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
481d25bf
Commit
481d25bf
authored
Mar 20, 2019
by
Jose Vargas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add feature flag
Also added relevant tests that make use of a stubbed feature flag, prettified files
parent
268b727a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
14 deletions
+29
-14
app/assets/javascripts/monitoring/components/dashboard.vue
app/assets/javascripts/monitoring/components/dashboard.vue
+11
-4
app/assets/javascripts/monitoring/services/monitoring_service.js
...ets/javascripts/monitoring/services/monitoring_service.js
+7
-5
app/assets/javascripts/monitoring/utils.js
app/assets/javascripts/monitoring/utils.js
+3
-3
spec/javascripts/monitoring/dashboard_spec.js
spec/javascripts/monitoring/dashboard_spec.js
+8
-2
No files found.
app/assets/javascripts/monitoring/components/dashboard.vue
View file @
481d25bf
...
...
@@ -99,6 +99,11 @@ export default {
selectedTimeWindow
:
''
,
};
},
computed
:
{
getTimeWindowFlagStatus
()
{
return
gon
.
features
.
metricsTimeWindow
;
},
},
created
()
{
this
.
service
=
new
MonitoringService
({
metricsEndpoint
:
this
.
metricsEndpoint
,
...
...
@@ -201,7 +206,10 @@ export default {
<
template
>
<div
v-if=
"!showEmptyState"
class=
"prometheus-graphs prepend-top-default"
>
<div
v-if=
"environmentsEndpoint"
class=
"environments d-flex align-items-center"
>
<div
v-if=
"environmentsEndpoint"
class=
"dropdowns d-flex align-items-center justify-content-between"
>
<div
class=
"d-flex align-items-center"
>
<strong>
{{
s__
(
'
Metrics|Environment
'
)
}}
</strong>
<gl-dropdown
...
...
@@ -219,11 +227,10 @@ export default {
>
</gl-dropdown>
</div>
<div
class=
"d-flex align-items-center
"
>
<div
v-if=
"getTimeWindowFlagStatus"
class=
"d-flex align-items-center float-right
"
>
<span
class=
"font-weight-bold"
>
{{
s__
(
'
Metrics|Show Last
'
)
}}
</span>
<gl-dropdown
id=
"time-window-dropdown"
class=
"prepend-left-10"
class=
"prepend-left-10 js-time-window-dropdown"
toggle-class=
"dropdown-menu-toggle"
:text=
"selectedTimeWindow"
>
...
...
app/assets/javascripts/monitoring/services/monitoring_service.js
View file @
481d25bf
...
...
@@ -33,11 +33,13 @@ export default class MonitoringService {
}
getGraphsData
(
params
=
{})
{
return
backOffRequest
(()
=>
axios
.
get
(
this
.
metricsEndpoint
,
{
return
backOffRequest
(()
=>
axios
.
get
(
this
.
metricsEndpoint
,
{
params
:
{
...
params
}
}))
...
params
,
},
}),
)
.
then
(
resp
=>
resp
.
data
)
.
then
(
response
=>
{
if
(
!
response
||
!
response
.
data
||
!
response
.
success
)
{
...
...
app/assets/javascripts/monitoring/utils.js
View file @
481d25bf
import
{
timeWindows
}
from
'
./constants
'
import
{
timeWindows
}
from
'
./constants
'
;
export
const
getTimeDifferenceMinutes
=
(
timeWindow
)
=>
{
export
const
getTimeDifferenceMinutes
=
timeWindow
=>
{
let
timeDifferenceMinutes
;
switch
(
timeWindow
)
{
switch
(
timeWindow
)
{
case
timeWindows
.
thirtyMinutes
:
timeDifferenceMinutes
=
30
;
break
;
...
...
spec/javascripts/monitoring/dashboard_spec.js
View file @
481d25bf
...
...
@@ -39,11 +39,17 @@ describe('Dashboard', () => {
ee
:
false
,
};
gon
.
features
=
{
metricsTimeWindow
:
true
,
};
mock
=
new
MockAdapter
(
axios
);
DashboardComponent
=
Vue
.
extend
(
Dashboard
);
});
afterEach
(()
=>
{
gon
.
features
=
{};
mock
.
restore
();
});
...
...
@@ -186,9 +192,9 @@ describe('Dashboard', () => {
const
numberOfTimeWindows
=
Object
.
keys
(
timeWindows
).
length
;
setTimeout
(()
=>
{
const
timeWindowDropdown
=
component
.
$el
.
querySelector
(
'
#
time-window-dropdown
'
);
const
timeWindowDropdown
=
component
.
$el
.
querySelector
(
'
.js-
time-window-dropdown
'
);
const
timeWindowDropdownEls
=
component
.
$el
.
querySelectorAll
(
'
#
time-window-dropdown .dropdown-item
'
,
'
.js-
time-window-dropdown .dropdown-item
'
,
);
expect
(
timeWindowDropdown
).
not
.
toBeNull
();
...
...
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