summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2017-02-16 11:24:34 +0000
committerFilipa Lacerda <filipa@gitlab.com>2017-02-16 11:24:34 +0000
commit8ca90a68c4201714b01f88880a132d4febada48c (patch)
tree9023bc50691ef48b7de32f4bcdd2fb42848760d8 /app
parent605195c26add353805bdb5b3e927ebc286f91fec (diff)
parent19791b65b20a21f1d12315b5b75f52a01531693b (diff)
downloadgitlab-ce-8ca90a68c4201714b01f88880a132d4febada48c.tar.gz
Merge branch 'fe-paginated-environments-api-add-pagination' into fe-paginated-environments-api-add-subview
* fe-paginated-environments-api-add-pagination: Changes after review Rename storePagination to setPagination
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/environments/components/environment.js.es62
-rw-r--r--app/assets/javascripts/environments/stores/environments_store.js.es62
-rw-r--r--app/assets/javascripts/vue_pipelines_index/pipelines.js.es612
3 files changed, 12 insertions, 4 deletions
diff --git a/app/assets/javascripts/environments/components/environment.js.es6 b/app/assets/javascripts/environments/components/environment.js.es6
index e9ea6d91adb..d096f837285 100644
--- a/app/assets/javascripts/environments/components/environment.js.es6
+++ b/app/assets/javascripts/environments/components/environment.js.es6
@@ -86,7 +86,7 @@ module.exports = Vue.component('environment-component', {
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;
diff --git a/app/assets/javascripts/environments/stores/environments_store.js.es6 b/app/assets/javascripts/environments/stores/environments_store.js.es6
index e8b44aeb0bb..87822730be2 100644
--- a/app/assets/javascripts/environments/stores/environments_store.js.es6
+++ b/app/assets/javascripts/environments/stores/environments_store.js.es6
@@ -56,7 +56,7 @@ class EnvironmentsStore {
return filteredEnvironments;
}
- storePagination(pagination = {}) {
+ setPagination(pagination = {}) {
const normalizedHeaders = gl.utils.normalizeHeaders(pagination);
const paginationInformation = {
perPage: parseInt(normalizedHeaders['X-PER-PAGE'], 10),
diff --git a/app/assets/javascripts/vue_pipelines_index/pipelines.js.es6 b/app/assets/javascripts/vue_pipelines_index/pipelines.js.es6
index 9e816a285e4..39935b08dc0 100644
--- a/app/assets/javascripts/vue_pipelines_index/pipelines.js.es6
+++ b/app/assets/javascripts/vue_pipelines_index/pipelines.js.es6
@@ -35,8 +35,16 @@ require('../vue_shared/components/pipelines_table');
this.store.fetchDataLoop.call(this, Vue, this.pagenum, this.scope, this.apiScope);
},
methods: {
- change(pagenum, apiScope) {
- if (!apiScope) apiScope = 'all';
+
+ /**
+ * Changes the URL according to the pagination component.
+ *
+ * If no scope is provided, 'all' is assumed.
+ *
+ * @param {Number} pagenum
+ * @param {String} apiScope = 'all'
+ */
+ change(pagenum, apiScope = 'all') {
gl.utils.visitUrl(`?scope=${apiScope}&p=${pagenum}`);
},
},