Commit af527e27 authored by Oswaldo Ferreira's avatar Oswaldo Ferreira

Merge branch '2518-saved-configuration-for-issue-board' of...

Merge branch '2518-saved-configuration-for-issue-board' of https://gitlab.com/gitlab-org/gitlab-ee into 2518-saved-configuration-for-issue-board
parents 1ea0cd21 63b7cdc6
<script> <script>
/* global BoardService */ /* global BoardService */
/* global Flash */
import Flash from '~/flash';
import PopupDialog from '~/vue_shared/components/popup_dialog.vue'; import PopupDialog from '~/vue_shared/components/popup_dialog.vue';
import BoardMilestoneSelect from './milestone_select.vue'; import BoardMilestoneSelect from './milestone_select.vue';
import BoardWeightSelect from './weight_select.vue'; import BoardWeightSelect from './weight_select.vue';
...@@ -65,7 +65,7 @@ export default { ...@@ -65,7 +65,7 @@ export default {
currentPage: Store.state.currentPage, currentPage: Store.state.currentPage,
milestones: [], milestones: [],
milestoneDropdownOpen: false, milestoneDropdownOpen: false,
submitDisabled: false, isLoading: false,
}; };
}, },
components: { components: {
...@@ -115,9 +115,6 @@ export default { ...@@ -115,9 +115,6 @@ export default {
} }
return 'Edit board'; return 'Edit board';
}, },
milestoneToggleText() {
return this.board.milestone ? this.board.milestone.title : 'Milestone';
},
expandButtonText() { expandButtonText() {
return this.expanded ? 'Collapse' : 'Expand'; return this.expanded ? 'Collapse' : 'Expand';
}, },
...@@ -130,18 +127,22 @@ export default { ...@@ -130,18 +127,22 @@ export default {
weightsArray() { weightsArray() {
return JSON.parse(this.weights); return JSON.parse(this.weights);
}, },
submitDisabled() {
return this.isLoading || this.board.name.length === 0;
},
}, },
methods: { methods: {
submit() { submit() {
if (this.board.name.length === 0) return;
this.isLoading = true;
if (this.isDeleteForm) { if (this.isDeleteForm) {
this.submitDisabled = true;
gl.boardService.deleteBoard(this.currentBoard) gl.boardService.deleteBoard(this.currentBoard)
.then(() => { .then(() => {
gl.utils.visitUrl(Store.rootPath); gl.utils.visitUrl(Store.rootPath);
}) })
.catch(() => { .catch(() => {
Flash('Failed to delete board. Please try again.'); Flash('Failed to delete board. Please try again.');
this.submitDisabled = false; this.isLoading = false;
}); });
} else { } else {
gl.boardService.createBoard(this.board) gl.boardService.createBoard(this.board)
...@@ -151,6 +152,7 @@ export default { ...@@ -151,6 +152,7 @@ export default {
}) })
.catch(() => { .catch(() => {
Flash('Unable to save your changes. Please try again.'); Flash('Unable to save your changes. Please try again.');
this.isLoading = false;
}); });
} }
}, },
...@@ -194,6 +196,7 @@ export default { ...@@ -194,6 +196,7 @@ export default {
<form <form
v-else v-else
class="js-board-config-modal" class="js-board-config-modal"
@submit.prevent
> >
<div <div
v-if="!readonly" v-if="!readonly"
...@@ -211,6 +214,7 @@ export default { ...@@ -211,6 +214,7 @@ export default {
type="text" type="text"
id="board-new-name" id="board-new-name"
v-model="board.name" v-model="board.name"
@keyup.enter="submit"
placeholder="Enter board name" placeholder="Enter board name"
> >
</div> </div>
......
...@@ -112,9 +112,6 @@ export default { ...@@ -112,9 +112,6 @@ export default {
</div> </div>
</div> </div>
</div> </div>
<div <div class="modal-backdrop fade in" />
class="modal-backdrop fade in"
@click="close"
/>
</div> </div>
</template> </template>
...@@ -12,15 +12,17 @@ class BoardsStoreEE { ...@@ -12,15 +12,17 @@ class BoardsStoreEE {
this.removePromotion(); this.removePromotion();
}; };
this.store.boardConfig = { if (this.$boardApp) {
milestoneId: parseInt(this.$boardApp.dataset.boardMilestoneId, 10), this.store.boardConfig = {
milestoneTitle: this.$boardApp.dataset.boardMilestoneTitle, milestoneId: parseInt(this.$boardApp.dataset.boardMilestoneId, 10),
assigneeUsername: this.$boardApp.dataset.boardAssigneeUsername, milestoneTitle: this.$boardApp.dataset.boardMilestoneTitle,
labels: JSON.parse(this.$boardApp.dataset.labels || []), assigneeUsername: this.$boardApp.dataset.boardAssigneeUsername,
weight: parseInt(this.$boardApp.dataset.boardWeight, 10), labels: JSON.parse(this.$boardApp.dataset.labels || []),
}; weight: parseInt(this.$boardApp.dataset.boardWeight, 10),
this.store.cantEdit = []; };
this.initBoardFilters(); this.store.cantEdit = [];
this.initBoardFilters();
}
} }
initBoardFilters() { initBoardFilters() {
......
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