From: Lucas Di Pentima Date: Mon, 16 May 2022 11:14:43 +0000 (-0300) Subject: 16115: Fixes sharing URL building for per-collection domain configs. X-Git-Tag: 2.4.1~1^2~2^2~12 X-Git-Url: https://git.arvados.org/arvados-workbench2.git/commitdiff_plain/4ee084a36d4adf2740f84875c47d81de566ec7b1 16115: Fixes sharing URL building for per-collection domain configs. Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- diff --git a/src/views-components/sharing-dialog/sharing-urls-component.tsx b/src/views-components/sharing-dialog/sharing-urls-component.tsx index ee5d50be..5151e8a2 100644 --- a/src/views-components/sharing-dialog/sharing-urls-component.tsx +++ b/src/views-components/sharing-dialog/sharing-urls-component.tsx @@ -9,6 +9,7 @@ import { Link, StyleRulesCallback, Tooltip, + Typography, WithStyles, withStyles } from '@material-ui/core'; @@ -57,10 +58,13 @@ export interface SharingURLsComponentActionProps { type SharingURLsComponentProps = SharingURLsComponentDataProps & SharingURLsComponentActionProps; export const SharingURLsComponent = withStyles(styles)((props: SharingURLsComponentProps & WithStyles) => - { props.sharingTokens + { props.sharingTokens.length > 0 + ? props.sharingTokens .sort((a, b) => (new Date(a.expiresAt).getTime() - new Date(b.expiresAt).getTime())) .map(token => { - const url = `${props.sharingURLsPrefix}/c=${props.collectionUuid}/t=${token.apiToken}/_/` + const url = props.sharingURLsPrefix.includes('*') + ? `${props.sharingURLsPrefix.replace('*', props.collectionUuid)}/t=${token.apiToken}/_/` + : `${props.sharingURLsPrefix}/c=${props.collectionUuid}/t=${token.apiToken}/_/`; const expDate = new Date(token.expiresAt); const urlLabel = `Token ${token.apiToken.slice(0, 8)}... expiring at: ${expDate.toLocaleString()} (${moment(expDate).fromNow()})`; @@ -84,5 +88,6 @@ export const SharingURLsComponent = withStyles(styles)((props: SharingURLsCompon - }) } + }) + : No sharing URLs } );