Support importing local cue modules when generating TS types with cog (#96876)

* Support importing local cue modules when generating TS types with cog

* Generate enums as unions of values instead of an actual `enum` statement

* Update transformers to use the new TS enums

* Update go workspaces

---------

Co-authored-by: Ivan Ortega <ivanortegaalba@gmail.com>
dana/cloud-migrations/plugin-migration-safeguard^2
Kévin Gomez 8 months ago committed by GitHub
parent c8caf787d4
commit c8d3ea58f8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      apps/playlist/go.mod
  2. 8
      apps/playlist/go.sum
  3. 10
      go.mod
  4. 20
      go.sum
  5. 5
      go.work.sum
  6. 43
      kindsv2/gen.go
  7. 12
      kindsv2/go.mod
  8. 20
      kindsv2/go.sum
  9. 166
      packages/grafana-schema/src/schema/dashboard/v2alpha0/dashboard.gen.ts
  10. 10
      packages/grafana-schema/src/schema/dashboard/v2alpha0/dashboard.schema.cue
  11. 46
      packages/grafana-schema/src/schema/dashboard/v2alpha0/examples.ts
  12. 10
      pkg/aggregator/go.mod
  13. 20
      pkg/aggregator/go.sum
  14. 4
      pkg/apimachinery/go.mod
  15. 8
      pkg/apimachinery/go.sum
  16. 6
      pkg/apiserver/go.mod
  17. 16
      pkg/apiserver/go.sum
  18. 6
      pkg/build/go.mod
  19. 12
      pkg/build/go.sum
  20. 4
      pkg/build/wire/go.mod
  21. 8
      pkg/build/wire/go.sum
  22. 6
      pkg/promlib/go.mod
  23. 12
      pkg/promlib/go.sum
  24. 6
      pkg/tests/apis/folder/folders_test.go
  25. 9
      public/app/features/dashboard-scene/serialization/sceneVariablesSetToVariables.ts
  26. 2
      public/app/features/dashboard-scene/serialization/transformSaveModelSchemaV2ToScene.test.ts
  27. 4
      public/app/features/dashboard-scene/serialization/transformSaveModelSchemaV2ToScene.ts
  28. 8
      public/app/features/dashboard-scene/serialization/transformSceneToSaveModelSchemaV2.ts
  29. 77
      public/app/features/dashboard-scene/serialization/transformToV1TypesUtils.ts
  30. 83
      public/app/features/dashboard-scene/serialization/transformToV2TypesUtils.test.ts
  31. 52
      public/app/features/dashboard-scene/serialization/transformToV2TypesUtils.ts

@ -59,10 +59,10 @@ require (
go.opentelemetry.io/otel/sdk v1.32.0 // indirect go.opentelemetry.io/otel/sdk v1.32.0 // indirect
go.opentelemetry.io/otel/trace v1.32.0 // indirect go.opentelemetry.io/otel/trace v1.32.0 // indirect
go.opentelemetry.io/proto/otlp v1.3.1 // indirect go.opentelemetry.io/proto/otlp v1.3.1 // indirect
golang.org/x/net v0.30.0 // indirect golang.org/x/net v0.31.0 // indirect
golang.org/x/oauth2 v0.23.0 // indirect golang.org/x/oauth2 v0.23.0 // indirect
golang.org/x/sys v0.27.0 // indirect golang.org/x/sys v0.27.0 // indirect
golang.org/x/term v0.25.0 // indirect golang.org/x/term v0.26.0 // indirect
golang.org/x/text v0.20.0 // indirect golang.org/x/text v0.20.0 // indirect
golang.org/x/time v0.6.0 // indirect golang.org/x/time v0.6.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect

@ -141,8 +141,8 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo=
golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= golang.org/x/net v0.31.0/go.mod h1:P4fl1q7dY2hnZFxEk4pPSkDHF+QqjitcnDjUQyMM+pM=
golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs=
golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@ -153,8 +153,8 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s= golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s=
golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24= golang.org/x/term v0.26.0 h1:WEQa6V3Gja/BhNxg540hBip/kkaYtRg3cxg4oXSw4AU=
golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M= golang.org/x/term v0.26.0/go.mod h1:Si5m1o57C5nBNQo5z1iq+XDijt21BDBDp2bK0QI8e3E=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug= golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug=

@ -171,15 +171,15 @@ require (
go.uber.org/atomic v1.11.0 // @grafana/alerting-backend go.uber.org/atomic v1.11.0 // @grafana/alerting-backend
go.uber.org/goleak v1.3.0 // @grafana/grafana-search-and-storage go.uber.org/goleak v1.3.0 // @grafana/grafana-search-and-storage
gocloud.dev v0.40.0 // @grafana/grafana-app-platform-squad gocloud.dev v0.40.0 // @grafana/grafana-app-platform-squad
golang.org/x/crypto v0.28.0 // @grafana/grafana-backend-group golang.org/x/crypto v0.29.0 // @grafana/grafana-backend-group
golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e // @grafana/alerting-backend golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e // @grafana/alerting-backend
golang.org/x/mod v0.21.0 // indirect; @grafana/grafana-backend-group golang.org/x/mod v0.22.0 // indirect; @grafana/grafana-backend-group
golang.org/x/net v0.30.0 // @grafana/oss-big-tent @grafana/partner-datasources golang.org/x/net v0.31.0 // @grafana/oss-big-tent @grafana/partner-datasources
golang.org/x/oauth2 v0.23.0 // @grafana/identity-access-team golang.org/x/oauth2 v0.23.0 // @grafana/identity-access-team
golang.org/x/sync v0.9.0 // @grafana/alerting-backend golang.org/x/sync v0.9.0 // @grafana/alerting-backend
golang.org/x/text v0.20.0 // @grafana/grafana-backend-group golang.org/x/text v0.20.0 // @grafana/grafana-backend-group
golang.org/x/time v0.6.0 // @grafana/grafana-backend-group golang.org/x/time v0.6.0 // @grafana/grafana-backend-group
golang.org/x/tools v0.26.0 // @grafana/grafana-as-code golang.org/x/tools v0.27.0 // @grafana/grafana-as-code
gonum.org/v1/gonum v0.15.1 // @grafana/observability-metrics gonum.org/v1/gonum v0.15.1 // @grafana/observability-metrics
google.golang.org/api v0.193.0 // @grafana/grafana-backend-group google.golang.org/api v0.193.0 // @grafana/grafana-backend-group
google.golang.org/grpc v1.67.1 // @grafana/plugins-platform-backend google.golang.org/grpc v1.67.1 // @grafana/plugins-platform-backend
@ -431,7 +431,7 @@ require (
go.uber.org/multierr v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // @grafana/identity-access-team go.uber.org/zap v1.27.0 // @grafana/identity-access-team
golang.org/x/sys v0.27.0 // indirect golang.org/x/sys v0.27.0 // indirect
golang.org/x/term v0.25.0 // indirect golang.org/x/term v0.26.0 // indirect
golang.org/x/xerrors v0.0.0-20240716161551-93cc26a95ae9 // indirect golang.org/x/xerrors v0.0.0-20240716161551-93cc26a95ae9 // indirect
google.golang.org/genproto v0.0.0-20240820151423-278611b39280 // indirect; @grafana/grafana-backend-group google.golang.org/genproto v0.0.0-20240820151423-278611b39280 // indirect; @grafana/grafana-backend-group
google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 // indirect

@ -3516,8 +3516,8 @@ golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1m
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M=
golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ=
golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg=
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
@ -3595,8 +3595,8 @@ golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.16.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/mod v0.16.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4=
golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
golang.org/x/net v0.0.0-20180530234432-1e491301e022/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180530234432-1e491301e022/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@ -3695,8 +3695,8 @@ golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8=
golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo=
golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= golang.org/x/net v0.31.0/go.mod h1:P4fl1q7dY2hnZFxEk4pPSkDHF+QqjitcnDjUQyMM+pM=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@ -3931,8 +3931,8 @@ golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY=
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=
golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk= golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk=
golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24= golang.org/x/term v0.26.0 h1:WEQa6V3Gja/BhNxg540hBip/kkaYtRg3cxg4oXSw4AU=
golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M= golang.org/x/term v0.26.0/go.mod h1:Si5m1o57C5nBNQo5z1iq+XDijt21BDBDp2bK0QI8e3E=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@ -4062,8 +4062,8 @@ golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps
golang.org/x/tools v0.18.0/go.mod h1:GL7B4CwcLLeo59yx/9UWWuNOW1n3VZ4f5axWfML7Lcg= golang.org/x/tools v0.18.0/go.mod h1:GL7B4CwcLLeo59yx/9UWWuNOW1n3VZ4f5axWfML7Lcg=
golang.org/x/tools v0.19.0/go.mod h1:qoJWxmGSIBmAeriMx19ogtrEPrGtDbPK634QFIcLAhc= golang.org/x/tools v0.19.0/go.mod h1:qoJWxmGSIBmAeriMx19ogtrEPrGtDbPK634QFIcLAhc=
golang.org/x/tools v0.20.0/go.mod h1:WvitBU7JJf6A4jOdg4S1tviW9bhUxkgeCui/0JHctQg= golang.org/x/tools v0.20.0/go.mod h1:WvitBU7JJf6A4jOdg4S1tviW9bhUxkgeCui/0JHctQg=
golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= golang.org/x/tools v0.27.0 h1:qEKojBykQkQ4EynWy4S8Weg69NumxKdn40Fce3uc/8o=
golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/tools v0.27.0/go.mod h1:sUi0ZgbwW9ZPAq26Ekut+weQPR5eIM6GQLQ1Yjm1H0Q=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

@ -989,6 +989,9 @@ github.com/grafana/alerting v0.0.0-20240917171353-6c25eb6eff10 h1:oDbLKM34O+JUF9
github.com/grafana/alerting v0.0.0-20240917171353-6c25eb6eff10/go.mod h1:GMLi6d09Xqo96fCVUjNk//rcjP5NKEdjOzfWIffD5r4= github.com/grafana/alerting v0.0.0-20240917171353-6c25eb6eff10/go.mod h1:GMLi6d09Xqo96fCVUjNk//rcjP5NKEdjOzfWIffD5r4=
github.com/grafana/cloudflare-go v0.0.0-20230110200409-c627cf6792f2 h1:qhugDMdQ4Vp68H0tp/0iN17DM2ehRo1rLEdOFe/gB8I= github.com/grafana/cloudflare-go v0.0.0-20230110200409-c627cf6792f2 h1:qhugDMdQ4Vp68H0tp/0iN17DM2ehRo1rLEdOFe/gB8I=
github.com/grafana/cloudflare-go v0.0.0-20230110200409-c627cf6792f2/go.mod h1:w/aiO1POVIeXUQyl0VQSZjl5OAGDTL5aX+4v0RA1tcw= github.com/grafana/cloudflare-go v0.0.0-20230110200409-c627cf6792f2/go.mod h1:w/aiO1POVIeXUQyl0VQSZjl5OAGDTL5aX+4v0RA1tcw=
github.com/grafana/cog v0.0.4/go.mod h1:lzetOuhGUl/JaSACiJoHvBokf9/fS6PEFaWZvnQu2vs=
github.com/grafana/cog v0.0.5 h1:BCa+10i3KvV+KMSQuxlN1DS9cZEwN+EAFc7ZmXqHxQE=
github.com/grafana/cog v0.0.5/go.mod h1:lzetOuhGUl/JaSACiJoHvBokf9/fS6PEFaWZvnQu2vs=
github.com/grafana/cuetsy v0.1.10/go.mod h1:Ix97+CPD8ws9oSSxR3/Lf4ahU1I4Np83kjJmDVnLZvc= github.com/grafana/cuetsy v0.1.10/go.mod h1:Ix97+CPD8ws9oSSxR3/Lf4ahU1I4Np83kjJmDVnLZvc=
github.com/grafana/go-gelf/v2 v2.0.1 h1:BOChP0h/jLeD+7F9mL7tq10xVkDG15he3T1zHuQaWak= github.com/grafana/go-gelf/v2 v2.0.1 h1:BOChP0h/jLeD+7F9mL7tq10xVkDG15he3T1zHuQaWak=
github.com/grafana/go-gelf/v2 v2.0.1/go.mod h1:lexHie0xzYGwCgiRGcvZ723bSNyNI8ZRD4s0CLobh90= github.com/grafana/go-gelf/v2 v2.0.1/go.mod h1:lexHie0xzYGwCgiRGcvZ723bSNyNI8ZRD4s0CLobh90=
@ -1783,6 +1786,7 @@ golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE=
golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE=
golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg=
golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU=
golang.org/x/oauth2 v0.0.0-20210427180440-81ed05c6b58c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210427180440-81ed05c6b58c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
golang.org/x/oauth2 v0.22.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/oauth2 v0.22.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
@ -1796,6 +1800,7 @@ golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/telemetry v0.0.0-20240521205824-bda55230c457 h1:zf5N6UOrA487eEFacMePxjXAJctxKmyjKUsjA11Uzuk= golang.org/x/telemetry v0.0.0-20240521205824-bda55230c457 h1:zf5N6UOrA487eEFacMePxjXAJctxKmyjKUsjA11Uzuk=
golang.org/x/telemetry v0.0.0-20240521205824-bda55230c457/go.mod h1:pRgIJT+bRLFKnoM1ldnzKoxTIn14Yxz928LQRYYgIN0= golang.org/x/telemetry v0.0.0-20240521205824-bda55230c457/go.mod h1:pRgIJT+bRLFKnoM1ldnzKoxTIn14Yxz928LQRYYgIN0=
golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0= golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0=

@ -6,46 +6,47 @@ import (
"context" "context"
"os" "os"
"cuelang.org/go/cue/cuecontext"
"github.com/grafana/cog" "github.com/grafana/cog"
) )
type codegenTargets struct { type codegenTargets struct {
schemaPath string modulePath string
outputPath string outputPath string
cueImportsMap map[string]string
packagesImportMap map[string]string
} }
func main() { func main() {
cueCtx := cuecontext.New()
targets := []codegenTargets{ targets := []codegenTargets{
{ {
schemaPath: "../packages/grafana-schema/src/schema/dashboard/v2alpha0/dashboard.schema.cue", modulePath: "../packages/grafana-schema/src/schema/dashboard/v2alpha0/",
outputPath: "../packages/grafana-schema/src/schema/dashboard/v2alpha0/dashboard.gen.ts", outputPath: "../packages/grafana-schema/src/schema/dashboard/v2alpha0/dashboard.gen.ts",
cueImportsMap: map[string]string{
"github.com/grafana/grafana/packages/grafana-schema/src/common": "../packages/grafana-schema/src/common",
},
packagesImportMap: map[string]string{
"common": "@grafana/schema",
},
}, },
} }
for _, target := range targets { for _, target := range targets {
rawSchema, err := os.ReadFile(target.schemaPath)
if err != nil {
panic(err)
}
value := cueCtx.CompileBytes(rawSchema)
if value.Err() != nil {
panic(value.Err())
}
codegenPipeline := cog.TypesFromSchema(). codegenPipeline := cog.TypesFromSchema().
CUEValue("dashboard", value). CUEModule(
Typescript() target.modulePath,
cog.CUEImports(target.cueImportsMap),
tsBytes, err := codegenPipeline.Run(context.Background()) ).
Typescript(cog.TypescriptConfig{
ImportsMap: target.packagesImportMap,
EnumsAsUnionTypes: true,
})
files, err := codegenPipeline.Run(context.Background())
if err != nil { if err != nil {
panic(err) panic(err)
} }
if err := os.WriteFile(target.outputPath, tsBytes, 0644); err != nil { if err := os.WriteFile(target.outputPath, files[0].Data, 0644); err != nil {
panic(err) panic(err)
} }
} }

@ -2,13 +2,11 @@ module github.com/grafana/grafana/kindsv2
go 1.23.1 go 1.23.1
require ( require github.com/grafana/cog v0.0.5
cuelang.org/go v0.8.2
github.com/grafana/cog v0.0.0-20241029201114-f7f7db0c1070
)
require ( require (
cuelabs.dev/go/oci/ociregistry v0.0.0-20240906074133-82eb438dd565 // indirect cuelabs.dev/go/oci/ociregistry v0.0.0-20240906074133-82eb438dd565 // indirect
cuelang.org/go v0.8.2 // indirect
github.com/cockroachdb/apd/v3 v3.2.1 // indirect github.com/cockroachdb/apd/v3 v3.2.1 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/proto v1.13.2 // indirect github.com/emicklei/proto v1.13.2 // indirect
@ -36,11 +34,11 @@ require (
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 // indirect github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 // indirect
github.com/ugorji/go/codec v1.2.11 // indirect github.com/ugorji/go/codec v1.2.11 // indirect
github.com/yalue/merged_fs v1.3.0 // indirect github.com/yalue/merged_fs v1.3.0 // indirect
golang.org/x/mod v0.21.0 // indirect golang.org/x/mod v0.22.0 // indirect
golang.org/x/net v0.30.0 // indirect golang.org/x/net v0.31.0 // indirect
golang.org/x/oauth2 v0.23.0 // indirect golang.org/x/oauth2 v0.23.0 // indirect
golang.org/x/sync v0.9.0 // indirect golang.org/x/sync v0.9.0 // indirect
golang.org/x/text v0.20.0 // indirect golang.org/x/text v0.20.0 // indirect
golang.org/x/tools v0.26.0 // indirect golang.org/x/tools v0.27.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect
) )

@ -26,8 +26,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/grafana/codejen v0.0.4-0.20230321061741-77f656893a3d h1:hrXbGJ5jgp6yNITzs5o+zXq0V5yT3siNJ+uM8LGwWKk= github.com/grafana/codejen v0.0.4-0.20230321061741-77f656893a3d h1:hrXbGJ5jgp6yNITzs5o+zXq0V5yT3siNJ+uM8LGwWKk=
github.com/grafana/codejen v0.0.4-0.20230321061741-77f656893a3d/go.mod h1:zmwwM/DRyQB7pfuBjTWII3CWtxcXh8LTwAYGfDfpR6s= github.com/grafana/codejen v0.0.4-0.20230321061741-77f656893a3d/go.mod h1:zmwwM/DRyQB7pfuBjTWII3CWtxcXh8LTwAYGfDfpR6s=
github.com/grafana/cog v0.0.0-20241029201114-f7f7db0c1070 h1:ncAkFmIq3UbPiPhQ2CuBzdTuwnDqLsFFNqEIXKaiPGA= github.com/grafana/cog v0.0.5 h1:BCa+10i3KvV+KMSQuxlN1DS9cZEwN+EAFc7ZmXqHxQE=
github.com/grafana/cog v0.0.0-20241029201114-f7f7db0c1070/go.mod h1:FqZi9WZ/Uzvs3tvo7l+OViThCpfvu3KDGDqHCB2LNbg= github.com/grafana/cog v0.0.5/go.mod h1:lzetOuhGUl/JaSACiJoHvBokf9/fS6PEFaWZvnQu2vs=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
@ -73,20 +73,20 @@ github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4d
github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
github.com/yalue/merged_fs v1.3.0 h1:qCeh9tMPNy/i8cwDsQTJ5bLr6IRxbs6meakNE5O+wyY= github.com/yalue/merged_fs v1.3.0 h1:qCeh9tMPNy/i8cwDsQTJ5bLr6IRxbs6meakNE5O+wyY=
github.com/yalue/merged_fs v1.3.0/go.mod h1:WqqchfVYQyclV2tnR7wtRhBddzBvLVR83Cjw9BKQw0M= github.com/yalue/merged_fs v1.3.0/go.mod h1:WqqchfVYQyclV2tnR7wtRhBddzBvLVR83Cjw9BKQw0M=
golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4=
golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo=
golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= golang.org/x/net v0.31.0/go.mod h1:P4fl1q7dY2hnZFxEk4pPSkDHF+QqjitcnDjUQyMM+pM=
golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs=
golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ= golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ=
golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s=
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug= golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug=
golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4= golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4=
golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= golang.org/x/tools v0.27.0 h1:qEKojBykQkQ4EynWy4S8Weg69NumxKdn40Fce3uc/8o=
golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/tools v0.27.0/go.mod h1:sUi0ZgbwW9ZPAq26Ekut+weQPR5eIM6GQLQ1Yjm1H0Q=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=

@ -1,5 +1,8 @@
// Code generated - EDITING IS FUTILE. DO NOT EDIT. // Code generated - EDITING IS FUTILE. DO NOT EDIT.
import * as common from '@grafana/schema';
export interface DashboardV2Spec { export interface DashboardV2Spec {
// Unique numeric identifier for the dashboard. // Unique numeric identifier for the dashboard.
// `id` is internal to a specific Grafana instance. `uid` should be used to identify a dashboard across Grafana instances. // `id` is internal to a specific Grafana instance. `uid` should be used to identify a dashboard across Grafana instances.
@ -42,7 +45,7 @@ export interface DashboardV2Spec {
export const defaultDashboardV2Spec = (): DashboardV2Spec => ({ export const defaultDashboardV2Spec = (): DashboardV2Spec => ({
title: "", title: "",
cursorSync: DashboardCursorSync.Off, cursorSync: "Off",
preload: false, preload: false,
editable: true, editable: true,
links: [], links: [],
@ -69,13 +72,9 @@ export const defaultAnnotationPanelFilter = (): AnnotationPanelFilter => ({
// "Off" for no shared crosshair or tooltip (default). // "Off" for no shared crosshair or tooltip (default).
// "Crosshair" for shared crosshair. // "Crosshair" for shared crosshair.
// "Tooltip" for shared crosshair AND shared tooltip. // "Tooltip" for shared crosshair AND shared tooltip.
export enum DashboardCursorSync { export type DashboardCursorSync = "Off" | "Crosshair" | "Tooltip";
Off = "Off",
Crosshair = "Crosshair",
Tooltip = "Tooltip",
}
export const defaultDashboardCursorSync = (): DashboardCursorSync => (DashboardCursorSync.Off); export const defaultDashboardCursorSync = (): DashboardCursorSync => ("Off");
// Links with references to other dashboards or external resources // Links with references to other dashboards or external resources
export interface DashboardLink { export interface DashboardLink {
@ -104,7 +103,7 @@ export interface DashboardLink {
export const defaultDashboardLink = (): DashboardLink => ({ export const defaultDashboardLink = (): DashboardLink => ({
title: "", title: "",
type: DashboardLinkType.Link, type: "link",
icon: "", icon: "",
tooltip: "", tooltip: "",
tags: [], tags: [],
@ -124,14 +123,6 @@ export interface DataSourceRef {
export const defaultDataSourceRef = (): DataSourceRef => ({ export const defaultDataSourceRef = (): DataSourceRef => ({
}); });
export enum DataTopic {
AlertStates = "alertStates",
Annotations = "annotations",
Series = "series",
}
export const defaultDataTopic = (): DataTopic => (DataTopic.AlertStates);
// Transformations allow to manipulate data returned by a query before the system applies a visualization. // Transformations allow to manipulate data returned by a query before the system applies a visualization.
// Using transformations you can: rename fields, join time series data, perform mathematical operations across queries, // Using transformations you can: rename fields, join time series data, perform mathematical operations across queries,
// use the output of one transformation as the input to another transformation, etc. // use the output of one transformation as the input to another transformation, etc.
@ -143,7 +134,7 @@ export interface DataTransformerConfig {
// Optional frame matcher. When missing it will be applied to all results // Optional frame matcher. When missing it will be applied to all results
filter?: MatcherConfig; filter?: MatcherConfig;
// Where to pull DataFrames from as input to transformation // Where to pull DataFrames from as input to transformation
topic?: DataTopic; topic?: common.DataTopic;
// Options to be passed to the transformer // Options to be passed to the transformer
// Valid options depend on the transformer id // Valid options depend on the transformer id
options: any; options: any;
@ -263,12 +254,9 @@ export const defaultThreshold = (): Threshold => ({
color: "", color: "",
}); });
export enum ThresholdsMode { export type ThresholdsMode = "absolute" | "percentage";
Absolute = "absolute",
Percentage = "percentage",
}
export const defaultThresholdsMode = (): ThresholdsMode => (ThresholdsMode.Absolute); export const defaultThresholdsMode = (): ThresholdsMode => ("absolute");
export interface ThresholdsConfig { export interface ThresholdsConfig {
mode: ThresholdsMode; mode: ThresholdsMode;
@ -276,7 +264,7 @@ export interface ThresholdsConfig {
} }
export const defaultThresholdsConfig = (): ThresholdsConfig => ({ export const defaultThresholdsConfig = (): ThresholdsConfig => ({
mode: ThresholdsMode.Absolute, mode: "absolute",
steps: [], steps: [],
}); });
@ -289,14 +277,9 @@ export const defaultValueMapping = (): ValueMapping => (defaultValueMap());
// `range`: Maps numerical ranges to a display text and color. For example, if a value is within a certain range, you can configure a range value mapping to display Low or High rather than the number. // `range`: Maps numerical ranges to a display text and color. For example, if a value is within a certain range, you can configure a range value mapping to display Low or High rather than the number.
// `regex`: Maps regular expressions to replacement text and a color. For example, if a value is www.example.com, you can configure a regex value mapping so that Grafana displays www and truncates the domain. // `regex`: Maps regular expressions to replacement text and a color. For example, if a value is www.example.com, you can configure a regex value mapping so that Grafana displays www and truncates the domain.
// `special`: Maps special values like Null, NaN (not a number), and boolean values like true and false to a display text and color. See SpecialValueMatch to see the list of special values. For example, you can configure a special value mapping so that null values appear as N/A. // `special`: Maps special values like Null, NaN (not a number), and boolean values like true and false to a display text and color. See SpecialValueMatch to see the list of special values. For example, you can configure a special value mapping so that null values appear as N/A.
export enum MappingType { export type MappingType = "value" | "range" | "regex" | "special";
ValueToText = "value",
RangeToText = "range",
RegexToText = "regex",
SpecialValue = "special",
}
export const defaultMappingType = (): MappingType => (MappingType.ValueToText); export const defaultMappingType = (): MappingType => ("value");
// Maps text values to a color or different display text and color. // Maps text values to a color or different display text and color.
// For example, you can configure a value mapping so that all instances of the value 10 appear as Perfection! rather than the number. // For example, you can configure a value mapping so that all instances of the value 10 appear as Perfection! rather than the number.
@ -372,22 +355,15 @@ export interface SpecialValueMap {
export const defaultSpecialValueMap = (): SpecialValueMap => ({ export const defaultSpecialValueMap = (): SpecialValueMap => ({
type: "special", type: "special",
options: { options: {
match: SpecialValueMatch.True, match: "true",
result: defaultValueMappingResult(), result: defaultValueMappingResult(),
}, },
}); });
// Special value types supported by the `SpecialValueMap` // Special value types supported by the `SpecialValueMap`
export enum SpecialValueMatch { export type SpecialValueMatch = "true" | "false" | "null" | "nan" | "null+nan" | "empty";
True = "true",
False = "false",
Null = "null",
NotANumber = "nan",
NullAndNaN = "null+nan",
Empty = "empty",
}
export const defaultSpecialValueMatch = (): SpecialValueMatch => (SpecialValueMatch.True); export const defaultSpecialValueMatch = (): SpecialValueMatch => ("true");
// Result used as replacement with text and color when the value matches // Result used as replacement with text and color when the value matches
export interface ValueMappingResult { export interface ValueMappingResult {
@ -422,34 +398,14 @@ export const defaultValueMappingResult = (): ValueMappingResult => ({
// `continuous-purples`: Continuous Purple palette mode // `continuous-purples`: Continuous Purple palette mode
// `shades`: Shades of a single color. Specify a single color, useful in an override rule. // `shades`: Shades of a single color. Specify a single color, useful in an override rule.
// `fixed`: Fixed color mode. Specify a single color, useful in an override rule. // `fixed`: Fixed color mode. Specify a single color, useful in an override rule.
export enum FieldColorModeId { export type FieldColorModeId = "thresholds" | "palette-classic" | "palette-classic-by-name" | "continuous-GrYlRd" | "continuous-RdYlGr" | "continuous-BlYlRd" | "continuous-YlRd" | "continuous-BlPu" | "continuous-YlBl" | "continuous-blues" | "continuous-reds" | "continuous-greens" | "continuous-purples" | "fixed" | "shades";
Thresholds = "thresholds",
PaletteClassic = "palette-classic",
PaletteClassicByName = "palette-classic-by-name",
ContinuousGrYlRd = "continuous-GrYlRd",
ContinuousRdYlGr = "continuous-RdYlGr",
ContinuousBlYlRd = "continuous-BlYlRd",
ContinuousYlRd = "continuous-YlRd",
ContinuousBlPu = "continuous-BlPu",
ContinuousYlBl = "continuous-YlBl",
ContinuousBlues = "continuous-blues",
ContinuousReds = "continuous-reds",
ContinuousGreens = "continuous-greens",
ContinuousPurples = "continuous-purples",
Fixed = "fixed",
Shades = "shades",
}
export const defaultFieldColorModeId = (): FieldColorModeId => (FieldColorModeId.Thresholds); export const defaultFieldColorModeId = (): FieldColorModeId => ("thresholds");
// Defines how to assign a series color from "by value" color schemes. For example for an aggregated data points like a timeseries, the color can be assigned by the min, max or last value. // Defines how to assign a series color from "by value" color schemes. For example for an aggregated data points like a timeseries, the color can be assigned by the min, max or last value.
export enum FieldColorSeriesByMode { export type FieldColorSeriesByMode = "min" | "max" | "last";
Min = "min",
Max = "max",
Last = "last",
}
export const defaultFieldColorSeriesByMode = (): FieldColorSeriesByMode => (FieldColorSeriesByMode.Min); export const defaultFieldColorSeriesByMode = (): FieldColorSeriesByMode => ("min");
// Map a field to a color. // Map a field to a color.
export interface FieldColor { export interface FieldColor {
@ -462,16 +418,13 @@ export interface FieldColor {
} }
export const defaultFieldColor = (): FieldColor => ({ export const defaultFieldColor = (): FieldColor => ({
mode: FieldColorModeId.Thresholds, mode: "thresholds",
}); });
// Dashboard Link type. Accepted values are dashboards (to refer to another dashboard) and link (to refer to an external resource) // Dashboard Link type. Accepted values are dashboards (to refer to another dashboard) and link (to refer to an external resource)
export enum DashboardLinkType { export type DashboardLinkType = "link" | "dashboards";
Link = "link",
Dashboards = "dashboards",
}
export const defaultDashboardLinkType = (): DashboardLinkType => (DashboardLinkType.Link); export const defaultDashboardLinkType = (): DashboardLinkType => ("link");
// --- Common types --- // --- Common types ---
export interface Kind { export interface Kind {
@ -790,7 +743,7 @@ export interface CustomFormatterVariable {
export const defaultCustomFormatterVariable = (): CustomFormatterVariable => ({ export const defaultCustomFormatterVariable = (): CustomFormatterVariable => ({
name: "", name: "",
type: VariableType.Query, type: "query",
multi: false, multi: false,
includeAll: false, includeAll: false,
}); });
@ -821,7 +774,7 @@ export const defaultVariableCustomFormatterFn = (): VariableCustomFormatterFn =>
value: {}, value: {},
legacyVariableModel: { legacyVariableModel: {
name: "", name: "",
type: VariableType.Query, type: "query",
multi: false, multi: false,
includeAll: false, includeAll: false,
}, },
@ -836,20 +789,9 @@ export const defaultVariableCustomFormatterFn = (): VariableCustomFormatterFn =>
// `textbox`: Display a free text input field with an optional default value. // `textbox`: Display a free text input field with an optional default value.
// `custom`: Define the variable options manually using a comma-separated list. // `custom`: Define the variable options manually using a comma-separated list.
// `system`: Variables defined by Grafana. See: https://grafana.com/docs/grafana/latest/dashboards/variables/add-template-variables/#global-variables // `system`: Variables defined by Grafana. See: https://grafana.com/docs/grafana/latest/dashboards/variables/add-template-variables/#global-variables
export enum VariableType { export type VariableType = "query" | "adhoc" | "groupby" | "constant" | "datasource" | "interval" | "textbox" | "custom" | "system" | "snapshot";
Query = "query",
Adhoc = "adhoc",
Groupby = "groupby",
Constant = "constant",
Datasource = "datasource",
Interval = "interval",
Textbox = "textbox",
Custom = "custom",
System = "system",
Snapshot = "snapshot",
}
export const defaultVariableType = (): VariableType => (VariableType.Query); export const defaultVariableType = (): VariableType => ("query");
// Sort variable options // Sort variable options
// Accepted values are: // Accepted values are:
@ -863,41 +805,23 @@ export const defaultVariableType = (): VariableType => (VariableType.Query);
// `naturalAsc`: Natural ASC // `naturalAsc`: Natural ASC
// `naturalDesc`: Natural DESC // `naturalDesc`: Natural DESC
// VariableSort enum with default value // VariableSort enum with default value
export enum VariableSort { export type VariableSort = "disabled" | "alphabeticalAsc" | "alphabeticalDesc" | "numericalAsc" | "numericalDesc" | "alphabeticalCaseInsensitiveAsc" | "alphabeticalCaseInsensitiveDesc" | "naturalAsc" | "naturalDesc";
Disabled = "disabled",
AlphabeticalAsc = "alphabeticalAsc",
AlphabeticalDesc = "alphabeticalDesc",
NumericalAsc = "numericalAsc",
NumericalDesc = "numericalDesc",
AlphabeticalCaseInsensitiveAsc = "alphabeticalCaseInsensitiveAsc",
AlphabeticalCaseInsensitiveDesc = "alphabeticalCaseInsensitiveDesc",
NaturalAsc = "naturalAsc",
NaturalDesc = "naturalDesc",
}
export const defaultVariableSort = (): VariableSort => (VariableSort.Disabled); export const defaultVariableSort = (): VariableSort => ("disabled");
// Options to config when to refresh a variable // Options to config when to refresh a variable
// `never`: Never refresh the variable // `never`: Never refresh the variable
// `onDashboardLoad`: Queries the data source every time the dashboard loads. // `onDashboardLoad`: Queries the data source every time the dashboard loads.
// `onTimeRangeChanged`: Queries the data source when the dashboard time range changes. // `onTimeRangeChanged`: Queries the data source when the dashboard time range changes.
export enum VariableRefresh { export type VariableRefresh = "never" | "onDashboardLoad" | "onTimeRangeChanged";
Never = "never",
OnDashboardLoad = "onDashboardLoad",
OnTimeRangeChanged = "onTimeRangeChanged",
}
export const defaultVariableRefresh = (): VariableRefresh => (VariableRefresh.Never); export const defaultVariableRefresh = (): VariableRefresh => ("never");
// Determine if the variable shows on dashboard // Determine if the variable shows on dashboard
// Accepted values are `dontHide` (show label and value), `hideLabel` (show value only), `hideVariable` (show nothing). // Accepted values are `dontHide` (show label and value), `hideLabel` (show value only), `hideVariable` (show nothing).
export enum VariableHide { export type VariableHide = "dontHide" | "hideLabel" | "hideVariable";
DontHide = "dontHide",
HideLabel = "hideLabel",
HideVariable = "hideVariable",
}
export const defaultVariableHide = (): VariableHide => (VariableHide.DontHide); export const defaultVariableHide = (): VariableHide => ("dontHide");
// FIXME: should we introduce this? --- Variable value option // FIXME: should we introduce this? --- Variable value option
export interface VariableValueOption { export interface VariableValueOption {
@ -950,13 +874,13 @@ export interface QueryVariableSpec {
export const defaultQueryVariableSpec = (): QueryVariableSpec => ({ export const defaultQueryVariableSpec = (): QueryVariableSpec => ({
name: "", name: "",
current: { text: "", value: "", }, current: { text: "", value: "", },
hide: VariableHide.DontHide, hide: "dontHide",
refresh: VariableRefresh.Never, refresh: "never",
skipUrlSync: false, skipUrlSync: false,
datasource: defaultDataSourceRef(), datasource: defaultDataSourceRef(),
query: "", query: "",
regex: "", regex: "",
sort: VariableSort.Disabled, sort: "disabled",
options: [], options: [],
multi: false, multi: false,
includeAll: false, includeAll: false,
@ -988,7 +912,7 @@ export const defaultTextVariableSpec = (): TextVariableSpec => ({
name: "", name: "",
current: { text: "", value: "", }, current: { text: "", value: "", },
query: "", query: "",
hide: VariableHide.DontHide, hide: "dontHide",
skipUrlSync: false, skipUrlSync: false,
}); });
@ -1018,7 +942,7 @@ export const defaultConstantVariableSpec = (): ConstantVariableSpec => ({
name: "", name: "",
query: "", query: "",
current: { text: "", value: "", }, current: { text: "", value: "", },
hide: VariableHide.DontHide, hide: "dontHide",
skipUrlSync: false, skipUrlSync: false,
}); });
@ -1054,14 +978,14 @@ export interface DatasourceVariableSpec {
export const defaultDatasourceVariableSpec = (): DatasourceVariableSpec => ({ export const defaultDatasourceVariableSpec = (): DatasourceVariableSpec => ({
name: "", name: "",
pluginId: "", pluginId: "",
refresh: VariableRefresh.Never, refresh: "never",
regex: "", regex: "",
current: { text: "", value: "", }, current: { text: "", value: "", },
defaultOptionEnabled: false, defaultOptionEnabled: false,
options: [], options: [],
multi: false, multi: false,
includeAll: false, includeAll: false,
hide: VariableHide.DontHide, hide: "dontHide",
skipUrlSync: false, skipUrlSync: false,
}); });
@ -1100,8 +1024,8 @@ export const defaultIntervalVariableSpec = (): IntervalVariableSpec => ({
auto: false, auto: false,
auto_min: "", auto_min: "",
auto_count: 0, auto_count: 0,
refresh: VariableRefresh.Never, refresh: "never",
hide: VariableHide.DontHide, hide: "dontHide",
skipUrlSync: false, skipUrlSync: false,
}); });
@ -1138,7 +1062,7 @@ export const defaultCustomVariableSpec = (): CustomVariableSpec => ({
options: [], options: [],
multi: false, multi: false,
includeAll: false, includeAll: false,
hide: VariableHide.DontHide, hide: "dontHide",
skipUrlSync: false, skipUrlSync: false,
}); });
@ -1175,7 +1099,7 @@ export const defaultGroupByVariableSpec = (): GroupByVariableSpec => ({
options: [], options: [],
multi: false, multi: false,
includeAll: false, includeAll: false,
hide: VariableHide.DontHide, hide: "dontHide",
skipUrlSync: false, skipUrlSync: false,
}); });
@ -1209,7 +1133,7 @@ export const defaultAdhocVariableSpec = (): AdhocVariableSpec => ({
baseFilters: [], baseFilters: [],
filters: [], filters: [],
defaultKeys: [], defaultKeys: [],
hide: VariableHide.DontHide, hide: "dontHide",
skipUrlSync: false, skipUrlSync: false,
}); });

@ -1,4 +1,8 @@
package dashboard package v2alpha0
import (
"github.com/grafana/grafana/packages/grafana-schema/src/common"
)
DashboardV2Spec: { DashboardV2Spec: {
// Unique numeric identifier for the dashboard. // Unique numeric identifier for the dashboard.
@ -102,8 +106,6 @@ DataSourceRef: {
uid?: string uid?: string
} }
DataTopic: "alertStates" | "annotations" | "series"
// Transformations allow to manipulate data returned by a query before the system applies a visualization. // Transformations allow to manipulate data returned by a query before the system applies a visualization.
// Using transformations you can: rename fields, join time series data, perform mathematical operations across queries, // Using transformations you can: rename fields, join time series data, perform mathematical operations across queries,
// use the output of one transformation as the input to another transformation, etc. // use the output of one transformation as the input to another transformation, etc.
@ -115,7 +117,7 @@ DataTransformerConfig: {
// Optional frame matcher. When missing it will be applied to all results // Optional frame matcher. When missing it will be applied to all results
filter?: MatcherConfig filter?: MatcherConfig
// Where to pull DataFrames from as input to transformation // Where to pull DataFrames from as input to transformation
topic?: DataTopic topic?: common.DataTopic
// Options to be passed to the transformer // Options to be passed to the transformer
// Valid options depend on the transformer id // Valid options depend on the transformer id
options: _ options: _

@ -1,21 +1,15 @@
import { import { DashboardV2Spec } from './dashboard.gen';
DashboardCursorSync,
DashboardLinkType,
DashboardV2Spec,
VariableHide,
VariableRefresh,
VariableSort,
} from './dashboard.gen';
export const handyTestingSchema: DashboardV2Spec = { export const handyTestingSchema: DashboardV2Spec = {
title: 'Test Dashboard', id: 1,
description: 'Test Description', title: 'Default Dashboard',
description: 'This is a default dashboard',
cursorSync: 'Off',
liveNow: false,
preload: false,
editable: true, editable: true,
preload: true,
schemaVersion: 40, schemaVersion: 40,
tags: ['tag1', 'tag2'], tags: ['tag1', 'tag2'],
liveNow: true,
cursorSync: DashboardCursorSync.Crosshair,
timeSettings: { timeSettings: {
autoRefresh: '5s', autoRefresh: '5s',
autoRefreshIntervals: ['5s', '10s', '30s'], autoRefreshIntervals: ['5s', '10s', '30s'],
@ -132,7 +126,7 @@ export const handyTestingSchema: DashboardV2Spec = {
targetBlank: false, targetBlank: false,
title: 'Test Link', title: 'Test Link',
tooltip: '', tooltip: '',
type: DashboardLinkType.Dashboards, type: 'dashboards',
url: 'http://test.com', url: 'http://test.com',
}, },
], ],
@ -152,17 +146,17 @@ export const handyTestingSchema: DashboardV2Spec = {
}, },
definition: 'definition1', definition: 'definition1',
description: 'A query variable', description: 'A query variable',
hide: VariableHide.DontHide, hide: 'dontHide',
includeAll: true, includeAll: true,
label: 'Query Variable', label: 'Query Variable',
multi: true, multi: true,
name: 'queryVar', name: 'queryVar',
options: [], options: [],
query: 'query1', query: 'query1',
refresh: VariableRefresh.OnDashboardLoad, refresh: 'onDashboardLoad',
regex: 'regex1', regex: 'regex1',
skipUrlSync: false, skipUrlSync: false,
sort: VariableSort.Disabled, sort: 'disabled',
}, },
}, },
{ {
@ -174,7 +168,7 @@ export const handyTestingSchema: DashboardV2Spec = {
value: 'option1', value: 'option1',
}, },
description: 'A custom variable', description: 'A custom variable',
hide: VariableHide.DontHide, hide: 'dontHide',
includeAll: true, includeAll: true,
label: 'Custom Variable', label: 'Custom Variable',
multi: true, multi: true,
@ -205,14 +199,14 @@ export const handyTestingSchema: DashboardV2Spec = {
}, },
defaultOptionEnabled: true, defaultOptionEnabled: true,
description: 'A datasource variable', description: 'A datasource variable',
hide: VariableHide.DontHide, hide: 'dontHide',
includeAll: false, includeAll: false,
label: 'Datasource Variable', label: 'Datasource Variable',
multi: false, multi: false,
name: 'datasourceVar', name: 'datasourceVar',
options: [], options: [],
pluginId: 'datasource1', pluginId: 'datasource1',
refresh: VariableRefresh.OnDashboardLoad, refresh: 'onDashboardLoad',
regex: 'regex1', regex: 'regex1',
skipUrlSync: false, skipUrlSync: false,
}, },
@ -225,7 +219,7 @@ export const handyTestingSchema: DashboardV2Spec = {
value: 'value4', value: 'value4',
}, },
description: 'A constant variable', description: 'A constant variable',
hide: VariableHide.DontHide, hide: 'dontHide',
label: 'Constant Variable', label: 'Constant Variable',
name: 'constantVar', name: 'constantVar',
query: 'value4', query: 'value4',
@ -243,7 +237,7 @@ export const handyTestingSchema: DashboardV2Spec = {
value: '1m', value: '1m',
}, },
description: 'An interval variable', description: 'An interval variable',
hide: VariableHide.DontHide, hide: 'dontHide',
label: 'Interval Variable', label: 'Interval Variable',
name: 'intervalVar', name: 'intervalVar',
options: [ options: [
@ -264,7 +258,7 @@ export const handyTestingSchema: DashboardV2Spec = {
}, },
], ],
query: '1m,5m,10m', query: '1m,5m,10m',
refresh: VariableRefresh.OnDashboardLoad, refresh: 'onDashboardLoad',
skipUrlSync: false, skipUrlSync: false,
}, },
}, },
@ -276,7 +270,7 @@ export const handyTestingSchema: DashboardV2Spec = {
value: 'value6', value: 'value6',
}, },
description: 'A text variable', description: 'A text variable',
hide: VariableHide.DontHide, hide: 'dontHide',
label: 'Text Variable', label: 'Text Variable',
name: 'textVar', name: 'textVar',
query: 'value6', query: 'value6',
@ -295,7 +289,7 @@ export const handyTestingSchema: DashboardV2Spec = {
uid: 'datasource2', uid: 'datasource2',
}, },
description: 'A group by variable', description: 'A group by variable',
hide: VariableHide.DontHide, hide: 'dontHide',
includeAll: false, includeAll: false,
label: 'Group By Variable', label: 'Group By Variable',
multi: false, multi: false,
@ -351,7 +345,7 @@ export const handyTestingSchema: DashboardV2Spec = {
value: 'value3', value: 'value3',
}, },
], ],
hide: VariableHide.DontHide, hide: 'dontHide',
label: 'Adhoc Variable', label: 'Adhoc Variable',
name: 'adhocVar', name: 'adhocVar',
skipUrlSync: false, skipUrlSync: false,

@ -134,17 +134,17 @@ require (
go.opentelemetry.io/proto/otlp v1.3.1 // indirect go.opentelemetry.io/proto/otlp v1.3.1 // indirect
go.uber.org/multierr v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect go.uber.org/zap v1.27.0 // indirect
golang.org/x/crypto v0.28.0 // indirect golang.org/x/crypto v0.29.0 // indirect
golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e // indirect golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e // indirect
golang.org/x/mod v0.21.0 // indirect golang.org/x/mod v0.22.0 // indirect
golang.org/x/net v0.30.0 // indirect golang.org/x/net v0.31.0 // indirect
golang.org/x/oauth2 v0.23.0 // indirect golang.org/x/oauth2 v0.23.0 // indirect
golang.org/x/sync v0.9.0 // indirect golang.org/x/sync v0.9.0 // indirect
golang.org/x/sys v0.27.0 // indirect golang.org/x/sys v0.27.0 // indirect
golang.org/x/term v0.25.0 // indirect golang.org/x/term v0.26.0 // indirect
golang.org/x/text v0.20.0 // indirect golang.org/x/text v0.20.0 // indirect
golang.org/x/time v0.6.0 // indirect golang.org/x/time v0.6.0 // indirect
golang.org/x/tools v0.26.0 // indirect golang.org/x/tools v0.27.0 // indirect
golang.org/x/xerrors v0.0.0-20240716161551-93cc26a95ae9 // indirect golang.org/x/xerrors v0.0.0-20240716161551-93cc26a95ae9 // indirect
gonum.org/v1/gonum v0.15.1 // indirect gonum.org/v1/gonum v0.15.1 // indirect
google.golang.org/genproto v0.0.0-20240820151423-278611b39280 // indirect google.golang.org/genproto v0.0.0-20240820151423-278611b39280 // indirect

@ -381,8 +381,8 @@ go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ=
golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e h1:I88y4caeGeuDQxgdoFPUq097j7kNfw6uvuiNxUBfcBk= golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e h1:I88y4caeGeuDQxgdoFPUq097j7kNfw6uvuiNxUBfcBk=
golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ= golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ=
@ -392,8 +392,8 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4=
golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@ -403,8 +403,8 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo=
golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= golang.org/x/net v0.31.0/go.mod h1:P4fl1q7dY2hnZFxEk4pPSkDHF+QqjitcnDjUQyMM+pM=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs=
golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
@ -433,8 +433,8 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s= golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s=
golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24= golang.org/x/term v0.26.0 h1:WEQa6V3Gja/BhNxg540hBip/kkaYtRg3cxg4oXSw4AU=
golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M= golang.org/x/term v0.26.0/go.mod h1:Si5m1o57C5nBNQo5z1iq+XDijt21BDBDp2bK0QI8e3E=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug= golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug=
@ -452,8 +452,8 @@ golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtn
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= golang.org/x/tools v0.27.0 h1:qEKojBykQkQ4EynWy4S8Weg69NumxKdn40Fce3uc/8o=
golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/tools v0.27.0/go.mod h1:sUi0ZgbwW9ZPAq26Ekut+weQPR5eIM6GQLQ1Yjm1H0Q=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

@ -35,8 +35,8 @@ require (
github.com/x448/float16 v0.8.4 // indirect github.com/x448/float16 v0.8.4 // indirect
go.opentelemetry.io/otel v1.32.0 // indirect go.opentelemetry.io/otel v1.32.0 // indirect
go.opentelemetry.io/otel/trace v1.32.0 // indirect go.opentelemetry.io/otel/trace v1.32.0 // indirect
golang.org/x/crypto v0.28.0 // indirect golang.org/x/crypto v0.29.0 // indirect
golang.org/x/net v0.30.0 // indirect golang.org/x/net v0.31.0 // indirect
golang.org/x/sync v0.9.0 // indirect golang.org/x/sync v0.9.0 // indirect
golang.org/x/sys v0.27.0 // indirect golang.org/x/sys v0.27.0 // indirect
golang.org/x/text v0.20.0 // indirect golang.org/x/text v0.20.0 // indirect

@ -77,8 +77,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ=
golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
@ -91,8 +91,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo=
golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= golang.org/x/net v0.31.0/go.mod h1:P4fl1q7dY2hnZFxEk4pPSkDHF+QqjitcnDjUQyMM+pM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=

@ -78,13 +78,13 @@ require (
go.uber.org/multierr v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect go.uber.org/zap v1.27.0 // indirect
golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e // indirect golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e // indirect
golang.org/x/net v0.30.0 // indirect golang.org/x/net v0.31.0 // indirect
golang.org/x/oauth2 v0.23.0 // indirect golang.org/x/oauth2 v0.23.0 // indirect
golang.org/x/sys v0.27.0 // indirect golang.org/x/sys v0.27.0 // indirect
golang.org/x/term v0.25.0 // indirect golang.org/x/term v0.26.0 // indirect
golang.org/x/text v0.20.0 // indirect golang.org/x/text v0.20.0 // indirect
golang.org/x/time v0.6.0 // indirect golang.org/x/time v0.6.0 // indirect
golang.org/x/tools v0.26.0 // indirect golang.org/x/tools v0.27.0 // indirect
google.golang.org/genproto v0.0.0-20240820151423-278611b39280 // indirect google.golang.org/genproto v0.0.0-20240820151423-278611b39280 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 // indirect

@ -221,8 +221,8 @@ go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ=
golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e h1:I88y4caeGeuDQxgdoFPUq097j7kNfw6uvuiNxUBfcBk= golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e h1:I88y4caeGeuDQxgdoFPUq097j7kNfw6uvuiNxUBfcBk=
golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ= golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ=
@ -241,8 +241,8 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo=
golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= golang.org/x/net v0.31.0/go.mod h1:P4fl1q7dY2hnZFxEk4pPSkDHF+QqjitcnDjUQyMM+pM=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs=
golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
@ -259,8 +259,8 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s= golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s=
golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24= golang.org/x/term v0.26.0 h1:WEQa6V3Gja/BhNxg540hBip/kkaYtRg3cxg4oXSw4AU=
golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M= golang.org/x/term v0.26.0/go.mod h1:Si5m1o57C5nBNQo5z1iq+XDijt21BDBDp2bK0QI8e3E=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug= golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug=
@ -277,8 +277,8 @@ golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtn
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= golang.org/x/tools v0.27.0 h1:qEKojBykQkQ4EynWy4S8Weg69NumxKdn40Fce3uc/8o=
golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/tools v0.27.0/go.mod h1:sUi0ZgbwW9ZPAq26Ekut+weQPR5eIM6GQLQ1Yjm1H0Q=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

@ -35,9 +35,9 @@ require (
go.opentelemetry.io/otel v1.32.0 // indirect; @grafana/grafana-backend-group go.opentelemetry.io/otel v1.32.0 // indirect; @grafana/grafana-backend-group
go.opentelemetry.io/otel/sdk v1.32.0 // indirect; @grafana/grafana-backend-group go.opentelemetry.io/otel/sdk v1.32.0 // indirect; @grafana/grafana-backend-group
go.opentelemetry.io/otel/trace v1.32.0 // indirect; @grafana/grafana-backend-group go.opentelemetry.io/otel/trace v1.32.0 // indirect; @grafana/grafana-backend-group
golang.org/x/crypto v0.28.0 // indirect; @grafana/grafana-backend-group golang.org/x/crypto v0.29.0 // indirect; @grafana/grafana-backend-group
golang.org/x/mod v0.21.0 // @grafana/grafana-backend-group golang.org/x/mod v0.22.0 // @grafana/grafana-backend-group
golang.org/x/net v0.30.0 // indirect; @grafana/oss-big-tent @grafana/partner-datasources golang.org/x/net v0.31.0 // indirect; @grafana/oss-big-tent @grafana/partner-datasources
golang.org/x/oauth2 v0.23.0 // @grafana/identity-access-team golang.org/x/oauth2 v0.23.0 // @grafana/identity-access-team
golang.org/x/sync v0.9.0 // indirect; @grafana/alerting-backend golang.org/x/sync v0.9.0 // indirect; @grafana/alerting-backend
golang.org/x/text v0.20.0 // indirect; @grafana/grafana-backend-group golang.org/x/text v0.20.0 // indirect; @grafana/grafana-backend-group

@ -262,8 +262,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk
golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ=
golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e h1:I88y4caeGeuDQxgdoFPUq097j7kNfw6uvuiNxUBfcBk= golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e h1:I88y4caeGeuDQxgdoFPUq097j7kNfw6uvuiNxUBfcBk=
golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ= golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ=
@ -272,8 +272,8 @@ golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvx
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4=
golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@ -283,8 +283,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo=
golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= golang.org/x/net v0.31.0/go.mod h1:P4fl1q7dY2hnZFxEk4pPSkDHF+QqjitcnDjUQyMM+pM=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs=
golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=

@ -6,10 +6,10 @@ require (
github.com/google/go-cmp v0.6.0 github.com/google/go-cmp v0.6.0
github.com/google/subcommands v1.2.0 github.com/google/subcommands v1.2.0
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2
golang.org/x/tools v0.26.0 golang.org/x/tools v0.27.0
) )
require ( require (
golang.org/x/mod v0.21.0 // indirect golang.org/x/mod v0.22.0 // indirect
golang.org/x/sync v0.9.0 // indirect golang.org/x/sync v0.9.0 // indirect
) )

@ -4,9 +4,9 @@ github.com/google/subcommands v1.2.0 h1:vWQspBTo2nEqTUFita5/KeEWlUL8kQObDFbub/EN
github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4=
golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ= golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ=
golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= golang.org/x/tools v0.27.0 h1:qEKojBykQkQ4EynWy4S8Weg69NumxKdn40Fce3uc/8o=
golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/tools v0.27.0/go.mod h1:sUi0ZgbwW9ZPAq26Ekut+weQPR5eIM6GQLQ1Yjm1H0Q=

@ -111,12 +111,12 @@ require (
go.opentelemetry.io/proto/otlp v1.3.1 // indirect go.opentelemetry.io/proto/otlp v1.3.1 // indirect
go.uber.org/atomic v1.11.0 // indirect go.uber.org/atomic v1.11.0 // indirect
go.uber.org/goleak v1.3.0 // indirect go.uber.org/goleak v1.3.0 // indirect
golang.org/x/mod v0.21.0 // indirect golang.org/x/mod v0.22.0 // indirect
golang.org/x/net v0.30.0 // indirect golang.org/x/net v0.31.0 // indirect
golang.org/x/sync v0.9.0 // indirect golang.org/x/sync v0.9.0 // indirect
golang.org/x/sys v0.27.0 // indirect golang.org/x/sys v0.27.0 // indirect
golang.org/x/text v0.20.0 // indirect golang.org/x/text v0.20.0 // indirect
golang.org/x/tools v0.26.0 // indirect golang.org/x/tools v0.27.0 // indirect
golang.org/x/xerrors v0.0.0-20240716161551-93cc26a95ae9 // indirect golang.org/x/xerrors v0.0.0-20240716161551-93cc26a95ae9 // indirect
gonum.org/v1/gonum v0.15.1 // indirect gonum.org/v1/gonum v0.15.1 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 // indirect

@ -297,15 +297,15 @@ golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e h1:I88y4caeGeuDQxgdoFPUq097j
golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ= golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4=
golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo=
golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= golang.org/x/net v0.31.0/go.mod h1:P4fl1q7dY2hnZFxEk4pPSkDHF+QqjitcnDjUQyMM+pM=
golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs=
golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@ -337,8 +337,8 @@ golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= golang.org/x/tools v0.27.0 h1:qEKojBykQkQ4EynWy4S8Weg69NumxKdn40Fce3uc/8o=
golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/tools v0.27.0/go.mod h1:sUi0ZgbwW9ZPAq26Ekut+weQPR5eIM6GQLQ1Yjm1H0Q=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

@ -1131,8 +1131,8 @@ func TestFoldersGetAPIEndpointK8S(t *testing.T) {
}, },
expectedCode: http.StatusOK, expectedCode: http.StatusOK,
expectedOutput: []dtos.FolderSearchHit{ expectedOutput: []dtos.FolderSearchHit{
dtos.FolderSearchHit{UID: "foo", Title: "Folder 1"}, {UID: "foo", Title: "Folder 1"},
dtos.FolderSearchHit{UID: "qux", Title: "Folder 3"}, {UID: "qux", Title: "Folder 3"},
}, },
permissions: folderReadAndCreatePermission, permissions: folderReadAndCreatePermission,
}, },
@ -1146,7 +1146,7 @@ func TestFoldersGetAPIEndpointK8S(t *testing.T) {
params: "?parentUid=foo", params: "?parentUid=foo",
expectedCode: http.StatusOK, expectedCode: http.StatusOK,
expectedOutput: []dtos.FolderSearchHit{ expectedOutput: []dtos.FolderSearchHit{
dtos.FolderSearchHit{UID: "bar", Title: "Folder 2", ParentUID: "foo"}, {UID: "bar", Title: "Folder 2", ParentUID: "foo"},
}, },
permissions: folderReadAndCreatePermission, permissions: folderReadAndCreatePermission,
}, },

@ -18,7 +18,6 @@ import {
GroupByVariableKind, GroupByVariableKind,
defaultVariableHide, defaultVariableHide,
VariableOption, VariableOption,
VariableRefresh,
} from '@grafana/schema/dist/esm/schema/dashboard/v2alpha0/dashboard.gen'; } from '@grafana/schema/dist/esm/schema/dashboard/v2alpha0/dashboard.gen';
import { getIntervalsQueryFromNewIntervalModel } from '../utils/utils'; import { getIntervalsQueryFromNewIntervalModel } from '../utils/utils';
@ -53,7 +52,7 @@ export function sceneVariablesSetToVariables(set: SceneVariables, keepQueryOptio
let options: VariableOption[] = []; let options: VariableOption[] = [];
// Not sure if we actually have to still support this option given // Not sure if we actually have to still support this option given
// that it's not exposed in the UI // that it's not exposed in the UI
if (transformVariableRefreshToEnum(variable.state.refresh) === VariableRefresh.Never || keepQueryOptions) { if (transformVariableRefreshToEnum(variable.state.refresh) === 'never' || keepQueryOptions) {
options = variableValueOptionsToVariableOptions(variable.state); options = variableValueOptionsToVariableOptions(variable.state);
} }
variables.push({ variables.push({
@ -269,7 +268,7 @@ export function sceneVariablesSetToSchemaV2Variables(
if (sceneUtils.isQueryVariable(variable)) { if (sceneUtils.isQueryVariable(variable)) {
// Not sure if we actually have to still support this option given // Not sure if we actually have to still support this option given
// that it's not exposed in the UI // that it's not exposed in the UI
if (transformVariableRefreshToEnum(variable.state.refresh) === VariableRefresh.Never || keepQueryOptions) { if (transformVariableRefreshToEnum(variable.state.refresh) === 'never' || keepQueryOptions) {
options = variableValueOptionsToVariableOptions(variable.state); options = variableValueOptionsToVariableOptions(variable.state);
} }
//query: DataQueryKind | string; //query: DataQueryKind | string;
@ -325,7 +324,7 @@ export function sceneVariablesSetToSchemaV2Variables(
current: currentVariableOption, current: currentVariableOption,
options: [], options: [],
regex: variable.state.regex, regex: variable.state.regex,
refresh: VariableRefresh.OnDashboardLoad, refresh: 'onDashboardLoad',
pluginId: variable.state.pluginId, pluginId: variable.state.pluginId,
defaultOptionEnabled: !!variable.state.defaultOptionEnabled, defaultOptionEnabled: !!variable.state.defaultOptionEnabled,
multi: variable.state.isMulti || false, multi: variable.state.isMulti || false,
@ -361,7 +360,7 @@ export function sceneVariablesSetToSchemaV2Variables(
text: variable.state.value, text: variable.state.value,
}, },
query: intervals, query: intervals,
refresh: VariableRefresh.OnTimeRangeChanged, refresh: 'onTimeRangeChanged',
options: variable.state.intervals.map((interval) => ({ options: variable.state.intervals.map((interval) => ({
value: interval, value: interval,
text: interval, text: interval,

@ -53,7 +53,7 @@ describe('transformSaveModelSchemaV2ToScene', () => {
expect(scene.state.title).toEqual(dash.title); expect(scene.state.title).toEqual(dash.title);
expect(scene.state.description).toEqual(dash.description); expect(scene.state.description).toEqual(dash.description);
expect(scene.state.editable).toEqual(dash.editable); expect(scene.state.editable).toEqual(dash.editable);
expect(scene.state.preload).toEqual(true); expect(scene.state.preload).toEqual(false);
expect(scene.state.version).toEqual(dash.schemaVersion); expect(scene.state.version).toEqual(dash.schemaVersion);
expect(scene.state.tags).toEqual(dash.tags); expect(scene.state.tags).toEqual(dash.tags);

@ -78,7 +78,7 @@ import { registerPanelInteractionsReporter } from './transformSaveModelToScene';
import { import {
transformCursorSyncV2ToV1, transformCursorSyncV2ToV1,
transformSortVariableToEnumV1, transformSortVariableToEnumV1,
transformValueMappingsToV1, transformMappingsToV1,
transformVariableHideToEnumV1, transformVariableHideToEnumV1,
transformVariableRefreshToEnumV1, transformVariableRefreshToEnumV1,
} from './transformToV1TypesUtils'; } from './transformToV1TypesUtils';
@ -233,7 +233,7 @@ function buildVizPanel(panel: PanelKind): VizPanel {
description: panel.spec.description, description: panel.spec.description,
pluginId: panel.spec.vizConfig.kind, pluginId: panel.spec.vizConfig.kind,
options: panel.spec.vizConfig.spec.options, options: panel.spec.vizConfig.spec.options,
fieldConfig: transformValueMappingsToV1(panel.spec.vizConfig.spec.fieldConfig), fieldConfig: transformMappingsToV1(panel.spec.vizConfig.spec.fieldConfig),
pluginVersion: panel.spec.vizConfig.spec.pluginVersion, pluginVersion: panel.spec.vizConfig.spec.pluginVersion,
// FIXME: Transparent is not added to the schema yet // FIXME: Transparent is not added to the schema yet
// displayMode: panel.spec.transparent ? 'transparent' : undefined, // displayMode: panel.spec.transparent ? 'transparent' : undefined,

@ -8,7 +8,6 @@ import {
TransformationKind, TransformationKind,
FieldConfigSource, FieldConfigSource,
DashboardLink, DashboardLink,
DashboardCursorSync,
DataTransformerConfig, DataTransformerConfig,
PanelQuerySpec, PanelQuerySpec,
DataQueryKind, DataQueryKind,
@ -34,7 +33,7 @@ import { dashboardSceneGraph } from '../utils/dashboardSceneGraph';
import { getQueryRunnerFor } from '../utils/utils'; import { getQueryRunnerFor } from '../utils/utils';
import { sceneVariablesSetToSchemaV2Variables } from './sceneVariablesSetToVariables'; import { sceneVariablesSetToSchemaV2Variables } from './sceneVariablesSetToVariables';
import { transformDashboardLinksToEnums, transformCursorSynctoEnum } from './transformToV2TypesUtils'; import { transformCursorSynctoEnum } from './transformToV2TypesUtils';
// FIXME: This is temporary to avoid creating partial types for all the new schema, it has some performance implications, but it's fine for now // FIXME: This is temporary to avoid creating partial types for all the new schema, it has some performance implications, but it's fine for now
type DeepPartial<T> = T extends object type DeepPartial<T> = T extends object
@ -58,7 +57,7 @@ export function transformSceneToSaveModelSchemaV2(scene: DashboardScene, isSnaps
liveNow: getLiveNow(oldDash), liveNow: getLiveNow(oldDash),
preload: oldDash.preload, preload: oldDash.preload,
editable: oldDash.editable, editable: oldDash.editable,
links: transformDashboardLinksToEnums(oldDash.links), links: oldDash.links,
tags: oldDash.tags, tags: oldDash.tags,
schemaVersion: DASHBOARD_SCHEMA_VERSION, schemaVersion: DASHBOARD_SCHEMA_VERSION,
// EOF dashboard settings // EOF dashboard settings
@ -385,9 +384,6 @@ function isDashboardSchemaV2(dash: any): dash is DashboardV2Spec {
if (typeof dash.cursorSync !== 'string') { if (typeof dash.cursorSync !== 'string') {
return false; return false;
} }
if (!Object.values(DashboardCursorSync).includes(dash.cursorSync)) {
return false;
}
if (typeof dash.liveNow !== 'boolean') { if (typeof dash.liveNow !== 'boolean') {
return false; return false;
} }

@ -5,24 +5,26 @@ import {
VariableSort as VariableSortV1, VariableSort as VariableSortV1,
DashboardCursorSync as DashboardCursorSyncV1, DashboardCursorSync as DashboardCursorSyncV1,
defaultDashboardCursorSync, defaultDashboardCursorSync,
MappingType as MappingTypeV1,
ThresholdsMode as ThresholdsModeV1,
} from '@grafana/schema'; } from '@grafana/schema';
import { import {
DashboardCursorSync, DashboardCursorSync,
MappingType,
VariableHide, VariableHide,
VariableRefresh, VariableRefresh,
VariableSort, VariableSort,
FieldConfigSource, FieldConfigSource,
SpecialValueMatch, SpecialValueMatch,
ThresholdsMode,
} from '@grafana/schema/dist/esm/schema/dashboard/v2alpha0/dashboard.gen'; } from '@grafana/schema/dist/esm/schema/dashboard/v2alpha0/dashboard.gen';
export function transformVariableRefreshToEnumV1(refresh?: VariableRefresh): VariableRefreshV1 { export function transformVariableRefreshToEnumV1(refresh?: VariableRefresh): VariableRefreshV1 {
switch (refresh) { switch (refresh) {
case VariableRefresh.Never: case 'never':
return VariableRefreshV1.never; return VariableRefreshV1.never;
case VariableRefresh.OnDashboardLoad: case 'onDashboardLoad':
return VariableRefreshV1.onDashboardLoad; return VariableRefreshV1.onDashboardLoad;
case VariableRefresh.OnTimeRangeChanged: case 'onTimeRangeChanged':
return VariableRefreshV1.onTimeRangeChanged; return VariableRefreshV1.onTimeRangeChanged;
default: default:
return VariableRefreshV1.never; return VariableRefreshV1.never;
@ -31,11 +33,11 @@ export function transformVariableRefreshToEnumV1(refresh?: VariableRefresh): Var
export function transformVariableHideToEnumV1(hide?: VariableHide): VariableHideV1 { export function transformVariableHideToEnumV1(hide?: VariableHide): VariableHideV1 {
switch (hide) { switch (hide) {
case VariableHide.DontHide: case 'dontHide':
return VariableHideV1.dontHide; return VariableHideV1.dontHide;
case VariableHide.HideLabel: case 'hideLabel':
return VariableHideV1.hideLabel; return VariableHideV1.hideLabel;
case VariableHide.HideVariable: case 'hideVariable':
return VariableHideV1.hideVariable; return VariableHideV1.hideVariable;
default: default:
return VariableHideV1.dontHide; return VariableHideV1.dontHide;
@ -44,15 +46,23 @@ export function transformVariableHideToEnumV1(hide?: VariableHide): VariableHide
export function transformSortVariableToEnumV1(sort?: VariableSort): VariableSortV1 { export function transformSortVariableToEnumV1(sort?: VariableSort): VariableSortV1 {
switch (sort) { switch (sort) {
case VariableSort.Disabled: case 'disabled':
return VariableSortV1.disabled; return VariableSortV1.disabled;
case VariableSort.NumericalAsc: case 'numericalAsc':
return VariableSortV1.numericalAsc; return VariableSortV1.numericalAsc;
case VariableSort.NumericalDesc: case 'alphabeticalCaseInsensitiveAsc':
return VariableSortV1.alphabeticalCaseInsensitiveAsc;
case 'alphabeticalCaseInsensitiveDesc':
return VariableSortV1.alphabeticalCaseInsensitiveDesc;
case 'numericalDesc':
return VariableSortV1.numericalDesc; return VariableSortV1.numericalDesc;
case VariableSort.AlphabeticalAsc: case 'naturalAsc':
return VariableSortV1.naturalAsc;
case 'naturalDesc':
return VariableSortV1.naturalDesc;
case 'alphabeticalAsc':
return VariableSortV1.alphabeticalAsc; return VariableSortV1.alphabeticalAsc;
case VariableSort.AlphabeticalDesc: case 'alphabeticalDesc':
return VariableSortV1.alphabeticalDesc; return VariableSortV1.alphabeticalDesc;
default: default:
return VariableSortV1.disabled; return VariableSortV1.disabled;
@ -61,11 +71,11 @@ export function transformSortVariableToEnumV1(sort?: VariableSort): VariableSort
export function transformCursorSyncV2ToV1(cursorSync: DashboardCursorSync): DashboardCursorSyncV1 { export function transformCursorSyncV2ToV1(cursorSync: DashboardCursorSync): DashboardCursorSyncV1 {
switch (cursorSync) { switch (cursorSync) {
case DashboardCursorSync.Crosshair: case 'Crosshair':
return DashboardCursorSyncV1.Crosshair; return DashboardCursorSyncV1.Crosshair;
case DashboardCursorSync.Tooltip: case 'Tooltip':
return DashboardCursorSyncV1.Tooltip; return DashboardCursorSyncV1.Tooltip;
case DashboardCursorSync.Off: case 'Off':
return DashboardCursorSyncV1.Off; return DashboardCursorSyncV1.Off;
default: default:
return defaultDashboardCursorSync; return defaultDashboardCursorSync;
@ -74,24 +84,35 @@ export function transformCursorSyncV2ToV1(cursorSync: DashboardCursorSync): Dash
function transformSpecialValueMatchToV1(match: SpecialValueMatch): SpecialValueMatchV1 { function transformSpecialValueMatchToV1(match: SpecialValueMatch): SpecialValueMatchV1 {
switch (match) { switch (match) {
case SpecialValueMatch.True: case 'true':
return SpecialValueMatchV1.True; return SpecialValueMatchV1.True;
case SpecialValueMatch.False: case 'false':
return SpecialValueMatchV1.False; return SpecialValueMatchV1.False;
case SpecialValueMatch.Null: case 'null':
return SpecialValueMatchV1.Null; return SpecialValueMatchV1.Null;
case SpecialValueMatch.NotANumber: case 'nan':
return SpecialValueMatchV1.NaN; return SpecialValueMatchV1.NaN;
case SpecialValueMatch.NullAndNaN: case 'null+nan':
return SpecialValueMatchV1.NullAndNaN; return SpecialValueMatchV1.NullAndNaN;
case SpecialValueMatch.Empty: case 'empty':
return SpecialValueMatchV1.Empty; return SpecialValueMatchV1.Empty;
default: default:
throw new Error(`Unknown match type: ${match}`); throw new Error(`Unknown match type: ${match}`);
} }
} }
export function transformValueMappingsToV1(fieldConfig: FieldConfigSource): FieldConfigSourceV1 { export function transformMappingsToV1(fieldConfig: FieldConfigSource): FieldConfigSourceV1 {
const getThresholdsMode = (mode: ThresholdsMode): ThresholdsModeV1 => {
switch (mode) {
case 'absolute':
return ThresholdsModeV1.Absolute;
case 'percentage':
return ThresholdsModeV1.Percentage;
default:
return ThresholdsModeV1.Absolute;
}
};
return { return {
...fieldConfig, ...fieldConfig,
defaults: { defaults: {
@ -101,17 +122,17 @@ export function transformValueMappingsToV1(fieldConfig: FieldConfigSource): Fiel
case 'value': case 'value':
return { return {
...mapping, ...mapping,
type: MappingType.ValueToText, type: MappingTypeV1.ValueToText,
}; };
case 'range': case 'range':
return { return {
...mapping, ...mapping,
type: MappingType.RangeToText, type: MappingTypeV1.RangeToText,
}; };
case 'regex': case 'regex':
return { return {
...mapping, ...mapping,
type: MappingType.RegexToText, type: MappingTypeV1.RegexToText,
}; };
case 'special': case 'special':
return { return {
@ -120,12 +141,16 @@ export function transformValueMappingsToV1(fieldConfig: FieldConfigSource): Fiel
...mapping.options, ...mapping.options,
match: transformSpecialValueMatchToV1(mapping.options.match), match: transformSpecialValueMatchToV1(mapping.options.match),
}, },
type: MappingType.SpecialValue, type: MappingTypeV1.SpecialValue,
}; };
default: default:
return mapping; return mapping;
} }
}), }),
thresholds: fieldConfig.defaults.thresholds && {
...fieldConfig.defaults.thresholds,
mode: getThresholdsMode(fieldConfig.defaults.thresholds.mode),
},
}, },
}; };
} }

@ -1,20 +1,12 @@
import { DashboardLink as DashboardLinkTypeV1 } from '@grafana/schema';
import { import {
DashboardCursorSync,
DashboardLinkType,
VariableRefresh,
VariableHide,
VariableSort,
defaultVariableHide, defaultVariableHide,
defaultVariableSort, defaultVariableSort,
defaultVariableRefresh, defaultVariableRefresh,
defaultDashboardLinkType,
defaultDashboardCursorSync, defaultDashboardCursorSync,
} from '@grafana/schema/dist/esm/schema/dashboard/v2alpha0/dashboard.gen'; } from '@grafana/schema/dist/esm/schema/dashboard/v2alpha0/dashboard.gen';
import { import {
transformCursorSynctoEnum, transformCursorSynctoEnum,
transformDashboardLinksToEnums,
transformVariableRefreshToEnum, transformVariableRefreshToEnum,
transformVariableHideToEnum, transformVariableHideToEnum,
transformSortVariableToEnum, transformSortVariableToEnum,
@ -23,86 +15,39 @@ import {
describe('transformToV2TypesUtils', () => { describe('transformToV2TypesUtils', () => {
describe('transformCursorSynctoEnum', () => { describe('transformCursorSynctoEnum', () => {
it('should return the correct enum value for cursor sync', () => { it('should return the correct enum value for cursor sync', () => {
expect(transformCursorSynctoEnum(0)).toBe(DashboardCursorSync.Off); expect(transformCursorSynctoEnum(0)).toBe('Off');
expect(transformCursorSynctoEnum(1)).toBe(DashboardCursorSync.Crosshair); expect(transformCursorSynctoEnum(1)).toBe('Crosshair');
expect(transformCursorSynctoEnum(2)).toBe(DashboardCursorSync.Tooltip); expect(transformCursorSynctoEnum(2)).toBe('Tooltip');
expect(transformCursorSynctoEnum(undefined)).toBe(defaultDashboardCursorSync()); expect(transformCursorSynctoEnum(undefined)).toBe(defaultDashboardCursorSync());
}); });
}); });
describe('transformDashboardLinksToEnums', () => {
const links: DashboardLinkTypeV1[] = [
{
type: 'link',
asDropdown: false,
icon: '',
includeVars: false,
keepTime: false,
tags: [],
title: '',
url: '',
targetBlank: false,
tooltip: '',
},
{
type: 'dashboards',
asDropdown: false,
icon: '',
includeVars: false,
keepTime: false,
tags: [],
title: '',
url: '',
targetBlank: false,
tooltip: '',
},
{
// @ts-expect-error Testing invalid type
type: 'non-valid-type',
asDropdown: false,
icon: '',
includeVars: false,
keepTime: false,
tags: [],
title: '',
url: '',
targetBlank: false,
tooltip: '',
},
];
const transformedLinks = transformDashboardLinksToEnums(links);
expect(transformedLinks[0].type).toBe(DashboardLinkType.Link);
expect(transformedLinks[1].type).toBe(DashboardLinkType.Dashboards);
expect(transformedLinks[2].type).toBe(defaultDashboardLinkType());
});
}); });
describe('transformVariableRefreshToEnum', () => { describe('transformVariableRefreshToEnum', () => {
it('should return the correct enum value for variable refresh', () => { it('should return the correct enum value for variable refresh', () => {
expect(transformVariableRefreshToEnum(0)).toBe(VariableRefresh.Never); expect(transformVariableRefreshToEnum(0)).toBe('never');
expect(transformVariableRefreshToEnum(1)).toBe(VariableRefresh.OnDashboardLoad); expect(transformVariableRefreshToEnum(1)).toBe('onDashboardLoad');
expect(transformVariableRefreshToEnum(2)).toBe(VariableRefresh.OnTimeRangeChanged); expect(transformVariableRefreshToEnum(2)).toBe('onTimeRangeChanged');
expect(transformVariableRefreshToEnum(undefined)).toBe(defaultVariableRefresh()); expect(transformVariableRefreshToEnum(undefined)).toBe(defaultVariableRefresh());
}); });
}); });
describe('transformVariableHideToEnum', () => { describe('transformVariableHideToEnum', () => {
it('should return the correct enum value for variable hide', () => { it('should return the correct enum value for variable hide', () => {
expect(transformVariableHideToEnum(0)).toBe(VariableHide.DontHide); expect(transformVariableHideToEnum(0)).toBe('dontHide');
expect(transformVariableHideToEnum(1)).toBe(VariableHide.HideLabel); expect(transformVariableHideToEnum(1)).toBe('hideLabel');
expect(transformVariableHideToEnum(2)).toBe(VariableHide.HideVariable); expect(transformVariableHideToEnum(2)).toBe('hideVariable');
expect(transformVariableHideToEnum(undefined)).toBe(defaultVariableHide()); expect(transformVariableHideToEnum(undefined)).toBe(defaultVariableHide());
}); });
}); });
describe('transformSortVariableToEnum', () => { describe('transformSortVariableToEnum', () => {
it('should return the correct enum value for variable sort', () => { it('should return the correct enum value for variable sort', () => {
expect(transformSortVariableToEnum(0)).toBe(VariableSort.Disabled); expect(transformSortVariableToEnum(0)).toBe('disabled');
expect(transformSortVariableToEnum(1)).toBe(VariableSort.AlphabeticalAsc); expect(transformSortVariableToEnum(1)).toBe('alphabeticalAsc');
expect(transformSortVariableToEnum(2)).toBe(VariableSort.AlphabeticalDesc); expect(transformSortVariableToEnum(2)).toBe('alphabeticalDesc');
expect(transformSortVariableToEnum(3)).toBe(VariableSort.NumericalAsc); expect(transformSortVariableToEnum(3)).toBe('numericalAsc');
expect(transformSortVariableToEnum(4)).toBe(VariableSort.NumericalDesc); expect(transformSortVariableToEnum(4)).toBe('numericalDesc');
expect(transformSortVariableToEnum(undefined)).toBe(defaultVariableSort()); expect(transformSortVariableToEnum(undefined)).toBe(defaultVariableSort());
}); });
}); });

@ -1,65 +1,41 @@
import { import {
DashboardLink as DashboardLinkV1,
VariableHide as VariableHideV1, VariableHide as VariableHideV1,
VariableRefresh as VariableRefreshV1, VariableRefresh as VariableRefreshV1,
VariableSort as VariableSortV1, VariableSort as VariableSortV1,
DashboardCursorSync as DashboardCursorSyncV1, DashboardCursorSync as DashboardCursorSyncV1,
DashboardLinkType as DashboardLinkTypeV1,
} from '@grafana/schema'; } from '@grafana/schema';
import { import {
DashboardCursorSync, DashboardCursorSync,
defaultDashboardV2Spec, defaultDashboardV2Spec,
DashboardLinkType,
DashboardLink,
defaultVariableHide, defaultVariableHide,
defaultVariableRefresh, defaultVariableRefresh,
defaultVariableSort, defaultVariableSort,
VariableHide, VariableHide,
VariableRefresh, VariableRefresh,
VariableSort, VariableSort,
defaultDashboardLinkType,
} from '@grafana/schema/dist/esm/schema/dashboard/v2alpha0/dashboard.gen'; } from '@grafana/schema/dist/esm/schema/dashboard/v2alpha0/dashboard.gen';
export function transformCursorSynctoEnum(cursorSync?: DashboardCursorSyncV1): DashboardCursorSync { export function transformCursorSynctoEnum(cursorSync?: DashboardCursorSyncV1): DashboardCursorSync {
switch (cursorSync) { switch (cursorSync) {
case 0: case 0:
return DashboardCursorSync.Off; return 'Off';
case 1: case 1:
return DashboardCursorSync.Crosshair; return 'Crosshair';
case 2: case 2:
return DashboardCursorSync.Tooltip; return 'Tooltip';
default: default:
return defaultDashboardV2Spec().cursorSync; return defaultDashboardV2Spec().cursorSync;
} }
} }
function transformDashboardLinkTypeToEnum(linkType: DashboardLinkTypeV1): DashboardLinkType {
switch (linkType) {
case 'link':
return DashboardLinkType.Link;
case 'dashboards':
return DashboardLinkType.Dashboards;
default:
return defaultDashboardLinkType();
}
}
export function transformDashboardLinksToEnums(links: DashboardLinkV1[]): DashboardLink[] {
return links.map((link) => {
return {
...link,
type: transformDashboardLinkTypeToEnum(link.type),
};
});
}
export function transformVariableRefreshToEnum(refresh?: VariableRefreshV1): VariableRefresh { export function transformVariableRefreshToEnum(refresh?: VariableRefreshV1): VariableRefresh {
switch (refresh) { switch (refresh) {
case 0: case 0:
return VariableRefresh.Never; return 'never';
case 1: case 1:
return VariableRefresh.OnDashboardLoad; return 'onDashboardLoad';
case 2: case 2:
return VariableRefresh.OnTimeRangeChanged; return 'onTimeRangeChanged';
default: default:
return defaultVariableRefresh(); return defaultVariableRefresh();
} }
@ -67,11 +43,11 @@ export function transformVariableRefreshToEnum(refresh?: VariableRefreshV1): Var
export function transformVariableHideToEnum(hide?: VariableHideV1): VariableHide { export function transformVariableHideToEnum(hide?: VariableHideV1): VariableHide {
switch (hide) { switch (hide) {
case 0: case 0:
return VariableHide.DontHide; return 'dontHide';
case 1: case 1:
return VariableHide.HideLabel; return 'hideLabel';
case 2: case 2:
return VariableHide.HideVariable; return 'hideVariable';
default: default:
return defaultVariableHide(); return defaultVariableHide();
} }
@ -79,15 +55,15 @@ export function transformVariableHideToEnum(hide?: VariableHideV1): VariableHide
export function transformSortVariableToEnum(sort?: VariableSortV1): VariableSort { export function transformSortVariableToEnum(sort?: VariableSortV1): VariableSort {
switch (sort) { switch (sort) {
case 0: case 0:
return VariableSort.Disabled; return 'disabled';
case 1: case 1:
return VariableSort.AlphabeticalAsc; return 'alphabeticalAsc';
case 2: case 2:
return VariableSort.AlphabeticalDesc; return 'alphabeticalDesc';
case 3: case 3:
return VariableSort.NumericalAsc; return 'numericalAsc';
case 4: case 4:
return VariableSort.NumericalDesc; return 'numericalDesc';
default: default:
return defaultVariableSort(); return defaultVariableSort();
} }

Loading…
Cancel
Save