File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed
plugins/datasource/graphite Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ export class AlertSrv {
16
16
17
17
init ( ) {
18
18
this . $rootScope . onAppEvent ( 'alert-error' , ( e , alert ) => {
19
- this . set ( alert [ 0 ] , alert [ 1 ] , 'error' , 0 ) ;
19
+ this . set ( alert [ 0 ] , alert [ 1 ] , 'error' , 7000 ) ;
20
20
} , this . $rootScope ) ;
21
21
22
22
this . $rootScope . onAppEvent ( 'alert-warning' , ( e , alert ) => {
@@ -27,10 +27,21 @@ export class AlertSrv {
27
27
this . set ( alert [ 0 ] , alert [ 1 ] , 'success' , 3000 ) ;
28
28
} , this . $rootScope ) ;
29
29
30
+ appEvents . on ( 'alert-error' , options => {
31
+ this . set ( options [ 0 ] , options [ 1 ] , 'error' , 7000 ) ;
32
+ } ) ;
33
+
30
34
appEvents . on ( 'confirm-modal' , this . showConfirmModal . bind ( this ) ) ;
31
35
}
32
36
33
37
set ( title , text , severity , timeout ) {
38
+ if ( _ . isObject ( text ) ) {
39
+ console . log ( 'alert error' , text ) ;
40
+ if ( text . statusText ) {
41
+ text = `HTTP Error (${ text . status } ) ${ text . statusText } ` ;
42
+ }
43
+ }
44
+
34
45
var newAlert = {
35
46
title : title || '' ,
36
47
text : text || '' ,
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import moment from 'moment';
9
9
import gfunc from './gfunc' ;
10
10
import { Parser } from './parser' ;
11
11
import { QueryCtrl } from 'app/plugins/sdk' ;
12
+ import appEvents from 'app/core/app_events' ;
12
13
13
14
export class GraphiteQueryCtrl extends QueryCtrl {
14
15
static templateUrl = 'partials/query.editor.html' ;
@@ -141,7 +142,7 @@ export class GraphiteQueryCtrl extends QueryCtrl {
141
142
}
142
143
}
143
144
} ) . catch ( err => {
144
- this . error = err . message || 'Failed to issue metric query' ;
145
+ appEvents . emit ( 'alert- error' , [ 'Error' , err ] ) ;
145
146
} ) ;
146
147
}
147
148
@@ -178,7 +179,7 @@ export class GraphiteQueryCtrl extends QueryCtrl {
178
179
altSegments . unshift ( this . uiSegmentSrv . newSegment ( '*' ) ) ;
179
180
return altSegments ;
180
181
} ) . catch ( err => {
181
- this . error = err . message || 'Failed to issue metric query' ;
182
+ appEvents . emit ( 'alert- error' , [ 'Error' , err ] ) ;
182
183
return [ ] ;
183
184
} ) ;
184
185
}
You can’t perform that action at this time.
0 commit comments