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 103 104 105 106 107 108 109 110 111 112 | 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 3x 3x 3x 3x 3x 3x | /*
* 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.
*/
import React from 'react'
import { useParams } from 'react-router-dom'
import { Layout, Text } from '@wings-software/uicore'
import { Color } from '@harness/design-system'
import routes from '@common/RouteDefinitions'
import { NGBreadcrumbs } from '@common/components/NGBreadcrumbs/NGBreadcrumbs'
import { useStrings } from 'framework/strings'
import { Page } from '@common/exports'
import { useGetServiceHeaderInfo } from 'services/cd-ng'
import { getReadableDateTime } from '@common/utils/dateUtils'
import type { ModulePathParams, ProjectPathProps, ServicePathProps } from '@common/interfaces/RouteInterfaces'
import { useDocumentTitle } from '@common/hooks/useDocumentTitle'
import { DeploymentTypeIcons } from '@cd/components/DeploymentTypeIcons/DeploymentTypeIcons'
import css from '@cd/components/ServiceDetails/ServiceDetailsHeader/ServiceDetailsHeader.module.scss'
export const ServiceDetailsHeader: React.FC = () => {
const { accountId, orgIdentifier, projectIdentifier, serviceId, module } = useParams<
ProjectPathProps & ModulePathParams & ServicePathProps
>()
const { getString } = useStrings()
const { loading, error, data } = useGetServiceHeaderInfo({
queryParams: {
accountIdentifier: accountId,
orgIdentifier,
projectIdentifier,
serviceId
}
})
useDocumentTitle([data?.data?.name || getString('services')])
const TitleComponent =
data?.data && !loading && !error ? (
<Layout.Horizontal padding={{ top: 'small', right: 'medium' }} width="100%">
<Layout.Horizontal margin={{ right: 'small' }}>
<DeploymentTypeIcons deploymentTypes={data.data.deploymentTypes || []} size={38} />
</Layout.Horizontal>
<Layout.Horizontal flex={{ justifyContent: 'space-between' }} className={css.serviceDetails}>
<Layout.Vertical className={css.detailsSection}>
<Layout.Horizontal
margin={{ bottom: 'small' }}
flex={{ alignItems: 'center', justifyContent: 'flex-start' }}
>
<Text
font={{ size: 'medium' }}
color={Color.BLACK}
margin={{ right: 'small' }}
className={css.textOverflow}
>
{data.data.name}
</Text>
<Text font={{ size: 'small' }} color={Color.GREY_500} className={css.textOverflow}>
{`${getString('common.ID')}: ${serviceId}`}
</Text>
</Layout.Horizontal>
<Text
font={{ size: 'small' }}
color={Color.GREY_500}
className={css.textOverflow}
margin={{ right: 'small' }}
>
{data.data.description}
</Text>
</Layout.Vertical>
<Layout.Vertical>
<Layout.Horizontal margin={{ bottom: 'small' }}>
<Text font={{ size: 'small', weight: 'semi-bold' }} color={Color.BLACK} margin={{ right: 'small' }}>
{getString('created')}
</Text>
<Text font={{ size: 'small' }}>{getReadableDateTime(data.data.createdAt, 'MMM DD, YYYY hh:mm a')}</Text>
</Layout.Horizontal>
<Layout.Horizontal>
<Text font={{ size: 'small', weight: 'semi-bold' }} color={Color.BLACK} margin={{ right: 'small' }}>
{getString('lastUpdated')}
</Text>
<Text font={{ size: 'small' }}>
{getReadableDateTime(data.data.lastModifiedAt, 'MMM DD, YYYY hh:mm a')}
</Text>
</Layout.Horizontal>
</Layout.Vertical>
</Layout.Horizontal>
</Layout.Horizontal>
) : (
serviceId
)
return (
<Page.Header
title={TitleComponent}
className={css.header}
size="large"
breadcrumbs={
<NGBreadcrumbs
links={[
{
url: routes.toServices({ orgIdentifier, projectIdentifier, accountId, module }),
label: getString('services')
}
]}
/>
}
/>
)
}
|