From 44bf15d7e8504152172f092eac3a4318aafdc26d Mon Sep 17 00:00:00 2001 From: zhangjingwei Date: Fri, 24 Nov 2023 09:18:39 +0800 Subject: [PATCH] feat: support admin_state_up for listener's pool 1. support setting admin_state_up when creating listener's pool in the listener detail page 2. update pool and health monitor cards in the listener detail page Change-Id: Ifdb16cc3b82dbb928f4c2e3fcf336450cbe7cc3c --- ...in-State-Up-For-Pool-eca4a829af8c0446.yaml | 10 +++ src/locales/en.json | 1 + src/locales/ko-kr.json | 1 + src/locales/zh-hans.json | 1 + .../Listener/Actions/CreatePool.jsx | 12 ++++ .../Listener/Detail/BaseDetail.jsx | 68 +++++++++++-------- 6 files changed, 64 insertions(+), 29 deletions(-) create mode 100644 releasenotes/notes/Support-Setting-Admin-State-Up-For-Pool-eca4a829af8c0446.yaml diff --git a/releasenotes/notes/Support-Setting-Admin-State-Up-For-Pool-eca4a829af8c0446.yaml b/releasenotes/notes/Support-Setting-Admin-State-Up-For-Pool-eca4a829af8c0446.yaml new file mode 100644 index 00000000..06d5154d --- /dev/null +++ b/releasenotes/notes/Support-Setting-Admin-State-Up-For-Pool-eca4a829af8c0446.yaml @@ -0,0 +1,10 @@ +--- +features: + - | + Support setting admin_state_up for listener's pool: + + * Support setting admin_state_up when creating a pool in the listener detail page. + + * Fix pool info card in the listener detail page when there is no pool for the listener. + + * Remove health monitor card in the listener detail page when there is no pool for the listener. diff --git a/src/locales/en.json b/src/locales/en.json index b5aa52e3..3bab9189 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -1646,6 +1646,7 @@ "No State": "No State", "No Task": "No Task", "No Vender": "No Vender", + "No default pool set": "No default pool set", "Node": "Node", "Node Addresses": "Node Addresses", "Node Driver": "Node Driver", diff --git a/src/locales/ko-kr.json b/src/locales/ko-kr.json index 5b257da7..c27732b1 100644 --- a/src/locales/ko-kr.json +++ b/src/locales/ko-kr.json @@ -1646,6 +1646,7 @@ "No State": "", "No Task": "", "No Vender": "", + "No default pool set": "기본 풀이 설정되지 않았습니다.", "Node": "노드", "Node Addresses": "노드 주소", "Node Driver": "노드 드라이버", diff --git a/src/locales/zh-hans.json b/src/locales/zh-hans.json index ae2ad882..403a8a25 100644 --- a/src/locales/zh-hans.json +++ b/src/locales/zh-hans.json @@ -1646,6 +1646,7 @@ "No State": "无状态", "No Task": "空闲", "No Vender": "", + "No default pool set": "未设置默认池", "Node": "节点", "Node Addresses": "节点地址", "Node Driver": "节点驱动", diff --git a/src/pages/network/containers/LoadBalancers/Listener/Actions/CreatePool.jsx b/src/pages/network/containers/LoadBalancers/Listener/Actions/CreatePool.jsx index 79ebb237..7a047fe9 100644 --- a/src/pages/network/containers/LoadBalancers/Listener/Actions/CreatePool.jsx +++ b/src/pages/network/containers/LoadBalancers/Listener/Actions/CreatePool.jsx @@ -69,6 +69,12 @@ export class CreatePool extends ModalAction { }); }; + get defaultValue() { + return { + admin_state_up: true, + }; + } + get formItems() { const { algorithm } = this.state; return [ @@ -99,6 +105,12 @@ export class CreatePool extends ModalAction { options: this.filterOptions, required: true, }, + { + name: 'admin_state_up', + label: t('Admin State Up'), + type: 'switch', + tip: t('Defines the admin state of the pool.'), + }, ]; } diff --git a/src/pages/network/containers/LoadBalancers/Listener/Detail/BaseDetail.jsx b/src/pages/network/containers/LoadBalancers/Listener/Detail/BaseDetail.jsx index f98cba6e..73503644 100644 --- a/src/pages/network/containers/LoadBalancers/Listener/Detail/BaseDetail.jsx +++ b/src/pages/network/containers/LoadBalancers/Listener/Detail/BaseDetail.jsx @@ -20,12 +20,15 @@ import { algorithmDict } from 'resources/octavia/pool'; export class BaseDetail extends Base { get leftCards() { - const cards = [this.PoolInfo, this.healthMonitor]; - const { insert_headers = {} } = this.detailData; - if (isEmpty(insert_headers)) { - return cards; + const cards = [this.poolCard]; + const { insert_headers = {}, default_pool_id } = this.detailData; + if (default_pool_id) { + cards.push(this.healthMonitor); } - return [...cards, this.customHeaders]; + if (!isEmpty(insert_headers)) { + cards.push(this.customHeaders); + } + return cards; } get rightCards() { @@ -36,32 +39,39 @@ export class BaseDetail extends Base { return []; } - get PoolInfo() { - const { default_pool = {} } = this.detailData || {}; + get poolCard() { + const { default_pool = {}, default_pool_id } = this.detailData || {}; const { name, protocol, lb_algorithm, description, admin_state_up } = default_pool; - const options = [ - { - label: t('Name'), - content: name || '-', - }, - { - label: t('Protocol'), - content: protocol || '-', - }, - { - label: t('LB Algorithm'), - content: algorithmDict[lb_algorithm] || lb_algorithm || '-', - }, - { - label: t('Admin State Up'), - content: admin_state_up ? t('On') : t('Off'), - }, - { - label: t('Description'), - content: description || '-', - }, - ]; + const options = default_pool_id + ? [ + { + label: '', + content: t('No default pool set'), + }, + ] + : [ + { + label: t('Name'), + content: name || '-', + }, + { + label: t('Protocol'), + content: protocol || '-', + }, + { + label: t('LB Algorithm'), + content: algorithmDict[lb_algorithm] || lb_algorithm || '-', + }, + { + label: t('Admin State Up'), + content: admin_state_up ? t('On') : t('Off'), + }, + { + label: t('Description'), + content: description || '-', + }, + ]; return { title: t('Pool Info'), options,