Commit 9806db32 authored by Phil Hughes's avatar Phil Hughes

Added loading icon so user knows when new page is loading

Added test for finding lists when limited to type
parent 31657f8d
...@@ -10,14 +10,13 @@ ...@@ -10,14 +10,13 @@
data () { data () {
return { return {
scrollOffset: 250, scrollOffset: 250,
loadingMore: false,
filters: BoardsStore.state.filters filters: BoardsStore.state.filters
}; };
}, },
watch: { watch: {
filters: { filters: {
handler () { handler () {
this.loadingMore = false; this.list.loadingMore = false;
this.$els.list.scrollTop = 0; this.$els.list.scrollTop = 0;
}, },
deep: true deep: true
...@@ -34,12 +33,12 @@ ...@@ -34,12 +33,12 @@
return this.$els.list.scrollTop + this.listHeight(); return this.$els.list.scrollTop + this.listHeight();
}, },
loadNextPage () { loadNextPage () {
this.loadingMore = true;
const getIssues = this.list.nextPage(); const getIssues = this.list.nextPage();
if (getIssues) { if (getIssues) {
this.list.loadingMore = true;
getIssues.then(() => { getIssues.then(() => {
this.loadingMore = false; this.list.loadingMore = false;
}); });
} }
}, },
...@@ -71,7 +70,7 @@ ...@@ -71,7 +70,7 @@
// Scroll event on list to load more // Scroll event on list to load more
this.$els.list.onscroll = () => { this.$els.list.onscroll = () => {
if ((this.scrollTop() > this.scrollHeight() - this.scrollOffset) && !this.loadingMore) { if ((this.scrollTop() > this.scrollHeight() - this.scrollOffset) && !this.list.loadingMore) {
this.loadNextPage(); this.loadNextPage();
} }
}; };
......
...@@ -7,6 +7,7 @@ class List { ...@@ -7,6 +7,7 @@ class List {
this.filters = BoardsStore.state.filters; this.filters = BoardsStore.state.filters;
this.page = 1; this.page = 1;
this.loading = true; this.loading = true;
this.loadingMore = false;
this.issues = []; this.issues = [];
if (obj.label) { if (obj.label) {
......
...@@ -133,6 +133,11 @@ ...@@ -133,6 +133,11 @@
} }
} }
.board-header-loading-spinner {
margin-right: 10px;
color: $gray-darkest;
}
.board-inner-container { .board-inner-container {
border-bottom: 1px solid $border-color; border-bottom: 1px solid $border-color;
padding: $gl-padding; padding: $gl-padding;
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
":list" => "list" } ":list" => "list" }
%button.board-delete.has-tooltip.pull-right{ type: "button", title: "Delete list", "aria-label" => "Delete list", data: { placement: "bottom" }, "@click" => "deleteBoard" } %button.board-delete.has-tooltip.pull-right{ type: "button", title: "Delete list", "aria-label" => "Delete list", data: { placement: "bottom" }, "@click" => "deleteBoard" }
= icon("trash") = icon("trash")
= icon("spinner spin", class: "board-header-loading-spinner pull-right", "v-show" => "list.loadingMore")
.board-inner-container.board-search-container{ "v-if" => "list.canSearch()" } .board-inner-container.board-search-container{ "v-if" => "list.canSearch()" }
%input.form-control{ type: "text", placeholder: "Search issues", "v-model" => "query", "debounce" => "250" } %input.form-control{ type: "text", placeholder: "Search issues", "v-model" => "query", "debounce" => "250" }
= icon("search", class: "board-search-icon", "v-show" => "!query") = icon("search", class: "board-search-icon", "v-show" => "!query")
......
...@@ -46,6 +46,18 @@ ...@@ -46,6 +46,18 @@
expect(list).toBeDefined(); expect(list).toBeDefined();
}); });
it('finds list limited by type', () => {
BoardsStore.addList({
id: 1,
position: 0,
title: 'Test',
list_type: 'backlog'
});
const list = BoardsStore.findList('id', 1, 'backlog');
expect(list).toBeDefined();
});
it('gets issue when new list added', (done) => { it('gets issue when new list added', (done) => {
BoardsStore.addList(listObj); BoardsStore.addList(listObj);
const list = BoardsStore.findList('id', 1); const list = BoardsStore.findList('id', 1);
......
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