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