Changes after review
This commit is contained in:
parent
8ca90a68c4
commit
ba53ee78fa
3 changed files with 14 additions and 13 deletions
|
@ -5,7 +5,7 @@ const Vue = require('vue');
|
|||
Vue.use(require('vue-resource'));
|
||||
const EnvironmentsService = require('../services/environments_service');
|
||||
const EnvironmentTable = require('./environments_table');
|
||||
const Store = require('../stores/environments_store');
|
||||
const EnvironmentsStore = require('../stores/environments_store');
|
||||
require('../../vue_shared/components/table_pagination');
|
||||
require('../../lib/utils/common_utils');
|
||||
|
||||
|
@ -18,7 +18,7 @@ module.exports = Vue.component('environment-component', {
|
|||
|
||||
data() {
|
||||
const environmentsData = document.querySelector('#environments-list-view').dataset;
|
||||
const store = new Store();
|
||||
const store = new EnvironmentsStore();
|
||||
|
||||
return {
|
||||
store,
|
||||
|
|
|
@ -5,7 +5,7 @@ const Vue = require('vue');
|
|||
Vue.use(require('vue-resource'));
|
||||
const EnvironmentsService = require('../services/environments_service');
|
||||
const EnvironmentTable = require('../components/environments_table');
|
||||
const Store = require('../stores/environments_store');
|
||||
const EnvironmentsStore = require('../stores/environments_store');
|
||||
require('../../vue_shared/components/table_pagination');
|
||||
require('../../lib/utils/common_utils');
|
||||
|
||||
|
@ -18,9 +18,10 @@ module.exports = Vue.component('environment-folder-view', {
|
|||
|
||||
data() {
|
||||
const environmentsData = document.querySelector('#environments-folder-list-view').dataset;
|
||||
const store = new Store();
|
||||
const endpoint = `${window.location.pathname}.json`;
|
||||
const folderName = window.location.pathname.substr(window.location.pathname.lastIndexOf('/') + 1);
|
||||
const store = new EnvironmentsStore();
|
||||
const pathname = window.location.pathname;
|
||||
const endpoint = `${pathname}.json`;
|
||||
const folderName = pathname.substr(pathname.lastIndexOf('/') + 1);
|
||||
|
||||
return {
|
||||
store,
|
||||
|
@ -99,7 +100,7 @@ module.exports = Vue.component('environment-folder-view', {
|
|||
this.store.storeAvailableCount(response.body.available_count);
|
||||
this.store.storeStoppedCount(response.body.stopped_count);
|
||||
this.store.storeEnvironments(response.body.environments);
|
||||
this.store.storePagination(response.headers);
|
||||
this.store.setPagination(response.headers);
|
||||
})
|
||||
.then(() => {
|
||||
this.isLoading = false;
|
||||
|
|
|
@ -256,19 +256,19 @@
|
|||
*/
|
||||
w.gl.utils.setParamInURL = (param, value) => {
|
||||
let search;
|
||||
const locationSearch = window.location.search;
|
||||
|
||||
if (window.location.search.length === 0) {
|
||||
if (locationSearch.length === 0) {
|
||||
search = `?${param}=${value}`;
|
||||
}
|
||||
|
||||
if (window.location.search.indexOf(param) !== -1) {
|
||||
if (locationSearch.indexOf(param) !== -1) {
|
||||
const regex = new RegExp(param + '=\\d');
|
||||
search = window.location.search.replace(regex, `${param}=${value}`);
|
||||
search = locationSearch.replace(regex, `${param}=${value}`);
|
||||
}
|
||||
|
||||
if (window.location.search.length &&
|
||||
window.location.search.indexOf(param) === -1) {
|
||||
search = `${window.location.search}&${param}=${value}`;
|
||||
if (locationSearch.length && locationSearch.indexOf(param) === -1) {
|
||||
search = `${locationSearch}&${param}=${value}`;
|
||||
}
|
||||
|
||||
return search;
|
||||
|
|
Loading…
Reference in a new issue