Commit 161d77e0 authored by Phil Hughes's avatar Phil Hughes

Open new board after creating it

After creating a new board, it correctly opens it instead of just reloading the list & therefore requiring the user to click on the board link to view it.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/29611
parent 7e7eec0e
...@@ -78,6 +78,7 @@ $(() => { ...@@ -78,6 +78,7 @@ $(() => {
} }
gl.boardService = new BoardService(this.endpoint, this.bulkUpdatePath, this.boardId); gl.boardService = new BoardService(this.endpoint, this.bulkUpdatePath, this.boardId);
Store.rootPath = this.endpoint;
this.filterManager = new FilteredSearchBoards(Store.filter, true, [(this.milestoneTitle ? 'milestone' : null)]); this.filterManager = new FilteredSearchBoards(Store.filter, true, [(this.milestoneTitle ? 'milestone' : null)]);
......
...@@ -81,7 +81,7 @@ const extraMilestones = require('../mixins/extra_milestones'); ...@@ -81,7 +81,7 @@ const extraMilestones = require('../mixins/extra_milestones');
}, },
submit() { submit() {
gl.boardService.createBoard(this.board) gl.boardService.createBoard(this.board)
.then(() => { .then((resp) => {
if (this.currentBoard && this.currentPage !== 'new') { if (this.currentBoard && this.currentPage !== 'new') {
this.currentBoard.name = this.board.name; this.currentBoard.name = this.board.name;
...@@ -89,14 +89,17 @@ const extraMilestones = require('../mixins/extra_milestones'); ...@@ -89,14 +89,17 @@ const extraMilestones = require('../mixins/extra_milestones');
// We reload the page to make sure the store & state of the app are correct // We reload the page to make sure the store & state of the app are correct
this.refreshPage(); this.refreshPage();
} }
}
// Enable the button thanks to our jQuery disabling it // Enable the button thanks to our jQuery disabling it
$(this.$refs.submitBtn).enable(); $(this.$refs.submitBtn).enable();
// Reset the selectors current page // Reset the selectors current page
Store.state.currentPage = ''; Store.state.currentPage = '';
Store.state.reload = true; Store.state.reload = true;
} else if (this.currentPage === 'new') {
const data = resp.json();
gl.utils.visitUrl(`${Store.rootPath}/${data.id}`);
}
}); });
}, },
cancel() { cancel() {
......
...@@ -24,9 +24,8 @@ describe 'Board with milestone', :feature, :js do ...@@ -24,9 +24,8 @@ describe 'Board with milestone', :feature, :js do
it 'creates board with milestone' do it 'creates board with milestone' do
create_board_with_milestone create_board_with_milestone
click_link 'test'
expect(find('.tokens-container')).to have_content(milestone.title) expect(find('.tokens-container')).to have_content(milestone.title)
wait_for_vue_resource
expect(all('.board')[1]).to have_selector('.card', count: 1) expect(all('.board')[1]).to have_selector('.card', count: 1)
end end
end end
......
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