From 74e1006cedab21e3b95dc99adcf84746e44b0526 Mon Sep 17 00:00:00 2001 From: zhuyue Date: Thu, 2 Sep 2021 15:24:58 +0800 Subject: [PATCH] fix: Fix for port manage security groups & delete 1. fix for port manage security groups 2. fix port delete allowed address pair Change-Id: Ifbff7d6de779227b53880dd70dc811693be9b0ab --- .../Detail/AllowedAddressPair/actions/Delete.jsx | 12 +++++------- .../network/containers/VirtualAdapter/index.jsx | 8 ++------ 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/pages/network/containers/VirtualAdapter/Detail/AllowedAddressPair/actions/Delete.jsx b/src/pages/network/containers/VirtualAdapter/Detail/AllowedAddressPair/actions/Delete.jsx index 5ae872c9..d46da281 100644 --- a/src/pages/network/containers/VirtualAdapter/Detail/AllowedAddressPair/actions/Delete.jsx +++ b/src/pages/network/containers/VirtualAdapter/Detail/AllowedAddressPair/actions/Delete.jsx @@ -13,7 +13,6 @@ // limitations under the License. import { ConfirmAction } from 'containers/Action'; -import _ from 'lodash'; import globalVirtualAdapterStore from 'stores/neutron/virtual-adapter'; export default class DeleteAction extends ConfirmAction { @@ -53,17 +52,16 @@ export default class DeleteAction extends ConfirmAction { return true; } - onSubmit = async (data) => { - const { allowed_address_pairs = [], id } = globalVirtualAdapterStore.detail; - _.remove( - allowed_address_pairs, - (item) => item.ip_address === data.ip_address + onSubmit = async (data, containerProps) => { + const { allowed_address_pairs = [], id } = containerProps.detail; + const newData = allowed_address_pairs.filter( + (i) => i.ip_address !== data.ip_address ); return globalVirtualAdapterStore .update( { id }, { - allowed_address_pairs, + allowed_address_pairs: newData, } ) .then((ret) => { diff --git a/src/pages/network/containers/VirtualAdapter/index.jsx b/src/pages/network/containers/VirtualAdapter/index.jsx index c7dabd60..071486e6 100644 --- a/src/pages/network/containers/VirtualAdapter/index.jsx +++ b/src/pages/network/containers/VirtualAdapter/index.jsx @@ -16,9 +16,7 @@ import React from 'react'; import { Link } from 'react-router-dom'; import { observer, inject } from 'mobx-react'; import Base from 'containers/List'; -import globalVirtualAdapterStore, { - VirtualAdapterStore, -} from 'stores/neutron/virtual-adapter'; +import { VirtualAdapterStore } from 'stores/neutron/virtual-adapter'; import { portStatus } from 'resources/port'; import { emptyActionConfig } from 'utils/constants'; import actionConfigs from './actions'; @@ -27,9 +25,7 @@ import actionConfigs from './actions'; @observer export default class VirtualAdapter extends Base { init() { - this.store = this.inDetailPage - ? new VirtualAdapterStore() - : globalVirtualAdapterStore; + this.store = new VirtualAdapterStore(); this.downloadStore = new VirtualAdapterStore(); }