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