Sfoglia il codice sorgente

Show dropdown in Wizard's options if field type is text and has an 'enum' option

Fix typo in CloudLabes for one of the options in enum
Sergiu Miclea 8 anni fa
parent
commit
a2e37ddfa3

+ 1 - 1
src/constants/CloudLabels.js

@@ -45,7 +45,7 @@ export const defaultLabels = {
   volumes_are_zeroed: "Volumes on destination are created zeroed",
   port_reuse_policy: "Port Reuse Policy",
   keep_mac: "Keep MAC address",
-  reuse_port: "Reuse Existing Ports",
+  reuse_ports: "Reuse Existing Ports",
   replace_mac: "Replace MAC address",
   migr_image_name: "Migration Image Name",
   migr_image_name_map: "Migration Image Name Map",

+ 12 - 1
src/stores/ConnectionsStore/ConnectionsStore.js

@@ -276,7 +276,18 @@ class ConnectionsStore extends Reflux.Store
           break
 
         case "string":
-          field.type = "text"
+          let enums = cloudData.properties[propName].enum
+          if (enums && enums.length) {
+            field.type = "dropdown"
+            field.options = enums.map(option => {
+              return {
+                label: Helper.convertCloudFieldLabel(option),
+                value: option
+              }
+            })
+          } else {
+            field.type = "text"
+          }
           break
 
         case "integer":