提交 3aabf0c6 编写于 作者: P Phil Hughes 提交者: Fatih Acet

Used issue bulk update instead of different endpoint

上级 54461ce2
......@@ -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) => {
......
......@@ -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>
`,
......
......@@ -6,6 +6,7 @@
class ListIssue {
constructor (obj) {
this._id = obj.id;
this.id = obj.iid;
this.title = obj.title;
this.confidential = obj.confidential;
......
......@@ -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;
......@@ -50,10 +50,6 @@ module Projects
end
end
def multiple
head :ok
end
private
def authorize_admin_list!
......
......@@ -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] }
......
......@@ -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) }
......@@ -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]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册