Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
37a65459
Commit
37a65459
authored
May 05, 2021
by
Nathan Friend
Committed by
Natalia Tepluhina
May 05, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move group-level release stats into tab
parent
05c87a33
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
102 additions
and
5 deletions
+102
-5
app/assets/stylesheets/utilities.scss
app/assets/stylesheets/utilities.scss
+7
-0
ee/app/assets/javascripts/analytics/group_ci_cd_analytics/components/app.vue
...cripts/analytics/group_ci_cd_analytics/components/app.vue
+33
-1
ee/app/assets/javascripts/analytics/group_ci_cd_analytics/components/release_stats_card.vue
...s/group_ci_cd_analytics/components/release_stats_card.vue
+1
-1
ee/app/assets/javascripts/analytics/group_ci_cd_analytics/constants.js
.../javascripts/analytics/group_ci_cd_analytics/constants.js
+2
-0
ee/changelogs/unreleased/nfriend-put-release-stats-in-tab.yml
...hangelogs/unreleased/nfriend-put-release-stats-in-tab.yml
+5
-0
ee/spec/frontend/analytics/group_ci_cd_analytics/components/app_spec.js
...nd/analytics/group_ci_cd_analytics/components/app_spec.js
+51
-3
locale/gitlab.pot
locale/gitlab.pot
+3
-0
No files found.
app/assets/stylesheets/utilities.scss
View file @
37a65459
...
@@ -182,3 +182,10 @@
...
@@ -182,3 +182,10 @@
.gl-mb-n3
{
.gl-mb-n3
{
margin-bottom
:
-
$gl-spacing-scale-3
;
margin-bottom
:
-
$gl-spacing-scale-3
;
}
}
// Will be moved to @gitlab/ui in https://gitlab.com/gitlab-org/gitlab-ui/-/issues/1408
$gl-line-height-42
:
px-to-rem
(
42px
);
.gl-line-height-42
{
line-height
:
$gl-line-height-42
;
}
ee/app/assets/javascripts/analytics/group_ci_cd_analytics/components/app.vue
View file @
37a65459
<
script
>
<
script
>
import
{
GlTabs
,
GlTab
}
from
'
@gitlab/ui
'
;
import
{
mergeUrlParams
,
updateHistory
,
getParameterValues
}
from
'
~/lib/utils/url_utility
'
;
import
{
TABS
}
from
'
../constants
'
;
import
ReleaseStatsCard
from
'
./release_stats_card.vue
'
;
import
ReleaseStatsCard
from
'
./release_stats_card.vue
'
;
export
default
{
export
default
{
name
:
'
CiCdAnalyticsApp
'
,
name
:
'
CiCdAnalyticsApp
'
,
components
:
{
components
:
{
ReleaseStatsCard
,
ReleaseStatsCard
,
GlTabs
,
GlTab
,
},
data
()
{
return
{
selectedTabIndex
:
0
,
};
},
created
()
{
this
.
selectTab
();
window
.
addEventListener
(
'
popstate
'
,
this
.
selectTab
);
},
methods
:
{
selectTab
()
{
const
[
tabQueryParam
]
=
getParameterValues
(
'
tab
'
);
const
tabIndex
=
TABS
.
indexOf
(
tabQueryParam
);
this
.
selectedTabIndex
=
tabIndex
>=
0
?
tabIndex
:
0
;
},
onTabChange
(
newIndex
)
{
if
(
newIndex
!==
this
.
selectedTabIndex
)
{
this
.
selectedTabIndex
=
newIndex
;
const
path
=
mergeUrlParams
({
tab
:
TABS
[
newIndex
]
},
window
.
location
.
pathname
);
updateHistory
({
url
:
path
,
title
:
window
.
title
});
}
},
},
},
};
};
</
script
>
</
script
>
<
template
>
<
template
>
<div>
<div>
<gl-tabs
:value=
"selectedTabIndex"
@
input=
"onTabChange"
>
<gl-tab
:title=
"s__('CICDAnalytics|Release statistics')"
>
<release-stats-card
class=
"gl-mt-5"
/>
<release-stats-card
class=
"gl-mt-5"
/>
</gl-tab>
</gl-tabs>
</div>
</div>
</
template
>
</
template
>
ee/app/assets/javascripts/analytics/group_ci_cd_analytics/components/release_stats_card.vue
View file @
37a65459
...
@@ -115,7 +115,7 @@ export default {
...
@@ -115,7 +115,7 @@ export default {
<rect
x=
"50"
y=
"94"
rx=
"3"
ry=
"3"
width=
"300"
height=
"31"
/>
<rect
x=
"50"
y=
"94"
rx=
"3"
ry=
"3"
width=
"300"
height=
"31"
/>
</gl-skeleton-loader>
</gl-skeleton-loader>
<
template
v-else
>
<
template
v-else
>
<span
class=
"gl-font-size-h-display"
>
{{
stat
.
stat
}}
</span>
<span
class=
"gl-font-size-h-display
gl-line-height-42
"
>
{{
stat
.
stat
}}
</span>
{{
stat
.
title
}}
{{
stat
.
title
}}
</
template
>
</
template
>
</div>
</div>
...
...
ee/app/assets/javascripts/analytics/group_ci_cd_analytics/constants.js
View file @
37a65459
export
const
STAT_ERROR_PLACEHOLDER
=
'
-
'
;
export
const
STAT_ERROR_PLACEHOLDER
=
'
-
'
;
export
const
TABS
=
[
'
release-statistics
'
];
ee/changelogs/unreleased/nfriend-put-release-stats-in-tab.yml
0 → 100644
View file @
37a65459
---
title
:
Move group-level release statistics into tab
merge_request
:
60749
author
:
type
:
changed
ee/spec/frontend/analytics/group_ci_cd_analytics/components/app_spec.js
View file @
37a65459
import
{
GlTabs
,
GlTab
}
from
'
@gitlab/ui
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
CiCdAnalyticsApp
from
'
ee/analytics/group_ci_cd_analytics/components/app.vue
'
;
import
CiCdAnalyticsApp
from
'
ee/analytics/group_ci_cd_analytics/components/app.vue
'
;
import
ReleaseStatsCard
from
'
ee/analytics/group_ci_cd_analytics/components/release_stats_card.vue
'
;
import
ReleaseStatsCard
from
'
ee/analytics/group_ci_cd_analytics/components/release_stats_card.vue
'
;
import
setWindowLocation
from
'
helpers/set_window_location_helper
'
;
import
{
TEST_HOST
}
from
'
helpers/test_constants
'
;
import
{
getParameterValues
}
from
'
~/lib/utils/url_utility
'
;
jest
.
mock
(
'
~/lib/utils/url_utility
'
);
describe
(
'
ee/analytics/group_ci_cd_analytics/components/app.vue
'
,
()
=>
{
describe
(
'
ee/analytics/group_ci_cd_analytics/components/app.vue
'
,
()
=>
{
let
wrapper
;
let
wrapper
;
beforeEach
(()
=>
{
getParameterValues
.
mockReturnValue
([]);
});
const
createComponent
=
()
=>
{
const
createComponent
=
()
=>
{
wrapper
=
shallowMount
(
CiCdAnalyticsApp
);
wrapper
=
shallowMount
(
CiCdAnalyticsApp
);
};
};
it
(
'
renders the release stats card
'
,
()
=>
{
const
findGlTabs
=
()
=>
wrapper
.
findComponent
(
GlTabs
);
const
findAllGlTabs
=
()
=>
wrapper
.
findAllComponents
(
GlTab
);
const
findGlTabAtIndex
=
(
index
)
=>
findAllGlTabs
().
at
(
index
);
describe
(
'
tabs
'
,
()
=>
{
beforeEach
(()
=>
{
createComponent
();
createComponent
();
expect
(
wrapper
.
find
(
ReleaseStatsCard
).
exists
()).
toBe
(
true
);
});
it
(
'
renders tabs in the correct order
'
,
()
=>
{
expect
(
findGlTabs
().
exists
()).
toBe
(
true
);
expect
(
findGlTabAtIndex
(
0
).
attributes
(
'
title
'
)).
toBe
(
'
Release statistics
'
);
});
});
describe
(
'
release statistics
'
,
()
=>
{
beforeEach
(()
=>
{
createComponent
();
});
it
(
'
renders the release statistics component inside the first tab
'
,
()
=>
{
expect
(
findGlTabAtIndex
(
0
).
find
(
ReleaseStatsCard
).
exists
()).
toBe
(
true
);
});
});
describe
(
'
when provided with a query param
'
,
()
=>
{
it
.
each
`
tab | index
${
'
release-statistics
'
}
|
${
'
0
'
}
${
'
fake
'
}
|
${
'
0
'
}
${
''
}
|
${
'
0
'
}
`
(
'
shows the correct tab for URL parameter "$tab"
'
,
({
tab
,
index
})
=>
{
setWindowLocation
(
`
${
TEST_HOST
}
/groups/gitlab-org/gitlab/-/analytics/ci_cd?tab=
${
tab
}
`
);
getParameterValues
.
mockImplementation
((
name
)
=>
{
expect
(
name
).
toBe
(
'
tab
'
);
return
tab
?
[
tab
]
:
[];
});
createComponent
();
expect
(
findGlTabs
().
attributes
(
'
value
'
)).
toBe
(
index
);
});
});
});
});
});
locale/gitlab.pot
View file @
37a65459
...
@@ -5597,6 +5597,9 @@ msgid_plural "CICDAnalytics|Releases"
...
@@ -5597,6 +5597,9 @@ msgid_plural "CICDAnalytics|Releases"
msgstr[0] ""
msgstr[0] ""
msgstr[1] ""
msgstr[1] ""
msgid "CICDAnalytics|Release statistics"
msgstr ""
msgid "CICDAnalytics|Releases"
msgid "CICDAnalytics|Releases"
msgstr ""
msgstr ""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment