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
b7b1a794
Commit
b7b1a794
authored
Feb 11, 2019
by
Johannes Schill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: Only show Queries tab for panel plugins with isDataPanel set to true
parent
d3115325
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
13 deletions
+34
-13
public/app/features/dashboard/panel_editor/PanelEditor.tsx
+34
-13
No files found.
public/app/features/dashboard/panel_editor/PanelEditor.tsx
View file @
b7b1a794
...
...
@@ -30,6 +30,32 @@ interface PanelEditorTab {
text
:
string
;
}
enum
PanelEditorTabIds
{
Queries
=
'queries'
,
Visualization
=
'visualization'
,
Advanced
=
'advanced'
,
Alert
=
'alert'
}
interface
PanelEditorTab
{
id
:
string
;
text
:
string
;
}
const
panelEditorTabTexts
=
{
[
PanelEditorTabIds
.
Queries
]:
'Queries'
,
[
PanelEditorTabIds
.
Visualization
]:
'Visualization'
,
[
PanelEditorTabIds
.
Advanced
]:
'Panel Options'
,
[
PanelEditorTabIds
.
Alert
]:
'Alert'
,
};
const
getPanelEditorTab
=
(
tabId
:
PanelEditorTabIds
):
PanelEditorTab
=>
{
return
{
id
:
tabId
,
text
:
panelEditorTabTexts
[
tabId
]
};
};
export
class
PanelEditor
extends
PureComponent
<
PanelEditorProps
>
{
constructor
(
props
)
{
super
(
props
);
...
...
@@ -72,31 +98,26 @@ export class PanelEditor extends PureComponent<PanelEditorProps> {
render
()
{
const
{
plugin
}
=
this
.
props
;
let
activeTab
=
store
.
getState
().
location
.
query
.
tab
||
'queries'
;
let
activeTab
:
PanelEditorTabIds
=
store
.
getState
().
location
.
query
.
tab
||
PanelEditorTabIds
.
Queries
;
const
tabs
:
PanelEditorTab
[]
=
[
{
id
:
'queries'
,
text
:
'Queries'
}
,
{
id
:
'visualization'
,
text
:
'Visualization'
}
,
{
id
:
'advanced'
,
text
:
'Panel Options'
}
,
getPanelEditorTab
(
PanelEditorTabIds
.
Queries
)
,
getPanelEditorTab
(
PanelEditorTabIds
.
Visualization
)
,
getPanelEditorTab
(
PanelEditorTabIds
.
Advanced
)
,
];
// handle panels that do not have queries tab
if
(
plugin
.
exports
.
PanelCtrl
)
{
if
(
!
plugin
.
exports
.
PanelCtrl
.
prototype
.
onDataReceived
)
{
if
(
!
plugin
.
isDataPanel
)
{
// remove queries tab
tabs
.
shift
();
// switch tab
if
(
activeTab
===
'queries'
)
{
activeTab
=
'visualization'
;
}
if
(
activeTab
===
PanelEditorTabIds
.
Queries
)
{
activeTab
=
PanelEditorTabIds
.
Visualization
;
}
}
if
(
config
.
alertingEnabled
&&
plugin
.
id
===
'graph'
)
{
tabs
.
push
({
id
:
'alert'
,
text
:
'Alert'
,
});
tabs
.
push
(
getPanelEditorTab
(
PanelEditorTabIds
.
Alert
));
}
return
(
...
...
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