Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
6077dea7
Commit
6077dea7
authored
Feb 09, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove store from global namespace, use CSJ instead
parent
acb68ae6
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
65 additions
and
76 deletions
+65
-76
app/assets/javascripts/environments/components/environment.js.es6
...ts/javascripts/environments/components/environment.js.es6
+4
-8
app/assets/javascripts/environments/environments_bundle.js.es6
...ssets/javascripts/environments/environments_bundle.js.es6
+0
-7
app/assets/javascripts/environments/stores/environments_store.js.es6
...javascripts/environments/stores/environments_store.js.es6
+60
-60
app/assets/javascripts/vue_shared/vue_resource_interceptor.js.es6
...ts/javascripts/vue_shared/vue_resource_interceptor.js.es6
+1
-1
No files found.
app/assets/javascripts/environments/components/environment.js.es6
View file @
6077dea7
...
...
@@ -7,18 +7,12 @@ window.Vue = require('vue');
window.Vue.use(require('vue-resource'));
require('../services/environments_service');
require('./environment_item');
const Store = require('../stores/environments_store');
(() => {
window.gl = window.gl || {};
gl.environmentsList.EnvironmentsComponent = Vue.component('environment-component', {
props: {
store: {
type: Object,
required: true,
default: () => ({}),
},
},
components: {
'environment-item': gl.environmentsList.EnvironmentItem,
...
...
@@ -26,9 +20,11 @@ require('./environment_item');
data() {
const environmentsData = document.querySelector('#environments-list-view').dataset;
const store = new Store();
return {
state: this.store.state,
store,
state: store.state,
visibility: 'available',
isLoading: false,
cssContainerClass: environmentsData.cssClass,
...
...
app/assets/javascripts/environments/environments_bundle.js.es6
View file @
6077dea7
window.Vue = require('vue');
require('./stores/environments_store');
require('./components/environment');
require('../vue_shared/vue_resource_interceptor');
...
...
@@ -9,14 +8,8 @@ $(() => {
if (gl.EnvironmentsListApp) {
gl.EnvironmentsListApp.$destroy(true);
}
const Store = gl.environmentsList.EnvironmentsStore;
gl.EnvironmentsListApp = new gl.environmentsList.EnvironmentsComponent({
el: document.querySelector('#environments-list-view'),
propsData: {
store: Store.create(),
},
});
});
app/assets/javascripts/environments/stores/environments_store.js.es6
View file @
6077dea7
/*
eslint-disable no-param-reassign */
(() => {
window.gl = window.gl || {};
window.gl.environmentsList = window.gl.environmentsList || {};
gl.environmentsList.EnvironmentsStore = {
state: {},
create() {
/*
*
* Environments Store.
*
* Stores received environments, count of stopped environments and count of
* available environments.
*/
class EnvironmentsStore {
constructor() {
this.state = {};
this.state.environments = [];
this.state.stoppedCounter = 0;
this.state.availableCounter = 0;
this.state.filteredEnvironments = [];
return this;
},
}
/**
*
...
...
@@ -40,7 +40,7 @@
this.state.environments = filteredEnvironments;
return filteredEnvironments;
},
}
/**
* Stores the number of available environments.
...
...
@@ -51,7 +51,7 @@
storeAvailableCount(count = 0) {
this.state.availableCounter = count;
return count;
},
}
/**
* Stores the number of closed environments.
...
...
@@ -62,7 +62,7 @@
storeStoppedCount(count = 0) {
this.state.stoppedCounter = count;
return count;
},
}
}
};
})();
module.exports = EnvironmentsStore;
app/assets/javascripts/vue_shared/vue_resource_interceptor.js.es6
View file @
6077dea7
...
...
@@ -6,7 +6,7 @@ Vue.http.interceptors.push((request, next) => {
Vue.activeResources = Vue.activeResources ? Vue.activeResources + 1 : 1;
next((response) => {
if (typeof response.data === 'string'
&& response.status !== 500
) {
if (typeof response.data === 'string') {
response.data = JSON.parse(response.data);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment