re-wire count for pagination - refactor
This commit is contained in:
parent
1a5027a03d
commit
38bb34889c
7 changed files with 11 additions and 9 deletions
|
@ -10,7 +10,7 @@
|
|||
],
|
||||
computed: {
|
||||
last() {
|
||||
return Math.ceil(+this.count / 5);
|
||||
return Math.ceil(+this.count / 30);
|
||||
},
|
||||
getItems() {
|
||||
const total = +this.last;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
return `mailto:${this.pipeline.commit.author_email}`;
|
||||
},
|
||||
alt() {
|
||||
return `${this.pipeline.commit.author_name}'s avatar`
|
||||
return `${this.pipeline.commit.author_name}'s avatar`;
|
||||
},
|
||||
},
|
||||
template: `
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
el: '.vue-pipelines-index',
|
||||
data: {
|
||||
scope: project.dataset.url,
|
||||
count: project.dataset.count,
|
||||
store: new gl.PipelineStore(),
|
||||
},
|
||||
components: {
|
||||
|
@ -36,7 +35,6 @@
|
|||
<vue-pipelines
|
||||
:scope='scope'
|
||||
:store='store'
|
||||
:count='count'
|
||||
>
|
||||
</vue-pipelines>
|
||||
</div>
|
||||
|
|
|
@ -20,12 +20,15 @@
|
|||
currentPage: '',
|
||||
intervalId: '',
|
||||
pagenum: 1,
|
||||
count: {
|
||||
all: 0,
|
||||
running_or_pending: 0,
|
||||
},
|
||||
};
|
||||
},
|
||||
props: [
|
||||
'scope',
|
||||
'store',
|
||||
'count',
|
||||
],
|
||||
created() {
|
||||
const url = window.location.toString();
|
||||
|
@ -65,9 +68,10 @@
|
|||
</table>
|
||||
</div>
|
||||
<vue-gl-pagination
|
||||
v-if='count.all > 0'
|
||||
:pagenum='pagenum'
|
||||
:changepage='changepage'
|
||||
:count='count'
|
||||
:count='count.all'
|
||||
>
|
||||
</vue-gl-pagination>
|
||||
</div>
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
this.$http.get(`${url}?page=${pageNum}`)
|
||||
.then((response) => {
|
||||
const res = JSON.parse(response.body);
|
||||
debugger
|
||||
Vue.set(this, 'pipelines', res.pipelines);
|
||||
Vue.set(this, 'count', res.count);
|
||||
}, () => new Flash(
|
||||
'Something went wrong on our end.'
|
||||
));
|
||||
|
|
|
@ -20,4 +20,4 @@
|
|||
</td>
|
||||
`,
|
||||
});
|
||||
})(window.gl || (window.gl = {}));
|
||||
})(window.gl || (window.gl = {}));
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
= link_to ci_lint_path, class: 'btn btn-default' do
|
||||
%span CI Lint
|
||||
%div.content-list.pipelines{data: {url: namespace_project_pipelines_path(@project.namespace, @project, format: :json), "data-count": "#{@pipelines_count}"}}
|
||||
%div.content-list.pipelines{data: {url: namespace_project_pipelines_path(@project.namespace, @project, format: :json)}}
|
||||
- if @pipelines.blank?
|
||||
%div
|
||||
.nothing-here-block No pipelines to show
|
||||
|
|
Loading…
Reference in a new issue