mirror of
https://github.com/grafana/grafana.git
synced 2025-02-13 00:55:47 -06:00
* noImplicitAny playlist approx 200 * Add AngularPanelMenuItem interface * Roughly 100 noImplicitAny
26 lines
653 B
TypeScript
26 lines
653 B
TypeScript
import { getBackendSrv } from 'app/core/services/backend_srv';
|
|
import { PluginMeta } from '@grafana/ui';
|
|
|
|
type PluginCache = {
|
|
[key: string]: PluginMeta;
|
|
};
|
|
|
|
const pluginInfoCache: PluginCache = {};
|
|
|
|
export function getPluginSettings(pluginId: string): Promise<PluginMeta> {
|
|
const v = pluginInfoCache[pluginId];
|
|
if (v) {
|
|
return Promise.resolve(v);
|
|
}
|
|
return getBackendSrv()
|
|
.get(`/api/plugins/${pluginId}/settings`)
|
|
.then((settings: any) => {
|
|
pluginInfoCache[pluginId] = settings;
|
|
return settings;
|
|
})
|
|
.catch((err: any) => {
|
|
// err.isHandled = true;
|
|
return Promise.reject('Unknown Plugin');
|
|
});
|
|
}
|