debian-mirror-gitlab/app/assets/javascripts/feature_flags/index.js

52 lines
1.3 KiB
JavaScript
Raw Normal View History

2021-01-03 14:25:43 +05:30
import Vue from 'vue';
import Vuex from 'vuex';
import csrf from '~/lib/utils/csrf';
import FeatureFlagsComponent from './components/feature_flags.vue';
import createStore from './store/index';
Vue.use(Vuex);
export default () => {
const el = document.querySelector('#feature-flags-vue');
const {
projectName,
featureFlagsHelpPagePath,
errorStateSvgPath,
endpoint,
projectId,
unleashApiInstanceId,
rotateInstanceIdPath,
featureFlagsClientLibrariesHelpPagePath,
featureFlagsClientExampleHelpPagePath,
unleashApiUrl,
canUserAdminFeatureFlag,
newFeatureFlagPath,
newUserListPath,
featureFlagsLimitExceeded,
2021-06-08 01:23:25 +05:30
featureFlagsLimit,
2021-01-03 14:25:43 +05:30
} = el.dataset;
return new Vue({
el,
store: createStore({ endpoint, projectId, unleashApiInstanceId, rotateInstanceIdPath }),
provide: {
projectName,
featureFlagsHelpPagePath,
errorStateSvgPath,
featureFlagsClientLibrariesHelpPagePath,
featureFlagsClientExampleHelpPagePath,
unleashApiUrl,
csrfToken: csrf.token,
canUserConfigure: canUserAdminFeatureFlag !== undefined,
newFeatureFlagPath,
newUserListPath,
2021-06-08 01:23:25 +05:30
featureFlagsLimitExceeded: featureFlagsLimitExceeded !== undefined,
featureFlagsLimit,
2021-01-03 14:25:43 +05:30
},
render(createElement) {
return createElement(FeatureFlagsComponent);
},
});
};