ux: success/error alerts refactoring, #9214

This commit is contained in:
Torkel Ödegaard
2017-09-12 09:05:32 +02:00
parent 7164183739
commit f6100dd8eb
16 changed files with 48 additions and 49 deletions

View File

@@ -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) => {

View File

@@ -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);