2020-04-22 19:07:51 +05:30
|
|
|
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,
|
2022-07-23 23:45:48 +05:30
|
|
|
editIntegrationPath,
|
2020-04-22 19:07:51 +05:30
|
|
|
validateQueryPath,
|
|
|
|
title,
|
|
|
|
query,
|
|
|
|
yLabel,
|
|
|
|
unit,
|
|
|
|
group,
|
|
|
|
legend,
|
|
|
|
} = domEl.dataset;
|
|
|
|
let { metricPersisted } = domEl.dataset;
|
|
|
|
|
|
|
|
metricPersisted = parseBoolean(metricPersisted);
|
|
|
|
|
|
|
|
return createElement('custom-metrics-form', {
|
|
|
|
props: {
|
|
|
|
customMetricsPath,
|
|
|
|
metricPersisted,
|
2022-07-23 23:45:48 +05:30
|
|
|
editIntegrationPath,
|
2020-04-22 19:07:51 +05:30
|
|
|
validateQueryPath,
|
|
|
|
formData: {
|
|
|
|
title,
|
|
|
|
query,
|
|
|
|
yLabel,
|
|
|
|
unit,
|
|
|
|
group,
|
|
|
|
legend,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|