From 4ee084a36d4adf2740f84875c47d81de566ec7b1 Mon Sep 17 00:00:00 2001 From: Lucas Di Pentima Date: Mon, 16 May 2022 08:14:43 -0300 Subject: [PATCH] 16115: Fixes sharing URL building for per-collection domain configs. Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- .../sharing-dialog/sharing-urls-component.tsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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 } ); -- 2.30.2