Prechádzať zdrojové kódy

Add the new `auto_deploy` option to the execution options

Signed-off-by: Mihaela Balutoiu <mbalutoiu@cloudbasesolutions.com>
Mihaela Balutoiu 1 rok pred
rodič
commit
daa329cf1b

+ 1 - 0
src/@types/Schedule.ts

@@ -28,6 +28,7 @@ export type Schedule = {
   schedule?: ScheduleInfo;
   expiration_date?: Date;
   shutdown_instances?: boolean;
+  auto_deploy?: boolean;
 };
 
 export type ScheduleBulkItem = {

+ 9 - 0
src/constants.ts

@@ -69,6 +69,15 @@ export const executionOptions = [
     description:
       "When enabling this option, Coriolis will attempt to gracefully shut down the source instance(s), before syncing their data. This is recommended when executing Migrations, right before planning on completely Deploying on the destination cloud, as it will transfer the last chunks of data after the instance(s) have been shut down, and it leaves the source instance(s) off.",
   },
+  {
+    name: "auto_deploy",
+    type: "boolean",
+    label: "Auto Deploy",
+    defaultValue: false,
+    nullableBoolean: false,
+    description:
+      "When enabled, the transfer will automatically deploy the instances on the destination cloud after the transfer is complete.",
+  }
 ];
 
 export const wizardPages: WizardPage[] = [

+ 9 - 0
src/sources/ScheduleSource.ts

@@ -30,6 +30,10 @@ class ScheduleSource {
         scheduleData.shutdown_instances == null
           ? false
           : scheduleData.shutdown_instances,
+      auto_deploy:
+        scheduleData.auto_deploy == null 
+          ? false
+          : scheduleData.auto_deploy,
     };
 
     if (scheduleData.expiration_date) {
@@ -90,6 +94,8 @@ class ScheduleSource {
         : undefined,
       shutdown_instances:
         s.shutdown_instance != null ? s.shutdown_instance : undefined,
+      auto_deploy:
+        s.auto_deploy != null ? s.auto_deploy : undefined,
     }));
     schedules.sort(
       (a, b) =>
@@ -143,6 +149,9 @@ class ScheduleSource {
     if (scheduleData.shutdown_instances != null) {
       payload.shutdown_instance = scheduleData.shutdown_instances;
     }
+    if (scheduleData.auto_deploy != null) {
+      payload.auto_deploy = scheduleData.auto_deploy;
+    }
     if (unsavedData?.expiration_date) {
       payload.expiration_date = new Date(
         unsavedData.expiration_date

+ 1 - 1
src/sources/TransferSource.ts

@@ -155,7 +155,7 @@ class TransferSource {
   }
 
   async execute(transferId: string, fields?: Field[]): Promise<ExecutionTasks> {
-    const payload: any = { execution: { shutdown_instances: false } };
+    const payload: any = { execution: { shutdown_instances: false, auto_deploy: false } };
     if (fields) {
       fields.forEach(f => {
         payload.execution[f.name] = f.value || false;

+ 5 - 0
src/utils/LabelDictionary.ts

@@ -92,6 +92,11 @@ const dictionary = {
     description:
       "This option can be used before completing the Deployment on the target cloud. After the source instance(s) shutdown, a last snapshot will be executed, in order to transfer the last bits of data to the target cloud, and the source instance(s) will be left stopped.",
   },
+  auto_deploy: {
+    label: "Auto Deploy",
+    description:
+      "When enabled, the transfer will automatically deploy the instances on the destination cloud after the transfer is complete.",
+  }
 };
 
 const cache: {