Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
8ce509f3
Unverified
Commit
8ce509f3
authored
Aug 26, 2019
by
Ryan McKinley
Committed by
GitHub
Aug 26, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Plugins: show a clear error on the plugin page when it failed to load (#18733)
parent
e83f55f3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
5 deletions
+24
-5
packages/grafana-ui/src/types/plugin.ts
+3
-0
public/app/features/dashboard/dashgrid/PanelPluginError.tsx
+3
-2
public/app/features/plugins/PluginPage.tsx
+18
-3
No files found.
packages/grafana-ui/src/types/plugin.ts
View file @
8ce509f3
...
...
@@ -124,6 +124,9 @@ export class GrafanaPlugin<T extends PluginMeta = PluginMeta> {
// Meta is filled in by the plugin loading system
meta
?:
T
;
// This is set if the plugin system had errors loading the plugin
loadError
?:
boolean
;
// Config control (app/datasource)
angularConfigCtrl
?:
any
;
...
...
public/app/features/dashboard/dashgrid/PanelPluginError.tsx
View file @
8ce509f3
...
...
@@ -36,7 +36,7 @@ class PanelPluginError extends PureComponent<Props> {
}
export
function
getPanelPluginLoadError
(
meta
:
PanelPluginMeta
,
err
:
any
):
PanelPlugin
{
const
NotFound
=
class
NotFound
extends
PureComponent
<
PanelProps
>
{
const
LoadError
=
class
LoadError
extends
PureComponent
<
PanelProps
>
{
render
()
{
const
text
=
(
<>
...
...
@@ -47,8 +47,9 @@ export function getPanelPluginLoadError(meta: PanelPluginMeta, err: any): PanelP
return
<
PanelPluginError
title=
{
`Error loading: ${meta.id}`
}
text=
{
text
}
/>;
}
};
const
plugin
=
new
PanelPlugin
(
NotFound
);
const
plugin
=
new
PanelPlugin
(
LoadError
);
plugin
.
meta
=
meta
;
plugin
.
loadError
=
true
;
return
plugin
;
}
...
...
public/app/features/plugins/PluginPage.tsx
View file @
8ce509f3
...
...
@@ -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"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment