2
0
Эх сурвалжийг харах

Use correct replication count when recreat. migr.

Previously, if replication count value was already set when clicking
Recreate Migration, the value would appear in the Recreate Migration
modal, but it wouldn't have been sent to the API. You had to set it
again in order for it to be sent.

This fixes the issue.
Sergiu Miclea 6 жил өмнө
parent
commit
c90e8b7769

+ 1 - 0
.flowconfig

@@ -1,6 +1,7 @@
 [ignore]
 [ignore]
 <PROJECT_ROOT>/node_modules/*
 <PROJECT_ROOT>/node_modules/*
 <PROJECT_ROOT>/dist/.*
 <PROJECT_ROOT>/dist/.*
+<PROJECT_ROOT>/private/.*
 
 
 [libs]
 [libs]
 
 

+ 1 - 0
.vscode/settings.json

@@ -1,4 +1,5 @@
 {
 {
   "flow.useNPMPackagedFlow": true,
   "flow.useNPMPackagedFlow": true,
   "javascript.validate.enable": false,
   "javascript.validate.enable": false,
+  "files.eol": "\n",
 }
 }

+ 1 - 1
src/components/App.jsx

@@ -80,7 +80,7 @@ const Wrapper = styled.div`
 type State = {
 type State = {
   isConfigReady: boolean,
   isConfigReady: boolean,
 }
 }
-const MIN_WAIT_MS = 2000
+const MIN_WAIT_MS = 0
 
 
 class App extends React.Component<{}, State> {
 class App extends React.Component<{}, State> {
   state = {
   state = {

+ 9 - 1
src/components/organisms/EditReplica/EditReplica.jsx

@@ -324,7 +324,15 @@ class EditReplica extends React.Component<Props, State> {
     } else {
     } else {
       try {
       try {
         let replicaDefaultStorage = this.props.replica.storage_mappings && this.props.replica.storage_mappings.default
         let replicaDefaultStorage = this.props.replica.storage_mappings && this.props.replica.storage_mappings.default
-        let migration: MainItem = await migrationStore.recreate(this.props.replica, this.props.sourceEndpoint, this.props.destinationEndpoint, updateData, replicaDefaultStorage, this.state.defaultStorage)
+        let migration: MainItem = await migrationStore.recreate(
+          this.props.replica,
+          this.props.sourceEndpoint,
+          this.props.destinationEndpoint,
+          updateData,
+          replicaDefaultStorage,
+          this.state.defaultStorage,
+          this.props.replica.replication_count
+        )
         migrationStore.clearDetails()
         migrationStore.clearDetails()
         this.props.onRequestClose()
         this.props.onRequestClose()
         this.props.onUpdateComplete(`/migration/tasks/${migration.id}`)
         this.props.onUpdateComplete(`/migration/tasks/${migration.id}`)

+ 2 - 1
src/sources/MigrationSource.js

@@ -87,6 +87,7 @@ class MigrationSource {
     networkMappings: ?{ [string]: any },
     networkMappings: ?{ [string]: any },
     updatedNetworkMappings: ?NetworkMap[],
     updatedNetworkMappings: ?NetworkMap[],
     defaultSkipOsMorphing: ?boolean,
     defaultSkipOsMorphing: ?boolean,
+    replicationCount: ?number,
   }): Promise<MainItem> {
   }): Promise<MainItem> {
     const getValue = (fieldName: string): ?string => {
     const getValue = (fieldName: string): ?string => {
       let updatedDestEnv = opts.updatedDestEnv && opts.updatedDestEnv[fieldName]
       let updatedDestEnv = opts.updatedDestEnv && opts.updatedDestEnv[fieldName]
@@ -106,7 +107,7 @@ class MigrationSource {
         ...destParser.getDestinationEnv(opts.updatedDestEnv),
         ...destParser.getDestinationEnv(opts.updatedDestEnv),
       },
       },
       shutdown_instances: Boolean(opts.updatedDestEnv && opts.updatedDestEnv.shutdown_instances),
       shutdown_instances: Boolean(opts.updatedDestEnv && opts.updatedDestEnv.shutdown_instances),
-      replication_count: (opts.updatedDestEnv && opts.updatedDestEnv.replication_count) || 2,
+      replication_count: (opts.updatedDestEnv && opts.updatedDestEnv.replication_count) || opts.replicationCount || 2,
       instances: opts.instanceNames,
       instances: opts.instanceNames,
       notes: getValue('description') || '',
       notes: getValue('description') || '',
     }
     }

+ 3 - 1
src/stores/MigrationStore.js

@@ -69,7 +69,8 @@ class MigrationStore {
     destEndpoint: Endpoint,
     destEndpoint: Endpoint,
     updateData: UpdateData,
     updateData: UpdateData,
     defaultStorage: ?string,
     defaultStorage: ?string,
-    updatedDefaultStorage: ?string
+    updatedDefaultStorage: ?string,
+    replicationCount: ?number
   ): Promise<MainItem> {
   ): Promise<MainItem> {
     let migrationResult = await MigrationSource.recreate({
     let migrationResult = await MigrationSource.recreate({
       sourceEndpoint,
       sourceEndpoint,
@@ -86,6 +87,7 @@ class MigrationStore {
       networkMappings: migration.network_map,
       networkMappings: migration.network_map,
       updatedNetworkMappings: updateData.network,
       updatedNetworkMappings: updateData.network,
       defaultSkipOsMorphing: this.getDefaultSkipOsMorphing(migration),
       defaultSkipOsMorphing: this.getDefaultSkipOsMorphing(migration),
+      replicationCount,
     })
     })
     return migrationResult
     return migrationResult
   }
   }

+ 1 - 0
src/types/MainItem.js

@@ -55,6 +55,7 @@ export type MainItem = {
   destination_environment: { [string]: mixed },
   destination_environment: { [string]: mixed },
   source_environment: { [string]: mixed },
   source_environment: { [string]: mixed },
   transfer_result: ?{ [string]: Instance },
   transfer_result: ?{ [string]: Instance },
+  replication_count?: number,
   storage_mappings?: ?{
   storage_mappings?: ?{
     backend_mappings: ?{
     backend_mappings: ?{
       destination: string,
       destination: string,