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
60ea9907
Commit
60ea9907
authored
Dec 19, 2018
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Panel help view fixes
parent
9fec2026
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
23 additions
and
49 deletions
+23
-49
pkg/api/plugins.go
+8
-0
pkg/plugins/datasource_plugin.go
+0
-12
public/app/core/components/PluginHelp/PluginHelp.tsx
+8
-21
public/app/features/dashboard/dashgrid/QueriesTab.tsx
+1
-3
public/app/features/dashboard/dashgrid/VisualizationTab.tsx
+2
-8
public/app/plugins/panel/graph/README.md
+4
-5
No files found.
pkg/api/plugins.go
View file @
60ea9907
...
@@ -164,6 +164,14 @@ func GetPluginMarkdown(c *m.ReqContext) Response {
...
@@ -164,6 +164,14 @@ func GetPluginMarkdown(c *m.ReqContext) Response {
return
Error
(
500
,
"Could not get markdown file"
,
err
)
return
Error
(
500
,
"Could not get markdown file"
,
err
)
}
}
// fallback try readme
if
len
(
content
)
==
0
{
content
,
err
=
plugins
.
GetPluginMarkdown
(
pluginID
,
"readme"
)
if
err
!=
nil
{
return
Error
(
501
,
"Could not get markdown file"
,
err
)
}
}
resp
:=
Respond
(
200
,
content
)
resp
:=
Respond
(
200
,
content
)
resp
.
Header
(
"Content-Type"
,
"text/plain; charset=utf-8"
)
resp
.
Header
(
"Content-Type"
,
"text/plain; charset=utf-8"
)
return
resp
return
resp
...
...
pkg/plugins/datasource_plugin.go
View file @
60ea9907
...
@@ -3,10 +3,8 @@ package plugins
...
@@ -3,10 +3,8 @@ package plugins
import
(
import
(
"context"
"context"
"encoding/json"
"encoding/json"
"os"
"os/exec"
"os/exec"
"path"
"path"
"path/filepath"
"time"
"time"
"github.com/grafana/grafana-plugin-model/go/datasource"
"github.com/grafana/grafana-plugin-model/go/datasource"
...
@@ -29,7 +27,6 @@ type DataSourcePlugin struct {
...
@@ -29,7 +27,6 @@ type DataSourcePlugin struct {
QueryOptions
map
[
string
]
bool
`json:"queryOptions,omitempty"`
QueryOptions
map
[
string
]
bool
`json:"queryOptions,omitempty"`
BuiltIn
bool
`json:"builtIn,omitempty"`
BuiltIn
bool
`json:"builtIn,omitempty"`
Mixed
bool
`json:"mixed,omitempty"`
Mixed
bool
`json:"mixed,omitempty"`
HasQueryHelp
bool
`json:"hasQueryHelp,omitempty"`
Routes
[]
*
AppPluginRoute
`json:"routes"`
Routes
[]
*
AppPluginRoute
`json:"routes"`
Backend
bool
`json:"backend,omitempty"`
Backend
bool
`json:"backend,omitempty"`
...
@@ -48,15 +45,6 @@ func (p *DataSourcePlugin) Load(decoder *json.Decoder, pluginDir string) error {
...
@@ -48,15 +45,6 @@ func (p *DataSourcePlugin) Load(decoder *json.Decoder, pluginDir string) error {
return
err
return
err
}
}
// look for help markdown
helpPath
:=
filepath
.
Join
(
p
.
PluginDir
,
"QUERY_HELP.md"
)
if
_
,
err
:=
os
.
Stat
(
helpPath
);
os
.
IsNotExist
(
err
)
{
helpPath
=
filepath
.
Join
(
p
.
PluginDir
,
"query_help.md"
)
}
if
_
,
err
:=
os
.
Stat
(
helpPath
);
err
==
nil
{
p
.
HasQueryHelp
=
true
}
DataSources
[
p
.
Id
]
=
p
DataSources
[
p
.
Id
]
=
p
return
nil
return
nil
}
}
...
...
public/app/core/components/P
anel
Help/PluginHelp.tsx
→
public/app/core/components/P
lugin
Help/PluginHelp.tsx
View file @
60ea9907
import
React
,
{
PureComponent
}
from
'react'
;
import
React
,
{
PureComponent
}
from
'react'
;
import
Remarkable
from
'remarkable'
;
import
Remarkable
from
'remarkable'
;
import
{
getBackendSrv
}
from
'../../services/backend_srv'
;
import
{
getBackendSrv
}
from
'../../services/backend_srv'
;
import
{
PluginMeta
}
from
'app/types'
;
interface
Props
{
interface
Props
{
plugin
:
PluginMeta
;
plugin
:
{
name
:
string
;
id
:
string
;
};
type
:
string
;
type
:
string
;
}
}
...
@@ -14,7 +16,7 @@ interface State {
...
@@ -14,7 +16,7 @@ interface State {
help
:
string
;
help
:
string
;
}
}
export
default
class
PluginHelp
extends
PureComponent
<
Props
,
State
>
{
export
class
PluginHelp
extends
PureComponent
<
Props
,
State
>
{
state
=
{
state
=
{
isError
:
false
,
isError
:
false
,
isLoading
:
false
,
isLoading
:
false
,
...
@@ -25,24 +27,9 @@ export default class PluginHelp extends PureComponent<Props, State> {
...
@@ -25,24 +27,9 @@ export default class PluginHelp extends PureComponent<Props, State> {
this
.
loadHelp
();
this
.
loadHelp
();
}
}
constructPlaceholderInfo
=
()
=>
{
constructPlaceholderInfo
()
{
const
{
plugin
}
=
this
.
props
;
return
'No plugin help or readme markdown file was found'
;
const
markdown
=
new
Remarkable
();
}
const
fallBack
=
markdown
.
render
(
`##
${
plugin
.
name
}
\n by _
${
plugin
.
info
.
author
.
name
}
(<
${
plugin
.
info
.
author
.
url
}
>)_\n\n
${
plugin
.
info
.
description
}
\n\n
${
plugin
.
info
.
links
?
`### Links \n
${
plugin
.
info
.
links
.
map
(
link
=>
{
return
`
${
link
.
name
}
: <
${
link
.
url
}
>\n`
;
})}
`
: ''
}`
);
return
fallBack
;
};
loadHelp
=
()
=>
{
loadHelp
=
()
=>
{
const
{
plugin
,
type
}
=
this
.
props
;
const
{
plugin
,
type
}
=
this
.
props
;
...
...
public/app/features/dashboard/dashgrid/QueriesTab.tsx
View file @
60ea9907
...
@@ -21,7 +21,7 @@ import config from 'app/core/config';
...
@@ -21,7 +21,7 @@ import config from 'app/core/config';
import
{
PanelModel
}
from
'../panel_model'
;
import
{
PanelModel
}
from
'../panel_model'
;
import
{
DashboardModel
}
from
'../dashboard_model'
;
import
{
DashboardModel
}
from
'../dashboard_model'
;
import
{
DataSourceSelectItem
,
DataQuery
}
from
'app/types'
;
import
{
DataSourceSelectItem
,
DataQuery
}
from
'app/types'
;
import
PluginHelp
from
'../../../core/components/Panel
Help/PluginHelp'
;
import
{
PluginHelp
}
from
'app/core/components/Plugin
Help/PluginHelp'
;
interface
Props
{
interface
Props
{
panel
:
PanelModel
;
panel
:
PanelModel
;
...
@@ -203,7 +203,6 @@ export class QueriesTab extends PureComponent<Props, State> {
...
@@ -203,7 +203,6 @@ export class QueriesTab extends PureComponent<Props, State> {
render
()
{
render
()
{
const
{
panel
}
=
this
.
props
;
const
{
panel
}
=
this
.
props
;
const
{
currentDS
,
isAddingMixed
}
=
this
.
state
;
const
{
currentDS
,
isAddingMixed
}
=
this
.
state
;
const
{
hasQueryHelp
}
=
currentDS
.
meta
;
const
queryInspector
=
{
const
queryInspector
=
{
title
:
'Query Inspector'
,
title
:
'Query Inspector'
,
...
@@ -213,7 +212,6 @@ export class QueriesTab extends PureComponent<Props, State> {
...
@@ -213,7 +212,6 @@ export class QueriesTab extends PureComponent<Props, State> {
const
dsHelp
=
{
const
dsHelp
=
{
heading
:
'Help'
,
heading
:
'Help'
,
icon
:
'fa fa-question'
,
icon
:
'fa fa-question'
,
disabled
:
!
hasQueryHelp
,
render
:
this
.
renderHelp
,
render
:
this
.
renderHelp
,
};
};
...
...
public/app/features/dashboard/dashgrid/VisualizationTab.tsx
View file @
60ea9907
...
@@ -3,12 +3,11 @@ import React, { PureComponent } from 'react';
...
@@ -3,12 +3,11 @@ import React, { PureComponent } from 'react';
// Utils & Services
// Utils & Services
import
{
getAngularLoader
,
AngularComponent
}
from
'app/core/services/AngularLoader'
;
import
{
getAngularLoader
,
AngularComponent
}
from
'app/core/services/AngularLoader'
;
import
{
getDatasourceSrv
}
from
'../../plugins/datasource_srv'
;
// Components
// Components
import
{
EditorTabBody
}
from
'./EditorTabBody'
;
import
{
EditorTabBody
}
from
'./EditorTabBody'
;
import
{
VizTypePicker
}
from
'./VizTypePicker'
;
import
{
VizTypePicker
}
from
'./VizTypePicker'
;
import
PluginHelp
from
'app/core/components/Panel
Help/PluginHelp'
;
import
{
PluginHelp
}
from
'app/core/components/Plugin
Help/PluginHelp'
;
import
{
FadeIn
}
from
'app/core/components/Animations/FadeIn'
;
import
{
FadeIn
}
from
'app/core/components/Animations/FadeIn'
;
import
{
PanelOptionSection
}
from
'./PanelOptionSection'
;
import
{
PanelOptionSection
}
from
'./PanelOptionSection'
;
...
@@ -16,7 +15,6 @@ import { PanelOptionSection } from './PanelOptionSection';
...
@@ -16,7 +15,6 @@ import { PanelOptionSection } from './PanelOptionSection';
import
{
PanelModel
}
from
'../panel_model'
;
import
{
PanelModel
}
from
'../panel_model'
;
import
{
DashboardModel
}
from
'../dashboard_model'
;
import
{
DashboardModel
}
from
'../dashboard_model'
;
import
{
PanelPlugin
}
from
'app/types/plugins'
;
import
{
PanelPlugin
}
from
'app/types/plugins'
;
import
{
DataSourceSelectItem
}
from
'app/types'
;
interface
Props
{
interface
Props
{
panel
:
PanelModel
;
panel
:
PanelModel
;
...
@@ -27,7 +25,6 @@ interface Props {
...
@@ -27,7 +25,6 @@ interface Props {
}
}
interface
State
{
interface
State
{
currentDataSource
:
DataSourceSelectItem
;
isVizPickerOpen
:
boolean
;
isVizPickerOpen
:
boolean
;
searchQuery
:
string
;
searchQuery
:
string
;
}
}
...
@@ -36,16 +33,13 @@ export class VisualizationTab extends PureComponent<Props, State> {
...
@@ -36,16 +33,13 @@ export class VisualizationTab extends PureComponent<Props, State> {
element
:
HTMLElement
;
element
:
HTMLElement
;
angularOptions
:
AngularComponent
;
angularOptions
:
AngularComponent
;
searchInput
:
HTMLElement
;
searchInput
:
HTMLElement
;
dataSources
:
DataSourceSelectItem
[]
=
getDatasourceSrv
().
getMetricSources
();
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
);
super
(
props
);
const
{
panel
}
=
props
;
this
.
state
=
{
this
.
state
=
{
isVizPickerOpen
:
false
,
isVizPickerOpen
:
false
,
searchQuery
:
''
,
searchQuery
:
''
,
currentDataSource
:
this
.
dataSources
.
find
(
datasource
=>
datasource
.
value
===
panel
.
datasource
),
};
};
}
}
...
@@ -205,7 +199,7 @@ export class VisualizationTab extends PureComponent<Props, State> {
...
@@ -205,7 +199,7 @@ export class VisualizationTab extends PureComponent<Props, State> {
}
}
};
};
renderHelp
=
()
=>
<
PluginHelp
plugin=
{
this
.
state
.
currentDataSource
.
meta
}
type=
"help"
/>;
renderHelp
=
()
=>
<
PluginHelp
plugin=
{
this
.
props
.
plugin
}
type=
"help"
/>;
render
()
{
render
()
{
const
{
plugin
}
=
this
.
props
;
const
{
plugin
}
=
this
.
props
;
...
...
public/app/plugins/panel/graph/README.md
View file @
60ea9907
# Graph Panel
- Native Plugin
# Graph Panel
Th
e Graph is the main g
raph panel and is
**included**
with Grafana. It provides a very rich set of graphing options.
Th
is is the main G
raph panel and is
**included**
with Grafana. It provides a very rich set of graphing options.
Read more about it here
:
For full reference documentation
:
[
http://docs.grafana.org/reference/graph/
](
http://docs.grafana.org/reference/graph/
)
[
http://docs.grafana.org/reference/graph/
](
http://docs.grafana.org/reference/graph/
)
\ No newline at end of file
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