debian-mirror-gitlab/app/assets/javascripts/behaviors/markdown/render_metrics.js

25 lines
620 B
JavaScript
Raw Normal View History

2019-10-12 21:52:04 +05:30
import Vue from 'vue';
import Metrics from '~/monitoring/components/embed.vue';
import { createStore } from '~/monitoring/stores';
2019-12-04 20:38:33 +05:30
// TODO: Handle copy-pasting - https://gitlab.com/gitlab-org/gitlab-foss/issues/64369.
2019-10-12 21:52:04 +05:30
export default function renderMetrics(elements) {
if (!elements.length) {
return;
}
elements.forEach(element => {
const { dashboardUrl } = element.dataset;
const MetricsComponent = Vue.extend(Metrics);
// eslint-disable-next-line no-new
new MetricsComponent({
el: element,
store: createStore(),
propsData: {
dashboardUrl,
},
});
});
}