fix the QoS policy list

1. rules is invalid attribute for sort_keys

2. show '-' if the rules is empty

3. show project info only in administrator platform

Closes-Bug: #1991034
Change-Id: Ibf8188f2300651d0eda7fa8c84dc804686998f99
This commit is contained in:
xusongfu 2022-09-28 11:07:35 +08:00
parent fcb2856c31
commit b0c629ef29

View File

@ -52,16 +52,21 @@ export const getQosPolicyColumns = ({ self, all = false }) => {
{ {
title: t('Rules'), title: t('Rules'),
dataIndex: 'rules', dataIndex: 'rules',
render: (rules) => ( render: (rules) =>
<Row> rules.length ? (
{rules.map((rule) => ( <Row>
<Col span={24} key={rule.direction}> {rules.map((rule) => (
{getRuleValue(rule)} <Col span={24} key={rule.direction}>
</Col> {getRuleValue(rule)}
))} </Col>
</Row> ))}
), </Row>
stringify: (rules) => rules.map((rule) => getRuleValue(rule)).join('\n'), ) : (
'-'
),
sorter: false,
stringify: (rules) =>
rules.length ? rules.map((rule) => getRuleValue(rule)).join('\n') : '-',
}, },
{ {
title: t('Shared'), title: t('Shared'),
@ -86,7 +91,7 @@ export const getQosPolicyColumns = ({ self, all = false }) => {
sorter: false, sorter: false,
}, },
]; ];
if (all) { if (all && self.isAdminPage) {
ret.splice(2, 0, { ret.splice(2, 0, {
title: t('Project ID/Name'), title: t('Project ID/Name'),
dataIndex: 'project_name', dataIndex: 'project_name',