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 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",

View File

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

View File

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

View File

@ -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.'),
},
];
}

View File

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