From e1b289385c20d4659cbe0b58b25430279ac2e272 Mon Sep 17 00:00:00 2001 From: zhuyue Date: Wed, 1 Sep 2021 18:06:01 +0800 Subject: [PATCH] fix: Fix for lb status render fix for lb status render Change-Id: Idebf3504a07a8287cf7b34e5ed6f1008998c5330 --- src/components/Status/index.jsx | 2 ++ src/locales/en.json | 7 +++++++ src/locales/zh.json | 7 +++++++ .../Listener/Detail/Member/index.jsx | 2 ++ .../LoadBalancers/Listener/Detail/index.jsx | 2 ++ .../containers/LoadBalancers/Listener/index.jsx | 2 ++ .../LoadBalancerInstance/Detail/index.jsx | 3 ++- .../LoadBalancerInstance/index.jsx | 17 +++++++++++++++++ src/resources/lb.js | 17 +++++++++++++++++ 9 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 src/resources/lb.js diff --git a/src/components/Status/index.jsx b/src/components/Status/index.jsx index 1dcb461f..14a23a93 100644 --- a/src/components/Status/index.jsx +++ b/src/components/Status/index.jsx @@ -31,6 +31,7 @@ const successKeys = [ 'resolved', 'power on', 'complete', + 'online', ]; const successKeysContain = ['complete']; @@ -55,6 +56,7 @@ const errorKeys = [ 'firing', 'power off', 'error', + 'offline', ]; const errorKeysContain = ['fail']; diff --git a/src/locales/en.json b/src/locales/en.json index 9cce54b7..2bcc1298 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -388,6 +388,7 @@ "Custom Trait": "Custom Trait", "Custom UDP Rule": "Custom UDP Rule", "DCCP": "DCCP", + "DEGRADED: One or more of the entity’s components are in ERROR": "DEGRADED: One or more of the entity’s components are in ERROR", "DHCP": "DHCP", "DHCP Agents": "DHCP Agents", "DNAT Rules": "DNAT Rules", @@ -398,6 +399,7 @@ "DPD Interval (sec)": "DPD Interval (sec)", "DPD actions controls the use of Dead Peer Detection Protocol.": "DPD actions controls the use of Dead Peer Detection Protocol.", "DPD timeout (sec)": "DPD timeout (sec)", + "DRAINING: The member is not accepting new connections": "DRAINING: The member is not accepting new connections", "DSCP Marking": "DSCP Marking", "Danger": "Danger", "Data Disk": "Data Disk", @@ -409,6 +411,7 @@ "Debian": "Debian", "Dedicated": "Dedicated", "Default Policy": "Default Policy", + "Degraded": "Degraded", "Delay Interval(s)": "Delay Interval(s)", "Delete": "Delete", "Delete Allowed Address Pair": "Delete Allowed Address Pair", @@ -517,6 +520,7 @@ "Download canceled!": "Download canceled!", "Download current data": "Download current data", "Downloading": "Downloading", + "Draining": "Draining", "Driver": "Driver", "Driver Info": "Driver Info", "Driver Interface": "Driver Interface", @@ -1031,6 +1035,7 @@ "Next Hop": "Next Hop", "No": "No", "No Console": "No Console", + "No Monitor": "No Monitor", "No Raid": "No Raid", "No State": "No State", "No Task": "No Task", @@ -1060,9 +1065,11 @@ "OS Version": "OS Version", "OSPF": "OSPF", "Off": "Off", + "Offline": "Offline", "On": "On", "One entry per line(e.g. 114.114.114.114)": "One entry per line(e.g. 114.114.114.114)", "One entry per line(e.g. {ip})": "One entry per line(e.g. {ip})", + "Online": "Online", "Online Resize": "Online Resize", "Only a MAC address or an OpenFlow based datapath_id of the switch are accepted in this field": "Only a MAC address or an OpenFlow based datapath_id of the switch are accepted in this field", "Open External Gateway": "Open External Gateway", diff --git a/src/locales/zh.json b/src/locales/zh.json index bbcda387..7fde1fa2 100644 --- a/src/locales/zh.json +++ b/src/locales/zh.json @@ -388,6 +388,7 @@ "Custom Trait": "自定义特性", "Custom UDP Rule": "定制UDP规则", "DCCP": "", + "DEGRADED: One or more of the entity’s components are in ERROR": "降级:一个或多个实体的组件都处于错误状态", "DHCP": "", "DHCP Agents": "DHCP服务", "DNAT Rules": "DNAT规则", @@ -398,6 +399,7 @@ "DPD Interval (sec)": "DPD最大延迟(秒)", "DPD actions controls the use of Dead Peer Detection Protocol.": "DPD动作控制对失效对端协议的处理方式。", "DPD timeout (sec)": "DPD超时时间(秒)", + "DRAINING: The member is not accepting new connections": "满载:该成员不接受新的连接", "DSCP Marking": "DSCP标记", "Danger": "危险", "Data Disk": "数据盘", @@ -409,6 +411,7 @@ "Debian": "", "Dedicated": "专用", "Default Policy": "默认策略", + "Degraded": "降级", "Delay Interval(s)": "检查间隔(秒)", "Delete": "删除", "Delete Allowed Address Pair": "删除可用地址对", @@ -517,6 +520,7 @@ "Download canceled!": "下载已取消!", "Download current data": "下载当前数据", "Downloading": "下载中", + "Draining": "满载", "Driver": "驱动", "Driver Info": "驱动信息", "Driver Interface": "驱动接口", @@ -1031,6 +1035,7 @@ "Next Hop": "下一跳", "No": "否", "No Console": "", + "No Monitor": "无监控", "No Raid": "", "No State": "无状态", "No Task": "空闲", @@ -1060,9 +1065,11 @@ "OS Version": "系统版本", "OSPF": "", "Off": "关", + "Offline": "离线", "On": "开", "One entry per line(e.g. 114.114.114.114)": "每行一条(例如: 114.114.114.114)", "One entry per line(e.g. {ip})": "每行一条(例如: {ip})", + "Online": "在线", "Online Resize": "在线修改配置", "Only a MAC address or an OpenFlow based datapath_id of the switch are accepted in this field": "只可填写交换机的Mac地址或者交换机基于openflow的数据路径ID", "Open External Gateway": "开启公网网关", diff --git a/src/pages/network/containers/LoadBalancers/Listener/Detail/Member/index.jsx b/src/pages/network/containers/LoadBalancers/Listener/Detail/Member/index.jsx index c4abccf8..a601d05f 100644 --- a/src/pages/network/containers/LoadBalancers/Listener/Detail/Member/index.jsx +++ b/src/pages/network/containers/LoadBalancers/Listener/Detail/Member/index.jsx @@ -15,6 +15,7 @@ import React from 'react'; import { observer, inject } from 'mobx-react'; import Base from 'containers/List'; +import { provisioningStatusCodes } from 'resources/lb'; import globalPoolMemberStore from 'stores/octavia/pool-member'; import { actionConfigs, adminActions } from './Actions'; // import { toJS } from 'mobx'; @@ -73,6 +74,7 @@ export default class Members extends Base { { title: t('Status'), dataIndex: 'provisioning_status', + render: (data) => provisioningStatusCodes[data], isHideable: true, }, { diff --git a/src/pages/network/containers/LoadBalancers/Listener/Detail/index.jsx b/src/pages/network/containers/LoadBalancers/Listener/Detail/index.jsx index a5be3db8..db94b558 100644 --- a/src/pages/network/containers/LoadBalancers/Listener/Detail/index.jsx +++ b/src/pages/network/containers/LoadBalancers/Listener/Detail/index.jsx @@ -14,6 +14,7 @@ import { inject, observer } from 'mobx-react'; import { ListenerStore } from 'stores/octavia/listener'; +import { provisioningStatusCodes } from 'resources/lb'; import Base from 'containers/TabDetail'; import BaseDetail from './BaseDetail'; import Members from './Member'; @@ -59,6 +60,7 @@ export default class ListenerDetail extends Base { { title: t('Status'), dataIndex: 'provisioning_status', + render: (t) => provisioningStatusCodes[t], }, { title: t('Max connect'), diff --git a/src/pages/network/containers/LoadBalancers/Listener/index.jsx b/src/pages/network/containers/LoadBalancers/Listener/index.jsx index 318aca76..57f048c9 100644 --- a/src/pages/network/containers/LoadBalancers/Listener/index.jsx +++ b/src/pages/network/containers/LoadBalancers/Listener/index.jsx @@ -14,6 +14,7 @@ import { observer, inject } from 'mobx-react'; import Base from 'containers/List'; +import { provisioningStatusCodes } from 'resources/lb'; import { ListenerStore } from 'stores/octavia/listener'; import { actionConfigs, adminActions } from './Actions'; @@ -68,6 +69,7 @@ export default class Listeners extends Base { { title: t('Status'), dataIndex: 'provisioning_status', + render: (t) => provisioningStatusCodes[t], isHideable: true, }, { diff --git a/src/pages/network/containers/LoadBalancers/LoadBalancerInstance/Detail/index.jsx b/src/pages/network/containers/LoadBalancers/LoadBalancerInstance/Detail/index.jsx index 51f0f69e..e5a0653f 100644 --- a/src/pages/network/containers/LoadBalancers/LoadBalancerInstance/Detail/index.jsx +++ b/src/pages/network/containers/LoadBalancers/LoadBalancerInstance/Detail/index.jsx @@ -15,6 +15,7 @@ import { inject, observer } from 'mobx-react'; import Base from 'containers/TabDetail'; import { LbaasStore } from 'stores/octavia/loadbalancer'; +import { provisioningStatusCodes } from 'resources/lb'; import Listeners from '../../Listener'; import { actionConfigs, adminActions } from '../actions'; @@ -60,7 +61,7 @@ export default class LoadBalancerDetail extends Base { { title: t('Status'), dataIndex: 'provisioning_status', - // render: data => loadBalancerStatus[data] || '-', + render: (data) => provisioningStatusCodes[data], }, { title: t('Network'), diff --git a/src/pages/network/containers/LoadBalancers/LoadBalancerInstance/index.jsx b/src/pages/network/containers/LoadBalancers/LoadBalancerInstance/index.jsx index 59c0fa56..3e386d5d 100644 --- a/src/pages/network/containers/LoadBalancers/LoadBalancerInstance/index.jsx +++ b/src/pages/network/containers/LoadBalancers/LoadBalancerInstance/index.jsx @@ -12,9 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +import React from 'react'; import { inject, observer } from 'mobx-react'; import Base from 'containers/List'; +import { Col, Row } from 'antd'; import { LbaasStore } from 'stores/octavia/loadbalancer'; +import { operatingStatusCodes, provisioningStatusCodes } from 'resources/lb'; import { lbEndpoint } from 'client/client/constants'; import { actionConfigs, adminActions } from './actions'; @@ -102,10 +105,24 @@ export default class LoadBalancerInstance extends Base { { title: t('Operating Status'), dataIndex: 'operating_status', + render: (t) => operatingStatusCodes[t], + titleTip: ( + + + {t('DRAINING: The member is not accepting new connections')} + + + {t( + 'DEGRADED: One or more of the entity’s components are in ERROR' + )} + + + ), }, { title: t('Provisioning Status'), dataIndex: 'provisioning_status', + render: (t) => provisioningStatusCodes[t], }, { title: t('Listener Number'), diff --git a/src/resources/lb.js b/src/resources/lb.js new file mode 100644 index 00000000..c1eeb7ae --- /dev/null +++ b/src/resources/lb.js @@ -0,0 +1,17 @@ +export const operatingStatusCodes = { + ONLINE: t('Online'), + DRAINING: t('Draining'), + OFFLINE: t('Offline'), + DEGRADED: t('Degraded'), + ERROR: t('Error'), + NO_MONITOR: t('No Monitor'), +}; + +export const provisioningStatusCodes = { + ACTIVE: t('Active'), + DELETED: t('Deleted'), + ERROR: t('Error'), + PENDING_CREATE: t('Pending Create'), + PENDING_UPDATE: t('Pending Update'), + PENDING_DELETE: t('Pending Delete'), +};