-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: [AH-799]: Support generic artifact version details page for OSS (…
…#3198) * feat: [AH-799]: Support generic artifact version for OSS
- Loading branch information
1 parent
a094a54
commit 142f58e
Showing
8 changed files
with
251 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...c/ar/pages/version-details/GenericVersion/pages/oss-details/OSSArtifactDetailsContent.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright 2024 Harness, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import React from 'react' | ||
import { Container, Text } from '@harnessio/uicore' | ||
import { FontVariation } from '@harnessio/design-system' | ||
|
||
import { useStrings } from '@ar/frameworks/strings' | ||
import GenericArtifactDetailsPage from '../artifact-details/GenericArtifactDetailsPage' | ||
|
||
export default function OSSArtifactDetailsContent() { | ||
const { getString } = useStrings() | ||
return ( | ||
<Container> | ||
<Text padding="large" font={{ variation: FontVariation.CARD_TITLE }}> | ||
{getString('versionDetails.tabs.artifactDetails')} | ||
</Text> | ||
<GenericArtifactDetailsPage /> | ||
</Container> | ||
) | ||
} |
29 changes: 29 additions & 0 deletions
29
web/src/ar/pages/version-details/GenericVersion/pages/oss-details/OSSContentPage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright 2024 Harness, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import React from 'react' | ||
import { Layout } from '@harnessio/uicore' | ||
import OSSGeneralInfoContent from './OSSGeneralInfoContent' | ||
import OSSArtifactDetailsContent from './OSSArtifactDetailsContent' | ||
|
||
export default function OSSContentPage() { | ||
return ( | ||
<Layout.Vertical spacing="large"> | ||
<OSSGeneralInfoContent /> | ||
<OSSArtifactDetailsContent /> | ||
</Layout.Vertical> | ||
) | ||
} |
60 changes: 60 additions & 0 deletions
60
web/src/ar/pages/version-details/GenericVersion/pages/oss-details/OSSGeneralInfoContent.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Copyright 2024 Harness, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import React from 'react' | ||
import { Page } from '@harnessio/uicore' | ||
import { useGetArtifactDetailsQuery } from '@harnessio/react-har-service-client' | ||
|
||
import { useDecodedParams, useGetSpaceRef } from '@ar/hooks' | ||
import type { VersionDetailsPathParams } from '@ar/routes/types' | ||
|
||
import type { GenericArtifactDetails } from '../../types' | ||
import GeneralInformationCard from '../overview/GeneralInformationCard' | ||
|
||
import css from './ossDetails.module.scss' | ||
|
||
export default function OSSGeneralInfoContent() { | ||
const pathParams = useDecodedParams<VersionDetailsPathParams>() | ||
const spaceRef = useGetSpaceRef() | ||
const { | ||
data, | ||
isFetching: loading, | ||
error, | ||
refetch | ||
} = useGetArtifactDetailsQuery( | ||
{ | ||
registry_ref: spaceRef, | ||
artifact: pathParams.artifactIdentifier, | ||
version: pathParams.versionIdentifier, | ||
queryParams: {} | ||
}, | ||
{ | ||
enabled: false | ||
} | ||
) | ||
|
||
const response = data?.content?.data as GenericArtifactDetails | ||
|
||
return ( | ||
<Page.Body | ||
className={css.pageBody} | ||
loading={loading} | ||
error={error?.message || error} | ||
retryOnError={() => refetch()}> | ||
{response && <GeneralInformationCard className={css.cardContainer} data={response} />} | ||
</Page.Body> | ||
) | ||
} |
28 changes: 28 additions & 0 deletions
28
web/src/ar/pages/version-details/GenericVersion/pages/oss-details/ossDetails.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Copyright 2024 Harness, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
.pageBody { | ||
height: auto; | ||
min-height: 250px; | ||
width: 100%; | ||
padding: var(--spacing-large) !important; | ||
} | ||
|
||
.cardContainer { | ||
width: 100% !important; | ||
padding: var(--spacing-7) !important; | ||
background-color: var(--white); | ||
} |
20 changes: 20 additions & 0 deletions
20
...src/ar/pages/version-details/GenericVersion/pages/oss-details/ossDetails.module.scss.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* Copyright 2023 Harness, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/* eslint-disable */ | ||
// This is an auto-generated file | ||
export declare const cardContainer: string | ||
export declare const pageBody: string |
74 changes: 74 additions & 0 deletions
74
web/src/ar/pages/version-details/GenericVersion/pages/overview/GeneralInformationCard.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* Copyright 2024 Harness, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import React from 'react' | ||
import { defaultTo } from 'lodash-es' | ||
import { FontVariation } from '@harnessio/design-system' | ||
import { Card, Container, Layout, Text } from '@harnessio/uicore' | ||
|
||
import { useStrings } from '@ar/frameworks/strings' | ||
import { DEFAULT_DATE_TIME_FORMAT } from '@ar/constants' | ||
import { getReadableDateTime } from '@ar/common/dateUtils' | ||
import { LabelValueContent } from '@ar/pages/version-details/components/LabelValueContent/LabelValueContent' | ||
|
||
import type { GenericArtifactDetails } from '../../types' | ||
|
||
import css from './styles.module.scss' | ||
|
||
interface GeneralInformationCardProps { | ||
data: GenericArtifactDetails | ||
className?: string | ||
} | ||
|
||
export default function GeneralInformationCard(props: GeneralInformationCardProps) { | ||
const { data, className } = props | ||
const { getString } = useStrings() | ||
return ( | ||
<Card className={className} title={getString('versionDetails.overview.generalInformation.title')}> | ||
<Layout.Vertical spacing="medium"> | ||
<Text font={{ variation: FontVariation.CARD_TITLE }}> | ||
{getString('versionDetails.overview.generalInformation.title')} | ||
</Text> | ||
<Container className={css.gridContainer}> | ||
<LabelValueContent | ||
label={getString('versionDetails.overview.generalInformation.name')} | ||
value={data.name} | ||
withCopyText | ||
/> | ||
<LabelValueContent | ||
label={getString('versionDetails.overview.generalInformation.version')} | ||
value={data.version} | ||
withCopyText | ||
/> | ||
<Text font={{ variation: FontVariation.SMALL_BOLD }}> | ||
{getString('versionDetails.overview.generalInformation.packageType')} | ||
</Text> | ||
<Text icon="generic-repository-type" iconProps={{ size: 16 }} font={{ variation: FontVariation.SMALL }}> | ||
{getString('packageTypes.genericPackage')} | ||
</Text> | ||
<LabelValueContent | ||
label={getString('versionDetails.overview.generalInformation.uploadedBy')} | ||
value={getReadableDateTime(Number(data.modifiedAt), DEFAULT_DATE_TIME_FORMAT)} | ||
/> | ||
<LabelValueContent | ||
label={getString('versionDetails.overview.generalInformation.description')} | ||
value={defaultTo(data.description, getString('na'))} | ||
/> | ||
</Container> | ||
</Layout.Vertical> | ||
</Card> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters