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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

34 lines
755 B
JavaScript
Raw Normal View History

2023-03-04 22:38:38 +05:30
import Vue from 'vue';
import { darkModeEnabled } from '~/lib/utils/color_utils';
import { setUrlParams } from '~/lib/utils/url_utility';
export function getFrameSrc(url) {
return `${setUrlParams({ theme: darkModeEnabled() ? 'dark' : 'light' }, url)}&kiosk`;
}
const mountVueComponent = (element) => {
const url = [element.dataset.frameUrl];
return new Vue({
el: element,
render(h) {
return h('iframe', {
style: {
height: '366px',
width: '768px',
},
attrs: {
src: getFrameSrc(url),
frameBorder: '0',
},
});
},
});
};
export default function renderObservability(elements) {
elements.forEach((element) => {
mountVueComponent(element);
});
}