Commit 39fbd189 authored by Phil Hughes's avatar Phil Hughes Committed by Fatih Acet

Fixed bug with empty state showing after search

Fixed users href path being incorrect
parent 1b01386a
...@@ -44,6 +44,7 @@ $(() => { ...@@ -44,6 +44,7 @@ $(() => {
boardId: $boardApp.dataset.boardId, boardId: $boardApp.dataset.boardId,
disabled: $boardApp.dataset.disabled === 'true', disabled: $boardApp.dataset.disabled === 'true',
issueLinkBase: $boardApp.dataset.issueLinkBase, issueLinkBase: $boardApp.dataset.issueLinkBase,
rootPath: $boardApp.dataset.rootPath,
detailIssue: Store.detail detailIssue: Store.detail
}, },
computed: { computed: {
......
...@@ -22,7 +22,8 @@ ...@@ -22,7 +22,8 @@
props: { props: {
list: Object, list: Object,
disabled: Boolean, disabled: Boolean,
issueLinkBase: String issueLinkBase: String,
rootPath: String,
}, },
data () { data () {
return { return {
......
...@@ -18,7 +18,8 @@ ...@@ -18,7 +18,8 @@
issue: Object, issue: Object,
issueLinkBase: String, issueLinkBase: String,
disabled: Boolean, disabled: Boolean,
index: Number index: Number,
rootPath: String,
}, },
data () { data () {
return { return {
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
issues: Array, issues: Array,
loading: Boolean, loading: Boolean,
issueLinkBase: String, issueLinkBase: String,
rootPath: String,
}, },
data () { data () {
return { return {
......
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
gl.Subscription.bindAll('.subscription'); gl.Subscription.bindAll('.subscription');
}, },
components: { components: {
'remove-btn': gl.issueBoards.RemoveIssueBtn, removeBtn: gl.issueBoards.RemoveIssueBtn,
}, },
}); });
})(); })();
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
gl.issueBoards.IssueCardInner = Vue.extend({ gl.issueBoards.IssueCardInner = Vue.extend({
props: [ props: [
'issue', 'issueLinkBase', 'list', 'issue', 'issueLinkBase', 'list', 'rootPath',
], ],
methods: { methods: {
showLabel(label) { showLabel(label) {
...@@ -57,11 +57,11 @@ ...@@ -57,11 +57,11 @@
<span <span
class="card-number" class="card-number"
v-if="issue.id"> v-if="issue.id">
#{{issue.id}} #{{ issue.id }}
</span> </span>
<a <a
class="card-assignee has-tooltip" class="card-assignee has-tooltip"
:href="issue.assignee.username" :href="rootPath + issue.assignee.username"
:title="'Assigned to ' + issue.assignee.name" :title="'Assigned to ' + issue.assignee.name"
v-if="issue.assignee" v-if="issue.assignee"
data-container="body"> data-container="body">
...@@ -69,7 +69,8 @@ ...@@ -69,7 +69,8 @@
class="avatar avatar-inline s20" class="avatar avatar-inline s20"
:src="issue.assignee.avatar" :src="issue.assignee.avatar"
width="20" width="20"
height="20" /> height="20"
:alt="'Avatar for ' + issue.assignee.name" />
</a> </a>
<button <button
class="label color-label has-tooltip" class="label color-label has-tooltip"
......
...@@ -31,10 +31,10 @@ ...@@ -31,10 +31,10 @@
}, },
}, },
template: ` template: `
<div class="empty-state"> <section class="empty-state">
<div class="row"> <div class="row">
<div class="col-xs-12 col-sm-6 col-sm-push-6"> <div class="col-xs-12 col-sm-6 col-sm-push-6">
<div class="svg-content" v-html="image"></div> <aside class="svg-content" v-html="image"></aside>
</div> </div>
<div class="col-xs-12 col-sm-6 col-sm-pull-6"> <div class="col-xs-12 col-sm-6 col-sm-pull-6">
<div class="text-content"> <div class="text-content">
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
</div> </div>
</div> </div>
</div> </div>
</div> </section>
`, `,
}); });
})(); })();
...@@ -27,8 +27,7 @@ ...@@ -27,8 +27,7 @@
addIssues() { addIssues() {
const list = this.selectedList; const list = this.selectedList;
const selectedIssues = ModalStore.getSelectedIssues(); const selectedIssues = ModalStore.getSelectedIssues();
const issueIds = selectedIssues.filter(issue => issue.selected) const issueIds = selectedIssues.map(issue => issue.globalId);
.map(issue => issue.globalId);
// Post the data to the backend // Post the data to the backend
this.$http.post(this.bulkUpdatePath, { this.$http.post(this.bulkUpdatePath, {
......
...@@ -41,10 +41,10 @@ ...@@ -41,10 +41,10 @@
</button> </button>
</h2> </h2>
</header> </header>
<modal-tabs v-if="!loading && issues.length > 0"></modal-tabs> <modal-tabs v-if="!loading && issuesCount > 0"></modal-tabs>
<div <div
class="add-issues-search append-bottom-10" class="add-issues-search append-bottom-10"
v-if="activeTab == 'all' && !loading && issues.length > 0"> v-if="activeTab == 'all' && !loading && issuesCount > 0">
<input <input
placeholder="Search issues..." placeholder="Search issues..."
class="form-control" class="form-control"
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
gl.issueBoards.IssuesModal = Vue.extend({ gl.issueBoards.IssuesModal = Vue.extend({
props: [ props: [
'blankStateImage', 'newIssuePath', 'bulkUpdatePath', 'issueLinkBase', 'blankStateImage', 'newIssuePath', 'bulkUpdatePath', 'issueLinkBase',
'rootPath',
], ],
data() { data() {
return ModalStore.store; return ModalStore.store;
...@@ -57,6 +58,10 @@ ...@@ -57,6 +58,10 @@
}); });
this.loadingNewPage = false; this.loadingNewPage = false;
if (!this.issuesCount) {
this.issuesCount = this.issues.length;
}
}); });
}, },
}, },
...@@ -66,7 +71,7 @@ ...@@ -66,7 +71,7 @@
return this.selectedIssues.length > 0; return this.selectedIssues.length > 0;
} }
return this.issues.length > 0; return this.issuesCount > 0;
}, },
}, },
components: { components: {
...@@ -83,9 +88,10 @@ ...@@ -83,9 +88,10 @@
<modal-header></modal-header> <modal-header></modal-header>
<modal-list <modal-list
:issue-link-base="issueLinkBase" :issue-link-base="issueLinkBase"
:root-path="rootPath"
v-if="!loading && showList"></modal-list> v-if="!loading && showList"></modal-list>
<empty-state <empty-state
v-if="(!loading && issues.length === 0) || (activeTab === 'selected' && selectedIssues.length === 0)" v-if="(!loading && issuesCount === 0) || (activeTab === 'selected' && selectedIssues.length === 0)"
:image="blankStateImage" :image="blankStateImage"
:new-issue-path="newIssuePath"></empty-state> :new-issue-path="newIssuePath"></empty-state>
<section <section
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
gl.issueBoards.ModalList = Vue.extend({ gl.issueBoards.ModalList = Vue.extend({
props: [ props: [
'issueLinkBase', 'issueLinkBase', 'rootPath',
], ],
data() { data() {
return ModalStore.store; return ModalStore.store;
...@@ -97,7 +97,7 @@ ...@@ -97,7 +97,7 @@
issueCardInner: gl.issueBoards.IssueCardInner, issueCardInner: gl.issueBoards.IssueCardInner,
}, },
template: ` template: `
<div <section
class="add-issues-list add-issues-list-columns" class="add-issues-list add-issues-list-columns"
ref="list"> ref="list">
<div <div
...@@ -110,16 +110,19 @@ ...@@ -110,16 +110,19 @@
@click="toggleIssue($event, issue)"> @click="toggleIssue($event, issue)">
<issue-card-inner <issue-card-inner
:issue="issue" :issue="issue"
:issue-link-base="issueLinkBase"> :issue-link-base="issueLinkBase"
:root-path="rootPath">
</issue-card-inner> </issue-card-inner>
<span <span
:aria-label="'Issue #' + issue.id + ' selected'"
aria-checked="true"
v-if="issue.selected" v-if="issue.selected"
class="issue-card-selected text-center"> class="issue-card-selected text-center">
<i class="fa fa-check"></i> <i class="fa fa-check"></i>
</span> </span>
</div> </div>
</div> </div>
</div> </section>
`, `,
}); });
})(); })();
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
@click.prevent="activeTab = 'all'"> @click.prevent="activeTab = 'all'">
<span>All issues</span> <span>All issues</span>
<span class="badge"> <span class="badge">
{{ issues.length }} {{ issuesCount }}
</span> </span>
</a> </a>
</li> </li>
......
...@@ -13,7 +13,7 @@ class BoardService { ...@@ -13,7 +13,7 @@ class BoardService {
generate: { generate: {
method: 'POST', method: 'POST',
url: `${root}/${boardId}/lists/generate.json` url: `${root}/${boardId}/lists/generate.json`
}, }
}); });
this.issue = Vue.resource(`${root}/${boardId}/issues{/id}`, {}); this.issue = Vue.resource(`${root}/${boardId}/issues{/id}`, {});
this.issues = Vue.resource(`${root}/${boardId}/lists{/id}/issues`, {}); this.issues = Vue.resource(`${root}/${boardId}/lists{/id}/issues`, {});
......
...@@ -115,9 +115,6 @@ ...@@ -115,9 +115,6 @@
}, },
updateFiltersUrl () { updateFiltersUrl () {
history.pushState(null, null, `?${$.param(this.state.filters)}`); history.pushState(null, null, `?${$.param(this.state.filters)}`);
}, }
modalSelectedCount() {
return this.modal.selectedIssues.length;
},
}; };
})(); })();
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
constructor() { constructor() {
this.store = { this.store = {
issues: [], issues: [],
issuesCount: false,
selectedIssues: [], selectedIssues: [],
showAddIssuesModal: false, showAddIssuesModal: false,
activeTab: 'all', activeTab: 'all',
...@@ -19,7 +20,7 @@ ...@@ -19,7 +20,7 @@
} }
selectedCount() { selectedCount() {
return this.store.selectedIssues.filter(issue => issue.selected).length; return this.getSelectedIssues().length;
} }
toggleIssue(issueObj) { toggleIssue(issueObj) {
......
...@@ -6,7 +6,8 @@ module BoardsHelper ...@@ -6,7 +6,8 @@ module BoardsHelper
endpoint: namespace_project_boards_path(@project.namespace, @project), endpoint: namespace_project_boards_path(@project.namespace, @project),
board_id: board.id, board_id: board.id,
disabled: "#{!can?(current_user, :admin_list, @project)}", disabled: "#{!can?(current_user, :admin_list, @project)}",
issue_link_base: namespace_project_issues_path(@project.namespace, @project) issue_link_base: namespace_project_issues_path(@project.namespace, @project),
root_path: root_path,
} }
end end
end end
...@@ -24,9 +24,11 @@ ...@@ -24,9 +24,11 @@
":list" => "list", ":list" => "list",
":disabled" => "disabled", ":disabled" => "disabled",
":issue-link-base" => "issueLinkBase", ":issue-link-base" => "issueLinkBase",
":root-path" => "rootPath",
":key" => "_uid" } ":key" => "_uid" }
= render "projects/boards/components/sidebar" = render "projects/boards/components/sidebar"
%board-add-issues-modal{ "blank-state-image" => render('shared/empty_states/icons/issues.svg'), %board-add-issues-modal{ "blank-state-image" => render('shared/empty_states/icons/issues.svg'),
"new-issue-path" => new_namespace_project_issue_path(@project.namespace, @project), "new-issue-path" => new_namespace_project_issue_path(@project.namespace, @project),
"bulk-update-path" => bulk_update_namespace_project_issues_path(@project.namespace, @project), "bulk-update-path" => bulk_update_namespace_project_issues_path(@project.namespace, @project),
":issue-link-base" => "issueLinkBase" } ":issue-link-base" => "issueLinkBase",
":root-path" => "rootPath" }
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
":loading" => "list.loading", ":loading" => "list.loading",
":disabled" => "disabled", ":disabled" => "disabled",
":issue-link-base" => "issueLinkBase", ":issue-link-base" => "issueLinkBase",
":root-path" => "rootPath",
"ref" => "board-list" } "ref" => "board-list" }
- if can?(current_user, :admin_list, @project) - if can?(current_user, :admin_list, @project)
= render "projects/boards/components/blank_state" = render "projects/boards/components/blank_state"
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
":list" => "list", ":list" => "list",
":issue" => "issue", ":issue" => "issue",
":issue-link-base" => "issueLinkBase", ":issue-link-base" => "issueLinkBase",
":root-path" => "rootPath",
":disabled" => "disabled", ":disabled" => "disabled",
":key" => "issue.id" } ":key" => "issue.id" }
%li.board-list-count.text-center{ "v-if" => "showCount" } %li.board-list-count.text-center{ "v-if" => "showCount" }
......
...@@ -6,4 +6,5 @@ ...@@ -6,4 +6,5 @@
"@mouseup" => "showIssue($event)" } "@mouseup" => "showIssue($event)" }
%issue-card-inner{ ":list" => "list", %issue-card-inner{ ":list" => "list",
":issue" => "issue", ":issue" => "issue",
":issue-link-base" => "issueLinkBase" } ":issue-link-base" => "issueLinkBase",
":root-path" => "rootPath" }
...@@ -90,6 +90,7 @@ describe 'Issue Boards add issue modal', :feature, :js do ...@@ -90,6 +90,7 @@ describe 'Issue Boards add issue modal', :feature, :js do
find('.form-control').native.send_keys('testing search') find('.form-control').native.send_keys('testing search')
expect(page).not_to have_selector('.card') expect(page).not_to have_selector('.card')
expect(page).not_to have_content("You haven't added any issues to your project yet")
end end
end end
end end
......
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