mirror of
https://github.com/grafana/grafana.git
synced 2025-07-30 16:43:07 +08:00
Plugins: avoid app importDashboards() NPE (#18128)
* tables display * add missing file * adding toolbar option * adding toolbar option * add items to index * use root import path * merge master * show tables info * add importDashboards code * remove table changes * remove table changes * use deprecation warning
This commit is contained in:
@ -37,15 +37,11 @@ export class ConfigCtrl {
|
|||||||
|
|
||||||
postUpdate() {
|
postUpdate() {
|
||||||
if (!this.appModel.enabled) {
|
if (!this.appModel.enabled) {
|
||||||
return this.$q.resolve();
|
return;
|
||||||
}
|
}
|
||||||
return this.appEditCtrl.importDashboards().then(() => {
|
|
||||||
this.enabled = true;
|
// TODO, whatever you want
|
||||||
return {
|
console.log('Post Update:', this);
|
||||||
url: "plugins/raintank-kubernetes-app/page/clusters",
|
|
||||||
message: "Kubernetes App enabled!"
|
|
||||||
};
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ConfigCtrl.templateUrl = 'components/config/config.html';
|
ConfigCtrl.templateUrl = 'components/config/config.html';
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
export const deprecationWarning = (file: string, oldName: string, newName: string) => {
|
export const deprecationWarning = (file: string, oldName: string, newName?: string) => {
|
||||||
const message = `[Deprecation warning] ${file}: ${oldName} is deprecated. Use ${newName} instead`;
|
let message = `[Deprecation warning] ${file}: ${oldName} is deprecated`;
|
||||||
|
if (newName) {
|
||||||
|
message += `. Use ${newName} instead`;
|
||||||
|
}
|
||||||
console.warn(message);
|
console.warn(message);
|
||||||
};
|
};
|
||||||
|
@ -3,7 +3,7 @@ import React, { PureComponent } from 'react';
|
|||||||
import cloneDeep from 'lodash/cloneDeep';
|
import cloneDeep from 'lodash/cloneDeep';
|
||||||
import extend from 'lodash/extend';
|
import extend from 'lodash/extend';
|
||||||
|
|
||||||
import { PluginMeta, AppPlugin, Button } from '@grafana/ui';
|
import { PluginMeta, AppPlugin, Button, deprecationWarning } from '@grafana/ui';
|
||||||
|
|
||||||
import { AngularComponent, getAngularLoader } from '@grafana/runtime';
|
import { AngularComponent, getAngularLoader } from '@grafana/runtime';
|
||||||
import { getBackendSrv } from 'app/core/services/backend_srv';
|
import { getBackendSrv } from 'app/core/services/backend_srv';
|
||||||
@ -124,6 +124,12 @@ export class AppConfigCtrlWrapper extends PureComponent<Props, State> {
|
|||||||
this.postUpdateHook = callback;
|
this.postUpdateHook = callback;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Stub to avoid unknown function in legacy code
|
||||||
|
importDashboards = (): Promise<void> => {
|
||||||
|
deprecationWarning('AppConfig', 'importDashboards()');
|
||||||
|
return Promise.resolve();
|
||||||
|
};
|
||||||
|
|
||||||
enable = () => {
|
enable = () => {
|
||||||
this.model.enabled = true;
|
this.model.enabled = true;
|
||||||
this.model.pinned = true;
|
this.model.pinned = true;
|
||||||
|
Reference in New Issue
Block a user