Used issue bulk update instead of different endpoint

This commit is contained in:
Phil Hughes 2017-01-26 16:03:07 +00:00 committed by Fatih Acet
parent 54461ce2a3
commit 3aabf0c6aa
8 changed files with 16 additions and 21 deletions

View file

@ -4,6 +4,9 @@
const ModalStore = gl.issueBoards.ModalStore;
gl.issueBoards.ModalFooter = Vue.extend({
props: [
'bulkUpdatePath',
],
data() {
return ModalStore.store;
},
@ -23,10 +26,15 @@
},
addIssues() {
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
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
this.selectedIssues.forEach((issue) => {

View file

@ -9,7 +9,7 @@
gl.issueBoards.IssuesModal = Vue.extend({
props: [
'blankStateImage', 'newIssuePath',
'blankStateImage', 'newIssuePath', 'bulkUpdatePath',
],
data() {
return ModalStore.store;
@ -86,7 +86,7 @@
<i class="fa fa-spinner fa-spin"></i>
</div>
</section>
<modal-footer></modal-footer>
<modal-footer :bulk-update-path="bulkUpdatePath"></modal-footer>
</div>
</div>
`,

View file

@ -6,6 +6,7 @@
class ListIssue {
constructor (obj) {
this._id = obj.id;
this.id = obj.iid;
this.title = obj.title;
this.confidential = obj.confidential;

View file

@ -14,10 +14,6 @@ class BoardService {
method: 'POST',
url: `${root}/${boardId}/lists/generate.json`
},
multiple: {
method: 'POST',
url: `${root}/${boardId}/lists{/id}/multiple`
},
});
this.issue = Vue.resource(`${root}/${boardId}/issues{/id}`, {});
this.issues = Vue.resource(`${root}/${boardId}/lists{/id}/issues`, {});
@ -79,12 +75,6 @@ class BoardService {
getBacklog(data) {
return this.boards.backlog(data);
}
addMultipleIssues(list, issue_ids) {
return this.lists.multiple(list.id, {
issue_ids,
});
}
}
window.BoardService = BoardService;

View file

@ -50,10 +50,6 @@ module Projects
end
end
def multiple
head :ok
end
private
def authorize_admin_list!

View file

@ -37,7 +37,7 @@ class Projects::BoardsController < Projects::ApplicationController
render json: @issues.as_json(
labels: true,
only: [:iid, :title, :confidential, :due_date],
only: [:id, :iid, :title, :confidential, :due_date],
include: {
assignee: { only: [:id, :name, :username], methods: [:avatar_url] },
milestone: { only: [:id, :title] }

View file

@ -27,4 +27,5 @@
":key" => "_uid" }
= render "projects/boards/components/sidebar"
%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) }

View file

@ -274,7 +274,6 @@ constraints(ProjectUrlConstrainer.new) do
resources :lists, only: [:index, :create, :update, :destroy] do
collection do
post :generate
post :multiple
end
resources :issues, only: [:index, :create]