From 9c29be7a6147d806039cb9df65055d6526821a37 Mon Sep 17 00:00:00 2001 From: Kamil Czaja Date: Tue, 16 Jul 2024 10:39:50 +0200 Subject: [PATCH 01/23] chore: added terminated contracts to fake-backend --- .../contract-agreement-fake-service.ts | 58 +++++++++++++++++++ .../api/fake-backend/edc-fake-backend.ts | 2 +- .../connector-ui-routing.module.ts | 7 ++- 3 files changed, 65 insertions(+), 2 deletions(-) diff --git a/src/app/core/services/api/fake-backend/connector-fake-impl/contract-agreement-fake-service.ts b/src/app/core/services/api/fake-backend/connector-fake-impl/contract-agreement-fake-service.ts index 639578fd8..7d500f2b8 100644 --- a/src/app/core/services/api/fake-backend/connector-fake-impl/contract-agreement-fake-service.ts +++ b/src/app/core/services/api/fake-backend/connector-fake-impl/contract-agreement-fake-service.ts @@ -126,6 +126,64 @@ let contractAgreements: ContractAgreementCard[] = [ }, ], }, + { + contractAgreementId: 'my-test-asset-cd:6ebbc301-9b1e-4cd7-9f17-97b5b786759', + contractNegotiationId: + 'my-test-asset-neg:6ebbc301-9b1e-4cd7-9f17-97b5b786759', + direction: 'CONSUMING', + counterPartyAddress: 'http://edc2:11003/api/v1/ids/data', + counterPartyId: 'MDSL1234XX.C1234XX', + contractSigningDate: new Date('2022-03-25T11:18:59.659Z'), + asset: TestAssets.toDummyAsset(TestAssets.full), + contractPolicy: TestPolicies.connectorRestricted, + terminationInformation: { + terminatedAt: new Date('2024-07-16T08:25:12.031Z'), + reason: 'Creative termination reason', + detail: 'Creative termination details', + terminatedBy: "COUNTERPARTY" + }, + terminationStatus: 'TERMINATED', + transferProcesses: [ + { + transferProcessId: '522138de-349d-4b68-9356-7e5929f053e0', + lastUpdatedDate: new Date('2023-04-24T12:32:43.027Z'), + state: { + code: 800, + name: 'COMPLETED', + simplifiedState: 'OK', + }, + }, + ], + }, + { + contractAgreementId: 'my-test-asset-cd:6ebbc301-9b1e-4cd7-9f17-97b5b786758', + contractNegotiationId: + 'my-test-asset-neg:6ebbc301-9b1e-4cd7-9f17-97b5b786758', + direction: 'PROVIDING', + counterPartyAddress: 'http://edc2:11003/api/v1/ids/data', + counterPartyId: 'MDSL1234XX.C1234XX', + contractSigningDate: new Date('2022-03-25T11:18:59.659Z'), + asset: TestAssets.toDummyAsset(TestAssets.boring), + contractPolicy: TestPolicies.connectorRestricted, + terminationInformation: { + terminatedAt: new Date('2024-07-16T08:25:12.031Z'), + reason: 'Creative termination reason', + detail: 'Creative termination details', + terminatedBy: "SELF" + }, + terminationStatus: 'TERMINATED', + transferProcesses: [ + { + transferProcessId: '522138de-349d-4b68-9356-7e5929f053e0', + lastUpdatedDate: new Date('2023-04-24T12:32:43.027Z'), + state: { + code: 800, + name: 'COMPLETED', + simplifiedState: 'OK', + }, + }, + ], + }, ]; export const contractAgreementPage = (): ContractAgreementPage => { return { diff --git a/src/app/core/services/api/fake-backend/edc-fake-backend.ts b/src/app/core/services/api/fake-backend/edc-fake-backend.ts index 526b83115..ef3d797c4 100644 --- a/src/app/core/services/api/fake-backend/edc-fake-backend.ts +++ b/src/app/core/services/api/fake-backend/edc-fake-backend.ts @@ -167,7 +167,7 @@ export const EDC_FAKE_BACKEND: FetchAPI = async ( }) .url('pages/contract-agreement-page') - .on('GET', () => { + .on('POST', () => { const page = contractAgreementPage(); return ok(ContractAgreementPageToJSON(page)); }) diff --git a/src/app/routes/connector-ui/connector-ui-routing.module.ts b/src/app/routes/connector-ui/connector-ui-routing.module.ts index 65bb0deed..7d6e8a2d6 100644 --- a/src/app/routes/connector-ui/connector-ui-routing.module.ts +++ b/src/app/routes/connector-ui/connector-ui-routing.module.ts @@ -30,7 +30,12 @@ export const routes: Routes = [ { path: 'contracts', component: ContractAgreementPageComponent, - data: {title: 'Contracts', icon: 'attachment'}, + data: {title: 'Active Contracts', icon: 'content_paste'}, + }, + { + path: 'terminated-contracts', + component: ContractAgreementPageComponent, + data: {title: 'Terminated Contracts', icon: 'content_paste_off'}, }, { path: 'transfer-history', From ae52eeb76c76715ff54a323a499a145870f67490 Mon Sep 17 00:00:00 2001 From: Kamil Czaja Date: Tue, 16 Jul 2024 12:57:53 +0200 Subject: [PATCH 02/23] feat: added termination status to contract cards --- .../contract-agreement-card-mapped.service.ts | 33 +++++++++++-------- .../contract-agreement-card-mapped.ts | 2 ++ .../contract-agreement-cards.component.html | 4 +-- 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-cards/contract-agreement-card-mapped.service.ts b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-cards/contract-agreement-card-mapped.service.ts index 8e1a41995..7c75fec49 100644 --- a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-cards/contract-agreement-card-mapped.service.ts +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-cards/contract-agreement-card-mapped.service.ts @@ -6,7 +6,8 @@ import {ContractAgreementCardMapped} from './contract-agreement-card-mapped'; @Injectable({providedIn: 'root'}) export class ContractAgreementCardMappedService { - constructor(private assetBuilder: AssetBuilder) {} + constructor(private assetBuilder: AssetBuilder) { + } /** * Replace the asset with the parsed asset and add the other required fields of the UI model @@ -19,6 +20,7 @@ export class ContractAgreementCardMappedService { contractAgreement: ContractAgreementCard, ): ContractAgreementCardMapped { const asset = this.assetBuilder.buildAsset(contractAgreement.asset); + const isTerminated = contractAgreement.terminationStatus === 'TERMINATED'; return { ...contractAgreement, @@ -27,9 +29,11 @@ export class ContractAgreementCardMappedService { (it) => it.state.simplifiedState === 'RUNNING', ), isConsumingLimitsEnforced: false, - statusText: '', + isTerminated: isTerminated, + showStatus: isTerminated, + statusText: isTerminated ? 'Terminated' : '', statusTooltipText: '', - canTransfer: true, + canTransfer: !isTerminated, searchTargets: [ contractAgreement.contractAgreementId, contractAgreement.counterPartyId, @@ -50,16 +54,19 @@ export class ContractAgreementCardMappedService { maxConsumingContracts: number, agreements: ContractAgreementCardMapped[], ): ContractAgreementCardMapped[] { - return agreements.map((it, index) => ({ - ...it, - isConsumingLimitsEnforced: true, - statusText: index < maxConsumingContracts ? 'Active' : 'Inactive', - statusTooltipText: this.getConsumingContractsInfoText( - index, - maxConsumingContracts, - ), - canTransfer: index < maxConsumingContracts, - })); + return agreements + .filter((it) => !it.isTerminated) + .map((it, index) => ({ + ...it, + isConsumingLimitsEnforced: true, + showStatus: true, + statusText: index < maxConsumingContracts ? 'Active' : 'Inactive', + statusTooltipText: this.getConsumingContractsInfoText( + index, + maxConsumingContracts, + ), + canTransfer: index < maxConsumingContracts, + })); } private getConsumingContractsInfoText( diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-cards/contract-agreement-card-mapped.ts b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-cards/contract-agreement-card-mapped.ts index c8285ca77..9e3ea7705 100644 --- a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-cards/contract-agreement-card-mapped.ts +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-cards/contract-agreement-card-mapped.ts @@ -8,6 +8,8 @@ export type ContractAgreementCardMapped = Omit< asset: UiAssetMapped; isInProgress: boolean; isConsumingLimitsEnforced: boolean; + isTerminated: boolean; + showStatus: boolean; statusText: string; statusTooltipText: string; canTransfer: boolean; diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-cards/contract-agreement-cards.component.html b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-cards/contract-agreement-cards.component.html index 3003e2655..ba8b46aa6 100644 --- a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-cards/contract-agreement-cards.component.html +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-cards/contract-agreement-cards.component.html @@ -60,7 +60,7 @@
@@ -68,7 +68,7 @@
{{ card.statusText }} - + help
From 24e75cd8e1ab336673d5acf7391e3e2350f8f946 Mon Sep 17 00:00:00 2001 From: Kamil Czaja Date: Tue, 16 Jul 2024 13:54:02 +0200 Subject: [PATCH 03/23] feat: added termination information to contract agreement details --- .../asset-property-grid-group-builder.ts | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/app/component-library/catalog/asset-detail-dialog/asset-property-grid-group-builder.ts b/src/app/component-library/catalog/asset-detail-dialog/asset-property-grid-group-builder.ts index 1ef71ce09..1444ab704 100644 --- a/src/app/component-library/catalog/asset-detail-dialog/asset-property-grid-group-builder.ts +++ b/src/app/component-library/catalog/asset-detail-dialog/asset-property-grid-group-builder.ts @@ -312,6 +312,36 @@ export class AssetPropertyGridGroupBuilder { }); } + //TODO change the icons + if (contractAgreement.isTerminated) { + properties.push({ + icon: 'cancel', + label: 'Contract status', + text: contractAgreement.statusText, + additionalClasses: 'text-warn', + }) + properties.push({ + icon: 'cancel', + label: 'Terminated at', + text: this.propertyGridUtils.formatDate(contractAgreement.terminationInformation?.terminatedAt) + }) + properties.push({ + icon: 'cancel', + label: 'Terminated by', + ...this.propertyGridUtils.guessValue(contractAgreement.terminationInformation?.terminatedBy) + }) + properties.push({ + icon: 'cancel', + label: 'Termination reason', + ...this.propertyGridUtils.guessValue(contractAgreement.terminationInformation?.reason) + }) + properties.push({ + icon: 'cancel', + label: 'Termination details', + ...this.propertyGridUtils.guessValue(contractAgreement.terminationInformation?.detail) + }) + } + return { groupLabel: 'Contract Agreement', properties, From e2b14c857e0ce0296b31dd9f3995b516d8b2e817 Mon Sep 17 00:00:00 2001 From: Kamil Czaja Date: Tue, 16 Jul 2024 14:07:15 +0200 Subject: [PATCH 04/23] feat: adjusted icons in both cards and details --- .../asset-detail-dialog.component.html | 10 +++++++--- .../asset-property-grid-group-builder.ts | 11 +++++------ .../contract-agreement-cards.component.html | 12 ++++++++++-- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog.component.html b/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog.component.html index 680348c62..105631132 100644 --- a/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog.component.html +++ b/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog.component.html @@ -10,8 +10,12 @@ class="mat-card-avatar-icon"> {{ data.contractAgreement!!.direction === 'PROVIDING' - ? 'upload' - : 'download' + ? data.contractAgreement!!.isTerminated + ? 'file_upload_off' + : 'file_upload' + : data.contractAgreement!!.isTerminated + ? 'file_download_off' + : 'file_download' }}
-
+
diff --git a/src/app/component-library/catalog/asset-detail-dialog/asset-property-grid-group-builder.ts b/src/app/component-library/catalog/asset-detail-dialog/asset-property-grid-group-builder.ts index 1444ab704..9bd00dcf8 100644 --- a/src/app/component-library/catalog/asset-detail-dialog/asset-property-grid-group-builder.ts +++ b/src/app/component-library/catalog/asset-detail-dialog/asset-property-grid-group-builder.ts @@ -312,31 +312,30 @@ export class AssetPropertyGridGroupBuilder { }); } - //TODO change the icons if (contractAgreement.isTerminated) { properties.push({ - icon: 'cancel', + icon: 'content_paste_off', label: 'Contract status', text: contractAgreement.statusText, additionalClasses: 'text-warn', }) properties.push({ - icon: 'cancel', + icon: 'category', label: 'Terminated at', text: this.propertyGridUtils.formatDate(contractAgreement.terminationInformation?.terminatedAt) }) properties.push({ - icon: 'cancel', + icon: 'group_off', label: 'Terminated by', ...this.propertyGridUtils.guessValue(contractAgreement.terminationInformation?.terminatedBy) }) properties.push({ - icon: 'cancel', + icon: 'category', label: 'Termination reason', ...this.propertyGridUtils.guessValue(contractAgreement.terminationInformation?.reason) }) properties.push({ - icon: 'cancel', + icon: 'category', label: 'Termination details', ...this.propertyGridUtils.guessValue(contractAgreement.terminationInformation?.detail) }) diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-cards/contract-agreement-cards.component.html b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-cards/contract-agreement-cards.component.html index ba8b46aa6..458f60bd4 100644 --- a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-cards/contract-agreement-cards.component.html +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-cards/contract-agreement-cards.component.html @@ -5,7 +5,15 @@ style="width: 400px; min-height: 120px"> - {{ card.direction === 'PROVIDING' ? 'upload' : 'download' }} + {{ + card.direction === 'PROVIDING' + ? card.isTerminated + ? 'file_upload_off' + : 'file_upload' + : card.isTerminated + ? 'file_download_off' + : 'file_download' + }} {{ card.counterPartyAddress }}{{ card.counterPartyAddress }}
From 22f5ffdb3422a74a8b223206708ed71d6dedbadb Mon Sep 17 00:00:00 2001 From: Kamil Czaja Date: Tue, 16 Jul 2024 17:29:00 +0200 Subject: [PATCH 05/23] feat: spaced buttons in contract details differently, added termination notice --- .../asset-detail-dialog.component.html | 51 +++++++++++++++++-- .../asset-detail-dialog.component.ts | 6 +++ .../asset-property-grid-group-builder.ts | 5 -- .../pipes-and-directives.module.ts | 3 ++ .../pipes/date-format.pipe.ts | 13 +++++ .../contract-agreement-fake-service.ts | 4 +- .../contract-agreement-cards.component.html | 2 +- 7 files changed, 74 insertions(+), 10 deletions(-) create mode 100644 src/app/component-library/pipes-and-directives/pipes/date-format.pipe.ts diff --git a/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog.component.html b/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog.component.html index 105631132..ea940de16 100644 --- a/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog.component.html +++ b/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog.component.html @@ -59,6 +59,38 @@ color="primary" mode="indeterminate"> + +
+
+
+ +
+
+
+ This contract has been terminated + + by {{ data.contractAgreement!!.terminationInformation?.terminatedBy === 'SELF' ? 'you.' : 'the counter-party.' }} +
+
+

+ Termination + date: {{ data.contractAgreement!!.terminationInformation!!.terminatedAt | formatDate: 'yyyy-MM-dd HH:mm:ss' }} +
+ Reason: {{ data.contractAgreement!!.terminationInformation!!.reason }} +

+

+ Details:
+ {{ data.contractAgreement!!.terminationInformation!!.detail }} +

+
+
+
+
+ -
+
+ +
+ +
+
- @@ -143,6 +187,7 @@ + -
+
diff --git a/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog.component.ts b/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog.component.ts index 7b0544c89..7d8a49de0 100644 --- a/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog.component.ts +++ b/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog.component.ts @@ -20,6 +20,7 @@ import { import {PropertyGridGroup} from '../../property-grid/property-grid-group/property-grid-group'; import {AssetDetailDialogData} from './asset-detail-dialog-data'; import {AssetDetailDialogResult} from './asset-detail-dialog-result'; +import {formatDate, getLocaleId} from "@angular/common"; /** * Asset Detail Dialog @@ -113,6 +114,8 @@ export class AssetDetailDialogComponent implements OnDestroy { }); } + onTerminateClick() {} + private confirmDelete(): Observable { const dialogData = ConfirmDialogModel.forDelete('asset', this.asset.title); const ref = this.matDialog.open(ConfirmationDialogComponent, { @@ -163,4 +166,7 @@ export class AssetDetailDialogComponent implements OnDestroy { this.ngOnDestroy$.next(null); this.ngOnDestroy$.complete(); } + + protected readonly formatDate = formatDate; + protected readonly getLocaleId = getLocaleId; } diff --git a/src/app/component-library/catalog/asset-detail-dialog/asset-property-grid-group-builder.ts b/src/app/component-library/catalog/asset-detail-dialog/asset-property-grid-group-builder.ts index 9bd00dcf8..9665853fa 100644 --- a/src/app/component-library/catalog/asset-detail-dialog/asset-property-grid-group-builder.ts +++ b/src/app/component-library/catalog/asset-detail-dialog/asset-property-grid-group-builder.ts @@ -334,11 +334,6 @@ export class AssetPropertyGridGroupBuilder { label: 'Termination reason', ...this.propertyGridUtils.guessValue(contractAgreement.terminationInformation?.reason) }) - properties.push({ - icon: 'category', - label: 'Termination details', - ...this.propertyGridUtils.guessValue(contractAgreement.terminationInformation?.detail) - }) } return { diff --git a/src/app/component-library/pipes-and-directives/pipes-and-directives.module.ts b/src/app/component-library/pipes-and-directives/pipes-and-directives.module.ts index 1af7a09de..b047ff46b 100644 --- a/src/app/component-library/pipes-and-directives/pipes-and-directives.module.ts +++ b/src/app/component-library/pipes-and-directives/pipes-and-directives.module.ts @@ -9,6 +9,7 @@ import {TrackByFieldDirective} from './directives/track-by-field.directive'; import {CompareByFieldPipe} from './pipes/compare-by-field.pipe'; import {IsActiveFeaturePipe} from './pipes/is-active-feature.pipe'; import {ValuesPipe} from './pipes/values.pipe'; +import {DateFormatPipe} from "./pipes/date-format.pipe"; @NgModule({ imports: [ @@ -22,6 +23,7 @@ import {ValuesPipe} from './pipes/values.pipe'; declarations: [ AutofocusDirective, CompareByFieldPipe, + DateFormatPipe, ExternalLinkDirective, IsActiveFeaturePipe, RemoveClassDirective, @@ -31,6 +33,7 @@ import {ValuesPipe} from './pipes/values.pipe'; exports: [ AutofocusDirective, CompareByFieldPipe, + DateFormatPipe, ExternalLinkDirective, IsActiveFeaturePipe, RemoveClassDirective, diff --git a/src/app/component-library/pipes-and-directives/pipes/date-format.pipe.ts b/src/app/component-library/pipes-and-directives/pipes/date-format.pipe.ts new file mode 100644 index 000000000..95cc12f04 --- /dev/null +++ b/src/app/component-library/pipes-and-directives/pipes/date-format.pipe.ts @@ -0,0 +1,13 @@ +import {Inject, LOCALE_ID, Pipe, PipeTransform} from '@angular/core'; +import {formatDate} from "@angular/common"; + +/** + * Creates Compare By Function for Angular Material compareWith parameters + */ +@Pipe({name: 'formatDate'}) +export class DateFormatPipe implements PipeTransform { + constructor(@Inject(LOCALE_ID) private locale: string) {} + transform(date: Date, format: string): string { + return formatDate(date, format, this.locale) + } +} diff --git a/src/app/core/services/api/fake-backend/connector-fake-impl/contract-agreement-fake-service.ts b/src/app/core/services/api/fake-backend/connector-fake-impl/contract-agreement-fake-service.ts index 7d500f2b8..f6c36d088 100644 --- a/src/app/core/services/api/fake-backend/connector-fake-impl/contract-agreement-fake-service.ts +++ b/src/app/core/services/api/fake-backend/connector-fake-impl/contract-agreement-fake-service.ts @@ -168,7 +168,9 @@ let contractAgreements: ContractAgreementCard[] = [ terminationInformation: { terminatedAt: new Date('2024-07-16T08:25:12.031Z'), reason: 'Creative termination reason', - detail: 'Creative termination details', + detail: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed tristique facilisis ornare. Maecenas at facilisis dui, vel dapibus nisi. Nam dapibus, sapien ac iaculis sodales, tellus ante dictum libero, eu viverra metus lorem nec lectus. Donec cursus feugiat massa sed pharetra. Etiam nec lacus nisi. Etiam ut justo bibendum felis tincidunt tempor vel et sem. Suspendisse potenti. Nam volutpat ornare mi, at fringilla sapien accumsan congue. Maecenas ornare rutrum ipsum, quis fermentum risus. Proin vitae tortor nec metus tristique posuere. Cras ornare lobortis diam. Proin pellentesque, massa eu bibendum posuere, augue nibh porta libero, eu rhoncus ex enim vel nulla. Fusce eget dui non velit rutrum euismod.\n' + + '\n' + + 'Mauris finibus vel lectus eu aliquam. Proin et leo sit amet turpis venenatis faucibus. Fusce nisl quam, malesuada sit amet feugiat at, vehicula id mauris. Phasellus aliquam libero quis lobortis viverra. Vivamus luctus purus et nibh pellentesque, eget tristique ipsum pretium. Nulla rhoncus lacus sed lectus elementum vulputate. Nunc massa mauris, viverra vitae magna nec, mollis molestie tellus. Donec accumsan massa sit amet ultricies mollis. Mauris dui nunc, eleifend vel risus vitae, convallis bibendum dolor. Aliquam felis quam, rhoncus non gravida a, bibendum feugiat nunc. Sed varius dictum nisi, id lacinia enim condimentum.', terminatedBy: "SELF" }, terminationStatus: 'TERMINATED', diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-cards/contract-agreement-cards.component.html b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-cards/contract-agreement-cards.component.html index 458f60bd4..e74703cda 100644 --- a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-cards/contract-agreement-cards.component.html +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-cards/contract-agreement-cards.component.html @@ -4,7 +4,7 @@ trackByField="contractAgreementId" style="width: 400px; min-height: 120px"> - + {{ card.direction === 'PROVIDING' ? card.isTerminated From 352d0a9d559ba38342aec85b16cda5826f12f864 Mon Sep 17 00:00:00 2001 From: Kamil Czaja Date: Tue, 16 Jul 2024 17:33:06 +0200 Subject: [PATCH 06/23] chore: prettier --- .../asset-detail-dialog/asset-detail-dialog.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog.component.html b/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog.component.html index ea940de16..04127a621 100644 --- a/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog.component.html +++ b/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog.component.html @@ -200,6 +200,6 @@ (click)="onTransferClick()"> Transfer - + From 3841ae88bb39f44fa28064431531296567169cbc Mon Sep 17 00:00:00 2001 From: Kamil Czaja Date: Wed, 17 Jul 2024 10:44:20 +0200 Subject: [PATCH 07/23] --wip-- [skip ci] --- .../contract-agreement-page.module.ts | 4 + ...tract-agreement-termination-dialog-data.ts | 6 + ...agreement-termination-dialog-form-model.ts | 42 ++++ ...tract-agreement-termination-dialog-form.ts | 105 ++++++++ ...act-agreement-termination-dialog-result.ts | 4 + ...greement-termination-dialog.component.html | 233 ++++++++++++++++++ ...-agreement-termination-dialog.component.ts | 167 +++++++++++++ 7 files changed, 561 insertions(+) create mode 100644 src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-data.ts create mode 100644 src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-form-model.ts create mode 100644 src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-form.ts create mode 100644 src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-result.ts create mode 100644 src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog.component.html create mode 100644 src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog.component.ts diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page.module.ts b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page.module.ts index 882f3af69..261399611 100644 --- a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page.module.ts +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page.module.ts @@ -28,6 +28,9 @@ import {UiElementsModule} from '../../../component-library/ui-elements/ui-elemen import {ContractAgreementCardsComponent} from './contract-agreement-cards/contract-agreement-cards.component'; import {ContractAgreementPageComponent} from './contract-agreement-page/contract-agreement-page.component'; import {ContractAgreementTransferDialogComponent} from './contract-agreement-transfer-dialog/contract-agreement-transfer-dialog.component'; +import { + ContractAgreementTerminationDialogComponent +} from "./contract-agreement-termination-dialog/contract-agreement-termination-dialog.component"; @NgModule({ imports: [ @@ -69,6 +72,7 @@ import {ContractAgreementTransferDialogComponent} from './contract-agreement-tra declarations: [ ContractAgreementPageComponent, ContractAgreementCardsComponent, + ContractAgreementTerminationDialogComponent, ContractAgreementTransferDialogComponent, ], exports: [ContractAgreementPageComponent], diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-data.ts b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-data.ts new file mode 100644 index 000000000..244defa73 --- /dev/null +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-data.ts @@ -0,0 +1,6 @@ +import {UiAssetMapped} from '../../../../core/services/models/ui-asset-mapped'; + +export interface ContractAgreementTerminationDialogData { + contractId: string; + asset: UiAssetMapped; +} diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-form-model.ts b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-form-model.ts new file mode 100644 index 000000000..40c5cf25c --- /dev/null +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-form-model.ts @@ -0,0 +1,42 @@ +import { + FormArray, + FormControl, + FormGroup, + ɵFormGroupValue, +} from '@angular/forms'; +import {DataAddressType} from '../../../../component-library/data-address/data-address-type-select/data-address-type'; +import {HttpDatasourceQueryParamFormModel} from '../../asset-page/asset-edit-dialog/form/model/http-datasource-query-param-form-model'; + +/** + * Form Value Type + */ +export type ContractAgreementTransferDialogFormValue = + ɵFormGroupValue; + +/** + * Form Group Template Type + */ +export interface ContractAgreementTerminationDialogFormModel { + dataAddressType: FormControl; + + // Custom Datasink JSON + dataDestination: FormControl; + + // Custom Transfer Process Request JSON + transferProcessRequest: FormControl; + + // Http Datasink + httpUrl: FormControl; + httpMethod: FormControl; + + showAllHttpParameterizationFields: FormControl; + + // Http Datasource Parameterization + httpProxiedPath: FormControl; + httpProxiedMethod: FormControl; + httpProxiedQueryParams: FormArray< + FormGroup + >; + httpProxiedBody: FormControl; + httpProxiedBodyContentType: FormControl; +} diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-form.ts b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-form.ts new file mode 100644 index 000000000..23eef0994 --- /dev/null +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-form.ts @@ -0,0 +1,105 @@ +import {Injectable} from '@angular/core'; +import {FormBuilder, FormGroup, Validators} from '@angular/forms'; +import {DataAddressType} from '../../../../component-library/data-address/data-address-type-select/data-address-type'; +import {switchDisabledControls} from '../../../../core/utils/form-group-utils'; +import {jsonValidator} from '../../../../core/validators/json-validator'; +import {urlValidator} from '../../../../core/validators/url-validator'; +import { + HttpDatasourceQueryParamFormModel +} from '../../asset-page/asset-edit-dialog/form/model/http-datasource-query-param-form-model'; +import { + ContractAgreementTerminationDialogFormModel, + ContractAgreementTransferDialogFormValue, +} from './contract-agreement-termination-dialog-form-model'; + +/** + * Handles AngularForms for ContractAgreementTransferDialog + */ +@Injectable() +export class ContractAgreementTerminationDialogForm { + all = this.buildFormGroup(); + + /** + * Quick access to selected data address type + */ + get dataAddressType(): DataAddressType | null { + return this.all.controls.dataAddressType.value; + } + + /** + * Quick access to full value + */ + get value(): ContractAgreementTransferDialogFormValue { + return this.all.value; + } + + constructor(private formBuilder: FormBuilder) {} + + buildFormGroup(): FormGroup { + const all: FormGroup = + this.formBuilder.nonNullable.group({ + dataAddressType: 'Http' as DataAddressType, + dataDestination: ['', [Validators.required, jsonValidator]], + transferProcessRequest: ['', [Validators.required, jsonValidator]], + + // Http Datasink Fields + httpUrl: ['', [Validators.required, urlValidator]], + httpMethod: ['POST', Validators.required], + + showAllHttpParameterizationFields: [false], + + httpProxiedPath: [''], + httpProxiedMethod: [''], + httpProxiedQueryParams: this.formBuilder.array( + new Array>(), + ), + httpProxiedBody: [''], + httpProxiedBodyContentType: [''], + }); + + switchDisabledControls( + all, + (value) => { + const customDataAddressJson = + value.dataAddressType === 'Custom-Data-Address-Json'; + + const customTransferProcessRequest = + value.dataAddressType === 'Custom-Transfer-Process-Request'; + + const http = value.dataAddressType === 'Http'; + + return { + dataAddressType: true, + + // Custom Datasink JSON + dataDestination: customDataAddressJson, + transferProcessRequest: customTransferProcessRequest, + + // Http Datasink Fields + httpUrl: http, + httpMethod: http, + + httpAuthHeaderType: http, + + httpHeaders: http, + + showAllHttpParameterizationFields: !customTransferProcessRequest, + + httpProxiedPath: !customTransferProcessRequest, + httpProxiedMethod: !customTransferProcessRequest, + httpProxiedQueryParams: !customTransferProcessRequest, + httpProxiedBody: !customTransferProcessRequest, + httpProxiedBodyContentType: !customTransferProcessRequest, + }; + }, + ); + return all; + } + + buildQueryParamFormGroup(): FormGroup { + return this.formBuilder.nonNullable.group({ + paramName: ['', Validators.required], + paramValue: [''], + }); + }} + diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-result.ts b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-result.ts new file mode 100644 index 000000000..07298bd9c --- /dev/null +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-result.ts @@ -0,0 +1,4 @@ +export interface ContractAgreementTerminationDialogResult { + transferProcessId: string; + contractId: string; +} diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog.component.html b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog.component.html new file mode 100644 index 000000000..1127ab466 --- /dev/null +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog.component.html @@ -0,0 +1,233 @@ +

Initiate Transfer

+ +
+
+
Datasink
+ + + + + + + Custom Datasink Config (JSON) + + + {{ validationMessages.invalidJsonMessage }} + + + + + + Custom Transfer Process Request (JSON) + + + {{ validationMessages.invalidJsonMessage }} + + + JSON-LD values for "edc:connectorId", "edc:contractId", + "edc:connectorId" and "edc:connectorAddress" will be overridden. + + + + + + +
+ + + Method + + {{ method }} + + + + URL + + + {{ validationMessages.invalidUrlMessage }} + + +
+
+ + +
HTTP Datasource Parameterization
+ +
+ When the data offer on the provider side is of the type + HttpData and certain data source fields are set, certain parts + of the request to the data source can be customized from the consumer + side and will be passed to the other connector when initiating the + transfer. This allows an asset to contain more than just one kind of + data, allowing additional filtering or even sharing of entire APIs + with multiple data sets via a single asset and a single contract. +
+ +
+ The resulting URL will look like + {{ + '{baseUrl}{customSubPath}?{baseQueryParams}&{customQueryParams}' + }} +
+ +
+ + + + Custom Method + + + {{ method }} + + Requires "proxyMethod" to be "true". + + + + + + + Custom Subpath + + Requires "proxyPath" to be "true". + + +
+ + +
+ + + Custom Query Param Name + + Requires "proxyQueryParams" to be "true". + + + + + Value + + +
+
+ + + + + Custom Request Body Content Type + + Requires "proxyBody" to be "true". + + + + + Custom Request Body + + Requires "proxyBody" to be "true". + + + + +
+ +
+
+
+
+
+ + + + + + diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog.component.ts b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog.component.ts new file mode 100644 index 000000000..7f3a8a35b --- /dev/null +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog.component.ts @@ -0,0 +1,167 @@ +import {Component, Inject, OnDestroy} from '@angular/core'; +import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog'; +import {Observable, Subject} from 'rxjs'; +import {finalize} from 'rxjs/operators'; +import { + IdResponseDto, + InitiateCustomTransferRequest, + InitiateTransferRequest, +} from '@sovity.de/edc-client'; +import {EdcApiService} from '../../../../core/services/api/edc-api.service'; +import {DataAddressMapper} from '../../../../core/services/data-address-mapper'; +import {NotificationService} from '../../../../core/services/notification.service'; +import {TransferDataSinkMapper} from '../../../../core/services/transfer-data-sink-mapper'; +import {ValidationMessages} from '../../../../core/validators/validation-messages'; +import { + DATA_SINK_HTTP_METHODS, + DATA_SOURCE_HTTP_METHODS, +} from '../../asset-page/asset-edit-dialog/form/http-methods'; +import {ContractAgreementTerminationDialogData} from './contract-agreement-termination-dialog-data'; +import {ContractAgreementTerminationDialogForm} from './contract-agreement-termination-dialog-form'; +import {ContractAgreementTransferDialogFormValue} from './contract-agreement-termination-dialog-form-model'; +import {ContractAgreementTerminationDialogResult} from './contract-agreement-termination-dialog-result'; + +@Component({ + selector: 'contract-agreement-transfer-dialog', + templateUrl: './contract-agreement-termination-dialog.component.html', + providers: [ContractAgreementTerminationDialogForm], +}) +export class ContractAgreementTerminationDialogComponent implements OnDestroy { + loading = false; + + dataSinkMethods = DATA_SINK_HTTP_METHODS; + dataSourceMethods = DATA_SOURCE_HTTP_METHODS; + + get proxyMethod(): boolean { + return ( + this.showAllHttpParameterizationFields || + this.data.asset.httpDatasourceHintsProxyMethod === true + ); + } + + get proxyPath(): boolean { + return ( + this.showAllHttpParameterizationFields || + this.data.asset.httpDatasourceHintsProxyPath === true + ); + } + + get proxyQueryParams(): boolean { + return ( + this.showAllHttpParameterizationFields || + this.data.asset.httpDatasourceHintsProxyQueryParams === true + ); + } + + get proxyBody(): boolean { + return ( + this.showAllHttpParameterizationFields || + this.data.asset.httpDatasourceHintsProxyBody === true + ); + } + + get showHttpParameterizationToggleButton(): boolean { + return ( + this.data.asset.httpDatasourceHintsProxyMethod !== true || + this.data.asset.httpDatasourceHintsProxyPath !== true || + this.data.asset.httpDatasourceHintsProxyQueryParams !== true || + this.data.asset.httpDatasourceHintsProxyBody !== true + ); + } + + get showAllHttpParameterizationFields(): boolean { + return this.form.all.controls.showAllHttpParameterizationFields.value; + } + + constructor( + public form: ContractAgreementTerminationDialogForm, + public validationMessages: ValidationMessages, + private dialogRef: MatDialogRef, + private edcApiService: EdcApiService, + private notificationService: NotificationService, + private httpRequestParamsMapper: TransferDataSinkMapper, + private dataAddressMapper: DataAddressMapper, + @Inject(MAT_DIALOG_DATA) public data: ContractAgreementTerminationDialogData, + ) {} + + onSave() { + if (this.loading && !this.form.all.valid) { + return; + } + + this.initiateTransfer(); + } + + private initiateTransfer() { + this.loading = true; + this.form.all.disable(); + + const value = this.form.value; + let request$: Observable; + if (value.dataAddressType === 'Custom-Transfer-Process-Request') { + const request = this.buildCustomTransferRequest(value); + request$ = this.edcApiService.initiateCustomTransfer(request); + } else { + const request = this.buildTransferRequest(value); + request$ = this.edcApiService.initiateTransfer(request); + } + + request$ + .pipe( + finalize(() => { + this.loading = false; + this.form.all.enable(); + }), + ) + .subscribe({ + next: (response) => + this.close({ + transferProcessId: response.id!, + contractId: this.data.contractId, + }), + error: (err) => { + this.notificationService.showError('Failed initiating transfer!'); + console.error('Failed initiating transfer', err); + }, + }); + } + + private close(params: ContractAgreementTerminationDialogResult) { + this.dialogRef.close(params); + } + + ngOnDestroy$ = new Subject(); + + ngOnDestroy(): void { + this.ngOnDestroy$.next(null); + this.ngOnDestroy$.complete(); + } + + private buildTransferRequest( + value: ContractAgreementTransferDialogFormValue, + ): InitiateTransferRequest { + const transferProcessProperties = + this.httpRequestParamsMapper.encodeHttpProxyTransferRequestProperties( + this.data.asset, + value, + ); + + const dataSinkProperties = + this.dataAddressMapper.buildDataAddressProperties(value) ?? {}; + + return { + contractAgreementId: this.data.contractId, + transferProcessProperties, + dataSinkProperties, + }; + } + + private buildCustomTransferRequest( + value: ContractAgreementTransferDialogFormValue, + ): InitiateCustomTransferRequest { + return { + contractAgreementId: this.data.contractId, + transferProcessRequestJsonLd: value.transferProcessRequest!, + }; + } +} From f9a06a4aa58fb39c619f920b60910d4471340bf4 Mon Sep 17 00:00:00 2001 From: Kamil Czaja Date: Wed, 17 Jul 2024 12:29:57 +0200 Subject: [PATCH 08/23] feat: termination dialog --- .../asset-detail-dialog.component.ts | 14 +- ...agreement-termination-dialog-form-model.ts | 33 +-- ...tract-agreement-termination-dialog-form.ts | 87 +----- ...act-agreement-termination-dialog-result.ts | 2 +- ...greement-termination-dialog.component.html | 253 +++--------------- ...-agreement-termination-dialog.component.ts | 137 +--------- 6 files changed, 77 insertions(+), 449 deletions(-) diff --git a/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog.component.ts b/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog.component.ts index 7d8a49de0..c11478bd3 100644 --- a/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog.component.ts +++ b/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog.component.ts @@ -21,6 +21,12 @@ import {PropertyGridGroup} from '../../property-grid/property-grid-group/propert import {AssetDetailDialogData} from './asset-detail-dialog-data'; import {AssetDetailDialogResult} from './asset-detail-dialog-result'; import {formatDate, getLocaleId} from "@angular/common"; +import { + ContractAgreementTerminationDialogData +} from "../../../routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-data"; +import { + ContractAgreementTerminationDialogComponent +} from "../../../routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog.component"; /** * Asset Detail Dialog @@ -114,7 +120,13 @@ export class AssetDetailDialogComponent implements OnDestroy { }); } - onTerminateClick() {} + onTerminateClick() { + const data: ContractAgreementTerminationDialogData = { + contractId: this.data.contractAgreement?.contractAgreementId!!, + asset: this.data.asset, + }; + this.matDialog.open(ContractAgreementTerminationDialogComponent, {data}) + } private confirmDelete(): Observable { const dialogData = ConfirmDialogModel.forDelete('asset', this.asset.title); diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-form-model.ts b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-form-model.ts index 40c5cf25c..e1d152ebe 100644 --- a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-form-model.ts +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-form-model.ts @@ -1,11 +1,4 @@ -import { - FormArray, - FormControl, - FormGroup, - ɵFormGroupValue, -} from '@angular/forms'; -import {DataAddressType} from '../../../../component-library/data-address/data-address-type-select/data-address-type'; -import {HttpDatasourceQueryParamFormModel} from '../../asset-page/asset-edit-dialog/form/model/http-datasource-query-param-form-model'; +import {FormControl, ɵFormGroupValue,} from '@angular/forms'; /** * Form Value Type @@ -17,26 +10,6 @@ export type ContractAgreementTransferDialogFormValue = * Form Group Template Type */ export interface ContractAgreementTerminationDialogFormModel { - dataAddressType: FormControl; - - // Custom Datasink JSON - dataDestination: FormControl; - - // Custom Transfer Process Request JSON - transferProcessRequest: FormControl; - - // Http Datasink - httpUrl: FormControl; - httpMethod: FormControl; - - showAllHttpParameterizationFields: FormControl; - - // Http Datasource Parameterization - httpProxiedPath: FormControl; - httpProxiedMethod: FormControl; - httpProxiedQueryParams: FormArray< - FormGroup - >; - httpProxiedBody: FormControl; - httpProxiedBodyContentType: FormControl; + shortReason: FormControl; + detailedReason: FormControl; } diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-form.ts b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-form.ts index 23eef0994..cc00e277f 100644 --- a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-form.ts +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-form.ts @@ -1,31 +1,17 @@ import {Injectable} from '@angular/core'; import {FormBuilder, FormGroup, Validators} from '@angular/forms'; -import {DataAddressType} from '../../../../component-library/data-address/data-address-type-select/data-address-type'; -import {switchDisabledControls} from '../../../../core/utils/form-group-utils'; -import {jsonValidator} from '../../../../core/validators/json-validator'; -import {urlValidator} from '../../../../core/validators/url-validator'; -import { - HttpDatasourceQueryParamFormModel -} from '../../asset-page/asset-edit-dialog/form/model/http-datasource-query-param-form-model'; import { ContractAgreementTerminationDialogFormModel, ContractAgreementTransferDialogFormValue, } from './contract-agreement-termination-dialog-form-model'; /** - * Handles AngularForms for ContractAgreementTransferDialog + * Handles AngularForms for ContractAgreementTerminationDialog */ @Injectable() export class ContractAgreementTerminationDialogForm { all = this.buildFormGroup(); - /** - * Quick access to selected data address type - */ - get dataAddressType(): DataAddressType | null { - return this.all.controls.dataAddressType.value; - } - /** * Quick access to full value */ @@ -33,73 +19,14 @@ export class ContractAgreementTerminationDialogForm { return this.all.value; } - constructor(private formBuilder: FormBuilder) {} - - buildFormGroup(): FormGroup { - const all: FormGroup = - this.formBuilder.nonNullable.group({ - dataAddressType: 'Http' as DataAddressType, - dataDestination: ['', [Validators.required, jsonValidator]], - transferProcessRequest: ['', [Validators.required, jsonValidator]], - - // Http Datasink Fields - httpUrl: ['', [Validators.required, urlValidator]], - httpMethod: ['POST', Validators.required], - - showAllHttpParameterizationFields: [false], - - httpProxiedPath: [''], - httpProxiedMethod: [''], - httpProxiedQueryParams: this.formBuilder.array( - new Array>(), - ), - httpProxiedBody: [''], - httpProxiedBodyContentType: [''], - }); - - switchDisabledControls( - all, - (value) => { - const customDataAddressJson = - value.dataAddressType === 'Custom-Data-Address-Json'; - - const customTransferProcessRequest = - value.dataAddressType === 'Custom-Transfer-Process-Request'; - - const http = value.dataAddressType === 'Http'; - - return { - dataAddressType: true, - - // Custom Datasink JSON - dataDestination: customDataAddressJson, - transferProcessRequest: customTransferProcessRequest, - - // Http Datasink Fields - httpUrl: http, - httpMethod: http, - - httpAuthHeaderType: http, - - httpHeaders: http, - - showAllHttpParameterizationFields: !customTransferProcessRequest, - - httpProxiedPath: !customTransferProcessRequest, - httpProxiedMethod: !customTransferProcessRequest, - httpProxiedQueryParams: !customTransferProcessRequest, - httpProxiedBody: !customTransferProcessRequest, - httpProxiedBodyContentType: !customTransferProcessRequest, - }; - }, - ); - return all; + constructor(private formBuilder: FormBuilder) { } - buildQueryParamFormGroup(): FormGroup { + buildFormGroup(): FormGroup { return this.formBuilder.nonNullable.group({ - paramName: ['', Validators.required], - paramValue: [''], + shortReason: ['', Validators.required], + detailedReason: [''] }); - }} + } +} diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-result.ts b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-result.ts index 07298bd9c..753cd2db8 100644 --- a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-result.ts +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-result.ts @@ -1,4 +1,4 @@ export interface ContractAgreementTerminationDialogResult { - transferProcessId: string; contractId: string; + lastUpdatedTime: Date | null; } diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog.component.html b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog.component.html index 1127ab466..e708ccdee 100644 --- a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog.component.html +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog.component.html @@ -1,223 +1,56 @@ -

Initiate Transfer

- +

Terminate Contract Agreement

+
-
-
Datasink
+
+
Reason
- - - - - - Custom Datasink Config (JSON) - - - {{ validationMessages.invalidJsonMessage }} + formControlName="shortReason" + placeholder="Enter reason for termination" + maxlength="100" + required> + + Reason is required + {{form.all.controls.shortReason.value.length}}/100 characters - - - Custom Transfer Process Request (JSON) - - - {{ validationMessages.invalidJsonMessage }} - - - JSON-LD values for "edc:connectorId", "edc:contractId", - "edc:connectorId" and "edc:connectorAddress" will be overridden. - + + Details + + {{form.all.controls.detailedReason.value.length}}/1000 characters - - - - -
- - - Method - - {{ method }} - - - - URL - - - {{ validationMessages.invalidUrlMessage }} - - -
-
- - -
HTTP Datasource Parameterization
- -
- When the data offer on the provider side is of the type - HttpData and certain data source fields are set, certain parts - of the request to the data source can be customized from the consumer - side and will be passed to the other connector when initiating the - transfer. This allows an asset to contain more than just one kind of - data, allowing additional filtering or even sharing of entire APIs - with multiple data sets via a single asset and a single contract. -
- -
- The resulting URL will look like - {{ - '{baseUrl}{customSubPath}?{baseQueryParams}&{customQueryParams}' - }} -
- -
- - - - Custom Method - - - {{ method }} - - Requires "proxyMethod" to be "true". - - - - - - - Custom Subpath - - Requires "proxyPath" to be "true". - - -
- - -
- - - Custom Query Param Name - - Requires "proxyQueryParams" to be "true". - - - - - Value - - -
-
- - - - - Custom Request Body Content Type - - Requires "proxyBody" to be "true". - - - - - Custom Request Body - - Requires "proxyBody" to be "true". - - - - -
- -
-
+ + +
+
Confirmation
+
+

+ By clicking the 'Terminate Contract' button, you will terminate the contract + agreement. New data transfers via this agreement will no longer be possible and current transfer processes will + be canceled.
+ This action is irreversible. +

+
+ + I have read the information and want to terminate the contract agreement. + +
diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog.component.ts b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog.component.ts index 7f3a8a35b..1f4146f08 100644 --- a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog.component.ts +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog.component.ts @@ -1,25 +1,11 @@ import {Component, Inject, OnDestroy} from '@angular/core'; import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog'; -import {Observable, Subject} from 'rxjs'; -import {finalize} from 'rxjs/operators'; -import { - IdResponseDto, - InitiateCustomTransferRequest, - InitiateTransferRequest, -} from '@sovity.de/edc-client'; -import {EdcApiService} from '../../../../core/services/api/edc-api.service'; -import {DataAddressMapper} from '../../../../core/services/data-address-mapper'; -import {NotificationService} from '../../../../core/services/notification.service'; -import {TransferDataSinkMapper} from '../../../../core/services/transfer-data-sink-mapper'; +import {Subject} from 'rxjs'; import {ValidationMessages} from '../../../../core/validators/validation-messages'; -import { - DATA_SINK_HTTP_METHODS, - DATA_SOURCE_HTTP_METHODS, -} from '../../asset-page/asset-edit-dialog/form/http-methods'; import {ContractAgreementTerminationDialogData} from './contract-agreement-termination-dialog-data'; import {ContractAgreementTerminationDialogForm} from './contract-agreement-termination-dialog-form'; -import {ContractAgreementTransferDialogFormValue} from './contract-agreement-termination-dialog-form-model'; import {ContractAgreementTerminationDialogResult} from './contract-agreement-termination-dialog-result'; +import {MatCheckboxChange} from "@angular/material/checkbox"; @Component({ selector: 'contract-agreement-transfer-dialog', @@ -28,103 +14,28 @@ import {ContractAgreementTerminationDialogResult} from './contract-agreement-ter }) export class ContractAgreementTerminationDialogComponent implements OnDestroy { loading = false; - - dataSinkMethods = DATA_SINK_HTTP_METHODS; - dataSourceMethods = DATA_SOURCE_HTTP_METHODS; - - get proxyMethod(): boolean { - return ( - this.showAllHttpParameterizationFields || - this.data.asset.httpDatasourceHintsProxyMethod === true - ); - } - - get proxyPath(): boolean { - return ( - this.showAllHttpParameterizationFields || - this.data.asset.httpDatasourceHintsProxyPath === true - ); - } - - get proxyQueryParams(): boolean { - return ( - this.showAllHttpParameterizationFields || - this.data.asset.httpDatasourceHintsProxyQueryParams === true - ); - } - - get proxyBody(): boolean { - return ( - this.showAllHttpParameterizationFields || - this.data.asset.httpDatasourceHintsProxyBody === true - ); - } - - get showHttpParameterizationToggleButton(): boolean { - return ( - this.data.asset.httpDatasourceHintsProxyMethod !== true || - this.data.asset.httpDatasourceHintsProxyPath !== true || - this.data.asset.httpDatasourceHintsProxyQueryParams !== true || - this.data.asset.httpDatasourceHintsProxyBody !== true - ); - } - - get showAllHttpParameterizationFields(): boolean { - return this.form.all.controls.showAllHttpParameterizationFields.value; - } + checkboxChecked = false; constructor( public form: ContractAgreementTerminationDialogForm, public validationMessages: ValidationMessages, private dialogRef: MatDialogRef, - private edcApiService: EdcApiService, - private notificationService: NotificationService, - private httpRequestParamsMapper: TransferDataSinkMapper, - private dataAddressMapper: DataAddressMapper, + //private edcApiService: EdcApiService, + //private notificationService: NotificationService, @Inject(MAT_DIALOG_DATA) public data: ContractAgreementTerminationDialogData, ) {} + public onCheckboxChange($event: MatCheckboxChange) { + this.checkboxChecked = $event.checked; + } + onSave() { if (this.loading && !this.form.all.valid) { return; } - - this.initiateTransfer(); + this.close({contractId: '', lastUpdatedTime: null}); } - private initiateTransfer() { - this.loading = true; - this.form.all.disable(); - - const value = this.form.value; - let request$: Observable; - if (value.dataAddressType === 'Custom-Transfer-Process-Request') { - const request = this.buildCustomTransferRequest(value); - request$ = this.edcApiService.initiateCustomTransfer(request); - } else { - const request = this.buildTransferRequest(value); - request$ = this.edcApiService.initiateTransfer(request); - } - - request$ - .pipe( - finalize(() => { - this.loading = false; - this.form.all.enable(); - }), - ) - .subscribe({ - next: (response) => - this.close({ - transferProcessId: response.id!, - contractId: this.data.contractId, - }), - error: (err) => { - this.notificationService.showError('Failed initiating transfer!'); - console.error('Failed initiating transfer', err); - }, - }); - } private close(params: ContractAgreementTerminationDialogResult) { this.dialogRef.close(params); @@ -136,32 +47,4 @@ export class ContractAgreementTerminationDialogComponent implements OnDestroy { this.ngOnDestroy$.next(null); this.ngOnDestroy$.complete(); } - - private buildTransferRequest( - value: ContractAgreementTransferDialogFormValue, - ): InitiateTransferRequest { - const transferProcessProperties = - this.httpRequestParamsMapper.encodeHttpProxyTransferRequestProperties( - this.data.asset, - value, - ); - - const dataSinkProperties = - this.dataAddressMapper.buildDataAddressProperties(value) ?? {}; - - return { - contractAgreementId: this.data.contractId, - transferProcessProperties, - dataSinkProperties, - }; - } - - private buildCustomTransferRequest( - value: ContractAgreementTransferDialogFormValue, - ): InitiateCustomTransferRequest { - return { - contractAgreementId: this.data.contractId, - transferProcessRequestJsonLd: value.transferProcessRequest!, - }; - } } From 1e01dd7a1368ce14d51dcc13fc7fb12fdd4b2cb7 Mon Sep 17 00:00:00 2001 From: Kamil Czaja Date: Wed, 17 Jul 2024 12:50:36 +0200 Subject: [PATCH 09/23] feat: contract termination request --- src/app/core/services/api/edc-api.service.ts | 8 +++- ...-agreement-termination-dialog.component.ts | 45 ++++++++++++++++--- 2 files changed, 46 insertions(+), 7 deletions(-) diff --git a/src/app/core/services/api/edc-api.service.ts b/src/app/core/services/api/edc-api.service.ts index cf07e87e2..880e1a82c 100644 --- a/src/app/core/services/api/edc-api.service.ts +++ b/src/app/core/services/api/edc-api.service.ts @@ -20,7 +20,7 @@ import { UiAssetEditRequest, UiContractNegotiation, UiDataOffer, - buildEdcClient, + buildEdcClient, TerminateContractAgreementRequest, } from '@sovity.de/edc-client'; import {APP_CONFIG, AppConfig} from '../../config/app-config'; import {EDC_FAKE_BACKEND} from './fake-backend/edc-fake-backend'; @@ -127,6 +127,12 @@ export class EdcApiService { ); } + terminateContractAgreement(terminateContractAgreementRequest: TerminateContractAgreementRequest): Observable { + return from( + this.edcClient.uiApi.terminateContractAgreement(terminateContractAgreementRequest) + ); + } + getContractNegotiation( contractNegotiationId: string, ): Observable { diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog.component.ts b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog.component.ts index 1f4146f08..adab70f69 100644 --- a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog.component.ts +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog.component.ts @@ -1,11 +1,14 @@ import {Component, Inject, OnDestroy} from '@angular/core'; import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog'; -import {Subject} from 'rxjs'; -import {ValidationMessages} from '../../../../core/validators/validation-messages'; +import {Observable, Subject} from 'rxjs'; import {ContractAgreementTerminationDialogData} from './contract-agreement-termination-dialog-data'; import {ContractAgreementTerminationDialogForm} from './contract-agreement-termination-dialog-form'; import {ContractAgreementTerminationDialogResult} from './contract-agreement-termination-dialog-result'; import {MatCheckboxChange} from "@angular/material/checkbox"; +import {EdcApiService} from "../../../../core/services/api/edc-api.service"; +import {IdResponseDto} from "@sovity.de/edc-client"; +import {finalize} from "rxjs/operators"; +import {NotificationService} from "../../../../core/services/notification.service"; @Component({ selector: 'contract-agreement-transfer-dialog', @@ -18,10 +21,9 @@ export class ContractAgreementTerminationDialogComponent implements OnDestroy { constructor( public form: ContractAgreementTerminationDialogForm, - public validationMessages: ValidationMessages, private dialogRef: MatDialogRef, - //private edcApiService: EdcApiService, - //private notificationService: NotificationService, + private edcApiService: EdcApiService, + private notificationService: NotificationService, @Inject(MAT_DIALOG_DATA) public data: ContractAgreementTerminationDialogData, ) {} @@ -33,9 +35,40 @@ export class ContractAgreementTerminationDialogComponent implements OnDestroy { if (this.loading && !this.form.all.valid) { return; } - this.close({contractId: '', lastUpdatedTime: null}); + + this.initiateTermination(); } + private initiateTermination() { + this.loading = true; + this.form.all.disable(); + + const value = this.form.value + let request$: Observable + request$ = this.edcApiService.terminateContractAgreement({ + contractAgreementId: this.data.contractId, + contractTerminationRequest: { + reason: value.shortReason!, + detail: value.detailedReason! + } + }); + + request$.pipe( + finalize(() => { + this.loading = false; + this.form.all.enable(); + }) + ) + .subscribe({ + next: (response) => { + this.close({contractId: response.id, lastUpdatedTime: response.lastUpdatedDate}); + }, + error: (error) => { + this.notificationService.showError('Contract termination failed!'); + console.error('Contract termination failed', error) + } + }); + } private close(params: ContractAgreementTerminationDialogResult) { this.dialogRef.close(params); From f5998d9076afbd7b4390c45b848ea63f647d2a4e Mon Sep 17 00:00:00 2001 From: Kamil Czaja Date: Wed, 17 Jul 2024 13:55:45 +0200 Subject: [PATCH 10/23] feat: contract termination via ui possible - wip: autorefresh contract details --- .../contract-agreement-fake-service.ts | 2 +- .../contract-termination-fake-service.ts | 24 ++++++++++++++++ .../api/fake-backend/edc-fake-backend.ts | 28 ++++++++----------- 3 files changed, 37 insertions(+), 17 deletions(-) create mode 100644 src/app/core/services/api/fake-backend/connector-fake-impl/contract-termination-fake-service.ts diff --git a/src/app/core/services/api/fake-backend/connector-fake-impl/contract-agreement-fake-service.ts b/src/app/core/services/api/fake-backend/connector-fake-impl/contract-agreement-fake-service.ts index f6c36d088..033563ff4 100644 --- a/src/app/core/services/api/fake-backend/connector-fake-impl/contract-agreement-fake-service.ts +++ b/src/app/core/services/api/fake-backend/connector-fake-impl/contract-agreement-fake-service.ts @@ -223,7 +223,7 @@ export const contractAgreementInitiateTransfer = ( return {id: transferProcessId, lastUpdatedDate: new Date(new Date())}; }; -const updateAgreement = ( +export const updateAgreement = ( contractAgreementId: string, patcher: Patcher, ) => { diff --git a/src/app/core/services/api/fake-backend/connector-fake-impl/contract-termination-fake-service.ts b/src/app/core/services/api/fake-backend/connector-fake-impl/contract-termination-fake-service.ts new file mode 100644 index 000000000..9f1d85634 --- /dev/null +++ b/src/app/core/services/api/fake-backend/connector-fake-impl/contract-termination-fake-service.ts @@ -0,0 +1,24 @@ +import {ContractAgreementCard, IdResponseDto, TerminateContractAgreementRequest,} from '@sovity.de/edc-client'; +import {updateAgreement} from './contract-agreement-fake-service'; + +export const initiateContractTermination = ( + request: TerminateContractAgreementRequest, +): IdResponseDto => { + let response: IdResponseDto = { + id: request.contractAgreementId, + lastUpdatedDate: new Date(), + }; + + setTimeout(() => { + updateAgreement(request.contractAgreementId, (agremeent: ContractAgreementCard) => ({ + terminationStatus: 'TERMINATED', + terminationInformation: { + terminatedAt: new Date(), + terminatedBy: 'SELF', + reason: request.contractTerminationRequest?.reason ?? '', + detail: request.contractTerminationRequest?.detail ?? '' + }, + })); + }, 4000); + return response; +}; diff --git a/src/app/core/services/api/fake-backend/edc-fake-backend.ts b/src/app/core/services/api/fake-backend/edc-fake-backend.ts index ef3d797c4..8e6f13907 100644 --- a/src/app/core/services/api/fake-backend/edc-fake-backend.ts +++ b/src/app/core/services/api/fake-backend/edc-fake-backend.ts @@ -4,6 +4,7 @@ import { ContractDefinitionPageToJSON, ContractDefinitionRequestFromJSON, ContractNegotiationRequestFromJSON, + ContractTerminationRequestFromJSON, DashboardPageToJSON, FetchAPI, IdResponseDtoToJSON, @@ -17,12 +18,7 @@ import { UiContractNegotiationToJSON, UiDataOfferToJSON, } from '@sovity.de/edc-client'; -import { - assetPage, - createAsset, - deleteAsset, - editAsset, -} from './connector-fake-impl/asset-fake-service'; +import {assetPage, createAsset, deleteAsset, editAsset,} from './connector-fake-impl/asset-fake-service'; import {getCatalogPageDataOffers} from './connector-fake-impl/catalog-fake-service'; import { contractAgreementInitiateTransfer, @@ -43,18 +39,11 @@ import { deletePolicyDefinition, policyDefinitionPage, } from './connector-fake-impl/policy-definition-fake-service'; -import { - transferHistoryPage, - transferProcessAsset, -} from './connector-fake-impl/transfer-history-fake-service'; -import { - getBody, - getMethod, - getQueryParams, - getUrl, -} from './utils/request-utils'; +import {transferHistoryPage, transferProcessAsset,} from './connector-fake-impl/transfer-history-fake-service'; +import {getBody, getMethod, getQueryParams, getUrl,} from './utils/request-utils'; import {ok} from './utils/response-utils'; import {UrlInterceptor} from './utils/url-interceptor'; +import {initiateContractTermination} from "./connector-fake-impl/contract-termination-fake-service"; export const EDC_FAKE_BACKEND: FetchAPI = async ( input: RequestInfo, @@ -172,6 +161,13 @@ export const EDC_FAKE_BACKEND: FetchAPI = async ( return ok(ContractAgreementPageToJSON(page)); }) + .url('pages/content-agreement-page/*/terminate') + .on('POST', (contractAgreementId) => { + const request = ContractTerminationRequestFromJSON(body); + const response = initiateContractTermination({contractAgreementId: contractAgreementId, contractTerminationRequest: request}); + return ok(IdResponseDtoToJSON(response)); + }) + .url('pages/contract-agreement-page/transfers') .on('POST', () => { const transferRequest = InitiateTransferRequestFromJSON(body); From d5cfc84a10ab6a91cad0c49b1907a52f9d400046 Mon Sep 17 00:00:00 2001 From: Kamil Czaja Date: Wed, 17 Jul 2024 14:28:21 +0200 Subject: [PATCH 11/23] feat: termination status filter --- src/app/core/services/api/edc-api.service.ts | 6 +- .../contract-agreement-page.module.ts | 68 ++++++++++--------- .../contract-agreement-page.component.html | 12 +++- .../contract-agreement-page.component.ts | 25 +++---- .../contract-agreement-page.service.ts | 12 ++-- 5 files changed, 70 insertions(+), 53 deletions(-) diff --git a/src/app/core/services/api/edc-api.service.ts b/src/app/core/services/api/edc-api.service.ts index 880e1a82c..c39188a60 100644 --- a/src/app/core/services/api/edc-api.service.ts +++ b/src/app/core/services/api/edc-api.service.ts @@ -20,7 +20,7 @@ import { UiAssetEditRequest, UiContractNegotiation, UiDataOffer, - buildEdcClient, TerminateContractAgreementRequest, + buildEdcClient, TerminateContractAgreementRequest, GetContractAgreementPageRequest, } from '@sovity.de/edc-client'; import {APP_CONFIG, AppConfig} from '../../config/app-config'; import {EDC_FAKE_BACKEND} from './fake-backend/edc-fake-backend'; @@ -141,8 +141,8 @@ export class EdcApiService { ); } - getContractAgreementPage(): Observable { - return from(this.edcClient.uiApi.getContractAgreementPage()); + getContractAgreementPage(getContractAgreementPageRequest: GetContractAgreementPageRequest): Observable { + return from(this.edcClient.uiApi.getContractAgreementPage(getContractAgreementPageRequest)); } initiateTransfer( diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page.module.ts b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page.module.ts index 261399611..c7eb93ea0 100644 --- a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page.module.ts +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page.module.ts @@ -31,44 +31,46 @@ import {ContractAgreementTransferDialogComponent} from './contract-agreement-tra import { ContractAgreementTerminationDialogComponent } from "./contract-agreement-termination-dialog/contract-agreement-termination-dialog.component"; +import {MatButtonToggleModule} from "@angular/material/button-toggle"; @NgModule({ - imports: [ - // Angular - CommonModule, - FormsModule, - ReactiveFormsModule, - RouterModule, + imports: [ + // Angular + CommonModule, + FormsModule, + ReactiveFormsModule, + RouterModule, - // Angular Material - MatBadgeModule, - MatButtonModule, - MatCardModule, - MatCheckboxModule, - MatChipsModule, - MatDatepickerModule, - MatFormFieldModule, - MatProgressSpinnerModule, - MatSelectModule, - MatSlideToggleModule, - MatStepperModule, - MatTooltipModule, - MatPaginatorModule, - MatProgressBarModule, - MatInputModule, - MatIconModule, - MatDialogModule, + // Angular Material + MatBadgeModule, + MatButtonModule, + MatCardModule, + MatCheckboxModule, + MatChipsModule, + MatDatepickerModule, + MatFormFieldModule, + MatProgressSpinnerModule, + MatSelectModule, + MatSlideToggleModule, + MatStepperModule, + MatTooltipModule, + MatPaginatorModule, + MatProgressBarModule, + MatInputModule, + MatIconModule, + MatDialogModule, - // Third Party - NgChartsModule, - NgxJsonViewerModule, + // Third Party + NgChartsModule, + NgxJsonViewerModule, - // EDC UI Modules - CatalogModule, - DataAddressModule, - PipesAndDirectivesModule, - UiElementsModule, - ], + // EDC UI Modules + CatalogModule, + DataAddressModule, + PipesAndDirectivesModule, + UiElementsModule, + MatButtonToggleModule, + ], declarations: [ ContractAgreementPageComponent, ContractAgreementCardsComponent, diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page/contract-agreement-page.component.html b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page/contract-agreement-page.component.html index 64e5bac93..f8ccde40f 100644 --- a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page/contract-agreement-page.component.html +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page/contract-agreement-page.component.html @@ -1,5 +1,5 @@
-
+
+ +
+ + Active Contracts + Terminated Contracts + All Contracts + +
+ +
diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page/contract-agreement-page.component.ts b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page/contract-agreement-page.component.ts index c12b53356..3ced64cdf 100644 --- a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page/contract-agreement-page.component.ts +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page/contract-agreement-page.component.ts @@ -1,23 +1,20 @@ import {Component, OnDestroy, OnInit} from '@angular/core'; import {FormControl} from '@angular/forms'; -import { - BehaviorSubject, - Observable, - Subject, - concat, - distinctUntilChanged, - of, - share, -} from 'rxjs'; +import {BehaviorSubject, concat, distinctUntilChanged, Observable, of, share, Subject,} from 'rxjs'; import {filter, map, takeUntil} from 'rxjs/operators'; -import {AssetDetailDialogDataService} from 'src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog-data.service'; -import {AssetDetailDialogService} from '../../../../component-library/catalog/asset-detail-dialog/asset-detail-dialog.service'; +import { + AssetDetailDialogDataService +} from 'src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog-data.service'; +import { + AssetDetailDialogService +} from '../../../../component-library/catalog/asset-detail-dialog/asset-detail-dialog.service'; import {Fetched} from '../../../../core/services/models/fetched'; import {value$} from '../../../../core/utils/form-group-utils'; import {filterNotNull} from '../../../../core/utils/rxjs-utils'; import {ContractAgreementCardMapped} from '../contract-agreement-cards/contract-agreement-card-mapped'; import {ContractAgreementPageData} from './contract-agreement-page.data'; import {ContractAgreementPageService} from './contract-agreement-page.service'; +import {ContractTerminationStatus} from "@sovity.de/edc-client"; @Component({ selector: 'app-contract-agreement-page', @@ -39,8 +36,12 @@ export class ContractAgreementPageComponent implements OnInit, OnDestroy { ) {} ngOnInit(): void { + this.fetchContracts(); + } + + fetchContracts(filter?: ContractTerminationStatus) { this.page$ = this.contractAgreementPageService - .contractAgreementPageData$(this.fetch$, 5000, this.searchText$()) + .contractAgreementPageData$(this.fetch$, 5000, this.searchText$(), filter) .pipe(takeUntil(this.ngOnDestroy$), share()); this.page$.subscribe((contractAgreementList) => { this.page = contractAgreementList; diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page/contract-agreement-page.service.ts b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page/contract-agreement-page.service.ts index 1f4802073..38dd670b3 100644 --- a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page/contract-agreement-page.service.ts +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page/contract-agreement-page.service.ts @@ -1,10 +1,11 @@ import {Injectable} from '@angular/core'; -import {Observable, combineLatest, concat, interval, of} from 'rxjs'; +import {combineLatest, concat, interval, Observable, of} from 'rxjs'; import {filter, map, switchMap} from 'rxjs/operators'; import { ConnectorLimits, ContractAgreementCard, ContractAgreementPage, + ContractTerminationStatus, } from '@sovity.de/edc-client'; import {ActiveFeatureSet} from '../../../../core/config/active-feature-set'; import {EdcApiService} from '../../../../core/services/api/edc-api.service'; @@ -25,12 +26,13 @@ export class ContractAgreementPageService { refresh$: Observable, silentPollingInterval: number, searchText$: Observable, + terminationStatusFilter?: ContractTerminationStatus, ): Observable> { return combineLatest([ refresh$.pipe( switchMap(() => concat( - this.fetchData(), + this.fetchData(terminationStatusFilter), this.silentRefreshing(silentPollingInterval), ), ), @@ -45,9 +47,11 @@ export class ContractAgreementPageService { ); } - private fetchData(): Observable> { + private fetchData(terminationStatusFilter?: ContractTerminationStatus): Observable> { + const requestBody = {contractAgreementPageQuery: {terminationStatus: terminationStatusFilter}}; + return combineLatest([ - this.edcApiService.getContractAgreementPage(), + this.edcApiService.getContractAgreementPage(requestBody), this.fetchLimits(), ]).pipe( map(([contractAgreementPage, connectorLimits]) => From c9a6dd1c0b2496ad8a10aac33766d95f03b41efa Mon Sep 17 00:00:00 2001 From: Kamil Czaja Date: Wed, 17 Jul 2024 15:32:10 +0200 Subject: [PATCH 12/23] fix: termination status filter now actually works --- .../contract-agreement-fake-service.ts | 8 ++++--- .../api/fake-backend/edc-fake-backend.ts | 5 +++-- .../contract-agreement-page.component.html | 8 +++---- .../contract-agreement-page.component.ts | 21 ++++++++++++++++--- .../contract-agreement-page.service.ts | 11 ++++++---- 5 files changed, 37 insertions(+), 16 deletions(-) diff --git a/src/app/core/services/api/fake-backend/connector-fake-impl/contract-agreement-fake-service.ts b/src/app/core/services/api/fake-backend/connector-fake-impl/contract-agreement-fake-service.ts index 033563ff4..9aa2921d7 100644 --- a/src/app/core/services/api/fake-backend/connector-fake-impl/contract-agreement-fake-service.ts +++ b/src/app/core/services/api/fake-backend/connector-fake-impl/contract-agreement-fake-service.ts @@ -1,7 +1,7 @@ import { ContractAgreementCard, ContractAgreementPage, - ContractAgreementTransferProcess, + ContractAgreementTransferProcess, GetContractAgreementPageRequest, IdResponseDto, InitiateTransferRequest, } from '@sovity.de/edc-client'; @@ -187,9 +187,11 @@ let contractAgreements: ContractAgreementCard[] = [ ], }, ]; -export const contractAgreementPage = (): ContractAgreementPage => { +export const contractAgreementPage = (request: GetContractAgreementPageRequest): ContractAgreementPage => { return { - contractAgreements, + contractAgreements: request.contractAgreementPageQuery?.terminationStatus + ? contractAgreements.filter((agreement) => agreement.terminationStatus === request.contractAgreementPageQuery!.terminationStatus) + : contractAgreements }; }; diff --git a/src/app/core/services/api/fake-backend/edc-fake-backend.ts b/src/app/core/services/api/fake-backend/edc-fake-backend.ts index 8e6f13907..e3d053196 100644 --- a/src/app/core/services/api/fake-backend/edc-fake-backend.ts +++ b/src/app/core/services/api/fake-backend/edc-fake-backend.ts @@ -1,5 +1,5 @@ import { - AssetPageToJSON, + AssetPageToJSON, ContractAgreementPageQueryFromJSON, ContractAgreementPageToJSON, ContractDefinitionPageToJSON, ContractDefinitionRequestFromJSON, @@ -157,7 +157,8 @@ export const EDC_FAKE_BACKEND: FetchAPI = async ( .url('pages/contract-agreement-page') .on('POST', () => { - const page = contractAgreementPage(); + const request = ContractAgreementPageQueryFromJSON(body); + const page = contractAgreementPage({contractAgreementPageQuery: request}); return ok(ContractAgreementPageToJSON(page)); }) diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page/contract-agreement-page.component.html b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page/contract-agreement-page.component.html index f8ccde40f..a071c5853 100644 --- a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page/contract-agreement-page.component.html +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page/contract-agreement-page.component.html @@ -19,10 +19,10 @@
- - Active Contracts - Terminated Contracts - All Contracts + + Active Contracts + Terminated Contracts + All Contracts
diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page/contract-agreement-page.component.ts b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page/contract-agreement-page.component.ts index 3ced64cdf..738ad28d9 100644 --- a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page/contract-agreement-page.component.ts +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page/contract-agreement-page.component.ts @@ -25,7 +25,9 @@ export class ContractAgreementPageComponent implements OnInit, OnDestroy { page: Fetched = Fetched.empty(); page$: Observable> = new Subject(); searchText = new FormControl(''); - deleteBusy = false; + terminationFilterControl: FormControl = new FormControl('ONGOING'); + + terminationFilter: ContractTerminationStatus | null = 'ONGOING'; private fetch$ = new BehaviorSubject(null); @@ -36,18 +38,29 @@ export class ContractAgreementPageComponent implements OnInit, OnDestroy { ) {} ngOnInit(): void { + //this.terminationFilterControl.setValue('all') this.fetchContracts(); } - fetchContracts(filter?: ContractTerminationStatus) { + fetchContracts() { this.page$ = this.contractAgreementPageService - .contractAgreementPageData$(this.fetch$, 5000, this.searchText$(), filter) + .contractAgreementPageData$(this.fetch$, 5000, this.searchText$(), this.terminationFilter) .pipe(takeUntil(this.ngOnDestroy$), share()); this.page$.subscribe((contractAgreementList) => { this.page = contractAgreementList; }); } + onTerminationFilterChange() { + if (this.terminationFilterControl.value === 'all') { + this.terminationFilter = null; + } else { + this.terminationFilter = this.terminationFilterControl.value as ContractTerminationStatus; + } + + this.fetchContracts() + } + onContractAgreementClick(card: ContractAgreementCardMapped) { const data$ = this.card$(card.contractAgreementId).pipe( map((card) => @@ -90,4 +103,6 @@ export class ContractAgreementPageComponent implements OnInit, OnDestroy { this.ngOnDestroy$.next(null); this.ngOnDestroy$.complete(); } + + protected readonly value$ = value$; } diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page/contract-agreement-page.service.ts b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page/contract-agreement-page.service.ts index 38dd670b3..660246424 100644 --- a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page/contract-agreement-page.service.ts +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page/contract-agreement-page.service.ts @@ -22,17 +22,20 @@ export class ContractAgreementPageService { private activeFeatureSet: ActiveFeatureSet, ) {} + activeTerminationFilter?: ContractTerminationStatus | null; + contractAgreementPageData$( refresh$: Observable, silentPollingInterval: number, searchText$: Observable, - terminationStatusFilter?: ContractTerminationStatus, + terminationStatusFilter?: ContractTerminationStatus | null, ): Observable> { + this.activeTerminationFilter = terminationStatusFilter; return combineLatest([ refresh$.pipe( switchMap(() => concat( - this.fetchData(terminationStatusFilter), + this.fetchData(), this.silentRefreshing(silentPollingInterval), ), ), @@ -47,8 +50,8 @@ export class ContractAgreementPageService { ); } - private fetchData(terminationStatusFilter?: ContractTerminationStatus): Observable> { - const requestBody = {contractAgreementPageQuery: {terminationStatus: terminationStatusFilter}}; + private fetchData(): Observable> { + const requestBody = this.activeTerminationFilter ? {contractAgreementPageQuery: {terminationStatus: this.activeTerminationFilter}} : {}; return combineLatest([ this.edcApiService.getContractAgreementPage(requestBody), From f9132eb147a7b71a1f94c754acff7958e10c2950 Mon Sep 17 00:00:00 2001 From: Kamil Czaja Date: Wed, 17 Jul 2024 15:42:52 +0200 Subject: [PATCH 13/23] --wip-- [skip ci] --- .../asset-detail-dialog.component.html | 11 +++++------ .../ui-elements/ago/ago.component.ts | 2 +- .../ui-elements/ui-elements.module.ts | 16 +++++++++------- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog.component.html b/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog.component.html index 04127a621..8a080b0da 100644 --- a/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog.component.html +++ b/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog.component.html @@ -71,16 +71,15 @@
- This contract has been terminated - - by {{ data.contractAgreement!!.terminationInformation?.terminatedBy === 'SELF' ? 'you.' : 'the counter-party.' }} + Contract has been terminated +

- Termination - date: {{ data.contractAgreement!!.terminationInformation!!.terminatedAt | formatDate: 'yyyy-MM-dd HH:mm:ss' }} + Terminated + by {{ data.contractAgreement!!.terminationInformation?.terminatedBy === 'SELF' ? 'you.' : 'the counter-party.' }}
- Reason: {{ data.contractAgreement!!.terminationInformation!!.reason }} + Reason:
{{ data.contractAgreement!!.terminationInformation!!.reason }}

Details:
diff --git a/src/app/component-library/ui-elements/ago/ago.component.ts b/src/app/component-library/ui-elements/ago/ago.component.ts index 380f16fe4..6f60bb4eb 100644 --- a/src/app/component-library/ui-elements/ago/ago.component.ts +++ b/src/app/component-library/ui-elements/ago/ago.component.ts @@ -7,7 +7,7 @@ import {Component, Input} from '@angular/core'; */ @Component({ selector: 'ago', - template: `{{ + template: `{{ date | ago | async }}`, }) diff --git a/src/app/component-library/ui-elements/ui-elements.module.ts b/src/app/component-library/ui-elements/ui-elements.module.ts index 031df1a55..a23190cc6 100644 --- a/src/app/component-library/ui-elements/ui-elements.module.ts +++ b/src/app/component-library/ui-elements/ui-elements.module.ts @@ -9,16 +9,18 @@ import {EmptyStateComponent} from './empty-state/empty-state.component'; import {ErrorStateComponent} from './error-state/error-state.component'; import {HorizontalSectionDividerComponent} from './horizontal-section-divider/horizontal-section-divider.component'; import {LoadingStateComponent} from './loading-state/loading-state.component'; +import {MatTooltipModule} from "@angular/material/tooltip"; @NgModule({ - imports: [ - // Angular - CommonModule, + imports: [ + // Angular + CommonModule, - // Angular Material - MatIconModule, - MatProgressSpinnerModule, - ], + // Angular Material + MatIconModule, + MatProgressSpinnerModule, + MatTooltipModule, + ], declarations: [ AgoComponent, AgoPipe, From 3f62734389e1a3dd08fed87c32a5bb2ccbfe488e Mon Sep 17 00:00:00 2001 From: Kamil Czaja Date: Wed, 17 Jul 2024 16:22:42 +0200 Subject: [PATCH 14/23] fix: termination dialog styling --- .../asset-detail-dialog.component.html | 26 +++++----- .../asset-property-grid-group-builder.ts | 24 --------- ...tract-agreement-termination-dialog-form.ts | 8 +-- ...greement-termination-dialog.component.html | 49 ++++++++++--------- 4 files changed, 43 insertions(+), 64 deletions(-) diff --git a/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog.component.html b/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog.component.html index 8a080b0da..cb0f24a9f 100644 --- a/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog.component.html +++ b/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog.component.html @@ -69,22 +69,18 @@ clip-rule="evenodd"/>

-
+
- Contract has been terminated - + {{ data.contractAgreement!!.terminationInformation!!.reason }} +
+
+ {{ data.contractAgreement!!.terminationInformation!!.detail }}
-
-

- Terminated - by {{ data.contractAgreement!!.terminationInformation?.terminatedBy === 'SELF' ? 'you.' : 'the counter-party.' }} -
- Reason:
{{ data.contractAgreement!!.terminationInformation!!.reason }} -

-

- Details:
- {{ data.contractAgreement!!.terminationInformation!!.detail }} -

+
+ + · + terminated + by {{ data.contractAgreement!!.terminationInformation?.terminatedBy === 'SELF' ? 'you' : 'the counter-party' }}
@@ -139,7 +135,7 @@ color="warn" [disabled]="data.contractAgreement?.isTerminated ?? false" (click)="onTerminateClick()"> - Terminate Contract + Terminate
diff --git a/src/app/component-library/catalog/asset-detail-dialog/asset-property-grid-group-builder.ts b/src/app/component-library/catalog/asset-detail-dialog/asset-property-grid-group-builder.ts index 9665853fa..1ef71ce09 100644 --- a/src/app/component-library/catalog/asset-detail-dialog/asset-property-grid-group-builder.ts +++ b/src/app/component-library/catalog/asset-detail-dialog/asset-property-grid-group-builder.ts @@ -312,30 +312,6 @@ export class AssetPropertyGridGroupBuilder { }); } - if (contractAgreement.isTerminated) { - properties.push({ - icon: 'content_paste_off', - label: 'Contract status', - text: contractAgreement.statusText, - additionalClasses: 'text-warn', - }) - properties.push({ - icon: 'category', - label: 'Terminated at', - text: this.propertyGridUtils.formatDate(contractAgreement.terminationInformation?.terminatedAt) - }) - properties.push({ - icon: 'group_off', - label: 'Terminated by', - ...this.propertyGridUtils.guessValue(contractAgreement.terminationInformation?.terminatedBy) - }) - properties.push({ - icon: 'category', - label: 'Termination reason', - ...this.propertyGridUtils.guessValue(contractAgreement.terminationInformation?.reason) - }) - } - return { groupLabel: 'Contract Agreement', properties, diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-form.ts b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-form.ts index cc00e277f..b35469b8b 100644 --- a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-form.ts +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-form.ts @@ -23,10 +23,12 @@ export class ContractAgreementTerminationDialogForm { } buildFormGroup(): FormGroup { - return this.formBuilder.nonNullable.group({ - shortReason: ['', Validators.required], - detailedReason: [''] + const formGroup = this.formBuilder.nonNullable.group({ + shortReason: ['User terminated', Validators.required], + detailedReason: ['', [Validators.required, Validators.maxLength(1000)]] }); + formGroup.controls.shortReason.disable() + return formGroup; } } diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog.component.html b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog.component.html index e708ccdee..0c7100d0e 100644 --- a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog.component.html +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog.component.html @@ -1,9 +1,20 @@

Terminate Contract Agreement

-
-
Reason
+
+
+ By clicking the 'Terminate Contract' button, you will terminate the contract + agreement. New data transfers via this agreement will no longer be possible and current transfer processes + will + be canceled. +
+
+ This action is irreversible. +
+
+
+
Termination Details
Reason @@ -11,39 +22,33 @@

Terminate Contract Agreement

matInput formControlName="shortReason" placeholder="Enter reason for termination" - maxlength="100" - required> - - Reason is required - - {{form.all.controls.shortReason.value.length}}/100 characters + required + >
- Details + Detailed reason - {{form.all.controls.detailedReason.value.length}}/1000 characters + autofocus + rows="10"> + {{ form.all.controls.detailedReason.value.length }}/1000 characters + + Maximum 1000 characters allowed. + + + Field is required. +
-
Confirmation
-
-

- By clicking the 'Terminate Contract' button, you will terminate the contract - agreement. New data transfers via this agreement will no longer be possible and current transfer processes will - be canceled.
- This action is irreversible. -

-
- I have read the information and want to terminate the contract agreement. + I understand the consequences of terminating a contract.
@@ -61,6 +66,6 @@

Terminate Contract Agreement

color="warn" [disabled]="!form.all.valid || loading || !checkboxChecked" (click)="onSave()"> - Terminate Contract + Terminate From fd3f5feca1e8a4cee02853d67be1fca8db537d8d Mon Sep 17 00:00:00 2001 From: Kamil Czaja Date: Wed, 17 Jul 2024 17:26:53 +0200 Subject: [PATCH 15/23] feat: auto-refresh after termination --- .../asset-detail-dialog-data.service.ts | 2 + .../asset-detail-dialog-data.ts | 6 +- .../asset-detail-dialog.component.html | 5 +- .../asset-detail-dialog.component.ts | 39 ++++++--- src/app/core/services/api/edc-api.service.ts | 42 ++++++++-- .../contract-agreement-fake-service.ts | 35 +++++--- .../contract-termination-fake-service.ts | 17 ++-- src/app/core/utils/rxjs-utils.ts | 12 ++- .../contract-agreement-page.component.ts | 79 +++++++++++-------- 9 files changed, 166 insertions(+), 71 deletions(-) diff --git a/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog-data.service.ts b/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog-data.service.ts index d440a700b..299c13cda 100644 --- a/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog-data.service.ts +++ b/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog-data.service.ts @@ -60,6 +60,7 @@ export class AssetDetailDialogDataService { contractAgreementDetails( contractAgreement: ContractAgreementCardMapped, + refreshCallback: () => void, ): AssetDetailDialogData { const asset = contractAgreement.asset; @@ -85,6 +86,7 @@ export class AssetDetailDialogDataService { asset: contractAgreement.asset, contractAgreement, propertyGridGroups, + refreshCallback, }; } } diff --git a/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog-data.ts b/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog-data.ts index 4753a2e8c..b219cf004 100644 --- a/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog-data.ts +++ b/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog-data.ts @@ -4,10 +4,7 @@ import {ContractAgreementCardMapped} from '../../../routes/connector-ui/contract import {PropertyGridGroup} from '../../property-grid/property-grid-group/property-grid-group'; export interface AssetDetailDialogData { - type: - | 'asset-details' - | 'data-offer' - | 'contract-agreement' + type: 'asset-details' | 'data-offer' | 'contract-agreement'; propertyGridGroups: PropertyGridGroup[]; asset: UiAssetMapped; dataOffer?: DataOffer; @@ -15,6 +12,7 @@ export interface AssetDetailDialogData { showDeleteButton?: boolean; showEditButton?: boolean; onAssetEditClick?: OnAssetEditClickFn; + refreshCallback?: () => void; } export type OnAssetEditClickFn = ( diff --git a/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog.component.html b/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog.component.html index cb0f24a9f..c73ce52f7 100644 --- a/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog.component.html +++ b/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog.component.html @@ -130,7 +130,7 @@
diff --git a/src/app/component-library/catalog/asset-detail-dialog/asset-property-grid-group-builder.ts b/src/app/component-library/catalog/asset-detail-dialog/asset-property-grid-group-builder.ts index 1ef71ce09..1b29b818c 100644 --- a/src/app/component-library/catalog/asset-detail-dialog/asset-property-grid-group-builder.ts +++ b/src/app/component-library/catalog/asset-detail-dialog/asset-property-grid-group-builder.ts @@ -3,9 +3,7 @@ import {UiPolicy} from '@sovity.de/edc-client'; import {ActiveFeatureSet} from '../../../core/config/active-feature-set'; import {UiAssetMapped} from '../../../core/services/models/ui-asset-mapped'; import {ParticipantIdLocalization} from '../../../core/services/participant-id-localization'; -import { - ContractAgreementCardMapped -} from '../../../routes/connector-ui/contract-agreement-page/contract-agreement-cards/contract-agreement-card-mapped'; +import {ContractAgreementCardMapped} from '../../../routes/connector-ui/contract-agreement-page/contract-agreement-cards/contract-agreement-card-mapped'; import {PropertyGridGroup} from '../../property-grid/property-grid-group/property-grid-group'; import {PropertyGridField} from '../../property-grid/property-grid/property-grid-field'; import {PropertyGridFieldService} from '../../property-grid/property-grid/property-grid-field.service'; diff --git a/src/app/component-library/catalog/catalog.module.ts b/src/app/component-library/catalog/catalog.module.ts index 909bebe0a..77c2b127d 100644 --- a/src/app/component-library/catalog/catalog.module.ts +++ b/src/app/component-library/catalog/catalog.module.ts @@ -8,9 +8,7 @@ import {MatIconModule} from '@angular/material/icon'; import {MatProgressBarModule} from '@angular/material/progress-bar'; import {MatProgressSpinnerModule} from '@angular/material/progress-spinner'; import {MatTooltipModule} from '@angular/material/tooltip'; -import { - InitiateNegotiationConfirmTosDialogModule -} from '../initiate-negotiation-confirm-tos-dialog/initiate-negotiation-confirm-tos-dialog.module'; +import {InitiateNegotiationConfirmTosDialogModule} from '../initiate-negotiation-confirm-tos-dialog/initiate-negotiation-confirm-tos-dialog.module'; import {JsonDialogModule} from '../json-dialog/json-dialog.module'; import {PipesAndDirectivesModule} from '../pipes-and-directives/pipes-and-directives.module'; import {PropertyGridModule} from '../property-grid/property-grid.module'; diff --git a/src/app/component-library/pipes-and-directives/pipes-and-directives.module.ts b/src/app/component-library/pipes-and-directives/pipes-and-directives.module.ts index b047ff46b..f37b7b032 100644 --- a/src/app/component-library/pipes-and-directives/pipes-and-directives.module.ts +++ b/src/app/component-library/pipes-and-directives/pipes-and-directives.module.ts @@ -7,9 +7,9 @@ import {ExternalLinkDirective} from './directives/external-link.directive'; import {RemoveClassDirective} from './directives/remove-class.directive'; import {TrackByFieldDirective} from './directives/track-by-field.directive'; import {CompareByFieldPipe} from './pipes/compare-by-field.pipe'; +import {DateFormatPipe} from './pipes/date-format.pipe'; import {IsActiveFeaturePipe} from './pipes/is-active-feature.pipe'; import {ValuesPipe} from './pipes/values.pipe'; -import {DateFormatPipe} from "./pipes/date-format.pipe"; @NgModule({ imports: [ diff --git a/src/app/component-library/pipes-and-directives/pipes/date-format.pipe.ts b/src/app/component-library/pipes-and-directives/pipes/date-format.pipe.ts index 95cc12f04..aeb07986e 100644 --- a/src/app/component-library/pipes-and-directives/pipes/date-format.pipe.ts +++ b/src/app/component-library/pipes-and-directives/pipes/date-format.pipe.ts @@ -1,5 +1,5 @@ +import {formatDate} from '@angular/common'; import {Inject, LOCALE_ID, Pipe, PipeTransform} from '@angular/core'; -import {formatDate} from "@angular/common"; /** * Creates Compare By Function for Angular Material compareWith parameters @@ -8,6 +8,6 @@ import {formatDate} from "@angular/common"; export class DateFormatPipe implements PipeTransform { constructor(@Inject(LOCALE_ID) private locale: string) {} transform(date: Date, format: string): string { - return formatDate(date, format, this.locale) + return formatDate(date, format, this.locale); } } diff --git a/src/app/component-library/ui-elements/ago/ago.component.ts b/src/app/component-library/ui-elements/ago/ago.component.ts index 6f60bb4eb..c46acb279 100644 --- a/src/app/component-library/ui-elements/ago/ago.component.ts +++ b/src/app/component-library/ui-elements/ago/ago.component.ts @@ -7,9 +7,10 @@ import {Component, Input} from '@angular/core'; */ @Component({ selector: 'ago', - template: `{{ - date | ago | async - }}`, + template: `{{ date | ago | async }}`, }) export class AgoComponent { @Input() diff --git a/src/app/component-library/ui-elements/ui-elements.module.ts b/src/app/component-library/ui-elements/ui-elements.module.ts index a23190cc6..a5ada56e1 100644 --- a/src/app/component-library/ui-elements/ui-elements.module.ts +++ b/src/app/component-library/ui-elements/ui-elements.module.ts @@ -2,6 +2,7 @@ import {CommonModule} from '@angular/common'; import {NgModule} from '@angular/core'; import {MatIconModule} from '@angular/material/icon'; import {MatProgressSpinnerModule} from '@angular/material/progress-spinner'; +import {MatTooltipModule} from '@angular/material/tooltip'; import {AgoComponent} from './ago/ago.component'; import {AgoPipe} from './ago/ago.pipe'; import {DateComponent} from './date/date.component'; @@ -9,18 +10,17 @@ import {EmptyStateComponent} from './empty-state/empty-state.component'; import {ErrorStateComponent} from './error-state/error-state.component'; import {HorizontalSectionDividerComponent} from './horizontal-section-divider/horizontal-section-divider.component'; import {LoadingStateComponent} from './loading-state/loading-state.component'; -import {MatTooltipModule} from "@angular/material/tooltip"; @NgModule({ - imports: [ - // Angular - CommonModule, + imports: [ + // Angular + CommonModule, - // Angular Material - MatIconModule, - MatProgressSpinnerModule, - MatTooltipModule, - ], + // Angular Material + MatIconModule, + MatProgressSpinnerModule, + MatTooltipModule, + ], declarations: [ AgoComponent, AgoPipe, diff --git a/src/app/core/services/title-utils.service.ts b/src/app/core/services/title-utils.service.ts index 26e368a3e..ef372f793 100644 --- a/src/app/core/services/title-utils.service.ts +++ b/src/app/core/services/title-utils.service.ts @@ -1,6 +1,11 @@ import {Injectable} from '@angular/core'; import {Title} from '@angular/platform-browser'; -import {ActivatedRoute, ActivatedRouteSnapshot, NavigationEnd, Router,} from '@angular/router'; +import { + ActivatedRoute, + ActivatedRouteSnapshot, + NavigationEnd, + Router, +} from '@angular/router'; import {concat, of} from 'rxjs'; import {filter, map, shareReplay} from 'rxjs/operators'; diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-cards/contract-agreement-cards.component.html b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-cards/contract-agreement-cards.component.html index e74703cda..8586452a1 100644 --- a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-cards/contract-agreement-cards.component.html +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-cards/contract-agreement-cards.component.html @@ -11,8 +11,8 @@ ? 'file_upload_off' : 'file_upload' : card.isTerminated - ? 'file_download_off' - : 'file_download' + ? 'file_download_off' + : 'file_download' }} @@ -62,7 +62,7 @@ class="link break-all" externalLink [attr.href]="card.counterPartyAddress" - >{{ card.counterPartyAddress }}{{ card.counterPartyAddress }}
diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page.module.ts b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page.module.ts index c7eb93ea0..35e6c4176 100644 --- a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page.module.ts +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page.module.ts @@ -3,6 +3,7 @@ import {NgModule} from '@angular/core'; import {FormsModule, ReactiveFormsModule} from '@angular/forms'; import {MatBadgeModule} from '@angular/material/badge'; import {MatButtonModule} from '@angular/material/button'; +import {MatButtonToggleModule} from '@angular/material/button-toggle'; import {MatCardModule} from '@angular/material/card'; import {MatCheckboxModule} from '@angular/material/checkbox'; import {MatChipsModule} from '@angular/material/chips'; @@ -27,50 +28,47 @@ import {PipesAndDirectivesModule} from '../../../component-library/pipes-and-dir import {UiElementsModule} from '../../../component-library/ui-elements/ui-elements.module'; import {ContractAgreementCardsComponent} from './contract-agreement-cards/contract-agreement-cards.component'; import {ContractAgreementPageComponent} from './contract-agreement-page/contract-agreement-page.component'; +import {ContractAgreementTerminationDialogComponent} from './contract-agreement-termination-dialog/contract-agreement-termination-dialog.component'; import {ContractAgreementTransferDialogComponent} from './contract-agreement-transfer-dialog/contract-agreement-transfer-dialog.component'; -import { - ContractAgreementTerminationDialogComponent -} from "./contract-agreement-termination-dialog/contract-agreement-termination-dialog.component"; -import {MatButtonToggleModule} from "@angular/material/button-toggle"; @NgModule({ - imports: [ - // Angular - CommonModule, - FormsModule, - ReactiveFormsModule, - RouterModule, + imports: [ + // Angular + CommonModule, + FormsModule, + ReactiveFormsModule, + RouterModule, - // Angular Material - MatBadgeModule, - MatButtonModule, - MatCardModule, - MatCheckboxModule, - MatChipsModule, - MatDatepickerModule, - MatFormFieldModule, - MatProgressSpinnerModule, - MatSelectModule, - MatSlideToggleModule, - MatStepperModule, - MatTooltipModule, - MatPaginatorModule, - MatProgressBarModule, - MatInputModule, - MatIconModule, - MatDialogModule, + // Angular Material + MatBadgeModule, + MatButtonModule, + MatCardModule, + MatCheckboxModule, + MatChipsModule, + MatDatepickerModule, + MatFormFieldModule, + MatProgressSpinnerModule, + MatSelectModule, + MatSlideToggleModule, + MatStepperModule, + MatTooltipModule, + MatPaginatorModule, + MatProgressBarModule, + MatInputModule, + MatIconModule, + MatDialogModule, - // Third Party - NgChartsModule, - NgxJsonViewerModule, + // Third Party + NgChartsModule, + NgxJsonViewerModule, - // EDC UI Modules - CatalogModule, - DataAddressModule, - PipesAndDirectivesModule, - UiElementsModule, - MatButtonToggleModule, - ], + // EDC UI Modules + CatalogModule, + DataAddressModule, + PipesAndDirectivesModule, + UiElementsModule, + MatButtonToggleModule, + ], declarations: [ ContractAgreementPageComponent, ContractAgreementCardsComponent, diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page/contract-agreement-page.component.html b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page/contract-agreement-page.component.html index a071c5853..d84d22141 100644 --- a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page/contract-agreement-page.component.html +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page/contract-agreement-page.component.html @@ -19,14 +19,25 @@
- - Active Contracts - Terminated Contracts - All Contracts + + Active Contracts + Terminated Contracts + All Contracts
-
diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page/contract-agreement-page.service.ts b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page/contract-agreement-page.service.ts index 660246424..aff294920 100644 --- a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page/contract-agreement-page.service.ts +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page/contract-agreement-page.service.ts @@ -1,5 +1,5 @@ import {Injectable} from '@angular/core'; -import {combineLatest, concat, interval, Observable, of} from 'rxjs'; +import {Observable, combineLatest, concat, interval, of} from 'rxjs'; import {filter, map, switchMap} from 'rxjs/operators'; import { ConnectorLimits, @@ -51,7 +51,13 @@ export class ContractAgreementPageService { } private fetchData(): Observable> { - const requestBody = this.activeTerminationFilter ? {contractAgreementPageQuery: {terminationStatus: this.activeTerminationFilter}} : {}; + const requestBody = this.activeTerminationFilter + ? { + contractAgreementPageQuery: { + terminationStatus: this.activeTerminationFilter, + }, + } + : {}; return combineLatest([ this.edcApiService.getContractAgreementPage(requestBody), diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-form-model.ts b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-form-model.ts index e1d152ebe..747fcdd36 100644 --- a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-form-model.ts +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-form-model.ts @@ -1,4 +1,4 @@ -import {FormControl, ɵFormGroupValue,} from '@angular/forms'; +import {FormControl, ɵFormGroupValue} from '@angular/forms'; /** * Form Value Type diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-form.ts b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-form.ts index b35469b8b..4c9cde490 100644 --- a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-form.ts +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-form.ts @@ -19,16 +19,14 @@ export class ContractAgreementTerminationDialogForm { return this.all.value; } - constructor(private formBuilder: FormBuilder) { - } + constructor(private formBuilder: FormBuilder) {} buildFormGroup(): FormGroup { const formGroup = this.formBuilder.nonNullable.group({ shortReason: ['User terminated', Validators.required], - detailedReason: ['', [Validators.required, Validators.maxLength(1000)]] + detailedReason: ['', [Validators.required, Validators.maxLength(1000)]], }); - formGroup.controls.shortReason.disable() + formGroup.controls.shortReason.disable(); return formGroup; } } - diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog.component.html b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog.component.html index 0c7100d0e..64cd56a8f 100644 --- a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog.component.html +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog.component.html @@ -3,14 +3,11 @@

Terminate Contract Agreement

- By clicking the 'Terminate Contract' button, you will terminate the contract - agreement. New data transfers via this agreement will no longer be possible and current transfer processes - will - be canceled. -
-
- This action is irreversible. + By clicking the 'Terminate Contract' button, you will terminate the + contract agreement. New data transfers via this agreement will no longer + be possible and current transfer processes will be canceled.
+
This action is irreversible.
@@ -22,8 +19,7 @@

Terminate Contract Agreement

matInput formControlName="shortReason" placeholder="Enter reason for termination" - required - > + required /> @@ -34,11 +30,16 @@

Terminate Contract Agreement

placeholder="You can enter a detailed explanation here" autofocus rows="10"> - {{ form.all.controls.detailedReason.value.length }}/1000 characters - + {{ form.all.controls.detailedReason.value.length }}/1000 + characters + Maximum 1000 characters allowed. - + Field is required.
@@ -47,17 +48,16 @@

Terminate Contract Agreement

- + I understand the consequences of terminating a contract.
- diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog.component.ts b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog.component.ts index adab70f69..84a32dc84 100644 --- a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog.component.ts +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog.component.ts @@ -1,14 +1,14 @@ import {Component, Inject, OnDestroy} from '@angular/core'; +import {MatCheckboxChange} from '@angular/material/checkbox'; import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog'; import {Observable, Subject} from 'rxjs'; +import {finalize} from 'rxjs/operators'; +import {IdResponseDto} from '@sovity.de/edc-client'; +import {EdcApiService} from '../../../../core/services/api/edc-api.service'; +import {NotificationService} from '../../../../core/services/notification.service'; import {ContractAgreementTerminationDialogData} from './contract-agreement-termination-dialog-data'; import {ContractAgreementTerminationDialogForm} from './contract-agreement-termination-dialog-form'; import {ContractAgreementTerminationDialogResult} from './contract-agreement-termination-dialog-result'; -import {MatCheckboxChange} from "@angular/material/checkbox"; -import {EdcApiService} from "../../../../core/services/api/edc-api.service"; -import {IdResponseDto} from "@sovity.de/edc-client"; -import {finalize} from "rxjs/operators"; -import {NotificationService} from "../../../../core/services/notification.service"; @Component({ selector: 'contract-agreement-transfer-dialog', @@ -24,7 +24,8 @@ export class ContractAgreementTerminationDialogComponent implements OnDestroy { private dialogRef: MatDialogRef, private edcApiService: EdcApiService, private notificationService: NotificationService, - @Inject(MAT_DIALOG_DATA) public data: ContractAgreementTerminationDialogData, + @Inject(MAT_DIALOG_DATA) + public data: ContractAgreementTerminationDialogData, ) {} public onCheckboxChange($event: MatCheckboxChange) { @@ -43,30 +44,34 @@ export class ContractAgreementTerminationDialogComponent implements OnDestroy { this.loading = true; this.form.all.disable(); - const value = this.form.value - let request$: Observable + const value = this.form.value; + let request$: Observable; request$ = this.edcApiService.terminateContractAgreement({ contractAgreementId: this.data.contractId, contractTerminationRequest: { reason: value.shortReason!, - detail: value.detailedReason! - } + detail: value.detailedReason!, + }, }); - request$.pipe( - finalize(() => { - this.loading = false; - this.form.all.enable(); - }) - ) + request$ + .pipe( + finalize(() => { + this.loading = false; + this.form.all.enable(); + }), + ) .subscribe({ next: (response) => { - this.close({contractId: response.id, lastUpdatedTime: response.lastUpdatedDate}); + this.close({ + contractId: response.id, + lastUpdatedTime: response.lastUpdatedDate, + }); }, error: (error) => { this.notificationService.showError('Contract termination failed!'); - console.error('Contract termination failed', error) - } + console.error('Contract termination failed', error); + }, }); } From 7018d18630b4c82fe7de4a85d2af2d9b2bf09794 Mon Sep 17 00:00:00 2001 From: Kamil Czaja Date: Thu, 18 Jul 2024 11:22:22 +0200 Subject: [PATCH 19/23] chore: updated CHANGELOG --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f5030135..084b4aa3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,8 @@ the detailed section referring to by linking pull requests or issues. #### Minor +- Added functionality to terminate contracts and a toggle to filter for active/terminated/all contracts + #### Patch ### Deployment Migration Notes From b2927056c0bf2dd083510778f95ea45ed7db8c95 Mon Sep 17 00:00:00 2001 From: Kamil Czaja Date: Thu, 18 Jul 2024 11:40:37 +0200 Subject: [PATCH 20/23] chore: self-review --- .../asset-detail-dialog.component.ts | 4 ---- .../pipes-and-directives.module.ts | 3 --- .../pipes-and-directives/pipes/date-format.pipe.ts | 13 ------------- .../contract-agreement-page.component.ts | 3 --- 4 files changed, 23 deletions(-) delete mode 100644 src/app/component-library/pipes-and-directives/pipes/date-format.pipe.ts diff --git a/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog.component.ts b/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog.component.ts index 4fd9e3470..2f4ed4cf3 100644 --- a/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog.component.ts +++ b/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog.component.ts @@ -1,4 +1,3 @@ -import {formatDate, getLocaleId} from '@angular/common'; import {Component, Inject, OnDestroy} from '@angular/core'; import { MAT_DIALOG_DATA, @@ -199,7 +198,4 @@ export class AssetDetailDialogComponent implements OnDestroy { this.ngOnDestroy$.next(null); this.ngOnDestroy$.complete(); } - - protected readonly formatDate = formatDate; - protected readonly getLocaleId = getLocaleId; } diff --git a/src/app/component-library/pipes-and-directives/pipes-and-directives.module.ts b/src/app/component-library/pipes-and-directives/pipes-and-directives.module.ts index f37b7b032..1af7a09de 100644 --- a/src/app/component-library/pipes-and-directives/pipes-and-directives.module.ts +++ b/src/app/component-library/pipes-and-directives/pipes-and-directives.module.ts @@ -7,7 +7,6 @@ import {ExternalLinkDirective} from './directives/external-link.directive'; import {RemoveClassDirective} from './directives/remove-class.directive'; import {TrackByFieldDirective} from './directives/track-by-field.directive'; import {CompareByFieldPipe} from './pipes/compare-by-field.pipe'; -import {DateFormatPipe} from './pipes/date-format.pipe'; import {IsActiveFeaturePipe} from './pipes/is-active-feature.pipe'; import {ValuesPipe} from './pipes/values.pipe'; @@ -23,7 +22,6 @@ import {ValuesPipe} from './pipes/values.pipe'; declarations: [ AutofocusDirective, CompareByFieldPipe, - DateFormatPipe, ExternalLinkDirective, IsActiveFeaturePipe, RemoveClassDirective, @@ -33,7 +31,6 @@ import {ValuesPipe} from './pipes/values.pipe'; exports: [ AutofocusDirective, CompareByFieldPipe, - DateFormatPipe, ExternalLinkDirective, IsActiveFeaturePipe, RemoveClassDirective, diff --git a/src/app/component-library/pipes-and-directives/pipes/date-format.pipe.ts b/src/app/component-library/pipes-and-directives/pipes/date-format.pipe.ts deleted file mode 100644 index aeb07986e..000000000 --- a/src/app/component-library/pipes-and-directives/pipes/date-format.pipe.ts +++ /dev/null @@ -1,13 +0,0 @@ -import {formatDate} from '@angular/common'; -import {Inject, LOCALE_ID, Pipe, PipeTransform} from '@angular/core'; - -/** - * Creates Compare By Function for Angular Material compareWith parameters - */ -@Pipe({name: 'formatDate'}) -export class DateFormatPipe implements PipeTransform { - constructor(@Inject(LOCALE_ID) private locale: string) {} - transform(date: Date, format: string): string { - return formatDate(date, format, this.locale); - } -} diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page/contract-agreement-page.component.ts b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page/contract-agreement-page.component.ts index e7e4474a5..465ad591d 100644 --- a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page/contract-agreement-page.component.ts +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page/contract-agreement-page.component.ts @@ -51,7 +51,6 @@ export class ContractAgreementPageComponent implements OnInit, OnDestroy { ) {} ngOnInit(): void { - //this.terminationFilterControl.setValue('all') this.fetchContracts(); } @@ -153,6 +152,4 @@ export class ContractAgreementPageComponent implements OnInit, OnDestroy { this.ngOnDestroy$.next(null); this.ngOnDestroy$.complete(); } - - protected readonly value$ = value$; } From a71ee71b08e72d2065e7bc59a047d2b7f04d2957 Mon Sep 17 00:00:00 2001 From: Kamil Czaja Date: Thu, 18 Jul 2024 12:03:20 +0200 Subject: [PATCH 21/23] fix: icon in contract dialog inconsistent with card --- .../asset-detail-dialog/asset-detail-dialog.component.html | 3 ++- .../contract-agreement-termination-dialog-form.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog.component.html b/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog.component.html index b403cd6da..ec61141e1 100644 --- a/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog.component.html +++ b/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog.component.html @@ -7,7 +7,8 @@ + class="mat-card-avatar-icon" + [class.text-warn]="data.contractAgreement?.terminationStatus === 'TERMINATED'"> {{ data.contractAgreement!!.direction === 'PROVIDING' ? data.contractAgreement!!.isTerminated diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-form.ts b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-form.ts index 4c9cde490..aaf2af2d5 100644 --- a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-form.ts +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-termination-dialog/contract-agreement-termination-dialog-form.ts @@ -23,7 +23,7 @@ export class ContractAgreementTerminationDialogForm { buildFormGroup(): FormGroup { const formGroup = this.formBuilder.nonNullable.group({ - shortReason: ['User terminated', Validators.required], + shortReason: ['Terminated by user', Validators.required], detailedReason: ['', [Validators.required, Validators.maxLength(1000)]], }); formGroup.controls.shortReason.disable(); From b58bd9e92a130efe81256d62b69fc3cbeefe88d0 Mon Sep 17 00:00:00 2001 From: Kamil Czaja Date: Thu, 18 Jul 2024 13:13:41 +0200 Subject: [PATCH 22/23] chore: review comments --- CHANGELOG.md | 3 ++- .../contract-agreement-page.service.ts | 12 +++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 084b4aa3b..86b76053e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,8 @@ the detailed section referring to by linking pull requests or issues. #### Minor -- Added functionality to terminate contracts and a toggle to filter for active/terminated/all contracts +- Both providers and consumers can now terminate contracts. +- Contracts can be filtered by their termination status. #### Patch diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page/contract-agreement-page.service.ts b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page/contract-agreement-page.service.ts index aff294920..5d4478bf2 100644 --- a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page/contract-agreement-page.service.ts +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page/contract-agreement-page.service.ts @@ -51,13 +51,11 @@ export class ContractAgreementPageService { } private fetchData(): Observable> { - const requestBody = this.activeTerminationFilter - ? { - contractAgreementPageQuery: { - terminationStatus: this.activeTerminationFilter, - }, - } - : {}; + const requestBody = { + contractAgreementPageQuery: { + terminationStatus: this.activeTerminationFilter ?? undefined, + }, + }; return combineLatest([ this.edcApiService.getContractAgreementPage(requestBody), From 43915952600e514ff5e8761ca5ea7f462a89a1e1 Mon Sep 17 00:00:00 2001 From: Kamil Czaja Date: Thu, 18 Jul 2024 13:49:39 +0200 Subject: [PATCH 23/23] chore: review 2 --- .../contract-agreement-page/contract-agreement-page.service.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page/contract-agreement-page.service.ts b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page/contract-agreement-page.service.ts index 5d4478bf2..4c127f0b7 100644 --- a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page/contract-agreement-page.service.ts +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-page/contract-agreement-page.service.ts @@ -6,6 +6,7 @@ import { ContractAgreementCard, ContractAgreementPage, ContractTerminationStatus, + GetContractAgreementPageRequest, } from '@sovity.de/edc-client'; import {ActiveFeatureSet} from '../../../../core/config/active-feature-set'; import {EdcApiService} from '../../../../core/services/api/edc-api.service'; @@ -51,7 +52,7 @@ export class ContractAgreementPageService { } private fetchData(): Observable> { - const requestBody = { + const requestBody: GetContractAgreementPageRequest = { contractAgreementPageQuery: { terminationStatus: this.activeTerminationFilter ?? undefined, },