1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import copy from 'copy-to-clipboard';
6 import { Dispatch } from 'redux';
7 import { getNavUrl } from 'routes/routes';
8 import { RootState } from 'store/store';
10 export const openInNewTabAction = (resource: any) => (dispatch: Dispatch, getState: () => RootState) => {
11 const url = getNavUrl(resource.uuid, getState().auth);
14 window.open(`${window.location.origin}${url}`, '_blank');
15 } else if (url.length) {
16 window.open(url, '_blank');
20 export const copyToClipboardAction = (resource: any) => (dispatch: Dispatch, getState: () => RootState) => {
21 // Copy to clipboard omits token to avoid accidental sharing
22 const url = getNavUrl(resource.uuid, getState().auth, false);
25 copy(`${window.location.origin}${url}`);
26 } else if (url.length) {