feat: Add enable/disable action for load balancer member and display provisioning/operating status
Change-Id: I83b8b531363aec94634254b35b4ac3b87bd2e8e6 Signed-off-by: Sowmya Nethi <sowmya.kamavaram@rackspace.com>
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
import { ConfirmAction } from 'containers/Action';
|
||||
import globalPoolMemberStore from 'stores/octavia/pool-member';
|
||||
|
||||
export default class DisableAction extends ConfirmAction {
|
||||
get id() {
|
||||
return 'disable';
|
||||
}
|
||||
|
||||
get title() {
|
||||
return t('Disable Member');
|
||||
}
|
||||
|
||||
get isDanger() {
|
||||
return false;
|
||||
}
|
||||
|
||||
get buttonText() {
|
||||
return t('Disable');
|
||||
}
|
||||
|
||||
get actionName() {
|
||||
return t('disable member');
|
||||
}
|
||||
|
||||
policy = 'os_load-balancer_api:member:put';
|
||||
|
||||
allowedCheckFunc = (item) => {
|
||||
if (!item) return true;
|
||||
return (
|
||||
this.isOwnerOrAdmin(item) &&
|
||||
item.provisioning_status === 'ACTIVE' &&
|
||||
item.admin_state_up
|
||||
);
|
||||
};
|
||||
|
||||
isOwnerOrAdmin() {
|
||||
return true;
|
||||
}
|
||||
|
||||
onSubmit = (values) => {
|
||||
const { default_pool_id } = this.containerProps.detail;
|
||||
const { id } = values;
|
||||
const data = {
|
||||
admin_state_up: false,
|
||||
};
|
||||
return globalPoolMemberStore.update({
|
||||
member_id: id,
|
||||
default_pool_id,
|
||||
data,
|
||||
});
|
||||
};
|
||||
}
|
@@ -0,0 +1,52 @@
|
||||
import { ConfirmAction } from 'containers/Action';
|
||||
import globalPoolMemberStore from 'stores/octavia/pool-member';
|
||||
|
||||
export default class EnableAction extends ConfirmAction {
|
||||
get id() {
|
||||
return 'enable';
|
||||
}
|
||||
|
||||
get title() {
|
||||
return t('Enable Member');
|
||||
}
|
||||
|
||||
get isDanger() {
|
||||
return false;
|
||||
}
|
||||
|
||||
get buttonText() {
|
||||
return t('Enable');
|
||||
}
|
||||
|
||||
get actionName() {
|
||||
return t('enable member');
|
||||
}
|
||||
|
||||
policy = 'os_load-balancer_api:member:put';
|
||||
|
||||
allowedCheckFunc = (item) => {
|
||||
if (!item) return true;
|
||||
return (
|
||||
this.isOwnerOrAdmin(item) &&
|
||||
item.provisioning_status === 'ACTIVE' &&
|
||||
item.admin_state_up === false
|
||||
);
|
||||
};
|
||||
|
||||
isOwnerOrAdmin() {
|
||||
return true;
|
||||
}
|
||||
|
||||
onSubmit = (values) => {
|
||||
const { default_pool_id } = this.containerProps.detail;
|
||||
const { id } = values;
|
||||
const data = {
|
||||
admin_state_up: true,
|
||||
};
|
||||
return globalPoolMemberStore.update({
|
||||
member_id: id,
|
||||
default_pool_id,
|
||||
data,
|
||||
});
|
||||
};
|
||||
}
|
@@ -13,6 +13,8 @@
|
||||
// limitations under the License.
|
||||
|
||||
import DeleteAction from './DeleteMember';
|
||||
import DisableAction from './DisableMember';
|
||||
import EnableAction from './EnableMember';
|
||||
import CreateAction from './CreateMember';
|
||||
import Edit from './EditMember';
|
||||
|
||||
@@ -23,6 +25,12 @@ export const actionConfigs = {
|
||||
{
|
||||
action: DeleteAction,
|
||||
},
|
||||
{
|
||||
action: DisableAction,
|
||||
},
|
||||
{
|
||||
action: EnableAction,
|
||||
},
|
||||
],
|
||||
},
|
||||
batchActions: [
|
||||
@@ -37,6 +45,12 @@ export const adminActions = {
|
||||
{
|
||||
action: DeleteAction,
|
||||
},
|
||||
{
|
||||
action: DisableAction,
|
||||
},
|
||||
{
|
||||
action: EnableAction,
|
||||
},
|
||||
],
|
||||
},
|
||||
batchActions: [],
|
||||
|
@@ -14,7 +14,10 @@
|
||||
|
||||
import { observer, inject } from 'mobx-react';
|
||||
import Base from 'containers/List';
|
||||
import { provisioningStatusCodes } from 'resources/octavia/lb';
|
||||
import {
|
||||
provisioningStatusCodes,
|
||||
operatingStatusCodes,
|
||||
} from 'resources/octavia/lb';
|
||||
import globalPoolMemberStore from 'stores/octavia/pool-member';
|
||||
import { idNameColumn } from 'utils/table';
|
||||
import { actionConfigs, adminActions } from './Actions';
|
||||
@@ -63,11 +66,24 @@ export class Members extends Base {
|
||||
getColumns = () => [
|
||||
idNameColumn,
|
||||
{
|
||||
title: t('Status'),
|
||||
title: t('Provisioning Status'),
|
||||
dataIndex: 'provisioning_status',
|
||||
valueMap: provisioningStatusCodes,
|
||||
isHideable: true,
|
||||
},
|
||||
{
|
||||
title: t('Operating Status'),
|
||||
dataIndex: 'operating_status',
|
||||
valueMap: operatingStatusCodes,
|
||||
isHideable: true,
|
||||
},
|
||||
{
|
||||
title: t('Admin State Up'),
|
||||
dataIndex: 'admin_state_up',
|
||||
render: (value) => (value ? t('On') : t('Off')),
|
||||
isStatus: false,
|
||||
isHideable: true,
|
||||
},
|
||||
{
|
||||
title: t('Ip Address'),
|
||||
dataIndex: 'address',
|
||||
|
Reference in New Issue
Block a user