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(); }