@@ -13,7 +13,6 @@ import {
13
13
} from '../../../../ui-components'
14
14
import { ActionList , ActionListItem , Bullseye , ButtonVariant , PageSection } from '@patternfly/react-core'
15
15
import { ExternalLinkAltIcon } from '@patternfly/react-icons'
16
- import * as moment from 'moment'
17
16
import { Fragment , useCallback , useMemo } from 'react'
18
17
import { Trans , useTranslation } from '../../../../lib/acm-i18next'
19
18
import { Link , useNavigate } from 'react-router-dom-v5-compat'
@@ -22,6 +21,7 @@ import { navigateToBackCancelLocation, NavigationPath } from '../../../../Naviga
22
21
import { DiscoveredCluster , DiscoveryConfig , ProviderConnection , unpackProviderConnection } from '../../../../resources'
23
22
import { useRecoilValue , useSharedAtoms } from '../../../../shared-recoil'
24
23
import { getISOStringTimestamp } from '../../../../resources/utils'
24
+ import AcmTimestamp from '../../../../lib/AcmTimestamp'
25
25
26
26
export default function DiscoveredClustersPage ( ) {
27
27
return (
@@ -224,11 +224,11 @@ export function DiscoveredClustersTable(props: {
224
224
sort : 'spec.activityTimestamp' ,
225
225
cell : ( discoveredCluster ) => (
226
226
< span style = { { whiteSpace : 'nowrap' } } key = "dcLastActive" >
227
- { discoveredCluster . spec . activityTimestamp === undefined
228
- ? [ 'N/A' ]
229
- : moment
230
- . duration ( Math . abs ( new Date ( ) . getTime ( ) - new Date ( discoveredCluster . spec . activityTimestamp ) . getTime ( ) ) )
231
- . humanize ( ) }
227
+ { discoveredCluster . spec . activityTimestamp ? (
228
+ < AcmTimestamp timestamp = { discoveredCluster . spec . activityTimestamp } />
229
+ ) : (
230
+ [ '-' ]
231
+ ) }
232
232
</ span >
233
233
) ,
234
234
exportContent : ( discoveredCluster ) => {
@@ -292,11 +292,11 @@ export function DiscoveredClustersTable(props: {
292
292
sort : 'spec.creationTimestamp' ,
293
293
cell : ( discoveredCluster ) => (
294
294
< span style = { { whiteSpace : 'nowrap' } } key = "dcCreationTimestamp" >
295
- { discoveredCluster . spec . creationTimestamp === undefined
296
- ? [ 'N/A' ]
297
- : moment
298
- . duration ( Math . abs ( new Date ( ) . getTime ( ) - new Date ( discoveredCluster . spec . creationTimestamp ) . getTime ( ) ) )
299
- . humanize ( ) }
295
+ { discoveredCluster . spec . creationTimestamp ? (
296
+ < AcmTimestamp timestamp = { discoveredCluster . spec . creationTimestamp } />
297
+ ) : (
298
+ [ '-' ]
299
+ ) }
300
300
</ span >
301
301
) ,
302
302
exportContent : ( discoveredCluster ) => {
@@ -310,15 +310,11 @@ export function DiscoveredClustersTable(props: {
310
310
sort : 'metadata.creationTimestamp' ,
311
311
cell : ( discoveredCluster ) => (
312
312
< span style = { { whiteSpace : 'nowrap' } } key = "dcObjCreationTimestamp" >
313
- { discoveredCluster . spec . creationTimestamp === undefined
314
- ? [ 'N/A' ]
315
- : moment
316
- . duration (
317
- Math . abs (
318
- new Date ( ) . getTime ( ) - new Date ( discoveredCluster . metadata . creationTimestamp ?? '' ) . getTime ( )
319
- )
320
- )
321
- . humanize ( ) }
313
+ { discoveredCluster . metadata . creationTimestamp ? (
314
+ < AcmTimestamp timestamp = { discoveredCluster . metadata . creationTimestamp } />
315
+ ) : (
316
+ [ '-' ]
317
+ ) }
322
318
</ span >
323
319
) ,
324
320
exportContent : ( discoveredCluster ) => {
0 commit comments