Commit 38bb3488 authored by Regis's avatar Regis

re-wire count for pagination - refactor

parent 1a5027a0
......@@ -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 = {}));
\ No newline at end of file
})(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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment