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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
236e752b
Commit
236e752b
authored
Jul 17, 2018
by
Jose Ivan Vargas
Committed by
Clement Ho
Jul 17, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve "Metrics drop down doesn't show all environment, some not clickable"
parent
2f16eab0
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
3 deletions
+30
-3
app/assets/javascripts/monitoring/stores/monitoring_store.js
app/assets/javascripts/monitoring/stores/monitoring_store.js
+7
-2
spec/javascripts/monitoring/mock_data.js
spec/javascripts/monitoring/mock_data.js
+17
-0
spec/javascripts/monitoring/monitoring_store_spec.js
spec/javascripts/monitoring/monitoring_store_spec.js
+6
-1
No files found.
app/assets/javascripts/monitoring/stores/monitoring_store.js
View file @
236e752b
import
_
from
'
underscore
'
;
function
sortMetrics
(
metrics
)
{
return
_
.
chain
(
metrics
).
sortBy
(
'
title
'
).
sortBy
(
'
weight
'
).
value
();
return
_
.
chain
(
metrics
)
.
sortBy
(
'
title
'
)
.
sortBy
(
'
weight
'
)
.
value
();
}
function
normalizeMetrics
(
metrics
)
{
...
...
@@ -39,7 +42,9 @@ export default class MonitoringStore {
}
storeEnvironmentsData
(
environmentsData
=
[])
{
this
.
environmentsData
=
environmentsData
;
this
.
environmentsData
=
environmentsData
.
filter
(
environment
=>
!!
environment
.
latest
.
last_deployment
,
);
}
getMetricsCount
()
{
...
...
spec/javascripts/monitoring/mock_data.js
View file @
236e752b
...
...
@@ -6561,6 +6561,9 @@ export const environmentData = [
folder_path
:
'
/root/hello-prometheus/environments/folders/production
'
,
created_at
:
'
2018-06-29T16:53:38.301Z
'
,
updated_at
:
'
2018-06-29T16:57:09.825Z
'
,
last_deployment
:
{
id
:
127
,
},
},
},
{
...
...
@@ -6580,6 +6583,20 @@ export const environmentData = [
folder_path
:
'
/root/hello-prometheus/environments/folders/review
'
,
created_at
:
'
2018-07-03T18:39:41.702Z
'
,
updated_at
:
'
2018-07-03T18:44:54.010Z
'
,
last_deployment
:
{
id
:
128
,
},
},
},
{
name
:
'
no-deployment
'
,
size
:
1
,
latest
:
{
id
:
36
,
name
:
'
no-deployment/noop-branch
'
,
state
:
'
available
'
,
created_at
:
'
2018-07-04T18:39:41.702Z
'
,
updated_at
:
'
2018-07-04T18:44:54.010Z
'
,
},
},
];
spec/javascripts/monitoring/monitoring_store_spec.js
View file @
236e752b
import
MonitoringStore
from
'
~/monitoring/stores/monitoring_store
'
;
import
MonitoringMock
,
{
deploymentData
}
from
'
./mock_data
'
;
import
MonitoringMock
,
{
deploymentData
,
environmentData
}
from
'
./mock_data
'
;
describe
(
'
MonitoringStore
'
,
function
()
{
this
.
store
=
new
MonitoringStore
();
...
...
@@ -21,4 +21,9 @@ describe('MonitoringStore', function () {
expect
(
this
.
store
.
deploymentData
.
length
).
toEqual
(
3
);
expect
(
typeof
this
.
store
.
deploymentData
[
0
]).
toEqual
(
'
object
'
);
});
it
(
'
only stores environment data that contains deployments
'
,
()
=>
{
this
.
store
.
storeEnvironmentsData
(
environmentData
);
expect
(
this
.
store
.
environmentsData
.
length
).
toEqual
(
2
);
});
});
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