argos/dmp-frontend/src/app/ui/admin/maintenance-tasks/maintenance-tasks.component.ts

66 lines
2.3 KiB
TypeScript
Raw Normal View History

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';
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']
})
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-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-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-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-12-29 16:04:16 +01:00
onCallbackError(error: any) {
this.uiNotificationService.snackBarNotification(error, SnackBarNotificationLevel.Error);
}
}