2021-11-18 22:05:49 +05:30
|
|
|
import Vue from 'vue';
|
|
|
|
import { parseBoolean } from '~/lib/utils/common_utils';
|
|
|
|
import { mergeUrlParams } from '~/lib/utils/url_utility';
|
2021-03-11 19:13:27 +05:30
|
|
|
import ProjectsList from '~/projects_list';
|
2021-11-18 22:05:49 +05:30
|
|
|
import NamespaceSelect from './components/namespace_select.vue';
|
2020-07-28 23:09:34 +05:30
|
|
|
|
2021-04-17 20:07:23 +05:30
|
|
|
new ProjectsList(); // eslint-disable-line no-new
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2021-11-18 22:05:49 +05:30
|
|
|
function mountNamespaceSelect() {
|
|
|
|
const el = document.querySelector('.js-namespace-select');
|
|
|
|
if (!el) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
const { showAny, fieldName, placeholder, updateLocation } = el.dataset;
|
|
|
|
|
|
|
|
return new Vue({
|
|
|
|
el,
|
|
|
|
render(createComponent) {
|
|
|
|
return createComponent(NamespaceSelect, {
|
|
|
|
props: {
|
|
|
|
showAny: parseBoolean(showAny),
|
|
|
|
fieldName,
|
|
|
|
placeholder,
|
|
|
|
},
|
|
|
|
on: {
|
|
|
|
setNamespace(newNamespace) {
|
|
|
|
if (fieldName && updateLocation) {
|
|
|
|
window.location = mergeUrlParams({ [fieldName]: newNamespace }, window.location.href);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
mountNamespaceSelect();
|