mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
ux: success/error alerts refactoring, #9214
This commit is contained in:
@@ -16,7 +16,7 @@ export class AlertSrv {
|
||||
|
||||
init() {
|
||||
this.$rootScope.onAppEvent('alert-error', (e, alert) => {
|
||||
this.set(alert[0], alert[1], 'error', 7000);
|
||||
this.set(alert[0], alert[1], 'error', 12000);
|
||||
}, this.$rootScope);
|
||||
|
||||
this.$rootScope.onAppEvent('alert-warning', (e, alert) => {
|
||||
|
||||
@@ -64,7 +64,13 @@ export class BackendSrv {
|
||||
}
|
||||
|
||||
if (data.message) {
|
||||
this.alertSrv.set("Problem!", data.message, data.severity, 10000);
|
||||
let description = "";
|
||||
let message = data.message;
|
||||
if (message.length > 80) {
|
||||
description = message;
|
||||
message = "Error";
|
||||
}
|
||||
this.alertSrv.set(message, description, data.severity, 10000);
|
||||
}
|
||||
|
||||
throw data;
|
||||
@@ -97,7 +103,7 @@ export class BackendSrv {
|
||||
return results.data;
|
||||
}, err => {
|
||||
// handle unauthorized
|
||||
if (err.status === 401 && firstAttempt) {
|
||||
if (err.status === 401 && this.contextSrv.user.isSignedIn && firstAttempt) {
|
||||
return this.loginPing().then(() => {
|
||||
options.retry = 1;
|
||||
return this.request(options);
|
||||
|
||||
Reference in New Issue
Block a user