Skip to content

Commit

Permalink
Fix veneers configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
K-Phoen committed Oct 9, 2023
1 parent 4da6cab commit 41619de
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions internal/veneers/veneers.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,52 +53,55 @@ func Common() *Rewriter {

// Let's make the dashboard constructor more friendly
option.PromoteToConstructor(
option.ByName("Dashboard", "title"),
option.ByName("dashboard", "title"),
),

// `Tooltip` looks better than `GraphTooltip`
option.Rename(
option.ByName("Dashboard", "graphTooltip"),
option.ByName("dashboard", "graphTooltip"),
"tooltip",
),

// `panels` refers to RowPanel only for now
option.Rename(
option.ByName("Dashboard", "panels"),
option.ByName("dashboard", "panels"),
"rows",
),
/*
// TODO: finish implementing this rule
option.ArrayToAppend(
option.ByName("Dashboard", "rows"),
option.ByName("dashboard", "rows"),
),
*/

// Editable() + Readonly() instead of Editable(val bool)
option.UnfoldBoolean(
option.ByName("Dashboard", "editable"),
option.ByName("dashboard", "editable"),
option.BooleanUnfold{OptionTrue: "editable", OptionFalse: "readonly"},
),

// Refresh(string) instead of Refresh(struct StringOrBool)
option.StructFieldsAsArguments(
option.ByName("Dashboard", "refresh"),
option.ByName("dashboard", "refresh"),
"ValString",
),

// Time(from, to) instead of Time({from: 'now-6h', to: 'now'})
option.StructFieldsAsArguments(option.ByName("dashboard", "time")),

// We don't want these options at all
option.Omit(option.ByName("Dashboard", "schemaVersion")),
option.Omit(option.ByName("dashboard", "schemaVersion")),

/********************************************
* Panels
********************************************/

option.Omit(option.ByName("Panel", "id")), // generated by the backend
option.Omit(option.ByName("Panel", "fieldConfig")), // merged with another builder
option.Omit(option.ByName("Panel", "options")), // comes from a panel plugin
option.Omit(option.ByName("Panel", "custom")), // comes from a panel plugin
option.Omit(option.ByName("Panel", "pluginVersion")), // TODO: check if it's relevant or not
option.Omit(option.ByName("Panel", "repeatPanelId")), // TODO: check if it's relevant or not
option.Omit(option.ByName("panel", "id")), // generated by the backend
option.Omit(option.ByName("panel", "fieldConfig")), // merged with another builder
option.Omit(option.ByName("panel", "options")), // comes from a panel plugin
option.Omit(option.ByName("panel", "custom")), // comes from a panel plugin
option.Omit(option.ByName("panel", "pluginVersion")), // TODO: check if it's relevant or not
option.Omit(option.ByName("panel", "repeatPanelId")), // TODO: check if it's relevant or not

/********************************************
* Rows
Expand Down

0 comments on commit 41619de

Please sign in to comment.