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
Léo-Paul Géneau
gitlab-ce
Commits
991a7ae8
Commit
991a7ae8
authored
Feb 09, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds pagination component
parent
b8dbebce
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
2 deletions
+36
-2
app/assets/javascripts/environments/components/environment.js.es6
...ts/javascripts/environments/components/environment.js.es6
+23
-2
app/assets/javascripts/environments/stores/environments_store.js.es6
...javascripts/environments/stores/environments_store.js.es6
+13
-0
No files found.
app/assets/javascripts/environments/components/environment.js.es6
View file @
991a7ae8
...
@@ -6,11 +6,13 @@ Vue.use(require('vue-resource'));
...
@@ -6,11 +6,13 @@ Vue.use(require('vue-resource'));
const EnvironmentsService = require('../services/environments_service');
const EnvironmentsService = require('../services/environments_service');
const EnvironmentItem = require('./environment_item');
const EnvironmentItem = require('./environment_item');
const Store = require('../stores/environments_store');
const Store = require('../stores/environments_store');
require('../../vue_shared/components/table_pagination');
module.exports = Vue.component('environment-component', {
module.exports = Vue.component('environment-component', {
components: {
components: {
'environment-item': EnvironmentItem,
'environment-item': EnvironmentItem,
'table-pagination': gl.VueGlPagination,
},
},
data() {
data() {
...
@@ -34,6 +36,10 @@ module.exports = Vue.component('environment-component', {
...
@@ -34,6 +36,10 @@ module.exports = Vue.component('environment-component', {
commitIconSvg: environmentsData.commitIconSvg,
commitIconSvg: environmentsData.commitIconSvg,
playIconSvg: environmentsData.playIconSvg,
playIconSvg: environmentsData.playIconSvg,
terminalIconSvg: environmentsData.terminalIconSvg,
terminalIconSvg: environmentsData.terminalIconSvg,
// Pagination Properties,
paginationInformation: {},
pageNumber: 1,
};
};
},
},
...
@@ -61,14 +67,18 @@ module.exports = Vue.component('environment-component', {
...
@@ -61,14 +67,18 @@ module.exports = Vue.component('environment-component', {
*/
*/
created() {
created() {
const scope = this.$options.getQueryParameter('scope') || this.visibility;
const scope = this.$options.getQueryParameter('scope') || this.visibility;
const endpoint = `${this.endpoint}?scope=${scope}`;
const pageNumber = this.$options.getQueryParameter('page') || this.pageNumber;
const endpoint = `${this.endpoint}?scope=${scope}&page=${pageNumber}`;
const service = new EnvironmentsService(endpoint);
const service = new EnvironmentsService(endpoint);
this.isLoading = true;
this.isLoading = true;
return service.all()
return service.all()
.then(resp => resp.json())
.then((resp) => {
debugger;
return resp.json();
})
.then((json) => {
.then((json) => {
this.store.storeAvailableCount(json.available_count);
this.store.storeAvailableCount(json.available_count);
this.store.storeStoppedCount(json.stopped_count);
this.store.storeStoppedCount(json.stopped_count);
...
@@ -111,6 +121,10 @@ module.exports = Vue.component('environment-component', {
...
@@ -111,6 +121,10 @@ module.exports = Vue.component('environment-component', {
toggleRow(model) {
toggleRow(model) {
return this.store.toggleFolder(model.name);
return this.store.toggleFolder(model.name);
},
},
changePage(pageNumber, scope) {
gl.utils.visitUrl(`?scope=${scope}&p=${pageNumber}`);
},
},
},
template: `
template: `
...
@@ -192,6 +206,13 @@ module.exports = Vue.component('environment-component', {
...
@@ -192,6 +206,13 @@ module.exports = Vue.component('environment-component', {
</template>
</template>
</tbody>
</tbody>
</table>
</table>
<table-pagination v-if="!isLoading && state.environments.length"
:pagenum="1"
:count="2"
:change="changePage"
:pageInfo="paginationInformation">
</table-pagination>
</div>
</div>
</div>
</div>
</div>
</div>
...
...
app/assets/javascripts/environments/stores/environments_store.js.es6
View file @
991a7ae8
require('~/lib/utils/common_utils');
/**
/**
* Environments Store.
* Environments Store.
*
*
...
@@ -10,6 +11,7 @@ class EnvironmentsStore {
...
@@ -10,6 +11,7 @@ class EnvironmentsStore {
this.state.environments = [];
this.state.environments = [];
this.state.stoppedCounter = 0;
this.state.stoppedCounter = 0;
this.state.availableCounter = 0;
this.state.availableCounter = 0;
this.state.paginationInformation = {};
return this;
return this;
}
}
...
@@ -41,6 +43,17 @@ class EnvironmentsStore {
...
@@ -41,6 +43,17 @@ class EnvironmentsStore {
return filteredEnvironments;
return filteredEnvironments;
}
}
storePagination(pagination = {}) {
const normalizedHeaders = gl.utils.normalizedHeaders(pagination);
const paginationInformation = {
};
this.paginationInformation = paginationInformation;
return paginationInformation;
}
/**
/**
* Stores the number of available environments.
* Stores the number of available environments.
*
*
...
...
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