1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { Dispatch } from 'redux';
6 import { ResourceKind } from '~/models/resource';
7 import { unionize, ofType } from '~/common/unionize';
9 export const openInNewTabActions = unionize({
10 COPY_STORE: ofType<{}>(),
11 OPEN_COLLECTION_IN_NEW_TAB: ofType<string>(),
12 OPEN_PROJECT_IN_NEW_TAB: ofType<string>()
15 export const openInNewTabAction = (resource: any) => (dispatch: Dispatch) => {
16 const { uuid, kind } = resource;
18 dispatch(openInNewTabActions.COPY_STORE());
20 if (kind === ResourceKind.COLLECTION) {
21 dispatch(openInNewTabActions.OPEN_COLLECTION_IN_NEW_TAB(uuid));
22 } else if (kind === ResourceKind.PROJECT) {
23 dispatch(openInNewTabActions.OPEN_PROJECT_IN_NEW_TAB(uuid));