Skip to content

Commit

Permalink
Merge branch 'eclipse-xpanse:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
WangLiNaruto authored Jun 12, 2024
2 parents f950e6c + 1d2e9ea commit bee931e
Show file tree
Hide file tree
Showing 10 changed files with 100 additions and 41 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,16 @@ function ServiceDetail({ serviceDetails }: { serviceDetails: ServiceTemplateDeta
<Descriptions.Item label='ServiceTemplateId' labelStyle={{ width: '230px' }}>
{serviceDetails.serviceTemplateId}
</Descriptions.Item>
<Descriptions.Item label='Description' labelStyle={{ width: '230px' }}>
{serviceDetails.description}
</Descriptions.Item>
<Descriptions.Item label='Category'>{serviceDetails.category}</Descriptions.Item>
<Descriptions.Item label='Service Version'>{serviceDetails.version}</Descriptions.Item>
<Descriptions.Item label='Register Time'>{serviceDetails.createTime}</Descriptions.Item>
<Descriptions.Item label='Update Time'>{serviceDetails.lastModifiedTime}</Descriptions.Item>
<Descriptions.Item label='Namespace'>
<Tag color='cyan'>{serviceDetails.namespace}</Tag>
</Descriptions.Item>
<Descriptions.Item label='Description' labelStyle={{ width: '230px' }}>
{serviceDetails.description}
</Descriptions.Item>
<Descriptions.Item label='Register Time'>{serviceDetails.createTime}</Descriptions.Item>
<Descriptions.Item label='Update Time'>{serviceDetails.lastModifiedTime}</Descriptions.Item>
<Descriptions.Item label='Status'>
<ServiceTemplateRegisterStatus serviceRegistrationState={serviceDetails.serviceRegistrationState} />
</Descriptions.Item>
Expand Down
12 changes: 6 additions & 6 deletions src/components/content/common/ocl/DisplayOclData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,25 +99,25 @@ function DisplayOclData({ ocl }: { ocl: Ocl }): React.JSX.Element | string {
<Descriptions.Item label='Namespace'>
<Tag color='cyan'>{ocl.namespace}</Tag>
</Descriptions.Item>
<Descriptions.Item label='Flavors'>
<FlavorsText flavors={ocl.flavors.serviceFlavors} />
</Descriptions.Item>
<Descriptions.Item label='Description'>{ocl.description}</Descriptions.Item>
<Descriptions.Item label='Billing Modes'>
<BillingText billing={ocl.billing} />
</Descriptions.Item>
<Descriptions.Item label='CredentialType'>
{ocl.deployment.credentialType ? ocl.deployment.credentialType.valueOf() : ''}
</Descriptions.Item>
<Descriptions.Item label='Deployment'>
<DeploymentText deployment={ocl.deployment} />
</Descriptions.Item>
<Descriptions.Item label='CredentialType'>
{ocl.deployment.credentialType ? ocl.deployment.credentialType : ''}
<Descriptions.Item label='Flavors'>
<FlavorsText flavors={ocl.flavors.serviceFlavors} />
</Descriptions.Item>
<Descriptions.Item label='Contact Details'>
<ContactDetailsText
serviceProviderContactDetails={ocl.serviceProviderContactDetails}
showFor={ContactDetailsShowType.Catalog}
/>
</Descriptions.Item>
<Descriptions.Item label='Description'>{ocl.description}</Descriptions.Item>
<Descriptions.Item label='EULA'>
{ocl.eula ? <AgreementText eula={ocl.eula} /> : <span>Not Provided</span>}
</Descriptions.Item>
Expand Down
35 changes: 23 additions & 12 deletions src/components/content/common/ocl/FlavorsText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,29 @@ export function FlavorsText({ flavors }: { flavors: ServiceFlavor[] }): React.JS
// These warnings must be suppressed because the Ocl object here is created from the import file and the data not necessarily contains all the mandatory fields.
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
if (flavors) {
const yamlDocument = new YAML.Document();
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
yamlDocument.contents = flavors;
return (
<Popover content={<pre>{yamlDocument.toString()}</pre>} title={'Flavors'} trigger='hover'>
<Button
className={oclDisplayStyles.oclDataHover}
type={'link'}
>{`Available in ${flavors.length.toString()} flavor(s)`}</Button>
</Popover>
);
const flavorPops: React.JSX.Element[] = flavors.map((flavor, index) => {
const yamlDocument = new YAML.Document();
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
yamlDocument.contents = flavor;
return (
<li key={index}>
<Popover
content={
<pre className={oclDisplayStyles.oclFlavorsItemContent}>{yamlDocument.toString()}</pre>
}
title='Flavor Details'
trigger='hover'
>
<Button className={oclDisplayStyles.oclDataHover} type='link'>
{flavor.name}
</Button>
</Popover>
</li>
);
});

return <ul>{flavorPops}</ul>;
}
return <></>;
}
32 changes: 30 additions & 2 deletions src/components/content/home/common/DashBoardError.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@
* SPDX-FileCopyrightText: Huawei Inc.
*/

import { Alert, Card } from 'antd';
import { Alert, Button, Card } from 'antd';
import React from 'react';
import errorAlertStyles from '../../../../styles/error-alert.module.css';
import { ApiError, Response } from '../../../../xpanse-api/generated';
import { convertStringArrayToUnorderedList } from '../../../utils/generateUnorderedList';

export default function DashBoardError({ error }: { error: unknown }): React.JSX.Element {
export default function DashBoardError({
error,
retryRequest,
}: {
error: unknown;
retryRequest: () => void;
}): React.JSX.Element {
if (error instanceof ApiError && error.body && 'details' in error.body) {
const response: Response = error.body as Response;
return (
Expand All @@ -20,6 +26,17 @@ export default function DashBoardError({ error }: { error: unknown }): React.JSX
type={'error'}
closable={false}
className={errorAlertStyles.errorFailureAlert}
action={
<Button
className={errorAlertStyles.tryAgainBtnInAlertClass}
size='small'
type='primary'
onClick={retryRequest}
danger={true}
>
Retry Request
</Button>
}
/>
</Card>
);
Expand All @@ -32,6 +49,17 @@ export default function DashBoardError({ error }: { error: unknown }): React.JSX
type={'error'}
closable={false}
className={errorAlertStyles.errorFailureAlert}
action={
<Button
className={errorAlertStyles.tryAgainBtnInAlertClass}
size='small'
type='primary'
onClick={retryRequest}
danger={true}
>
Retry Request
</Button>
}
/>
</Card>
);
Expand Down
8 changes: 7 additions & 1 deletion src/components/content/home/isv/IsvServicesDashBoard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ export function IsvServicesDashBoard(): React.JSX.Element {
let registeredServicesCount: number = 0;
const navigate = useNavigate();

const retryRequest = () => {
if (listDeployedServicesByIsvQuery.isError) {
void listDeployedServicesByIsvQuery.refetch();
}
};

if (listDeployedServicesByIsvQuery.data !== undefined && listDeployedServicesByIsvQuery.data.length > 0) {
listDeployedServicesByIsvQuery.data.forEach((serviceItem: DeployedService) => {
if (
Expand Down Expand Up @@ -56,7 +62,7 @@ export function IsvServicesDashBoard(): React.JSX.Element {
? listDeployedServicesByIsvQuery.error
: listRegisteredServicesByIsvQuery.error;

return <DashBoardError error={errorToDisplay} />;
return <DashBoardError error={errorToDisplay} retryRequest={retryRequest} />;
}

if (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,14 @@ export function EndUserServicesDashboard(): React.JSX.Element {
let successfulDestroysCount: number = 0;
let failedDestroysCount: number = 0;

const retryRequest = () => {
if (listDeployedServicesQuery.isError) {
void listDeployedServicesQuery.refetch();
}
};

if (listDeployedServicesQuery.isError) {
return <DashBoardError error={listDeployedServicesQuery.error} />;
return <DashBoardError error={listDeployedServicesQuery.error} retryRequest={retryRequest} />;
}

if (listDeployedServicesQuery.isPending || listDeployedServicesQuery.isFetching) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/content/review/ServiceReviews.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ export default function ServiceReviews(): React.JSX.Element {
{currentServiceTemplateVo ? (
<Modal
title={'Service Details'}
width={1000}
width={1400}
footer={null}
destroyOnClose={true}
open={isServiceTemplateDetailsModalOpen}
Expand Down
20 changes: 10 additions & 10 deletions src/components/content/review/ServiceReviewsDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,29 +169,29 @@ export const ServiceReviewsDetails = ({
<Descriptions.Item label='Namespace'>
<Tag color='cyan'>{currentServiceTemplateVo.namespace}</Tag>
</Descriptions.Item>
<Descriptions.Item label='Flavors'>
<FlavorsText flavors={currentServiceTemplateVo.flavors.serviceFlavors} />
<Descriptions.Item label='Description'>
{currentServiceTemplateVo.description}
</Descriptions.Item>
<Descriptions.Item label='CredentialType'>
{currentServiceTemplateVo.deployment.credentialType
? currentServiceTemplateVo.deployment.credentialType
: ''}
</Descriptions.Item>
<Descriptions.Item label='Billing Modes'>
<BillingText billing={currentServiceTemplateVo.billing} />
</Descriptions.Item>
<Descriptions.Item label='Flavors'>
<FlavorsText flavors={currentServiceTemplateVo.flavors.serviceFlavors} />
</Descriptions.Item>
<Descriptions.Item label='Deployment'>
<DeploymentText deployment={currentServiceTemplateVo.deployment} />
</Descriptions.Item>
<Descriptions.Item label='CredentialType'>
{currentServiceTemplateVo.deployment.credentialType
? currentServiceTemplateVo.deployment.credentialType
: ''}
</Descriptions.Item>
<Descriptions.Item label='Contact Details'>
<ContactDetailsText
serviceProviderContactDetails={currentServiceTemplateVo.serviceProviderContactDetails}
showFor={ContactDetailsShowType.Catalog}
/>
</Descriptions.Item>
<Descriptions.Item label='Description'>
{currentServiceTemplateVo.description}
</Descriptions.Item>
<Descriptions.Item label='EULA'>
{currentServiceTemplateVo.eula ? (
<AgreementText eula={currentServiceTemplateVo.eula} />
Expand Down
8 changes: 8 additions & 0 deletions src/styles/ocl-display.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
margin-top: 10px;
overflow-x: auto;
}

.ocl-data-display-service-review-name {
width: 400px;
margin-top: 15px;
Expand All @@ -28,6 +29,7 @@
width: 800px;
margin-top: 15px;
}

.ocl-data-display-default-billing-mode {
font-size: 10px;
display: flex;
Expand All @@ -37,6 +39,7 @@
margin-top: -12px;
transform: translateX(-20%);
}

.ocl-data-display-default-billing-mode-tag {
margin-top: 8px;
width: 80px;
Expand Down Expand Up @@ -73,3 +76,8 @@
overflow: auto;
max-width: 50vh;
}

.ocl-flavors-item-content {
max-height: 200px;
overflow: auto;
}

0 comments on commit bee931e

Please sign in to comment.