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
Jérome Perrin
gitlab-ce
Commits
0c9a4c14
Commit
0c9a4c14
authored
Nov 06, 2016
by
Regis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
icon and status comps - pagination logic almost done
parent
f140da6b
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
129 additions
and
15 deletions
+129
-15
app/assets/javascripts/vue_pipeline_status/failed.js.es6
app/assets/javascripts/vue_pipeline_status/failed.js.es6
+24
-0
app/assets/javascripts/vue_pipeline_status/pending.js.es6
app/assets/javascripts/vue_pipeline_status/pending.js.es6
+24
-0
app/assets/javascripts/vue_pipeline_status/running.js.es6
app/assets/javascripts/vue_pipeline_status/running.js.es6
+24
-0
app/assets/javascripts/vue_pipeline_status/status.js.es6
app/assets/javascripts/vue_pipeline_status/status.js.es6
+38
-0
app/assets/javascripts/vue_pipelines_index/gl_pagination.js.es6
...sets/javascripts/vue_pipelines_index/gl_pagination.js.es6
+13
-11
app/assets/javascripts/vue_pipelines_index/pipelines.js.es6
app/assets/javascripts/vue_pipelines_index/pipelines.js.es6
+6
-4
No files found.
app/assets/javascripts/vue_pipeline_status/failed.js.es6
0 → 100644
View file @
0c9a4c14
/* global Vue, gl */
/* eslint-disable no-param-reassign */
((gl) => {
gl.VueFailedPipeline = Vue.extend({
components: {
'vue-failed-icon': gl.VuePendingIcon,
},
props: [
'pipeline',
'pipelineurl',
],
template: `
<td class="commit-link">
<a :href='pipelineurl(pipeline.id)'>
<span class="ci-status ci-failed">
<vue-failed-icon></vue-failed-icon>
failed
</span>
</a>
</td>
`,
});
})(window.gl || (window.gl = {}));
app/assets/javascripts/vue_pipeline_status/pending.js.es6
0 → 100644
View file @
0c9a4c14
/* global Vue, gl */
/* eslint-disable no-param-reassign */
((gl) => {
gl.VuePendingPipeline = Vue.extend({
components: {
'vue-pending-icon': gl.VuePendingIcon,
},
props: [
'pipeline',
'pipelineurl',
],
template: `
<td class="commit-link">
<a :href='pipelineurl(pipeline.id)'>
<span class="ci-status ci-pending">
<vue-pending-icon></vue-pending-icon>
pending
</span>
</a>
</td>
`,
});
})(window.gl || (window.gl = {}));
app/assets/javascripts/vue_pipeline_status/running.js.es6
0 → 100644
View file @
0c9a4c14
/* global Vue, gl */
/* eslint-disable no-param-reassign */
((gl) => {
gl.VueRunningPipeline = Vue.extend({
components: {
'vue-running-icon': gl.VueRunningIcon,
},
props: [
'pipeline',
'pipelineurl',
],
template: `
<td class="commit-link">
<a :href='pipelineurl(pipeline.id)'>
<span class="ci-status ci-running">
<vue-running-icon></vue-running-icon>
running
</span>
</a>
</td>
`,
});
})(window.gl || (window.gl = {}));
app/assets/javascripts/vue_pipeline_status/status.js.es6
0 → 100644
View file @
0c9a4c14
/* global Vue, gl */
/* eslint-disable no-param-reassign */
((gl) => {
gl.VueStatusPipeline = Vue.extend({
components: {
'vue-running-pipeline': gl.VueRunningPipeline,
'vue-pending-pipeline': gl.VuePendingPipeline,
'vue-failed-pipeline': gl.VueFailedPipeline,
},
props: [
'pipeline',
'pipelineurl',
],
template: `
<td class="commit-link">
<vue-running-pipeline
v-if="pipeline.status === 'running'"
:pipeline='pipeline'
:pipelineurl='pipelineurl'
>
</vue-running-pipeline>
<vue-pending-pipeline
v-if="pipeline.status === 'pending'"
:pipeline='pipeline'
:pipelineurl='pipelineurl'
>
</vue-pending-pipeline>
<vue-failed-pipeline
v-if="pipeline.status === 'failed'"
:pipeline='pipeline'
:pipelineurl='pipelineurl'
>
</vue-failed-pipeline>
</td>
`,
});
})(window.gl || (window.gl = {}));
app/assets/javascripts/vue_pipelines_index/gl_pagination.js.es6
View file @
0c9a4c14
...
@@ -14,6 +14,10 @@
...
@@ -14,6 +14,10 @@
if (n - 1 === +this.pagenum) return 'active';
if (n - 1 === +this.pagenum) return 'active';
return '';
return '';
},
},
prevstatus() {
if (+this.pagenum > 1) return '';
return 'prev disabled';
},
},
},
computed: {
computed: {
last() {
last() {
...
@@ -29,33 +33,31 @@
...
@@ -29,33 +33,31 @@
if (this.pagenum === 1) return 1;
if (this.pagenum === 1) return 1;
return this.pagenum - 1;
return this.pagenum - 1;
},
},
next() {
if (this.pagenum === this.last) return `pipelines?p=${this.pagenum}`;
return `pipelines?p=${this.pagenum + 1}`;
},
},
},
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 upcount'>
<li
class="prev disabled"
v-if='n === 1'>
<li
:class='prevstatus(n)'
v-if='n === 1'>
<span>Prev</span>
<span
@click='changepage($event, {where: pagenum - 1})'
>Prev</span>
</li>
</li>
<li :class='pagenumberstatus(n)' v-else>
<li :class='pagenumberstatus(n)' v-else>
<
a @click='changepage($event)'>{{(n - 1)}}</a
>
<
span @click='changepage($event)'>{{(n - 1)}}</span
>
</li>
</li>
<!--
<!--
take a slice of current array (up to 5)
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'>
<li v-if='n === upcount
&& upcount > 4
'>
<span class="gap">…</span>
<span class="gap">…</span>
</li>
</li>
<li class="next" v-if='n === upcount'>
<li class="next" v-if='n === upcount && pagenum !== last'>
<a rel="next" :href='next'>Next</a>
<span @click='changepage($event, {where: pagenum + 1})'>
Next
</span>
</li>
</li>
<li class="last" v-if='n === upcount && pagenum !== last'>
<li class="last" v-if='n === upcount && pagenum !== last'>
<
a @click='changepage($event, last)'>Last »</a
>
<
span @click='changepage($event, {last: last})'>Last »</span
>
</li>
</li>
</ul>
</ul>
</div>
</div>
...
...
app/assets/javascripts/vue_pipelines_index/pipelines.js.es6
View file @
0c9a4c14
...
@@ -35,10 +35,12 @@
...
@@ -35,10 +35,12 @@
shortsha(pipeline) {
shortsha(pipeline) {
return pipeline.sha.slice(0, 8);
return pipeline.sha.slice(0, 8);
},
},
changepage(event, last) {
changepage(event, page = {}) {
if (last) this.pagenum = +last;
if (page) this.pagenum = +event.target.innerText;
if (!last) this.pagenum = +event.target.innerText;
if (page.last) this.pagenum = +page.last;
// use p instead of page to avoid rails tyring to make an actual request
if (page.where) this.pagenum = +page.next;
// 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}`);
clearInterval(this.intervalId);
clearInterval(this.intervalId);
this.store.fetchDataLoop.call(this, Vue, this.pagenum);
this.store.fetchDataLoop.call(this, Vue, this.pagenum);
...
...
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