Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugins: Fix routing in app plugin pages #21847

Merged
merged 1 commit into from
Jan 30, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 11 additions & 8 deletions public/app/features/plugins/plugin_page_ctrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { PluginMeta } from '@grafana/data';
import { NavModelSrv } from 'app/core/core';
import { GrafanaRootScope } from 'app/routes/GrafanaCtrl';
import { AppEvents } from '@grafana/data';
import { promiseToDigest } from '../../core/utils/promiseToDigest';

export class AppPageCtrl {
page: any;
Expand All @@ -17,14 +18,16 @@ export class AppPageCtrl {
constructor(private $routeParams: any, private $rootScope: GrafanaRootScope, private navModelSrv: NavModelSrv) {
this.pluginId = $routeParams.pluginId;

Promise.resolve(getPluginSettings(this.pluginId))
.then(settings => {
this.initPage(settings);
})
.catch(err => {
this.$rootScope.appEvent(AppEvents.alertError, ['Unknown Plugin']);
this.navModel = this.navModelSrv.getNotFoundNav();
});
promiseToDigest($rootScope)(
Promise.resolve(getPluginSettings(this.pluginId))
.then(settings => {
this.initPage(settings);
})
.catch(err => {
this.$rootScope.appEvent(AppEvents.alertError, ['Unknown Plugin']);
this.navModel = this.navModelSrv.getNotFoundNav();
})
);
}

initPage(app: PluginMeta) {
Expand Down