Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/eclipse/main' into chore/#985
Browse files Browse the repository at this point in the history
-fe-contract-reference
  • Loading branch information
ds-mmaul committed Jun 28, 2024
2 parents fef0d52 + 4df9128 commit ba43c5d
Show file tree
Hide file tree
Showing 42 changed files with 311 additions and 190 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/helm-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ on:
- 'charts/**'

workflow_dispatch:
inputs:
node_image:
description: 'kindest/node image for k8s kind cluster'
default: 'kindest/node:v1.27.3'
required: false
type: string
workflow_call: # Trigger by another workflow
inputs:
node_image:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/publish-documentation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ jobs:
locale
asciidoctor-reducer -o docs/target/adminguide.adoc docs/src/docs/administration/administration-guide.adoc
asciidoctor-reducer -o docs/target/arc42.adoc docs/src/docs/arc42/full.adoc
asciidoctor-reducer -o docs/target/user-manual.adoc docs/src/docs/user/user-manual.adoc
- name: Cache plantuml jar
uses: actions/cache@v3
Expand All @@ -104,7 +105,7 @@ jobs:
run: |
npx downdoc -o docs/target/generated-docs/adminguide.md docs/src/diagram-replacer/generated-adocs/adminguide.adoc
npx downdoc -o docs/target/generated-docs/arc42.md docs/src/diagram-replacer/generated-adocs/arc42.adoc
npx downdoc -o docs/target/generated-docs/user-manual.md docs/src/docs/user/user-manual.adoc
npx downdoc -o docs/target/generated-docs/user-manual.md docs/src/diagram-replacer/generated-adocs/user-manual.adoc
- name: MD files post-processing
working-directory: docs/src/post-processing/
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ _**For better traceability add the corresponding GitHub issue number in each cha
- XXX updated local deployment documentation
- #1037 extended autocomplete api by contractAgreementId
- #985 Added function to save Contracts based on notification contractAgreementIds into the database
- #985 Added function to filter notifications for contractAgreementIds

### Added
- #832 added policymanagement list view, creator and editor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,17 @@
Module 1
[plantuml, target=modul1-sequence, format=svg]
....
include::../../../uml-diagrams/arc42/trace-x-data-import-interface/trace-x-data-import-interface-modul1-sequence.puml[]
include::../../../uml-diagrams/arc42/runtime-view/data-provisioning/trace-x-data-import-interface-modul1-sequence.puml[]
....

Module 2
[plantuml, target=modul2-sequence, format=svg]
....
include::../../../uml-diagrams/arc42/trace-x-data-import-interface/trace-x-data-import-interface-modul2-sequence.puml[]
....

[plantuml, target=modul2-swimlane, format=svg]
....
include::../../../uml-diagrams/arc42/trace-x-data-import-interface/trace-x-data-import-interface-modul2-swimlane.puml[]
include::../../../uml-diagrams/arc42/runtime-view/data-provisioning/trace-x-data-import-interface-modul2-sequence.puml[]
....

Module 3
[plantuml, target=modul3-sequence, format=svg]
....
include::../../../uml-diagrams/arc42/trace-x-data-import-interface/trace-x-data-import-interface-modul3-sequence.puml[]
include::../../../uml-diagrams/arc42/runtime-view/data-provisioning/trace-x-data-import-interface-modul3-sequence.puml[]
....

[plantuml, target=modul3-swimlane, format=svg]
....
include::../../../uml-diagrams/arc42/trace-x-data-import-interface/trace-x-data-import-interface-modul3-swimlane.puml[]
....

28 changes: 20 additions & 8 deletions docs/src/docs/user/user-manual.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ This work is licensed under the [Apache-2.0](https://www.apache.org/licenses/LIC

* SPDX-License-Identifier: Apache-2.0
* Licence Path: https://creativecommons.org/licenses/by/4.0/legalcode
* Copyright (c) 2021,2022,2023 Contributors to the Eclipse Foundation
* Copyright (c) 2021, 2022, 2023 Contributors to the Eclipse Foundation
* Copyright (c) 2022, 2023 ZF Friedrichshafen AG
* Copyright (c) 2022 ISTOS GmbH
* Copyright (c) 2022, 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
* Copyright (c) 2022,2023 BOSCH AG

* Copyright (c) 2022, 2023 BOSCH AG
* Source URL: https://github.com/eclipse-tractusx/traceability-foss

== General information
Expand Down Expand Up @@ -98,13 +97,26 @@ In the BPN-EDC configuration screen an admin user can add URLs for BPNs. Existin
image::https://raw.githubusercontent.com/eclipse-tractusx/traceability-foss/main/docs/src/images/user-manual/navigation/bpn_edc_configuration.png[]

Any configured BPNs will have their URLs merged in addition to the URLs found by the DiscoveryService.
The resulting list of URLs will be used whenever a notification is sent to those BPNs. In case an URL returns an error response, the remaining URLs will be used as backup.
The resulting list of URLs will be used whenever a notification is sent to those BPNs. In case a URL returns an error response, the remaining URLs will be used as backup.

[plantuml, target=bpn-edc-configuration, format=svg]
....
include::../../uml-diagrams/user-manual/bpn-edc-configuration.puml[]
....

|===
|ID |Description

|01
|Any URLs configured for the selected BPN in the BPN-EDC configuration are requested.

|02
|Any URLs configured for the selected BPN in the DiscoveryFinder service are requested.

|03
|All received URLs are merged into one list with identical URLs discarded.
|===

==== Contracts - view and export

In the Contracts view an admin user can view contract agreements and sort them by the contract ID.
Expand Down Expand Up @@ -470,9 +482,9 @@ image:https://raw.githubusercontent.com/eclipse-tractusx/traceability-foss/main/
=== Quality notification create/edit view

A quality notification can be started by the following options:
- Part detail view if a part has child elements an quality notification with type INVESTIGATION can be created.
- Part table if parts are selected an quality notification with type ALERT can be created.
- Other parts table if parts are selected an quality notification with type INVESTIGATION can be created.
- Part detail view if a part has child elements a quality notification with type INVESTIGATION can be created.
- Part table if parts are selected a quality notification with type ALERT can be created.
- Other parts table if parts are selected a quality notification with type INVESTIGATION can be created.

A quality notification can be edited by clicking on the context menu on an item within the inbox.

Expand All @@ -481,7 +493,7 @@ image:https://raw.githubusercontent.com/eclipse-tractusx/traceability-foss/main/

=== Quality notifications context action

Select the three dots icon on the right side of an quality notification entry to open the context menu.
Select the three dots icon on the right side of a quality notification entry to open the context menu.
From there it is possible to open the quality notification detailed view or change the status of it.
Only the possible status transition will show up.

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion docs/src/uml-diagrams/user-manual/bpn-edc-configuration.puml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
skinparam monochrome true
skinparam shadowing false
skinparam defaultFontName "Architects daughter"
autonumber "<B>[00]"

title Receive EDC URLs
participant "Trace-X" as TX
Expand All @@ -11,12 +12,15 @@ participant "DiscoveryFinder" as DF
activate TX
TX -> BEC: Look up URLs for configured BPN
activate BEC
autonumber stop
BEC --> TX: URLs
deactivate BEC
autonumber resume
TX -> DF: Look up URLs for configured BPN
activate DF
autonumber stop
DF --> TX: URLs
deactivate DF
autonumber resume
TX -> TX: Merge URLs into list (no duplicates)

@enduml
29 changes: 25 additions & 4 deletions frontend/src/app/mocks/services/policy-mock/policy.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import { OperatorType, Policy, PolicyAction, PolicyResponseMap } from '@page/pol
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/
// For now Mocks are built by current response (any). This is because Policy Model changes frequently
export const getPolicies = (): Policy[] => {
return mockedPolicyList;
export const getPolicies = (): PolicyResponseMap => {
return MockPolicyResponseMap;
};

export const getPolicyById = (policyId: string | ReadonlyArray<string>): Policy => {
Expand Down Expand Up @@ -183,11 +183,32 @@ export const MockPolicyResponseMap: PolicyResponseMap = {
'and': null,
'or': [
{
'leftOperand': 'asd',
'leftOperand': 'cx-policy:FrameworkAgreement',
'operator': {
'@id': OperatorType.EQ,
},
'odrl:rightOperand': 'dsa',
'odrl:rightOperand': 'traceability:1.0',
},
{
'leftOperand': 'cx-policy:FrameworkAgreement',
'operator': {
'@id': OperatorType.EQ,
},
'odrl:rightOperand': 'traceability:1.0',
},
{
'leftOperand': 'cx-policy:FrameworkAgreement',
'operator': {
'@id': OperatorType.EQ,
},
'odrl:rightOperand': 'traceability:1.0',
},
{
'leftOperand': 'cx-policy:FrameworkAgreement',
'operator': {
'@id': OperatorType.EQ,
},
'odrl:rightOperand': 'traceability:1.0',
},
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ describe('PoliciesAssembler', () => {
expect(assembledPolicy.createdOn).toBe('2024-01-01T00:00');
expect(assembledPolicy.validUntil).toBe('2024-12-31T23:59');
expect(assembledPolicy.accessType).toBe('USE');
expect(assembledPolicy.constraints).toEqual([ 'left1', '=', 'right1', 'left2', '!=', 'right2' ]);
expect(assembledPolicy.constraints).toEqual('left1=right1left2!=right2');

});

Expand All @@ -107,15 +107,21 @@ describe('PoliciesAssembler', () => {
},
};
const constraints = PoliciesAssembler.mapDisplayPropsToPolicyRootLevelFromPolicyEntry(policyEntry);
expect(constraints).toEqual([
'left1', '=', 'right1', 'left2', '!=', 'right2',
]);
expect(constraints).toEqual('left1=right1left2!=right2');
});

it('should map display props to policy root level from policy', () => {
const constraints = PoliciesAssembler.mapDisplayPropsToPolicyRootLevelFromPolicy(mockPolicy2);
expect(constraints).toEqual([
'left1', '=', 'right1', 'left2', '!=', 'right2',
]);
expect(constraints).toEqual('left1=right1left2!=right2');
});

it('should remove everything after the third symbol', () => {
const testString = 'a,b,c,d,e';
const result = PoliciesAssembler.removeAfterThird(',', testString);
expect(result).toEqual('a,b,c,');
const testString2 = 'a,b,c';
const resul2 = PoliciesAssembler.removeAfterThird(',', testString2);
expect(resul2).toEqual('a,b,c');
});

});
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
[showHover]="false"
[tableType]="TableType.POLICIES"
[tableSettingsEnabled]="true"
[selectedPoliciesInfoLabel]="selectedPoliciesInfoLabel"
[deselectTrigger]="deselectPartTrigger$ | async"
(selected)="openDetailedView($event)"
(editClicked)="openEditView($event)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,21 @@ describe('PoliciesComponent', () => {
expect(policyFacadeMock.setPolicies).toHaveBeenCalled();
}));

it('should call deletePolicies and handle success', fakeAsync(async () => {
const { fixture } = await renderPoliciesComponent();
const componentInstance = fixture.componentInstance;
componentInstance.selectedPolicies = [ { policyId: '1' }, { policyId: '2' } ] as Policy[];

componentInstance.multiSelection(componentInstance.selectedPolicies);
expect(componentInstance.selectedPoliciesInfoLabel).toEqual('pageAdmin.policyManagement.selectedPolicies');

componentInstance.selectedPolicies = [ { policyId: '1' } ] as Policy[];

componentInstance.multiSelection(componentInstance.selectedPolicies);
expect(componentInstance.selectedPoliciesInfoLabel).toEqual('pageAdmin.policyManagement.selectedPolicy');

}));

it('should call deletePolicies and handle error', fakeAsync(async () => {
policyFacadeMock.deletePolicies.and.returnValue(throwError('error'));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export class PoliciesComponent {
multiSortList: TableHeaderSort[] = [];
ctrlKeyState: boolean = false;
deselectPartTrigger$ = new Subject<Policy[]>();
selectedPoliciesInfoLabel: string = 'pageAdmin.policyManagement.selectedPolicies';
isDefaultSelected: boolean;

constructor(public readonly policyFacade: PoliciesFacade, private readonly router: Router, private readonly toastService: ToastService, public dialog: MatDialog, private readonly roleService: RoleService) {
window.addEventListener('keydown', (event) => {
Expand Down Expand Up @@ -82,7 +84,10 @@ export class PoliciesComponent {
}

multiSelection(selectedPolicies: Policy[]) {
this.selectedPoliciesInfoLabel = selectedPolicies.length === 1 ? 'pageAdmin.policyManagement.selectedPolicy' : 'pageAdmin.policyManagement.selectedPolicies';
this.selectedPolicies = selectedPolicies;
this.isDefaultSelected = this.selectedPolicies.filter(policy => policy?.policyId === 'default-policy').length > 0;
console.log(this.isDefaultSelected);
}

openDetailedView(selectedPolicy: Record<string, unknown>) {
Expand All @@ -103,21 +108,22 @@ export class PoliciesComponent {

dialogRef.afterClosed().subscribe(confirmation => {
if (confirmation) {
this.deletePolicies();
this.deletePolicies(this.isDefaultSelected);
this.deselectPartTrigger$.next(this.selectedPolicies);
}
});
}


deletePolicies() {
deletePolicies(isDefaultSelected?: boolean) {
this.policyFacade.deletePolicies(this.selectedPolicies).subscribe({
next: value => {
this.toastService.success('pageAdmin.policyManagement.deleteSuccess');
this.policyFacade.setPolicies();
},
error: err => {
this.toastService.error('pageAdmin.policyManagement.deleteError');
const errorMessage = isDefaultSelected === true ? 'pageAdmin.policyManagement.deleteErrorDefault' : 'pageAdmin.policyManagement.deleteError';
this.toastService.error(errorMessage);
},
});
}
Expand Down
Loading

0 comments on commit ba43c5d

Please sign in to comment.