diff --git a/CHANGELOG.md b/CHANGELOG.md index c112a1a869..9009907c8a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,11 +9,14 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ### Added - Cypress Login to E2E Environment to enable cypress e2e tests. - Fixed bug in argo workflow which allows to successfully run on INT-A/INT-B + ### Changed - Fixed table-settings reset bug - Changed datepicker in FE to date range picker - Fixed name of veracode backend job - Bump jetty-http from 11.0.15 to 11.0.17 +- Assets response have now list of notification ids rather than count of existing notifications +- Frontend adapt to backend api changes for activeAlerts and activeInvestigations ### Removed diff --git a/frontend/src/app/mocks/services/parts-mock/partsAsBuilt/partsAsBuilt.model.ts b/frontend/src/app/mocks/services/parts-mock/partsAsBuilt/partsAsBuilt.model.ts index bdf17103bc..7c7a7af6a5 100644 --- a/frontend/src/app/mocks/services/parts-mock/partsAsBuilt/partsAsBuilt.model.ts +++ b/frontend/src/app/mocks/services/parts-mock/partsAsBuilt/partsAsBuilt.model.ts @@ -64,8 +64,8 @@ export const mockBmwAssets = [ } } ], - qualityAlertsInStatusActive: 0, - qualityInvestigationsInStatusActive: 0, + qualityAlertIdsInStatusActive: [], + qualityInvestigationIdsInStatusActive: [], }, { "id": "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e43842", @@ -96,8 +96,8 @@ export const mockBmwAssets = [ } } ], - qualityAlertsInStatusActive: 0, - qualityInvestigationsInStatusActive: 0, + qualityAlertIdsInStatusActive:[], + qualityInvestigationIdsInStatusActive: [], }, { "id": "urn:uuid:4a5e9ff6-2d5c-4510-a90e-d55af3ba502f", @@ -136,8 +136,8 @@ export const mockBmwAssets = [ } } ], - qualityAlertsInStatusActive: 0, - qualityInvestigationsInStatusActive: 0, + qualityAlertIdsInStatusActive:[], + qualityInvestigationIdsInStatusActive: [], }, { "id": "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fa03", @@ -173,8 +173,8 @@ export const mockBmwAssets = [ } } ], - qualityAlertsInStatusActive: 0, - qualityInvestigationsInStatusActive: 0, + qualityAlertIdsInStatusActive: [], + qualityInvestigationIdsInStatusActive: [], }, { "id": "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fa01", @@ -205,8 +205,8 @@ export const mockBmwAssets = [ } } ], - qualityAlertsInStatusActive: 0, - qualityInvestigationsInStatusActive: 0, + qualityAlertIdsInStatusActive: [], + qualityInvestigationIdsInStatusActive: [], }, { "id": "urn:uuid:d8030bbf-a874-49fb-b2e1-7610f0ccad12", @@ -242,8 +242,8 @@ export const mockBmwAssets = [ } } ], - qualityAlertsInStatusActive: 0, - qualityInvestigationsInStatusActive: 0, + qualityAlertIdsInStatusActive: [], + qualityInvestigationIdsInStatusActive: [], }, { "id": "urn:uuid:5205f736-8fc2-4585-b869-6bf36842369a", @@ -274,8 +274,8 @@ export const mockBmwAssets = [ } } ], - qualityAlertsInStatusActive: 0, - qualityInvestigationsInStatusActive: 0, + qualityAlertIdsInStatusActive: [], + qualityInvestigationIdsInStatusActive: [], }, { "id": "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fa02", @@ -311,8 +311,8 @@ export const mockBmwAssets = [ } } ], - qualityAlertsInStatusActive: 0, - qualityInvestigationsInStatusActive: 0, + qualityAlertIdsInStatusActive: [], + qualityInvestigationIdsInStatusActive:[], }, { "id": "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb01", @@ -343,8 +343,8 @@ export const mockBmwAssets = [ } } ], - qualityAlertsInStatusActive: 0, - qualityInvestigationsInStatusActive: 0, + qualityAlertIdsInStatusActive: [], + qualityInvestigationIdsInStatusActive: [], }, { "id": "urn:uuid:6b2296cc-26c0-4f38-8a22-092338c36e22", @@ -380,8 +380,8 @@ export const mockBmwAssets = [ } } ], - qualityAlertsInStatusActive: 0, - qualityInvestigationsInStatusActive: 0, + qualityAlertIdsInStatusActive: [], + qualityInvestigationIdsInStatusActive: [], }, { "id": "urn:uuid:c47b9f8b-48d0-4ef4-8f0b-e965a225cb8d", @@ -412,8 +412,8 @@ export const mockBmwAssets = [ } } ], - qualityAlertsInStatusActive: 0, - qualityInvestigationsInStatusActive: 0, + qualityAlertIdsInStatusActive: [], + qualityInvestigationIdsInStatusActive: [], }, { "id": "urn:uuid:f11ddc62-3bd5-468f-b7b0-110fe13ed0cd", @@ -444,8 +444,8 @@ export const mockBmwAssets = [ } } ], - qualityAlertsInStatusActive: 0, - qualityInvestigationsInStatusActive: 0, + qualityAlertIdsInStatusActive: [], + qualityInvestigationIdsInStatusActive: [], }, { "id": "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb02", @@ -476,8 +476,8 @@ export const mockBmwAssets = [ } } ], - qualityAlertsInStatusActive: 0, - qualityInvestigationsInStatusActive: 0, + qualityAlertIdsInStatusActive: [], + qualityInvestigationIdsInStatusActive:[], }, { "id": "urn:uuid:7eeeac86-7b69-444d-81e6-655d0f1513bd", @@ -508,8 +508,8 @@ export const mockBmwAssets = [ } } ], - qualityAlertsInStatusActive: 0, - qualityInvestigationsInStatusActive: 0, + qualityAlertIdsInStatusActive:[], + qualityInvestigationIdsInStatusActive: [], }, ] as PartResponse[]; @@ -541,8 +541,8 @@ const MockEmptyPart: PartResponse = { qualityType: QualityType.Ok, van: null, semanticDataModel: SemanticDataModel.SERIALPART, - qualityAlertsInStatusActive: 0, - qualityInvestigationsInStatusActive: 0, + qualityAlertIdsInStatusActive: [], + qualityInvestigationIdsInStatusActive: [], }; diff --git a/frontend/src/app/modules/page/parts/model/parts.model.ts b/frontend/src/app/modules/page/parts/model/parts.model.ts index 9b2234a088..cd32d4ca27 100644 --- a/frontend/src/app/modules/page/parts/model/parts.model.ts +++ b/frontend/src/app/modules/page/parts/model/parts.model.ts @@ -26,75 +26,75 @@ import { MainAspectType } from '@page/parts/model/mainAspectType.enum'; import { Owner } from '@page/parts/model/owner.enum'; export interface Part { - id: string; - idShort: string; - name: string; - manufacturer: string; - manufacturerPartId: string; - nameAtManufacturer: string; - businessPartner: string - semanticModel?: SemanticModel; - semanticModelId: string; - qualityType: QualityType; - children: string[]; - parents?: string[]; - error?: boolean; - activeInvestigation?: boolean; - activeAlert: boolean; - van: string; - semanticDataModel: SemanticDataModel; - classification: string; - - mainAspectType: MainAspectType; - - // aspectmodel props are temporarely hardcoded here because Tables and Views only accept root level prop array - // as built - partId?: string; - customerPartId?: string; - nameAtCustomer?: string; - manufacturingDate?: string; - manufacturingCountry?: string; - - productType?: string; - tractionBatteryCode?: string; - subcomponents: TractionBatteryCode[]; - - // as planned - validityPeriodFrom?: string; - validityPeriodTo?: string; - //partSiteInformationAsPlanned - catenaXSiteId: string; - psFunction: string; - functionValidFrom?: string; - functionValidUntil?: string; + id: string; + idShort: string; + name: string; + manufacturer: string; + manufacturerPartId: string; + nameAtManufacturer: string; + businessPartner: string; + semanticModel?: SemanticModel; + semanticModelId: string; + qualityType: QualityType; + children: string[]; + parents?: string[]; + error?: boolean; + activeInvestigation?: boolean; + activeAlert: boolean; + van: string; + semanticDataModel: SemanticDataModel; + classification: string; + + mainAspectType: MainAspectType; + + // aspectmodel props are temporarely hardcoded here because Tables and Views only accept root level prop array + // as built + partId?: string; + customerPartId?: string; + nameAtCustomer?: string; + manufacturingDate?: string; + manufacturingCountry?: string; + + productType?: string; + tractionBatteryCode?: string; + subcomponents: TractionBatteryCode[]; + + // as planned + validityPeriodFrom?: string; + validityPeriodTo?: string; + //partSiteInformationAsPlanned + catenaXSiteId: string; + psFunction: string; + functionValidFrom?: string; + functionValidUntil?: string; // count of notifications - activeAlerts: number; - activeInvestigations: number; + activeAlerts: string []; + activeInvestigations: string []; } export interface PartResponse { - id: string; - idShort: string; - semanticModelId: string; - manufacturerPartId: string; - businessPartner: string; - manufacturerName: string; - nameAtManufacturer: string; - owner: Owner; - childRelations: Relation[]; - parentRelations: Relation[]; - activeAlert: boolean; - underInvestigation: boolean; - qualityType: QualityType; - van: string; - semanticDataModel: SemanticDataModel; - classification: string; + id: string; + idShort: string; + semanticModelId: string; + manufacturerPartId: string; + businessPartner: string; + manufacturerName: string; + nameAtManufacturer: string; + owner: Owner; + childRelations: Relation[]; + parentRelations: Relation[]; + activeAlert: boolean; + underInvestigation: boolean; + qualityType: QualityType; + van: string; + semanticDataModel: SemanticDataModel; + classification: string; detailAspectModels: DetailAspectModel[]; // TODO: Delete ? flag when AsPlanned Parts do not return the props anymore - qualityAlertsInStatusActive?: number; - qualityInvestigationsInStatusActive?: number; + qualityAlertIdsInStatusActive?: string[]; + qualityInvestigationIdsInStatusActive?: string[]; } @@ -102,77 +102,77 @@ export type PartsResponse = PaginationResponse; // TODO: needs to be aligned with Severity in the future in terms of coding standards and use export enum QualityType { - Ok = 'Ok', - Minor = 'Minor', - Major = 'Major', - Critical = 'Critical', - LifeThreatening = 'LifeThreatening', + Ok = 'Ok', + Minor = 'Minor', + Major = 'Major', + Critical = 'Critical', + LifeThreatening = 'LifeThreatening', } export enum SemanticDataModel { - BATCH = 'BATCH', - SERIALPART = 'SERIALPART', - PARTASPLANNED = 'PARTASPLANNED', - JUSTINSEQUENCE = 'JUSTINSEQUENCE', - TRACTIONBATTERYCODE = 'TRACTIONBATTERYCODE', - UNKNOWN = 'UNKNOWN' + BATCH = 'BATCH', + SERIALPART = 'SERIALPART', + PARTASPLANNED = 'PARTASPLANNED', + JUSTINSEQUENCE = 'JUSTINSEQUENCE', + TRACTIONBATTERYCODE = 'TRACTIONBATTERYCODE', + UNKNOWN = 'UNKNOWN' } export enum SemanticDataModelInCamelCase { - BATCH = "Batch", - SERIALPART = 'SerialPart', - PARTASPLANNED = 'PartAsPlanned', - JUSTINSEQUENCE = 'JustInSequence', - TRACTIONBATTERYCODE = 'TractionBatteryCode', - UNKNOWN = 'Unknown' + BATCH = 'Batch', + SERIALPART = 'SerialPart', + PARTASPLANNED = 'PartAsPlanned', + JUSTINSEQUENCE = 'JustInSequence', + TRACTIONBATTERYCODE = 'TractionBatteryCode', + UNKNOWN = 'Unknown' } export interface Relation { - id: string; - idShort: string; + id: string; + idShort: string; } export interface AssetAsBuiltFilter { - id?: string, - idShort?: string, - name?: string, - manufacturer?: string, - partId?: string, - manufacturerPartId?: string, - customerPartId?: string, - classification?: string, - nameAtCustomer?: string, - semanticModelId?: string, - semanticDataModel?: string[], - manufacturingDate?: string, - manufacturingCountry?: string + id?: string, + idShort?: string, + name?: string, + manufacturer?: string, + partId?: string, + manufacturerPartId?: string, + customerPartId?: string, + classification?: string, + nameAtCustomer?: string, + semanticModelId?: string, + semanticDataModel?: string[], + manufacturingDate?: string, + manufacturingCountry?: string } export interface AssetAsPlannedFilter { - id?: string, - idShort?: string, - name?: string, - manufacturer?: string, - manufacturerPartId?: string, - classification?: string, - semanticDataModel?: string[], - semanticModelId?: string, - validityPeriodFrom?: string, - validityPeriodTo?: string, - psFunction?: string, - catenaXSiteId?: string, - functionValidFrom?: string, - functionValidUntil?: string, + id?: string, + idShort?: string, + name?: string, + manufacturer?: string, + manufacturerPartId?: string, + classification?: string, + semanticDataModel?: string[], + semanticModelId?: string, + validityPeriodFrom?: string, + validityPeriodTo?: string, + psFunction?: string, + catenaXSiteId?: string, + functionValidFrom?: string, + functionValidUntil?: string, } export enum FilterOperator { - EQUAL = 'EQUAL', - AT_LOCAL_DATE = 'AT_LOCAL_DATE', - STARTS_WITH = 'STARTS_WITH', - BEFORE_LOCAL_DATE = "BEFORE_LOCAL_DATE", - AFTER_LOCAL_DATE = "AFTER_LOCAL_DATE" + EQUAL = 'EQUAL', + AT_LOCAL_DATE = 'AT_LOCAL_DATE', + STARTS_WITH = 'STARTS_WITH', + BEFORE_LOCAL_DATE = 'BEFORE_LOCAL_DATE', + AFTER_LOCAL_DATE = 'AFTER_LOCAL_DATE' } export function getFilterOperatorValue(operator: FilterOperator) { - return operator as string; + return operator as string; } diff --git a/frontend/src/app/modules/shared/assembler/parts.assembler.ts b/frontend/src/app/modules/shared/assembler/parts.assembler.ts index 3f81fdce98..93c1a01281 100644 --- a/frontend/src/app/modules/shared/assembler/parts.assembler.ts +++ b/frontend/src/app/modules/shared/assembler/parts.assembler.ts @@ -117,8 +117,8 @@ export class PartsAssembler { functionValidUntil: functionValidUntil, // count of notifications - activeAlerts: partResponse.qualityAlertsInStatusActive, - activeInvestigations: partResponse.qualityInvestigationsInStatusActive, + activeAlerts: partResponse.qualityAlertIdsInStatusActive, + activeInvestigations: partResponse.qualityInvestigationIdsInStatusActive, } return mappedPart; @@ -269,8 +269,8 @@ export class PartsAssembler { ['psFunction', 'function'], ['functionValidFrom', 'functionValidFrom'], ['functionValidUntil', 'functionValidUntil'], - [ 'activeAlerts', 'qualityAlertsInStatusActive' ], - [ 'activeInvestigations', 'qualityInvestigationsInStatusActive' ], + [ 'activeAlerts', 'qualityAlertIdsInStatusActive' ], + [ 'activeInvestigations', 'qualityInvestigationIdsInStatusActive' ], ]); diff --git a/frontend/src/app/modules/shared/components/parts-table/parts-table.component.html b/frontend/src/app/modules/shared/components/parts-table/parts-table.component.html index fe5b7f90ca..45732e5b55 100644 --- a/frontend/src/app/modules/shared/components/parts-table/parts-table.component.html +++ b/frontend/src/app/modules/shared/components/parts-table/parts-table.component.html @@ -194,10 +194,10 @@

{{ 'table.noResultFound' | i18n }}

- - {{ element[column] | date:'yyyy-MM-dd' }} - - + + + {{isDateElement(column) ? (element[column] | date:'yyyy-MM-dd') : element[column]?.length }} + notifications) { + protected static List gettNotificationIdsInActiveState(List notifications) { return emptyIfNull(notifications).stream() .filter(QualityNotification::isActiveState) - .toList().size(); + .map(QualityNotification::getNotificationId) + .map(QualityNotificationId::value) + .toList(); } private static List from(List subcomponents) { diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsBuiltControllerByIdIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsBuiltControllerByIdIT.java index 3393e765a8..d2788093ab 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsBuiltControllerByIdIT.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsBuiltControllerByIdIT.java @@ -49,7 +49,7 @@ import static org.eclipse.tractusx.traceability.qualitynotification.infrastructure.model.NotificationStatusBaseEntity.RECEIVED; import static org.eclipse.tractusx.traceability.qualitynotification.infrastructure.model.NotificationStatusBaseEntity.SENT; import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.hasSize; import static org.junit.jupiter.params.provider.Arguments.arguments; class AssetAsBuiltControllerByIdIT extends IntegrationTestSpecification { @@ -101,7 +101,7 @@ void givenAlertsForAsset_whenCallAssetById_thenReturnProperCount() throws JoseEx .log().all() .statusCode(200) .assertThat() - .body("qualityAlertsInStatusActive", is(6)); + .body("qualityAlertIdsInStatusActive", hasSize(6)); } @Test @@ -127,7 +127,7 @@ void givenInvestigationsForAsset_whenCallAssetById_thenReturnProperCount() throw .then() .statusCode(200) .assertThat() - .body("qualityInvestigationsInStatusActive", is(6)); + .body("qualityInvestigationIdsInStatusActive", hasSize(6)); } @Test diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsPlannedControllerByIdIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsPlannedControllerByIdIT.java index 498afe1ff6..9fb9bc8e15 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsPlannedControllerByIdIT.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsPlannedControllerByIdIT.java @@ -48,6 +48,7 @@ import static org.eclipse.tractusx.traceability.qualitynotification.infrastructure.model.NotificationStatusBaseEntity.RECEIVED; import static org.eclipse.tractusx.traceability.qualitynotification.infrastructure.model.NotificationStatusBaseEntity.SENT; import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.is; import static org.junit.jupiter.params.provider.Arguments.arguments; @@ -98,7 +99,7 @@ void givenAlertsForAsset_whenCallAssetById_thenReturnProperCount() throws JoseEx .log().all() .statusCode(200) .assertThat() - .body("qualityAlertsInStatusActive", is(6)); + .body("qualityAlertIdsInStatusActive", hasSize(6)); } @Test @@ -124,7 +125,7 @@ void givenInvestigationsForAsset_whenCallAssetById_thenReturnProperCount() throw .then() .statusCode(200) .assertThat() - .body("qualityInvestigationsInStatusActive", is(6)); + .body("qualityInvestigationIdsInStatusActive", hasSize(6)); } @Test diff --git a/tx-models/src/main/java/assets/response/base/AssetBaseResponse.java b/tx-models/src/main/java/assets/response/base/AssetBaseResponse.java index f46b33aab8..7e6b1d5dc4 100644 --- a/tx-models/src/main/java/assets/response/base/AssetBaseResponse.java +++ b/tx-models/src/main/java/assets/response/base/AssetBaseResponse.java @@ -75,8 +75,8 @@ public class AssetBaseResponse { @Size(max = 255) private String classification; private List detailAspectModels; - @ApiModelProperty(example = "1") - private Integer qualityAlertsInStatusActive; - @ApiModelProperty(example = "2") - private Integer qualityInvestigationsInStatusActive; + @ApiModelProperty(dataType = "List", example = "1") + private List qualityAlertIdsInStatusActive; + @ApiModelProperty(dataType = "List", example = "2") + private List qualityInvestigationIdsInStatusActive; }