Commit ba53ee78 authored by Filipa Lacerda's avatar Filipa Lacerda

Changes after review

parent 8ca90a68
...@@ -5,7 +5,7 @@ const Vue = require('vue'); ...@@ -5,7 +5,7 @@ const Vue = require('vue');
Vue.use(require('vue-resource')); Vue.use(require('vue-resource'));
const EnvironmentsService = require('../services/environments_service'); const EnvironmentsService = require('../services/environments_service');
const EnvironmentTable = require('./environments_table'); const EnvironmentTable = require('./environments_table');
const Store = require('../stores/environments_store'); const EnvironmentsStore = require('../stores/environments_store');
require('../../vue_shared/components/table_pagination'); require('../../vue_shared/components/table_pagination');
require('../../lib/utils/common_utils'); require('../../lib/utils/common_utils');
...@@ -18,7 +18,7 @@ module.exports = Vue.component('environment-component', { ...@@ -18,7 +18,7 @@ module.exports = Vue.component('environment-component', {
data() { data() {
const environmentsData = document.querySelector('#environments-list-view').dataset; const environmentsData = document.querySelector('#environments-list-view').dataset;
const store = new Store(); const store = new EnvironmentsStore();
return { return {
store, store,
......
...@@ -5,7 +5,7 @@ const Vue = require('vue'); ...@@ -5,7 +5,7 @@ const Vue = require('vue');
Vue.use(require('vue-resource')); Vue.use(require('vue-resource'));
const EnvironmentsService = require('../services/environments_service'); const EnvironmentsService = require('../services/environments_service');
const EnvironmentTable = require('../components/environments_table'); 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('../../vue_shared/components/table_pagination');
require('../../lib/utils/common_utils'); require('../../lib/utils/common_utils');
...@@ -18,9 +18,10 @@ module.exports = Vue.component('environment-folder-view', { ...@@ -18,9 +18,10 @@ module.exports = Vue.component('environment-folder-view', {
data() { data() {
const environmentsData = document.querySelector('#environments-folder-list-view').dataset; const environmentsData = document.querySelector('#environments-folder-list-view').dataset;
const store = new Store(); const store = new EnvironmentsStore();
const endpoint = `${window.location.pathname}.json`; const pathname = window.location.pathname;
const folderName = window.location.pathname.substr(window.location.pathname.lastIndexOf('/') + 1); const endpoint = `${pathname}.json`;
const folderName = pathname.substr(pathname.lastIndexOf('/') + 1);
return { return {
store, store,
...@@ -99,7 +100,7 @@ module.exports = Vue.component('environment-folder-view', { ...@@ -99,7 +100,7 @@ module.exports = Vue.component('environment-folder-view', {
this.store.storeAvailableCount(response.body.available_count); this.store.storeAvailableCount(response.body.available_count);
this.store.storeStoppedCount(response.body.stopped_count); this.store.storeStoppedCount(response.body.stopped_count);
this.store.storeEnvironments(response.body.environments); this.store.storeEnvironments(response.body.environments);
this.store.storePagination(response.headers); this.store.setPagination(response.headers);
}) })
.then(() => { .then(() => {
this.isLoading = false; this.isLoading = false;
......
...@@ -256,19 +256,19 @@ ...@@ -256,19 +256,19 @@
*/ */
w.gl.utils.setParamInURL = (param, value) => { w.gl.utils.setParamInURL = (param, value) => {
let search; let search;
const locationSearch = window.location.search;
if (window.location.search.length === 0) { if (locationSearch.length === 0) {
search = `?${param}=${value}`; search = `?${param}=${value}`;
} }
if (window.location.search.indexOf(param) !== -1) { if (locationSearch.indexOf(param) !== -1) {
const regex = new RegExp(param + '=\\d'); 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 && if (locationSearch.length && locationSearch.indexOf(param) === -1) {
window.location.search.indexOf(param) === -1) { search = `${locationSearch}&${param}=${value}`;
search = `${window.location.search}&${param}=${value}`;
} }
return search; return search;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment