2021-02-11 10:09:11 -05:00
|
|
|
import Vue from 'vue';
|
|
|
|
import VueApollo from 'vue-apollo';
|
|
|
|
import createDefaultClient from '~/lib/graphql';
|
2021-06-09 17:10:34 -04:00
|
|
|
import { parseBooleanDataAttributes } from '~/lib/utils/dom_utils';
|
2021-02-11 10:09:11 -05:00
|
|
|
import SecurityConfigurationApp from './components/app.vue';
|
2021-06-01 08:09:36 -04:00
|
|
|
import { securityFeatures, complianceFeatures } from './components/constants';
|
|
|
|
import { augmentFeatures } from './utils';
|
2021-12-10 01:10:22 -05:00
|
|
|
|
2021-08-06 20:09:01 -04:00
|
|
|
export const initSecurityConfiguration = (el) => {
|
|
|
|
if (!el) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2021-02-11 10:09:11 -05:00
|
|
|
Vue.use(VueApollo);
|
|
|
|
|
|
|
|
const apolloProvider = new VueApollo({
|
2022-02-16 13:14:47 -05:00
|
|
|
defaultClient: createDefaultClient(),
|
2021-02-11 10:09:11 -05:00
|
|
|
});
|
|
|
|
|
2021-06-09 17:10:34 -04:00
|
|
|
const {
|
2022-01-27 10:14:51 -05:00
|
|
|
projectFullPath,
|
2021-06-09 17:10:34 -04:00
|
|
|
upgradePath,
|
|
|
|
features,
|
|
|
|
latestPipelinePath,
|
|
|
|
gitlabCiHistoryPath,
|
2021-07-15 11:09:41 -04:00
|
|
|
autoDevopsHelpPagePath,
|
|
|
|
autoDevopsPath,
|
2021-06-09 17:10:34 -04:00
|
|
|
} = el.dataset;
|
2021-02-11 10:09:11 -05:00
|
|
|
|
2021-07-06 08:07:43 -04:00
|
|
|
const { augmentedSecurityFeatures, augmentedComplianceFeatures } = augmentFeatures(
|
|
|
|
securityFeatures,
|
|
|
|
complianceFeatures,
|
|
|
|
features ? JSON.parse(features) : [],
|
|
|
|
);
|
|
|
|
|
|
|
|
return new Vue({
|
|
|
|
el,
|
|
|
|
apolloProvider,
|
|
|
|
provide: {
|
2022-01-27 10:14:51 -05:00
|
|
|
projectFullPath,
|
2021-07-06 08:07:43 -04:00
|
|
|
upgradePath,
|
2021-07-15 11:09:41 -04:00
|
|
|
autoDevopsHelpPagePath,
|
|
|
|
autoDevopsPath,
|
2021-07-06 08:07:43 -04:00
|
|
|
},
|
|
|
|
render(createElement) {
|
2021-08-06 20:09:01 -04:00
|
|
|
return createElement(SecurityConfigurationApp, {
|
2021-07-06 08:07:43 -04:00
|
|
|
props: {
|
|
|
|
augmentedComplianceFeatures,
|
|
|
|
augmentedSecurityFeatures,
|
|
|
|
latestPipelinePath,
|
|
|
|
gitlabCiHistoryPath,
|
2021-07-15 11:09:41 -04:00
|
|
|
...parseBooleanDataAttributes(el, [
|
|
|
|
'gitlabCiPresent',
|
|
|
|
'autoDevopsEnabled',
|
|
|
|
'canEnableAutoDevops',
|
|
|
|
]),
|
2021-07-06 08:07:43 -04:00
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|