X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/d8c787ee061c3953628362f5eb6c37123f5ca0f5..2f0ac8c05c27a6cb41afe90d40a35a0195a8f885:/src/store/details-panel/details-panel-action.ts diff --git a/src/store/details-panel/details-panel-action.ts b/src/store/details-panel/details-panel-action.ts index e2d2479b..2724a3e3 100644 --- a/src/store/details-panel/details-panel-action.ts +++ b/src/store/details-panel/details-panel-action.ts @@ -2,34 +2,17 @@ // // SPDX-License-Identifier: AGPL-3.0 -import { unionize, ofType, UnionOf } from "unionize"; -import { Resource } from "../../common/api/common-resource-service"; -import { ResourceKind } from "../../models/kinds"; -import { Dispatch } from "redux"; -import { groupsService } from "../../services/services"; +import { unionize, ofType, UnionOf } from '~/common/unionize'; -const actions = unionize({ +export const detailsPanelActions = unionize({ TOGGLE_DETAILS_PANEL: ofType<{}>(), - LOAD_DETAILS: ofType<{ uuid: string, kind: ResourceKind }>(), - LOAD_DETAILS_SUCCESS: ofType<{ item: Resource }>(), -}, { tag: 'type', value: 'payload' }); - -export default actions; - -export type DetailsPanelAction = UnionOf; - -export const loadDetails = (uuid: string, kind: ResourceKind) => - (dispatch: Dispatch) => { - dispatch(actions.LOAD_DETAILS({ uuid, kind })); - if (kind === ResourceKind.Project) { - groupsService - .get(uuid) - .then(project => { - dispatch(actions.LOAD_DETAILS_SUCCESS({ item: project })); - }); - } - - }; + LOAD_DETAILS_PANEL: ofType() +}); + +export type DetailsPanelAction = UnionOf; + +export const loadDetailsPanel = (uuid: string) => detailsPanelActions.LOAD_DETAILS_PANEL(uuid); +