summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/monitoring/monitoring_bundle.js
diff options
context:
space:
mode:
authorMike Greiling <mike@pixelcog.com>2018-02-22 00:07:58 -0600
committerMike Greiling <mike@pixelcog.com>2018-03-06 03:11:38 -0600
commit76b65bb2cd9d9fe082df448eea669f9cf0cbe066 (patch)
tree08bfb4bd13283216a2f44da269af8671f66a1644 /app/assets/javascripts/monitoring/monitoring_bundle.js
parent711d9c0b541f120612dac4317b78e54272a80429 (diff)
downloadgitlab-ce-76b65bb2cd9d9fe082df448eea669f9cf0cbe066.tar.gz
use proper dependency injection for monitoring dashboard component
Diffstat (limited to 'app/assets/javascripts/monitoring/monitoring_bundle.js')
-rw-r--r--app/assets/javascripts/monitoring/monitoring_bundle.js19
1 files changed, 15 insertions, 4 deletions
diff --git a/app/assets/javascripts/monitoring/monitoring_bundle.js b/app/assets/javascripts/monitoring/monitoring_bundle.js
index c3b0ef7e9ca..a9b608e4433 100644
--- a/app/assets/javascripts/monitoring/monitoring_bundle.js
+++ b/app/assets/javascripts/monitoring/monitoring_bundle.js
@@ -1,7 +1,18 @@
import Vue from 'vue';
import Dashboard from './components/dashboard.vue';
-export default () => new Vue({
- el: '#prometheus-graphs',
- render: createElement => createElement(Dashboard),
-});
+export default () => {
+ const el = document.querySelector('#prometheus-graphs');
+
+ if (el && el.dataset) {
+ // eslint-disable-next-line no-new
+ new Vue({
+ el,
+ render(createElement) {
+ return createElement(Dashboard, {
+ props: el.dataset,
+ });
+ },
+ });
+ }
+};