From b0c629ef29f326e60ac3fde649e03838db16f948 Mon Sep 17 00:00:00 2001 From: xusongfu Date: Wed, 28 Sep 2022 11:07:35 +0800 Subject: [PATCH] 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 --- src/resources/neutron/qos-policy.jsx | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/resources/neutron/qos-policy.jsx b/src/resources/neutron/qos-policy.jsx index 16f17630..fb74e062 100644 --- a/src/resources/neutron/qos-policy.jsx +++ b/src/resources/neutron/qos-policy.jsx @@ -52,16 +52,21 @@ export const getQosPolicyColumns = ({ self, all = false }) => { { title: t('Rules'), dataIndex: 'rules', - render: (rules) => ( - - {rules.map((rule) => ( - - {getRuleValue(rule)} - - ))} - - ), - stringify: (rules) => rules.map((rule) => getRuleValue(rule)).join('\n'), + render: (rules) => + rules.length ? ( + + {rules.map((rule) => ( + + {getRuleValue(rule)} + + ))} + + ) : ( + '-' + ), + 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',