|
|
|
@ -86,7 +86,7 @@ import { Authority } from '@shared/models/authority.enum'; |
|
|
|
import { DialogService } from '@core/services/dialog.service'; |
|
|
|
import { EntityService } from '@core/http/entity.service'; |
|
|
|
import { AliasController } from '@core/api/alias-controller'; |
|
|
|
import { BehaviorSubject, Observable, of, Subject, Subscription } from 'rxjs'; |
|
|
|
import { BehaviorSubject, Observable, of, Subject, Subscription, throwError } from 'rxjs'; |
|
|
|
import { DashboardUtilsService } from '@core/services/dashboard-utils.service'; |
|
|
|
import { DashboardService } from '@core/http/dashboard.service'; |
|
|
|
import { |
|
|
|
@ -156,6 +156,7 @@ import { |
|
|
|
MoveWidgetsDialogComponent, |
|
|
|
MoveWidgetsDialogResult |
|
|
|
} from '@home/components/dashboard-page/layout/move-widgets-dialog.component'; |
|
|
|
import { HttpStatusCode } from '@angular/common/http'; |
|
|
|
|
|
|
|
// @dynamic
|
|
|
|
@Component({ |
|
|
|
@ -1203,15 +1204,31 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC |
|
|
|
data: widget |
|
|
|
}; |
|
|
|
this.window.parent.postMessage(JSON.stringify(message), '*'); |
|
|
|
this.setEditMode(false, false); |
|
|
|
} else { |
|
|
|
let reInitDashboard = false; |
|
|
|
this.dashboardService.saveDashboard(this.dashboard).pipe( |
|
|
|
catchError(() => { |
|
|
|
this.setEditMode(false, true); |
|
|
|
return of(null); |
|
|
|
catchError((err) => { |
|
|
|
if (err.status === HttpStatusCode.Conflict) { |
|
|
|
reInitDashboard = true; |
|
|
|
return this.dashboardService.getDashboard(this.dashboard.id.id).pipe( |
|
|
|
map(dashboard => this.dashboardUtils.validateAndUpdateDashboard(dashboard)) |
|
|
|
); |
|
|
|
} |
|
|
|
return throwError(() => err); |
|
|
|
}) |
|
|
|
).subscribe(() => { |
|
|
|
this.dashboard.version = this.dashboard.version + 1; |
|
|
|
).subscribe((dashboard) => { |
|
|
|
this.setEditMode(false, false); |
|
|
|
this.dashboard = dashboard; |
|
|
|
if (reInitDashboard) { |
|
|
|
const dashboardPageInitData: DashboardPageInitData = { |
|
|
|
dashboard, |
|
|
|
currentDashboardId: dashboard.id ? dashboard.id.id : null, |
|
|
|
widgetEditMode: false, |
|
|
|
singlePageMode: false |
|
|
|
}; |
|
|
|
this.init(dashboardPageInitData); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|