feature: css classes on displays (#363)
This commit is contained in:
parent
a54ea505c9
commit
69d1cc75a7
|
|
@ -55,6 +55,7 @@ message DashboardComponent {
|
||||||
string type = 2;
|
string type = 2;
|
||||||
repeated DashboardComponent contents = 3;
|
repeated DashboardComponent contents = 3;
|
||||||
string icon = 4;
|
string icon = 4;
|
||||||
|
string css_class = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
message StartActionRequest {
|
message StartActionRequest {
|
||||||
|
|
|
||||||
|
|
@ -149,6 +149,7 @@ type DashboardComponent struct {
|
||||||
Type string
|
Type string
|
||||||
Entity string
|
Entity string
|
||||||
Icon string
|
Icon string
|
||||||
|
CssClass string
|
||||||
Contents []DashboardComponent
|
Contents []DashboardComponent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ func getDashboardComponentContents(dashboard *config.DashboardComponent, cfg *co
|
||||||
Type: getDashboardComponentType(&subitem),
|
Type: getDashboardComponentType(&subitem),
|
||||||
Contents: getDashboardComponentContents(&subitem, cfg),
|
Contents: getDashboardComponentContents(&subitem, cfg),
|
||||||
Icon: getDashboardComponentIcon(&subitem, cfg),
|
Icon: getDashboardComponentIcon(&subitem, cfg),
|
||||||
|
CssClass: subitem.CssClass,
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = append(ret, newitem)
|
ret = append(ret, newitem)
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ func buildEntityFieldset(tpl *config.DashboardComponent, entityTitle string, ent
|
||||||
Title: sv.ReplaceEntityVars(prefix, tpl.Title),
|
Title: sv.ReplaceEntityVars(prefix, tpl.Title),
|
||||||
Type: "fieldset",
|
Type: "fieldset",
|
||||||
Contents: buildEntityFieldsetContents(tpl.Contents, prefix),
|
Contents: buildEntityFieldsetContents(tpl.Contents, prefix),
|
||||||
|
CssClass: sv.ReplaceEntityVars(prefix, tpl.CssClass),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -33,6 +34,7 @@ func buildEntityFieldsetContents(contents []config.DashboardComponent, prefix st
|
||||||
|
|
||||||
for _, subitem := range contents {
|
for _, subitem := range contents {
|
||||||
clone := &pb.DashboardComponent{}
|
clone := &pb.DashboardComponent{}
|
||||||
|
clone.CssClass = sv.ReplaceEntityVars(prefix, subitem.CssClass)
|
||||||
|
|
||||||
if subitem.Type == "" || subitem.Type == "link" {
|
if subitem.Type == "" || subitem.Type == "link" {
|
||||||
clone.Type = "link"
|
clone.Type = "link"
|
||||||
|
|
|
||||||
|
|
@ -462,6 +462,10 @@ function marshalDisplay (item, fieldset) {
|
||||||
display.innerHTML = item.title
|
display.innerHTML = item.title
|
||||||
display.classList.add('display')
|
display.classList.add('display')
|
||||||
|
|
||||||
|
if (item.cssClass !== '') {
|
||||||
|
display.classList.add(item.cssClass)
|
||||||
|
}
|
||||||
|
|
||||||
fieldset.appendChild(display)
|
fieldset.appendChild(display)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue