From 852c4c41d3c0a3bf352fc5380729747a25f775fb Mon Sep 17 00:00:00 2001 From: Jadson Luan Date: Mon, 27 Jul 2020 12:52:48 -0300 Subject: [PATCH 1/2] Add instant refresh after terminate a resource --- src/components/OrderComponent.js | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/src/components/OrderComponent.js b/src/components/OrderComponent.js index a81dfc6..d77b97f 100644 --- a/src/components/OrderComponent.js +++ b/src/components/OrderComponent.js @@ -2,11 +2,11 @@ import React, { Component } from 'react'; import { connect } from 'react-redux'; import '../styles/order.css'; -import { deleteAttachment } from '../actions/attachments.actions'; -import { deleteCompute } from '../actions/computes.actions'; -import { deleteNetwork, deleteFedNetwork } from '../actions/networks.actions'; -import { deleteVolume } from '../actions/volumes.actions'; -import { deletePublicIp } from '../actions/publicIps.actions'; +import { deleteAttachment, getAttachments } from '../actions/attachments.actions'; +import { deleteCompute, getComputes } from '../actions/computes.actions'; +import { deleteNetwork, deleteFedNetwork, getNetworks, getFedNetworks } from '../actions/networks.actions'; +import { deleteVolume, getVolumes } from '../actions/volumes.actions'; +import { deletePublicIp, getPublicIps } from '../actions/publicIps.actions'; const mapping = { computes: 'Compute', @@ -18,31 +18,37 @@ const mapping = { }; class OrderComponent extends Component { - handleDelete = (event) => { + handleDelete = async(event) => { event.preventDefault(); - const { dispatch } = this.props; + const { dispatch } = this.props; let id = this.props.order.instanceId; let type = this.props.type; switch (type) { case 'computes': - dispatch(deleteCompute(id)); + await dispatch(deleteCompute(id)); + await dispatch(getComputes()); break; case 'networks': - dispatch(deleteNetwork(id)); + await dispatch(deleteNetwork(id)); + await dispatch(getNetworks()); break; case 'fednets': - dispatch(deleteFedNetwork(id)); + await dispatch(deleteFedNetwork(id)); + await dispatch(getFedNetworks()); break; case 'volumes': - dispatch(deleteVolume(id)); + await dispatch(deleteVolume(id)); + await dispatch(getVolumes()); break; case 'attachments': - dispatch(deleteAttachment(id)); + await dispatch(deleteAttachment(id)); + await dispatch(getAttachments()); break; case 'publicip': - dispatch(deletePublicIp(id)); + await dispatch(deletePublicIp(id)); + await dispatch(getPublicIps()); break; default: break; From 0bce76926efd558b66262ed3f7b753314612f26f Mon Sep 17 00:00:00 2001 From: Jadson Luan Date: Mon, 27 Jul 2020 12:53:14 -0300 Subject: [PATCH 2/2] Disable terminate button while deleting a resource --- src/components/OrderComponent.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/OrderComponent.js b/src/components/OrderComponent.js index d77b97f..d57a533 100644 --- a/src/components/OrderComponent.js +++ b/src/components/OrderComponent.js @@ -20,6 +20,7 @@ const mapping = { class OrderComponent extends Component { handleDelete = async(event) => { event.preventDefault(); + event.target.disabled = true; const { dispatch } = this.props; let id = this.props.order.instanceId;