63 lines
1.5 KiB
JavaScript
63 lines
1.5 KiB
JavaScript
import Vue from 'vue';
|
|
import VueApollo from 'vue-apollo';
|
|
import createDefaultClient from '~/lib/graphql';
|
|
import { parseBooleanDataAttributes } from '~/lib/utils/dom_utils';
|
|
import SecurityConfigurationApp from './components/app.vue';
|
|
import { securityFeatures } from './components/constants';
|
|
import { augmentFeatures } from './utils';
|
|
|
|
export const initSecurityConfiguration = (el) => {
|
|
if (!el) {
|
|
return null;
|
|
}
|
|
|
|
Vue.use(VueApollo);
|
|
|
|
const apolloProvider = new VueApollo({
|
|
defaultClient: createDefaultClient(),
|
|
});
|
|
|
|
const {
|
|
projectFullPath,
|
|
upgradePath,
|
|
features,
|
|
latestPipelinePath,
|
|
gitlabCiHistoryPath,
|
|
autoDevopsHelpPagePath,
|
|
autoDevopsPath,
|
|
vulnerabilityTrainingDocsPath,
|
|
} = el.dataset;
|
|
|
|
const { augmentedSecurityFeatures } = augmentFeatures(
|
|
securityFeatures,
|
|
features ? JSON.parse(features) : [],
|
|
);
|
|
|
|
return new Vue({
|
|
el,
|
|
apolloProvider,
|
|
name: 'SecurityConfigurationRoot',
|
|
provide: {
|
|
projectFullPath,
|
|
upgradePath,
|
|
autoDevopsHelpPagePath,
|
|
autoDevopsPath,
|
|
vulnerabilityTrainingDocsPath,
|
|
},
|
|
render(createElement) {
|
|
return createElement(SecurityConfigurationApp, {
|
|
props: {
|
|
augmentedSecurityFeatures,
|
|
latestPipelinePath,
|
|
gitlabCiHistoryPath,
|
|
...parseBooleanDataAttributes(el, [
|
|
'gitlabCiPresent',
|
|
'autoDevopsEnabled',
|
|
'canEnableAutoDevops',
|
|
'securityTrainingEnabled',
|
|
]),
|
|
},
|
|
});
|
|
},
|
|
});
|
|
};
|