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
6560d2e0
Unverified
Commit
6560d2e0
authored
Apr 02, 2020
by
Torkel Ödegaard
Committed by
GitHub
Apr 02, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NewPanelEdit: Adding variables to new panel editor (#23203)
parent
7e85e4d0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
6 deletions
+31
-6
public/app/features/dashboard/components/PanelEditor/PanelEditor.tsx
+30
-5
public/app/features/dashboard/containers/DashboardPage.tsx
+1
-1
No files found.
public/app/features/dashboard/components/PanelEditor/PanelEditor.tsx
View file @
6560d2e0
...
@@ -26,6 +26,9 @@ import { getPanelEditorTabs } from './state/selectors';
...
@@ -26,6 +26,9 @@ import { getPanelEditorTabs } from './state/selectors';
import
{
getPanelStateById
}
from
'../../state/selectors'
;
import
{
getPanelStateById
}
from
'../../state/selectors'
;
import
{
OptionsPaneContent
}
from
'./OptionsPaneContent'
;
import
{
OptionsPaneContent
}
from
'./OptionsPaneContent'
;
import
{
DashNavButton
}
from
'app/features/dashboard/components/DashNav/DashNavButton'
;
import
{
DashNavButton
}
from
'app/features/dashboard/components/DashNav/DashNavButton'
;
import
{
VariableModel
}
from
'app/features/templating/types'
;
import
{
getVariables
}
from
'app/features/variables/state/selectors'
;
import
{
SubMenuItems
}
from
'app/features/dashboard/components/SubMenu/SubMenuItems'
;
enum
Pane
{
enum
Pane
{
Right
,
Right
,
...
@@ -45,6 +48,7 @@ interface ConnectedProps {
...
@@ -45,6 +48,7 @@ interface ConnectedProps {
initDone
:
boolean
;
initDone
:
boolean
;
tabs
:
PanelEditorTab
[];
tabs
:
PanelEditorTab
[];
uiState
:
PanelEditorUIState
;
uiState
:
PanelEditorUIState
;
variables
:
VariableModel
[];
}
}
interface
DispatchProps
{
interface
DispatchProps
{
...
@@ -141,7 +145,7 @@ export class PanelEditorUnconnected extends PureComponent<Props> {
...
@@ -141,7 +145,7 @@ export class PanelEditorUnconnected extends PureComponent<Props> {
updatePanelEditorUIState
({
isPanelOptionsVisible
:
!
uiState
.
isPanelOptionsVisible
});
updatePanelEditorUIState
({
isPanelOptionsVisible
:
!
uiState
.
isPanelOptionsVisible
});
};
};
renderHorizontalSplit
(
styles
:
any
)
{
renderHorizontalSplit
(
styles
:
EditorStyles
)
{
const
{
dashboard
,
panel
,
tabs
,
data
,
uiState
}
=
this
.
props
;
const
{
dashboard
,
panel
,
tabs
,
data
,
uiState
}
=
this
.
props
;
return
(
return
(
...
@@ -158,6 +162,7 @@ export class PanelEditorUnconnected extends PureComponent<Props> {
...
@@ -158,6 +162,7 @@ export class PanelEditorUnconnected extends PureComponent<Props> {
>
>
<
div
className=
{
styles
.
mainPaneWrapper
}
>
<
div
className=
{
styles
.
mainPaneWrapper
}
>
{
this
.
renderToolbar
(
styles
)
}
{
this
.
renderToolbar
(
styles
)
}
{
this
.
renderTemplateVariables
(
styles
)
}
<
div
className=
{
styles
.
panelWrapper
}
>
<
div
className=
{
styles
.
panelWrapper
}
>
<
AutoSizer
>
<
AutoSizer
>
{
({
width
,
height
})
=>
{
{
({
width
,
height
})
=>
{
...
@@ -189,7 +194,21 @@ export class PanelEditorUnconnected extends PureComponent<Props> {
...
@@ -189,7 +194,21 @@ export class PanelEditorUnconnected extends PureComponent<Props> {
);
);
}
}
renderToolbar
(
styles
:
any
)
{
renderTemplateVariables
(
styles
:
EditorStyles
)
{
const
{
variables
}
=
this
.
props
;
if
(
!
variables
.
length
)
{
return
null
;
}
return
(
<
div
className=
{
styles
.
variablesWrapper
}
>
<
SubMenuItems
variables=
{
variables
}
/>
</
div
>
);
}
renderToolbar
(
styles
:
EditorStyles
)
{
const
{
dashboard
,
location
,
uiState
}
=
this
.
props
;
const
{
dashboard
,
location
,
uiState
}
=
this
.
props
;
return
(
return
(
...
@@ -230,7 +249,7 @@ export class PanelEditorUnconnected extends PureComponent<Props> {
...
@@ -230,7 +249,7 @@ export class PanelEditorUnconnected extends PureComponent<Props> {
);
);
}
}
renderOptionsPane
(
styles
:
any
)
{
renderOptionsPane
()
{
const
{
plugin
,
dashboard
,
data
,
panel
}
=
this
.
props
;
const
{
plugin
,
dashboard
,
data
,
panel
}
=
this
.
props
;
if
(
!
plugin
)
{
if
(
!
plugin
)
{
...
@@ -251,7 +270,7 @@ export class PanelEditorUnconnected extends PureComponent<Props> {
...
@@ -251,7 +270,7 @@ export class PanelEditorUnconnected extends PureComponent<Props> {
);
);
}
}
renderWithOptionsPane
(
styles
:
any
)
{
renderWithOptionsPane
(
styles
:
EditorStyles
)
{
const
{
uiState
}
=
this
.
props
;
const
{
uiState
}
=
this
.
props
;
return
(
return
(
...
@@ -266,7 +285,7 @@ export class PanelEditorUnconnected extends PureComponent<Props> {
...
@@ -266,7 +285,7 @@ export class PanelEditorUnconnected extends PureComponent<Props> {
onDragFinished=
{
size
=>
this
.
onDragFinished
(
Pane
.
Right
,
size
)
}
onDragFinished=
{
size
=>
this
.
onDragFinished
(
Pane
.
Right
,
size
)
}
>
>
{
this
.
renderHorizontalSplit
(
styles
)
}
{
this
.
renderHorizontalSplit
(
styles
)
}
{
this
.
renderOptionsPane
(
styles
)
}
{
this
.
renderOptionsPane
()
}
</
SplitPane
>
</
SplitPane
>
);
);
}
}
...
@@ -301,6 +320,7 @@ const mapStateToProps: MapStateToProps<ConnectedProps, OwnProps, StoreState> = (
...
@@ -301,6 +320,7 @@ const mapStateToProps: MapStateToProps<ConnectedProps, OwnProps, StoreState> = (
initDone
:
state
.
panelEditorNew
.
initDone
,
initDone
:
state
.
panelEditorNew
.
initDone
,
tabs
:
getPanelEditorTabs
(
state
.
location
,
plugin
),
tabs
:
getPanelEditorTabs
(
state
.
location
,
plugin
),
uiState
:
state
.
panelEditorNew
.
ui
,
uiState
:
state
.
panelEditorNew
.
ui
,
variables
:
getVariables
(
state
),
};
};
};
};
...
@@ -359,6 +379,9 @@ const getStyles = stylesFactory((theme: GrafanaTheme, props: Props) => {
...
@@ -359,6 +379,9 @@ const getStyles = stylesFactory((theme: GrafanaTheme, props: Props) => {
width: 100%;
width: 100%;
padding-right:
${
uiState
.
isPanelOptionsVisible
?
0
:
paneSpaceing
}
;
padding-right:
${
uiState
.
isPanelOptionsVisible
?
0
:
paneSpaceing
}
;
`
,
`
,
variablesWrapper
:
css
`
padding: 0
${
theme
.
spacing
.
sm
}
${
theme
.
spacing
.
sm
}
${
paneSpaceing
}
;
`
,
panelWrapper
:
css
`
panelWrapper
:
css
`
flex: 1 1 0;
flex: 1 1 0;
min-height: 0;
min-height: 0;
...
@@ -417,3 +440,5 @@ const getStyles = stylesFactory((theme: GrafanaTheme, props: Props) => {
...
@@ -417,3 +440,5 @@ const getStyles = stylesFactory((theme: GrafanaTheme, props: Props) => {
`
,
`
,
};
};
});
});
type
EditorStyles
=
ReturnType
<
typeof
getStyles
>
;
public/app/features/dashboard/containers/DashboardPage.tsx
View file @
6560d2e0
...
@@ -301,7 +301,7 @@ export class DashboardPage extends PureComponent<Props, State> {
...
@@ -301,7 +301,7 @@ export class DashboardPage extends PureComponent<Props, State> {
<
div
className=
{
gridWrapperClasses
}
>
<
div
className=
{
gridWrapperClasses
}
>
{
!
getConfig
().
featureToggles
.
newVariables
&&
<
AngularSubMenu
dashboard=
{
dashboard
}
/>
}
{
!
getConfig
().
featureToggles
.
newVariables
&&
<
AngularSubMenu
dashboard=
{
dashboard
}
/>
}
{
getConfig
().
featureToggles
.
newVariables
&&
<
SubMenu
dashboard=
{
dashboard
}
/>
}
{
!
editPanel
&&
getConfig
().
featureToggles
.
newVariables
&&
<
SubMenu
dashboard=
{
dashboard
}
/>
}
<
DashboardGrid
<
DashboardGrid
dashboard=
{
dashboard
}
dashboard=
{
dashboard
}
isEditing=
{
isEditing
}
isEditing=
{
isEditing
}
...
...
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