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
fa1602da
Unverified
Commit
fa1602da
authored
Feb 12, 2020
by
Torkel Ödegaard
Committed by
GitHub
Feb 12, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NewPanelEdit: Added visualization tab / selection view (#22117)
* NewPanelEdit: Added visualization tab * Minor fix
parent
60ed1e95
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
1 deletions
+64
-1
public/app/features/dashboard/components/PanelEditor/PanelEditor.tsx
+2
-1
public/app/features/dashboard/components/PanelEditor/PanelEditorTabs.tsx
+2
-0
public/app/features/dashboard/components/PanelEditor/VisualizationTab.tsx
+60
-0
No files found.
public/app/features/dashboard/components/PanelEditor/PanelEditor.tsx
View file @
fa1602da
...
...
@@ -280,7 +280,8 @@ export class PanelEditorUnconnected extends PureComponent<Props> {
}
const
mapStateToProps
:
MapStateToProps
<
ConnectedProps
,
OwnProps
,
StoreState
>
=
(
state
,
props
)
=>
{
const
plugin
=
state
.
plugins
.
panels
[
props
.
sourcePanel
.
type
];
const
panel
=
state
.
panelEditorNew
.
getPanel
();
const
plugin
=
state
.
plugins
.
panels
[
panel
.
type
];
return
{
location
:
state
.
location
,
...
...
public/app/features/dashboard/components/PanelEditor/PanelEditorTabs.tsx
View file @
fa1602da
...
...
@@ -8,6 +8,7 @@ import { DashboardModel } from '../../state';
import
{
QueriesTab
}
from
'../../panel_editor/QueriesTab'
;
import
{
PanelModel
}
from
'../../state/PanelModel'
;
import
{
AlertTab
}
from
'app/features/alerting/AlertTab'
;
import
{
VisualizationTab
}
from
'./VisualizationTab'
;
interface
PanelEditorTabsProps
{
panel
:
PanelModel
;
...
...
@@ -39,6 +40,7 @@ export const PanelEditorTabs: React.FC<PanelEditorTabsProps> = ({ panel, dashboa
<
TabContent
className=
{
styles
.
tabContent
}
>
{
activeTab
.
id
===
PanelEditorTabId
.
Queries
&&
<
QueriesTab
panel=
{
panel
}
dashboard=
{
dashboard
}
/>
}
{
activeTab
.
id
===
PanelEditorTabId
.
Alert
&&
<
AlertTab
panel=
{
panel
}
dashboard=
{
dashboard
}
/>
}
{
activeTab
.
id
===
PanelEditorTabId
.
Visualization
&&
<
VisualizationTab
panel=
{
panel
}
/>
}
{
activeTab
.
id
===
PanelEditorTabId
.
Transform
&&
data
.
state
!==
LoadingState
.
NotStarted
&&
(
<
TransformationsEditor
transformations=
{
panel
.
transformations
||
[]
}
...
...
public/app/features/dashboard/components/PanelEditor/VisualizationTab.tsx
0 → 100644
View file @
fa1602da
import
React
,
{
FC
}
from
'react'
;
import
{
css
}
from
'emotion'
;
import
{
GrafanaTheme
,
PanelPlugin
,
PanelPluginMeta
}
from
'@grafana/data'
;
import
{
useTheme
,
stylesFactory
}
from
'@grafana/ui'
;
import
{
changePanelPlugin
}
from
'../../state/actions'
;
import
{
StoreState
}
from
'app/types'
;
import
{
PanelModel
}
from
'../../state/PanelModel'
;
import
{
connect
,
MapStateToProps
,
MapDispatchToProps
}
from
'react-redux'
;
import
{
VizTypePicker
}
from
'../../panel_editor/VizTypePicker'
;
interface
OwnProps
{
panel
:
PanelModel
;
}
interface
ConnectedProps
{
plugin
?:
PanelPlugin
;
}
interface
DispatchProps
{
changePanelPlugin
:
typeof
changePanelPlugin
;
}
type
Props
=
OwnProps
&
ConnectedProps
&
DispatchProps
;
export
const
VisualizationTabUnconnected
:
FC
<
Props
>
=
({
panel
,
plugin
,
changePanelPlugin
})
=>
{
const
theme
=
useTheme
();
const
styles
=
getStyles
(
theme
);
if
(
!
plugin
)
{
return
null
;
}
const
onPluginTypeChange
=
(
meta
:
PanelPluginMeta
)
=>
{
changePanelPlugin
(
panel
,
meta
.
id
);
};
return
(
<
div
className=
{
styles
.
wrapper
}
>
<
VizTypePicker
current=
{
plugin
.
meta
}
onTypeChange=
{
onPluginTypeChange
}
searchQuery=
{
''
}
onClose=
{
()
=>
{}
}
/>
</
div
>
);
};
const
getStyles
=
stylesFactory
((
theme
:
GrafanaTheme
)
=>
{
return
{
wrapper
:
css
`
padding:
${
theme
.
spacing
.
md
}
;
`
,
};
});
const
mapStateToProps
:
MapStateToProps
<
ConnectedProps
,
OwnProps
,
StoreState
>
=
(
state
,
props
)
=>
{
return
{
plugin
:
state
.
plugins
.
panels
[
props
.
panel
.
type
],
};
};
const
mapDispatchToProps
:
MapDispatchToProps
<
DispatchProps
,
OwnProps
>
=
{
changePanelPlugin
};
export
const
VisualizationTab
=
connect
(
mapStateToProps
,
mapDispatchToProps
)(
VisualizationTabUnconnected
);
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