Skip to content

Commit d39f4a2

Browse files
authored
fix: fixing run number in dataset list (#1976)
## Description This PR removes the custom function to extract the run number from the scientific metadata with hard coded key name. It instead uses the dedicated high level field run_number recently added in the dataset schema. <img width="1530" height="923" alt="SciCat_dataset_run_number_fix_1" src="https://github.com/user-attachments/assets/b03b1d3c-4a07-40ed-8032-0e91145333ec" /> <img width="1530" height="923" alt="SciCat_dataset_run_number_fix_2" src="https://github.com/user-attachments/assets/172907c4-e4de-40af-bbf2-517b19c129fd" /> ## Motivation We need to show run number high level field by default. A soon to be created PR, will allow to include scientific metadata in the datasets list, so a different run number from scientific metadata will be addressed by the new PR. ## Changes: Please provide a list of the changes implemented by this PR * datasets table ## Tests included - [ ] Included for each change/fix? - [ ] Passing? (Merge will not be approved unless this is checked) ## Documentation - [ ] swagger documentation updated \[required\] - [ ] official documentation updated \[nice-to-have\] ### official documentation info If you have updated the official documentation, please provide PR # and URL of the pages where the updates are included ## Backend version - [ ] Does it require a specific version of the backend - which version of the backend is required: ## Summary by Sourcery Fix run number display in the dataset list by removing the custom scientific metadata fallback and using the high-level runNumber field, add localization of table headers, and standardize translation namespaces across dataset components. Bug Fixes: - Use the high-level runNumber field for the dataset list instead of the scientificMetadata fallback Enhancements: - Inject TranslateService to translate dataset table column headers using the "dataset" namespace - Unify translation context to "dataset" in both dataset-detail components Chores: - Add console.log statements in DynamicMatTableComponent for debugging
2 parents a89a4ce + e4e2fba commit d39f4a2

File tree

2 files changed

+2
-14
lines changed

2 files changed

+2
-14
lines changed

src/app/datasets/dataset-table/dataset-table.component.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -271,10 +271,7 @@ export class DatasetTableComponent implements OnInit, OnDestroy {
271271
if (event === TableEventType.SortChanged) {
272272
const { active, direction } = sender as Sort;
273273

274-
let column = active;
275-
if (column === "runNumber") {
276-
column = "scientificMetadata.runNumber.value";
277-
}
274+
const column = active;
278275

279276
this.store.dispatch(sortByColumnAction({ column, direction }));
280277
}
@@ -367,8 +364,7 @@ export class DatasetTableComponent implements OnInit, OnDestroy {
367364

368365
onSortChange(event: SortChangeEvent): void {
369366
const { active, direction } = event;
370-
let column = active.split("_")[1];
371-
if (column === "runNumber") column = "scientificMetadata.runNumber.value";
367+
const column = active.split("_")[1];
372368
this.store.dispatch(sortByColumnAction({ column, direction }));
373369
}
374370

@@ -387,13 +383,6 @@ export class DatasetTableComponent implements OnInit, OnDestroy {
387383
tooltip: column.tooltip,
388384
};
389385

390-
if (column.name === "runNumber" && column.type !== "custom") {
391-
// NOTE: This is for the saved columns in the database or the old config.
392-
convertedColumn.customRender = (c, row) =>
393-
lodashGet(row, "scientificMetadata.runNumber.value");
394-
convertedColumn.toExport = (row) =>
395-
lodashGet(row, "scientificMetadata.runNumber.value");
396-
}
397386
// NOTE: This is how we render the custom columns if new config is used.
398387
if (column.type === "custom") {
399388
convertedColumn.customRender = (c, row) =>

src/app/shared/modules/dynamic-material-table/table/dynamic-mat-table.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,6 @@ export class DynamicMatTableComponent<T extends TableRow>
553553
if (column.customRender) {
554554
return column.customRender(column, row);
555555
}
556-
557556
return row[column.name];
558557
}
559558

0 commit comments

Comments
 (0)