2023-03-27 13:58:45 +02:00
|
|
|
import { Component, OnInit } from '@angular/core';
|
2023-12-29 16:04:16 +01:00
|
|
|
import { Router } from '@angular/router';
|
|
|
|
import { MaintenanceService } from '@app/core/services/maintenance/maintenance.service';
|
|
|
|
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
|
2023-03-27 13:58:45 +02:00
|
|
|
import { BaseComponent } from '@common/base/base.component';
|
|
|
|
import { TranslateService } from '@ngx-translate/core';
|
|
|
|
|
|
|
|
@Component({
|
2023-12-29 16:04:16 +01:00
|
|
|
selector: 'app-maintenance-tasks',
|
|
|
|
templateUrl: './maintenance-tasks.component.html',
|
|
|
|
styleUrls: ['./maintenance-tasks.component.scss']
|
2023-03-27 13:58:45 +02:00
|
|
|
})
|
|
|
|
export class MaintenanceTasksComponent extends BaseComponent implements OnInit {
|
|
|
|
|
2023-12-29 16:04:16 +01:00
|
|
|
constructor(
|
|
|
|
private maintenanceService: MaintenanceService,
|
|
|
|
private uiNotificationService: UiNotificationService,
|
|
|
|
private translate: TranslateService,
|
|
|
|
private router: Router,
|
|
|
|
) {
|
|
|
|
super();
|
|
|
|
}
|
|
|
|
|
|
|
|
ngOnInit(): void {
|
|
|
|
}
|
2023-03-27 13:58:45 +02:00
|
|
|
|
2023-12-29 16:04:16 +01:00
|
|
|
//TODO: refactor
|
|
|
|
// migrateSemantics(ev: Event) {
|
|
|
|
// (ev.srcElement as HTMLButtonElement).disabled = true;
|
|
|
|
// this.maintenanceTasksService.migrateSemantics().pipe(takeUntil(this._destroyed)).subscribe(
|
|
|
|
// response => {
|
|
|
|
// (ev.srcElement as HTMLButtonElement).disabled = false;
|
|
|
|
// this.onCallbackSuccess();
|
|
|
|
// },
|
|
|
|
// error => {
|
|
|
|
// (ev.srcElement as HTMLButtonElement).disabled = false;
|
|
|
|
// this.onCallbackError(error);
|
|
|
|
// }
|
|
|
|
// );
|
|
|
|
// }
|
2023-03-27 13:58:45 +02:00
|
|
|
|
2023-12-29 16:04:16 +01:00
|
|
|
// addRdaInSemantics(ev: Event) {
|
|
|
|
// (ev.srcElement as HTMLButtonElement).disabled = true;
|
|
|
|
// this.maintenanceTasksService.addRdaInSemantics().pipe(takeUntil(this._destroyed)).subscribe(
|
|
|
|
// response => {
|
|
|
|
// (ev.srcElement as HTMLButtonElement).disabled = false;
|
|
|
|
// this.onCallbackSuccess();
|
|
|
|
// },
|
|
|
|
// error => {
|
|
|
|
// (ev.srcElement as HTMLButtonElement).disabled = false;
|
|
|
|
// this.onCallbackError(error);
|
|
|
|
// }
|
|
|
|
// );
|
|
|
|
// }
|
2023-04-20 09:12:55 +02:00
|
|
|
|
2023-12-29 16:04:16 +01:00
|
|
|
onCallbackSuccess(): void {
|
|
|
|
this.uiNotificationService.snackBarNotification(this.translate.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
|
|
|
|
this.router.navigate(['/reload']).then(() => this.router.navigate(['/maintenance-tasks']));
|
|
|
|
}
|
2023-03-27 13:58:45 +02:00
|
|
|
|
2023-12-29 16:04:16 +01:00
|
|
|
onCallbackError(error: any) {
|
|
|
|
this.uiNotificationService.snackBarNotification(error, SnackBarNotificationLevel.Error);
|
|
|
|
}
|
2023-03-27 13:58:45 +02:00
|
|
|
|
|
|
|
}
|