Explorar o código

Populate instance details after execution without a refresh

Polling refreshed `transfer.info` once an execution
collected the VM `export_info` but never re-derived
the instance details, so after executing a transfer
those sections stayed empty until a manual page refresh.

Signed-off-by: Mihaela Balutoiu <mbalutoiu@cloudbasesolutions.com>
Mihaela Balutoiu hai 1 semana
pai
achega
ec3c5a7de1

+ 14 - 0
src/components/smart/TransferDetailsPage/TransferDetailsPage.tsx

@@ -385,6 +385,17 @@ class TransferDetailsPage extends React.Component<Props, State> {
     this.setState({ dbInstancesDetails: instancesDetails });
   }
 
+  populateInstanceDetails() {
+    const transfer = this.transfer;
+    if (
+      transfer &&
+      !this.state.dbInstancesDetails.length &&
+      this.hasStoredVmInfo(transfer.info)
+    ) {
+      this.populateInstanceStoreFromTransferInfo(transfer.info);
+    }
+  }
+
   isExecuteDisabled() {
     const transfer = this.transfer;
     if (!transfer) {
@@ -491,10 +502,12 @@ class TransferDetailsPage extends React.Component<Props, State> {
   }
 
   handleCreateDeploymentClick() {
+    this.populateInstanceDetails();
     this.setState({ showDeploymentModal: true, pausePolling: true });
   }
 
   handleTransferEditClick() {
+    this.populateInstanceDetails();
     this.setState({ showEditModal: true, pausePolling: true });
   }
 
@@ -665,6 +678,7 @@ class TransferDetailsPage extends React.Component<Props, State> {
         }
       })(),
     ]);
+    this.populateInstanceDetails();
 
     setTimeout(() => {
       this.pollData();