sunguroku 5 лет назад
Родитель
Сommit
4138337bab

+ 4 - 4
dashboard/src/main/home/templates/expanded-template/LaunchTemplate.tsx

@@ -52,7 +52,7 @@ export default class LaunchTemplate extends Component<PropsType, StateType> {
 
     api.deployTemplate('<token>', {
       templateName: this.props.currentTemplate.name,
-      imageURL: "",
+      imageURL: this.state.selectedImageUrl,
       storage: StorageType.Secret,
       formValues,
       namespace: this.state.selectedNamespace,
@@ -80,8 +80,8 @@ export default class LaunchTemplate extends Component<PropsType, StateType> {
               key={tab.name}
               sections={tab.sections} 
               onSubmit={this.onSubmit}
-              // disabled={!this.state.selectedImageUrl || this.state.selectedImageUrl === ''}
               disabled={false}
+              // disabled={!this.state.selectedImageUrl || this.state.selectedImageUrl === ''}
               saveValuesStatus={this.state.saveValuesStatus}
             />
           </ValuesFormWrapper>
@@ -185,7 +185,7 @@ export default class LaunchTemplate extends Component<PropsType, StateType> {
           />
         </ClusterSection>
 
-        {/* <Subtitle>Select the container image you would like to connect to this template (optional).</Subtitle>
+        <Subtitle>Select the container image you would like to connect to this template (optional).</Subtitle>
         <Br />
         <ImageSelector
           selectedTag={this.state.selectedTag}
@@ -196,7 +196,7 @@ export default class LaunchTemplate extends Component<PropsType, StateType> {
           setCurrentView={this.props.setCurrentView}
         />
 
-        <br /> */}
+        <br />
         <Subtitle>Configure additional settings for this template (optional).</Subtitle>
         <TabRegion
           options={this.state.tabOptions}

+ 3 - 38
server/api/deploy_handler.go

@@ -57,46 +57,9 @@ func (app *App) HandleDeployTemplate(w http.ResponseWriter, r *http.Request) {
 		return
 	}
 
-	baseURL := "https://porter-dev.github.io/chart-repo/"
-	values, err := getDefaultValues(form.ChartTemplateForm.TemplateName, baseURL)
-	if err != nil {
-		return
-	}
-
-	// Set image URL
-	if form.ChartTemplateForm.ImageURL != "" {
-		(*values)["image"].(map[interface{}]interface{})["repository"] = form.ChartTemplateForm.ImageURL
-	}
-
-	// Loop through form params to override
-	for k := range form.ChartTemplateForm.FormValues {
-		switch v := interface{}(k).(type) {
-		case string:
-			splits := strings.Split(v, ".")
-
-			// Validate that the field to override exists
-			currentLoc := *values
-			for s := range splits {
-				key := splits[s]
-				val := currentLoc[key]
-				if val == nil {
-					fmt.Printf("No such field: %v\n", key)
-				} else if s == len(splits)-1 {
-					newValue := form.ChartTemplateForm.FormValues[v]
-					fmt.Printf("Overriding default %v with %v\n", val, newValue)
-					currentLoc[key] = newValue
-				} else {
-					fmt.Println("Traversing...")
-					currentLoc = val.(map[interface{}]interface{})
-				}
-			}
-		default:
-			fmt.Println("Non-string type")
-		}
-	}
+	values := form.ChartTemplateForm.FormValues
 
 	v, err := yaml.Marshal(values)
-
 	if err != nil {
 		return
 	}
@@ -105,6 +68,8 @@ func (app *App) HandleDeployTemplate(w http.ResponseWriter, r *http.Request) {
 	switch form.ChartTemplateForm.TemplateName {
 	case "redis":
 		tgz = "redis-0.0.1.tgz"
+	case "Docker":
+		tgz = "docker-0.0.1.tgz"
 	}
 
 	// Output values.yaml string