debian-mirror-gitlab/app/assets/javascripts/custom_metrics/index.js
2020-04-22 19:07:51 +05:30

47 lines
1.1 KiB
JavaScript

import Vue from 'vue';
import { parseBoolean } from '~/lib/utils/common_utils';
import CustomMetricsForm from './components/custom_metrics_form.vue';
export default () => {
// eslint-disable-next-line no-new
new Vue({
el: '#js-custom-metrics',
components: {
CustomMetricsForm,
},
render(createElement) {
const domEl = document.querySelector(this.$options.el);
const {
customMetricsPath,
editProjectServicePath,
validateQueryPath,
title,
query,
yLabel,
unit,
group,
legend,
} = domEl.dataset;
let { metricPersisted } = domEl.dataset;
metricPersisted = parseBoolean(metricPersisted);
return createElement('custom-metrics-form', {
props: {
customMetricsPath,
metricPersisted,
editProjectServicePath,
validateQueryPath,
formData: {
title,
query,
yLabel,
unit,
group,
legend,
},
},
});
},
});
};