Commit 1c4c0342 authored by Simon Knox's avatar Simon Knox

remove some unused code

parent 84cf1644
......@@ -72,7 +72,6 @@ $(() => {
weight: $boardApp.dataset.boardWeight,
authorUsername: $boardApp.dataset.boardAuthorUsername,
assigneeUsername: $boardApp.dataset.boardAssigneeUsername,
labelIds: $boardApp.dataset.label_ids || [],
labels: JSON.parse($boardApp.dataset.labels || []),
defaultAvatar: $boardApp.dataset.defaultAvatar,
cantEdit: [],
......@@ -94,7 +93,6 @@ $(() => {
updateFilterPath('milestone_title', this.milestoneTitle, 'milestone');
updateFilterPath('weight', this.weight, 'weight');
updateFilterPath('author_username', this.authorUsername, 'author');
updateFilterPath('assignee_username', this.assigneeUsername, 'assignee');
const filterPath = gl.issueBoards.BoardsStore.filter.path.split('&');
......
......@@ -247,9 +247,6 @@ export default Vue.extend({
}
},
methods: {
refreshPage() {
location.href = location.pathname;
},
submit() {
if (this.currentPage === 'delete') {
this.submitDisabled = true;
......@@ -265,21 +262,7 @@ export default Vue.extend({
gl.boardService.createBoard(this.board)
.then(resp => resp.json())
.then((data) => {
if (this.currentBoard && this.currentPage !== 'new') {
this.currentBoard.name = this.board.name;
// We reload the page to make sure the store & state of the app are correct
this.refreshPage();
// Enable the button thanks to our jQuery disabling it
$(this.$refs.submitBtn).enable();
// Reset the selectors current page
Store.state.currentPage = '';
Store.state.reload = true;
} else if (this.currentPage === 'new') {
gl.utils.visitUrl(`${Store.rootPath}/${data.id}`);
}
})
.catch(() => {
Flash('Unable to save your changes. Please try again.')
......@@ -294,12 +277,7 @@ export default Vue.extend({
if (this.currentBoard && Object.keys(this.currentBoard).length && this.currentPage !== 'new') {
Store.updateBoardConfig(this.currentBoard);
} else {
Store.updateBoardConfig({
name: '',
id: false,
label_ids: [],
assignee: {},
});
Store.updateBoardConfig();
}
if (!this.board.labels) {
......
......@@ -30,14 +30,17 @@ class BoardService {
}
createBoard (board) {
if (board.labels && board.labels.length > 0) {
board.board = board.board || {};
if (board.labels && board.labels.length > 0) {
board.board.label_ids = board.labels.map(b => b.id);
board.board.milestone_id = board.milestone_id;
}
if (board.assignee) {
board.assignee_id = board.assignee.id;
board.board.assignee_id = board.assignee.id;
}
board.board.weight = board.weight;
if (board.id) {
return this.boards.update({ id: board.id }, board);
}
......
......@@ -53,14 +53,13 @@ gl.issueBoards.BoardsStore = {
this.state.reload = false;
this.state.currentPage = page;
},
updateBoardConfig(board) {
updateBoardConfig(board = {}) {
this.boardConfig.name = board.name;
this.boardConfig.milestone = board.milestone;
this.boardConfig.milestone_id = board.milestone_id;
this.boardConfig.id = board.id;
this.boardConfig.weight = board.weight;
this.boardConfig.labels = board.labels || [];
Vue.set(this.boardConfig, 'label_ids', board.labels.map(b => b.id));
this.boardConfig.author_id = board.author_id;
this.boardConfig.assignee_id = board.assignee_id;
Vue.set(this.boardConfig, 'assignee', board.assignee);
......
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