re-wire count for pagination - refactor

This commit is contained in:
Regis 2016-11-10 12:46:29 -07:00
parent 1a5027a03d
commit 38bb34889c
7 changed files with 11 additions and 9 deletions

View File

@ -10,7 +10,7 @@
],
computed: {
last() {
return Math.ceil(+this.count / 5);
return Math.ceil(+this.count / 30);
},
getItems() {
const total = +this.last;

View File

@ -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: `

View File

@ -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>

View File

@ -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>

View File

@ -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.'
));

View File

@ -20,4 +20,4 @@
</td>
`,
});
})(window.gl || (window.gl = {}));
})(window.gl || (window.gl = {}));

View File

@ -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