feat: update qos policy info

For the qos policy info in the port detail page:
1. add qos policy name
2. update qos policy link for console and administrator

Change-Id: Ib17f3c84aade6ce44610f379e577e676c30facb7
This commit is contained in:
zhangjingwei 2024-04-15 13:11:34 +08:00
parent 84d1e7af72
commit 34a41dd38d
2 changed files with 21 additions and 8 deletions

View File

@ -12,8 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import React from 'react';
import { Link } from 'react-router-dom';
import { inject, observer } from 'mobx-react';
import Base from 'containers/BaseDetail';
import { qosEndpoint } from 'client/client/constants';
@ -63,12 +61,17 @@ export class BaseDetail extends Base {
label: t('QoS Policy'),
dataIndex: 'qos_policy_id',
copyable: false,
render: (data) =>
data ? (
<Link to={`/network/qos-policy/detail/${data}`}>{data}</Link>
) : (
'-'
),
render: (data) => {
if (!data) {
return '-';
}
const { qosPolicy } = this.detailData;
const { name } = qosPolicy || {};
const displayName = name ? `${data}(${name})` : data;
return this.getLinkRender('networkQosDetail', displayName, {
id: data,
});
},
});
}
return {

View File

@ -166,6 +166,16 @@ export class PortStore extends Base {
});
}
item.itemInList = itemContrib;
const { qos_policy_id } = item;
if (qos_policy_id) {
try {
const { policy } = await client.neutron.qosPolicies.show(qos_policy_id);
item.qosPolicy = policy;
} catch (e) {
// eslint-disable-next-line no-console
console.log('fetch qos error', e);
}
}
return item;
}