Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
acd86c12
Commit
acd86c12
authored
Jan 25, 2017
by
Phil Hughes
Committed by
Fatih Acet
Feb 03, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Search bar now returns data
Selected data is added into a different array
parent
38d84c13
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
72 additions
and
35 deletions
+72
-35
app/assets/javascripts/boards/components/modal/footer.js.es6
app/assets/javascripts/boards/components/modal/footer.js.es6
+1
-1
app/assets/javascripts/boards/components/modal/header.js.es6
app/assets/javascripts/boards/components/modal/header.js.es6
+2
-2
app/assets/javascripts/boards/components/modal/list.js.es6
app/assets/javascripts/boards/components/modal/list.js.es6
+17
-6
app/assets/javascripts/boards/components/modal/modal.es6
app/assets/javascripts/boards/components/modal/modal.es6
+30
-5
app/assets/javascripts/boards/components/modal/search.js.es6
app/assets/javascripts/boards/components/modal/search.js.es6
+13
-2
app/assets/javascripts/boards/services/board_service.js.es6
app/assets/javascripts/boards/services/board_service.js.es6
+2
-2
app/assets/javascripts/boards/stores/boards_store.js.es6
app/assets/javascripts/boards/stores/boards_store.js.es6
+7
-17
No files found.
app/assets/javascripts/boards/components/modal/footer.js.es6
View file @
acd86c12
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
},
},
addIssues() {
addIssues() {
const list = this.store.selectedList;
const list = this.store.selectedList;
const issueIds = this.store.
issues.filter(issue => issue.selected)
.map(issue => issue.id);
const issueIds = this.store.
selectedIssues
.map(issue => issue.id);
// Post the data to the backend
// Post the data to the backend
gl.boardService.addMultipleIssues(list, issueIds);
gl.boardService.addMultipleIssues(list, issueIds);
...
...
app/assets/javascripts/boards/components/modal/header.js.es6
View file @
acd86c12
...
@@ -25,8 +25,8 @@
...
@@ -25,8 +25,8 @@
<modal-dismiss></modal-dismiss>
<modal-dismiss></modal-dismiss>
</h2>
</h2>
</header>
</header>
<modal-tabs v-if="
issues.length
"></modal-tabs>
<modal-tabs v-if="
!loading
"></modal-tabs>
<modal-search v-if="
issues.length
"></modal-search>
<modal-search v-if="
!loading
"></modal-search>
</div>
</div>
`,
`,
});
});
...
...
app/assets/javascripts/boards/components/modal/list.js.es6
View file @
acd86c12
...
@@ -22,9 +22,7 @@
...
@@ -22,9 +22,7 @@
issues: {
issues: {
handler() {
handler() {
this.$nextTick(() => {
this.$nextTick(() => {
if (this.activeTab === 'selected') {
listMasonry.layout();
listMasonry.layout();
}
});
});
},
},
deep: true,
deep: true,
...
@@ -37,12 +35,26 @@
...
@@ -37,12 +35,26 @@
selectedCount() {
selectedCount() {
return Store.modalSelectedCount();
return Store.modalSelectedCount();
},
},
loopIssues() {
if (this.activeTab === 'all') {
return this.issues;
}
return this.selectedIssues;
},
},
},
methods: {
methods: {
toggleIssue(issueObj) {
toggleIssue(issueObj) {
const issue = issueObj;
const issue = issueObj;
issue.selected = !issue.selected;
issue.selected = !issue.selected;
if (issue.selected) {
this.selectedIssues.push(issue);
} else {
// Remove this issue
const index = this.selectedIssues.indexOf(issue);
this.selectedIssues.splice(index, 1);
}
},
},
showIssue(issue) {
showIssue(issue) {
if (this.activeTab === 'all') return true;
if (this.activeTab === 'all') return true;
...
@@ -64,7 +76,6 @@
...
@@ -64,7 +76,6 @@
this.initMasonry();
this.initMasonry();
},
},
destroyed() {
destroyed() {
this.issues = [];
this.destroyMasonry();
this.destroyMasonry();
},
},
components: {
components: {
...
@@ -77,7 +88,7 @@
...
@@ -77,7 +88,7 @@
ref="list"
ref="list"
v-show="!loading">
v-show="!loading">
<div
<div
v-for="issue in
i
ssues"
v-for="issue in
loopI
ssues"
v-if="showIssue(issue)"
v-if="showIssue(issue)"
class="card-parent">
class="card-parent">
<div
<div
...
...
app/assets/javascripts/boards/components/modal/modal.es6
View file @
acd86c12
...
@@ -12,16 +12,41 @@
...
@@ -12,16 +12,41 @@
data() {
data() {
return Store.modal;
return Store.modal;
},
},
watch: {
searchTerm() {
this.searchOperation();
},
},
mounted() {
mounted() {
gl.boardService.getBacklog()
this.loading = true;
.then((res) => {
this.loadIssues()
.then(() => {
this.loading = false;
});
},
methods: {
searchOperation: _.debounce(function() {
this.loadIssues();
}, 500),
loadIssues() {
return gl.boardService.getBacklog({
search: this.searchTerm,
}).then((res) => {
const data = res.json();
const data = res.json();
this.issues = [];
data.forEach((issueObj) => {
data.forEach((issueObj) => {
this.issues.push(new ListIssue(issueObj));
const issue = new ListIssue(issueObj);
const foundSelectedIssue = this.selectedIssues
.filter(filteredIssue => filteredIssue.id === issue.id)[0];
issue.selected = foundSelectedIssue !== undefined;
this.issues.push(issue);
});
});
});
});
},
},
},
components: {
components: {
'modal-header': gl.issueBoards.IssuesModalHeader,
'modal-header': gl.issueBoards.IssuesModalHeader,
'modal-list': gl.issueBoards.ModalList,
'modal-list': gl.issueBoards.ModalList,
...
@@ -33,10 +58,10 @@
...
@@ -33,10 +58,10 @@
v-if="showAddIssuesModal">
v-if="showAddIssuesModal">
<div class="add-issues-container">
<div class="add-issues-container">
<modal-header></modal-header>
<modal-header></modal-header>
<modal-list v-if="
issues.length
"></modal-list>
<modal-list v-if="
!loading
"></modal-list>
<section
<section
class="add-issues-list"
class="add-issues-list"
v-if="
issues.length == 0
">
v-if="
loading
">
<div class="add-issues-list-loading">
<div class="add-issues-list-loading">
<i class="fa fa-spinner fa-spin"></i>
<i class="fa fa-spinner fa-spin"></i>
</div>
</div>
...
...
app/assets/javascripts/boards/components/modal/search.js.es6
View file @
acd86c12
...
@@ -24,7 +24,17 @@
...
@@ -24,7 +24,17 @@
this.issues.forEach((issue) => {
this.issues.forEach((issue) => {
const issueUpdate = issue;
const issueUpdate = issue;
if (issueUpdate.selected !== select) {
issueUpdate.selected = select;
issueUpdate.selected = select;
if (select) {
this.selectedIssues.push(issueUpdate);
} else {
const index = this.selectedIssues.indexOf(issue);
this.selectedIssues.splice(index, 1);
}
}
});
});
},
},
},
},
...
@@ -35,7 +45,8 @@
...
@@ -35,7 +45,8 @@
<input
<input
placeholder="Search issues..."
placeholder="Search issues..."
class="form-control"
class="form-control"
type="search" />
type="search"
v-model="searchTerm" />
<button
<button
type="button"
type="button"
class="btn btn-success btn-inverted"
class="btn btn-success btn-inverted"
...
...
app/assets/javascripts/boards/services/board_service.js.es6
View file @
acd86c12
...
@@ -76,8 +76,8 @@ class BoardService {
...
@@ -76,8 +76,8 @@ class BoardService {
});
});
}
}
getBacklog() {
getBacklog(
data
) {
return this.boards.backlog();
return this.boards.backlog(
data
);
}
}
addMultipleIssues(list, issue_ids) {
addMultipleIssues(list, issue_ids) {
...
...
app/assets/javascripts/boards/stores/boards_store.js.es6
View file @
acd86c12
...
@@ -14,9 +14,12 @@
...
@@ -14,9 +14,12 @@
},
},
modal: {
modal: {
issues: [],
issues: [],
selectedIssues: [],
showAddIssuesModal: false,
showAddIssuesModal: false,
activeTab: 'all',
activeTab: 'all',
selectedList: {}
selectedList: {},
searchTerm: '',
loading: false,
},
},
moving: {
moving: {
issue: {},
issue: {},
...
@@ -40,15 +43,10 @@
...
@@ -40,15 +43,10 @@
},
},
new (listObj) {
new (listObj) {
const list = this.addList(listObj);
const list = this.addList(listObj);
const backlogList = this.findList('type', 'backlog', 'backlog');
list
list
.save()
.save()
.then(() => {
.then(() => {
// Remove any new issues from the backlog
// as they will be visible in the new list
list.issues.forEach(backlogList.removeIssue.bind(backlogList));
this.state.lists = _.sortBy(this.state.lists, 'position');
this.state.lists = _.sortBy(this.state.lists, 'position');
});
});
this.removeBlankState();
this.removeBlankState();
...
@@ -58,7 +56,7 @@
...
@@ -58,7 +56,7 @@
},
},
shouldAddBlankState () {
shouldAddBlankState () {
// Decide whether to add the blank state
// Decide whether to add the blank state
return !(this.state.lists.filter(list => list.type !== '
backlog' && list.type !== '
done')[0]);
return !(this.state.lists.filter(list => list.type !== 'done')[0]);
},
},
addBlankState () {
addBlankState () {
if (!this.shouldAddBlankState() || this.welcomeIsHidden() || this.disabled) return;
if (!this.shouldAddBlankState() || this.welcomeIsHidden() || this.disabled) return;
...
@@ -108,7 +106,7 @@
...
@@ -108,7 +106,7 @@
listTo.addIssue(issue, listFrom, newIndex);
listTo.addIssue(issue, listFrom, newIndex);
}
}
if (listTo.type === 'done'
&& listFrom.type !== 'backlog'
) {
if (listTo.type === 'done') {
issueLists.forEach((list) => {
issueLists.forEach((list) => {
list.removeIssue(issue);
list.removeIssue(issue);
});
});
...
@@ -128,15 +126,7 @@
...
@@ -128,15 +126,7 @@
history.pushState(null, null, `?${$.param(this.state.filters)}`);
history.pushState(null, null, `?${$.param(this.state.filters)}`);
},
},
modalSelectedCount() {
modalSelectedCount() {
let count = 0;
return this.modal.selectedIssues.length;
this.modal.issues.forEach((issue) => {
if (issue.selected) {
count += 1;
}
});
return count;
},
},
};
};
})();
})();
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment