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
76b65bb2
Commit
76b65bb2
authored
Feb 22, 2018
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use proper dependency injection for monitoring dashboard component
parent
711d9c0b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
23 deletions
+69
-23
app/assets/javascripts/monitoring/components/dashboard.vue
app/assets/javascripts/monitoring/components/dashboard.vue
+51
-17
app/assets/javascripts/monitoring/monitoring_bundle.js
app/assets/javascripts/monitoring/monitoring_bundle.js
+15
-4
app/views/projects/environments/metrics.html.haml
app/views/projects/environments/metrics.html.haml
+3
-2
No files found.
app/assets/javascripts/monitoring/components/dashboard.vue
View file @
76b65bb2
...
@@ -10,31 +10,64 @@
...
@@ -10,31 +10,64 @@
import
{
convertPermissionToBoolean
}
from
'
../../lib/utils/common_utils
'
;
import
{
convertPermissionToBoolean
}
from
'
../../lib/utils/common_utils
'
;
export
default
{
export
default
{
components
:
{
components
:
{
Graph
,
Graph
,
GraphGroup
,
GraphGroup
,
EmptyState
,
EmptyState
,
},
},
data
()
{
props
:
{
const
metricsData
=
document
.
querySelector
(
'
#prometheus-graphs
'
).
dataset
;
hasMetrics
:
{
const
store
=
new
MonitoringStore
();
type
:
String
,
required
:
true
,
},
documentationPath
:
{
type
:
String
,
required
:
true
,
},
settingsPath
:
{
type
:
String
,
required
:
true
,
},
clustersPath
:
{
type
:
String
,
required
:
true
,
},
tagsPath
:
{
type
:
String
,
required
:
true
,
},
projectPath
:
{
type
:
String
,
required
:
true
,
},
metricsEndpoint
:
{
type
:
String
,
required
:
true
,
},
deploymentEndpoint
:
{
type
:
String
,
required
:
false
,
default
:
null
,
},
emptyGettingStartedSvgPath
:
{
type
:
String
,
required
:
true
,
},
emptyLoadingSvgPath
:
{
type
:
String
,
required
:
true
,
},
emptyUnableToConnectSvgPath
:
{
type
:
String
,
required
:
true
,
},
},
data
()
{
return
{
return
{
store
,
store
:
new
MonitoringStore
()
,
state
:
'
gettingStarted
'
,
state
:
'
gettingStarted
'
,
hasMetrics
:
convertPermissionToBoolean
(
metricsData
.
hasMetrics
),
documentationPath
:
metricsData
.
documentationPath
,
settingsPath
:
metricsData
.
settingsPath
,
clustersPath
:
metricsData
.
clustersPath
,
tagsPath
:
metricsData
.
tagsPath
,
projectPath
:
metricsData
.
projectPath
,
metricsEndpoint
:
metricsData
.
additionalMetrics
,
deploymentEndpoint
:
metricsData
.
deploymentEndpoint
,
emptyGettingStartedSvgPath
:
metricsData
.
emptyGettingStartedSvgPath
,
emptyLoadingSvgPath
:
metricsData
.
emptyLoadingSvgPath
,
emptyUnableToConnectSvgPath
:
metricsData
.
emptyUnableToConnectSvgPath
,
showEmptyState
:
true
,
showEmptyState
:
true
,
updateAspectRatio
:
false
,
updateAspectRatio
:
false
,
updatedAspectRatios
:
0
,
updatedAspectRatios
:
0
,
...
@@ -60,13 +93,14 @@
...
@@ -60,13 +93,14 @@
mounted
()
{
mounted
()
{
this
.
resizeThrottled
=
_
.
throttle
(
this
.
resize
,
600
);
this
.
resizeThrottled
=
_
.
throttle
(
this
.
resize
,
600
);
if
(
!
this
.
hasMetrics
)
{
if
(
!
convertPermissionToBoolean
(
this
.
hasMetrics
)
)
{
this
.
state
=
'
gettingStarted
'
;
this
.
state
=
'
gettingStarted
'
;
}
else
{
}
else
{
this
.
getGraphsData
();
this
.
getGraphsData
();
window
.
addEventListener
(
'
resize
'
,
this
.
resizeThrottled
,
false
);
window
.
addEventListener
(
'
resize
'
,
this
.
resizeThrottled
,
false
);
}
}
},
},
methods
:
{
methods
:
{
getGraphsData
()
{
getGraphsData
()
{
this
.
state
=
'
loading
'
;
this
.
state
=
'
loading
'
;
...
...
app/assets/javascripts/monitoring/monitoring_bundle.js
View file @
76b65bb2
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
Dashboard
from
'
./components/dashboard.vue
'
;
import
Dashboard
from
'
./components/dashboard.vue
'
;
export
default
()
=>
new
Vue
({
export
default
()
=>
{
el
:
'
#prometheus-graphs
'
,
const
el
=
document
.
querySelector
(
'
#prometheus-graphs
'
);
render
:
createElement
=>
createElement
(
Dashboard
),
});
if
(
el
&&
el
.
dataset
)
{
// eslint-disable-next-line no-new
new
Vue
({
el
,
render
(
createElement
)
{
return
createElement
(
Dashboard
,
{
props
:
el
.
dataset
,
});
},
});
}
};
app/views/projects/environments/metrics.html.haml
View file @
76b65bb2
...
@@ -15,7 +15,8 @@
...
@@ -15,7 +15,8 @@
"empty-getting-started-svg-path"
:
image_path
(
'illustrations/monitoring/getting_started.svg'
),
"empty-getting-started-svg-path"
:
image_path
(
'illustrations/monitoring/getting_started.svg'
),
"empty-loading-svg-path"
:
image_path
(
'illustrations/monitoring/loading.svg'
),
"empty-loading-svg-path"
:
image_path
(
'illustrations/monitoring/loading.svg'
),
"empty-unable-to-connect-svg-path"
:
image_path
(
'illustrations/monitoring/unable_to_connect.svg'
),
"empty-unable-to-connect-svg-path"
:
image_path
(
'illustrations/monitoring/unable_to_connect.svg'
),
"additional-metrics"
:
additional_metrics_project_environment_path
(
@project
,
@environment
,
format: :json
),
"metrics-endpoint"
:
additional_metrics_project_environment_path
(
@project
,
@environment
,
format: :json
),
"deployment-endpoint"
:
project_environment_deployments_path
(
@project
,
@environment
,
format: :json
),
"project-path"
:
project_path
(
@project
),
"project-path"
:
project_path
(
@project
),
"tags-path"
:
project_tags_path
(
@project
),
"tags-path"
:
project_tags_path
(
@project
),
"has-metrics"
:
"#{@environment.has_metrics?}"
,
deployment_endpoint:
project_environment_deployments_path
(
@project
,
@environment
,
format: :json
)
}
}
"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