QueryField: Handle autocomplete better (#81484)

* extract out function + add unit tests

* add feature toggle and default it to on
This commit is contained in:
Ashley Harrison
2024-01-31 10:01:20 +00:00
committed by GitHub
parent f896072cd7
commit 39057552dc
8 changed files with 118 additions and 8 deletions
+9
View File
@@ -1320,5 +1320,14 @@ var (
Owner: grafanaObservabilityMetricsSquad,
Created: time.Date(2024, time.January, 29, 0, 0, 0, 0, time.UTC),
},
{
Name: "slateAutocomplete",
Description: "Adjusts the behaviour of the slate editor to properly handle autocomplete. Feature toggled for safety.",
Stage: FeatureStageGeneralAvailability,
Expression: "true", // enabled by default
FrontendOnly: true,
Owner: grafanaFrontendPlatformSquad,
Created: time.Date(2024, time.January, 29, 12, 0, 0, 0, time.UTC),
},
}
)
+1
View File
@@ -155,3 +155,4 @@ jitterAlertRulesWithinGroups,preview,@grafana/alerting-squad,2024-01-17,false,tr
onPremToCloudMigrations,experimental,@grafana/grafana-operator-experience-squad,2024-01-22,false,false,false
alertingSaveStatePeriodic,privatePreview,@grafana/alerting-squad,2024-01-22,false,false,false
promQLScope,experimental,@grafana/observability-metrics,2024-01-29,false,false,false
slateAutocomplete,GA,@grafana/grafana-frontend-platform,2024-01-29,false,false,true
1 Name Stage Owner Created requiresDevMode RequiresRestart FrontendOnly
155 onPremToCloudMigrations experimental @grafana/grafana-operator-experience-squad 2024-01-22 false false false
156 alertingSaveStatePeriodic privatePreview @grafana/alerting-squad 2024-01-22 false false false
157 promQLScope experimental @grafana/observability-metrics 2024-01-29 false false false
158 slateAutocomplete GA @grafana/grafana-frontend-platform 2024-01-29 false false true
+4
View File
@@ -630,4 +630,8 @@ const (
// FlagPromQLScope
// In-development feature that will allow injection of labels into prometheus queries.
FlagPromQLScope = "promQLScope"
// FlagSlateAutocomplete
// Adjusts the behaviour of the slate editor to properly handle autocomplete. Feature toggled for safety.
FlagSlateAutocomplete = "slateAutocomplete"
)
@@ -239,7 +239,7 @@ func TestSchedulableAlertRulesRegistry(t *testing.T) {
assert.Len(t, rules, 0)
assert.Len(t, folders, 0)
expectedFolders := map[models.FolderKey]string{models.FolderKey{OrgID: 1, UID: "test-uid"}: "test-title"}
expectedFolders := map[models.FolderKey]string{{OrgID: 1, UID: "test-uid"}: "test-title"}
// replace all rules in the registry with foo
r.set([]*models.AlertRule{{OrgID: 1, UID: "foo", Version: 1}}, expectedFolders)
rules, folders = r.all()