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
23666c0f
Commit
23666c0f
authored
Aug 10, 2017
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
grid: remove panel works
parent
83568716
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
7 deletions
+40
-7
public/app/features/dashboard/dashgrid/dashgrid.ts
+11
-0
public/app/features/dashboard/model.ts
+28
-0
public/app/features/panel/panel_ctrl.ts
+1
-1
public/app/features/panel/panel_header.ts
+0
-6
No files found.
public/app/features/dashboard/dashgrid/dashgrid.ts
View file @
23666c0f
...
@@ -60,6 +60,10 @@ export class GridCtrl {
...
@@ -60,6 +60,10 @@ export class GridCtrl {
bindItem
(
element
)
{
bindItem
(
element
)
{
this
.
gridstack
.
makeWidget
(
element
);
this
.
gridstack
.
makeWidget
(
element
);
}
}
removeItem
(
element
)
{
this
.
gridstack
.
removeWidget
(
element
,
false
);
}
}
}
/** @ngInject **/
/** @ngInject **/
...
@@ -115,6 +119,13 @@ export function dashGridItem($timeout, $rootScope) {
...
@@ -115,6 +119,13 @@ export function dashGridItem($timeout, $rootScope) {
element
.
addClass
(
'panel-fullscreen'
);
element
.
addClass
(
'panel-fullscreen'
);
},
scope
);
},
scope
);
scope
.
$on
(
'$destroy'
,
()
=>
{
gridCtrl
.
removeItem
(
element
);
});
// scope.onItemRemoved({item: item});
// ctrl.removeItem(element);
//var item = element.data('_gridstack_node');
//var item = element.data('_gridstack_node');
//console.log('link item', item);
//console.log('link item', item);
...
...
public/app/features/dashboard/model.ts
View file @
23666c0f
...
@@ -302,6 +302,34 @@ export class DashboardModel {
...
@@ -302,6 +302,34 @@ export class DashboardModel {
});
});
}
}
removePanel
(
panel
,
ask
?)
{
// confirm deletion
if
(
ask
!==
false
)
{
var
text2
,
confirmText
;
if
(
panel
.
alert
)
{
text2
=
"Panel includes an alert rule, removing panel will also remove alert rule"
;
confirmText
=
"YES"
;
}
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
;
}
var
index
=
_
.
indexOf
(
this
.
panels
,
panel
);
this
.
panels
.
splice
(
index
,
1
);
this
.
events
.
emit
(
'panel-removed'
,
panel
);
}
isTimezoneUtc
()
{
isTimezoneUtc
()
{
return
this
.
getTimezone
()
===
'utc'
;
return
this
.
getTimezone
()
===
'utc'
;
}
}
...
...
public/app/features/panel/panel_ctrl.ts
View file @
23666c0f
...
@@ -217,7 +217,7 @@ export class PanelCtrl {
...
@@ -217,7 +217,7 @@ export class PanelCtrl {
}
}
removePanel
()
{
removePanel
()
{
this
.
row
.
removePanel
(
this
.
panel
);
this
.
dashboard
.
removePanel
(
this
.
panel
);
}
}
editPanelJson
()
{
editPanelJson
()
{
...
...
public/app/features/panel/panel_header.ts
View file @
23666c0f
...
@@ -92,12 +92,6 @@ function panelHeader($compile) {
...
@@ -92,12 +92,6 @@ function panelHeader($compile) {
elem
.
click
(
function
(
evt
)
{
elem
.
click
(
function
(
evt
)
{
const
targetClass
=
evt
.
target
.
className
;
const
targetClass
=
evt
.
target
.
className
;
console
.
log
(
elem
.
closest
(
'.ui-draggable-dragging'
));
// ignore click if we are dragging
if
(
elem
.
closest
(
'.ui-draggable-dragging'
).
length
>
0
)
{
return
;
}
// remove existing scope
// remove existing scope
if
(
menuScope
)
{
if
(
menuScope
)
{
menuScope
.
$destroy
();
menuScope
.
$destroy
();
...
...
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