From 9913eff4f343d9eab453bcd3f0f0d11af31f20dd Mon Sep 17 00:00:00 2001 From: zhangjingwei Date: Wed, 14 Sep 2022 10:15:15 +0800 Subject: [PATCH] fix: fix fetch fip data Fix fetch fip data without qos policy service Closes-Bug: #1989517 Change-Id: I13a86f5d1c1dc01f5949c4cd0ba86a98dfa72725 --- src/stores/neutron/floatingIp.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/stores/neutron/floatingIp.js b/src/stores/neutron/floatingIp.js index 46c62250..6b6d99a0 100644 --- a/src/stores/neutron/floatingIp.js +++ b/src/stores/neutron/floatingIp.js @@ -19,6 +19,7 @@ import globalRouterStore from 'stores/neutron/router'; import globalServerStore from 'stores/nova/instance'; import globalLbaasStore from 'stores/octavia/loadbalancer'; import globalQoSPolicyStore from 'stores/neutron/qos-policy'; +import { qosEndpoint } from 'client/client/constants'; export class FloatingIpStore extends Base { get client() { @@ -29,6 +30,10 @@ export class FloatingIpStore extends Base { return true; } + get enableQos() { + return !!qosEndpoint(); + } + get mapper() { return (data) => { const { created_at } = data; @@ -70,8 +75,9 @@ export class FloatingIpStore extends Base { timeFilter, ...filters } = {}) { - const [qosPolicies, allData] = await Promise.all([ - globalQoSPolicyStore.fetchList(), + const qosReq = this.enableQos ? globalQoSPolicyStore.fetchList() : null; + const [qosResult, allData] = await Promise.all([ + qosReq, this.fetchListByPage({ limit, page, @@ -82,6 +88,7 @@ export class FloatingIpStore extends Base { ...filters, }), ]); + const qosPolicies = qosResult || []; const promises = []; allData.forEach((data) => { const qos = qosPolicies.find((it) => it.id === data.qos_policy_id);