X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/d0166a21891dca8719bcedc252a640d1b8037f40..cc493b89840b48f40c2beaf626994724331aa196:/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 cb5a709e..2724a3e3 100644 --- a/src/store/details-panel/details-panel-action.ts +++ b/src/store/details-panel/details-panel-action.ts @@ -2,41 +2,17 @@ // // SPDX-License-Identifier: AGPL-3.0 -import { unionize, ofType, UnionOf } from "unionize"; -import { CommonResourceService } from "../../common/api/common-resource-service"; -import { Dispatch } from "redux"; -import { Resource, ResourceKind } from "../../models/resource"; -import { RootState } from "../store"; -import { ServiceRepository } from "../../services/services"; +import { unionize, ofType, UnionOf } from '~/common/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' }); + LOAD_DETAILS_PANEL: ofType() +}); export type DetailsPanelAction = UnionOf; -export const loadDetails = (uuid: string, kind: ResourceKind) => - (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { - dispatch(detailsPanelActions.LOAD_DETAILS({ uuid, kind })); - getService(services, kind) - .get(uuid) - .then(project => { - dispatch(detailsPanelActions.LOAD_DETAILS_SUCCESS({ item: project })); - }); - }; - -const getService = (services: ServiceRepository, kind: ResourceKind) => { - switch (kind) { - case ResourceKind.PROJECT: - return services.projectService; - case ResourceKind.COLLECTION: - return services.collectionService; - default: - return services.projectService; - } -}; +export const loadDetailsPanel = (uuid: string) => detailsPanelActions.LOAD_DETAILS_PANEL(uuid); +