[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/"
|
adminRoot := "/yao/"
|
||||||
if root, ok := share.App.Optional["adminRoot"].(string); ok && root != "" {
|
if share.App.AdminRoot != "" {
|
||||||
root = strings.TrimPrefix(root, "/")
|
root := strings.TrimPrefix(share.App.AdminRoot, "/")
|
||||||
root = strings.TrimSuffix(root, "/")
|
root = strings.TrimSuffix(root, "/")
|
||||||
adminRoot = fmt.Sprintf("/%s/", root)
|
adminRoot = fmt.Sprintf("/%s/", root)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,7 @@ type AppInfo struct {
|
||||||
Storage AppStorage `json:"storage,omitempty"`
|
Storage AppStorage `json:"storage,omitempty"`
|
||||||
Option map[string]interface{} `json:"option,omitempty"`
|
Option map[string]interface{} `json:"option,omitempty"`
|
||||||
XGen string `json:"xgen,omitempty"`
|
XGen string `json:"xgen,omitempty"`
|
||||||
|
AdminRoot string `json:"adminRoot,omitempty"`
|
||||||
Optional map[string]interface{} `json:"optional,omitempty"`
|
Optional map[string]interface{} `json:"optional,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -174,6 +174,7 @@ func (dsl *DSL) Xgen() (map[string]interface{}, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
setting["fields"] = fields
|
setting["fields"] = fields
|
||||||
|
setting["config"] = dsl.Config
|
||||||
for _, cProp := range dsl.CProps {
|
for _, cProp := range dsl.CProps {
|
||||||
err := cProp.Replace(setting, func(cProp component.CloudPropsDSL) interface{} {
|
err := cProp.Replace(setting, func(cProp component.CloudPropsDSL) interface{} {
|
||||||
return map[string]interface{}{
|
return map[string]interface{}{
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ type DSL struct {
|
||||||
Action *ActionDSL `json:"action"`
|
Action *ActionDSL `json:"action"`
|
||||||
Layout *LayoutDSL `json:"layout"`
|
Layout *LayoutDSL `json:"layout"`
|
||||||
Fields *FieldsDSL `json:"fields"`
|
Fields *FieldsDSL `json:"fields"`
|
||||||
|
Config map[string]interface{} `json:"config,omitempty"`
|
||||||
ComputesIn field.ComputeFields `json:"-"`
|
ComputesIn field.ComputeFields `json:"-"`
|
||||||
ComputesOut field.ComputeFields `json:"-"`
|
ComputesOut field.ComputeFields `json:"-"`
|
||||||
CProps field.CloudProps `json:"-"`
|
CProps field.CloudProps `json:"-"`
|
||||||
|
|
|
||||||
|
|
@ -192,6 +192,7 @@ func (dsl *DSL) Xgen() (map[string]interface{}, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
setting["fields"] = fields
|
setting["fields"] = fields
|
||||||
|
setting["config"] = dsl.Config
|
||||||
for _, cProp := range dsl.CProps {
|
for _, cProp := range dsl.CProps {
|
||||||
err := cProp.Replace(setting, func(cProp component.CloudPropsDSL) interface{} {
|
err := cProp.Replace(setting, func(cProp component.CloudPropsDSL) interface{} {
|
||||||
return map[string]interface{}{
|
return map[string]interface{}{
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ type DSL struct {
|
||||||
Action *ActionDSL `json:"action"`
|
Action *ActionDSL `json:"action"`
|
||||||
Layout *LayoutDSL `json:"layout"`
|
Layout *LayoutDSL `json:"layout"`
|
||||||
Fields *FieldsDSL `json:"fields"`
|
Fields *FieldsDSL `json:"fields"`
|
||||||
|
Config map[string]interface{} `json:"config,omitempty"`
|
||||||
ComputesIn field.ComputeFields `json:"-"`
|
ComputesIn field.ComputeFields `json:"-"`
|
||||||
ComputesOut field.ComputeFields `json:"-"`
|
ComputesOut field.ComputeFields `json:"-"`
|
||||||
CProps field.CloudProps `json:"-"`
|
CProps field.CloudProps `json:"-"`
|
||||||
|
|
|
||||||
|
|
@ -261,6 +261,7 @@ func (dsl *DSL) Xgen() (map[string]interface{}, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
setting["fields"] = fields
|
setting["fields"] = fields
|
||||||
|
setting["config"] = dsl.Config
|
||||||
for _, cProp := range dsl.CProps {
|
for _, cProp := range dsl.CProps {
|
||||||
err := cProp.Replace(setting, func(cProp component.CloudPropsDSL) interface{} {
|
err := cProp.Replace(setting, func(cProp component.CloudPropsDSL) interface{} {
|
||||||
return map[string]interface{}{
|
return map[string]interface{}{
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ func TestLoad(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
assert.Equal(t, 6, len(Tables))
|
assert.Equal(t, 9, len(Tables))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestLoadID(t *testing.T) {
|
func TestLoadID(t *testing.T) {
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ type DSL struct {
|
||||||
Action *ActionDSL `json:"action"`
|
Action *ActionDSL `json:"action"`
|
||||||
Layout *LayoutDSL `json:"layout"`
|
Layout *LayoutDSL `json:"layout"`
|
||||||
Fields *FieldsDSL `json:"fields"`
|
Fields *FieldsDSL `json:"fields"`
|
||||||
|
Config map[string]interface{} `json:"config,omitempty"`
|
||||||
ComputesIn field.ComputeFields `json:"-"`
|
ComputesIn field.ComputeFields `json:"-"`
|
||||||
ComputesOut field.ComputeFields `json:"-"`
|
ComputesOut field.ComputeFields `json:"-"`
|
||||||
CProps field.CloudProps `json:"-"`
|
CProps field.CloudProps `json:"-"`
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue