forked from eclipse-xpanse/xpanse-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'eclipse-xpanse:main' into main
- Loading branch information
Showing
37 changed files
with
2,611 additions
and
2,778 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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,70 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* SPDX-FileCopyrightText: Huawei Inc. | ||
*/ | ||
|
||
import { Table, TableProps, Tag } from 'antd'; | ||
import React from 'react'; | ||
import regionStyle from '../../../../styles/region-text.module.css'; | ||
import { Region } from '../../../../xpanse-api/generated'; | ||
import { GroupedRegionItem, groupedRegions } from '../../../utils/groupedRegions.tsx'; | ||
|
||
const columns: TableProps<GroupedRegionItem>['columns'] = [ | ||
{ | ||
title: 'Area', | ||
dataIndex: 'area', | ||
key: 'area', | ||
render: (text) => <Tag color={'green'}>{text}</Tag>, | ||
}, | ||
{ | ||
title: 'Region', | ||
dataIndex: 'name', | ||
key: 'region', | ||
render: (_, { name }) => ( | ||
<> | ||
{name.map((item) => { | ||
return ( | ||
<Tag color={'blue'} key={item}> | ||
{item} | ||
</Tag> | ||
); | ||
})} | ||
</> | ||
), | ||
}, | ||
{ | ||
title: 'Site', | ||
dataIndex: 'site', | ||
key: 'site', | ||
render: (_, { site }) => ( | ||
<> | ||
{site.map((item) => { | ||
return ( | ||
<Tag color={'orange'} key={item}> | ||
{item} | ||
</Tag> | ||
); | ||
})} | ||
</> | ||
), | ||
}, | ||
]; | ||
|
||
export function RegionText({ regions }: { regions: Region[] }): React.JSX.Element { | ||
if (regions.length > 0) { | ||
const groupedByAreaRegions = groupedRegions(regions); | ||
return ( | ||
<div className={regionStyle.regionList}> | ||
<Table | ||
columns={columns} | ||
dataSource={groupedByAreaRegions} | ||
rowKey={'id'} | ||
pagination={false} | ||
bordered={true} | ||
/> | ||
</div> | ||
); | ||
} | ||
|
||
return <></>; | ||
} |
Oops, something went wrong.