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
cba471b0
Commit
cba471b0
authored
Sep 03, 2015
by
Pavel Strashkin
Committed by
carl bergquist
Dec 15, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ui(dashboard): delete empty rows without confirm
parent
f1b897b3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
3 deletions
+30
-3
public/app/features/dashboard/rowCtrl.js
+11
-1
public/test/specs/row-ctrl-specs.js
+19
-2
No files found.
public/app/features/dashboard/rowCtrl.js
View file @
cba471b0
...
...
@@ -41,13 +41,23 @@ function (angular, _, config) {
$scope
.
dashboard
.
addPanel
(
panel
,
$scope
.
row
);
};
$scope
.
deleteRow
=
function
()
{
function
delete_row
()
{
$scope
.
dashboard
.
rows
=
_
.
without
(
$scope
.
dashboard
.
rows
,
$scope
.
row
);
}
if
(
!
$scope
.
row
.
panels
.
length
)
{
delete_row
();
return
;
}
$scope
.
appEvent
(
'confirm-modal'
,
{
title
:
'Are you sure you want to delete this row?'
,
icon
:
'fa-trash'
,
yesText
:
'Delete'
,
onConfirm
:
function
()
{
$scope
.
dashboard
.
rows
=
_
.
without
(
$scope
.
dashboard
.
rows
,
$scope
.
row
);
delete_row
(
);
}
});
};
...
...
public/test/specs/row-ctrl-specs.js
View file @
cba471b0
...
...
@@ -12,7 +12,24 @@ define([
beforeEach
(
ctx
.
providePhase
());
beforeEach
(
ctx
.
createControllerPhase
(
'RowCtrl'
));
});
describe
(
'delete_row'
,
function
()
{
describe
(
'when row is empty (has no panels)'
,
function
()
{
beforeEach
(
function
()
{
ctx
.
scope
.
dashboard
.
rows
=
[{
id
:
1
,
panels
:
[]}];
ctx
.
scope
.
row
=
ctx
.
scope
.
dashboard
.
rows
[
0
];
ctx
.
scope
.
appEvent
=
sinon
.
spy
();
});
ctx
.
scope
.
delete_row
();
});
it
(
'should NOT ask for confirmation'
,
function
()
{
expect
(
ctx
.
scope
.
appEvent
.
called
).
to
.
be
(
false
);
});
it
(
'should delete row'
,
function
()
{
expect
(
ctx
.
scope
.
dashboard
.
rows
).
to
.
not
.
contain
(
ctx
.
scope
.
row
);
});
});
});
});
});
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