Used issue bulk update instead of different endpoint
This commit is contained in:
parent
54461ce2a3
commit
3aabf0c6aa
8 changed files with 16 additions and 21 deletions
|
@ -4,6 +4,9 @@
|
||||||
const ModalStore = gl.issueBoards.ModalStore;
|
const ModalStore = gl.issueBoards.ModalStore;
|
||||||
|
|
||||||
gl.issueBoards.ModalFooter = Vue.extend({
|
gl.issueBoards.ModalFooter = Vue.extend({
|
||||||
|
props: [
|
||||||
|
'bulkUpdatePath',
|
||||||
|
],
|
||||||
data() {
|
data() {
|
||||||
return ModalStore.store;
|
return ModalStore.store;
|
||||||
},
|
},
|
||||||
|
@ -23,10 +26,15 @@
|
||||||
},
|
},
|
||||||
addIssues() {
|
addIssues() {
|
||||||
const list = this.selectedList;
|
const list = this.selectedList;
|
||||||
const issueIds = this.selectedIssues.map(issue => issue.id);
|
const issueIds = this.selectedIssues.map(issue => issue._id);
|
||||||
|
|
||||||
// Post the data to the backend
|
// Post the data to the backend
|
||||||
gl.boardService.addMultipleIssues(list, issueIds);
|
this.$http.post(this.bulkUpdatePath, {
|
||||||
|
update: {
|
||||||
|
issuable_ids: issueIds.join(','),
|
||||||
|
add_label_ids: [list.label.id],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
// Add the issues on the frontend
|
// Add the issues on the frontend
|
||||||
this.selectedIssues.forEach((issue) => {
|
this.selectedIssues.forEach((issue) => {
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
gl.issueBoards.IssuesModal = Vue.extend({
|
gl.issueBoards.IssuesModal = Vue.extend({
|
||||||
props: [
|
props: [
|
||||||
'blankStateImage', 'newIssuePath',
|
'blankStateImage', 'newIssuePath', 'bulkUpdatePath',
|
||||||
],
|
],
|
||||||
data() {
|
data() {
|
||||||
return ModalStore.store;
|
return ModalStore.store;
|
||||||
|
@ -86,7 +86,7 @@
|
||||||
<i class="fa fa-spinner fa-spin"></i>
|
<i class="fa fa-spinner fa-spin"></i>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<modal-footer></modal-footer>
|
<modal-footer :bulk-update-path="bulkUpdatePath"></modal-footer>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
class ListIssue {
|
class ListIssue {
|
||||||
constructor (obj) {
|
constructor (obj) {
|
||||||
|
this._id = obj.id;
|
||||||
this.id = obj.iid;
|
this.id = obj.iid;
|
||||||
this.title = obj.title;
|
this.title = obj.title;
|
||||||
this.confidential = obj.confidential;
|
this.confidential = obj.confidential;
|
||||||
|
|
|
@ -14,10 +14,6 @@ class BoardService {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: `${root}/${boardId}/lists/generate.json`
|
url: `${root}/${boardId}/lists/generate.json`
|
||||||
},
|
},
|
||||||
multiple: {
|
|
||||||
method: 'POST',
|
|
||||||
url: `${root}/${boardId}/lists{/id}/multiple`
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
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`, {});
|
||||||
|
@ -79,12 +75,6 @@ class BoardService {
|
||||||
getBacklog(data) {
|
getBacklog(data) {
|
||||||
return this.boards.backlog(data);
|
return this.boards.backlog(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
addMultipleIssues(list, issue_ids) {
|
|
||||||
return this.lists.multiple(list.id, {
|
|
||||||
issue_ids,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
window.BoardService = BoardService;
|
window.BoardService = BoardService;
|
||||||
|
|
|
@ -50,10 +50,6 @@ module Projects
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def multiple
|
|
||||||
head :ok
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def authorize_admin_list!
|
def authorize_admin_list!
|
||||||
|
|
|
@ -37,7 +37,7 @@ class Projects::BoardsController < Projects::ApplicationController
|
||||||
|
|
||||||
render json: @issues.as_json(
|
render json: @issues.as_json(
|
||||||
labels: true,
|
labels: true,
|
||||||
only: [:iid, :title, :confidential, :due_date],
|
only: [:id, :iid, :title, :confidential, :due_date],
|
||||||
include: {
|
include: {
|
||||||
assignee: { only: [:id, :name, :username], methods: [:avatar_url] },
|
assignee: { only: [:id, :name, :username], methods: [:avatar_url] },
|
||||||
milestone: { only: [:id, :title] }
|
milestone: { only: [:id, :title] }
|
||||||
|
|
|
@ -27,4 +27,5 @@
|
||||||
":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) }
|
||||||
|
|
|
@ -274,7 +274,6 @@ constraints(ProjectUrlConstrainer.new) do
|
||||||
resources :lists, only: [:index, :create, :update, :destroy] do
|
resources :lists, only: [:index, :create, :update, :destroy] do
|
||||||
collection do
|
collection do
|
||||||
post :generate
|
post :generate
|
||||||
post :multiple
|
|
||||||
end
|
end
|
||||||
|
|
||||||
resources :issues, only: [:index, :create]
|
resources :issues, only: [:index, :create]
|
||||||
|
|
Loading…
Reference in a new issue