From 5a831d877ac3305e7dfdb54057069b41b36b40fa Mon Sep 17 00:00:00 2001 From: Isabella Siu Date: Mon, 12 Jun 2023 09:49:52 -0400 Subject: [PATCH] CloudWatch Logs: add monaco editor feature flag and types (#69871) --- .../configure-grafana/feature-toggles/index.md | 1 + .../grafana-data/src/types/featureToggles.gen.ts | 1 + pkg/services/featuremgmt/registry.go | 7 +++++++ pkg/services/featuremgmt/toggles_gen.csv | 1 + pkg/services/featuremgmt/toggles_gen.go | 4 ++++ .../cloudwatch/language/logs/completion/types.ts | 15 +++++++++++++++ 6 files changed, 29 insertions(+) create mode 100644 public/app/plugins/datasource/cloudwatch/language/logs/completion/types.ts diff --git a/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md b/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md index fd810c83abb..69e2b33293a 100644 --- a/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md +++ b/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md @@ -113,6 +113,7 @@ Experimental features might be changed or removed without prior notice. | `extraThemes` | Enables extra themes | | `lokiPredefinedOperations` | Adds predefined query operations to Loki query editor | | `pluginsFrontendSandbox` | Enables the plugins frontend sandbox | +| `cloudWatchLogsMonacoEditor` | Enables the Monaco editor for CloudWatch Logs queries | ## Development feature toggles diff --git a/packages/grafana-data/src/types/featureToggles.gen.ts b/packages/grafana-data/src/types/featureToggles.gen.ts index ffe63a8b450..8906db1f56e 100644 --- a/packages/grafana-data/src/types/featureToggles.gen.ts +++ b/packages/grafana-data/src/types/featureToggles.gen.ts @@ -100,4 +100,5 @@ export interface FeatureToggles { lokiPredefinedOperations?: boolean; pluginsFrontendSandbox?: boolean; sqlDatasourceDatabaseSelection?: boolean; + cloudWatchLogsMonacoEditor?: boolean; } diff --git a/pkg/services/featuremgmt/registry.go b/pkg/services/featuremgmt/registry.go index b8a9574ee59..016257089a1 100644 --- a/pkg/services/featuremgmt/registry.go +++ b/pkg/services/featuremgmt/registry.go @@ -557,5 +557,12 @@ var ( Stage: FeatureStagePublicPreview, Owner: grafanaBiSquad, }, + { + Name: "cloudWatchLogsMonacoEditor", + Description: "Enables the Monaco editor for CloudWatch Logs queries", + Stage: FeatureStageExperimental, + FrontendOnly: true, + Owner: awsPluginsSquad, + }, } ) diff --git a/pkg/services/featuremgmt/toggles_gen.csv b/pkg/services/featuremgmt/toggles_gen.csv index 477d97abf24..0a0a942d055 100644 --- a/pkg/services/featuremgmt/toggles_gen.csv +++ b/pkg/services/featuremgmt/toggles_gen.csv @@ -81,3 +81,4 @@ extraThemes,experimental,@grafana/grafana-frontend-platform,false,false,false,tr lokiPredefinedOperations,experimental,@grafana/observability-logs,false,false,false,true pluginsFrontendSandbox,experimental,@grafana/plugins-platform-backend,false,false,false,true sqlDatasourceDatabaseSelection,preview,@grafana/grafana-bi-squad,false,false,false,true +cloudWatchLogsMonacoEditor,experimental,@grafana/aws-plugins,false,false,false,true diff --git a/pkg/services/featuremgmt/toggles_gen.go b/pkg/services/featuremgmt/toggles_gen.go index 795ffef0377..b5a319a1d2a 100644 --- a/pkg/services/featuremgmt/toggles_gen.go +++ b/pkg/services/featuremgmt/toggles_gen.go @@ -334,4 +334,8 @@ const ( // FlagSqlDatasourceDatabaseSelection // Enables previous SQL data source dataset dropdown behavior FlagSqlDatasourceDatabaseSelection = "sqlDatasourceDatabaseSelection" + + // FlagCloudWatchLogsMonacoEditor + // Enables the Monaco editor for CloudWatch Logs queries + FlagCloudWatchLogsMonacoEditor = "cloudWatchLogsMonacoEditor" ) diff --git a/public/app/plugins/datasource/cloudwatch/language/logs/completion/types.ts b/public/app/plugins/datasource/cloudwatch/language/logs/completion/types.ts new file mode 100644 index 00000000000..58534242044 --- /dev/null +++ b/public/app/plugins/datasource/cloudwatch/language/logs/completion/types.ts @@ -0,0 +1,15 @@ +import { TokenTypes } from '../../monarch/types'; + +export const LogsTokenTypes: TokenTypes = { + Parenthesis: 'delimiter.parenthesis.cloudwatch-logs', + Whitespace: 'white.cloudwatch-logs', + Keyword: 'keyword.cloudwatch-logs', + Delimiter: 'delimiter.cloudwatch-logs', + Operator: 'operator.cloudwatch-logs', + Identifier: 'identifier.cloudwatch-logs', + Type: 'type.cloudwatch-logs', + Function: 'predefined.cloudwatch-logs', + Number: 'number.cloudwatch-logs', + String: 'string.cloudwatch-logs', + Variable: 'variable.cloudwatch-logs', +};