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
This commit is contained in:
zhangjingwei 2023-11-24 09:18:39 +08:00
parent 9fcb6b34a8
commit 44bf15d7e8
6 changed files with 64 additions and 29 deletions

View File

@ -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.

View File

@ -1646,6 +1646,7 @@
"No State": "No State", "No State": "No State",
"No Task": "No Task", "No Task": "No Task",
"No Vender": "No Vender", "No Vender": "No Vender",
"No default pool set": "No default pool set",
"Node": "Node", "Node": "Node",
"Node Addresses": "Node Addresses", "Node Addresses": "Node Addresses",
"Node Driver": "Node Driver", "Node Driver": "Node Driver",

View File

@ -1646,6 +1646,7 @@
"No State": "", "No State": "",
"No Task": "", "No Task": "",
"No Vender": "", "No Vender": "",
"No default pool set": "기본 풀이 설정되지 않았습니다.",
"Node": "노드", "Node": "노드",
"Node Addresses": "노드 주소", "Node Addresses": "노드 주소",
"Node Driver": "노드 드라이버", "Node Driver": "노드 드라이버",

View File

@ -1646,6 +1646,7 @@
"No State": "无状态", "No State": "无状态",
"No Task": "空闲", "No Task": "空闲",
"No Vender": "", "No Vender": "",
"No default pool set": "未设置默认池",
"Node": "节点", "Node": "节点",
"Node Addresses": "节点地址", "Node Addresses": "节点地址",
"Node Driver": "节点驱动", "Node Driver": "节点驱动",

View File

@ -69,6 +69,12 @@ export class CreatePool extends ModalAction {
}); });
}; };
get defaultValue() {
return {
admin_state_up: true,
};
}
get formItems() { get formItems() {
const { algorithm } = this.state; const { algorithm } = this.state;
return [ return [
@ -99,6 +105,12 @@ export class CreatePool extends ModalAction {
options: this.filterOptions, options: this.filterOptions,
required: true, required: true,
}, },
{
name: 'admin_state_up',
label: t('Admin State Up'),
type: 'switch',
tip: t('Defines the admin state of the pool.'),
},
]; ];
} }

View File

@ -20,12 +20,15 @@ import { algorithmDict } from 'resources/octavia/pool';
export class BaseDetail extends Base { export class BaseDetail extends Base {
get leftCards() { get leftCards() {
const cards = [this.PoolInfo, this.healthMonitor]; const cards = [this.poolCard];
const { insert_headers = {} } = this.detailData; const { insert_headers = {}, default_pool_id } = this.detailData;
if (isEmpty(insert_headers)) { if (default_pool_id) {
return cards; cards.push(this.healthMonitor);
} }
return [...cards, this.customHeaders]; if (!isEmpty(insert_headers)) {
cards.push(this.customHeaders);
}
return cards;
} }
get rightCards() { get rightCards() {
@ -36,32 +39,39 @@ export class BaseDetail extends Base {
return []; return [];
} }
get PoolInfo() { get poolCard() {
const { default_pool = {} } = this.detailData || {}; const { default_pool = {}, default_pool_id } = this.detailData || {};
const { name, protocol, lb_algorithm, description, admin_state_up } = const { name, protocol, lb_algorithm, description, admin_state_up } =
default_pool; default_pool;
const options = [ const options = default_pool_id
{ ? [
label: t('Name'), {
content: name || '-', label: '',
}, content: t('No default pool set'),
{ },
label: t('Protocol'), ]
content: protocol || '-', : [
}, {
{ label: t('Name'),
label: t('LB Algorithm'), content: name || '-',
content: algorithmDict[lb_algorithm] || lb_algorithm || '-', },
}, {
{ label: t('Protocol'),
label: t('Admin State Up'), content: protocol || '-',
content: admin_state_up ? t('On') : t('Off'), },
}, {
{ label: t('LB Algorithm'),
label: t('Description'), content: algorithmDict[lb_algorithm] || lb_algorithm || '-',
content: description || '-', },
}, {
]; label: t('Admin State Up'),
content: admin_state_up ? t('On') : t('Off'),
},
{
label: t('Description'),
content: description || '-',
},
];
return { return {
title: t('Pool Info'), title: t('Pool Info'),
options, options,