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
47e4b771
Commit
47e4b771
authored
Jan 06, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lodash remove override fix, Fixes #1304
parent
7c6f0ad4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
21 deletions
+16
-21
src/app/components/lodash.extended.js
+0
-4
src/app/services/alertSrv.js
+16
-17
No files found.
src/app/components/lodash.extended.js
View file @
47e4b771
...
...
@@ -14,10 +14,6 @@ function () {
array
.
splice
(
toIndex
,
0
,
array
.
splice
(
fromIndex
,
1
)[
0
]);
return
array
;
},
remove
:
function
(
array
,
index
)
{
array
.
splice
(
index
,
1
);
return
array
;
},
// If variable is value, then return alt. If variable is anything else, return value;
toggle
:
function
(
variable
,
value
,
alt
)
{
return
variable
===
value
?
alt
:
value
;
...
...
src/app/services/alertSrv.js
View file @
47e4b771
...
...
@@ -27,28 +27,27 @@ function (angular, _) {
this
.
list
=
[];
this
.
set
=
function
(
title
,
text
,
severity
,
timeout
)
{
var
_a
=
{
title
:
title
||
''
,
text
:
$sce
.
trustAsHtml
(
text
||
''
),
severity
:
severity
||
'info'
,
},
_ca
=
angular
.
toJson
(
_a
),
_clist
=
_
.
map
(
self
.
list
,
function
(
alert
)
{
return
angular
.
toJson
(
alert
);});
// If we already have this alert, remove it and add a new one
// Why do this instead of skipping the add because it resets the timer
if
(
_
.
contains
(
_clist
,
_ca
))
{
_
.
remove
(
self
.
list
,
_
.
indexOf
(
_clist
,
_ca
));
}
var
newAlert
=
{
title
:
title
||
''
,
text
:
$sce
.
trustAsHtml
(
text
||
''
),
severity
:
severity
||
'info'
,
};
var
newAlertJson
=
angular
.
toJson
(
newAlert
);
self
.
list
.
push
(
_a
);
// remove same alert if it already exists
_
.
remove
(
self
.
list
,
function
(
value
)
{
return
angular
.
toJson
(
value
)
===
newAlertJson
;
});
self
.
list
.
push
(
newAlert
);
if
(
timeout
>
0
)
{
$timeout
(
function
()
{
self
.
list
=
_
.
without
(
self
.
list
,
_a
);
self
.
list
=
_
.
without
(
self
.
list
,
newAlert
);
},
timeout
);
}
return
(
_a
);
return
(
newAlert
);
};
this
.
clear
=
function
(
alert
)
{
...
...
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