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

62 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';
2021-03-11 19:13:27 +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({
2021-10-27 15:23:28 +05:30
defaultClient: createDefaultClient({}, { assumeImmutableResults: true }),
2021-03-11 19:13:27 +05:30
});
2021-09-04 01:27:46 +05:30
const {
projectPath,
upgradePath,
features,
latestPipelinePath,
gitlabCiHistoryPath,
2021-09-30 23:02:18 +05:30
autoDevopsHelpPagePath,
autoDevopsPath,
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: {
projectPath,
upgradePath,
autoDevopsHelpPagePath,
autoDevopsPath,
},
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',
]),
},
});
},
});
};