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
edceb204
Commit
edceb204
authored
Oct 30, 2018
by
Johannes Schill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip: panel-header: Add "Copy" functionality
parent
b296d724
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
9 deletions
+20
-9
public/app/features/dashboard/dashgrid/PanelHeader/PanelHeaderMenu.tsx
+8
-3
public/app/features/dashboard/utils/panel.ts
+8
-0
public/app/features/panel/panel_ctrl.ts
+4
-6
No files found.
public/app/features/dashboard/dashgrid/PanelHeader/PanelHeaderMenu.tsx
View file @
edceb204
...
@@ -3,7 +3,7 @@ import { DashboardModel } from 'app/features/dashboard/dashboard_model';
...
@@ -3,7 +3,7 @@ import { DashboardModel } from 'app/features/dashboard/dashboard_model';
import
{
PanelHeaderMenuItem
,
PanelHeaderMenuItemTypes
}
from
'./PanelHeaderMenuItem'
;
import
{
PanelHeaderMenuItem
,
PanelHeaderMenuItemTypes
}
from
'./PanelHeaderMenuItem'
;
import
{
store
}
from
'app/store/configureStore'
;
import
{
store
}
from
'app/store/configureStore'
;
import
{
updateLocation
}
from
'app/core/actions'
;
import
{
updateLocation
}
from
'app/core/actions'
;
import
{
removePanel
,
duplicatePanel
}
from
'app/features/dashboard/utils/panel'
;
import
{
removePanel
,
duplicatePanel
,
copyPanel
}
from
'app/features/dashboard/utils/panel'
;
import
appEvents
from
'app/core/app_events'
;
import
appEvents
from
'app/core/app_events'
;
export
interface
PanelHeaderMenuProps
{
export
interface
PanelHeaderMenuProps
{
...
@@ -69,6 +69,11 @@ export class PanelHeaderMenu extends PureComponent<PanelHeaderMenuProps, any> {
...
@@ -69,6 +69,11 @@ export class PanelHeaderMenu extends PureComponent<PanelHeaderMenuProps, any> {
duplicatePanel
(
dashboard
,
panel
);
duplicatePanel
(
dashboard
,
panel
);
};
};
onCopyPanel
=
()
=>
{
const
panel
=
this
.
getPanel
();
copyPanel
(
panel
);
};
render
()
{
render
()
{
return
(
return
(
<
div
className=
"panel-menu-container dropdown"
>
<
div
className=
"panel-menu-container dropdown"
>
...
@@ -98,7 +103,7 @@ export class PanelHeaderMenu extends PureComponent<PanelHeaderMenuProps, any> {
...
@@ -98,7 +103,7 @@ export class PanelHeaderMenu extends PureComponent<PanelHeaderMenuProps, any> {
type=
{
PanelHeaderMenuItemTypes
.
SubMenu
}
type=
{
PanelHeaderMenuItemTypes
.
SubMenu
}
text=
"More ..."
text=
"More ..."
iconClassName=
"fa fa-fw fa-cube"
iconClassName=
"fa fa-fw fa-cube"
handleClick=
{
()
=>
{}
}
handleClick=
{
null
}
>
>
<
ul
className=
"dropdown-menu dropdown-menu--menu panel-menu"
>
<
ul
className=
"dropdown-menu dropdown-menu--menu panel-menu"
>
<
PanelHeaderMenuItem
<
PanelHeaderMenuItem
...
@@ -108,7 +113,7 @@ export class PanelHeaderMenu extends PureComponent<PanelHeaderMenuProps, any> {
...
@@ -108,7 +113,7 @@ export class PanelHeaderMenu extends PureComponent<PanelHeaderMenuProps, any> {
handleClick=
{
this
.
onDuplicatePanel
}
handleClick=
{
this
.
onDuplicatePanel
}
shortcut=
"p d"
shortcut=
"p d"
/>
/>
<
PanelHeaderMenuItem
type=
{
PanelHeaderMenuItemTypes
.
Link
}
text=
"Copy"
handleClick=
{
()
=>
{}
}
/>
<
PanelHeaderMenuItem
type=
{
PanelHeaderMenuItemTypes
.
Link
}
text=
"Copy"
handleClick=
{
this
.
onCopyPanel
}
/>
<
PanelHeaderMenuItem
type=
{
PanelHeaderMenuItemTypes
.
Link
}
text=
"Panel JSON"
handleClick=
{
()
=>
{}
}
/>
<
PanelHeaderMenuItem
type=
{
PanelHeaderMenuItemTypes
.
Link
}
text=
"Panel JSON"
handleClick=
{
()
=>
{}
}
/>
<
PanelHeaderMenuItem
type=
{
PanelHeaderMenuItemTypes
.
Link
}
text=
"Export CSV"
handleClick=
{
()
=>
{}
}
/>
<
PanelHeaderMenuItem
type=
{
PanelHeaderMenuItemTypes
.
Link
}
text=
"Export CSV"
handleClick=
{
()
=>
{}
}
/>
<
PanelHeaderMenuItem
<
PanelHeaderMenuItem
...
...
public/app/features/dashboard/utils/panel.ts
View file @
edceb204
import
appEvents
from
'app/core/app_events'
;
import
appEvents
from
'app/core/app_events'
;
import
{
DashboardModel
}
from
'app/features/dashboard/dashboard_model'
;
import
{
DashboardModel
}
from
'app/features/dashboard/dashboard_model'
;
import
{
PanelModel
}
from
'app/features/dashboard/panel_model'
;
import
{
PanelModel
}
from
'app/features/dashboard/panel_model'
;
import
store
from
'app/core/store'
;
import
{
LS_PANEL_COPY_KEY
}
from
'app/core/constants'
;
export
const
removePanel
=
(
dashboard
:
DashboardModel
,
panel
:
PanelModel
,
ask
:
boolean
)
=>
{
export
const
removePanel
=
(
dashboard
:
DashboardModel
,
panel
:
PanelModel
,
ask
:
boolean
)
=>
{
// confirm deletion
// confirm deletion
...
@@ -26,7 +28,13 @@ export const duplicatePanel = (dashboard: DashboardModel, panel: PanelModel) =>
...
@@ -26,7 +28,13 @@ export const duplicatePanel = (dashboard: DashboardModel, panel: PanelModel) =>
dashboard
.
duplicatePanel
(
panel
);
dashboard
.
duplicatePanel
(
panel
);
};
};
export
const
copyPanel
=
(
panel
:
PanelModel
)
=>
{
store
.
set
(
LS_PANEL_COPY_KEY
,
JSON
.
stringify
(
panel
.
getSaveModel
()));
appEvents
.
emit
(
'alert-success'
,
[
'Panel copied. Open Add Panel to paste'
]);
};
export
default
{
export
default
{
removePanel
,
removePanel
,
duplicatePanel
,
duplicatePanel
,
copyPanel
,
};
};
public/app/features/panel/panel_ctrl.ts
View file @
edceb204
import
config
from
'app/core/config'
;
import
config
from
'app/core/config'
;
import
_
from
'lodash'
;
import
_
from
'lodash'
;
import
$
from
'jquery'
;
import
$
from
'jquery'
;
import
{
appEvents
,
profiler
}
from
'app/core/core'
;
import
{
profiler
}
from
'app/core/core'
;
import
{
PanelModel
}
from
'app/features/dashboard/panel_model'
;
import
{
PanelModel
}
from
'app/features/dashboard/panel_model'
;
import
{
duplicatePanel
}
from
'app/features/dashboard/utils/panel'
;
import
{
duplicatePanel
,
copyPanel
}
from
'app/features/dashboard/utils/panel'
;
import
Remarkable
from
'remarkable'
;
import
Remarkable
from
'remarkable'
;
import
{
GRID_CELL_HEIGHT
,
GRID_CELL_VMARGIN
,
LS_PANEL_COPY_KEY
}
from
'app/core/constants'
;
import
{
GRID_CELL_HEIGHT
,
GRID_CELL_VMARGIN
}
from
'app/core/constants'
;
import
store
from
'app/core/store'
;
const
TITLE_HEIGHT
=
27
;
const
TITLE_HEIGHT
=
27
;
const
PANEL_BORDER
=
2
;
const
PANEL_BORDER
=
2
;
...
@@ -264,8 +263,7 @@ export class PanelCtrl {
...
@@ -264,8 +263,7 @@ export class PanelCtrl {
}
}
copyPanel
()
{
copyPanel
()
{
store
.
set
(
LS_PANEL_COPY_KEY
,
JSON
.
stringify
(
this
.
panel
.
getSaveModel
()));
copyPanel
(
this
.
panel
);
appEvents
.
emit
(
'alert-success'
,
[
'Panel copied. Open Add Panel to paste'
]);
}
}
replacePanel
(
newPanel
,
oldPanel
)
{
replacePanel
(
newPanel
,
oldPanel
)
{
...
...
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