2017-04-27 10:06:17 -04:00
|
|
|
import Vue from 'vue';
|
2020-09-04 17:08:41 -04:00
|
|
|
import VueApollo from 'vue-apollo';
|
2020-04-28 17:09:35 -04:00
|
|
|
import canaryCalloutMixin from './mixins/canary_callout_mixin';
|
2017-11-23 07:04:03 -05:00
|
|
|
import environmentsComponent from './components/environments_app.vue';
|
2018-11-21 10:13:04 -05:00
|
|
|
import { parseBoolean } from '../lib/utils/common_utils';
|
2017-11-23 07:04:03 -05:00
|
|
|
import Translate from '../vue_shared/translate';
|
2020-09-04 17:08:41 -04:00
|
|
|
import createDefaultClient from '~/lib/graphql';
|
2017-11-23 07:04:03 -05:00
|
|
|
|
|
|
|
Vue.use(Translate);
|
2020-09-04 17:08:41 -04:00
|
|
|
Vue.use(VueApollo);
|
2016-10-14 08:14:18 -04:00
|
|
|
|
2020-09-04 17:08:41 -04:00
|
|
|
const apolloProvider = new VueApollo({
|
|
|
|
defaultClient: createDefaultClient(),
|
|
|
|
});
|
|
|
|
|
|
|
|
export default () => {
|
|
|
|
const el = document.getElementById('environments-list-view');
|
|
|
|
return new Vue({
|
|
|
|
el,
|
2018-10-10 02:18:49 -04:00
|
|
|
components: {
|
|
|
|
environmentsComponent,
|
|
|
|
},
|
2019-03-14 06:19:12 -04:00
|
|
|
mixins: [canaryCalloutMixin],
|
2020-09-04 17:08:41 -04:00
|
|
|
apolloProvider,
|
|
|
|
provide: {
|
|
|
|
projectPath: el.dataset.projectPath,
|
|
|
|
},
|
2018-10-10 02:18:49 -04:00
|
|
|
data() {
|
2020-09-04 17:08:41 -04:00
|
|
|
const environmentsData = el.dataset;
|
2017-11-23 07:04:03 -05:00
|
|
|
|
2018-10-10 02:18:49 -04:00
|
|
|
return {
|
|
|
|
endpoint: environmentsData.environmentsDataEndpoint,
|
|
|
|
newEnvironmentPath: environmentsData.newEnvironmentPath,
|
|
|
|
helpPagePath: environmentsData.helpPagePath,
|
2019-06-21 16:45:06 -04:00
|
|
|
deployBoardsHelpPath: environmentsData.deployBoardsHelpPath,
|
2018-11-21 10:13:04 -05:00
|
|
|
canCreateEnvironment: parseBoolean(environmentsData.canCreateEnvironment),
|
|
|
|
canReadEnvironment: parseBoolean(environmentsData.canReadEnvironment),
|
2018-10-10 02:18:49 -04:00
|
|
|
};
|
|
|
|
},
|
|
|
|
render(createElement) {
|
|
|
|
return createElement('environments-component', {
|
|
|
|
props: {
|
|
|
|
endpoint: this.endpoint,
|
|
|
|
newEnvironmentPath: this.newEnvironmentPath,
|
|
|
|
helpPagePath: this.helpPagePath,
|
2019-06-21 16:45:06 -04:00
|
|
|
deployBoardsHelpPath: this.deployBoardsHelpPath,
|
2018-10-10 02:18:49 -04:00
|
|
|
canCreateEnvironment: this.canCreateEnvironment,
|
|
|
|
canReadEnvironment: this.canReadEnvironment,
|
2019-03-14 06:19:12 -04:00
|
|
|
...this.canaryCalloutProps,
|
2018-10-10 02:18:49 -04:00
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
2020-09-04 17:08:41 -04:00
|
|
|
};
|