2017-08-17 22:00:37 +05:30
|
|
|
import Vue from 'vue';
|
2020-11-24 15:15:51 +05:30
|
|
|
import VueApollo from 'vue-apollo';
|
2021-03-11 19:13:27 +05:30
|
|
|
import createDefaultClient from '~/lib/graphql';
|
2019-02-15 15:39:39 +05:30
|
|
|
import { parseBoolean } from '../lib/utils/common_utils';
|
2018-03-17 18:26:18 +05:30
|
|
|
import Translate from '../vue_shared/translate';
|
2021-03-11 19:13:27 +05:30
|
|
|
import environmentsComponent from './components/environments_app.vue';
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
Vue.use(Translate);
|
2020-11-24 15:15:51 +05:30
|
|
|
Vue.use(VueApollo);
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2020-11-24 15:15:51 +05:30
|
|
|
const apolloProvider = new VueApollo({
|
|
|
|
defaultClient: createDefaultClient(),
|
|
|
|
});
|
|
|
|
|
|
|
|
export default () => {
|
|
|
|
const el = document.getElementById('environments-list-view');
|
|
|
|
return new Vue({
|
|
|
|
el,
|
2018-12-13 13:39:08 +05:30
|
|
|
components: {
|
|
|
|
environmentsComponent,
|
|
|
|
},
|
2020-11-24 15:15:51 +05:30
|
|
|
apolloProvider,
|
|
|
|
provide: {
|
|
|
|
projectPath: el.dataset.projectPath,
|
2021-04-29 21:17:54 +05:30
|
|
|
defaultBranchName: el.dataset.defaultBranchName,
|
2020-11-24 15:15:51 +05:30
|
|
|
},
|
2018-12-13 13:39:08 +05:30
|
|
|
data() {
|
2020-11-24 15:15:51 +05:30
|
|
|
const environmentsData = el.dataset;
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
return {
|
|
|
|
endpoint: environmentsData.environmentsDataEndpoint,
|
|
|
|
newEnvironmentPath: environmentsData.newEnvironmentPath,
|
|
|
|
helpPagePath: environmentsData.helpPagePath,
|
2019-02-15 15:39:39 +05:30
|
|
|
canCreateEnvironment: parseBoolean(environmentsData.canCreateEnvironment),
|
|
|
|
canReadEnvironment: parseBoolean(environmentsData.canReadEnvironment),
|
2018-12-13 13:39:08 +05:30
|
|
|
};
|
|
|
|
},
|
|
|
|
render(createElement) {
|
|
|
|
return createElement('environments-component', {
|
|
|
|
props: {
|
|
|
|
endpoint: this.endpoint,
|
|
|
|
newEnvironmentPath: this.newEnvironmentPath,
|
|
|
|
helpPagePath: this.helpPagePath,
|
|
|
|
canCreateEnvironment: this.canCreateEnvironment,
|
|
|
|
canReadEnvironment: this.canReadEnvironment,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
2020-11-24 15:15:51 +05:30
|
|
|
};
|