|
|
@@ -61,6 +61,7 @@ type State = {
|
|
|
pausePolling: boolean;
|
|
|
initialLoading: boolean;
|
|
|
deploying: boolean;
|
|
|
+ dbInstancesDetails: any[];
|
|
|
};
|
|
|
@observer
|
|
|
class DeploymentDetailsPage extends React.Component<Props, State> {
|
|
|
@@ -73,6 +74,7 @@ class DeploymentDetailsPage extends React.Component<Props, State> {
|
|
|
pausePolling: false,
|
|
|
initialLoading: true,
|
|
|
deploying: false,
|
|
|
+ dbInstancesDetails: [],
|
|
|
};
|
|
|
|
|
|
stopPolling: boolean | null = null;
|
|
|
@@ -135,6 +137,14 @@ class DeploymentDetailsPage extends React.Component<Props, State> {
|
|
|
return image;
|
|
|
}
|
|
|
|
|
|
+ hasStoredVmInfo(info: any): boolean {
|
|
|
+ return (
|
|
|
+ info &&
|
|
|
+ Object.keys(info).length > 0 &&
|
|
|
+ Object.values(info).some((vmData: any) => vmData.export_info)
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
async loadDeploymentAndPollData() {
|
|
|
const loadDeployment = async () => {
|
|
|
await endpointStore.getEndpoints({ showLoading: true });
|
|
|
@@ -250,14 +260,39 @@ class DeploymentDetailsPage extends React.Component<Props, State> {
|
|
|
},
|
|
|
);
|
|
|
|
|
|
- instanceStore.loadInstancesDetails({
|
|
|
- endpointId: details.origin_endpoint_id,
|
|
|
- instances: details.instances.map(n => ({ id: n })),
|
|
|
- cache: options.cache,
|
|
|
- quietError: false,
|
|
|
- env: details.source_environment,
|
|
|
- targetProvider: targetEndpoint?.type,
|
|
|
+ if (this.hasStoredVmInfo(details.info)) {
|
|
|
+ this.populateInstanceStoreFromDeploymentInfo(details.info);
|
|
|
+ } else {
|
|
|
+ instanceStore.loadInstancesDetails({
|
|
|
+ endpointId: details.origin_endpoint_id,
|
|
|
+ instances: details.instances.map(n => ({ id: n })),
|
|
|
+ cache: options.cache,
|
|
|
+ quietError: false,
|
|
|
+ env: details.source_environment,
|
|
|
+ targetProvider: targetEndpoint?.type,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ populateInstanceStoreFromDeploymentInfo(deploymentInfo: any) {
|
|
|
+ const instancesDetails = Object.keys(deploymentInfo).map(vmName => {
|
|
|
+ const vmData = deploymentInfo[vmName];
|
|
|
+ const exportInfo = vmData.export_info || {};
|
|
|
+
|
|
|
+ return {
|
|
|
+ id: exportInfo.id || vmName,
|
|
|
+ name: exportInfo.name || vmName,
|
|
|
+ instance_name: exportInfo.instance_name || vmName,
|
|
|
+ firmware_type: exportInfo.firmware_type,
|
|
|
+ num_cpu: exportInfo.num_cpu,
|
|
|
+ memory_mb: exportInfo.memory_mb,
|
|
|
+ os_type: exportInfo.os_type,
|
|
|
+ flavor_name: exportInfo.flavor_name,
|
|
|
+ devices: exportInfo.devices || {},
|
|
|
+ };
|
|
|
});
|
|
|
+
|
|
|
+ this.setState({ dbInstancesDetails: instancesDetails });
|
|
|
}
|
|
|
|
|
|
handleUserItemClick(item: { value: string }) {
|
|
|
@@ -547,7 +582,9 @@ class DeploymentDetailsPage extends React.Component<Props, State> {
|
|
|
<DeploymentDetailsContent
|
|
|
item={deploymentStore.deploymentDetails}
|
|
|
itemId={this.props.match.params.id}
|
|
|
- instancesDetails={instanceStore.instancesDetails}
|
|
|
+ instancesDetails={
|
|
|
+ this.state.dbInstancesDetails || instanceStore.instancesDetails
|
|
|
+ }
|
|
|
instancesDetailsLoading={
|
|
|
instanceStore.loadingInstancesDetails ||
|
|
|
endpointStore.storageLoading ||
|