@intentius/chant-lexicon-grafana 0.100.0 → 0.102.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/actions/grafana.d.ts.map +1 -1
- package/dist/alerting-build.d.ts.map +1 -1
- package/dist/alerting.d.ts +22 -9
- package/dist/alerting.d.ts.map +1 -1
- package/dist/api/apply.d.ts.map +1 -1
- package/dist/api/bind.d.ts.map +1 -1
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/library-panels.d.ts +1 -1
- package/dist/api/library-panels.d.ts.map +1 -1
- package/dist/build.d.ts +29 -5
- package/dist/build.d.ts.map +1 -1
- package/dist/catalog.d.ts +1 -1
- package/dist/catalog.d.ts.map +1 -1
- package/dist/codegen/docs.d.ts.map +1 -1
- package/dist/composites/agent-dashboard.d.ts +81 -7
- package/dist/composites/agent-dashboard.d.ts.map +1 -1
- package/dist/composites/catalog.d.ts.map +1 -1
- package/dist/composites/index.d.ts +1 -1
- package/dist/composites/index.d.ts.map +1 -1
- package/dist/composites/red-dashboard.d.ts +1 -1
- package/dist/composites/red-dashboard.d.ts.map +1 -1
- package/dist/composites/shared.d.ts +4 -4
- package/dist/composites/shared.d.ts.map +1 -1
- package/dist/composites/slo-alert-rules.d.ts +6 -6
- package/dist/composites/slo-alert-rules.d.ts.map +1 -1
- package/dist/composites/slo-dashboard.d.ts +4 -4
- package/dist/composites/slo-dashboard.d.ts.map +1 -1
- package/dist/contact-point-check.d.ts +8 -0
- package/dist/contact-point-check.d.ts.map +1 -0
- package/dist/contact-point-secrets.d.ts +3 -2
- package/dist/contact-point-secrets.d.ts.map +1 -1
- package/dist/contact-point-settings.gen.d.ts +632 -0
- package/dist/contact-point-settings.gen.d.ts.map +1 -0
- package/dist/dashboard.d.ts +7 -3
- package/dist/dashboard.d.ts.map +1 -1
- package/dist/datasource-refs.d.ts +11 -0
- package/dist/datasource-refs.d.ts.map +1 -1
- package/dist/datasource-settings.d.ts +44 -0
- package/dist/datasource-settings.d.ts.map +1 -1
- package/dist/deep-observe.d.ts +3 -2
- package/dist/deep-observe.d.ts.map +1 -1
- package/dist/describe-resources.d.ts +2 -4
- package/dist/describe-resources.d.ts.map +1 -1
- package/dist/import/embedded.d.ts +5 -0
- package/dist/import/embedded.d.ts.map +1 -1
- package/dist/import/generator.d.ts +41 -13
- package/dist/import/generator.d.ts.map +1 -1
- package/dist/import/mappings.d.ts.map +1 -1
- package/dist/import/model.d.ts +22 -0
- package/dist/import/model.d.ts.map +1 -1
- package/dist/import/normalize.d.ts +1 -1
- package/dist/import/normalize.d.ts.map +1 -1
- package/dist/import/parser.d.ts +8 -0
- package/dist/import/parser.d.ts.map +1 -1
- package/dist/import/report.d.ts.map +1 -1
- package/dist/import/testdata/fixtures.d.ts.map +1 -1
- package/dist/import/v2.d.ts +4 -3
- package/dist/import/v2.d.ts.map +1 -1
- package/dist/index.d.ts +8 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/init-templates.d.ts.map +1 -1
- package/dist/integrity.json +10 -8
- package/dist/k8s.d.ts +83 -2
- package/dist/k8s.d.ts.map +1 -1
- package/dist/library-panel.d.ts +95 -0
- package/dist/library-panel.d.ts.map +1 -0
- package/dist/lint/audit-catalog.d.ts +1 -1
- package/dist/lint/audit-catalog.d.ts.map +1 -1
- package/dist/lint/audit-lineage.d.ts +37 -0
- package/dist/lint/audit-lineage.d.ts.map +1 -0
- package/dist/lint/post-synth/graf114.d.ts +1 -1
- package/dist/lint/post-synth/graf116.d.ts +8 -0
- package/dist/lint/post-synth/graf116.d.ts.map +1 -0
- package/dist/lint/post-synth/graf117.d.ts +8 -0
- package/dist/lint/post-synth/graf117.d.ts.map +1 -0
- package/dist/lint/post-synth/index.d.ts.map +1 -1
- package/dist/lint/rules/uid-syntax.d.ts +1 -1
- package/dist/manifest.json +1 -1
- package/dist/meta.json +40 -0
- package/dist/okf/index.md +10 -0
- package/dist/okf/rules/GRAF001.md +1 -0
- package/dist/okf/rules/GRAF116.md +11 -0
- package/dist/okf/rules/GRAF117.md +11 -0
- package/dist/okf/types/AnnotationsListPanel.md +9 -0
- package/dist/okf/types/CandlestickPanel.md +9 -0
- package/dist/okf/types/DashboardListPanel.md +9 -0
- package/dist/okf/types/DataGridPanel.md +9 -0
- package/dist/okf/types/LibraryPanel.md +13 -0
- package/dist/okf/types/LibraryPanelRef.md +9 -0
- package/dist/okf/types/NewsPanel.md +9 -0
- package/dist/okf/types/OpenSearchQuery.md +9 -0
- package/dist/op/builders.d.ts.map +1 -1
- package/dist/panels.d.ts +23 -1
- package/dist/panels.d.ts.map +1 -1
- package/dist/pin.d.ts +1 -1
- package/dist/pin.d.ts.map +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/promql-check.d.ts +2 -0
- package/dist/promql-check.d.ts.map +1 -1
- package/dist/query-models.d.ts +78 -0
- package/dist/query-models.d.ts.map +1 -1
- package/dist/query-syntax.d.ts +55 -0
- package/dist/query-syntax.d.ts.map +1 -0
- package/dist/query.d.ts +16 -8
- package/dist/query.d.ts.map +1 -1
- package/dist/rules/graf114.ts +1 -1
- package/dist/rules/graf116.ts +17 -0
- package/dist/rules/graf117.ts +17 -0
- package/dist/rules/uid-syntax.ts +2 -2
- package/dist/schema/annotationslist.gen.d.ts +13 -0
- package/dist/schema/annotationslist.gen.d.ts.map +1 -0
- package/dist/schema/candlestick.gen.d.ts +244 -0
- package/dist/schema/candlestick.gen.d.ts.map +1 -0
- package/dist/schema/dashboardlist.gen.d.ts +18 -0
- package/dist/schema/dashboardlist.gen.d.ts.map +1 -0
- package/dist/schema/datagrid.gen.d.ts +4 -0
- package/dist/schema/datagrid.gen.d.ts.map +1 -0
- package/dist/schema/index.d.ts +5 -0
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/news.gen.d.ts +8 -0
- package/dist/schema/news.gen.d.ts.map +1 -0
- package/dist/schema/table.gen.d.ts +37 -0
- package/dist/schema/table.gen.d.ts.map +1 -1
- package/dist/skill-defs.d.ts +1 -1
- package/dist/skill-defs.d.ts.map +1 -1
- package/dist/skills/chant-grafana-operations.md +3 -3
- package/dist/skills/chant-grafana-provisioning.md +1 -1
- package/dist/skills/chant-grafana.md +6 -3
- package/dist/spec/fetch-notifiers-cli.d.ts +3 -0
- package/dist/spec/fetch-notifiers-cli.d.ts.map +1 -0
- package/dist/spec/notifiers.d.ts +48 -0
- package/dist/spec/notifiers.d.ts.map +1 -0
- package/dist/spec/schemas.gen.d.ts.map +1 -1
- package/dist/validate-alerting.d.ts +12 -3
- package/dist/validate-alerting.d.ts.map +1 -1
- package/dist/validate-output.d.ts +11 -2
- package/dist/validate-output.d.ts.map +1 -1
- package/dist/validate.d.ts.map +1 -1
- package/dist/validation.d.ts +1 -1
- package/dist/variables.d.ts +4 -2
- package/dist/variables.d.ts.map +1 -1
- package/package.json +6 -3
- package/src/alerting-build.ts +1 -1
- package/src/alerting.ts +22 -33
- package/src/api/library-panels.ts +4 -2
- package/src/build.test.ts +95 -7
- package/src/build.ts +138 -25
- package/src/catalog.ts +16 -1
- package/src/codegen/docs.ts +3 -2
- package/src/composites/__snapshots__/agent-dashboard.snapshot.test.ts.snap +1581 -0
- package/src/composites/agent-dashboard.snapshot.test.ts +47 -0
- package/src/composites/agent-dashboard.ts +316 -8
- package/src/composites/catalog.ts +13 -7
- package/src/composites/composites.test.ts +160 -2
- package/src/composites/index.ts +1 -1
- package/src/composites/queries.e2e.test.ts +128 -2
- package/src/contact-point-check.test.ts +65 -0
- package/src/contact-point-check.ts +69 -0
- package/src/contact-point-secrets.ts +13 -39
- package/src/contact-point-settings.gen.ts +1096 -0
- package/src/dashboard.ts +7 -4
- package/src/datasource-refs.ts +24 -0
- package/src/datasource-settings.test.ts +1 -0
- package/src/datasource-settings.ts +49 -0
- package/src/deep-observe.test.ts +2 -2
- package/src/deep-observe.ts +4 -13
- package/src/describe-resources.test.ts +23 -28
- package/src/describe-resources.ts +39 -22
- package/src/export-resources.test.ts +1 -1
- package/src/generated/lexicon-grafana.json +40 -0
- package/src/import/embedded.test.ts +14 -2
- package/src/import/embedded.ts +22 -3
- package/src/import/generated-types.e2e.test.ts +10 -1
- package/src/import/generator.test.ts +109 -1
- package/src/import/generator.ts +328 -130
- package/src/import/mappings.ts +3 -2
- package/src/import/model.ts +22 -0
- package/src/import/normalize.ts +14 -1
- package/src/import/parser.test.ts +111 -14
- package/src/import/parser.ts +194 -44
- package/src/import/roundtrip.test.ts +54 -26
- package/src/import/v2.test.ts +2 -6
- package/src/import/v2.ts +6 -7
- package/src/index.ts +41 -3
- package/src/k8s.test.ts +77 -2
- package/src/k8s.ts +186 -2
- package/src/library-panel.ts +150 -0
- package/src/lint/audit-catalog.ts +22 -2
- package/src/lint/audit-lineage.test.ts +21 -0
- package/src/lint/audit-lineage.ts +46 -0
- package/src/lint/post-synth/graf114.ts +1 -1
- package/src/lint/post-synth/graf116.ts +17 -0
- package/src/lint/post-synth/graf117.ts +17 -0
- package/src/lint/post-synth/index.ts +4 -0
- package/src/lint/post-synth/post-synth.test.ts +19 -2
- package/src/lint/rules/rules.test.ts +2 -0
- package/src/lint/rules/uid-syntax.ts +2 -2
- package/src/load-cost.test.ts +5 -0
- package/src/op/activities/grafana-apply.e2e.test.ts +25 -21
- package/src/panels.ts +65 -1
- package/src/pin.ts +10 -0
- package/src/plugin.test.ts +14 -1
- package/src/plugin.ts +13 -2
- package/src/promql-check.ts +7 -13
- package/src/query-models.ts +79 -0
- package/src/query-syntax.test.ts +211 -0
- package/src/query-syntax.ts +137 -0
- package/src/query.test.ts +13 -2
- package/src/query.ts +23 -8
- package/src/schema/annotationslist.gen.ts +17 -0
- package/src/schema/candlestick.gen.ts +278 -0
- package/src/schema/dashboardlist.gen.ts +22 -0
- package/src/schema/datagrid.gen.ts +8 -0
- package/src/schema/index.ts +5 -0
- package/src/schema/news.gen.ts +12 -0
- package/src/schema/table.gen.ts +39 -0
- package/src/schema-overlay.test.ts +30 -1
- package/src/skills/chant-grafana-operations.md +3 -3
- package/src/skills/chant-grafana-provisioning.md +1 -1
- package/src/skills/chant-grafana.md +6 -3
- package/src/spec/fetch-notifiers-cli.ts +55 -0
- package/src/spec/notifiers.ts +158 -0
- package/src/spec/overlay/candlestick.overlay.json +44 -0
- package/src/spec/overlay/table.overlay.json +8 -1
- package/src/spec/schemas/annotationslist.jsonschema.json +65 -0
- package/src/spec/schemas/candlestick.jsonschema.json +553 -0
- package/src/spec/schemas/dashboardlist.jsonschema.json +72 -0
- package/src/spec/schemas/datagrid.jsonschema.json +19 -0
- package/src/spec/schemas/news.jsonschema.json +19 -0
- package/src/spec/schemas.gen.ts +6 -1
- package/src/typecheck.test.ts +90 -0
- package/src/validate-alerting.ts +31 -6
- package/src/validate-output.ts +49 -4
- package/src/validate.ts +8 -0
- package/src/validation.ts +1 -1
- package/src/variables.ts +4 -2
- package/dist/members.d.ts +0 -27
- package/dist/members.d.ts.map +0 -1
- package/src/members.ts +0 -68
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-alerting.d.ts","sourceRoot":"","sources":["../src/validate-alerting.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"validate-alerting.d.ts","sourceRoot":"","sources":["../src/validate-alerting.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAKH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAOzD,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEpC,sEAAsE;AACtE,MAAM,WAAW,WAAW;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,IAAI,CAAC;CACZ;AAED,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;AAEtG,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,iBAAiB,CAAC;IACxB,QAAQ,EAAE,OAA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MAAM,CAAA;CAAE,CAAC,CAEjK;AAED,yFAAyF;AACzF,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,WAAW,EAAE,EAAE,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG,aAAa,EAAE,CAO1H;AAED,kFAAkF;AAClF,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,WAAW,EAAE,EAAE,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG,aAAa,EAAE,CAOzH;AAqBD,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,SAAS,WAAW,EAAE,GAAG,aAAa,EAAE,CAiEnF;AAaD,wGAAwG;AACxG,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAIxC,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,SAAS,WAAW,EAAE,GAAG,aAAa,EAAE,CA8EnF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The checks behind GRAF101-GRAF110, GRAF111-GRAF114 and GRAF115, as plain
|
|
2
|
+
* The checks behind GRAF101-GRAF110, GRAF111-GRAF114 and GRAF115-GRAF117, as plain
|
|
3
3
|
* functions over built Grafana output: dashboard JSON documents, provisioned
|
|
4
4
|
* datasources, dashboard providers and alerting provisioning files (the
|
|
5
5
|
* alerting checks are in `validate-alerting.ts`). The
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
import type { ExternalDatasourceRecord, ProvisionedDatasource } from "./build.js";
|
|
17
17
|
import { variableReferences, type KnownDatasource } from "./datasource-refs.js";
|
|
18
18
|
import { type AlertingDoc } from "./validate-alerting.js";
|
|
19
|
-
export type GrafanaIssueCode = "GRAF101" | "GRAF102" | "GRAF103" | "GRAF104" | "GRAF105" | "GRAF106" | "GRAF107" | "GRAF108" | "GRAF109" | "GRAF110" | "GRAF111" | "GRAF112" | "GRAF113" | "GRAF114" | "GRAF115";
|
|
19
|
+
export type GrafanaIssueCode = "GRAF101" | "GRAF102" | "GRAF103" | "GRAF104" | "GRAF105" | "GRAF106" | "GRAF107" | "GRAF108" | "GRAF109" | "GRAF110" | "GRAF111" | "GRAF112" | "GRAF113" | "GRAF114" | "GRAF115" | "GRAF116" | "GRAF117";
|
|
20
20
|
export interface GrafanaIssue {
|
|
21
21
|
code: GrafanaIssueCode;
|
|
22
22
|
severity: "error" | "warning";
|
|
@@ -75,6 +75,15 @@ export declare function checkSchema(a: GrafanaArtifacts): GrafanaIssue[];
|
|
|
75
75
|
* not parsed.
|
|
76
76
|
*/
|
|
77
77
|
export declare function checkPromqlSyntax(a: GrafanaArtifacts): GrafanaIssue[];
|
|
78
|
+
/**
|
|
79
|
+
* Each panel query, annotation query and query variable stream selector
|
|
80
|
+
* that reaches a Loki datasource is parsed as LogQL, and each alert rule
|
|
81
|
+
* query to Loki too (GRAF116, an error). Each panel query that reaches a
|
|
82
|
+
* Tempo datasource is parsed as TraceQL (GRAF117, a warning: Grafana's
|
|
83
|
+
* TraceQL grammar trails Tempo's own parser). See `query-syntax.ts`.
|
|
84
|
+
*/
|
|
85
|
+
export declare function checkLogqlSyntax(a: GrafanaArtifacts): GrafanaIssue[];
|
|
86
|
+
export declare function checkTraceqlSyntax(a: GrafanaArtifacts): GrafanaIssue[];
|
|
78
87
|
export declare function checkRepeats(a: GrafanaArtifacts): GrafanaIssue[];
|
|
79
88
|
/** Every unit a panel sets, with where: field defaults, `unit` overrides, heatmap axes and cells, and a legacy graph panel's y-axes. */
|
|
80
89
|
export declare function panelUnits(panel: Json): Array<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-output.d.ts","sourceRoot":"","sources":["../src/validate-output.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAE/E,OAAO,EAML,kBAAkB,EAGlB,KAAK,eAAe,EACrB,MAAM,mBAAmB,CAAC;
|
|
1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AE,gBAAgB,GAAG,YAAY,EAAE,CAWtE;AAeD,wBAAgB,YAAY,CAAC,CAAC,EAAE,gBAAgB,GAAG,YAAY,EAAE,CAuBhE;AAID,wIAAwI;AACxI,wBAAgB,UAAU,CAAC,KAAK,EAAE,IAAI,GAAG,KAAK,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAmB9E;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,gBAAgB,GAAG,YAAY,EAAE,CA2B9D;AA8CD,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,gBAAgB,GAAG,YAAY,EAAE,CAmErE;AAsBD,kCAAkC;AAClC,wBAAgB,SAAS,CAAC,IAAI,EAAE,gBAAgB,EAAE,CAAC,EAAE,gBAAgB,GAAG,YAAY,EAAE,CAErF;AAED,oDAAoD;AACpD,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,gBAAgB,GAAG,YAAY,EAAE,CAEzE"}
|
package/dist/validate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAiB,cAAc,EAAE,MAAM,mCAAmC,CAAC;AASvF,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAEvF,0DAA0D;AAC1D,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAiB,cAAc,EAAE,MAAM,mCAAmC,CAAC;AASvF,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAEvF,0DAA0D;AAC1D,eAAO,MAAM,cAAc,UA0D1B,CAAC;AAIF,wBAAsB,QAAQ,IAAI,OAAO,CAAC,cAAc,CAAC,CA2DxD"}
|
package/dist/validation.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `@intentius/chant-lexicon-grafana/validation`: the GRAF101-
|
|
2
|
+
* `@intentius/chant-lexicon-grafana/validation`: the GRAF101-GRAF117 checks
|
|
3
3
|
* as plain functions over built Grafana output, and the schema validation
|
|
4
4
|
* behind GRAF107, for code that checks dashboards without a build.
|
|
5
5
|
*
|
package/dist/variables.d.ts
CHANGED
|
@@ -14,8 +14,8 @@ import type { AdHocFilter, VariableOption } from "./schema/dashboard.gen.js";
|
|
|
14
14
|
export type VariableKind = "query" | "custom" | "interval" | "datasource" | "constant" | "textbox" | "adhoc" | "groupby" | "switch";
|
|
15
15
|
/** The kinds Grafana can repeat a panel or row over: the ones that hold a list of values (`MultiValueVariable` in @grafana/scenes). */
|
|
16
16
|
export declare const MULTI_VALUE_KINDS: ReadonlySet<string>;
|
|
17
|
-
/** Where the variable shows: with its label, without it,
|
|
18
|
-
export type VariableHide = "label" | "valueOnly" | "hidden";
|
|
17
|
+
/** Where the variable shows: with its label, without it, not at all, or under the dashboard's controls menu (Grafana 13). */
|
|
18
|
+
export type VariableHide = "label" | "valueOnly" | "hidden" | "controlsMenu";
|
|
19
19
|
interface CommonVariableProps {
|
|
20
20
|
/** The name queries use, `$name`. Letters, digits and `_`. */
|
|
21
21
|
name: string;
|
|
@@ -32,6 +32,8 @@ interface MultiValueProps {
|
|
|
32
32
|
includeAll?: boolean;
|
|
33
33
|
/** What `All` expands to, e.g. `.*` for a regex matcher. */
|
|
34
34
|
allValue?: string;
|
|
35
|
+
/** Whether a value not in the list can be typed in. Grafana's default is true. */
|
|
36
|
+
allowCustomValue?: boolean;
|
|
35
37
|
}
|
|
36
38
|
/** A variable anything can hold before its datasource is known: its own datasource ref or a datasource variable. */
|
|
37
39
|
export type VariableDatasource = DatasourceEntity<any> | ExternalDatasourceEntity<any> | DatasourceRef | DatasourceVariableEntity<any>;
|
package/dist/variables.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variables.d.ts","sourceRoot":"","sources":["../src/variables.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAC9F,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE1E,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,UAAU,GAAG,YAAY,GAAG,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEpI,uIAAuI;AACvI,eAAO,MAAM,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAAyD,CAAC;AAE5G,
|
|
1
|
+
{"version":3,"file":"variables.d.ts","sourceRoot":"","sources":["../src/variables.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAC9F,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE1E,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,UAAU,GAAG,YAAY,GAAG,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEpI,uIAAuI;AACvI,eAAO,MAAM,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAAyD,CAAC;AAE5G,6HAA6H;AAC7H,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,WAAW,GAAG,QAAQ,GAAG,cAAc,CAAC;AAE7E,UAAU,mBAAmB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Aa,EAA6E,KACrG,KAAK,EAAE,kBAAkB,KACtB,cAAc,CAAC,kBAAkB,CAAC,CAAC;AAExC;;;;;GAKG;AACH,eAAO,MAAM,eAAe,EAAmF,KAC7G,KAAK,EAAE,oBAAoB,KACxB,cAAc,CAAC,oBAAoB,CAAC,CAAC;AAE1C,8FAA8F;AAC9F,eAAO,MAAM,cAAc,EAAgF,KACzG,KAAK,EAAE,mBAAmB,KACvB,cAAc,CAAC,mBAAmB,CAAC,CAAC;AAEzC,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,cAAc,CAQxE;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,wBAAwB,CAEtF;AAED,8FAA8F;AAC9F,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEvD;AAED,qDAAqD;AACrD,eAAO,MAAM,aAAa,QAA6B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intentius/chant-lexicon-grafana",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.102.0",
|
|
4
4
|
"description": "Grafana lexicon for chant — typed dashboards, panels, queries and datasources, serialized to dashboard JSON and Grafana provisioning files",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://intentius.io/chant",
|
|
@@ -63,12 +63,15 @@
|
|
|
63
63
|
"validate": "tsx src/validate-cli.ts",
|
|
64
64
|
"docs": "tsx src/codegen/docs-cli.ts",
|
|
65
65
|
"prepack": "npm run generate && npm run bundle && npm run validate && npm run build",
|
|
66
|
-
"build": "
|
|
66
|
+
"build": "../../scripts/tsc7.sh -p tsconfig.build.json && tsc-alias -p tsconfig.build.json && find dist -type f \\( -name \"*.js\" -o -name \"*.js.map\" \\) -delete"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
+
"@grafana/lezer-logql": "0.4.2",
|
|
70
|
+
"@grafana/lezer-traceql": "1.0.3",
|
|
69
71
|
"@intentius/chant-lexicon-k8s": "*",
|
|
70
72
|
"@intentius/chant-lexicon-otel": "*",
|
|
71
73
|
"@intentius/chant-lexicon-prometheus": "*",
|
|
74
|
+
"@lezer/lr": "^1.4.10",
|
|
72
75
|
"ajv": "^8.20.0",
|
|
73
76
|
"js-yaml": "^4.3.1"
|
|
74
77
|
},
|
|
@@ -80,7 +83,7 @@
|
|
|
80
83
|
"zod": "^4.3.6"
|
|
81
84
|
},
|
|
82
85
|
"peerDependencies": {
|
|
83
|
-
"@intentius/chant": "^0.
|
|
86
|
+
"@intentius/chant": "^0.102.0",
|
|
84
87
|
"typescript": "^5.9.3",
|
|
85
88
|
"zod": "^4.3.6"
|
|
86
89
|
}
|
package/src/alerting-build.ts
CHANGED
|
@@ -281,7 +281,7 @@ export function contactPointJson(cp: ContactPointEntity): ProvisionedContactPoin
|
|
|
281
281
|
let uid = r.uid ?? slugUid(`${p.name} ${r.type}`);
|
|
282
282
|
if (r.uid === undefined) for (let n = 2; taken.has(uid); n++) uid = slugUid(`${p.name} ${r.type} ${n}`);
|
|
283
283
|
taken.add(uid);
|
|
284
|
-
return compact({ uid, type: r.type, settings: r.settings ?? {}, disableResolveMessage: r.disableResolveMessage });
|
|
284
|
+
return compact({ uid, type: r.type, settings: (r.settings ?? {}) as Json, disableResolveMessage: r.disableResolveMessage });
|
|
285
285
|
});
|
|
286
286
|
return compact({ orgId: p.orgId, name: p.name, receivers });
|
|
287
287
|
}
|
package/src/alerting.ts
CHANGED
|
@@ -21,6 +21,7 @@ import type { TimePeriodConfig } from "@intentius/chant-lexicon-prometheus/model
|
|
|
21
21
|
import type { MatchOp } from "@intentius/chant-lexicon-prometheus/matchers";
|
|
22
22
|
import type { DatasourceInput, QueryEntity } from "./query";
|
|
23
23
|
import type { DashboardEntity } from "./dashboard";
|
|
24
|
+
import type { ContactPointSettingsByType } from "./contact-point-settings.gen";
|
|
24
25
|
import type { TypeClassicConditions, TypeMath, TypeReduce, TypeResample, TypeSql, TypeThreshold } from "./schema/expr.gen";
|
|
25
26
|
|
|
26
27
|
/** The datasource uid Grafana gives server-side expressions. */
|
|
@@ -250,47 +251,35 @@ export function isAlertRuleGroupEntity(value: unknown): value is AlertRuleGroupE
|
|
|
250
251
|
// ── Contact points ──────────────────────────────────────────────
|
|
251
252
|
|
|
252
253
|
/** The integrations Grafana 12.4 and 13.2 offer (`GET /api/alert-notifiers`). Any other plugin id is accepted as a string. */
|
|
253
|
-
export type ContactPointIntegrationType =
|
|
254
|
-
| "dingding"
|
|
255
|
-
| "discord"
|
|
256
|
-
| "email"
|
|
257
|
-
| "googlechat"
|
|
258
|
-
| "jira"
|
|
259
|
-
| "kafka"
|
|
260
|
-
| "line"
|
|
261
|
-
| "mqtt"
|
|
262
|
-
| "oncall"
|
|
263
|
-
| "opsgenie"
|
|
264
|
-
| "pagerduty"
|
|
265
|
-
| "prometheus-alertmanager"
|
|
266
|
-
| "pushover"
|
|
267
|
-
| "sensugo"
|
|
268
|
-
| "slack"
|
|
269
|
-
| "sns"
|
|
270
|
-
| "teams"
|
|
271
|
-
| "telegram"
|
|
272
|
-
| "threema"
|
|
273
|
-
| "victorops"
|
|
274
|
-
| "webex"
|
|
275
|
-
| "webhook"
|
|
276
|
-
| "wechat"
|
|
277
|
-
| "wecom";
|
|
254
|
+
export type ContactPointIntegrationType = keyof ContactPointSettingsByType;
|
|
278
255
|
|
|
279
256
|
/** One integration of a contact point. */
|
|
280
|
-
export interface
|
|
257
|
+
export interface ContactPointReceiverBase {
|
|
281
258
|
/** Stable id, at most 40 characters. Defaults to the contact point's name and the integration type as a uid. */
|
|
282
259
|
uid?: string;
|
|
260
|
+
disableResolveMessage?: boolean;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* A receiver of one of the 24 integrations Grafana lists, its `settings`
|
|
265
|
+
* typed from `GET /api/alert-notifiers`. Write secrets (webhook URLs,
|
|
266
|
+
* tokens, passwords) as `$__env{NAME}` or `$__file{/path}`: Grafana expands
|
|
267
|
+
* them when it reads the file, and GRAF002 flags a literal. GRAF114 reports
|
|
268
|
+
* a setting the integration does not take and a missing required one.
|
|
269
|
+
*/
|
|
270
|
+
export type KnownContactPointReceiver = {
|
|
271
|
+
[K in ContactPointIntegrationType]: ContactPointReceiverBase & { type: K; settings: ContactPointSettingsByType[K] };
|
|
272
|
+
}[ContactPointIntegrationType];
|
|
273
|
+
|
|
274
|
+
/** An integration this lexicon has no settings type for (a plugin id, or one a newer Grafana added). Its settings are not checked. */
|
|
275
|
+
export interface OtherContactPointReceiver extends ContactPointReceiverBase {
|
|
283
276
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
284
|
-
type:
|
|
285
|
-
/**
|
|
286
|
-
* The integration's settings. Write secrets (webhook URLs, tokens,
|
|
287
|
-
* passwords) as `$__env{NAME}` or `$__file{/path}`: Grafana expands them
|
|
288
|
-
* when it reads the file, and GRAF002 flags a literal.
|
|
289
|
-
*/
|
|
277
|
+
type: string & {};
|
|
290
278
|
settings: Record<string, unknown>;
|
|
291
|
-
disableResolveMessage?: boolean;
|
|
292
279
|
}
|
|
293
280
|
|
|
281
|
+
export type ContactPointReceiver = KnownContactPointReceiver | OtherContactPointReceiver;
|
|
282
|
+
|
|
294
283
|
export interface ContactPointProps {
|
|
295
284
|
/** The name policies and rules route to. */
|
|
296
285
|
name: string;
|
|
@@ -36,7 +36,7 @@ export interface LibraryPanelPlan {
|
|
|
36
36
|
readonly uid: string;
|
|
37
37
|
readonly name: string;
|
|
38
38
|
readonly model: Json;
|
|
39
|
-
/** The folder it goes in: that of the first dashboard that carries it. Absent for the General folder. */
|
|
39
|
+
/** The folder it goes in: the element's `folderUid`, else that of the first dashboard that carries it. Absent for the General folder. */
|
|
40
40
|
readonly folderUid?: string;
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -61,7 +61,9 @@ export function libraryPanelsOf(dashboard: Json, folderUid?: string): { panels:
|
|
|
61
61
|
skipped.push(uid);
|
|
62
62
|
continue;
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
// A build writes the folder a `LibraryPanel` names into its element; an export's elements have none, and go in the dashboard's.
|
|
65
|
+
const inFolder = typeof el.folderUid === "string" && el.folderUid !== "" ? el.folderUid : folderUid;
|
|
66
|
+
panels.push({ uid, name: el.name, model: el.model, ...(inFolder ? { folderUid: inFolder } : {}) });
|
|
65
67
|
}
|
|
66
68
|
return { panels, skipped };
|
|
67
69
|
}
|
package/src/build.test.ts
CHANGED
|
@@ -16,6 +16,9 @@ import {
|
|
|
16
16
|
SwitchVariable,
|
|
17
17
|
TextboxVariable,
|
|
18
18
|
} from "./variables";
|
|
19
|
+
import { LibraryPanel, LibraryPanelRef } from "./library-panel";
|
|
20
|
+
import { planFromDashboards } from "./api/apply";
|
|
21
|
+
import { validateGrafanaOutput } from "./validate-output";
|
|
19
22
|
import { panelsJson, renderDashboard, variableModel, dashboardJson, grafanaFiles, buildGrafana, customVariableOptions, type PanelJson } from "./build";
|
|
20
23
|
|
|
21
24
|
/** The panels array, read as plain panels (the tests below build no rows unless they say so). */
|
|
@@ -251,11 +254,13 @@ describe("datasources and targets", () => {
|
|
|
251
254
|
expect(panel.targets!.map((t) => (t as { datasource?: unknown }).datasource)).toEqual([{ type: "prometheus", uid: "prometheus" }, undefined]);
|
|
252
255
|
});
|
|
253
256
|
|
|
254
|
-
test("a panel takes its queries' shared datasource, and a row
|
|
257
|
+
test("a panel takes its queries' shared datasource, and a row's datasource stays on the row (#2983)", () => {
|
|
255
258
|
const [shared] = panelsOnly([new StatPanel({ targets: [new PromQuery({ expr: "up", datasource: prometheus })] })]);
|
|
256
259
|
expect(shared.datasource).toEqual({ type: "prometheus", uid: "prometheus" });
|
|
257
|
-
const [, child] = panelsOnly([new Row({ title: "r", datasource: prometheus, panels: [new StatPanel({ targets: [new PromQuery({ expr: "up" })] })] })]);
|
|
258
|
-
expect(
|
|
260
|
+
const [rowJson, child] = panelsOnly([new Row({ title: "r", datasource: prometheus, panels: [new StatPanel({ targets: [new PromQuery({ expr: "up" })] })] })]);
|
|
261
|
+
expect(rowJson.datasource).toEqual({ type: "prometheus", uid: "prometheus" });
|
|
262
|
+
expect(child.datasource).toBeUndefined();
|
|
263
|
+
expect((child.targets![0] as { datasource?: unknown }).datasource).toBeUndefined();
|
|
259
264
|
});
|
|
260
265
|
|
|
261
266
|
test("a datasource variable is referenced as ${name}; a plain ref passes through", () => {
|
|
@@ -303,6 +308,7 @@ describe("variables", () => {
|
|
|
303
308
|
});
|
|
304
309
|
expect(variableModel(new IntervalVariable({ name: "step", values: ["1m", "5m"] }))).toMatchObject({ type: "interval", query: "1m,5m", auto: false, refresh: 2 });
|
|
305
310
|
expect(variableModel(new DatasourceVariable({ name: "ds", pluginType: "loki", hide: "valueOnly" }))).toMatchObject({ type: "datasource", query: "loki", hide: 1 });
|
|
311
|
+
expect(variableModel(new CustomVariable({ name: "env", values: ["a"], hide: "controlsMenu", allowCustomValue: false }))).toMatchObject({ hide: 3, allowCustomValue: false });
|
|
306
312
|
expect(variableModel(new ConstantVariable({ name: "cluster", value: "prod-1" }))).toMatchObject({ type: "constant", query: "prod-1", hide: 2 });
|
|
307
313
|
expect(variableModel(new TextboxVariable({ name: "q" }))).toMatchObject({ type: "textbox", query: "" });
|
|
308
314
|
});
|
|
@@ -422,16 +428,16 @@ describe("variables", () => {
|
|
|
422
428
|
describe("extension points", () => {
|
|
423
429
|
test("definePanel and defineQuery produce classes that render and lay out like built-ins", () => {
|
|
424
430
|
const ClockPanel = definePanel<{ mode?: "time" | "countdown" }>()({ type: "grafana-clock-panel", className: "ClockPanel", defaultSize: { w: 8, h: 8 } });
|
|
425
|
-
const
|
|
426
|
-
const os = new Datasource({ name: "Logs
|
|
431
|
+
const SplunkQuery = defineQuery<{ query: string; refId?: string }>()({ datasourceType: "grafana-splunk-datasource", className: "SplunkQuery" });
|
|
432
|
+
const os = new Datasource({ name: "Logs Splunk", type: "grafana-splunk-datasource" });
|
|
427
433
|
const json = renderDashboard(
|
|
428
|
-
new Dashboard({ title: "Custom", panels: [new ClockPanel({ options: { mode: "countdown" }, datasource: os, targets: [new
|
|
434
|
+
new Dashboard({ title: "Custom", panels: [new ClockPanel({ options: { mode: "countdown" }, datasource: os, targets: [new SplunkQuery({ query: "*" })] })] }),
|
|
429
435
|
);
|
|
430
436
|
expect(json.panels![0]).toMatchObject({
|
|
431
437
|
type: "grafana-clock-panel",
|
|
432
438
|
gridPos: { w: 8, h: 8, x: 0, y: 0 },
|
|
433
439
|
options: { mode: "countdown" },
|
|
434
|
-
datasource: { type: "grafana-
|
|
440
|
+
datasource: { type: "grafana-splunk-datasource", uid: "logs-splunk" },
|
|
435
441
|
targets: [{ refId: "A", query: "*" }],
|
|
436
442
|
});
|
|
437
443
|
expect(validateDashboardSchema(json as unknown as Record<string, unknown>)).toEqual([]);
|
|
@@ -549,3 +555,85 @@ describe("datasource prune (#2953)", () => {
|
|
|
549
555
|
expect(() => buildGrafana([new DatasourceProvisioning({}), new DatasourceProvisioning({})])).toThrow(/at most one DatasourceProvisioning/);
|
|
550
556
|
});
|
|
551
557
|
});
|
|
558
|
+
|
|
559
|
+
describe("library panels (#3010)", () => {
|
|
560
|
+
const burn = new LibraryPanel({
|
|
561
|
+
name: "Burn rate",
|
|
562
|
+
folder: "SLOs",
|
|
563
|
+
panel: new TimeSeriesPanel({ title: "Burn rate", gridPos: { w: 24, h: 6 }, targets: [new PromQuery({ expr: "up", datasource: prometheus })] }),
|
|
564
|
+
});
|
|
565
|
+
|
|
566
|
+
test("a LibraryPanel in panels is a reference, laid out at its panel's size, and its model goes in __elements", () => {
|
|
567
|
+
const json = renderDashboard(new Dashboard({ title: "SLO", panels: [new StatPanel({ title: "s" }), burn] })) as unknown as Record<string, unknown>;
|
|
568
|
+
expect(json.panels).toEqual([
|
|
569
|
+
expect.objectContaining({ type: "stat", id: 1 }),
|
|
570
|
+
{ id: 2, gridPos: { h: 8, w: 12, x: 6, y: 0 }, libraryPanel: { uid: "burn-rate", name: "Burn rate" } },
|
|
571
|
+
]);
|
|
572
|
+
expect(json.__elements).toEqual({
|
|
573
|
+
"burn-rate": {
|
|
574
|
+
name: "Burn rate",
|
|
575
|
+
uid: "burn-rate",
|
|
576
|
+
kind: 1,
|
|
577
|
+
model: {
|
|
578
|
+
type: "timeseries",
|
|
579
|
+
title: "Burn rate",
|
|
580
|
+
datasource: { type: "prometheus", uid: "prometheus" },
|
|
581
|
+
targets: [{ datasource: { type: "prometheus", uid: "prometheus" }, refId: "A", expr: "up" }],
|
|
582
|
+
options: {},
|
|
583
|
+
fieldConfig: { defaults: {}, overrides: [] },
|
|
584
|
+
},
|
|
585
|
+
folderUid: "slos",
|
|
586
|
+
},
|
|
587
|
+
});
|
|
588
|
+
expect(validateDashboardSchema(json as never).filter((p) => p.severity === "error")).toEqual([]);
|
|
589
|
+
});
|
|
590
|
+
|
|
591
|
+
test("a LibraryPanelRef places it, in a row too; one in Grafana is referenced by { uid, name } and not written", () => {
|
|
592
|
+
const json = renderDashboard(
|
|
593
|
+
new Dashboard({
|
|
594
|
+
title: "SLO",
|
|
595
|
+
panels: [
|
|
596
|
+
new LibraryPanelRef({ libraryPanel: burn, id: 7, gridPos: { x: 0, y: 0, w: 24, h: 6 }, title: "Burn rate" }),
|
|
597
|
+
new Row({ title: "More", panels: [new LibraryPanelRef({ libraryPanel: { uid: "shared-owners", name: "Owners" } }), burn] }),
|
|
598
|
+
],
|
|
599
|
+
}),
|
|
600
|
+
) as unknown as Record<string, unknown>;
|
|
601
|
+
expect(json.panels).toEqual([
|
|
602
|
+
{ id: 7, gridPos: { h: 6, w: 24, x: 0, y: 0 }, libraryPanel: { uid: "burn-rate", name: "Burn rate" }, title: "Burn rate" },
|
|
603
|
+
expect.objectContaining({ type: "row", title: "More" }),
|
|
604
|
+
{ id: 2, gridPos: { h: 8, w: 12, x: 0, y: 7 }, libraryPanel: { uid: "shared-owners", name: "Owners" } },
|
|
605
|
+
{ id: 3, gridPos: { h: 8, w: 12, x: 12, y: 7 }, libraryPanel: { uid: "burn-rate", name: "Burn rate" } },
|
|
606
|
+
]);
|
|
607
|
+
expect(Object.keys(json.__elements as object)).toEqual(["burn-rate"]);
|
|
608
|
+
expect(() => new LibraryPanelRef({ libraryPanel: "burn-rate" as never })).toThrow(/must be a LibraryPanel or a \{ uid, name \}/);
|
|
609
|
+
expect(() => renderDashboard(new Dashboard({ title: "X", panels: [burn, new LibraryPanel({ name: "Other", uid: "burn-rate", panel: new StatPanel({}) })] }))).toThrow(
|
|
610
|
+
/two different LibraryPanels with the uid "burn-rate"/,
|
|
611
|
+
);
|
|
612
|
+
});
|
|
613
|
+
|
|
614
|
+
test("the build makes the library panel's folder, the checks pass, and the applier writes it there, before the dashboards", () => {
|
|
615
|
+
const slos = new Folder({ title: "SLOs", uid: "slo-folder" });
|
|
616
|
+
const pinned = new LibraryPanel({ name: "Pinned", folder: slos, panel: new StatPanel({ title: "Pinned" }) });
|
|
617
|
+
const built = buildGrafana(
|
|
618
|
+
new Map<string, never>([
|
|
619
|
+
["prometheus", prometheus as never],
|
|
620
|
+
["burn", burn as never],
|
|
621
|
+
["slo", new Dashboard({ title: "SLO", folder: "Team A", panels: [burn, pinned] }) as never],
|
|
622
|
+
["other", new Dashboard({ title: "Other", panels: [burn] }) as never],
|
|
623
|
+
]),
|
|
624
|
+
);
|
|
625
|
+
expect(built.folders.map((f) => [f.path, f.uid])).toEqual([
|
|
626
|
+
["SLOs", "slo-folder"],
|
|
627
|
+
["Team A", "team-a"],
|
|
628
|
+
]);
|
|
629
|
+
const issues = validateGrafanaOutput({ dashboards: built.dashboards.map((d) => ({ source: d.file, json: d.json as never })), datasources: built.datasources });
|
|
630
|
+
expect(issues.filter((i) => i.severity === "error")).toEqual([]);
|
|
631
|
+
const plan = planFromDashboards(built.dashboards.map((d) => ({ json: d.json as never, folder: d.folder, folderUid: d.folderUid })), built.folders);
|
|
632
|
+
// "SLOs" is a path on burn, and the Folder of that path pins its uid.
|
|
633
|
+
expect(plan.libraryPanels.map((p) => [p.uid, p.folderUid])).toEqual([
|
|
634
|
+
["burn-rate", "slo-folder"],
|
|
635
|
+
["pinned", "slo-folder"],
|
|
636
|
+
]);
|
|
637
|
+
expect(plan.dashboards.every((d) => !("__elements" in d.json))).toBe(true);
|
|
638
|
+
});
|
|
639
|
+
});
|