Skip to content

Commit

Permalink
Set dashboard window title
Browse files Browse the repository at this point in the history
  • Loading branch information
pipe01 committed Jan 18, 2021
1 parent 782d4cc commit 5dac951
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmd/ui/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ type Config struct {
Widgets map[string]*widget.Widget `yaml:"-"`

Dashboard struct {
Columns int `yaml:"columns"`
Columns int `yaml:"columns"`
Title string `yaml:"title"`
} `yaml:"dashboard"`
}

Expand Down
3 changes: 3 additions & 0 deletions cmd/ui/front/src/components/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,14 @@ export default defineComponent({
widgets: Widget[]
columns: number
data: any
title: string
}>("/api/data").then(resp => {
var rows: WidgetRow[] = []
var currentRow: WidgetRow = {}
var i = 0;
document.title = resp.data.title;
for (const widget of resp.data.widgets) {
if (i++ == resp.data.columns) {
rows.push(currentRow);
Expand Down
2 changes: 2 additions & 0 deletions cmd/ui/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,12 @@ func main() {
resp := &struct {
Widgets []*widget.Widget `json:"widgets"`
Columns int `json:"columns"`
Title string `json:"title"`
Data map[string]interface{} `json:"data"`
}{
Widgets: cfg.OrderedWidgets(),
Columns: cfg.Dashboard.Columns,
Title: cfg.Dashboard.Title,
Data: make(map[string]interface{}, len(cfg.Widgets)),
}

Expand Down

0 comments on commit 5dac951

Please sign in to comment.