feat: support editing pool admin_state_up

1. support editing admin_state_up when edit listener's pool of lb
2. support display admin_state_up info in the pool info card in the listener detail page
3. update lb algorithm display in the pool info card in the listener detail page

Change-Id: I80a500c6d67b51203c1d2e5868f94c4800c72714
This commit is contained in:
zhangjingwei 2023-11-14 14:17:11 +08:00
parent 081ff7ee8b
commit 772b1b5d46
4 changed files with 31 additions and 14 deletions

View File

@ -0,0 +1,10 @@
---
features:
- |
Update editing admin_state_up for listener's pool:
* Support editing admin_state_up when edit listener's pool of lb.
* Support display admin_state_up info in the pool info card in the listener detail page.
* Update lb algorithm display in the pool info card in the listener detail page.

View File

@ -50,20 +50,13 @@ export class EditPoolInfo extends ModalAction {
get defaultValue() {
const { pool } = this.state;
const { name, description, protocol, lb_algorithm } = pool;
if (name && this.formRef.current) {
this.formRef.current.setFieldsValue({
name,
description,
protocol,
lb_algorithm,
});
}
const { name, description, protocol, lb_algorithm, admin_state_up } = pool;
return {
name,
description,
protocol,
lb_algorithm,
admin_state_up,
};
}
@ -84,7 +77,9 @@ export class EditPoolInfo extends ModalAction {
async getPoolDetail() {
const { default_pool_id } = this.item;
const pool = await this.store.fetchDetail({ id: default_pool_id });
this.setState({ pool });
this.setState({ pool }, () => {
this.updateDefaultValue();
});
}
get formItems() {
@ -115,6 +110,12 @@ export class EditPoolInfo extends ModalAction {
options: Algorithm,
required: true,
},
{
name: 'admin_state_up',
label: t('Admin State Up'),
type: 'switch',
tip: t('Defines the admin state of the pool.'),
},
];
}

View File

@ -16,8 +16,9 @@ import { inject, observer } from 'mobx-react';
import globalListenerStore from 'stores/octavia/listener';
import Base from 'containers/BaseDetail';
import { HealthMonitorStore } from 'stores/octavia/health-monitor';
import { getInsertHeaderCard } from 'src/resources/octavia/lb';
import { getInsertHeaderCard } from 'resources/octavia/lb';
import { isEmpty } from 'lodash';
import { algorithmDict } from 'resources/octavia/pool';
export class BaseDetail extends Base {
componentDidMount() {
@ -63,7 +64,8 @@ export class BaseDetail extends Base {
get PoolInfo() {
const { default_pool = {} } = this.detailData || {};
const { name, protocol, lb_algorithm, description } = default_pool;
const { name, protocol, lb_algorithm, description, admin_state_up } =
default_pool;
const options = [
{
label: t('Name'),
@ -75,7 +77,11 @@ export class BaseDetail extends Base {
},
{
label: t('LB Algorithm'),
content: lb_algorithm || '-',
content: algorithmDict[lb_algorithm] || lb_algorithm || '-',
},
{
label: t('Admin State Up'),
content: admin_state_up ? t('On') : t('Off'),
},
{
label: t('Description'),

View File

@ -23,7 +23,7 @@ export const BackendProtocol = [
},
];
const algorithmDict = {
export const algorithmDict = {
LEAST_CONNECTIONS: t('LEAST_CONNECTIONS'),
ROUND_ROBIN: t('ROUND_ROBIN'),
SOURCE_IP: t('SOURCE_IP'),