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
be146a4f
Commit
be146a4f
authored
Nov 06, 2016
by
Regis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove svg api call - more progress on pagination
parent
fd10ff30
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
25 deletions
+35
-25
app/assets/javascripts/vue_pagination/index.js.es6
app/assets/javascripts/vue_pagination/index.js.es6
+32
-13
app/assets/javascripts/vue_pipelines_index/index.js.es6
app/assets/javascripts/vue_pipelines_index/index.js.es6
+1
-1
app/assets/javascripts/vue_pipelines_index/pipelines.js.es6
app/assets/javascripts/vue_pipelines_index/pipelines.js.es6
+2
-2
app/assets/javascripts/vue_pipelines_index/store.js.es6
app/assets/javascripts/vue_pipelines_index/store.js.es6
+0
-9
No files found.
app/assets/javascripts/vue_pagination/index.js.es6
View file @
be146a4f
...
@@ -3,14 +3,19 @@
...
@@ -3,14 +3,19 @@
((gl) => {
((gl) => {
gl.VueGlPagination = Vue.extend({
gl.VueGlPagination = Vue.extend({
data() {
return {
nslice: +this.pagenum,
};
},
props: [
props: [
'changepage',
'changepage',
'pages',
'count',
'count',
'pagenum',
'pagenum',
],
],
methods: {
methods: {
pagenumberstatus(n) {
pagenumberstatus(n) {
console.log(n, this.nslice);
if (n - 1 === +this.pagenum) return 'active';
if (n - 1 === +this.pagenum) return 'active';
return '';
return '';
},
},
...
@@ -20,35 +25,46 @@
...
@@ -20,35 +25,46 @@
},
},
},
},
computed: {
computed: {
paginationsection() {
if (this.last < 6 && this.pagenum < 6) {
const pageArray = [...Array(6).keys()];
pageArray.shift();
return pageArray.slice(0, this.upcount);
}
const section = [...Array(this.upcount).keys()];
section.shift();
this.nslice = +this.pagenum;
return section.slice(+this.pagenum, +this.pagenum + 5);
},
last() {
last() {
return Math.ceil(+this.count / 5);
return Math.ceil(+this.count / 5);
},
},
lastpage() {
return `pipelines?p=${this.last}`;
},
upcount() {
upcount() {
return +this.last + 1;
return +this.last + 1;
},
},
prev() {
endspread() {
if (this.pagenum === 1) return 1;
if (+this.pagenum < this.last && +this.pagenum > 5) return true;
return this.pagenum - 1;
return false
},
begspread() {
if (+this.pagenum > 5 && +this.pagenum < this.last) return true;
return false
},
},
},
},
template: `
template: `
<div class="gl-pagination">
<div class="gl-pagination">
<ul class="pagination clearfix" v-for='n in
upcount
'>
<ul class="pagination clearfix" v-for='n in
paginationsection
'>
<li :class='prevstatus(n)' v-if='n === 1'>
<li :class='prevstatus(n)' v-if='n === 1
|| n - 1 === nslice
'>
<span @click='changepage($event, {where: pagenum - 1})'>Prev</span>
<span @click='changepage($event, {where: pagenum - 1})'>Prev</span>
</li>
</li>
<li :class='pagenumberstatus(n)' v-
else
>
<li :class='pagenumberstatus(n)' v-
if='n >= 2'
>
<span @click='changepage($event)'>{{(n - 1)}}</span>
<span @click='changepage($event)'>{{(n - 1)}}</span>
</li>
</li>
<!--
<!--
take a slice of current array (up to 5)
if at end make dots dissapear
if at end make dots dissapear
if in second slice or more make dots appear in the front
if in second slice or more make dots appear in the front
-->
-->
<li v-if='n === upcount && upcount > 4'>
<li v-if='n === upcount && upcount > 4
&& begspread
'>
<span class="gap">…</span>
<span class="gap">…</span>
</li>
</li>
<li class="next" v-if='n === upcount && pagenum !== last'>
<li class="next" v-if='n === upcount && pagenum !== last'>
...
@@ -56,8 +72,11 @@
...
@@ -56,8 +72,11 @@
Next
Next
</span>
</span>
</li>
</li>
<li v-if='n === upcount && upcount > 4 && endspread'>
<span class="gap">…</span>
</li>
<li class="last" v-if='n === upcount && pagenum !== last'>
<li class="last" v-if='n === upcount && pagenum !== last'>
<span @click='changepage($event, {
last
: last})'>Last »</span>
<span @click='changepage($event, {
where
: last})'>Last »</span>
</li>
</li>
</ul>
</ul>
</div>
</div>
...
...
app/assets/javascripts/vue_pipelines_index/index.js.es6
View file @
be146a4f
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
<vue-pipelines
<vue-pipelines
:scope='scope'
:scope='scope'
:store='store'
:store='store'
:count='
count
'
:count='
90
'
>
>
</vue-pipelines>
</vue-pipelines>
</div>
</div>
...
...
app/assets/javascripts/vue_pipelines_index/pipelines.js.es6
View file @
be146a4f
...
@@ -37,8 +37,8 @@
...
@@ -37,8 +37,8 @@
},
},
changepage(event, page = {}) {
changepage(event, page = {}) {
if (page) this.pagenum = +event.target.innerText;
if (page) this.pagenum = +event.target.innerText;
if (page.
last) this.pagenum = +page.last
;
if (page.
where) this.pagenum = +page.where
;
if (page.where) this.pagenum = +page.
next
;
if (page.where) this.pagenum = +page.
where
;
// use p instead of page to avoid making an actual request
// use p instead of page to avoid making an actual request
window.history.pushState({}, null, `?p=${this.pagenum}`);
window.history.pushState({}, null, `?p=${this.pagenum}`);
...
...
app/assets/javascripts/vue_pipelines_index/store.js.es6
View file @
be146a4f
...
@@ -23,14 +23,5 @@
...
@@ -23,14 +23,5 @@
goFetch();
goFetch();
}, 60000);
}, 60000);
}
}
fetchSvg(type, icon) {
this.$http.get(`/shared/icons/${icon}`)
.then((response) => {
this[type] = JSON.parse(response.body);
}, () => new Flash(
'Something went wrong on our end.'
));
}
};
};
})(window.gl || (window.gl = {}));
})(window.gl || (window.gl = {}));
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