Skip to content

Commit

Permalink
NAS-130698 / 25.04 / Replace EntityJobComponent with jobDialog me…
Browse files Browse the repository at this point in the history
…thod in `ix-cell-state-button` (#10545)
  • Loading branch information
RehanY147 authored Aug 31, 2024
1 parent a24d277 commit be02a7c
Show file tree
Hide file tree
Showing 89 changed files with 23 additions and 113 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { UntilDestroy } from '@ngneat/until-destroy';
import { select, Store } from '@ngrx/store';
import { TranslateService } from '@ngx-translate/core';
import { catchError, EMPTY, Observable } from 'rxjs';
import { JobState } from 'app/enums/job-state.enum';
import { observeJob } from 'app/helpers/operators/observe-job.operator';
import { helptextGlobal } from 'app/helptext/global-helptext';
import { ApiJobMethod, ApiJobResponse } from 'app/interfaces/api/api-job-directory.interface';
import { Job } from 'app/interfaces/job.interface';
import { ShowLogsDialogComponent } from 'app/modules/dialog/components/show-logs-dialog/show-logs-dialog.component';
import { DialogService } from 'app/modules/dialog/dialog.service';
import { EntityJobComponent } from 'app/modules/entity/entity-job/entity-job.component';
import { Column, ColumnComponent } from 'app/modules/ix-table/interfaces/table-column.interface';
import { SnackbarService } from 'app/modules/snackbar/services/snackbar.service';
import { JobSlice, selectJob } from 'app/modules/jobs/store/job.selectors';
import { ErrorHandlerService } from 'app/services/error-handler.service';

interface RowState {
Expand All @@ -33,7 +36,8 @@ export class IxCellStateButtonComponent<T> extends ColumnComponent<T> {
translate: TranslateService = inject(TranslateService);
dialogService: DialogService = inject(DialogService);
errorHandler: ErrorHandlerService = inject(ErrorHandlerService);
snackbar: SnackbarService = inject(SnackbarService);

private store$: Store<JobSlice> = inject<Store<JobSlice>>(Store<JobSlice>);

getWarnings?: (row: T) => unknown[];
getJob?: (row: T) => Job;
Expand Down Expand Up @@ -70,29 +74,23 @@ export class IxCellStateButtonComponent<T> extends ColumnComponent<T> {

if (this.job && state) {
if (this.job.state === JobState.Running) {
const dialogRef = this.matDialog.open(EntityJobComponent, {
data: {
this.dialogService.jobDialog(
this.store$.pipe(
select(selectJob(this.job.id)),
observeJob(),
) as Observable<Job<ApiJobResponse<ApiJobMethod>>>,
{
title: this.translate.instant('Task is running'),
canMinimize: true,
},
});

dialogRef.componentInstance.jobId = this.job.id;
dialogRef.componentInstance.job = this.job;
if (this.job.logs_path) {
dialogRef.componentInstance.enableRealtimeLogs(true);
}
dialogRef.componentInstance.wsshow();
dialogRef.componentInstance.success.pipe(untilDestroyed(this)).subscribe(() => {
dialogRef.close();
});
dialogRef.componentInstance.failure.pipe(untilDestroyed(this)).subscribe((error) => {
dialogRef.close();
this.errorHandler.showErrorModal(error);
});
dialogRef.componentInstance.aborted.pipe(untilDestroyed(this)).subscribe(() => {
this.snackbar.success(this.translate.instant('Task Aborted'));
dialogRef.close();
});
).afterClosed().pipe(
catchError((error) => {
this.errorHandler.showErrorModal(error);
return EMPTY;
}),
// TODO: Remove this ignore eslint lint line and add takeUntil (untilDestroyed)
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
).subscribe();
} else if (state.state === JobState.Hold) {
this.dialogService.info(this.translate.instant('Task is on hold'), state.reason);
} else if (state.warnings?.length > 0) {
Expand Down
1 change: 0 additions & 1 deletion src/assets/i18n/af.json
Original file line number Diff line number Diff line change
Expand Up @@ -4191,7 +4191,6 @@
"Target with this name already exists": "",
"Targets": "",
"Task": "",
"Task Aborted": "",
"Task Details for {task}": "",
"Task Name": "",
"Task Settings": "",
Expand Down
1 change: 0 additions & 1 deletion src/assets/i18n/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -4191,7 +4191,6 @@
"Target with this name already exists": "",
"Targets": "",
"Task": "",
"Task Aborted": "",
"Task Details for {task}": "",
"Task Name": "",
"Task Settings": "",
Expand Down
1 change: 0 additions & 1 deletion src/assets/i18n/ast.json
Original file line number Diff line number Diff line change
Expand Up @@ -4191,7 +4191,6 @@
"Target with this name already exists": "",
"Targets": "",
"Task": "",
"Task Aborted": "",
"Task Details for {task}": "",
"Task Name": "",
"Task Settings": "",
Expand Down
1 change: 0 additions & 1 deletion src/assets/i18n/az.json
Original file line number Diff line number Diff line change
Expand Up @@ -4191,7 +4191,6 @@
"Target with this name already exists": "",
"Targets": "",
"Task": "",
"Task Aborted": "",
"Task Details for {task}": "",
"Task Name": "",
"Task Settings": "",
Expand Down
1 change: 0 additions & 1 deletion src/assets/i18n/be.json
Original file line number Diff line number Diff line change
Expand Up @@ -4191,7 +4191,6 @@
"Target with this name already exists": "",
"Targets": "",
"Task": "",
"Task Aborted": "",
"Task Details for {task}": "",
"Task Name": "",
"Task Settings": "",
Expand Down
1 change: 0 additions & 1 deletion src/assets/i18n/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -4191,7 +4191,6 @@
"Target with this name already exists": "",
"Targets": "",
"Task": "",
"Task Aborted": "",
"Task Details for {task}": "",
"Task Name": "",
"Task Settings": "",
Expand Down
1 change: 0 additions & 1 deletion src/assets/i18n/bn.json
Original file line number Diff line number Diff line change
Expand Up @@ -4191,7 +4191,6 @@
"Target with this name already exists": "",
"Targets": "",
"Task": "",
"Task Aborted": "",
"Task Details for {task}": "",
"Task Name": "",
"Task Settings": "",
Expand Down
1 change: 0 additions & 1 deletion src/assets/i18n/br.json
Original file line number Diff line number Diff line change
Expand Up @@ -4191,7 +4191,6 @@
"Target with this name already exists": "",
"Targets": "",
"Task": "",
"Task Aborted": "",
"Task Details for {task}": "",
"Task Name": "",
"Task Settings": "",
Expand Down
1 change: 0 additions & 1 deletion src/assets/i18n/bs.json
Original file line number Diff line number Diff line change
Expand Up @@ -4191,7 +4191,6 @@
"Target with this name already exists": "",
"Targets": "",
"Task": "",
"Task Aborted": "",
"Task Details for {task}": "",
"Task Name": "",
"Task Settings": "",
Expand Down
1 change: 0 additions & 1 deletion src/assets/i18n/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -4191,7 +4191,6 @@
"Target with this name already exists": "",
"Targets": "",
"Task": "",
"Task Aborted": "",
"Task Details for {task}": "",
"Task Name": "",
"Task Settings": "",
Expand Down
1 change: 0 additions & 1 deletion src/assets/i18n/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -3800,7 +3800,6 @@
"Target with this name already exists": "",
"Targets": "",
"Task": "",
"Task Aborted": "",
"Task Details for {task}": "",
"Task Name": "",
"Task Settings": "",
Expand Down
1 change: 0 additions & 1 deletion src/assets/i18n/cy.json
Original file line number Diff line number Diff line change
Expand Up @@ -4191,7 +4191,6 @@
"Target with this name already exists": "",
"Targets": "",
"Task": "",
"Task Aborted": "",
"Task Details for {task}": "",
"Task Name": "",
"Task Settings": "",
Expand Down
1 change: 0 additions & 1 deletion src/assets/i18n/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -4191,7 +4191,6 @@
"Target with this name already exists": "",
"Targets": "",
"Task": "",
"Task Aborted": "",
"Task Details for {task}": "",
"Task Name": "",
"Task Settings": "",
Expand Down
1 change: 0 additions & 1 deletion src/assets/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -2993,7 +2993,6 @@
"Target dataset encryption will be inherited from its parent dataset.": "",
"Target with this name already exists": "",
"Task": "",
"Task Aborted": "",
"Task Details for {task}": "",
"Task Name": "",
"Task Settings": "",
Expand Down
1 change: 0 additions & 1 deletion src/assets/i18n/dsb.json
Original file line number Diff line number Diff line change
Expand Up @@ -4191,7 +4191,6 @@
"Target with this name already exists": "",
"Targets": "",
"Task": "",
"Task Aborted": "",
"Task Details for {task}": "",
"Task Name": "",
"Task Settings": "",
Expand Down
1 change: 0 additions & 1 deletion src/assets/i18n/el.json
Original file line number Diff line number Diff line change
Expand Up @@ -4191,7 +4191,6 @@
"Target with this name already exists": "",
"Targets": "",
"Task": "",
"Task Aborted": "",
"Task Details for {task}": "",
"Task Name": "",
"Task Settings": "",
Expand Down
1 change: 0 additions & 1 deletion src/assets/i18n/en-au.json
Original file line number Diff line number Diff line change
Expand Up @@ -4191,7 +4191,6 @@
"Target with this name already exists": "",
"Targets": "",
"Task": "",
"Task Aborted": "",
"Task Details for {task}": "",
"Task Name": "",
"Task Settings": "",
Expand Down
1 change: 0 additions & 1 deletion src/assets/i18n/en-gb.json
Original file line number Diff line number Diff line change
Expand Up @@ -4191,7 +4191,6 @@
"Target with this name already exists": "",
"Targets": "",
"Task": "",
"Task Aborted": "",
"Task Details for {task}": "",
"Task Name": "",
"Task Settings": "",
Expand Down
1 change: 0 additions & 1 deletion src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -4191,7 +4191,6 @@
"Target with this name already exists": "",
"Targets": "",
"Task": "",
"Task Aborted": "",
"Task Details for {task}": "",
"Task Name": "",
"Task Settings": "",
Expand Down
1 change: 0 additions & 1 deletion src/assets/i18n/eo.json
Original file line number Diff line number Diff line change
Expand Up @@ -4191,7 +4191,6 @@
"Target with this name already exists": "",
"Targets": "",
"Task": "",
"Task Aborted": "",
"Task Details for {task}": "",
"Task Name": "",
"Task Settings": "",
Expand Down
1 change: 0 additions & 1 deletion src/assets/i18n/es-ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -2296,7 +2296,6 @@
"Target dataset encryption will be inherited from its parent dataset.": "",
"Target with this name already exists": "",
"Task": "",
"Task Aborted": "",
"Task Details for {task}": "",
"Task Settings": "",
"Task created": "",
Expand Down
1 change: 0 additions & 1 deletion src/assets/i18n/es-co.json
Original file line number Diff line number Diff line change
Expand Up @@ -4191,7 +4191,6 @@
"Target with this name already exists": "",
"Targets": "",
"Task": "",
"Task Aborted": "",
"Task Details for {task}": "",
"Task Name": "",
"Task Settings": "",
Expand Down
1 change: 0 additions & 1 deletion src/assets/i18n/es-mx.json
Original file line number Diff line number Diff line change
Expand Up @@ -4191,7 +4191,6 @@
"Target with this name already exists": "",
"Targets": "",
"Task": "",
"Task Aborted": "",
"Task Details for {task}": "",
"Task Name": "",
"Task Settings": "",
Expand Down
1 change: 0 additions & 1 deletion src/assets/i18n/es-ni.json
Original file line number Diff line number Diff line change
Expand Up @@ -4191,7 +4191,6 @@
"Target with this name already exists": "",
"Targets": "",
"Task": "",
"Task Aborted": "",
"Task Details for {task}": "",
"Task Name": "",
"Task Settings": "",
Expand Down
1 change: 0 additions & 1 deletion src/assets/i18n/es-ve.json
Original file line number Diff line number Diff line change
Expand Up @@ -4191,7 +4191,6 @@
"Target with this name already exists": "",
"Targets": "",
"Task": "",
"Task Aborted": "",
"Task Details for {task}": "",
"Task Name": "",
"Task Settings": "",
Expand Down
1 change: 0 additions & 1 deletion src/assets/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -3993,7 +3993,6 @@
"Target with this name already exists": "",
"Targets": "",
"Task": "",
"Task Aborted": "",
"Task Details for {task}": "",
"Task Name": "",
"Task Settings": "",
Expand Down
1 change: 0 additions & 1 deletion src/assets/i18n/et.json
Original file line number Diff line number Diff line change
Expand Up @@ -4191,7 +4191,6 @@
"Target with this name already exists": "",
"Targets": "",
"Task": "",
"Task Aborted": "",
"Task Details for {task}": "",
"Task Name": "",
"Task Settings": "",
Expand Down
1 change: 0 additions & 1 deletion src/assets/i18n/eu.json
Original file line number Diff line number Diff line change
Expand Up @@ -4191,7 +4191,6 @@
"Target with this name already exists": "",
"Targets": "",
"Task": "",
"Task Aborted": "",
"Task Details for {task}": "",
"Task Name": "",
"Task Settings": "",
Expand Down
1 change: 0 additions & 1 deletion src/assets/i18n/fa.json
Original file line number Diff line number Diff line change
Expand Up @@ -4191,7 +4191,6 @@
"Target with this name already exists": "",
"Targets": "",
"Task": "",
"Task Aborted": "",
"Task Details for {task}": "",
"Task Name": "",
"Task Settings": "",
Expand Down
1 change: 0 additions & 1 deletion src/assets/i18n/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -4191,7 +4191,6 @@
"Target with this name already exists": "",
"Targets": "",
"Task": "",
"Task Aborted": "",
"Task Details for {task}": "",
"Task Name": "",
"Task Settings": "",
Expand Down
1 change: 0 additions & 1 deletion src/assets/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -4391,7 +4391,6 @@
"Target dataset encryption will be inherited from its parent dataset.": "Le chiffrement du dataset cible sera hérité de son dataset parent.",
"Target with this name already exists": "La cible portant ce nom existe déjà",
"Targets": "Cibles",
"Task Aborted": "Tâche annulée",
"Task Name": "Nom de la tâche",
"Task created": "Tâche créée",
"Task is on hold": "La tâche est en attente",
Expand Down
1 change: 0 additions & 1 deletion src/assets/i18n/fy.json
Original file line number Diff line number Diff line change
Expand Up @@ -4191,7 +4191,6 @@
"Target with this name already exists": "",
"Targets": "",
"Task": "",
"Task Aborted": "",
"Task Details for {task}": "",
"Task Name": "",
"Task Settings": "",
Expand Down
1 change: 0 additions & 1 deletion src/assets/i18n/ga.json
Original file line number Diff line number Diff line change
Expand Up @@ -4230,7 +4230,6 @@
"Target with this name already exists": "Tá sprioc leis an ainm seo ann cheana féin",
"Targets": "Spriocanna",
"Task": "Tasc",
"Task Aborted": "Tobscoireadh an Tasc",
"Task Details for {task}": "Sonraí Tasc le haghaidh {task}",
"Task Name": "Ainm Tasc",
"Task Settings": "Socruithe Tasc",
Expand Down
1 change: 0 additions & 1 deletion src/assets/i18n/gd.json
Original file line number Diff line number Diff line change
Expand Up @@ -4191,7 +4191,6 @@
"Target with this name already exists": "",
"Targets": "",
"Task": "",
"Task Aborted": "",
"Task Details for {task}": "",
"Task Name": "",
"Task Settings": "",
Expand Down
1 change: 0 additions & 1 deletion src/assets/i18n/gl.json
Original file line number Diff line number Diff line change
Expand Up @@ -4191,7 +4191,6 @@
"Target with this name already exists": "",
"Targets": "",
"Task": "",
"Task Aborted": "",
"Task Details for {task}": "",
"Task Name": "",
"Task Settings": "",
Expand Down
1 change: 0 additions & 1 deletion src/assets/i18n/he.json
Original file line number Diff line number Diff line change
Expand Up @@ -4191,7 +4191,6 @@
"Target with this name already exists": "",
"Targets": "",
"Task": "",
"Task Aborted": "",
"Task Details for {task}": "",
"Task Name": "",
"Task Settings": "",
Expand Down
1 change: 0 additions & 1 deletion src/assets/i18n/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -4191,7 +4191,6 @@
"Target with this name already exists": "",
"Targets": "",
"Task": "",
"Task Aborted": "",
"Task Details for {task}": "",
"Task Name": "",
"Task Settings": "",
Expand Down
1 change: 0 additions & 1 deletion src/assets/i18n/hr.json
Original file line number Diff line number Diff line change
Expand Up @@ -4191,7 +4191,6 @@
"Target with this name already exists": "",
"Targets": "",
"Task": "",
"Task Aborted": "",
"Task Details for {task}": "",
"Task Name": "",
"Task Settings": "",
Expand Down
1 change: 0 additions & 1 deletion src/assets/i18n/hsb.json
Original file line number Diff line number Diff line change
Expand Up @@ -4191,7 +4191,6 @@
"Target with this name already exists": "",
"Targets": "",
"Task": "",
"Task Aborted": "",
"Task Details for {task}": "",
"Task Name": "",
"Task Settings": "",
Expand Down
1 change: 0 additions & 1 deletion src/assets/i18n/hu.json
Original file line number Diff line number Diff line change
Expand Up @@ -4191,7 +4191,6 @@
"Target with this name already exists": "",
"Targets": "",
"Task": "",
"Task Aborted": "",
"Task Details for {task}": "",
"Task Name": "",
"Task Settings": "",
Expand Down
Loading

0 comments on commit be02a7c

Please sign in to comment.