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

remove some unused code

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