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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

64 lines
1.5 KiB
JavaScript
Raw Normal View History

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 { augmentFeatures } from './utils';
2022-01-26 12:08:38 +05:30
2021-10-27 15:23:28 +05:30
export const initSecurityConfiguration = (el) => {
if (!el) {
return null;
}
2021-03-11 19:13:27 +05:30
Vue.use(VueApollo);
const apolloProvider = new VueApollo({
2022-04-04 11:22:00 +05:30
defaultClient: createDefaultClient(),
2021-03-11 19:13:27 +05:30
});
2021-09-04 01:27:46 +05:30
const {
2022-04-04 11:22:00 +05:30
projectFullPath,
2021-09-04 01:27:46 +05:30
upgradePath,
features,
latestPipelinePath,
gitlabCiHistoryPath,
2021-09-30 23:02:18 +05:30
autoDevopsHelpPagePath,
autoDevopsPath,
2022-06-21 17:19:12 +05:30
vulnerabilityTrainingDocsPath,
2021-09-04 01:27:46 +05:30
} = el.dataset;
2021-03-11 19:13:27 +05:30
2021-09-30 23:02:18 +05:30
const { augmentedSecurityFeatures, augmentedComplianceFeatures } = augmentFeatures(
securityFeatures,
complianceFeatures,
features ? JSON.parse(features) : [],
);
return new Vue({
el,
apolloProvider,
provide: {
2022-04-04 11:22:00 +05:30
projectFullPath,
2021-09-30 23:02:18 +05:30
upgradePath,
autoDevopsHelpPagePath,
autoDevopsPath,
2022-06-21 17:19:12 +05:30
vulnerabilityTrainingDocsPath,
2021-09-30 23:02:18 +05:30
},
render(createElement) {
2021-10-27 15:23:28 +05:30
return createElement(SecurityConfigurationApp, {
2021-09-30 23:02:18 +05:30
props: {
augmentedComplianceFeatures,
augmentedSecurityFeatures,
latestPipelinePath,
gitlabCiHistoryPath,
...parseBooleanDataAttributes(el, [
'gitlabCiPresent',
'autoDevopsEnabled',
'canEnableAutoDevops',
]),
},
});
},
});
};