sunguroku 5 лет назад
Родитель
Сommit
6818e0a8f3

+ 18 - 0
dashboard/src/components/values-form/ValuesForm.tsx

@@ -98,6 +98,24 @@ export default class ValuesForm extends Component<PropsType, StateType> {
               unit={item.settings ? item.settings.unit : null}
             />
           );
+        case "string-input-password":
+          return (
+            <InputRow
+              key={i}
+              isRequired={item.required}
+              type="password"
+              value={this.getInputValue(item)}
+              setValue={(x: string) => {
+                console.log("string input", x)
+                if (item.settings && item.settings.unit && x !== "") {
+                  x = x + item.settings.unit;
+                }
+                this.props.setMetaState({ [key]: x });
+              }}
+              label={item.label}
+              unit={item.settings ? item.settings.unit : null}
+            />
+          );
         case "number-input":
           return (
             <InputRow

+ 2 - 0
dashboard/src/components/values-form/ValuesWrapper.tsx

@@ -55,6 +55,8 @@ export default class ValuesWrapper extends Component<PropsType, StateType> {
               case "string-input":
                 metaState[key] = def ? def : "";
                 break;
+              case "string-input-password":
+                metaState[key] = def ? def : item.settings.default;
               case "array-input":
                 metaState[key] = def ? def : [];
                 break;

+ 21 - 20
dashboard/src/main/home/launch/expanded-template/LaunchTemplate.tsx

@@ -321,7 +321,6 @@ export default class LaunchTemplate extends Component<PropsType, StateType> {
     if (this.props.currentTemplate.name !== "docker") {
       this.setState({ saveValuesStatus: "" });
     }
-
     // Retrieve tab options
     let tabOptions = [] as ChoiceType[];
     this.props.form?.tabs.map((tab: any, i: number) => {
@@ -329,8 +328,8 @@ export default class LaunchTemplate extends Component<PropsType, StateType> {
         tabOptions.push({ value: tab.name, label: tab.label });
       }
     });
-    console.log(tabOptions);
-    this.setState({ tabOptions, currentTab: tabOptions[0]["value"] });
+
+    this.setState({ tabOptions, currentTab: tabOptions[0] && tabOptions[0]["value"] });
 
     // TODO: query with selected filter once implemented
     let { currentProject, currentCluster } = this.context;
@@ -496,24 +495,26 @@ export default class LaunchTemplate extends Component<PropsType, StateType> {
   };
 
   renderSourceSelector = () => {
-    if (this.props.form?.hasSource) {
-      return (
-        <>
-          <TabRegion
-            options={[
-              { label: "Registry", value: "registry" },
-              { label: "Github", value: "repo" },
-            ]}
-            currentTab={this.state.sourceType}
-            setCurrentTab={(x) => this.setState({ sourceType: x })}
-          >
-            <StyledSourceBox>
-              {this.renderSourceSelectorContent()}
-            </StyledSourceBox>
-          </TabRegion>
-        </>
-      );
+    if (!this.props.form?.hasSource) {
+      return;
     }
+
+    return (
+      <>
+        <TabRegion
+          options={[
+            { label: "Registry", value: "registry" },
+            { label: "Github", value: "repo" },
+          ]}
+          currentTab={this.state.sourceType}
+          setCurrentTab={(x) => this.setState({ sourceType: x })}
+        >
+          <StyledSourceBox>
+            {this.renderSourceSelectorContent()}
+          </StyledSourceBox>
+        </TabRegion>
+      </>
+    );
   };
 
   render() {