[add] widgets config
This commit is contained in:
parent
7c0070ad3b
commit
f5fbef9e39
9 changed files with 35 additions and 28 deletions
|
|
@ -80,8 +80,8 @@ func adminRoot() (string, int) {
|
|||
}
|
||||
|
||||
adminRoot := "/yao/"
|
||||
if root, ok := share.App.Optional["adminRoot"].(string); ok && root != "" {
|
||||
root = strings.TrimPrefix(root, "/")
|
||||
if share.App.AdminRoot != "" {
|
||||
root := strings.TrimPrefix(share.App.AdminRoot, "/")
|
||||
root = strings.TrimSuffix(root, "/")
|
||||
adminRoot = fmt.Sprintf("/%s/", root)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,6 +80,7 @@ type AppInfo struct {
|
|||
Storage AppStorage `json:"storage,omitempty"`
|
||||
Option map[string]interface{} `json:"option,omitempty"`
|
||||
XGen string `json:"xgen,omitempty"`
|
||||
AdminRoot string `json:"adminRoot,omitempty"`
|
||||
Optional map[string]interface{} `json:"optional,omitempty"`
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -174,6 +174,7 @@ func (dsl *DSL) Xgen() (map[string]interface{}, error) {
|
|||
}
|
||||
|
||||
setting["fields"] = fields
|
||||
setting["config"] = dsl.Config
|
||||
for _, cProp := range dsl.CProps {
|
||||
err := cProp.Replace(setting, func(cProp component.CloudPropsDSL) interface{} {
|
||||
return map[string]interface{}{
|
||||
|
|
|
|||
|
|
@ -9,14 +9,15 @@ import (
|
|||
|
||||
// DSL the chart DSL
|
||||
type DSL struct {
|
||||
ID string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Action *ActionDSL `json:"action"`
|
||||
Layout *LayoutDSL `json:"layout"`
|
||||
Fields *FieldsDSL `json:"fields"`
|
||||
ComputesIn field.ComputeFields `json:"-"`
|
||||
ComputesOut field.ComputeFields `json:"-"`
|
||||
CProps field.CloudProps `json:"-"`
|
||||
ID string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Action *ActionDSL `json:"action"`
|
||||
Layout *LayoutDSL `json:"layout"`
|
||||
Fields *FieldsDSL `json:"fields"`
|
||||
Config map[string]interface{} `json:"config,omitempty"`
|
||||
ComputesIn field.ComputeFields `json:"-"`
|
||||
ComputesOut field.ComputeFields `json:"-"`
|
||||
CProps field.CloudProps `json:"-"`
|
||||
}
|
||||
|
||||
// ActionDSL the chart action DSL
|
||||
|
|
|
|||
|
|
@ -192,6 +192,7 @@ func (dsl *DSL) Xgen() (map[string]interface{}, error) {
|
|||
}
|
||||
|
||||
setting["fields"] = fields
|
||||
setting["config"] = dsl.Config
|
||||
for _, cProp := range dsl.CProps {
|
||||
err := cProp.Replace(setting, func(cProp component.CloudPropsDSL) interface{} {
|
||||
return map[string]interface{}{
|
||||
|
|
|
|||
|
|
@ -9,14 +9,15 @@ import (
|
|||
|
||||
// DSL the form DSL
|
||||
type DSL struct {
|
||||
ID string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Action *ActionDSL `json:"action"`
|
||||
Layout *LayoutDSL `json:"layout"`
|
||||
Fields *FieldsDSL `json:"fields"`
|
||||
ComputesIn field.ComputeFields `json:"-"`
|
||||
ComputesOut field.ComputeFields `json:"-"`
|
||||
CProps field.CloudProps `json:"-"`
|
||||
ID string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Action *ActionDSL `json:"action"`
|
||||
Layout *LayoutDSL `json:"layout"`
|
||||
Fields *FieldsDSL `json:"fields"`
|
||||
Config map[string]interface{} `json:"config,omitempty"`
|
||||
ComputesIn field.ComputeFields `json:"-"`
|
||||
ComputesOut field.ComputeFields `json:"-"`
|
||||
CProps field.CloudProps `json:"-"`
|
||||
}
|
||||
|
||||
// ActionDSL the form action DSL
|
||||
|
|
|
|||
|
|
@ -261,6 +261,7 @@ func (dsl *DSL) Xgen() (map[string]interface{}, error) {
|
|||
}
|
||||
|
||||
setting["fields"] = fields
|
||||
setting["config"] = dsl.Config
|
||||
for _, cProp := range dsl.CProps {
|
||||
err := cProp.Replace(setting, func(cProp component.CloudPropsDSL) interface{} {
|
||||
return map[string]interface{}{
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ func TestLoad(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
assert.Equal(t, 6, len(Tables))
|
||||
assert.Equal(t, 9, len(Tables))
|
||||
}
|
||||
|
||||
func TestLoadID(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -9,15 +9,16 @@ import (
|
|||
|
||||
// DSL the table DSL
|
||||
type DSL struct {
|
||||
Root string `json:"-"`
|
||||
ID string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Action *ActionDSL `json:"action"`
|
||||
Layout *LayoutDSL `json:"layout"`
|
||||
Fields *FieldsDSL `json:"fields"`
|
||||
ComputesIn field.ComputeFields `json:"-"`
|
||||
ComputesOut field.ComputeFields `json:"-"`
|
||||
CProps field.CloudProps `json:"-"`
|
||||
Root string `json:"-"`
|
||||
ID string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Action *ActionDSL `json:"action"`
|
||||
Layout *LayoutDSL `json:"layout"`
|
||||
Fields *FieldsDSL `json:"fields"`
|
||||
Config map[string]interface{} `json:"config,omitempty"`
|
||||
ComputesIn field.ComputeFields `json:"-"`
|
||||
ComputesOut field.ComputeFields `json:"-"`
|
||||
CProps field.CloudProps `json:"-"`
|
||||
}
|
||||
|
||||
// ActionDSL the table action DSL
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue