From ff44b8c4cc32737cf795d3b0789cb8d24388ddcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Gomez?= Date: Fri, 6 Oct 2023 16:16:09 +0200 Subject: [PATCH] Fix veneers configuration --- internal/veneers/veneers.go | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/internal/veneers/veneers.go b/internal/veneers/veneers.go index a804a0092..259be6b60 100644 --- a/internal/veneers/veneers.go +++ b/internal/veneers/veneers.go @@ -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