2021-03-11 19:13:27 +05:30
|
|
|
import Vue from 'vue';
|
|
|
|
import VueApollo from 'vue-apollo';
|
|
|
|
import createDefaultClient from '~/lib/graphql';
|
2021-09-04 01:27:46 +05:30
|
|
|
import { parseBooleanDataAttributes } from '~/lib/utils/dom_utils';
|
2021-03-11 19:13:27 +05:30
|
|
|
import SecurityConfigurationApp from './components/app.vue';
|
2021-09-04 01:27:46 +05:30
|
|
|
import { securityFeatures, complianceFeatures } from './components/constants';
|
|
|
|
import RedesignedSecurityConfigurationApp from './components/redesigned_app.vue';
|
|
|
|
import { augmentFeatures } from './utils';
|
2021-03-11 19:13:27 +05:30
|
|
|
|
|
|
|
export const initStaticSecurityConfiguration = (el) => {
|
|
|
|
if (!el) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
Vue.use(VueApollo);
|
|
|
|
|
|
|
|
const apolloProvider = new VueApollo({
|
|
|
|
defaultClient: createDefaultClient(),
|
|
|
|
});
|
|
|
|
|
2021-09-04 01:27:46 +05:30
|
|
|
const {
|
|
|
|
projectPath,
|
|
|
|
upgradePath,
|
|
|
|
features,
|
|
|
|
latestPipelinePath,
|
|
|
|
gitlabCiHistoryPath,
|
|
|
|
} = el.dataset;
|
2021-03-11 19:13:27 +05:30
|
|
|
|
2021-09-04 01:27:46 +05:30
|
|
|
if (gon.features.securityConfigurationRedesign) {
|
|
|
|
const { augmentedSecurityFeatures, augmentedComplianceFeatures } = augmentFeatures(
|
|
|
|
securityFeatures,
|
|
|
|
complianceFeatures,
|
|
|
|
features ? JSON.parse(features) : [],
|
|
|
|
);
|
|
|
|
|
|
|
|
return new Vue({
|
|
|
|
el,
|
|
|
|
apolloProvider,
|
|
|
|
provide: {
|
|
|
|
projectPath,
|
|
|
|
upgradePath,
|
|
|
|
},
|
|
|
|
render(createElement) {
|
|
|
|
return createElement(RedesignedSecurityConfigurationApp, {
|
|
|
|
props: {
|
|
|
|
augmentedComplianceFeatures,
|
|
|
|
augmentedSecurityFeatures,
|
|
|
|
latestPipelinePath,
|
|
|
|
gitlabCiHistoryPath,
|
|
|
|
...parseBooleanDataAttributes(el, ['gitlabCiPresent']),
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
2021-03-11 19:13:27 +05:30
|
|
|
return new Vue({
|
|
|
|
el,
|
|
|
|
apolloProvider,
|
|
|
|
provide: {
|
|
|
|
projectPath,
|
2021-04-17 20:07:23 +05:30
|
|
|
upgradePath,
|
2021-03-11 19:13:27 +05:30
|
|
|
},
|
|
|
|
render(createElement) {
|
|
|
|
return createElement(SecurityConfigurationApp);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|