Przeglądaj źródła

Call options for `list_all_destination_networks`

If `list_all_destination_networks` is toggled, call
'destination-options' API.
Sergiu Miclea 6 lat temu
rodzic
commit
53e535f26a
2 zmienionych plików z 10 dodań i 1 usunięć
  1. 5 0
      config.js
  2. 5 1
      src/stores/ProviderStore.js

+ 5 - 0
config.js

@@ -53,6 +53,11 @@ const conf: Config = {
         },
       ],
     },
+    {
+      name: 'openstack',
+      types: ['destination'],
+      requiredFields: ['list_all_destination_networks'],
+    },
     {
       name: 'aws',
       types: ['source', 'destination'],

+ 5 - 1
src/stores/ProviderStore.js

@@ -48,12 +48,16 @@ export const getFieldChangeOptions = (config: {
   let validFields = requiredFields.filter(fn => {
     let schemaField = findFieldInSchema(fn)
     if (data) {
+      // This is for 'list_all_networks' field, which requires options calls after each value change
+      if (schemaField && schemaField.type === 'boolean') {
+        return true
+      }
       if (data[fn] === null) {
         return false
       }
       let defaultValue = data[fn] === undefined && schemaField && schemaField.default
       let requiredValue = requiredValues && requiredValues.find(f => f.field === fn)
-      if (defaultValue) {
+      if (defaultValue != null) {
         if (requiredValue) {
           return Boolean(requiredValue.values.find(v => v === defaultValue))
         }