Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | 10x 10x 10x 10x 10x 10x 10x 10x 10x 10x 10x 10x 10x 10x 10x 10x 10x 10x 9x 1x 10x 10x | /* * Copyright 2021 Harness Inc. All rights reserved. * Use of this source code is governed by the PolyForm Shield 1.0.0 license * that can be found in the licenses directory at the root of this repository, also available at * https://polyformproject.org/wp-content/uploads/2020/06/PolyForm-Shield-1.0.0.txt. */ // This is used in ConnectorView for connector details page import React from 'react' import { Layout, Container, Icon, Text } from '@wings-software/uicore' import { Color } from '@harness/design-system' import { StringUtils } from '@common/exports' import type { ConnectorInfoDTO, ConnectorConnectivityDetails, ConnectorResponse } from 'services/cd-ng' import TestConnection from '@connectors/components/TestConnection/TestConnection' import { useStrings } from 'framework/strings' import { ConnectorStatus } from '@connectors/constants' import { getReadableDateTime } from '@common/utils/dateUtils' import { getUrlValueByType } from '@connectors/pages/connectors/utils/ConnectorUtils' import css from './ConnectorActivityDetails.module.scss' interface ConnectorActivityDetailsProp { responsedata: ConnectorResponse refetchConnector: () => Promise<void> } const ConnectorActivityDetails: React.FC<ConnectorActivityDetailsProp> = activityDetailsProp => { const { getString } = useStrings() const connector = activityDetailsProp.responsedata.connector as ConnectorInfoDTO const connectorStatus = activityDetailsProp.responsedata?.status as ConnectorConnectivityDetails const lastTestedAt = getReadableDateTime(connectorStatus?.testedAt, StringUtils.DEFAULT_DATE_FORMAT) const lastConnectedAt = getReadableDateTime(connectorStatus?.lastConnectedAt, StringUtils.DEFAULT_DATE_FORMAT) const RenderConnectorStatus = (status: ConnectorConnectivityDetails['status']): React.ReactElement => { if (status !== 'SUCCESS' && status !== 'FAILURE') { return ( <Text inline={true} font={{ size: 'medium' }}> {getString('na')} </Text> ) } return ( <> <Icon inline={true} name={status === 'SUCCESS' ? 'deployment-success-new' : 'warning-sign'} size={18} padding={{ left: 'medium' }} color={status === 'SUCCESS' ? Color.GREEN_500 : Color.RED_500} ></Icon> <Text inline={true} font={{ size: 'medium' }} color={status === 'SUCCESS' ? Color.GREEN_500 : Color.RED_500}> {status === ConnectorStatus.FAILURE ? getString('failed') : getString('success')} </Text> </> ) } return ( <Layout.Vertical className={css.activityContainer}> <Container className={css.activitySummary}> <Layout.Horizontal spacing="small"> <Text font={{ weight: 'bold', size: 'medium' }} inline={true} color={Color.GREY_800}> {getString('connectivityStatus')} </Text> {RenderConnectorStatus(connectorStatus?.status)} </Layout.Horizontal> <Text margin={{ top: 'small', bottom: 'small' }}> {getString('lastStatusCheckAt')} {lastTestedAt ? `${lastTestedAt}` : getString('na')} </Text> <Text margin={{ top: 'small', bottom: 'medium' }}> {getString('lastSuccessfulStatusCheckAt')} {lastConnectedAt ? `${lastConnectedAt}` : getString('na')} </Text> <TestConnection connector={connector} gitDetails={activityDetailsProp?.responsedata?.gitDetails} /* Todo delegateName={connector?.spec?.credential?.spec?.delegateName || ''} */ testUrl={getUrlValueByType(connector?.type || '', connector)} refetchConnector={activityDetailsProp.refetchConnector} /> </Container> <Container> <Text font={{ weight: 'bold', size: 'medium' }} margin={{ top: 'large', bottom: 'large' }} color={Color.GREY_800} > {getString('changeHistory')} </Text> <Text color={Color.GREY_800}>{getString('lastUpdated')}</Text> <Text margin={{ top: 'small', bottom: 'small' }}> {getReadableDateTime(activityDetailsProp.responsedata.lastModifiedAt, StringUtils.DEFAULT_DATE_FORMAT)} </Text> <Text color={Color.GREY_800}>{getString('connectorCreated')}</Text> <Text margin={{ top: 'small', bottom: 'medium' }}> {getReadableDateTime(activityDetailsProp.responsedata.createdAt, StringUtils.DEFAULT_DATE_FORMAT)} </Text> </Container> </Layout.Vertical> ) } export default ConnectorActivityDetails |