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
2feaad8b
Unverified
Commit
2feaad8b
authored
Feb 09, 2020
by
Ryan McKinley
Committed by
GitHub
Feb 09, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New Editor: add a tabs row for the query section (#22037)
parent
66191f94
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
5 deletions
+57
-5
public/app/features/dashboard/components/PanelEditor/PanelEditor.tsx
+57
-5
No files found.
public/app/features/dashboard/components/PanelEditor/PanelEditor.tsx
View file @
2feaad8b
import
React
,
{
PureComponent
}
from
'react'
;
import
{
GrafanaTheme
,
FieldConfigSource
,
PanelData
,
LoadingState
,
DefaultTimeRange
,
PanelEvents
}
from
'@grafana/data'
;
import
{
stylesFactory
,
Forms
,
FieldConfigEditor
,
CustomScrollbar
,
selectThemeVariant
}
from
'@grafana/ui'
;
import
{
stylesFactory
,
Forms
,
FieldConfigEditor
,
CustomScrollbar
,
selectThemeVariant
,
TabContent
,
Tab
,
TabsBar
,
}
from
'@grafana/ui'
;
import
{
css
,
cx
}
from
'emotion'
;
import
config
from
'app/core/config'
;
...
...
@@ -83,6 +92,18 @@ const getStyles = stylesFactory((theme: GrafanaTheme) => {
};
});
enum
EditorTab
{
Query
=
'query'
,
Alerts
=
'alerts'
,
Transform
=
'xform'
,
}
const
allTabs
=
[
{
tab
:
EditorTab
.
Query
,
label
:
'Query'
,
show
:
(
panel
:
PanelModel
)
=>
true
},
{
tab
:
EditorTab
.
Alerts
,
label
:
'Alerts'
,
show
:
(
panel
:
PanelModel
)
=>
true
},
{
tab
:
EditorTab
.
Transform
,
label
:
'Transform'
,
show
:
(
panel
:
PanelModel
)
=>
true
},
];
interface
Props
{
dashboard
:
DashboardModel
;
sourcePanel
:
PanelModel
;
...
...
@@ -93,6 +114,7 @@ interface State {
pluginLoadedCounter
:
number
;
panel
:
PanelModel
;
data
:
PanelData
;
tab
:
EditorTab
;
}
export
class
PanelEditor
extends
PureComponent
<
Props
,
State
>
{
...
...
@@ -106,6 +128,7 @@ export class PanelEditor extends PureComponent<Props, State> {
const
panel
=
props
.
sourcePanel
.
getEditClone
();
this
.
state
=
{
panel
,
tab
:
EditorTab
.
Query
,
pluginLoadedCounter
:
0
,
data
:
{
state
:
LoadingState
.
NotStarted
,
...
...
@@ -233,6 +256,37 @@ export class PanelEditor extends PureComponent<Props, State> {
this
.
forceUpdate
();
};
renderBottomOptions
()
{
const
{
dashboard
}
=
this
.
props
;
const
{
panel
,
tab
}
=
this
.
state
;
return
(
<
div
>
<
TabsBar
>
{
allTabs
.
map
(
t
=>
{
if
(
t
.
show
(
panel
))
{
return
(
<
Tab
label=
{
t
.
label
}
active=
{
tab
===
t
.
tab
}
onChangeTab=
{
()
=>
{
this
.
setState
({
tab
:
t
.
tab
});
}
}
/>
);
}
return
null
;
})
}
</
TabsBar
>
<
TabContent
>
{
tab
===
EditorTab
.
Query
&&
<
QueriesTab
panel=
{
panel
}
dashboard=
{
dashboard
}
/>
}
{
tab
===
EditorTab
.
Alerts
&&
<
div
>
TODO: Show Alerts
</
div
>
}
{
tab
===
EditorTab
.
Transform
&&
<
div
>
TODO: Show Transform
</
div
>
}
</
TabContent
>
</
div
>
);
}
render
()
{
const
{
dashboard
}
=
this
.
props
;
const
{
panel
}
=
this
.
state
;
...
...
@@ -269,7 +323,7 @@ export class PanelEditor extends PureComponent<Props, State> {
>
<
SplitPane
split=
"horizontal"
minSize=
{
5
0
}
minSize=
{
10
0
}
primary=
"second"
defaultSize=
"40%"
resizerClassName=
{
styles
.
resizerH
}
...
...
@@ -286,9 +340,7 @@ export class PanelEditor extends PureComponent<Props, State> {
isInView=
{
true
}
/>
</
div
>
<
div
className=
{
styles
.
noScrollPaneContent
}
>
<
QueriesTab
panel=
{
panel
}
dashboard=
{
dashboard
}
/>
</
div
>
<
div
className=
{
styles
.
noScrollPaneContent
}
>
{
this
.
renderBottomOptions
()
}
</
div
>
</
SplitPane
>
<
div
className=
{
styles
.
noScrollPaneContent
}
>
<
CustomScrollbar
>
...
...
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