X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/07bcb7d7b574ce4dfd5d335618f683e6fb1c7d4f..2a7fd99c212c33a1ec9911f8529fa5afc59a7bb2:/src/views-components/sharing-dialog/sharing-urls-component.tsx diff --git a/src/views-components/sharing-dialog/sharing-urls-component.tsx b/src/views-components/sharing-dialog/sharing-urls-component.tsx index 1638aaf768..5facb2e381 100644 --- a/src/views-components/sharing-dialog/sharing-urls-component.tsx +++ b/src/views-components/sharing-dialog/sharing-urls-component.tsx @@ -14,7 +14,7 @@ import { withStyles } from '@material-ui/core'; import { ApiClientAuthorization } from 'models/api-client-authorization'; -import { CopyIcon, RemoveIcon } from 'components/icon/icon'; +import { CopyIcon, CloseIcon } from 'components/icon/icon'; import CopyToClipboard from 'react-copy-to-clipboard'; import { ArvadosTheme } from 'common/custom-theme'; import moment from 'moment'; @@ -58,36 +58,38 @@ export interface SharingURLsComponentActionProps { export type SharingURLsComponentProps = SharingURLsComponentDataProps & SharingURLsComponentActionProps; export const SharingURLsComponent = withStyles(styles)((props: SharingURLsComponentProps & WithStyles) => - { 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.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()})`; + {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.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.expiresAt + ? `Token ${token.apiToken.slice(0, 8)}... expiring at: ${expDate.toLocaleString()} (${moment(expDate).fromNow()})` + : `Token ${token.apiToken.slice(0, 8)}... with no expiration date`; - return - - - {urlLabel} - - - - - - props.onCopy('Sharing URL copied')}> - - - - - props.onDeleteSharingToken(token.uuid)}> - - - - - - }) - : No sharing URLs } + return + + + {urlLabel} + + + + + + props.onCopy('Sharing URL copied')}> + + + + + props.onDeleteSharingToken(token.uuid)}> + + + + + + }) + : No sharing URLs} );