Skip to content

Commit

Permalink
Merge pull request #982 from catenax-ng/main
Browse files Browse the repository at this point in the history
sync
  • Loading branch information
ds-mwesener authored May 15, 2024
2 parents a0074e8 + 7eaeec6 commit 041f486
Show file tree
Hide file tree
Showing 45 changed files with 15,374 additions and 225 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/argo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -378,19 +378,19 @@ jobs:
curl -o transform-and-upload.py https://raw.githubusercontent.com/eclipse-tractusx/item-relationship-service/main/local/testing/testdata/transform-and-upload.py
if [ "${{ github.event.inputs.testdata_upload }}" == "true" ]; then
if [ "${{ github.event.inputs.environment }}" == "Dev/Test" ]; then
python transform-and-upload.py -f ./tx-backend/testdata/CX_Testdata_MessagingTest_v${{ github.event.inputs.testdata_version }}.json -s https://traceability-test.dev.demo.catena-x.net/api/submodel/data -edc https://trace-x-test-edc.dev.demo.catena-x.net -a https://trace-x-registry-test.dev.demo.catena-x.net/semantics/registry/api/v3 -d https://trace-x-test-edc-dataplane.dev.demo.catena-x.net -p id-3.1-trace -k ${{ secrets.TRACE_X_API_KEY_DEV }} --aas3 --edcBPN BPNL00000003CNKC --allowedBPNs BPNL00000003CML1 BPNL00000003CNKC
python transform-and-upload.py -f ./tx-backend/testdata/CX_Testdata_MessagingTest_v${{ github.event.inputs.testdata_version }}.json -s https://traceability-test.dev.demo.catena-x.net/api/submodel/data -edc https://trace-x-test-edc.dev.demo.catena-x.net -a https://trace-x-registry-test.dev.demo.catena-x.net/semantics/registry/api/v3 -d https://trace-x-test-edc-dataplane.dev.demo.catena-x.net -p traceability-core -k ${{ secrets.TRACE_X_API_KEY_DEV }} --aas3 --edcBPN BPNL00000003CNKC --allowedBPNs BPNL00000003CML1 BPNL00000003CNKC
sleep 10
python transform-and-upload.py -f ./tx-backend/testdata/CX_Testdata_MessagingTest_v${{ github.event.inputs.testdata_version }}.json -s https://traceability.dev.demo.catena-x.net/api/submodel/data -edc https://trace-x-edc.dev.demo.catena-x.net -a https://trace-x-registry-dev.dev.demo.catena-x.net/semantics/registry/api/v3 -d https://trace-x-edc-dataplane.dev.demo.catena-x.net -p id-3.1-trace -k ${{ secrets.TRACE_X_API_KEY_DEV }} --aas3 --edcBPN BPNL00000003CML1 --allowedBPNs BPNL00000003CML1 BPNL00000003CNKC
python transform-and-upload.py -f ./tx-backend/testdata/CX_Testdata_MessagingTest_v${{ github.event.inputs.testdata_version }}.json -s https://traceability.dev.demo.catena-x.net/api/submodel/data -edc https://trace-x-edc.dev.demo.catena-x.net -a https://trace-x-registry-dev.dev.demo.catena-x.net/semantics/registry/api/v3 -d https://trace-x-edc-dataplane.dev.demo.catena-x.net -p traceability-core -k ${{ secrets.TRACE_X_API_KEY_DEV }} --aas3 --edcBPN BPNL00000003CML1 --allowedBPNs BPNL00000003CML1 BPNL00000003CNKC
sleep 10
elif [ "${{ github.event.inputs.environment }}" == "E2E-A/E2E-B" ]; then
python transform-and-upload.py -f ./tx-backend/testdata/CX_Testdata_MessagingTest_v${{ github.event.inputs.testdata_version }}.json -s https://traceability-e2e-a.dev.demo.catena-x.net/api/submodel/data -edc https://trace-x-edc-e2e-a.dev.demo.catena-x.net -a https://trace-x-registry-e2e-a.dev.demo.catena-x.net/semantics/registry/api/v3 -d https://trace-x-edc-e2e-a-dataplane.dev.demo.catena-x.net -p id-3.1-trace -k ${{ secrets.TRACE_X_API_KEY_DEV }} --aas3 --edcBPN BPNL00000003CML1 --allowedBPNs BPNL00000003CML1 BPNL00000003CNKC
python transform-and-upload.py -f ./tx-backend/testdata/CX_Testdata_MessagingTest_v${{ github.event.inputs.testdata_version }}.json -s https://traceability-e2e-a.dev.demo.catena-x.net/api/submodel/data -edc https://trace-x-edc-e2e-a.dev.demo.catena-x.net -a https://trace-x-registry-e2e-a.dev.demo.catena-x.net/semantics/registry/api/v3 -d https://trace-x-edc-e2e-a-dataplane.dev.demo.catena-x.net -p traceability-core -k ${{ secrets.TRACE_X_API_KEY_DEV }} --aas3 --edcBPN BPNL00000003CML1 --allowedBPNs BPNL00000003CML1 BPNL00000003CNKC
sleep 10
python transform-and-upload.py -f ./tx-backend/testdata/CX_Testdata_MessagingTest_v${{ github.event.inputs.testdata_version }}.json -s https://traceability-e2e-b.dev.demo.catena-x.net/api/submodel/data -edc https://trace-x-edc-e2e-b.dev.demo.catena-x.net -a https://trace-x-registry-e2e-b.dev.demo.catena-x.net/semantics/registry/api/v3 -d https://trace-x-edc-e2e-b-dataplane.dev.demo.catena-x.net -p id-3.1-trace -k ${{ secrets.TRACE_X_API_KEY_DEV }} --aas3 --edcBPN BPNL00000003CNKC --allowedBPNs BPNL00000003CML1 BPNL00000003CNKC
python transform-and-upload.py -f ./tx-backend/testdata/CX_Testdata_MessagingTest_v${{ github.event.inputs.testdata_version }}.json -s https://traceability-e2e-b.dev.demo.catena-x.net/api/submodel/data -edc https://trace-x-edc-e2e-b.dev.demo.catena-x.net -a https://trace-x-registry-e2e-b.dev.demo.catena-x.net/semantics/registry/api/v3 -d https://trace-x-edc-e2e-b-dataplane.dev.demo.catena-x.net -p traceability-core -k ${{ secrets.TRACE_X_API_KEY_DEV }} --aas3 --edcBPN BPNL00000003CNKC --allowedBPNs BPNL00000003CML1 BPNL00000003CNKC
sleep 10
elif [ "${{ github.event.inputs.environment }}" == "int-a/int-b" ]; then
python transform-and-upload.py -f ./tx-backend/testdata/CX_Testdata_MessagingTest_v${{ github.event.inputs.testdata_version }}.json -s https://traceability-int-a.int.demo.catena-x.net/api/submodel/data -edc https://trace-x-edc-int-a.int.demo.catena-x.net -a https://trace-x-registry-int-a.int.demo.catena-x.net/semantics/registry/api/v3 -d https://trace-x-edc-int-a-dataplane.int.demo.catena-x.net -p id-3.1-trace -k ${{ secrets.TRACE_X_API_KEY_INT_A }} --aas3 --edcBPN BPNL00000003CML1 --allowedBPNs BPNL00000003CML1 BPNL00000003CNKC BPNL00000003AZQP BPNL00000003CSGV
python transform-and-upload.py -f ./tx-backend/testdata/CX_Testdata_MessagingTest_v${{ github.event.inputs.testdata_version }}.json -s https://traceability-int-a.int.demo.catena-x.net/api/submodel/data -edc https://trace-x-edc-int-a.int.demo.catena-x.net -a https://trace-x-registry-int-a.int.demo.catena-x.net/semantics/registry/api/v3 -d https://trace-x-edc-int-a-dataplane.int.demo.catena-x.net -p traceability-core -k ${{ secrets.TRACE_X_API_KEY_INT_A }} --aas3 --edcBPN BPNL00000003CML1 --allowedBPNs BPNL00000003CML1 BPNL00000003CNKC BPNL00000003AZQP BPNL00000003CSGV
sleep 10
python transform-and-upload.py -f ./tx-backend/testdata/CX_Testdata_MessagingTest_v${{ github.event.inputs.testdata_version }}.json -s https://traceability-int-b.int.demo.catena-x.net/api/submodel/data -edc https://trace-x-edc-int-b.int.demo.catena-x.net -a https://trace-x-registry-int-b.int.demo.catena-x.net/semantics/registry/api/v3 -d https://trace-x-edc-int-b-dataplane.int.demo.catena-x.net -p id-3.1-trace -k ${{ secrets.TRACE_X_API_KEY_INT_B }} --aas3 --edcBPN BPNL00000003CNKC --allowedBPNs BPNL00000003CML1 BPNL00000003CNKC BPNL00000003AZQP BPNL00000003CSGV
python transform-and-upload.py -f ./tx-backend/testdata/CX_Testdata_MessagingTest_v${{ github.event.inputs.testdata_version }}.json -s https://traceability-int-b.int.demo.catena-x.net/api/submodel/data -edc https://trace-x-edc-int-b.int.demo.catena-x.net -a https://trace-x-registry-int-b.int.demo.catena-x.net/semantics/registry/api/v3 -d https://trace-x-edc-int-b-dataplane.int.demo.catena-x.net -p traceability-core -k ${{ secrets.TRACE_X_API_KEY_INT_B }} --aas3 --edcBPN BPNL00000003CNKC --allowedBPNs BPNL00000003CML1 BPNL00000003CNKC BPNL00000003AZQP BPNL00000003CSGV
sleep 10
fi
elif [ "${{ github.event.inputs.testdata_upload }}" == "false" ]; then
Expand Down
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,18 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

_**For better traceability add the corresponding GitHub issue number in each changelog entry, please.**_
## [UNRELEASED - DD.MM.YYYY]
### Changed
- #837 Moved data import and IrsResponseMappers under same interface and shared methods

### Added
- #859 added autocomplete on subset of assets in notification creation/edit view

### Changed
- #778 return empty PageResult when no contract agreement Ids are found instead of http 404 in /contacts API
- #XXX Fixed some sonar issues in frontend application
- #958 Fixed bug where available parts filter was reset when list of affected parts are zero in notification creation
- XXX Removed EdcNotifiactionMockServiceImpl class and replaced with mocks
- #XXX Switched eclipse-temurin:21-jre-alpine@sha256:fb4150a30569aadae9d693d949684a00653411528e62498b9900940c9b5b8a66 to 23467b3e42617ca197f43f58bc5fb03ca4cb059d68acd49c67128bfded132d67
- #837 Moved data import and IrsResponseMappers under same interface and shared methods
- #947 Updating irs-helm from 7.1.1 to 7.1.2 to use latest catena-x policy

## [11.0.0 - 08.05.2024]
### Added
Expand Down
2 changes: 1 addition & 1 deletion charts/traceability-foss/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ dependencies:
condition: pgadmin4.enabled
- name: item-relationship-service
repository: https://eclipse-tractusx.github.io/item-relationship-service
version: 7.1.1
version: 7.1.2
condition: item-relationship-service.enabled
- name: tractusx-connector
repository: https://eclipse-tractusx.github.io/tractusx-edc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ spec:
value: {{ .Values.traceability.operatorType | quote }}
- name: TRACEABILITY_RIGHT_OPERAND
value: {{ .Values.traceability.rightOperand | quote }}
- name: TRACEABILITY_LEFT_OPERAND_SECOND
value: {{ .Values.traceability.leftOperandSecond | quote }}
- name: TRACEABILITY_OPERATOR_TYPE_SECOND
value: {{ .Values.traceability.operatorTypeSecond | quote }}
- name: TRACEABILITY_RIGHT_OPERAND_SECOND
value: {{ .Values.traceability.rightOperandSecond | quote }}
- name: TRACEABILITY_VALID_UNTIL
value: {{ .Values.traceability.validUntil | quote }}
- name: OAUTH2_CLIENT_ID
Expand Down
3 changes: 3 additions & 0 deletions charts/traceability-foss/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,9 @@ backend:
leftOperand: "PURPOSE"
operatorType: "eq"
rightOperand: "ID 3.0 Trace"
leftOperandSecond: "anything"
operatorTypeSecond: "eq"
rightOperandSecond: "anything"
validUntil: "2024-09-30T23:59:59.99Z"
datasource:
url: jdbc:postgresql://tx-backend-postgresql:5432/trace
Expand Down
7,510 changes: 7,509 additions & 1 deletion docs/api/traceability-foss-backend.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,9 @@ Then('selected {string} has been {string} as expected', function(notificationTyp
break;
}
case 'approved': {
cy.wait(3000);
cy.wait(10000);
// same as "requested"
cy.get('[title="Requested"]', { timeout: 10000 }).should('be.visible');
cy.get('[title="Requested"]', { timeout: 20000 }).should('be.visible');
break;
}
case 'accepted': {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
[multiSortList]="tableAsBuiltSortList"
[tableType]="TableType.AS_BUILT_OWN"
[mainAspectType]="MainAspectType.AS_BUILT"
[assetIdsForAutoCompleteFilter]="this.affectedPartIds"
></app-parts-table>
</ng-template>
</div>
Expand Down Expand Up @@ -164,6 +165,7 @@
[multiSortList]="tableAsBuiltSortList"
[tableType]="TableType.AS_BUILT_OWN"
[mainAspectType]="MainAspectType.AS_BUILT"
[assetIdsForAutoCompleteFilter]="this.availablePartIds"
></app-parts-table>
</ng-template>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import { Notification, NotificationType } from '@shared/model/notification.model
import { View } from '@shared/model/view.model';
import { StaticIdService } from '@shared/service/staticId.service';
import { BehaviorSubject, Observable, Subject, Subscription } from 'rxjs';
import { distinctUntilChanged } from 'rxjs/operators';

@Component({
selector: 'app-notification-edit',
Expand All @@ -60,6 +61,7 @@ export class NotificationEditComponent implements OnDestroy {
public notificationFormGroup: FormGroup;

public affectedPartIds: string[] = this.sharedPartService?.affectedParts?.map(value => value.id) || [];
public availablePartIds: string[] = [];
public temporaryAffectedParts: Part[] = [];
public temporaryAffectedPartsForRemoval: Part[] = [];
public readonly currentSelectedAvailableParts$ = new BehaviorSubject<Part[]>([]);
Expand Down Expand Up @@ -113,6 +115,15 @@ export class NotificationEditComponent implements OnDestroy {
this.isSaveButtonDisabled = false;
this.handleCreateNotification();
}

this.ownPartsFacade.partsAsBuilt$.pipe(
distinctUntilChanged((prev, curr) => prev?.data?.content?.length === curr?.data?.content?.length),
).subscribe(
data => {
this.availablePartIds = data?.data?.content?.map(part => part.id).filter(element => !this.affectedPartIds.includes(element));
},
);

}

private handleEditNotification() {
Expand Down Expand Up @@ -157,7 +168,6 @@ export class NotificationEditComponent implements OnDestroy {

public notificationFormGroupChange(notificationFormGroup: FormGroup) {
// if user switches type of notification in creation mode, reset affected parts and reload new available parts
console.log(notificationFormGroup, "group");
if (this.selectedNotification.type !== notificationFormGroup.getRawValue().type) {
this.selectedNotification.type = notificationFormGroup.getRawValue().type;
this.switchSelectedNotificationTypeAndResetParts();
Expand Down Expand Up @@ -276,7 +286,11 @@ export class NotificationEditComponent implements OnDestroy {

if (!this.affectedPartIds || this.affectedPartIds.length === 0) {
this.ownPartsFacade.setPartsAsBuiltSecondEmpty();
this.ownPartsFacade.setPartsAsBuilt();
this.ownPartsFacade.setPartsAsBuilt(FIRST_PAGE, DEFAULT_PAGE_SIZE, this.tableAsBuiltSortList, {
excludeIds: [],
ids: [],
owner: this.selectedNotification.type === NotificationType.INVESTIGATION ? Owner.SUPPLIER : Owner.OWN,
});
this.isSaveButtonDisabled = true;
} else {
this.isSaveButtonDisabled = this.notificationFormGroup.invalid || this.affectedPartIds.length < 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ import { AdminService } from '@page/admin/core/admin.service';
import { NotificationChannel, TableType } from '@shared/components/multi-select-autocomplete/table-type.model';
import { NotificationService } from '@shared/service/notification.service';
import { PartsService } from '@shared/service/parts.service';
import { of } from 'rxjs';

export abstract class AutocompleteStrategy {
abstract retrieveSuggestionValues(tableType: TableType, filterColumns: string, searchElement: string): any;
abstract retrieveSuggestionValues(tableType: TableType, filterColumns: string, searchElement: string, inAssetIds?: string[]): any;
}

@Injectable({
Expand All @@ -37,12 +38,18 @@ export class PartsStrategy extends AutocompleteStrategy {
this.partsService = partsService;
}

retrieveSuggestionValues(tableType: TableType, filterColumns: string, searchElement: string): any {
retrieveSuggestionValues(tableType: TableType, filterColumns: string, searchElement: string, inAssetIds?: string[]): any {
const asBuilt = isAsBuilt(tableType);

if(inAssetIds?.length < 1) {
return of([]);
}

return this.partsService.getDistinctFilterValues(
asBuilt,
filterColumns,
searchElement,
inAssetIds,
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ export class MultiSelectAutocompleteComponent implements OnChanges {

searchElement: string = '';

@Input()
inAssetIds: string[] = [];

searchElementChange: EventEmitter<any> = new EventEmitter();

@ViewChild('selectElem', { static: true }) selectElem: any;
Expand Down Expand Up @@ -205,9 +208,9 @@ export class MultiSelectAutocompleteComponent implements OnChanges {
const timeoutCallback = async (): Promise<void> => {
this.isLoadingSuggestions = true;
try {
firstValueFrom(this.strategy.retrieveSuggestionValues(this.tableType, this.filterColumn, this.searchElement)).then((res) => {
firstValueFrom(this.strategy.retrieveSuggestionValues(this.tableType, this.filterColumn, this.searchElement, this.inAssetIds)).then((res) => {
// @ts-ignore
this.searchedOptions = res.filter(option => !this.selectedValue.includes(option))
this.searchedOptions = res.filter(option => !this.selectedValue?.includes(option))
.map(option => ({ display: option, value: option }));
this.options = this.searchedOptions;
// @ts-ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@
[singleSearch]="filter.singleSearch"
[filterColumn]="filter.filterKey"
[tableType]="tableType"
[inAssetIds]="assetIdsForAutoCompleteFilter"
[placeholderMultiple]="('multiSelect.multipleResults' | i18n)"
ngDefaultControl
[formControl]="filterFormGroup.controls[filter.filterKey]">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ export class PartsTableComponent implements OnInit {
@Input() tableType: TableType;
@Input() mainAspectType: MainAspectType;

@Input() assetIdsForAutoCompleteFilter: string[];

public tableConfig: TableConfig;

@Input() set paginationData({ page, pageSize, totalItems, content }: Pagination<unknown>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export class FormatPartlistSemanticDataModelToCamelCasePipe implements PipeTrans
transform(partList: Part[] | any[]): Part[] | any[] {

partList.forEach(part => {
console.log(part.semanticDataModel.toString().toLowerCase());
switch (part.semanticDataModel.toString().toLowerCase()) {

case 'batch': {
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/app/modules/shared/service/parts.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,13 @@ export class PartsService {

}

public getDistinctFilterValues(isAsBuilt: boolean, fieldNames: string, startsWith: string) {
public getDistinctFilterValues(isAsBuilt: boolean, fieldNames: string, startsWith: string, inAssetIds?: string[]) {
const mappedFieldName = PartsAssembler.mapFieldNameToApi(fieldNames);
let params = new HttpParams()
.set('fieldName', mappedFieldName)
.set('startWith', startsWith)
.set('size', 200);

.set('size', 200)
.set('inAssetIds', inAssetIds ? inAssetIds.join(',') : '')

if (isAsBuilt) {
return this.apiService
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ SPDX-License-Identifier: Apache-2.0
<cucumber.version>7.17.0</cucumber.version>
<junit-bom.version>5.10.2</junit-bom.version>
<awaitility.version>4.2.1</awaitility.version>
<irs-client-lib.version>2.0.1</irs-client-lib.version>
<irs-client-lib.version>2.0.3</irs-client-lib.version>
<json-schema-validator.version>5.4.0</json-schema-validator.version>
<!-- Sonar related properties -->
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
Expand Down
7,510 changes: 7,509 additions & 1 deletion tx-backend/openapi/traceability-foss-backend.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@

import java.util.List;

import static org.apache.commons.collections4.ListUtils.emptyIfNull;

@UtilityClass
public class PolicyMapper {
public static EdcCreatePolicyDefinitionRequest mapToEdcPolicyRequest(PolicyResponse policy) {
Expand All @@ -58,11 +60,12 @@ private static EdcPolicyPermissionConstraint mapToConstraint(ConstraintsResponse
return EdcPolicyPermissionConstraint.builder()
.type("AtomicConstraint")
.orExpressions(mapToConstraintExpression(constraintsResponse.or()))
.andExpressions(mapToConstraintExpression(constraintsResponse.and()))
.build();
}

private static List<EdcPolicyPermissionConstraintExpression> mapToConstraintExpression(List<ConstraintResponse> constraints) {
return constraints.stream().map(constraint -> EdcPolicyPermissionConstraintExpression.builder()
return emptyIfNull(constraints).stream().map(constraint -> EdcPolicyPermissionConstraintExpression.builder()
.type("Constraint")
.leftOperand(constraint.leftOperand())
.rightOperand(constraint.rightOperand())
Expand Down
Loading

0 comments on commit 041f486

Please sign in to comment.