Browse Source

Make wizard display Execute Now options for Live Migrations too.

Signed-off-by: Nashwan Azhari <nazhari@cloudbasesolutions.com>
Nashwan Azhari 2 năm trước cách đây
mục cha
commit
cdc1fcde72

+ 19 - 18
src/components/modules/WizardModule/WizardOptions/WizardOptions.tsx

@@ -331,7 +331,7 @@ class WizardOptions extends React.Component<Props> {
       fieldsSchema.push(titleFieldSchema);
     }
 
-    if (this.props.wizardType === "replica") {
+    if (this.props.wizardType === "replica" || this.props.wizardType === "migration") {
       fieldsSchema.push({
         name: "execute_now",
         type: "boolean",
@@ -350,24 +350,25 @@ class WizardOptions extends React.Component<Props> {
           ? "Enable 'Execute Now' to set 'Execute Now Options'"
           : `Set the options for ${this.props.wizardType} execution`,
       });
-    } else if (
-      this.props.wizardType === "migration" ||
-      this.props.wizardType === "migration-destination-options-edit"
-    ) {
-      const shutdownInstanceField = migrationFields.find(
-        f => f.name === "shutdown_instances"
-      )!;
-      shutdownInstanceField.disabled = this.props.executeNowOptionsDisabled;
-      shutdownInstanceField.description = this.props.executeNowOptionsDisabled
-        ? "The 'Shutdown Instances' option is disabled for the source provider"
-        : shutdownInstanceField.description;
-      fieldsSchema = [
-        ...fieldsSchema,
-        ...migrationFields.map(f =>
-          f.name === "shutdown_instances" ? shutdownInstanceField : f
-        ),
-      ];
     }
+    // } else if (
+    //   this.props.wizardType === "migration" ||
+    //   this.props.wizardType === "migration-destination-options-edit"
+    // ) {
+    //   const shutdownInstanceField = migrationFields.find(
+    //     f => f.name === "shutdown_instances"
+    //   )!;
+    //   shutdownInstanceField.disabled = this.props.executeNowOptionsDisabled;
+    //   shutdownInstanceField.description = this.props.executeNowOptionsDisabled
+    //     ? "The 'Shutdown Instances' option is disabled for the source provider"
+    //     : shutdownInstanceField.description;
+    //   fieldsSchema = [
+    //     ...fieldsSchema,
+    //     ...migrationFields.map(f =>
+    //       f.name === "shutdown_instances" ? shutdownInstanceField : f
+    //     ),
+    //   ];
+    // }
 
     return fieldsSchema;
   }

+ 19 - 19
src/components/modules/WizardModule/WizardSummary/WizardSummary.tsx

@@ -448,24 +448,24 @@ class WizardSummary extends React.Component<Props> {
       </Option>
     );
 
-    const migrationOptions = [
-      <Option key="shutdown">
-        <OptionLabel>Shutdown Instances</OptionLabel>
-        <OptionValue>
-          {this.getDefaultBooleanOption("shutdown_instances", false)
-            ? "Yes"
-            : "No"}
-        </OptionValue>
-      </Option>,
-      <Option key="count">
-        <OptionLabel>Replication Count</OptionLabel>
-        <OptionValue>
-          {(this.props.data.destOptions &&
-            this.props.data.destOptions.replication_count) ||
-            2}
-        </OptionValue>
-      </Option>,
-    ];
+    // const migrationOptions = [
+    //   <Option key="shutdown">
+    //     <OptionLabel>Shutdown Instances</OptionLabel>
+    //     <OptionValue>
+    //       {this.getDefaultBooleanOption("shutdown_instances", false)
+    //         ? "Yes"
+    //         : "No"}
+    //     </OptionValue>
+    //   </Option>,
+    //   <Option key="count">
+    //     <OptionLabel>Replication Count</OptionLabel>
+    //     <OptionValue>
+    //       {(this.props.data.destOptions &&
+    //         this.props.data.destOptions.replication_count) ||
+    //         2}
+    //     </OptionValue>
+    //   </Option>,
+    // ];
 
     const renderDefaultStorageOption = () => (
       <Option>
@@ -487,7 +487,7 @@ class WizardSummary extends React.Component<Props> {
         <SectionTitle>{type} Target Options</SectionTitle>
         <OptionsList>
           {this.props.wizardType === "replica" ? executeNowOption : null}
-          {this.props.wizardType === "migration" ? migrationOptions : null}
+          {this.props.wizardType === "migration" ? executeNowOption: null}
           {this.props.data.selectedInstances &&
           this.props.data.selectedInstances.length > 1
             ? separateVmOption

+ 7 - 9
src/components/smart/WizardPage/WizardPage.tsx

@@ -197,15 +197,13 @@ class WizardPage extends React.Component<Props, State> {
     );
     let schedulePromise = Promise.resolve();
 
-    if (this.state.type === "replica") {
-      items.forEach(replica => {
-        if (replica.type !== "replica") {
-          return;
-        }
-        this.executeCreatedReplica(replica);
-        schedulePromise = this.scheduleReplica(replica);
-      });
-    }
+    items.forEach(replica => {
+      if (replica.type !== "replica") {
+        return;
+      }
+      this.executeCreatedReplica(replica);
+      schedulePromise = this.scheduleReplica(replica);
+    });
 
     if (items.length === 1) {
       let location = `/replicas/${items[0].id}/executions`;