appmanager: refactor schema into interface, introduce cuelang
diff --git a/core/installer/welcome/appmanager-tmpl/app.html b/core/installer/welcome/appmanager-tmpl/app.html
index df7501b..8d844a8 100644
--- a/core/installer/welcome/appmanager-tmpl/app.html
+++ b/core/installer/welcome/appmanager-tmpl/app.html
@@ -2,22 +2,20 @@
   {{ $readonly := .ReadOnly }}
   {{ $networks := .AvailableNetworks }}
   {{ $data := .Data }}
-  {{ range $name, $schema := .Schema.properties }}
-    {{ if eq $schema.type "string" }}
+  {{ range $name, $schema := .Schema.Fields }}
+    {{ if or (eq $schema.Kind 0) (eq $schema.Kind 1) }}
       <label for="{{ $name }}">
         <span>{{ $name }}</span>
       </label>
-      {{ if eq (index $schema "role") "network" }}
-        <select oninput="valueChanged({{ $name }}, this.value)" {{ if $readonly }}disabled{{ end }} >
-          {{ if not $readonly }}<option disabled selected value> -- select an option -- </option>{{ end }}
-          {{ range $networks }}
-            <option {{if eq .Name (index $data $name) }}selected{{ end }}>{{ .Name }}</option>
-          {{ end }}
-        </select>
-      {{ else }}
-        <input type="text" name="{{ $name }}" oninput="valueChanged({{ $name }}, this.value)" {{ if $readonly }}disabled{{ end }} value="{{ index $data $name }}"/>
-      {{ end }}
-    {{ end }}
+	  <input type="text" name="{{ $name }}" oninput="valueChanged({{ $name }}, this.value)" {{ if $readonly }}disabled{{ end }} value="{{ index $data $name }}"/>
+	{{ else if eq $schema.Kind 3 }}
+	  <select oninput="valueChanged({{ $name }}, this.value)" {{ if $readonly }}disabled{{ end }} >
+		{{ if not $readonly }}<option disabled selected value> -- select an option -- </option>{{ end }}
+		{{ range $networks }}
+		  <option {{if eq .Name (index $data $name) }}selected{{ end }}>{{ .Name }}</option>
+		{{ end }}
+	  </select>
+	{{ end }}
   {{ end }}
 {{ end }}
 
@@ -26,7 +24,7 @@
 <h1>{{ .App.Icon }}{{ .App.Name }}</h1>
 <pre id="readme"></pre>
 
-{{ $schema := .App.ConfigSchema }}
+{{ $schema := .App.Schema }}
 {{ $networks := .AvailableNetworks }}
 
 <form id="config-form">
diff --git a/core/installer/welcome/appmanager.go b/core/installer/welcome/appmanager.go
index be077e0..5d7e537 100644
--- a/core/installer/welcome/appmanager.go
+++ b/core/installer/welcome/appmanager.go
@@ -71,7 +71,6 @@
 	Icon             template.HTML         `json:"icon"`
 	ShortDescription string                `json:"shortDescription"`
 	Slug             string                `json:"slug"`
-	Schema           string                `json:"schema"`
 	Instances        []installer.AppConfig `json:"instances,omitempty"`
 }
 
@@ -82,7 +81,7 @@
 	}
 	resp := make([]app, len(all))
 	for i, a := range all {
-		resp[i] = app{a.Name, a.Icon, a.ShortDescription, a.Name, a.Schema, nil}
+		resp[i] = app{a.Name, a.Icon, a.ShortDescription, a.Name, nil}
 	}
 	return c.JSON(http.StatusOK, resp)
 }
@@ -116,7 +115,7 @@
 			}
 		}
 	}
-	return c.JSON(http.StatusOK, app{a.Name, a.Icon, a.ShortDescription, a.Name, a.Schema, instances})
+	return c.JSON(http.StatusOK, app{a.Name, a.Icon, a.ShortDescription, a.Name, instances})
 }
 
 func (s *AppManagerServer) handleInstance(c echo.Context) error {
@@ -146,7 +145,7 @@
 	if err != nil {
 		return err
 	}
-	return c.JSON(http.StatusOK, app{a.Name, a.Icon, a.ShortDescription, a.Name, a.Schema, []installer.AppConfig{instance}})
+	return c.JSON(http.StatusOK, app{a.Name, a.Icon, a.ShortDescription, a.Name, []installer.AppConfig{instance}})
 }
 
 type file struct {
@@ -293,7 +292,7 @@
 	}
 	resp := make([]app, len(all))
 	for i, a := range all {
-		resp[i] = app{a.Name, a.Icon, a.ShortDescription, a.Name, a.Schema, nil}
+		resp[i] = app{a.Name, a.Icon, a.ShortDescription, a.Name, nil}
 	}
 	return tmpl.Execute(c.Response(), resp)
 }