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
3410fb44
Commit
3410fb44
authored
Sep 04, 2019
by
lzd
Committed by
Torkel Ödegaard
Sep 04, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Annotations: check if the name exists before creating a new annotation (#18880)
parent
490a1d6f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
public/app/features/annotations/editor_ctrl.ts
+6
-0
No files found.
public/app/features/annotations/editor_ctrl.ts
View file @
3410fb44
...
@@ -4,6 +4,7 @@ import $ from 'jquery';
...
@@ -4,6 +4,7 @@ import $ from 'jquery';
import
coreModule
from
'app/core/core_module'
;
import
coreModule
from
'app/core/core_module'
;
import
{
DashboardModel
}
from
'app/features/dashboard/state'
;
import
{
DashboardModel
}
from
'app/features/dashboard/state'
;
import
DatasourceSrv
from
'../plugins/datasource_srv'
;
import
DatasourceSrv
from
'../plugins/datasource_srv'
;
import
appEvents
from
'app/core/app_events'
;
export
class
AnnotationsEditorCtrl
{
export
class
AnnotationsEditorCtrl
{
mode
:
any
;
mode
:
any
;
...
@@ -97,6 +98,11 @@ export class AnnotationsEditorCtrl {
...
@@ -97,6 +98,11 @@ export class AnnotationsEditorCtrl {
}
}
add
()
{
add
()
{
const
sameName
:
any
=
_
.
find
(
this
.
annotations
,
{
name
:
this
.
currentAnnotation
.
name
});
if
(
sameName
)
{
appEvents
.
emit
(
'alert-warning'
,
[
'Validation'
,
'Annotations with the same name already exists'
]);
return
;
}
this
.
annotations
.
push
(
this
.
currentAnnotation
);
this
.
annotations
.
push
(
this
.
currentAnnotation
);
this
.
reset
();
this
.
reset
();
this
.
mode
=
'list'
;
this
.
mode
=
'list'
;
...
...
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