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

41 lines
1.5 KiB
JavaScript
Raw Normal View History

2017-08-17 22:00:37 +05:30
import Vue from 'vue';
2018-03-17 18:26:18 +05:30
import environmentsComponent from './components/environments_app.vue';
2019-01-03 12:48:30 +05:30
import { convertPermissionToBoolean } from '../lib/utils/common_utils';
2018-03-17 18:26:18 +05:30
import Translate from '../vue_shared/translate';
Vue.use(Translate);
2017-08-17 22:00:37 +05:30
2018-12-13 13:39:08 +05:30
export default () =>
new Vue({
el: '#environments-list-view',
components: {
environmentsComponent,
},
data() {
const environmentsData = document.querySelector(this.$options.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,
cssContainerClass: environmentsData.cssClass,
2019-01-03 12:48:30 +05:30
canCreateEnvironment: convertPermissionToBoolean(environmentsData.canCreateEnvironment),
canCreateDeployment: convertPermissionToBoolean(environmentsData.canCreateDeployment),
canReadEnvironment: convertPermissionToBoolean(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,
cssContainerClass: this.cssContainerClass,
canCreateEnvironment: this.canCreateEnvironment,
canCreateDeployment: this.canCreateDeployment,
canReadEnvironment: this.canReadEnvironment,
},
});
},
});