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 Apr 30, 2024
2 parents ca7e30c + 7f5438a commit 83961cd
Show file tree
Hide file tree
Showing 36 changed files with 617 additions and 469 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { BillingText } from '../../../common/ocl/BillingText';
import { ServiceRegistrationStatus } from './ServiceRegistrationStatus';
import { ContactDetailsText } from '../../../common/ocl/ContactDetailsText';
import { ContactDetailsShowType } from '../../../common/ocl/ContactDetailsShowType';
import { AgreementText } from '../../../common/ocl/AgreementText';

function ServiceDetail({ serviceDetails }: { serviceDetails: ServiceTemplateDetailVo }): React.JSX.Element {
return (
Expand Down Expand Up @@ -73,6 +74,9 @@ function ServiceDetail({ serviceDetails }: { serviceDetails: ServiceTemplateDeta
showFor={ContactDetailsShowType.Catalog}
/>
</Descriptions.Item>
<Descriptions.Item label='EULA'>
{serviceDetails.eula ? <AgreementText eula={serviceDetails.eula} /> : <span>Not Provided</span>}
</Descriptions.Item>
</Descriptions>
</>
);
Expand Down
10 changes: 8 additions & 2 deletions src/components/content/catalog/services/details/ShowIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,19 @@

import { ServiceTemplateDetailVo } from '../../../../../xpanse-api/generated';
import React from 'react';
import { Tooltip, Typography } from 'antd';

export function ShowIcon({ serviceDetails }: { serviceDetails: ServiceTemplateDetailVo }): React.JSX.Element {
const { Paragraph } = Typography;
return (
<div className={'catalog-service-icon'}>
<img width={25} height={25} src={serviceDetails.icon} alt='Service Icon' referrerPolicy='no-referrer' />
<img width={20} height={20} src={serviceDetails.icon} alt='Service Icon' referrerPolicy='no-referrer' />
&nbsp;
{serviceDetails.name}
<Tooltip placement='topLeft' title={serviceDetails.name}>
<Paragraph ellipsis={true} className={'catalog-service-name'}>
{serviceDetails.name}
</Paragraph>
</Tooltip>
</div>
);
}
11 changes: 9 additions & 2 deletions src/components/content/catalog/services/tree/CategoryCatalog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import '../../../../../styles/catalog.css';
import { DataNode } from 'antd/es/tree';
import { TagOutlined } from '@ant-design/icons';
import { ApiError, DeployedService, Response, ServiceTemplateDetailVo } from '../../../../../xpanse-api/generated';
import { Alert, Empty, Skeleton } from 'antd';
import { Alert, Empty, Skeleton, Tooltip, Typography } from 'antd';
import { convertStringArrayToUnorderedList } from '../../../../utils/generateUnorderedList';
import {
groupServiceTemplatesByName,
Expand All @@ -19,6 +19,7 @@ import { CatalogFullView } from './CatalogFullView';

function CategoryCatalog({ category }: { category: DeployedService.category }): React.JSX.Element {
const treeData: DataNode[] = [];
const { Paragraph } = Typography;
let categoryOclData: Map<string, ServiceTemplateDetailVo[]> = new Map<string, ServiceTemplateDetailVo[]>();

const availableServiceTemplatesQuery = useAvailableServiceTemplatesQuery(category);
Expand All @@ -28,7 +29,13 @@ function CategoryCatalog({ category }: { category: DeployedService.category }):
categoryOclData = groupServiceTemplatesByName(userAvailableServiceList);
categoryOclData.forEach((_value: ServiceTemplateDetailVo[], serviceName: string) => {
const dataNode: DataNode = {
title: serviceName,
title: (
<Tooltip placement='topLeft' title={serviceName}>
<Paragraph ellipsis={true} className={'catalog-tree-node'}>
{serviceName}
</Paragraph>
</Tooltip>
),
key: serviceName || '',
children: [],
};
Expand Down
17 changes: 17 additions & 0 deletions src/components/content/common/ocl/AgreementText.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* SPDX-License-Identifier: Apache-2.0
* SPDX-FileCopyrightText: Huawei Inc.
*/

import React from 'react';
import { Button, Popover } from 'antd';

export function AgreementText({ eula }: { eula: string }): React.JSX.Element {
return (
<Popover content={<pre className={'agreement-text'}>{eula}</pre>} title={'Eula'} trigger='hover'>
<Button className={'ocl-data-hover'} type={'link'}>
{'terms and conditions'}
</Button>
</Popover>
);
}
3 changes: 2 additions & 1 deletion src/components/content/common/ocl/BillingText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ export function BillingText({ billing }: { billing: Billing }): React.JSX.Elemen
return (
<Popover content={<pre>{yamlDocument.toString()}</pre>} title={'Billing'} trigger='hover'>
<Button className={'ocl-data-hover'} type={'link'}>
{billing.billingModel}
{/* TODO Will be fixed in #1591 or #1592 */}
{billing.billingModes[0]}
</Button>
</Popover>
);
Expand Down
16 changes: 11 additions & 5 deletions src/components/content/common/ocl/DisplayOclData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@

import React from 'react';
import { Ocl } from '../../../../xpanse-api/generated';
import { Descriptions, Image, Tag } from 'antd';
import { Descriptions, Image, Tag, Tooltip, Typography } from 'antd';
import { DeploymentText } from './DeploymentText';
import { BillingText } from './BillingText';
import { cspMap } from '../csp/CspLogo';
import { ContactDetailsText } from './ContactDetailsText';
import { ContactDetailsShowType } from './ContactDetailsShowType';
import { FlavorsText } from './FlavorsText';
import { AgreementText } from './AgreementText';

function DisplayOclData({ ocl }: { ocl: Ocl }): React.JSX.Element | string {
const PLACE_HOLDER_UNKNOWN_VALUE: string = 'NOT PROVIDED';

const { Paragraph } = Typography;
try {
return (
<>
Expand All @@ -39,9 +40,11 @@ function DisplayOclData({ ocl }: { ocl: Ocl }): React.JSX.Element | string {
<br />
<b>Service Name</b>
<br />
<Tag className={'ocl-display-tag'} color='blue'>
{ocl.name}
</Tag>
<Tooltip placement='topLeft' title={ocl.name}>
<Paragraph ellipsis={true} className={'ocl-data-display-service-register-name'}>
{ocl.name}
</Paragraph>
</Tooltip>
<br />
<br />
</div>
Expand Down Expand Up @@ -108,6 +111,9 @@ function DisplayOclData({ ocl }: { ocl: Ocl }): React.JSX.Element | string {
/>
</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>
</Descriptions>
</div>
</div>
Expand Down
3 changes: 2 additions & 1 deletion src/components/content/order/common/BillingInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ export const BillingInfo = ({ priceValue, billing }: { priceValue: string; billi
</Tag>
<span className={'order-billing-model-title-class'}>Model:&nbsp;</span>
<Tag color={'blue'} className={'order-billing-model-value-class'}>
{billing.billingModel}
{/* TODO Will be fixed in #1591 or #1592 */}
{billing.billingModes[0]}
</Tag>
</div>
</>
Expand Down
44 changes: 44 additions & 0 deletions src/components/content/order/common/EulaInfo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* SPDX-License-Identifier: Apache-2.0
* SPDX-FileCopyrightText: Huawei Inc.
*/

import React, { Dispatch, SetStateAction } from 'react';
import { Checkbox, Form, Space } from 'antd';
import '../../../../styles/service_order.css';
import { AgreementText } from '../../common/ocl/AgreementText';
import { CheckboxChangeEvent } from 'antd/es/checkbox';

export const EulaInfo = ({
eula,
isEulaAccepted,
setIsEulaAccepted,
}: {
eula: string | undefined;
isEulaAccepted: boolean;
setIsEulaAccepted: Dispatch<SetStateAction<boolean>>;
}): React.JSX.Element => {
const onChange = (e: CheckboxChangeEvent) => {
setIsEulaAccepted(e.target.checked);
};

return (
<>
{eula && eula.length > 0 ? (
<div className={'cloud-provider-tab-class region-flavor-content'}>
<Form.Item
name='Terms and Conditions'
label='Terms and Conditions'
rules={[{ required: true, message: 'Eula needs to be accepted' }]}
>
<Space wrap>
<Checkbox checked={isEulaAccepted} name='isEulaAccepted' onChange={onChange}>
I have read and agreed to the <AgreementText eula={eula} /> of the service.
</Checkbox>
</Space>
</Form.Item>
</div>
) : null}
</>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ export interface OrderSubmitProps {
serviceHostingType: DeployRequest.serviceHostingType;
contactServiceDetails: ServiceProviderContactDetails | undefined;
availabilityZones?: Record<string, string>;
eula: string | undefined;
}
72 changes: 0 additions & 72 deletions src/components/content/order/create/GoToSubmit.tsx

This file was deleted.

32 changes: 26 additions & 6 deletions src/components/content/order/create/OrderSubmit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import NavigateOrderSubmission from './NavigateOrderSubmission';
import '../../../../styles/service_order.css';
import { Navigate, To, useLocation, useNavigate } from 'react-router-dom';
import React, { useRef, useState } from 'react';
import { Button, Form, Input, Tooltip } from 'antd';
import { Button, Col, Form, Input, Row, Tooltip, Typography } from 'antd';
import { DeployedServiceDetails, DeployRequest } from '../../../../xpanse-api/generated';
import { createServicePageRoute, CUSTOMER_SERVICE_NAME_FIELD, homePageRoute } from '../../../utils/constants';
import { InfoCircleOutlined } from '@ant-design/icons';
Expand All @@ -19,9 +19,12 @@ import { useServiceDetailsPollingQuery } from '../orderStatus/useServiceDetailsP
import { v4 } from 'uuid';
import { OrderSubmitProps } from '../common/utils/OrderSubmitProps';
import { OrderItem } from '../common/utils/OrderItem';
import { EulaInfo } from '../common/EulaInfo';

function OrderSubmit(state: OrderSubmitProps): React.JSX.Element {
const { Paragraph } = Typography;
const [form] = Form.useForm();
const [isEulaAccepted, setIsEulaAccepted] = useState<boolean>(false);
const [isShowDeploymentResult, setIsShowDeploymentResult] = useState<boolean>(false);
const uniqueRequestId = useRef(v4());
const submitDeploymentRequest = useDeployRequestSubmitQuery();
Expand Down Expand Up @@ -59,6 +62,7 @@ function OrderSubmit(state: OrderSubmitProps): React.JSX.Element {
customerServiceName: useOrderFormStore.getState().deployParams.Name as string,
serviceHostingType: state.serviceHostingType,
availabilityZones: state.availabilityZones,
eulaAccepted: isEulaAccepted,
};
const serviceRequestProperties: Record<string, unknown> = {};
for (const variable in useOrderFormStore.getState().deployParams) {
Expand All @@ -84,12 +88,18 @@ function OrderSubmit(state: OrderSubmitProps): React.JSX.Element {
<NavigateOrderSubmission text={'<< Back'} to={createServicePageUrl as To} props={state} />
<div className={'Line'} />
<div className={'generic-table-container'}>
<div className={'content-title'}>
<div className={'content-title-order'}>
Service: {state.name}@{state.version}
<Row>
<Col span={4}>
<Tooltip placement='topLeft' title={state.name + '@' + state.version}>
<Paragraph ellipsis={true} className={'content-title'}>
Service: {state.name + '@' + state.version}
</Paragraph>
</Tooltip>
</Col>
<Col span={4}>
<ApiDoc id={state.id} styleClass={'content-title-api'}></ApiDoc>
</div>
</div>
</Col>
</Row>
</div>
</div>
{isShowDeploymentResult ? (
Expand Down Expand Up @@ -149,6 +159,16 @@ function OrderSubmit(state: OrderSubmitProps): React.JSX.Element {
) : undefined
)}
</div>
<div className={'order-param-item-row'}>
<div className={'order-param-item-left'} />
<div className={'order-param-item-content'}>
<EulaInfo
eula={state.eula}
isEulaAccepted={isEulaAccepted}
setIsEulaAccepted={setIsEulaAccepted}
/>
</div>
</div>
<div className={'Line'} />
<div className={'order-param-item-row'}>
<div className={'order-param-item-left'} />
Expand Down
Loading

0 comments on commit 83961cd

Please sign in to comment.