Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export class DatasetDetailDynamicComponent implements OnInit, OnDestroy {
private router: Router,
private snackBar: MatSnackBar,
) {
this.translateService.use("datasetCustom");
this.translateService.use("dataset");
}

ngOnInit() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export class DatasetDetailComponent implements OnInit, OnDestroy {
private router: Router,
private fb: FormBuilder,
) {
this.translateService.use("datasetDefault");
this.translateService.use("dataset");
}

ngOnInit() {
Expand Down
37 changes: 28 additions & 9 deletions src/app/datasets/dataset-table/dataset-table.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
} from "@angular/core";
import { TableColumn } from "state-management/models";
import { MatCheckboxChange } from "@angular/material/checkbox";
import { BehaviorSubject, Subscription, lastValueFrom, take } from "rxjs";
import { BehaviorSubject, Subscription, forkJoin, lastValueFrom, map, take } from "rxjs";

Check failure on line 12 in src/app/datasets/dataset-table/dataset-table.component.ts

View workflow job for this annotation

GitHub Actions / eslint

Replace `·BehaviorSubject,·Subscription,·forkJoin,·lastValueFrom,·map,·take·` with `⏎··BehaviorSubject,⏎··Subscription,⏎··forkJoin,⏎··lastValueFrom,⏎··map,⏎··take,⏎`
import { Store } from "@ngrx/store";
import {
clearSelectionAction,
Expand Down Expand Up @@ -64,6 +64,7 @@
import { actionMenu } from "shared/modules/dynamic-material-table/utilizes/default-table-settings";
import { TableConfigService } from "shared/services/table-config.service";
import { selectInstruments } from "state-management/selectors/instruments.selectors";
import { TranslateService } from "@ngx-translate/core";

export interface SortChangeEvent {
active: string;
Expand Down Expand Up @@ -155,7 +156,10 @@
private fileSize: FileSizePipe,
private titleCase: TitleCasePipe,
private tableConfigService: TableConfigService,
) {}
private translateService: TranslateService,

Check failure on line 159 in src/app/datasets/dataset-table/dataset-table.component.ts

View workflow job for this annotation

GitHub Actions / eslint

Delete `····`
) {
this.translateService.use("dataset");
}

private getInstrumentName(row: OutputDatasetObsoleteDto): string {
const instrument = this.instrumentMap.get(row.instrumentId);
Expand Down Expand Up @@ -207,6 +211,21 @@
}

this.columns = currentColumnSetting;
const translated$ = forkJoin(
currentColumnSetting.map((i) =>
this.translateService.get(i.header || i.name).pipe(
map((translated) => ({
...i,
header: translated,
})

Check failure on line 220 in src/app/datasets/dataset-table/dataset-table.component.ts

View workflow job for this annotation

GitHub Actions / eslint

Insert `),`
))

Check failure on line 221 in src/app/datasets/dataset-table/dataset-table.component.ts

View workflow job for this annotation

GitHub Actions / eslint

Replace `)` with `,`
)

Check failure on line 222 in src/app/datasets/dataset-table/dataset-table.component.ts

View workflow job for this annotation

GitHub Actions / eslint

Insert `,`
);

translated$.subscribe((result) => {
this.columns = result;
});

this.setting = settingConfig;
this.pagination = paginationConfig;
}
Expand Down Expand Up @@ -385,13 +404,13 @@
type: column.type as any,
};

if (column.name === "runNumber" && column.type !== "custom") {
// NOTE: This is for the saved columns in the database or the old config.
convertedColumn.customRender = (c, row) =>
lodashGet(row, "scientificMetadata.runNumber.value");
convertedColumn.toExport = (row) =>
lodashGet(row, "scientificMetadata.runNumber.value");
}
// if (column.name === "runNumber" && column.type !== "custom") {
// // NOTE: This is for the saved columns in the database or the old config.
// convertedColumn.customRender = (c, row) =>
// lodashGet(row, "scientificMetadata.runNumber.value");
// convertedColumn.toExport = (row) =>
Comment on lines +407 to +411
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: Commented-out code for runNumber handling may cause confusion.

Remove deprecated code if no longer needed, or add a comment specifying when and why it should be re-enabled if it's only temporarily disabled.

// lodashGet(row, "scientificMetadata.runNumber.value");
// }
// NOTE: This is how we render the custom columns if new config is used.
if (column.type === "custom") {
convertedColumn.customRender = (c, row) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -512,10 +512,16 @@ export class DynamicMatTableComponent<T extends TableRow>
}

columnName(row: any, column: TableField<any>) {
console.log("------");
console.log(row);
console.log(column);
if (column.customRender) {
console.log("Custom");
console.log(column.customRender(column, row));
return column.customRender(column, row);
}

console.log("standard");
console.log(row[column.name]);
Comment on lines +515 to +524
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: Debugging console.log statements should be removed before merging.

Please remove these console.log statements or use a proper logging mechanism if necessary.

return row[column.name];
}

Expand Down
Loading