Просмотр исходного кода

Add 'max-param' ESLint rule across the codebase

Implement the rule with a maximum number of parameters (3) across the
codebase.

See https://eslint.org/docs/rules/max-params for more details about the
rule.
Sergiu Miclea 4 лет назад
Родитель
Сommit
8aee0dc252
30 измененных файлов с 381 добавлено и 243 удалено
  1. 4 0
      .eslintrc
  2. 5 2
      src/@types/Field.ts
  3. 11 8
      src/components/App.tsx
  4. 14 14
      src/components/modules/EndpointModule/EndpointLogos/story.tsx
  5. 3 1
      src/components/modules/MinionModule/MinionPoolDetailsContent/MinionPoolMainDetails.tsx
  6. 3 1
      src/components/modules/TransferModule/MainDetails/MainDetails.tsx
  7. 10 10
      src/components/modules/TransferModule/ReplicaMigrationOptions/ReplicaMigrationOptions.tsx
  8. 23 12
      src/components/modules/TransferModule/ScheduleItem/ScheduleItem.tsx
  9. 20 17
      src/components/modules/TransferModule/TransferDetailsTable/TransferDetailsTable.tsx
  10. 24 12
      src/components/modules/TransferModule/TransferItemModal/TransferItemModal.tsx
  11. 12 9
      src/components/modules/WizardModule/WizardScripts/WizardScripts.tsx
  12. 8 3
      src/components/modules/WizardModule/WizardStorage/WizardStorage.tsx
  13. 14 14
      src/components/modules/WizardModule/WizardSummary/WizardSummary.tsx
  14. 17 19
      src/components/smart/AssessmentsPage/AssessmentsPage.tsx
  15. 22 12
      src/components/smart/MigrationDetailsPage/MigrationDetailsPage.tsx
  16. 8 8
      src/components/smart/MigrationsPage/MigrationsPage.tsx
  17. 38 21
      src/components/smart/ReplicaDetailsPage/ReplicaDetailsPage.tsx
  18. 8 9
      src/components/smart/ReplicasPage/ReplicasPage.tsx
  19. 14 14
      src/components/smart/WizardPage/WizardPage.tsx
  20. 5 2
      src/sources/InstanceSource.ts
  21. 5 2
      src/sources/MigrationSource.ts
  22. 9 3
      src/sources/ProviderSource.ts
  23. 5 2
      src/sources/ScheduleSource.ts
  24. 13 5
      src/sources/WizardSource.ts
  25. 9 5
      src/stores/AzureStore.ts
  26. 23 10
      src/stores/InstanceStore.ts
  27. 13 7
      src/stores/MigrationStore.ts
  28. 15 9
      src/stores/ProviderStore.ts
  29. 10 6
      src/stores/ScheduleStore.ts
  30. 16 6
      src/stores/WizardStore.ts

+ 4 - 0
.eslintrc

@@ -36,6 +36,10 @@
     "src/**/package.json"
   ],
   "rules": {
+    "max-params": [
+      "error",
+      3
+    ],
     "coriolis-web/import-no-duplicate-name": "error",
     "react/function-component-definition": "off",
     "react/sort-comp": "off",

+ 5 - 2
src/@types/Field.ts

@@ -59,12 +59,15 @@ export type Field = {
 const migrationImageOsTypes = ['windows', 'linux']
 
 class FieldHelper {
-  getValueAlias(
+  getValueAlias(opts: {
     name: string,
     value: any,
     fields: Field[],
     targetProvider: ProviderTypes | null | undefined,
-  ): string {
+  }): string {
+    const {
+      name, value, fields, targetProvider,
+    } = opts
     const plugin = targetProvider && OptionsSchemaPlugin.for(targetProvider)
 
     if (value === true) {

+ 11 - 8
src/components/App.tsx

@@ -145,7 +145,10 @@ class App extends React.Component<{}, State> {
       return <Route path={path} component={component} exact={exact} />
     }
 
-    const renderOptionalRoute = (name: string, component: any, path?: string, exact?: boolean) => {
+    const renderOptionalRoute = (opts: { name: string, component: any, path?: string, exact?: boolean }) => {
+      const {
+        name, component, path, exact,
+      } = opts
       if (configLoader.config.disabledPages.find(p => p === name)) {
         return null
       }
@@ -200,13 +203,13 @@ class App extends React.Component<{}, State> {
             {renderRoute('/minion-pools/:id', MinionPoolDetailsPage, true)}
             {renderRoute('/minion-pools/:id/:page', MinionPoolDetailsPage)}
             {renderRoute('/wizard/:type', WizardPage)}
-            {renderOptionalRoute('planning', AssessmentsPage)}
-            {renderOptionalRoute('planning', AssessmentDetailsPage, '/assessment/:info')}
-            {renderOptionalRoute('users', UsersPage, undefined, true)}
-            {renderOptionalRoute('users', UserDetailsPage, '/users/:id')}
-            {renderOptionalRoute('projects', ProjectsPage, undefined, true)}
-            {renderOptionalRoute('projects', ProjectDetailsPage, '/projects/:id')}
-            {renderOptionalRoute('logging', LogsPage)}
+            {renderOptionalRoute({ name: 'planning', component: AssessmentsPage })}
+            {renderOptionalRoute({ name: 'planning', component: AssessmentDetailsPage, path: '/assessment/:info' })}
+            {renderOptionalRoute({ name: 'users', component: UsersPage, exact: true })}
+            {renderOptionalRoute({ name: 'users', component: UserDetailsPage, path: '/users/:id' })}
+            {renderOptionalRoute({ name: 'users', component: ProjectsPage, exact: true })}
+            {renderOptionalRoute({ name: 'projects', component: ProjectDetailsPage, path: '/projects/:id' })}
+            {renderOptionalRoute({ name: 'logging', component: LogsPage })}
             {renderRoute('/streamlog', LogStreamPage)}
             <Route component={MessagePage} />
           </Switch>

+ 14 - 14
src/components/modules/EndpointModule/EndpointLogos/story.tsx

@@ -29,17 +29,17 @@ const Wrapper = styled.div<any>`
     margin-top: 32px;
   }
 `
-const wrap = (
+const wrap = (opts: {
   endpoint: string | null | undefined,
   height: number | undefined,
-  disabled = false,
-  white = false,
-) => (
+  disabled?: boolean,
+  white?: boolean,
+}) => (
   <EndpointLogos
-    endpoint={endpoint as any}
-    height={height}
-    disabled={disabled}
-    white={white}
+    endpoint={opts.endpoint as any}
+    height={opts.height}
+    disabled={opts.disabled}
+    white={opts.white}
     baseUrl="http://localhost:3000"
   />
 )
@@ -61,7 +61,7 @@ storiesOf('EndpointLogos', module)
     const height = 32
     return (
       <Wrapper>
-        {providers.map(p => wrap(p, height))}
+        {providers.map(p => wrap({ endpoint: p, height }))}
       </Wrapper>
     )
   })
@@ -69,7 +69,7 @@ storiesOf('EndpointLogos', module)
     const height = 32
     return (
       <Wrapper background="#202134">
-        {providers.map(p => wrap(p, height, false, true))}
+        {providers.map(p => wrap({ endpoint: p, height, white: true }))}
       </Wrapper>
     )
   })
@@ -77,7 +77,7 @@ storiesOf('EndpointLogos', module)
     const height = 42
     return (
       <Wrapper>
-        {providers.map(p => wrap(p, height))}
+        {providers.map(p => wrap({ endpoint: p, height }))}
       </Wrapper>
     )
   })
@@ -85,7 +85,7 @@ storiesOf('EndpointLogos', module)
     const height = 64
     return (
       <Wrapper>
-        {providers.map(p => wrap(p, height))}
+        {providers.map(p => wrap({ endpoint: p, height }))}
       </Wrapper>
     )
   })
@@ -93,7 +93,7 @@ storiesOf('EndpointLogos', module)
     const height = 128
     return (
       <Wrapper>
-        {providers.map(p => wrap(p, height))}
+        {providers.map(p => wrap({ endpoint: p, height }))}
       </Wrapper>
     )
   })
@@ -101,7 +101,7 @@ storiesOf('EndpointLogos', module)
     const height = 128
     return (
       <Wrapper>
-        {providers.map(p => wrap(p, height, true))}
+        {providers.map(p => wrap({ endpoint: p, height, disabled: true }))}
       </Wrapper>
     )
   })

+ 3 - 1
src/components/modules/MinionModule/MinionPoolDetailsContent/MinionPoolMainDetails.tsx

@@ -150,7 +150,9 @@ class MinionPoolMainDetails extends React.Component<Props> {
         return value.map((v: { source: any; destination: any }) => `${v.source}=${v.destination}`).join(', ')
       }
       const schema = this.props.schema
-      return fieldHelper.getValueAlias(name, value, schema, endpoint && endpoint.type)
+      return fieldHelper.getValueAlias({
+        name, value, fields: schema, targetProvider: endpoint && endpoint.type,
+      })
     }
 
     let properties: any[] = []

+ 3 - 1
src/components/modules/TransferModule/MainDetails/MainDetails.tsx

@@ -197,7 +197,9 @@ class MainDetails extends React.Component<Props, State> {
         return value.map((v: { source: any; destination: any }) => `${v.source}=${v.destination}`).join(', ')
       }
       const schema = type === 'source' ? this.props.sourceSchema : this.props.destinationSchema
-      return fieldHelper.getValueAlias(name, value, schema, endpoint && endpoint.type)
+      return fieldHelper.getValueAlias({
+        name, value, fields: schema, targetProvider: endpoint && endpoint.type,
+      })
     }
 
     let properties: any[] = []

+ 10 - 10
src/components/modules/TransferModule/ReplicaMigrationOptions/ReplicaMigrationOptions.tsx

@@ -83,12 +83,12 @@ type Props = {
   loadingInstances: boolean,
   defaultSkipOsMorphing?: boolean | null,
   onCancelClick: () => void,
-  onMigrateClick: (
+  onMigrateClick: (opts: {
     fields: Field[],
-    uploadedScripts: InstanceScript[],
-    removedScripts: InstanceScript[],
+    uploadedUserScripts: InstanceScript[],
+    removedUserScripts: InstanceScript[],
     minionPoolMappings: { [instance: string]: string }
-  ) => void,
+  }) => void,
   onResizeUpdate?: (scrollableRef: HTMLElement, scrollOffset?: number) => void,
 }
 type State = {
@@ -139,12 +139,12 @@ class ReplicaMigrationOptions extends React.Component<Props, State> {
   }
 
   migrate() {
-    this.props.onMigrateClick(
-      this.state.fields,
-      this.state.uploadedScripts,
-      this.state.removedScripts,
-      this.state.minionPoolMappings,
-    )
+    this.props.onMigrateClick({
+      fields: this.state.fields,
+      uploadedUserScripts: this.state.uploadedScripts,
+      removedUserScripts: this.state.removedScripts,
+      minionPoolMappings: this.state.minionPoolMappings,
+    })
   }
 
   handleValueChange(field: Field, value: boolean) {

+ 23 - 12
src/components/modules/TransferModule/ScheduleItem/ScheduleItem.tsx

@@ -124,12 +124,15 @@ type Props = {
 }
 @observer
 class ScheduleItem extends React.Component<Props> {
-  getFieldValue(
+  getFieldValue(opts: {
     items: Field[],
     fieldName: ScheduleFieldName,
     zeroBasedIndex?: boolean,
     defaultSelectedIndex?: number,
-  ) {
+  }) {
+    const {
+      items, fieldName, zeroBasedIndex, defaultSelectedIndex,
+    } = opts
     if (this.props.item.schedule == null) {
       return defaultSelectedIndex !== undefined ? items[defaultSelectedIndex] : items[0]
     }
@@ -219,7 +222,7 @@ class ScheduleItem extends React.Component<Props> {
     })
 
     if (this.props.item.enabled || this.props.deleting) {
-      return this.renderLabel(this.getFieldValue(items, 'month'))
+      return this.renderLabel(this.getFieldValue({ items, fieldName: 'month' }))
     }
 
     return (
@@ -228,7 +231,7 @@ class ScheduleItem extends React.Component<Props> {
         width={160}
         items={items}
         useBold={this.shouldUseBold('month')}
-        selectedItem={this.getFieldValue(items, 'month')}
+        selectedItem={this.getFieldValue({ items, fieldName: 'month' })}
         onChange={item => { this.handleMonthChange(item) }}
         data-test-id="scheduleItem-monthDropdown"
       />
@@ -244,7 +247,7 @@ class ScheduleItem extends React.Component<Props> {
     }
 
     if (this.props.item.enabled || this.props.deleting) {
-      return this.renderLabel(this.getFieldValue(items, 'dom'))
+      return this.renderLabel(this.getFieldValue({ items, fieldName: 'dom' }))
     }
 
     return (
@@ -253,7 +256,7 @@ class ScheduleItem extends React.Component<Props> {
         width={86}
         items={items}
         useBold={this.shouldUseBold('dom')}
-        selectedItem={this.getFieldValue(items, 'dom')}
+        selectedItem={this.getFieldValue({ items, fieldName: 'dom' })}
         onChange={item => { this.props.onChange({ schedule: { dom: item.value } }) }}
         data-test-id="scheduleItem-dayOfMonthDropdown"
       />
@@ -269,7 +272,7 @@ class ScheduleItem extends React.Component<Props> {
     })
 
     if (this.props.item.enabled || this.props.deleting) {
-      return this.renderLabel(this.getFieldValue(items, 'dow', true))
+      return this.renderLabel(this.getFieldValue({ items, fieldName: 'dow', zeroBasedIndex: true }))
     }
 
     return (
@@ -278,7 +281,7 @@ class ScheduleItem extends React.Component<Props> {
         width={160}
         items={items}
         useBold={this.shouldUseBold('dow')}
-        selectedItem={this.getFieldValue(items, 'dow', true)}
+        selectedItem={this.getFieldValue({ items, fieldName: 'dow', zeroBasedIndex: true })}
         onChange={item => { this.props.onChange({ schedule: { dow: item.value } }) }}
         data-test-id="scheduleItem-dayOfWeekDropdown"
       />
@@ -292,7 +295,9 @@ class ScheduleItem extends React.Component<Props> {
     }
 
     if (this.props.item.enabled || this.props.deleting) {
-      return this.renderLabel(this.getFieldValue(items, 'hour', true, 1))
+      return this.renderLabel(this.getFieldValue({
+        items, fieldName: 'hour', zeroBasedIndex: true, defaultSelectedIndex: 1,
+      }))
     }
 
     return (
@@ -301,7 +306,9 @@ class ScheduleItem extends React.Component<Props> {
         width={86}
         items={items}
         useBold={this.shouldUseBold('hour')}
-        selectedItem={this.getFieldValue(items, 'hour', true, 1)}
+        selectedItem={this.getFieldValue({
+          items, fieldName: 'hour', zeroBasedIndex: true, defaultSelectedIndex: 1,
+        })}
         onChange={item => { this.handleHourChange(item.value) }}
         data-test-id="scheduleItem-hourDropdown"
       />
@@ -315,7 +322,9 @@ class ScheduleItem extends React.Component<Props> {
     }
 
     if (this.props.item.enabled || this.props.deleting) {
-      return this.renderLabel(this.getFieldValue(items, 'minute', true, 1))
+      return this.renderLabel(this.getFieldValue({
+        items, fieldName: 'minute', zeroBasedIndex: true, defaultSelectedIndex: 1,
+      }))
     }
 
     return (
@@ -324,7 +333,9 @@ class ScheduleItem extends React.Component<Props> {
         width={86}
         items={items}
         useBold={this.shouldUseBold('minute')}
-        selectedItem={this.getFieldValue(items, 'minute', true, 1)}
+        selectedItem={this.getFieldValue({
+          items, fieldName: 'minute', zeroBasedIndex: true, defaultSelectedIndex: 1,
+        })}
         onChange={item => { this.props.onChange({ schedule: { minute: item.value } }) }}
         data-test-id="scheduleItem-minuteDropdown"
       />

+ 20 - 17
src/components/modules/TransferModule/TransferDetailsTable/TransferDetailsTable.tsx

@@ -187,14 +187,17 @@ class TransferDetailsTable extends React.Component<Props, State> {
     }
   }
 
-  renderRow(
+  renderRow(opts: {
     id: string,
     icon: 'instance' | 'network' | 'storage',
     sourceName: string,
     destinationName: React.ReactNode,
     sourceBody: string[],
     destinationBody: string[],
-  ) {
+  }) {
+    const {
+      id, icon, sourceName, destinationName, sourceBody, destinationBody,
+    } = opts
     const isOpened: boolean = Boolean(this.state.openedRows.find(i => i === id))
 
     return (
@@ -298,14 +301,14 @@ class TransferDetailsTable extends React.Component<Props, State> {
         destinationBody = ['Waiting for migration to finish']
       }
 
-      rows.push(this.renderRow(
-        `${instance.instance_name || instance.id}-${sourceName}-${destinationKey}`,
-        'storage',
+      rows.push(this.renderRow({
+        id: `${instance.instance_name || instance.id}-${sourceName}-${destinationKey}`,
+        icon: 'storage',
         sourceName,
         destinationName,
         sourceBody,
         destinationBody,
-      ))
+      }))
     })
 
     return rows
@@ -376,14 +379,14 @@ class TransferDetailsTable extends React.Component<Props, State> {
           destinationBody = ['Waiting for migration to finish']
         }
 
-        rows.push(this.renderRow(
-          `${instance.instance_name || instance.id}-${nic.network_name}`,
-          'network',
-          nic.mac_address,
-          destinationNetworkName,
+        rows.push(this.renderRow({
+          id: `${instance.instance_name || instance.id}-${nic.network_name}`,
+          icon: 'network',
+          sourceName: nic.mac_address,
+          destinationName: destinationNetworkName,
           sourceBody,
           destinationBody,
-        ))
+        }))
       }
     })
 
@@ -421,14 +424,14 @@ class TransferDetailsTable extends React.Component<Props, State> {
       destinationName = 'Waiting for migration to finish'
     }
     const instanceName = instance.instance_name || instance.id
-    return this.renderRow(
-      instanceName,
-      'instance',
-      instanceName,
+    return this.renderRow({
+      id: instanceName,
+      icon: 'instance',
+      sourceName: instanceName,
       destinationName,
       sourceBody,
       destinationBody,
-    )
+    })
   }
 
   render() {

+ 24 - 12
src/components/modules/TransferModule/TransferItemModal/TransferItemModal.tsx

@@ -252,7 +252,10 @@ class TransferItemModal extends React.Component<Props, State> {
     return { value: null }
   }
 
-  getFieldValue(type: 'source' | 'destination', fieldName: string, defaultValue: any, parentFieldName?: string) {
+  getFieldValue(opts: { type: 'source' | 'destination', fieldName: string, defaultValue: any, parentFieldName?: string }) {
+    const {
+      type, fieldName, defaultValue, parentFieldName,
+    } = opts
     const currentData = type === 'source' ? this.state.sourceData : this.state.destinationData
 
     const replicaMinionMappings = this.props.replica[INSTANCE_OSMORPHING_MINION_POOL_MAPPINGS]
@@ -455,7 +458,10 @@ class TransferItemModal extends React.Component<Props, State> {
     this.loadData(false)
   }
 
-  handleFieldChange(type: 'source' | 'destination', field: Field, value: any, parentFieldName?: string) {
+  handleFieldChange(opts: { type: 'source' | 'destination', field: Field, value: any, parentFieldName?: string }) {
+    const {
+      type, field, value, parentFieldName,
+    } = opts
     const data = type === 'source' ? { ...this.state.sourceData } : { ...this.state.destinationData }
 
     if (field.type === 'array') {
@@ -539,15 +545,15 @@ class TransferItemModal extends React.Component<Props, State> {
           value: defaultStorage.id,
           busType: defaultStorage.busType,
         }
-        const migration: MigrationItemDetails = await migrationStore.recreate(
-          this.props.replica as any,
-          this.props.sourceEndpoint,
-          this.props.destinationEndpoint,
+        const migration: MigrationItemDetails = await migrationStore.recreate({
+          migration: this.props.replica as any,
+          sourceEndpoint: this.props.sourceEndpoint,
+          destEndpoint: this.props.destinationEndpoint,
           updateData,
-          replicaDefaultStorage,
-          this.state.defaultStorage,
-          this.props.replica.replication_count,
-        )
+          defaultStorage: replicaDefaultStorage,
+          updatedDefaultStorage: this.state.defaultStorage,
+          replicationCount: this.props.replica.replication_count,
+        })
         migrationStore.clearDetails()
         this.props.onRequestClose()
         this.props.onUpdateComplete(`/migrations/${migration.id}/tasks`)
@@ -647,12 +653,18 @@ class TransferItemModal extends React.Component<Props, State> {
       <WizardOptions
         minionPools={minionPools}
         wizardType={`${this.props.type || 'replica'}-${type}-options-edit`}
-        getFieldValue={(f, d, pf) => this.getFieldValue(type, f, d, pf)}
+        getFieldValue={(f, d, pf) => this.getFieldValue({
+          type, fieldName: f, defaultValue: d, parentFieldName: pf,
+        })}
         fields={fields}
         selectedInstances={type === 'destination' ? this.props.instancesDetails : null}
         hasStorageMap={type === 'source' ? false : this.hasStorageMap()}
         storageBackends={endpointStore.storageBackends}
-        onChange={(f, v, fp) => { this.handleFieldChange(type, f, v, fp) }}
+        onChange={(f, v, fp) => {
+          this.handleFieldChange({
+            type, field: f, value: v, parentFieldName: fp,
+          })
+        }}
         oneColumnStyle={{
           marginTop: '-16px', display: 'flex', flexDirection: 'column', width: '100%', alignItems: 'center',
         }}

+ 12 - 9
src/components/modules/WizardModule/WizardScripts/WizardScripts.tsx

@@ -188,12 +188,15 @@ class WizardScripts extends React.Component<Props> {
     DomUtils.download(scriptData, fileName)
   }
 
-  renderScriptItem(
-    global: 'windows' | 'linux' | null,
-    instanceId: string | null,
+  renderScriptItem(opts: {
+    global?: 'windows' | 'linux',
+    instanceId?: string,
     title: string,
     subtitle?: string,
-  ) {
+  }) {
+    const {
+      global, instanceId, title, subtitle,
+    } = opts
     const uploadedScript = this.props.uploadedScripts.find(
       s => (s.instanceId
         ? s.instanceId === instanceId : s.global ? s.global === global : false),
@@ -250,7 +253,7 @@ class WizardScripts extends React.Component<Props> {
             <InputCloseStyled
               show
               onClick={() => {
-                this.props.onCancelScript(global, instanceId)
+                this.props.onCancelScript(global || null, instanceId || null)
                 const ref = this.fileInputRefs[title]
                 if (ref) {
                   ref.inputRef.value = ''
@@ -273,7 +276,7 @@ class WizardScripts extends React.Component<Props> {
         <FakeFileInput
           type="file"
           ref={(r: HTMLInputElement) => { this.fileInputRefs[title] = { inputRef: r } }}
-          onChange={e => { this.handleFileUpload(e.target.files, global, instanceId) }}
+          onChange={e => { this.handleFileUpload(e.target.files, global || null, instanceId || null) }}
         />
       </Script>
     )
@@ -293,8 +296,8 @@ class WizardScripts extends React.Component<Props> {
             />
           </Heading>
           <Scripts>
-            {this.renderScriptItem('windows', null, 'Windows Script File')}
-            {this.renderScriptItem('linux', null, 'Linux Script File')}
+            {this.renderScriptItem({ global: 'windows', title: 'Windows Script File' })}
+            {this.renderScriptItem({ global: 'linux', title: 'Linux Script File' })}
           </Scripts>
         </Group>
       )
@@ -328,7 +331,7 @@ class WizardScripts extends React.Component<Props> {
             const osType = osLabel ? `${osLabel} OS | ` : ''
             const subtitle = `${osType}${instance.num_cpu} vCPU | ${instance.memory_mb} MB RAM`
 
-            return this.renderScriptItem(null, id, title, subtitle)
+            return this.renderScriptItem({ instanceId: id, title, subtitle })
           })}
         </Scripts>
       </Group>

+ 8 - 3
src/components/modules/WizardModule/WizardStorage/WizardStorage.tsx

@@ -214,12 +214,15 @@ class WizardStorage extends React.Component<Props> {
     )
   }
 
-  renderStorageDropdown(
+  renderStorageDropdown(opts: {
     storageItems: Array<StorageBackend>,
     selectedItem: StorageBackend | null | undefined,
     disk: Disk,
     type: 'backend' | 'disk',
-  ) {
+  }) {
+    const {
+      storageItems, selectedItem, disk, type,
+    } = opts
     return storageItems.length > 10 ? (
       <AutocompleteDropdown
         width={ThemeProps.inputSizes.large.width}
@@ -307,7 +310,9 @@ class WizardStorage extends React.Component<Props> {
                 <Dropdowns>
                   {disk.disabled && type === 'disk' ? this.renderDisabledDisk(disk) : (
                     <>
-                      {this.renderStorageDropdown(storageItems, selectedStorageMapping?.target, disk, type)}
+                      {this.renderStorageDropdown({
+                        storageItems, selectedItem: selectedStorageMapping?.target, disk, type,
+                      })}
                       {/* {this.renderBusTypeDropdown(selectedStorageMapping)} */}
                     </>
                   )}

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

@@ -284,9 +284,9 @@ class WizardSummary extends React.Component<Props> {
             }
             const optionLabel = optionName.split('/')
               .map(n => LabelDictionary.get(n, `${data.source ? data.source.type : ''}-source`)).join(' - ')
-            const optionValue = fieldHelper
-              .getValueAlias(optionName, data.sourceOptions
-                && data.sourceOptions[optionName], this.props.sourceSchema, provider)
+            const optionValue = fieldHelper.getValueAlias({
+              name: optionName, value: data.sourceOptions?.[optionName], fields: this.props.sourceSchema, targetProvider: provider,
+            })
             return (
               <Option key={optionName}>
                 <OptionLabel title={optionLabel}>
@@ -326,12 +326,12 @@ class WizardSummary extends React.Component<Props> {
           if (key.indexOf('password') > -1 || propertyName.indexOf('password') > -1) {
             optionValue = '•••••••••'
           } else {
-            optionValue = fieldHelper.getValueAlias(
-              propertyName,
+            optionValue = fieldHelper.getValueAlias({
+              name: propertyName,
               value,
-              schema,
-              provider,
-            )
+              fields: schema,
+              targetProvider: provider,
+            })
           }
 
           return (
@@ -465,12 +465,12 @@ class WizardSummary extends React.Component<Props> {
             const optionLabel = optionName.split('/')
               .map(n => LabelDictionary.get(n, `${data.target ? data.target.type : ''}-destination`)).join(' - ')
 
-            const optionValue = fieldHelper.getValueAlias(
-              optionName,
-              data.destOptions && data.destOptions[optionName],
-              this.props.destinationSchema,
-              provider,
-            )
+            const optionValue = fieldHelper.getValueAlias({
+              name: optionName,
+              value: data.destOptions?.[optionName],
+              fields: this.props.destinationSchema,
+              targetProvider: provider,
+            })
 
             return (
               <Option key={optionName}>

+ 17 - 19
src/components/smart/AssessmentsPage/AssessmentsPage.tsx

@@ -119,12 +119,11 @@ class AssessmentsPage extends React.Component<Props, State> {
       return
     }
 
-    azureStore.getAssessments(
-
-      endpointStore.connectionInfo.subscription_id,
-      assessmentStore.selectedResourceGroup ? assessmentStore.selectedResourceGroup.name : '',
-      userStore.loggedUser ? userStore.loggedUser.project.id : '',
-    )
+    azureStore.getAssessments({
+      subscriptionId: endpointStore.connectionInfo.subscription_id,
+      resourceGroupName: assessmentStore.selectedResourceGroup?.name || '',
+      projectId: userStore.loggedUser?.project.id || '',
+    })
   }
 
   handleItemClick(assessment: Assessment) {
@@ -188,13 +187,13 @@ class AssessmentsPage extends React.Component<Props, State> {
       return
     }
 
-    azureStore.getAssessments(
-
-      connectionInfo.subscription_id,
-      selectedResourceGroup.name,
-      userStore.loggedUser ? userStore.loggedUser.project.id : '',
-      { backgroundLoading: true, skipLog: true },
-    ).then(() => {
+    azureStore.getAssessments({
+      subscriptionId: connectionInfo.subscription_id,
+      resourceGroupName: selectedResourceGroup.name,
+      projectId: userStore.loggedUser?.project.id || '',
+      backgroundLoading: true,
+      skipLog: true,
+    }).then(() => {
       this.pollTimeout = window.setTimeout(() => {
         this.pollData()
       }, configLoader.config.requestPollTimeout)
@@ -207,12 +206,11 @@ class AssessmentsPage extends React.Component<Props, State> {
     }
 
     assessmentStore.updateSelectedResourceGroup(selectedResourceGroup)
-    azureStore.getAssessments(
-
-      endpointStore.connectionInfo.subscription_id,
-      selectedResourceGroup.name,
-      userStore.loggedUser ? userStore.loggedUser.project.id : '',
-    )
+    azureStore.getAssessments({
+      subscriptionId: endpointStore.connectionInfo.subscription_id,
+      resourceGroupName: selectedResourceGroup.name,
+      projectId: userStore.loggedUser?.project.id || '',
+    })
   }
 
   chooseEndpoint(selectedEndpoint: Endpoint, clearResourceGroup?: boolean) {

+ 22 - 12
src/components/smart/MigrationDetailsPage/MigrationDetailsPage.tsx

@@ -253,36 +253,44 @@ class MigrationDetailsPage extends React.Component<Props, State> {
     }
   }
 
-  async recreateFromReplica(
-    options: Field[],
+  async recreateFromReplica(opts: {
+    fields: Field[],
     uploadedUserScripts: InstanceScript[],
     removedUserScripts: InstanceScript[],
     minionPoolMappings: { [instance: string]: string },
-  ) {
+  }) {
+    const {
+      fields, uploadedUserScripts, removedUserScripts, minionPoolMappings,
+    } = opts
     const replicaId = migrationStore.migrationDetails && migrationStore.migrationDetails.replica_id
     if (!replicaId) {
       return
     }
 
-    this.migrate(replicaId, options, uploadedUserScripts, removedUserScripts, minionPoolMappings)
+    this.migrate({
+      replicaId, fields, uploadedUserScripts, removedUserScripts, minionPoolMappings,
+    })
     this.handleCloseFromReplicaModal()
   }
 
-  async migrate(
+  async migrate(opts: {
     replicaId: string,
-    options: Field[],
+    fields: Field[],
     uploadedUserScripts: InstanceScript[],
     removedUserScripts: InstanceScript[],
     minionPoolMappings: { [instance: string]: string },
-  ) {
-    const migration = await migrationStore.migrateReplica(
+  }) {
+    const {
+      replicaId, fields, uploadedUserScripts, removedUserScripts, minionPoolMappings,
+    } = opts
+    const migration = await migrationStore.migrateReplica({
       replicaId,
-      options,
+      fields,
       uploadedUserScripts,
       removedUserScripts,
-      migrationStore.migrationDetails?.user_scripts,
+      userScriptData: migrationStore.migrationDetails?.user_scripts,
       minionPoolMappings,
-    )
+    })
     this.props.history.push(`/migrations/${migration.id}/tasks`)
   }
 
@@ -447,7 +455,9 @@ Note that this may lead to scheduled cleanup tasks being forcibly skipped, and t
               transferItem={migrationStore.migrationDetails}
               minionPools={minionPoolStore.minionPools}
               onCancelClick={() => { this.handleCloseFromReplicaModal() }}
-              onMigrateClick={(o, s, r, m) => { this.recreateFromReplica(o, s, r, m) }}
+              onMigrateClick={opts => {
+                this.recreateFromReplica(opts)
+              }}
               instances={instanceStore.instancesDetails}
               loadingInstances={instanceStore.loadingInstancesDetails}
               defaultSkipOsMorphing={migrationStore

+ 8 - 8
src/components/smart/MigrationsPage/MigrationsPage.tsx

@@ -141,14 +141,14 @@ class MigrationsPage extends React.Component<{ history: any }, State> {
 
     await Promise.all(this.state.selectedMigrations.map(async migration => {
       if (migration.replica_id) {
-        await migrationStore.migrateReplica(
-          migration.replica_id,
-          replicaMigrationFields,
-          [],
-          [],
-          migration.user_scripts,
-          migration.instance_osmorphing_minion_pool_mappings || {},
-        )
+        await migrationStore.migrateReplica({
+          replicaId: migration.replica_id,
+          fields: replicaMigrationFields,
+          uploadedUserScripts: [],
+          removedUserScripts: [],
+          userScriptData: migration.user_scripts,
+          minionPoolMappings: migration.instance_osmorphing_minion_pool_mappings || {},
+        })
       } else {
         await migrationStore.recreateFullCopy(migration as any)
       }

+ 38 - 21
src/components/smart/ReplicaDetailsPage/ReplicaDetailsPage.tsx

@@ -367,13 +367,27 @@ class ReplicaDetailsPage extends React.Component<Props, State> {
     const unsavedData = scheduleStore.unsavedSchedules.find(s => s.id === scheduleId)
 
     if (scheduleId) {
-      scheduleStore.updateSchedule(this.replicaId, scheduleId, data, oldData, unsavedData, forceSave)
+      scheduleStore.updateSchedule({
+        replicaId: this.replicaId,
+        scheduleId,
+        data,
+        oldData,
+        unsavedData,
+        forceSave,
+      })
     }
   }
 
   handleScheduleSave(schedule: Schedule) {
     if (schedule.id) {
-      scheduleStore.updateSchedule(this.replicaId, schedule.id, schedule, schedule, schedule, true)
+      scheduleStore.updateSchedule({
+        replicaId: this.replicaId,
+        scheduleId: schedule.id,
+        data: schedule,
+        oldData: schedule,
+        unsavedData: schedule,
+        forceSave: true,
+      })
     }
   }
 
@@ -418,34 +432,37 @@ class ReplicaDetailsPage extends React.Component<Props, State> {
     })
   }
 
-  migrateReplica(
-    options: Field[],
-    uploadedScripts: InstanceScript[],
-    removedScripts: InstanceScript[],
+  migrateReplica(opts: {
+    fields: Field[],
+    uploadedUserScripts: InstanceScript[],
+    removedUserScripts: InstanceScript[],
     minionPoolMappings: { [instance: string]: string },
-  ) {
-    this.migrate(options, uploadedScripts, removedScripts, minionPoolMappings)
+  }) {
+    this.migrate(opts)
     this.handleCloseMigrationModal()
   }
 
-  async migrate(
-    options: Field[],
-    uploadedScripts: InstanceScript[],
-    removedScripts: InstanceScript[],
+  async migrate(opts: {
+    fields: Field[],
+    uploadedUserScripts: InstanceScript[],
+    removedUserScripts: InstanceScript[],
     minionPoolMappings: { [instance: string]: string },
-  ) {
+  }) {
     const replica = this.replica
     if (!replica) {
       return
     }
-    const migration = await migrationStore.migrateReplica(
-      replica.id,
-      options,
-      uploadedScripts,
-      removedScripts,
-      replica.user_scripts,
+    const {
+      fields, uploadedUserScripts, removedUserScripts, minionPoolMappings,
+    } = opts
+    const migration = await migrationStore.migrateReplica({
+      replicaId: replica.id,
+      fields,
+      uploadedUserScripts,
+      removedUserScripts,
+      userScriptData: replica.user_scripts,
       minionPoolMappings,
-    )
+    })
     notificationStore.alert('Migration successfully created from replica.', 'success', {
       action: {
         label: 'View Migration Status',
@@ -668,7 +685,7 @@ class ReplicaDetailsPage extends React.Component<Props, State> {
               loadingInstances={instanceStore.loadingInstancesDetails}
               instances={instanceStore.instancesDetails}
               onCancelClick={() => { this.handleCloseMigrationModal() }}
-              onMigrateClick={(o, s, r, m) => { this.migrateReplica(o, s, r, m) }}
+              onMigrateClick={opts => { this.migrateReplica(opts) }}
             />
           </Modal>
         ) : null}

+ 8 - 9
src/components/smart/ReplicasPage/ReplicasPage.tsx

@@ -161,15 +161,14 @@ class ReplicasPage extends React.Component<{ history: any }, State> {
 
   async migrate(fields: Field[], uploadedScripts: InstanceScript[]) {
     await Promise.all(this.state.selectedReplicas
-      .map(replica => migrationStore.migrateReplica(
-        replica.id,
+      .map(replica => migrationStore.migrateReplica({
+        replicaId: replica.id,
         fields,
-        uploadedScripts.filter(s => !s.instanceId
-          || replica.instances.find(i => i === s.instanceId)),
-        [],
-        replica.user_scripts,
-        replica.instance_osmorphing_minion_pool_mappings || {},
-      )))
+        uploadedUserScripts: uploadedScripts.filter(s => !s.instanceId || replica.instances.find(i => i === s.instanceId)),
+        removedUserScripts: [],
+        userScriptData: replica.user_scripts,
+        minionPoolMappings: replica.instance_osmorphing_minion_pool_mappings || {},
+      })))
     notificationStore.alert('Migrations successfully created from replicas.', 'success')
     this.props.history.push('/migrations')
   }
@@ -436,7 +435,7 @@ class ReplicasPage extends React.Component<{ history: any }, State> {
               onCancelClick={() => {
                 this.setState({ showCreateMigrationsModal: false, modalIsOpen: false })
               }}
-              onMigrateClick={(options, s) => { this.migrateSelectedReplicas(options, s) }}
+              onMigrateClick={options => { this.migrateSelectedReplicas(options.fields, options.uploadedUserScripts) }}
             />
           </Modal>
         ) : null}

+ 14 - 14
src/components/smart/WizardPage/WizardPage.tsx

@@ -548,13 +548,13 @@ class WizardPage extends React.Component<Props, State> {
   async createMultiple() {
     const typeLabel = this.state.type.charAt(0).toUpperCase() + this.state.type.substr(1)
     notificationStore.alert(`Creating ${typeLabel}s ...`)
-    const success = await wizardStore.createMultiple(
-      this.state.type,
-      wizardStore.data,
-      wizardStore.defaultStorage,
-      wizardStore.storageMap,
-      wizardStore.uploadedUserScripts,
-    )
+    const success = await wizardStore.createMultiple({
+      type: this.state.type,
+      data: wizardStore.data,
+      defaultStorage: wizardStore.defaultStorage,
+      storageMap: wizardStore.storageMap,
+      uploadedUserScripts: wizardStore.uploadedUserScripts,
+    })
     if (success && wizardStore.createdItems) {
       this.handleCreationSuccess(wizardStore.createdItems.filter(ObjectUtils.notEmpty))
     } else {
@@ -566,13 +566,13 @@ class WizardPage extends React.Component<Props, State> {
     const typeLabel = this.state.type.charAt(0).toUpperCase() + this.state.type.substr(1)
     notificationStore.alert(`Creating ${typeLabel} ...`)
     try {
-      await wizardStore.create(
-        this.state.type,
-        wizardStore.data,
-        wizardStore.defaultStorage,
-        wizardStore.storageMap,
-        wizardStore.uploadedUserScripts,
-      )
+      await wizardStore.create({
+        type: this.state.type,
+        data: wizardStore.data,
+        defaultStorage: wizardStore.defaultStorage,
+        storageMap: wizardStore.storageMap,
+        uploadedUserScripts: wizardStore.uploadedUserScripts,
+      })
       const item = wizardStore.createdItem
       if (!item) {
         notificationStore.alert(`${typeLabel} couldn't be created`, 'error')

+ 5 - 2
src/sources/InstanceSource.ts

@@ -22,7 +22,7 @@ import { ProviderTypes } from '@src/@types/Providers'
 import DomUtils from '@src/utils/DomUtils'
 
 class InstanceSource {
-  async loadInstancesChunk(
+  async loadInstancesChunk(opts: {
     endpointId: string,
     chunkSize: number,
     lastInstanceId?: string,
@@ -30,7 +30,10 @@ class InstanceSource {
     searchText?: string,
     env?: any,
     cache?: boolean,
-  ): Promise<[Instance[], Instance[]]> {
+  }): Promise<[Instance[], Instance[]]> {
+    const {
+      endpointId, chunkSize, lastInstanceId, cache, cancelId, env, searchText,
+    } = opts
     let url = `${configLoader.config.servicesUrls.coriolis}/${Api.projectId}/endpoints/${endpointId}/instances`
     let queryParams: { [prop: string]: string | number } = {}
 

+ 5 - 2
src/sources/MigrationSource.ts

@@ -270,14 +270,17 @@ class MigrationSource {
     return migrationId
   }
 
-  async migrateReplica(
+  async migrateReplica(opts: {
     replicaId: string,
     options: Field[],
     uploadedUserScripts: InstanceScript[],
     removedUserScripts: InstanceScript[],
     userScriptData: UserScriptData | null | undefined,
     minionPoolMappings: { [instance: string]: string },
-  ): Promise<MigrationItem> {
+  }): Promise<MigrationItem> {
+    const {
+      replicaId, options, uploadedUserScripts, removedUserScripts, userScriptData, minionPoolMappings,
+    } = opts
     const payload: any = {
       migration: {
         replica_id: replicaId,

+ 9 - 3
src/sources/ProviderSource.ts

@@ -34,7 +34,10 @@ class ProviderSource {
     return response.data.providers
   }
 
-  async loadOptionsSchema(providerName: ProviderTypes, optionsType: 'source' | 'destination', useCache?: boolean | null, quietError?: boolean | null): Promise<Field[]> {
+  async loadOptionsSchema(opts: { providerName: ProviderTypes, optionsType: 'source' | 'destination', useCache?: boolean | null, quietError?: boolean | null }): Promise<Field[]> {
+    const {
+      providerName, optionsType, useCache, quietError,
+    } = opts
     const schemaTypeInt = optionsType === 'source' ? providerTypes.SOURCE_REPLICA : providerTypes.TARGET_REPLICA
 
     try {
@@ -55,13 +58,16 @@ class ProviderSource {
     }
   }
 
-  async getOptionsValues(
+  async getOptionsValues(opts: {
     optionsType: 'source' | 'destination',
     endpointId: string,
     envData: { [prop: string]: any } | null | undefined,
     cache?: boolean | null,
     quietError?: boolean,
-  ): Promise<OptionValues[]> {
+  }): Promise<OptionValues[]> {
+    const {
+      optionsType, endpointId, envData, cache, quietError,
+    } = opts
     let envString = ''
     if (envData) {
       envString = `?env=${DomUtils.encodeToBase64Url(envData)}`

+ 5 - 2
src/sources/ScheduleSource.ts

@@ -102,13 +102,16 @@ class ScheduleSource {
     })
   }
 
-  async updateSchedule(
+  async updateSchedule(opts: {
     replicaId: string,
     scheduleId: string,
     scheduleData: Schedule,
     scheduleOldData: Schedule | null | undefined,
     unsavedData: Schedule | null | undefined,
-  ): Promise<Schedule> {
+  }): Promise<Schedule> {
+    const {
+      replicaId, scheduleId, scheduleData, scheduleOldData, unsavedData,
+    } = opts
     const payload: any = {}
     if (scheduleData.enabled != null) {
       payload.enabled = scheduleData.enabled

+ 13 - 5
src/sources/WizardSource.ts

@@ -26,13 +26,16 @@ import { TransferItem } from '@src/@types/MainItem'
 import { INSTANCE_OSMORPHING_MINION_POOL_MAPPINGS } from '@src/components/modules/WizardModule/WizardOptions'
 
 class WizardSource {
-  async create(
+  async create(opts: {
     type: string,
     data: WizardData,
     defaultStorage: { value: string | null, busType?: string | null } | undefined,
     storageMap: StorageMap[],
     uploadedUserScripts: InstanceScript[],
-  ): Promise<TransferItem> {
+  }): Promise<TransferItem> {
+    const {
+      type, data, defaultStorage, storageMap, uploadedUserScripts,
+    } = opts
     const sourceParser = data.source
       ? OptionsSchemaPlugin.for(data.source.type) : DefaultOptionsSchemaParser
     const destParser = data.target
@@ -107,13 +110,16 @@ class WizardSource {
     return response.data[type]
   }
 
-  async createMultiple(
+  async createMultiple(opts: {
     type: string,
     data: WizardData,
     defaultStorage: { value: string | null, busType?: string | null } | undefined,
     storageMap: StorageMap[],
     uploadedUserScripts: InstanceScript[],
-  ) {
+  }) {
+    const {
+      type, data, defaultStorage, storageMap, uploadedUserScripts,
+    } = opts
     if (!data.selectedInstances) {
       throw new Error('No selected instances')
     }
@@ -126,7 +132,9 @@ class WizardSource {
 
       let mainItem: TransferItem | null = null
       try {
-        mainItem = await this.create(type, newData, defaultStorage, storageMap, uploadedUserScripts)
+        mainItem = await this.create({
+          type, data: newData, defaultStorage, storageMap, uploadedUserScripts,
+        })
       } finally {
         // If an there's an error with the request, return null, don't break the loop.
         // eslint-disable-next-line no-unsafe-finally

+ 9 - 5
src/stores/AzureStore.ts

@@ -193,22 +193,26 @@ class AzureStore {
     return this.assessmentsProjectId === (cookie.get('projectId') || 'null')
   }
 
-  @action async getAssessments(
+  @action async getAssessments(opts: {
     subscriptionId: string,
     resourceGroupName: string,
     projectId: string,
-    options?: { backgroundLoading: boolean, skipLog?: boolean },
-  ): Promise<void> {
+    backgroundLoading?: boolean,
+    skipLog?: boolean
+  }): Promise<void> {
+    const {
+      subscriptionId, resourceGroupName, projectId, backgroundLoading, skipLog,
+    } = opts
     let cookieProjectId = cookie.get('projectId') || 'null'
     if (projectId !== cookieProjectId) {
       return Promise.resolve()
     }
 
-    if (!options || !options.backgroundLoading) {
+    if (!backgroundLoading) {
       this.loadingAssessments = true
     }
     const assessments = await AzureSource
-      .getAssessments(subscriptionId, resourceGroupName, options && options.skipLog)
+      .getAssessments(subscriptionId, resourceGroupName, skipLog)
     this.loadingAssessments = false
     cookieProjectId = cookie.get('projectId') || 'null'
     if (projectId !== cookieProjectId) {

+ 23 - 10
src/stores/InstanceStore.ts

@@ -100,7 +100,14 @@ class InstanceStore {
 
     const loadNextChunk = async (lastEndpointId?: string) => {
       const currentEndpointId = endpoint.id
-      const [instances, invalidInstances] = await InstanceSource.loadInstancesChunk(currentEndpointId, chunkCount, lastEndpointId, `${endpoint.id}-chunk`, undefined, env, useCache)
+      const [instances, invalidInstances] = await InstanceSource.loadInstancesChunk({
+        endpointId: currentEndpointId,
+        chunkSize: chunkCount,
+        lastInstanceId: lastEndpointId,
+        cancelId: `${endpoint.id}-chunk`,
+        env,
+        cache: useCache,
+      })
       if (currentEndpointId !== this.lastEndpointId) {
         return
       }
@@ -108,7 +115,9 @@ class InstanceStore {
         notificationStore.alert(`There are one or more instances with invalid data (i.e. missing ID): ${invalidInstances.map(i => i.name || i.instance_name).join(', ')}`, 'error')
       }
 
-      const shouldContinue = this.loadInstancesInChunksSuccess(instances, instances.length + invalidInstances.length, chunkCount, reload)
+      const shouldContinue = this.loadInstancesInChunksSuccess({
+        instances, instancesCount: instances.length + invalidInstances.length, chunkCount, reload,
+      })
       if (shouldContinue) {
         loadNextChunk(instances[instances.length - 1].id)
       }
@@ -116,12 +125,16 @@ class InstanceStore {
     loadNextChunk()
   }
 
-  @action loadInstancesInChunksSuccess(
+  @action loadInstancesInChunksSuccess(opts: {
     instances: Instance[],
     instancesCount: number,
     chunkCount: number,
     reload?: boolean,
-  ): boolean {
+  }): boolean {
+    const {
+      instances, instancesCount, chunkCount, reload,
+    } = opts
+
     this.backgroundInstances = [...this.backgroundInstances, ...instances]
     if (reload) {
       this.reloading = false
@@ -188,13 +201,13 @@ class InstanceStore {
       .max(chunkSize[endpoint.type] || chunkSize.default, this.instancesPerPage)
 
     const loadNextChunk = async (lastEndpointId?: string) => {
-      const [instances, invalidInstances] = await InstanceSource.loadInstancesChunk(
-        endpoint.id,
-        chunkCount,
-        lastEndpointId,
-        `${endpoint.id}-chunk-search`,
+      const [instances, invalidInstances] = await InstanceSource.loadInstancesChunk({
+        endpointId: endpoint.id,
+        chunkSize: chunkCount,
+        lastInstanceId: lastEndpointId,
+        cancelId: `${endpoint.id}-chunk-search`,
         searchText,
-      )
+      })
       if (this.searching) {
         runInAction(() => {
           this.currentPage = 1

+ 13 - 7
src/stores/MigrationStore.ts

@@ -64,7 +64,7 @@ class MigrationStore {
     return MigrationSource.recreateFullCopy(migration)
   }
 
-  @action async recreate(
+  @action async recreate(opts: {
     migration: MigrationItemDetails,
     sourceEndpoint: Endpoint,
     destEndpoint: Endpoint,
@@ -72,7 +72,10 @@ class MigrationStore {
     defaultStorage: { value: string | null, busType?: string | null },
     updatedDefaultStorage: { value: string | null, busType?: string | null } | undefined,
     replicationCount: number | null | undefined,
-  ): Promise<MigrationItemDetails> {
+  }): Promise<MigrationItemDetails> {
+    const {
+      migration, sourceEndpoint, destEndpoint, updateData, defaultStorage, updatedDefaultStorage, replicationCount,
+    } = opts
     const migrationResult = await MigrationSource.recreate({
       sourceEndpoint,
       destEndpoint,
@@ -121,22 +124,25 @@ class MigrationStore {
     runInAction(() => { this.migrations = this.migrations.filter(r => r.id !== migrationId) })
   }
 
-  @action async migrateReplica(
+  @action async migrateReplica(opts: {
     replicaId: string,
-    options: Field[],
+    fields: Field[],
     uploadedUserScripts: InstanceScript[],
     removedUserScripts: InstanceScript[],
     userScriptData: UserScriptData | null | undefined,
     minionPoolMappings: { [instance: string]: string },
-  ) {
-    const migration = await MigrationSource.migrateReplica(
+  }) {
+    const {
+      replicaId, fields: options, uploadedUserScripts, removedUserScripts, userScriptData, minionPoolMappings,
+    } = opts
+    const migration = await MigrationSource.migrateReplica({
       replicaId,
       options,
       uploadedUserScripts,
       removedUserScripts,
       userScriptData,
       minionPoolMappings,
-    )
+    })
     runInAction(() => {
       this.migrations = [
         migration,

+ 15 - 9
src/stores/ProviderStore.ts

@@ -246,7 +246,9 @@ class ProviderStore {
     }
 
     try {
-      const fields: Field[] = await ProviderSource.loadOptionsSchema(providerName, optionsType, useCache, quietError)
+      const fields: Field[] = await ProviderSource.loadOptionsSchema({
+        providerName, optionsType, useCache, quietError,
+      })
       this.loadOptionsSchemaSuccess(fields, optionsType, isValid())
       return fields
     } finally {
@@ -328,14 +330,15 @@ class ProviderStore {
     }
 
     try {
-      const options = await ProviderSource
-        .getOptionsValues(optionsType, endpointId, envData, useCache, quietError)
-      this.getOptionsValuesSuccess(
+      const options = await ProviderSource.getOptionsValues({
+        optionsType, endpointId, envData, cache: useCache, quietError,
+      })
+      this.getOptionsValuesSuccess({
         optionsType,
-        providerName,
+        provider: providerName,
         options,
-        isValid(),
-      )
+        isValid: isValid(),
+      })
       return options
     } catch (e) {
       const err: any = e
@@ -398,12 +401,15 @@ class ProviderStore {
     }
   }
 
-  @action getOptionsValuesSuccess(
+  @action getOptionsValuesSuccess(opts: {
     optionsType: 'source' | 'destination',
     provider: ProviderTypes,
     options: OptionValues[],
     isValid: boolean,
-  ) {
+  }) {
+    const {
+      optionsType, provider, options, isValid,
+    } = opts
     if (!isValid) {
       return
     }

+ 10 - 6
src/stores/ScheduleStore.ts

@@ -104,14 +104,18 @@ class ScheduleStore {
     }
   }
 
-  @action async updateSchedule(
+  @action async updateSchedule(opts: {
     replicaId: string,
     scheduleId: string,
     data: Schedule,
     oldData?: Schedule | null,
     unsavedData?: Schedule | null,
     forceSave?: boolean,
-  ): Promise<void> {
+  }): Promise<void> {
+    const {
+      replicaId, scheduleId, data, oldData, unsavedData, forceSave,
+    } = opts
+
     if (!forceSave) {
       this.schedules = updateSchedule(this.schedules, scheduleId, data)
       const unsavedSchedule = this.unsavedSchedules.find(s => s.id === scheduleId)
@@ -127,13 +131,13 @@ class ScheduleStore {
       this.enablingIds.push(scheduleId)
     }
     try {
-      const schedule: Schedule = await Source.updateSchedule(
+      const schedule: Schedule = await Source.updateSchedule({
         replicaId,
         scheduleId,
-        data,
-        oldData,
+        scheduleData: data,
+        scheduleOldData: oldData,
         unsavedData,
-      )
+      })
       runInAction(() => {
         this.schedules = this.schedules.map(s => {
           if (s.id === schedule.id) {

+ 16 - 6
src/stores/WizardStore.ts

@@ -233,34 +233,44 @@ class WizardStore {
     this.schedules = this.schedules.filter(s => s.id !== scheduleId)
   }
 
-  @action async create(
+  @action async create(opts: {
     type: string,
     data: WizardData,
     defaultStorage: { value: string | null, busType?: string | null } | undefined,
     storageMap: StorageMap[],
     uploadedUserScripts: InstanceScript[],
-  ): Promise<void> {
+  }): Promise<void> {
+    const {
+      type, data, defaultStorage, storageMap, uploadedUserScripts,
+    } = opts
     this.creatingItem = true
 
     try {
-      const item: TransferItem = await source.create(type, data, defaultStorage, storageMap, uploadedUserScripts)
+      const item: TransferItem = await source.create({
+        type, data, defaultStorage, storageMap, uploadedUserScripts,
+      })
       runInAction(() => { this.createdItem = item })
     } finally {
       runInAction(() => { this.creatingItem = false })
     }
   }
 
-  @action async createMultiple(
+  @action async createMultiple(opts: {
     type: string,
     data: WizardData,
     defaultStorage: { value: string | null, busType?: string | null } | undefined,
     storageMap: StorageMap[],
     uploadedUserScripts: InstanceScript[],
-  ): Promise<boolean> {
+  }): Promise<boolean> {
+    const {
+      type, data, defaultStorage, storageMap, uploadedUserScripts,
+    } = opts
     this.creatingItems = true
 
     try {
-      const items = await source.createMultiple(type, data, defaultStorage, storageMap, uploadedUserScripts)
+      const items = await source.createMultiple({
+        type, data, defaultStorage, storageMap, uploadedUserScripts,
+      })
       const nullItemsCount = items.filter(i => i === null).length
       if (items && nullItemsCount === 0) {
         runInAction(() => { this.createdItems = items })