FeatureToggles: remove open type declaration (#64645)

This commit is contained in:
Ryan McKinley 2023-03-14 10:47:32 -07:00 committed by GitHub
parent 85e5326040
commit 6751a93d49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 17 additions and 15 deletions

View File

@ -767,7 +767,8 @@ exports[`better eslint`] = {
"packages/grafana-runtime/src/config.ts:5381": [
[0, 0, 0, "Do not use any type assertions.", "0"],
[0, 0, 0, "Do not use any type assertions.", "1"],
[0, 0, 0, "Unexpected any. Specify a different type.", "2"]
[0, 0, 0, "Do not use any type assertions.", "2"],
[0, 0, 0, "Unexpected any. Specify a different type.", "3"]
],
"packages/grafana-runtime/src/services/AngularLoader.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],

View File

@ -9,13 +9,15 @@
* conf/custom.ini to enable features under development or not yet available in
* stable version.
*
* Only enabled values will be returned in this interface
* Only enabled values will be returned in this interface.
*
* NOTE: the possible values may change between versions without notice, although
* this may cause compilation issues when depending on removed feature keys, the
* runtime state will continue to work.
*
* @public
*/
export interface FeatureToggles {
[name: string]: boolean | undefined; // support any string value
alertingBigTransactions?: boolean;
trimDefaults?: boolean;
disableEnvelopeEncryption?: boolean;

View File

@ -230,10 +230,11 @@ function overrideFeatureTogglesFromUrl(config: GrafanaBootConfig) {
const params = new URLSearchParams(window.location.search);
params.forEach((value, key) => {
if (key.startsWith('__feature.')) {
const featureToggles = config.featureToggles as Record<string, boolean>;
const featureName = key.substring(10);
const toggleState = value === 'true';
if (toggleState !== config.featureToggles[key]) {
config.featureToggles[featureName] = toggleState;
if (toggleState !== featureToggles[key]) {
featureToggles[featureName] = toggleState;
console.log(`Setting feature toggle ${featureName} = ${toggleState}`);
}
}

View File

@ -22,4 +22,5 @@ const (
hostedGrafanaTeam codeowner = "@grafana/hosted-grafana-team"
awsPluginsSquad codeowner = "@grafana/aws-plugins"
appO11ySquad codeowner = "@grafana/app-o11y"
grafanaPartnerPluginsSquad codeowner = "@grafana/partner-plugins"
)

View File

@ -128,13 +128,15 @@ func generateTypeScript() string {
* conf/custom.ini to enable features under development or not yet available in
* stable version.
*
* Only enabled values will be returned in this interface
* Only enabled values will be returned in this interface.
*
* NOTE: the possible values may change between versions without notice, although
* this may cause compilation issues when depending on removed feature keys, the
* runtime state will continue to work.
*
* @public
*/
export interface FeatureToggles {
[name: string]: boolean | undefined; // support any string value
`
for _, flag := range standardFeatureFlags {
buf += " " + getTypeScriptKey(flag.Name) + "?: boolean;\n"

View File

@ -1,5 +1,3 @@
import { config } from '@grafana/runtime';
import { isGUIDish } from './components/ResourcePicker/utils';
import DataSource from './datasource';
import { AzureMonitorQuery, AzureQueryType } from './types';
@ -321,10 +319,7 @@ export const migrateQuery = async (
): Promise<AzureMonitorQuery> => {
let query = await migrateStringQueriesToObjectQueries(rawQuery, options);
if (
!config.featureToggles.azLegacyTemplateVariables &&
query.queryType === AzureQueryType.GrafanaTemplateVariableFn
) {
if (query.queryType === AzureQueryType.GrafanaTemplateVariableFn) {
query = migrateGrafanaTemplateVariableFn(query);
}