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
582bb324
Commit
582bb324
authored
Jan 06, 2021
by
Martin Wortschack
Committed by
Miguel Rincon
Jan 06, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deep link to DevOps Adoption tab
- Mark tab as active based on presence of tab query param
parent
f8971bea
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
4 deletions
+54
-4
ee/app/assets/javascripts/admin/dev_ops_report/tabs.js
ee/app/assets/javascripts/admin/dev_ops_report/tabs.js
+23
-0
ee/app/assets/javascripts/pages/admin/dev_ops_report/show/index.js
...sets/javascripts/pages/admin/dev_ops_report/show/index.js
+3
-0
ee/app/views/admin/dev_ops_report/_devops_tabs.html.haml
ee/app/views/admin/dev_ops_report/_devops_tabs.html.haml
+4
-4
ee/spec/features/admin/admin_dev_ops_report_spec.rb
ee/spec/features/admin/admin_dev_ops_report_spec.rb
+24
-0
No files found.
ee/app/assets/javascripts/admin/dev_ops_report/tabs.js
0 → 100644
View file @
582bb324
import
{
historyPushState
}
from
'
~/lib/utils/common_utils
'
;
import
{
mergeUrlParams
}
from
'
~/lib/utils/url_utility
'
;
const
DEVOPS_ADOPTION_PANE
=
'
devops-adoption
'
;
const
tabClickHandler
=
(
e
)
=>
{
const
{
hash
}
=
e
.
currentTarget
;
const
tab
=
hash
===
`#
${
DEVOPS_ADOPTION_PANE
}
`
?
DEVOPS_ADOPTION_PANE
:
null
;
const
newUrl
=
mergeUrlParams
({
tab
},
window
.
location
.
href
);
historyPushState
(
newUrl
);
};
const
initTabs
=
()
=>
{
const
tabLinks
=
document
.
querySelectorAll
(
'
.js-devops-tab-item a
'
);
if
(
tabLinks
.
length
)
{
tabLinks
.
forEach
((
tabLink
)
=>
{
tabLink
.
addEventListener
(
'
click
'
,
(
e
)
=>
tabClickHandler
(
e
));
});
}
};
export
default
initTabs
;
ee/app/assets/javascripts/pages/admin/dev_ops_report/show/index.js
0 → 100644
View file @
582bb324
import
initTabs
from
'
ee/admin/dev_ops_report/tabs
'
;
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
initTabs
());
ee/app/views/admin/dev_ops_report/_devops_tabs.html.haml
View file @
582bb324
%h2
%h2
=
_
(
'DevOps Report'
)
=
_
(
'DevOps Report'
)
%ul
.nav-links.nav-tabs.nav.js-devops-tabs
{
role:
'tablist'
}
%ul
.nav-links.nav-tabs.nav.js-devops-tabs
{
role:
'tablist'
}
=
render
'tab'
,
active:
true
,
title:
s_
(
'DevopsReport|DevOps Score'
),
target:
'#devops_score_pan
e'
=
render
'tab'
,
active:
params
[
:tab
]
!=
'devops-adoption'
,
title:
s_
(
'DevopsReport|DevOps Score'
),
target:
'#devops-scor
e'
=
render
'tab'
,
active:
false
,
title:
s_
(
'DevopsReport|Adoption'
),
target:
'#devops_adoption_pane
'
=
render
'tab'
,
active:
params
[
:tab
]
==
'devops-adoption'
,
title:
s_
(
'DevopsReport|Adoption'
),
target:
'#devops-adoption
'
.tab-content
.tab-content
.tab-pane
.active
#devops_score_pane
.tab-pane
{
id:
'devops-score'
,
class:
(
'active'
if
params
[
:tab
]
!=
'devops-adoption'
)
}
=
render_ce
'admin/dev_ops_report/report'
=
render_ce
'admin/dev_ops_report/report'
.tab-pane
#devops_adoption_pane
.tab-pane
{
id:
'devops-adoption'
,
class:
(
'active'
if
params
[
:tab
]
==
'devops-adoption'
)
}
.js-devops-adoption
{
data:
{
empty_state_svg_path:
image_path
(
'illustrations/monitoring/getting_started.svg'
)
}
}
.js-devops-adoption
{
data:
{
empty_state_svg_path:
image_path
(
'illustrations/monitoring/getting_started.svg'
)
}
}
ee/spec/features/admin/admin_dev_ops_report_spec.rb
View file @
582bb324
...
@@ -63,6 +63,30 @@ RSpec.describe 'DevOps Report page', :js do
...
@@ -63,6 +63,30 @@ RSpec.describe 'DevOps Report page', :js do
end
end
end
end
it
'does not add the tab param when the DevOps Score tab is selected'
do
visit
admin_dev_ops_report_path
click_link
'DevOps Score'
expect
(
page
).
to
have_current_path
(
admin_dev_ops_report_path
)
end
it
'adds the ?tab=devops-adoption param when the Adoption tab is selected'
do
visit
admin_dev_ops_report_path
click_link
'Adoption'
expect
(
page
).
to
have_current_path
(
admin_dev_ops_report_path
(
tab:
'devops-adoption'
))
end
it
'shows the devops adoption tab when the tab param is set'
do
visit
admin_dev_ops_report_path
(
tab:
'devops-adoption'
)
within
tabs_selector
do
expect
(
page
).
to
have_selector
active_tab_selector
,
text:
'Adoption'
end
end
context
'the devops score tab'
do
context
'the devops score tab'
do
it
'has dismissable intro callout'
do
it
'has dismissable intro callout'
do
visit
admin_dev_ops_report_path
visit
admin_dev_ops_report_path
...
...
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