diff --git a/package-lock.json b/package-lock.json index 790900211d..d3aab7c9a6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -32,7 +32,7 @@ "@ngrx/store": "^19.1.0", "@ngx-translate/core": "^17.0.0", "@ngxmc/datetime-picker": "^19.3.1", - "@scicatproject/scicat-sdk-ts-angular": "^4.23.0", + "@scicatproject/scicat-sdk-ts-angular": "^4.24.0", "autolinker": "^4.0.0", "deep-equal": "^2.0.5", "exceljs": "^4.4.0", @@ -5674,9 +5674,10 @@ } }, "node_modules/@scicatproject/scicat-sdk-ts-angular": { - "version": "4.23.0", - "resolved": "https://registry.npmjs.org/@scicatproject/scicat-sdk-ts-angular/-/scicat-sdk-ts-angular-4.23.0.tgz", - "integrity": "sha512-8rcP0gXWHDbgnqtGspFdqMUsQcrkCDU0CFzw1Wa7/wirPPPAUXaUW1q6XXiScYpt8pVur+D8acEF3PbvJA6a+w==", + "version": "4.24.0", + "resolved": "https://registry.npmjs.org/@scicatproject/scicat-sdk-ts-angular/-/scicat-sdk-ts-angular-4.24.0.tgz", + "integrity": "sha512-bERg4m/yhSZlDkLSn2yRl+rwN8P3UVzFL7zWPgV2O3RWx1VX+yMoFMY2qZcVmqEOELz3p8QqNJG0Ktj6dHvlrQ==", + "license": "Unlicense", "dependencies": { "tslib": "^2.3.0" }, diff --git a/package.json b/package.json index b02c7cd1f9..a2aeede9a2 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "@ngrx/store": "^19.1.0", "@ngx-translate/core": "^17.0.0", "@ngxmc/datetime-picker": "^19.3.1", - "@scicatproject/scicat-sdk-ts-angular": "^4.23.0", + "@scicatproject/scicat-sdk-ts-angular": "^4.24.0", "autolinker": "^4.0.0", "deep-equal": "^2.0.5", "exceljs": "^4.4.0", diff --git a/src/app/datasets/dataset-lifecycle/dataset-lifecycle.component.spec.ts b/src/app/datasets/dataset-lifecycle/dataset-lifecycle.component.spec.ts index 51c31857d9..37cb350427 100644 --- a/src/app/datasets/dataset-lifecycle/dataset-lifecycle.component.spec.ts +++ b/src/app/datasets/dataset-lifecycle/dataset-lifecycle.component.spec.ts @@ -121,31 +121,31 @@ describe("DatasetLifecycleComponent", () => { expect(parsedHistoryItems.length).toEqual(0); }); - it("should parse dataset.history into a HistoryItem array if dataset is defined", () => { - const keywords = ["test", "parse"]; - const dataset = createMock< - OutputDatasetObsoleteDto & { history: HistoryClass[] } - >({ ...mockDataset }); - // TODO: Check the types here and see if we need the keywords at all or not as it doesn't exist on the HistoryClass. - dataset.history = [ - { - id: "testId", - keywords, - updatedBy: "Test User", - updatedAt: new Date().toISOString(), - }, - ] as unknown as HistoryClass[]; - - component.dataset = dataset; - const parsedHistoryItems = component["parseHistoryItems"](); - - expect(parsedHistoryItems.length).toEqual(1); - parsedHistoryItems.forEach((item) => { - expect(Object.keys(item).includes("id")).toEqual(false); - expect(item.property).toEqual("keywords"); - expect(item.value).toEqual(keywords); - }); - }); + // it("should parse dataset.history into a HistoryItem array if dataset is defined", () => { + // const keywords = ["test", "parse"]; + // const dataset = createMock< + // OutputDatasetObsoleteDto & { history: HistoryClass[] } + // >({ ...mockDataset }); + // // TODO: Check the types here and see if we need the keywords at all or not as it doesn't exist on the HistoryClass. + // dataset.history = [ + // { + // id: "testId", + // keywords, + // updatedBy: "Test User", + // updatedAt: new Date().toISOString(), + // }, + // ] as unknown as HistoryClass[]; + + // component.dataset = dataset; + // const parsedHistoryItems = component["parseHistoryItems"](); + + // expect(parsedHistoryItems.length).toEqual(1); + // parsedHistoryItems.forEach((item) => { + // expect(Object.keys(item).includes("id")).toEqual(false); + // expect(item.property).toEqual("keywords"); + // expect(item.value).toEqual(keywords); + // }); + // }); }); describe("#downloadCsv()", () => { diff --git a/src/app/datasets/dataset-lifecycle/dataset-lifecycle.component.ts b/src/app/datasets/dataset-lifecycle/dataset-lifecycle.component.ts index 084c305854..8889d0d7c3 100644 --- a/src/app/datasets/dataset-lifecycle/dataset-lifecycle.component.ts +++ b/src/app/datasets/dataset-lifecycle/dataset-lifecycle.component.ts @@ -64,20 +64,21 @@ export class DatasetLifecycleComponent implements OnInit, OnChanges { private parseHistoryItems(): HistoryItem[] { // TODO: This should be checked because something is wrong with the types - const dataset = this.dataset as DatasetClass; - if (dataset && dataset.history) { - const history = dataset.history.map( - ({ updatedAt, updatedBy, id, ...properties }) => - Object.keys(properties).map((property) => ({ - property, - value: properties[property], - updatedBy: updatedBy.replace("ldap.", ""), - updatedAt: this.datePipe.transform(updatedAt, "yyyy-MM-dd HH:mm"), - })), - ); - // flatten and reverse array before return - return [].concat(...history).reverse(); - } + // TODO: The following code is commented out and should be refactored because the history is no longer part of the dataset object anymore due to this PR from Scicat BE: "feat: implements history for many entities #1939" + // const dataset = this.dataset as DatasetClass; + // if (dataset && dataset.history) { + // const history = dataset.history.map( + // ({ updatedAt, updatedBy, id, ...properties }) => + // Object.keys(properties).map((property) => ({ + // property, + // value: properties[property], + // updatedBy: updatedBy.replace("ldap.", ""), + // updatedAt: this.datePipe.transform(updatedAt, "yyyy-MM-dd HH:mm"), + // })), + // ); + // // flatten and reverse array before return + // return [].concat(...history).reverse(); + // } return []; } diff --git a/src/app/proposals/proposal-detail/proposal-detail.component.html b/src/app/proposals/proposal-detail/proposal-detail.component.html index 57215178a9..d18588957d 100644 --- a/src/app/proposals/proposal-detail/proposal-detail.component.html +++ b/src/app/proposals/proposal-detail/proposal-detail.component.html @@ -72,6 +72,10 @@ + + {{ "Number of Datasets" | translate: localization }} + {{ proposal.numberOfDatasets }} + diff --git a/src/app/shared/modules/dynamic-material-table/table/dynamic-mat-table.component.ts b/src/app/shared/modules/dynamic-material-table/table/dynamic-mat-table.component.ts index 2ec50d6de9..8bb440215f 100644 --- a/src/app/shared/modules/dynamic-material-table/table/dynamic-mat-table.component.ts +++ b/src/app/shared/modules/dynamic-material-table/table/dynamic-mat-table.component.ts @@ -1020,7 +1020,7 @@ export class DynamicMatTableComponent ? fieldName.split(".").reduce((acc, key) => acc?.[key], data) : data[fieldName]; - if (!value) { + if (value === null || value === undefined) { return ""; } diff --git a/src/app/state-management/state/proposals.store.ts b/src/app/state-management/state/proposals.store.ts index 588d95ece3..b96412463e 100644 --- a/src/app/state-management/state/proposals.store.ts +++ b/src/app/state-management/state/proposals.store.ts @@ -119,5 +119,10 @@ export const initialProposalsState: ProposalsState = { enabled: true, }, { name: "type", width: 200, enabled: true }, + { + name: "numberOfDatasets", + width: 150, + enabled: true, + }, ], };