Chore: Change so we cache loading plugins by its version (#41367)

* making it possible to cache plugins based on the version.

* feat(plugincache): introduce function to invalidate entries

* removed todo's

* added tests for the cache buster.

* fixed tests.

* fixed failing tests.

Co-authored-by: Jack Westbrook <jack.westbrook@gmail.com>
This commit is contained in:
Marcus Andersson
2021-11-10 11:54:58 +01:00
committed by GitHub
co-authored by Jack Westbrook
parent baab021fec
commit e5421dd53e
10 changed files with 138 additions and 21 deletions
+11 -1
View File
@@ -80,6 +80,16 @@ export interface SentryConfig {
sampleRate: number;
}
/**
* Describes the plugins that should be preloaded prior to start Grafana.
*
* @public
*/
export type PreloadPlugin = {
path: string;
version: string;
};
/**
* Describes all the different Grafana configuration values available for an instance.
*
@@ -123,7 +133,7 @@ export interface GrafanaConfig {
liveEnabled: boolean;
theme: GrafanaTheme;
theme2: GrafanaTheme2;
pluginsToPreload: string[];
pluginsToPreload: PreloadPlugin[];
featureToggles: FeatureToggles;
licenseInfo: LicenseInfo;
http2Enabled: boolean;
+1 -1
View File
@@ -36,6 +36,6 @@ export * from './live';
export * from './variables';
export * from './geometry';
export { isUnsignedPluginSignature } from './pluginSignature';
export { GrafanaConfig, BuildInfo, FeatureToggles, LicenseInfo } from './config';
export { GrafanaConfig, BuildInfo, FeatureToggles, LicenseInfo, PreloadPlugin } from './config';
export * from './alerts';
export * from './slider';
+2 -1
View File
@@ -10,6 +10,7 @@ import {
LicenseInfo,
MapLayerOptions,
PanelPluginMeta,
PreloadPlugin,
systemDateFormats,
SystemDateFormatSettings,
} from '@grafana/data';
@@ -59,7 +60,7 @@ export class GrafanaBootConfig implements GrafanaConfig {
liveEnabled = true;
theme: GrafanaTheme;
theme2: GrafanaTheme2;
pluginsToPreload: string[] = [];
pluginsToPreload: PreloadPlugin[] = [];
featureToggles: FeatureToggles = {
accesscontrol: false,
trimDefaults: false,