Commit b5e99b73 authored by Florie Guibert's avatar Florie Guibert

Fetch epics swimlanes action

- Feedback
parent 24785ae3
...@@ -19,7 +19,8 @@ export default { ...@@ -19,7 +19,8 @@ export default {
}, },
groupId: { groupId: {
type: Number, type: Number,
required: true, required: false,
default: null,
}, },
disabled: { disabled: {
type: Boolean, type: Boolean,
......
...@@ -4,7 +4,7 @@ import { mapActions } from 'vuex'; ...@@ -4,7 +4,7 @@ import { mapActions } from 'vuex';
import 'ee_else_ce/boards/models/issue'; import 'ee_else_ce/boards/models/issue';
import 'ee_else_ce/boards/models/list'; import 'ee_else_ce/boards/models/list';
import BoardsLists from '~/boards/components/boards_lists.vue'; import BoardContent from '~/boards/components/board_content.vue';
import BoardSidebar from 'ee_else_ce/boards/components/board_sidebar'; import BoardSidebar from 'ee_else_ce/boards/components/board_sidebar';
import initNewListDropdown from 'ee_else_ce/boards/components/new_list_dropdown'; import initNewListDropdown from 'ee_else_ce/boards/components/new_list_dropdown';
import boardConfigToggle from 'ee_else_ce/boards/config_toggle'; import boardConfigToggle from 'ee_else_ce/boards/config_toggle';
...@@ -79,7 +79,7 @@ export default () => { ...@@ -79,7 +79,7 @@ export default () => {
issueBoardsApp = new Vue({ issueBoardsApp = new Vue({
el: $boardApp, el: $boardApp,
components: { components: {
BoardsLists, BoardContent,
Board: () => Board: () =>
window?.gon?.features?.sfcIssueBoards window?.gon?.features?.sfcIssueBoards
? import('ee_else_ce/boards/components/board_column.vue') ? import('ee_else_ce/boards/components/board_column.vue')
......
...@@ -9,7 +9,7 @@ class Groups::BoardsController < Groups::ApplicationController ...@@ -9,7 +9,7 @@ class Groups::BoardsController < Groups::ApplicationController
before_action do before_action do
push_frontend_feature_flag(:multi_select_board, default_enabled: true) push_frontend_feature_flag(:multi_select_board, default_enabled: true)
push_frontend_feature_flag(:sfc_issue_boards, default_enabled: true) push_frontend_feature_flag(:sfc_issue_boards, default_enabled: true)
push_frontend_feature_flag(:boards_with_swimlanes, default_enabled: false) push_frontend_feature_flag(:boards_with_swimlanes, group, default_enabled: false)
end end
private private
......
...@@ -20,9 +20,9 @@ ...@@ -20,9 +20,9 @@
#board-app.boards-app.position-relative{ "v-cloak" => "true", data: board_data, ":class" => "{ 'is-compact': detailIssueVisible }" } #board-app.boards-app.position-relative{ "v-cloak" => "true", data: board_data, ":class" => "{ 'is-compact': detailIssueVisible }" }
= render 'shared/issuable/search_bar', type: :boards, board: board = render 'shared/issuable/search_bar', type: :boards, board: board
- if Feature.enabled?(:boards_with_swimlanes) - if Feature.enabled?(:boards_with_swimlanes, current_board_parent)
%boards-lists{ "v-cloak" => "true", %board-content{ "v-cloak" => "true",
"ref" => "boards_lists", "ref" => "board_content",
":lists" => "state.lists", ":lists" => "state.lists",
":can-admin-list" => can_admin_list, ":can-admin-list" => can_admin_list,
":group-id" => group_id, ":group-id" => group_id,
......
#import "ee_else_ce/boards/queries/board_list.fragment.graphql" #import "ee_else_ce/boards/queries/board_list.fragment.graphql"
query GroupBoard($fullPath: ID!, $boardId: ID!) { query GroupBoard($fullPath: ID!, $boardId: ID!) {
group(fullPath: $fullPath) @client { group(fullPath: $fullPath) {
board(id: $boardId) { board(id: $boardId) {
lists { lists {
nodes { nodes {
......
...@@ -22,10 +22,14 @@ const fetchEpicsSwimlanes = ({ endpoints }) => { ...@@ -22,10 +22,14 @@ const fetchEpicsSwimlanes = ({ endpoints }) => {
boardId: `gid://gitlab/Board/${boardId}`, boardId: `gid://gitlab/Board/${boardId}`,
}; };
return gqlClient.query({ return gqlClient
query, .query({
variables, query,
}); variables,
})
.then(({ data }) => {
return data;
});
}; };
export default { export default {
...@@ -72,8 +76,23 @@ export default { ...@@ -72,8 +76,23 @@ export default {
notImplemented(); notImplemented();
}, },
toggleEpicSwimlanes: ({ state, commit }) => { toggleEpicSwimlanes: ({ state, commit, dispatch }) => {
commit(types.TOGGLE_EPICS_SWIMLANES); commit(types.TOGGLE_EPICS_SWIMLANES);
fetchEpicsSwimlanes(state);
if (state.isShowingEpicsSwimlanes) {
fetchEpicsSwimlanes(state)
.then(swimlanes => {
dispatch('receiveSwimlanesSuccess', swimlanes);
})
.catch(() => dispatch('receiveSwimlanesFailure'));
}
},
receiveSwimlanesSuccess: ({ commit }, swimlanes) => {
commit(types.RECEIVE_SWIMLANES_SUCCESS, swimlanes);
},
receiveSwimlanesFailure: ({ commit }) => {
commit(types.RECEIVE_SWIMLANES_FAILURE);
}, },
}; };
...@@ -13,4 +13,6 @@ export const RECEIVE_REMOVE_BOARD_ERROR = 'RECEIVE_REMOVE_BOARD_ERROR'; ...@@ -13,4 +13,6 @@ export const RECEIVE_REMOVE_BOARD_ERROR = 'RECEIVE_REMOVE_BOARD_ERROR';
export const TOGGLE_PROMOTION_STATE = 'TOGGLE_PROMOTION_STATE'; export const TOGGLE_PROMOTION_STATE = 'TOGGLE_PROMOTION_STATE';
export const TOGGLE_LABELS = 'TOGGLE_LABELS'; export const TOGGLE_LABELS = 'TOGGLE_LABELS';
export const TOGGLE_EPICS_SWIMLANES = 'TOGGLE_EPICS_SWIMLANES'; export const TOGGLE_EPICS_SWIMLANES = 'TOGGLE_EPICS_SWIMLANES';
export const RECEIVE_SWIMLANES_SUCCESS = 'RECEIVE_SWIMLANES_SUCCESS';
export const RECEIVE_SWIMLANES_FAILURE = 'RECEIVE_SWIMLANES_FAILURE';
export const SET_ACTIVE_LIST_ID = 'SET_ACTIVE_LIST_ID'; export const SET_ACTIVE_LIST_ID = 'SET_ACTIVE_LIST_ID';
...@@ -69,5 +69,16 @@ export default { ...@@ -69,5 +69,16 @@ export default {
[mutationTypes.TOGGLE_EPICS_SWIMLANES]: state => { [mutationTypes.TOGGLE_EPICS_SWIMLANES]: state => {
state.isShowingEpicsSwimlanes = !state.isShowingEpicsSwimlanes; state.isShowingEpicsSwimlanes = !state.isShowingEpicsSwimlanes;
state.epicsSwimlanesFetchInProgress = true;
},
[mutationTypes.RECEIVE_SWIMLANES_SUCCESS]: (state, swimlanes) => {
state.epicsSwimlanes = swimlanes;
state.epicsSwimlanesFetchInProgress = false;
},
[mutationTypes.RECEIVE_SWIMLANES_FAILURE]: state => {
state.epicsSwimlanesFetchFailure = true;
state.epicsSwimlanesFetchInProgress = false;
}, },
}; };
...@@ -4,4 +4,7 @@ export default () => ({ ...@@ -4,4 +4,7 @@ export default () => ({
...createStateCE(), ...createStateCE(),
isShowingEpicsSwimlanes: false, isShowingEpicsSwimlanes: false,
epicsSwimlanesFetchInProgress: false,
epicsSwimlanesFetchFailure: false,
epicsSwimlanes: {},
}); });
...@@ -92,21 +92,46 @@ describe('togglePromotionState', () => { ...@@ -92,21 +92,46 @@ describe('togglePromotionState', () => {
}); });
describe('toggleEpicSwimlanes', () => { describe('toggleEpicSwimlanes', () => {
it('should commit mutation TOGGLE_EPICS_SWIMLANES', done => { it('should commit mutation TOGGLE_EPICS_SWIMLANES', () => {
const state = { const state = {
isShowingEpicsSwimlanes: true, isShowingEpicsSwimlanes: false,
endpoints: { endpoints: {
fullPath: 'gitlab-org', fullPath: 'gitlab-org',
boardId: 1, boardId: 1,
}, },
}; };
testAction( return testAction(
actions.toggleEpicSwimlanes, actions.toggleEpicSwimlanes,
null, null,
state, state,
[{ type: types.TOGGLE_EPICS_SWIMLANES }], [{ type: types.TOGGLE_EPICS_SWIMLANES }],
[], [],
);
});
});
describe('receiveSwimlanesSuccess', () => {
it('should commit mutation RECEIVE_SWIMLANES_SUCCESS', done => {
testAction(
actions.receiveSwimlanesSuccess,
{},
{},
[{ type: types.RECEIVE_SWIMLANES_SUCCESS, payload: {} }],
[],
done,
);
});
});
describe('receiveSwimlanesFailure', () => {
it('should commit mutation RECEIVE_SWIMLANES_SUCCESS', done => {
testAction(
actions.receiveSwimlanesFailure,
null,
{},
[{ type: types.RECEIVE_SWIMLANES_FAILURE }],
[],
done, done,
); );
}); });
......
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