mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Plugins: show a clear error on the plugin page when it failed to load (#18733)
This commit is contained in:
@@ -6,7 +6,7 @@ import find from 'lodash/find';
|
||||
|
||||
// Types
|
||||
import { UrlQueryMap } from '@grafana/runtime';
|
||||
import { StoreState } from 'app/types';
|
||||
import { StoreState, AppNotificationSeverity } from 'app/types';
|
||||
import {
|
||||
PluginType,
|
||||
GrafanaPlugin,
|
||||
@@ -30,6 +30,7 @@ import { PluginDashboards } from './PluginDashboards';
|
||||
import { appEvents } from 'app/core/core';
|
||||
import { config } from 'app/core/config';
|
||||
import { ContextSrv } from '../../core/services/context_srv';
|
||||
import { AlertBox } from 'app/core/components/AlertBox/AlertBox';
|
||||
|
||||
export function getLoadingNav(): NavModel {
|
||||
const node = {
|
||||
@@ -140,7 +141,7 @@ class PluginPage extends PureComponent<Props, State> {
|
||||
const { plugin, nav } = this.state;
|
||||
|
||||
if (!plugin) {
|
||||
return <div>Plugin not found.</div>;
|
||||
return <AlertBox severity={AppNotificationSeverity.Error} title="Plugin Not Found" />;
|
||||
}
|
||||
|
||||
const active = nav.main.children.find(tab => tab.active);
|
||||
@@ -297,7 +298,21 @@ class PluginPage extends PureComponent<Props, State> {
|
||||
<Page.Contents isLoading={loading}>
|
||||
{!loading && (
|
||||
<div className="sidebar-container">
|
||||
<div className="sidebar-content">{this.renderBody()}</div>
|
||||
<div className="sidebar-content">
|
||||
{plugin.loadError && (
|
||||
<AlertBox
|
||||
severity={AppNotificationSeverity.Error}
|
||||
title="Error Loading Plugin"
|
||||
body={
|
||||
<>
|
||||
Check the server startup logs for more information. <br />
|
||||
If this plugin was loaded from git, make sure it was compiled.
|
||||
</>
|
||||
}
|
||||
/>
|
||||
)}
|
||||
{this.renderBody()}
|
||||
</div>
|
||||
<aside className="page-sidebar">
|
||||
{plugin && (
|
||||
<section className="page-sidebar-section">
|
||||
|
||||
Reference in New Issue
Block a user