debian-mirror-gitlab/app/assets/javascripts/monitoring/monitoring_bundle.js

41 lines
1.2 KiB
JavaScript
Raw Normal View History

2017-09-10 17:25:29 +05:30
import Vue from 'vue';
2019-10-12 21:52:04 +05:30
import { GlToast } from '@gitlab/ui';
2019-02-15 15:39:39 +05:30
import { parseBoolean } from '~/lib/utils/common_utils';
2019-09-30 21:07:59 +05:30
import { getParameterValues } from '~/lib/utils/url_utility';
2019-07-07 11:18:12 +05:30
import Dashboard from 'ee_else_ce/monitoring/components/dashboard.vue';
2019-09-04 21:01:54 +05:30
import store from './stores';
2017-08-17 22:00:37 +05:30
2019-10-12 21:52:04 +05:30
Vue.use(GlToast);
2019-07-07 11:18:12 +05:30
export default (props = {}) => {
2018-03-27 19:54:05 +05:30
const el = document.getElementById('prometheus-graphs');
if (el && el.dataset) {
2019-09-30 21:07:59 +05:30
if (gon.features) {
store.dispatch('monitoringDashboard/setFeatureFlags', {
prometheusEndpointEnabled: gon.features.environmentMetricsUsePrometheusEndpoint,
multipleDashboardsEnabled: gon.features.environmentMetricsShowMultipleDashboards,
additionalPanelTypesEnabled: gon.features.environmentMetricsAdditionalPanelTypes,
});
}
const [currentDashboard] = getParameterValues('dashboard');
2019-09-04 21:01:54 +05:30
2018-03-27 19:54:05 +05:30
// eslint-disable-next-line no-new
new Vue({
el,
2019-09-04 21:01:54 +05:30
store,
2018-03-27 19:54:05 +05:30
render(createElement) {
return createElement(Dashboard, {
props: {
...el.dataset,
2019-09-30 21:07:59 +05:30
currentDashboard,
2019-02-15 15:39:39 +05:30
hasMetrics: parseBoolean(el.dataset.hasMetrics),
2019-07-07 11:18:12 +05:30
...props,
2018-03-27 19:54:05 +05:30
},
});
},
});
}
};