[arvados-workbench2] created: 2.4.0-143-g967a861f
git repository hosting
git at public.arvados.org
Thu Jun 23 04:39:39 UTC 2022
at 967a861f541ec6e8ef26cd794e7f7890ae65bef7 (commit)
commit 967a861f541ec6e8ef26cd794e7f7890ae65bef7
Author: Stephen Smith <stephen at curii.com>
Date: Thu Jun 23 00:32:14 2022 -0400
19079: Wrap resource navigation with anchor elements to allow middle/right click.
Arvados-DCO-1.1-Signed-off-by: Stephen Smith <stephen at curii.com>
diff --git a/src/views-components/data-explorer/renderers.tsx b/src/views-components/data-explorer/renderers.tsx
index 7822bdc6..c5b61a7d 100644
--- a/src/views-components/data-explorer/renderers.tsx
+++ b/src/views-components/data-explorer/renderers.tsx
@@ -10,7 +10,8 @@ import {
Tooltip,
IconButton,
Checkbox,
- Chip
+ Chip,
+ Link
} from '@material-ui/core';
import { FavoriteStar, PublicFavoriteStar } from '../favorite-star/favorite-star';
import { Resource, ResourceKind, TrashableResource } from 'models/resource';
@@ -59,21 +60,24 @@ import { openPermissionEditContextMenu } from 'store/context-menu/context-menu-a
import { getUserUuid } from 'common/getuser';
import { VirtualMachinesResource } from 'models/virtual-machines';
import { CopyToClipboardSnackbar } from 'components/copy-to-clipboard-snackbar/copy-to-clipboard-snackbar';
+import { getNavUrl } from 'routes/routes';
-const renderName = (dispatch: Dispatch, item: GroupContentsResource) => {
-
+const renderName = (dispatch: Dispatch, item: GroupContentsResource, navUrl: string) => {
const navFunc = ("groupClass" in item && item.groupClass === GroupClass.ROLE ? navigateToGroupDetails : navigateTo);
return <Grid container alignItems="center" wrap="nowrap" spacing={16}>
<Grid item>
{renderIcon(item)}
</Grid>
<Grid item>
- <Typography color="primary" style={{ width: 'auto', cursor: 'pointer' }} onClick={() => dispatch<any>(navFunc(item.uuid))}>
- {item.kind === ResourceKind.PROJECT || item.kind === ResourceKind.COLLECTION
- ? <IllegalNamingWarning name={item.name} />
- : null}
- {item.name}
- </Typography>
+ {/* Wrap router navigation with neutered anchor for enhanced middle clicking experience */}
+ <Link href={navUrl} onClick={(e) => e.preventDefault()}>
+ <Typography color="primary" style={{ width: 'auto', cursor: 'pointer' }} onClick={() => dispatch<any>(navFunc(item.uuid))}>
+ {item.kind === ResourceKind.PROJECT || item.kind === ResourceKind.COLLECTION
+ ? <IllegalNamingWarning name={item.name} />
+ : null}
+ {item.name}
+ </Typography>
+ </Link>
</Grid>
<Grid item>
<Typography variant="caption">
@@ -87,8 +91,9 @@ const renderName = (dispatch: Dispatch, item: GroupContentsResource) => {
export const ResourceName = connect(
(state: RootState, props: { uuid: string }) => {
const resource = getResource<GroupContentsResource>(props.uuid)(state.resources);
- return resource;
- })((resource: GroupContentsResource & DispatchProp<any>) => renderName(resource.dispatch, resource));
+ const navUrl = getNavUrl(props.uuid, state.auth);
+ return {resource, navUrl};
+ })((props: {resource: GroupContentsResource, navUrl: string} & DispatchProp<any>) => renderName(props.dispatch, props.resource, props.navUrl));
const renderIcon = (item: GroupContentsResource) => {
switch (item.kind) {
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list