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
Léo-Paul Géneau
gitlab-ce
Commits
8ec30e75
Commit
8ec30e75
authored
Jun 28, 2018
by
Jose
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add environments endpoint, also added store and service capabilities for said endpoint
parent
b80f819b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
7 deletions
+30
-7
app/assets/javascripts/monitoring/components/dashboard.vue
app/assets/javascripts/monitoring/components/dashboard.vue
+12
-5
app/assets/javascripts/monitoring/services/monitoring_service.js
...ets/javascripts/monitoring/services/monitoring_service.js
+13
-1
app/assets/javascripts/monitoring/stores/monitoring_store.js
app/assets/javascripts/monitoring/stores/monitoring_store.js
+4
-0
app/views/projects/environments/metrics.html.haml
app/views/projects/environments/metrics.html.haml
+1
-1
No files found.
app/assets/javascripts/monitoring/components/dashboard.vue
View file @
8ec30e75
...
...
@@ -80,6 +80,10 @@ export default {
type
:
String
,
required
:
true
,
},
environmentsEndpoint
:
{
type
:
String
,
required
:
true
,
},
},
data
()
{
return
{
...
...
@@ -96,6 +100,7 @@ export default {
this
.
service
=
new
MonitoringService
({
metricsEndpoint
:
this
.
metricsEndpoint
,
deploymentEndpoint
:
this
.
deploymentEndpoint
,
environmentsEndpoint
:
this
.
environmentsEndpoint
,
});
eventHub
.
$on
(
'
toggleAspectRatio
'
,
this
.
toggleAspectRatio
);
eventHub
.
$on
(
'
hoverChanged
'
,
this
.
hoverChanged
);
...
...
@@ -123,12 +128,17 @@ export default {
.
getDeploymentData
()
.
then
(
data
=>
this
.
store
.
storeDeploymentData
(
data
))
.
catch
(()
=>
new
Flash
(
'
Error getting deployment information.
'
)),
this
.
service
.
getEnvironmentsData
()
.
then
((
data
)
=>
this
.
store
.
storeEnvironmentsData
(
data
))
.
catch
(()
=>
new
Flash
(
'
Error getting environments information.
'
)),
])
.
then
(()
=>
{
if
(
this
.
store
.
groups
.
length
<
1
)
{
this
.
state
=
'
noData
'
;
return
;
}
// Populate the environments dropdown
this
.
showEmptyState
=
false
;
})
.
catch
(()
=>
{
...
...
@@ -170,12 +180,9 @@ export default {
<i
class=
"fa fa-chevron-down"
></i>
</button>
<div
class=
"dropdown-menu dropdown-menu-selectable dropdown-menu-drop-up"
>
<a
href=
"#"
class=
"dropdown-item"
>
<button
class=
"dropdown-item"
>
Staging
</
a
>
</
button
>
</div>
</div>
</div>
...
...
app/assets/javascripts/monitoring/services/monitoring_service.js
View file @
8ec30e75
...
...
@@ -23,9 +23,10 @@ function backOffRequest(makeRequestCallback) {
}
export
default
class
MonitoringService
{
constructor
({
metricsEndpoint
,
deploymentEndpoint
})
{
constructor
({
metricsEndpoint
,
deploymentEndpoint
,
environmentsEndpoint
})
{
this
.
metricsEndpoint
=
metricsEndpoint
;
this
.
deploymentEndpoint
=
deploymentEndpoint
;
this
.
environmentsEndpoint
=
environmentsEndpoint
;
}
getGraphsData
()
{
...
...
@@ -52,4 +53,15 @@ export default class MonitoringService {
return
response
.
deployments
;
});
}
getEnvironmentsData
()
{
return
axios
.
get
(
this
.
environmentsEndpoint
)
.
then
(
resp
=>
resp
.
data
)
.
then
((
response
)
=>
{
if
(
!
response
||
!
response
.
environments
)
{
throw
new
Error
(
'
There was an error fetching the environments data, please try again
'
);
}
return
response
.
environments
;
});
}
}
app/assets/javascripts/monitoring/stores/monitoring_store.js
View file @
8ec30e75
...
...
@@ -37,6 +37,10 @@ export default class MonitoringStore {
this
.
deploymentData
=
deploymentData
;
}
storeEnvironmentsData
(
environmentsData
=
[])
{
this
.
environmentsData
=
environmentsData
;
}
getMetricsCount
()
{
return
this
.
groups
.
reduce
((
count
,
group
)
=>
count
+
group
.
metrics
.
length
,
0
);
}
...
...
app/views/projects/environments/metrics.html.haml
View file @
8ec30e75
...
...
@@ -11,7 +11,7 @@
"empty-unable-to-connect-svg-path"
:
image_path
(
'illustrations/monitoring/unable_to_connect.svg'
),
"metrics-endpoint"
:
additional_metrics_project_environment_path
(
@project
,
@environment
,
format: :json
),
"deployment-endpoint"
:
project_environment_deployments_path
(
@project
,
@environment
,
format: :json
),
"environments"
:
project_environments_path
(
@project
,
format: :json
),
"environments
-endpoint
"
:
project_environments_path
(
@project
,
format: :json
),
"project-path"
:
project_path
(
@project
),
"tags-path"
:
project_tags_path
(
@project
),
"has-metrics"
:
"#{@environment.has_metrics?}"
}
}
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