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
820e47b4
Commit
820e47b4
authored
Oct 25, 2018
by
Johannes Schill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip: panel-header: Remove panel
parent
212c0861
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
4 deletions
+31
-4
public/app/features/dashboard/dashgrid/PanelHeader/PanelHeader.tsx
+2
-1
public/app/features/dashboard/dashgrid/PanelHeader/PanelHeaderMenu.tsx
+29
-3
No files found.
public/app/features/dashboard/dashgrid/PanelHeader/PanelHeader.tsx
View file @
820e47b4
...
...
@@ -14,6 +14,7 @@ interface PanelHeaderProps {
export
class
PanelHeader
extends
React
.
Component
<
PanelHeaderProps
,
any
>
{
render
()
{
const
{
dashboard
}
=
this
.
props
;
const
isFullscreen
=
false
;
const
isLoading
=
false
;
const
panelHeaderClass
=
classNames
({
'panel-header'
:
true
,
'grid-drag-handle'
:
!
isFullscreen
});
...
...
@@ -38,7 +39,7 @@ export class PanelHeader extends React.Component<PanelHeaderProps, any> {
{
this
.
props
.
panel
.
title
}
<
span
className=
"fa fa-caret-down panel-menu-toggle"
/>
</
span
>
<
PanelHeaderMenu
panelId=
{
this
.
props
.
panel
.
id
}
/>
<
PanelHeaderMenu
panelId=
{
this
.
props
.
panel
.
id
}
dashboard=
{
dashboard
}
/>
<
span
className=
"panel-time-info"
>
<
i
className=
"fa fa-clock-o"
/>
4m
</
span
>
...
...
public/app/features/dashboard/dashgrid/PanelHeader/PanelHeaderMenu.tsx
View file @
820e47b4
import
React
,
{
PureComponent
}
from
'react'
;
// import { store } from 'app/store/configureStore';
import
{
DashboardModel
}
from
'app/features/dashboard/dashboard_model'
;
import
{
PanelModel
}
from
'app/features/dashboard/panel_model'
;
import
{
PanelHeaderMenuItem
,
PanelHeaderMenuItemTypes
}
from
'./PanelHeaderMenuItem'
;
import
appEvents
from
'app/core/app_events'
;
import
{
store
}
from
'app/store/configureStore'
;
...
...
@@ -7,6 +9,7 @@ import { updateLocation } from 'app/core/actions';
export
interface
PanelHeaderMenuProps
{
panelId
:
number
;
dashboard
:
DashboardModel
;
}
export
class
PanelHeaderMenu
extends
PureComponent
<
PanelHeaderMenuProps
,
any
>
{
...
...
@@ -35,9 +38,32 @@ export class PanelHeaderMenu extends PureComponent<PanelHeaderMenuProps, any> {
};
onRemovePanel
=
()
=>
{
appEvents
.
emit
(
'panel-remove'
,
{
panelId
:
this
.
props
.
panelId
,
});
const
{
panelId
,
dashboard
}
=
this
.
props
;
const
panelInfo
=
dashboard
.
getPanelInfoById
(
panelId
);
this
.
removePanel
(
panelInfo
.
panel
,
true
);
};
removePanel
=
(
panel
:
PanelModel
,
ask
:
boolean
)
=>
{
const
{
dashboard
}
=
this
.
props
;
// confirm deletion
if
(
ask
!==
false
)
{
const
text2
=
panel
.
alert
?
'Panel includes an alert rule, removing panel will also remove alert rule'
:
null
;
const
confirmText
=
panel
.
alert
?
'YES'
:
null
;
appEvents
.
emit
(
'confirm-modal'
,
{
title
:
'Remove Panel'
,
text
:
'Are you sure you want to remove this panel?'
,
text2
:
text2
,
icon
:
'fa-trash'
,
confirmText
:
confirmText
,
yesText
:
'Remove'
,
onConfirm
:
()
=>
this
.
removePanel
(
panel
,
false
),
});
return
;
}
dashboard
.
removePanel
(
panel
);
};
render
()
{
...
...
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