From e6c71b4c91c7b0f2c056c727a3cd22b8e54d0069 Mon Sep 17 00:00:00 2001 From: Richard Treier Date: Mon, 25 Sep 2023 14:33:18 +0200 Subject: [PATCH 1/8] Squashed commit of the following: commit a5ea1284d07cac234949cb334ffadc9170b12f2d Author: SaadBendou Date: Mon Sep 25 14:15:54 2023 +0200 fix: Use ContractNegotiation & Catalog in UI commit 64e6f6d1d27473c76ccecdcddea9c4651b49292f Merge: 70498d4 9a177cb Author: SaadBendou Date: Mon Sep 25 11:44:11 2023 +0200 Merge branch 'main' of https://github.com/sovity/edc-ui into 406-use-new-negotiate-contract-endpoint-in-ui-1 commit 70498d4f24c18b666a02a823f8d15f4f3de9b32d Author: SaadBendou Date: Fri Sep 22 17:06:26 2023 +0200 fix: Use ContractNegotiation & Catalog in UI commit 2a35abfd0a496fe24dee52a091745c9b1f038212 Author: SaadBendou Date: Fri Sep 22 11:37:30 2023 +0200 fix: Use ContractNegotiation & Catalog in UI commit dca1e820c011fcf627bf3c4feb44b146cc24c961 Merge: 8cad198 cc84938 Author: SaadBendou Date: Fri Sep 22 11:36:35 2023 +0200 Merge branch 'main' of https://github.com/sovity/edc-ui into 406-use-new-negotiate-contract-endpoint-in-ui-1 # Conflicts: # src/app/core/services/api/edc-api.service.ts # src/app/core/services/asset-service-mapped.ts commit 8cad198b8186e0181a4a22f8a6f451eeb0f65356 Author: SaadBendou Date: Thu Sep 21 17:32:32 2023 +0200 fix: Use ContractNegotiation & Catalog in UI commit 51b7f9464355c6ac5e8f5d0141e89af06308152a Author: SaadBendou Date: Thu Sep 21 16:21:03 2023 +0200 fix:buildAsset & remove Dead Code commit 90ed2e450e05c2f8de38dbbd0d9f38afa5cf196e Author: SaadBendou Date: Thu Sep 21 15:27:18 2023 +0200 fix: use buildAsset function commit 445bf9f579c2eb8deb00230dd99ee0cdcc108fb4 Author: SaadBendou Date: Thu Sep 21 15:19:47 2023 +0200 fix: remove dead Code commit b5d8e9c7a26345a2146e6b3afd8085f9ea71e6a3 Author: SaadBendou Date: Thu Sep 21 15:14:49 2023 +0200 chore: use UI-safe Criterion && update UiCriterion commit d015c9da34ca67b80bd0a1b6fae5b6d8d59b7be7 Author: SaadBendou Date: Wed Sep 20 16:52:31 2023 +0200 chore: use UI-safe Criterion && update UiCriterion commit c8f0868e83e58ed7890d8505b779e274134a3b11 Merge: 4793366 a026525 Author: SaadBendou Date: Wed Sep 20 14:34:10 2023 +0200 Merge branch '472-use-new-type-safe-asset-in-ui' of https://github.com/sovity/edc-ui into 394-use-new-create-contract-definition-endpoint-in-ui # Conflicts: # src/app/core/services/api/edc-api.service.ts # src/app/core/services/api/fake-backend/asset-fake-service.ts # src/app/core/services/api/fake-backend/data/test-assets.ts commit 479336634220a5f0a8c9559ac2f8a15fb78c0862 Author: SaadBendou Date: Wed Sep 20 14:31:45 2023 +0200 chore: use UI-safe Criterion commit a0265254af4fa600f481fbee797cda06b918b946 Author: SaadBendou Date: Wed Sep 20 12:02:00 2023 +0200 chore: use UI-safe Asset --- .../asset-detail-dialog-data.service.ts | 7 +- .../asset-property-grid-group-builder.ts | 42 ++++++++++++ .../services/api/catalog-api-url.service.ts | 18 ----- .../api/contract-negotiation.service.ts | 62 +++++++++--------- .../services/api/contract-offer.service.ts | 25 +++++++ src/app/core/services/api/edc-api.service.ts | 29 +++++++++ .../api/fake-backend/catalog-fake-service.ts | 38 +++++++++++ .../contract-negotiation-fake-service.ts | 65 +++++++++++++++++++ .../api/fake-backend/edc-fake-backend.ts | 28 ++++++++ .../services/models/contract-offer-dto.ts | 5 +- .../core/services/models/contract-offer.ts | 4 +- .../catalog-browser-page-service.ts | 29 +++++---- .../catalog-browser-page.data.ts | 8 +-- 13 files changed, 286 insertions(+), 74 deletions(-) create mode 100644 src/app/core/services/api/fake-backend/catalog-fake-service.ts create mode 100644 src/app/core/services/api/fake-backend/contract-negotiation-fake-service.ts 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 a670c4a52..104c41897 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 @@ -1,6 +1,7 @@ import {Injectable} from '@angular/core'; +import {UiContractOffer, UiDataOffer} from '@sovity.de/edc-client'; +import {AssetPropertyMapper} from '../../../core/services/asset-property-mapper'; import {Asset} from '../../../core/services/models/asset'; -import {ContractOffer} from '../../../core/services/models/contract-offer'; import {BrokerDataOffer} from '../../../routes/broker-ui/catalog-page/catalog-page/mapping/broker-data-offer'; import {ContractAgreementCardMapped} from '../../../routes/connector-ui/contract-agreement-page/contract-agreement-cards/contract-agreement-card-mapped'; import {AssetDetailDialogData} from './asset-detail-dialog-data'; @@ -9,6 +10,7 @@ import {AssetPropertyGridGroupBuilder} from './asset-property-grid-group-builder @Injectable() export class AssetDetailDialogDataService { constructor( + private assetPropertyMapper: AssetPropertyMapper, private assetPropertyGridGroupBuilder: AssetPropertyGridGroupBuilder, ) {} @@ -26,8 +28,7 @@ export class AssetDetailDialogDataService { }; } - contractOfferDetails(contractOffer: ContractOffer): AssetDetailDialogData { - let asset = contractOffer.asset; + contractOfferDetails(contractOffer: UiContractOffer): AssetDetailDialogData { let contractPolicy = contractOffer.policy; const propertyGridGroups = [ 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 1f2b82730..989599166 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 @@ -1,6 +1,7 @@ import {Injectable} from '@angular/core'; import {MatDialog} from '@angular/material/dialog'; import {CatalogContractOffer} from '@sovity.de/broker-server-client'; +import {UiPolicy} from '@sovity.de/edc-client'; import {ActiveFeatureSet} from '../../../core/config/active-feature-set'; import {Policy} from '../../../core/services/api/legacy-managent-api-client'; import {AssetProperties} from '../../../core/services/asset-properties'; @@ -176,6 +177,20 @@ export class AssetPropertyGridGroupBuilder { this.matDialog.open(JsonDialogComponent, {data}); } + onShowUiPolicyDetailsClick( + title: string, + subtitle: string, + policyDetails: UiPolicy, + ) { + const data: JsonDialogData = { + title, + subtitle, + icon: 'policy', + objectForJson: policyDetails, + }; + this.matDialog.open(JsonDialogComponent, {data}); + } + buildContractOfferGroup( asset: Asset, contractOffer: CatalogContractOffer, @@ -225,6 +240,20 @@ export class AssetPropertyGridGroupBuilder { return {groupLabel, properties}; } + buildUiPolicyGroup( + asset: Asset, + contractPolicy: UiPolicy | null, + groupLabel: string = 'Policies', + ) { + let properties: PropertyGridField[] = []; + if (contractPolicy) { + properties.push( + this.buildUiContractPolicyField(contractPolicy, asset.name), + ); + } + return {groupLabel, properties}; + } + buildContractPolicyField(contractPolicy: Policy, subtitle: string) { return { icon: 'policy', @@ -239,6 +268,19 @@ export class AssetPropertyGridGroupBuilder { }; } + buildUiContractPolicyField(contractPolicy: UiPolicy, subtitle: string) { + return { + icon: 'policy', + label: 'Contract Policy', + text: 'Show Policy Details', + onclick: () => + this.onShowUiPolicyDetailsClick( + 'Contract Policy', + subtitle, + contractPolicy, + ), + }; + } buildContractAgreementGroup(contractAgreement: ContractAgreementCardMapped) { let properties: PropertyGridField[] = [ { diff --git a/src/app/core/services/api/catalog-api-url.service.ts b/src/app/core/services/api/catalog-api-url.service.ts index 9338d7433..23be7c1df 100644 --- a/src/app/core/services/api/catalog-api-url.service.ts +++ b/src/app/core/services/api/catalog-api-url.service.ts @@ -46,24 +46,6 @@ export class CatalogApiUrlService { this.customProviders = connectorIds; } - /** - * We fetch catalogs by proxying them through our own backend. - * - * @param connectorEndpoint target connector endpoint (or legacy full url - * targeted at own connector with query param providerUrl) - * @return full url for fetching catalog - */ - buildCatalogApiUrl(connectorEndpoint: string) { - // Detect legacy URLs - const prefix = `${this.config.managementApiUrl}/catalog?providerUrl=`; - if (connectorEndpoint.startsWith(prefix)) { - return connectorEndpoint; - } - - // Build Catalog API URL from Connector Endpoint - return `${prefix}${encodeURIComponent(connectorEndpoint)}`; - } - private splitUrls(commaJoinedUrls?: string | null): string[] { return ( commaJoinedUrls diff --git a/src/app/core/services/api/contract-negotiation.service.ts b/src/app/core/services/api/contract-negotiation.service.ts index 730af9f86..5a1116384 100644 --- a/src/app/core/services/api/contract-negotiation.service.ts +++ b/src/app/core/services/api/contract-negotiation.service.ts @@ -1,17 +1,16 @@ import {Injectable} from '@angular/core'; import {Router} from '@angular/router'; import {Observable} from 'rxjs'; -import {map} from 'rxjs/operators'; +import { + ContractNegotiationRequest, + UiContractNegotiation, +} from '@sovity.de/edc-client'; import {environment} from '../../../../environments/environment'; import {ContractOffer} from '../models/contract-offer'; import {NegotiationResult} from '../models/negotiation-result'; import {TransferProcessStates} from '../models/transfer-process-states'; import {NotificationService} from '../notification.service'; -import { - ContractNegotiationService as ContractNegotiationApiService, - ContractNegotiationDto, - NegotiationInitiateRequestDto, -} from './legacy-managent-api-client'; +import {EdcApiService} from './edc-api.service'; interface RunningTransferProcess { processId: string; @@ -28,14 +27,14 @@ export class ContractNegotiationService { NegotiationResult >(); // contractOfferId, contractAgreementId - finishedNegotiations: Map = new Map< + finishedNegotiations: Map = new Map< string, - ContractNegotiationDto + UiContractNegotiation >(); private pollingHandleNegotiation?: any; constructor( - private contractNegotiationService: ContractNegotiationApiService, + private edcApiService: EdcApiService, private router: Router, private notificationService: NotificationService, ) { @@ -82,26 +81,22 @@ export class ContractNegotiationService { } negotiate(contractOffer: ContractOffer) { - const initiateRequest: NegotiationInitiateRequestDto = { - connectorAddress: contractOffer.asset.connectorEndpoint!, - - offer: { - offerId: contractOffer.id, - assetId: contractOffer.asset.assetId, - policy: contractOffer.policy, - }, - connectorId: 'my-connector', - protocol: 'ids-multipart', + const initiateRequest: ContractNegotiationRequest = { + counterPartyAddress: contractOffer.asset.connectorEndpoint!, + contractOfferId: contractOffer.id, + assetId: contractOffer.asset.assetId, + policyJsonLd: contractOffer.policy.policyJsonLd, + counterPartyParticipantId: 'my-connector', }; const finishedNegotiationStates = ['CONFIRMED', 'DECLINED', 'ERROR']; this.initiateNegotiation(initiateRequest).subscribe( - (negotiationId) => { - this.finishedNegotiations.delete(initiateRequest.offer.offerId); - this.runningNegotiations.set(initiateRequest.offer.offerId, { - id: negotiationId, - offerId: initiateRequest.offer.offerId, + (uiContractNegotiation) => { + this.finishedNegotiations.delete(initiateRequest.contractOfferId); + this.runningNegotiations.set(initiateRequest.contractOfferId, { + id: uiContractNegotiation.contractNegotiationId, + offerId: initiateRequest.contractOfferId, }); if (!this.pollingHandleNegotiation) { @@ -111,11 +106,13 @@ export class ContractNegotiationService { this.getNegotiationState(negotiation.id).subscribe( (updatedNegotiation) => { if ( - finishedNegotiationStates.includes(updatedNegotiation.state) + finishedNegotiationStates.includes( + updatedNegotiation.state.name, + ) ) { let offerId = negotiation.offerId; this.runningNegotiations.delete(offerId); - if (updatedNegotiation.state === 'CONFIRMED') { + if (updatedNegotiation.state.name === 'CONFIRMED') { this.finishedNegotiations.set( offerId, updatedNegotiation, @@ -146,15 +143,14 @@ export class ContractNegotiationService { }, ); } + private initiateNegotiation( - initiateDto: NegotiationInitiateRequestDto, - ): Observable { - return this.contractNegotiationService - .initiateContractNegotiation(initiateDto, 'body', false) - .pipe(map((t) => t.id!)); + initiateDto: ContractNegotiationRequest, + ): Observable { + return this.edcApiService.initiateContractNegotiation(initiateDto); } - private getNegotiationState(id: string): Observable { - return this.contractNegotiationService.getNegotiation(id); + private getNegotiationState(id: string): Observable { + return this.edcApiService.getContractNegotiation(id); } } diff --git a/src/app/core/services/api/contract-offer.service.ts b/src/app/core/services/api/contract-offer.service.ts index 2e1dce287..e9e99cf6d 100644 --- a/src/app/core/services/api/contract-offer.service.ts +++ b/src/app/core/services/api/contract-offer.service.ts @@ -2,11 +2,13 @@ import {HttpClient, HttpErrorResponse} from '@angular/common/http'; import {Injectable} from '@angular/core'; import {Observable, merge, of, sampleTime} from 'rxjs'; import {catchError, map} from 'rxjs/operators'; +import {UiContractOffer} from '@sovity.de/edc-client'; import {AssetPropertyMapper} from '../asset-property-mapper'; import {ContractOffer} from '../models/contract-offer'; import {ContractOfferDto} from '../models/contract-offer-dto'; import {ContractOfferResponseDto} from '../models/contract-offer-response-dto'; import {CatalogApiUrlService} from './catalog-api-url.service'; +import {EdcApiService} from './edc-api.service'; /** * Combines several services that are used from the {@link CatalogBrowserComponent} @@ -17,10 +19,33 @@ import {CatalogApiUrlService} from './catalog-api-url.service'; export class ContractOfferService { constructor( private httpClient: HttpClient, + private edcApiService: EdcApiService, private catalogApiUrlService: CatalogApiUrlService, private assetPropertyMapper: AssetPropertyMapper, ) {} + getAllUiContractOffers(): Observable { + const catalogUrls = this.catalogApiUrlService.getAllProviders(); + + const uiDataOffers = catalogUrls.map((it) => + this.edcApiService.getCatalogPageDataOffers(it), + ); + + const uiContractOffers = uiDataOffers.map((it) => + it.pipe( + catchError((err: HttpErrorResponse) => { + console.warn('Failed fetching catalog of', it, err); + return of([] as UiContractOffer[]); + }), + ), + ); + + return merge(...uiContractOffers).pipe( + sampleTime(50), + map((results) => results.flat()), + ); + } + getAllContractOffers(): Observable { const catalogUrls = this.catalogApiUrlService.getAllProviders(); diff --git a/src/app/core/services/api/edc-api.service.ts b/src/app/core/services/api/edc-api.service.ts index 809904320..482d43e4d 100644 --- a/src/app/core/services/api/edc-api.service.ts +++ b/src/app/core/services/api/edc-api.service.ts @@ -7,6 +7,7 @@ import { ContractAgreementTransferRequest, ContractDefinitionPage, ContractDefinitionRequest, + ContractNegotiationRequest, EdcClient, IdResponse, IdResponseDto, @@ -15,6 +16,8 @@ import { TransferHistoryPage, UiAsset, UiAssetCreateRequest, + UiContractNegotiation, + UiDataOffer, buildEdcClient, } from '@sovity.de/edc-client'; import {APP_CONFIG, AppConfig} from '../../config/app-config'; @@ -113,4 +116,30 @@ export class EdcApiService { getEnterpriseEditionConnectorLimits(): Observable { return from(this.edcClient.enterpriseEditionApi.connectorLimits()); } + + getCatalogPageDataOffers( + connectorEndpoint: string, + ): Observable { + return from( + this.edcClient.uiApi.catalogPageDataOffers({connectorEndpoint}), + ); + } + + initiateContractNegotiation( + contractNegotiationRequest: ContractNegotiationRequest, + ): Observable { + return from( + this.edcClient.uiApi.initiateContractNegotiation({ + contractNegotiationRequest, + }), + ); + } + + getContractNegotiation( + contractNegotiationId: string, + ): Observable { + return from( + this.edcClient.uiApi.getContractNegotiation({contractNegotiationId}), + ); + } } diff --git a/src/app/core/services/api/fake-backend/catalog-fake-service.ts b/src/app/core/services/api/fake-backend/catalog-fake-service.ts new file mode 100644 index 000000000..c9c3a2368 --- /dev/null +++ b/src/app/core/services/api/fake-backend/catalog-fake-service.ts @@ -0,0 +1,38 @@ +import {UiDataOffer} from '@sovity.de/edc-client'; +import {TestAssets} from './data/test-assets'; +import {TestPolicies} from './data/test-policies'; + +export let uiDataOffers: UiDataOffer[] = [ + { + endpoint: 'https://sovity-demo2-edc/api/v1/ids/data', + participantId: 'sovity-demo2-edc', + asset: TestAssets.full, + contractOffers: [ + { + contractOfferId: 'test-contract-offer-1', + policy: TestPolicies.connectorRestricted, + }, + { + contractOfferId: 'test-contract-offer-2', + policy: TestPolicies.warnings, + }, + ], + }, + { + endpoint: 'https://sovity-demo4-mds/api/v1/ids/data', + asset: TestAssets.boring, + participantId: 'sovity-demo4-mds', + contractOffers: [ + { + contractOfferId: 'test-contract-offer-3', + policy: TestPolicies.failedMapping, + }, + ], + }, +]; + +export const getCatalogPageDataOffers = ( + connectorEndpoint: string, +): UiDataOffer[] => { + return uiDataOffers.filter((it) => it.endpoint === connectorEndpoint); +}; diff --git a/src/app/core/services/api/fake-backend/contract-negotiation-fake-service.ts b/src/app/core/services/api/fake-backend/contract-negotiation-fake-service.ts new file mode 100644 index 000000000..dd83b1eb7 --- /dev/null +++ b/src/app/core/services/api/fake-backend/contract-negotiation-fake-service.ts @@ -0,0 +1,65 @@ +import { + ContractNegotiationRequest, + ContractNegotiationState, + ContractNegotiationStateSimplifiedStateEnum, + UiContractNegotiation, +} from '@sovity.de/edc-client'; + +export let contractNegotiationStates: ContractNegotiationState[] = [ + { + name: 'INITIATED', + code: 500, + simplifiedState: ContractNegotiationStateSimplifiedStateEnum.InProgress, + }, + { + name: 'AGREED', + code: 1000, + simplifiedState: ContractNegotiationStateSimplifiedStateEnum.Agreed, + }, +]; +export let contractNegotiations: UiContractNegotiation[] = [ + { + contractNegotiationId: 'test-contract-negotiation-1', + createdAt: new Date(), + contractAgreementId: 'test-contract-agreement-1', + state: contractNegotiationStates[0], + }, + { + contractNegotiationId: 'test-contract-negotiation-2', + createdAt: new Date(), + contractAgreementId: 'test-contract-agreement-2', + state: contractNegotiationStates[1], + }, +]; + +export let contractNegotiationRequests: ContractNegotiationRequest[] = [ + { + counterPartyAddress: 'https://sovity-demo2-edc/api/v1/ids/data', + counterPartyParticipantId: 'sovity-demo2-edc', + contractOfferId: 'test-contract-definition-1', + policyJsonLd: '{"example-policy-jsonld": true}', + assetId: 'urn:artifact:test-asset-1', + }, + { + counterPartyAddress: 'https://sovity-demo4-mds/api/v1/ids/data', + counterPartyParticipantId: 'sovity-demo4-mds', + contractOfferId: 'test-contract-definition-2', + policyJsonLd: '{"example-policy-jsonld": true}', + assetId: 'urn:artifact:test-asset-2', + }, +]; + +export const initiateContractNegotiation = ( + request: ContractNegotiationRequest, +): UiContractNegotiation => { + contractNegotiations = [...contractNegotiations]; + + return contractNegotiations[0]; +}; + +export const getContractNegotiation = (id: string): UiContractNegotiation => { + contractNegotiations = contractNegotiations.filter( + (it) => it.contractNegotiationId !== id, + ); + return contractNegotiations[0]; +}; 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 fd2c4d850..9b2e3ce0c 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 { ContractAgreementTransferRequestFromJSON, ContractDefinitionPageToJSON, ContractDefinitionRequestFromJSON, + ContractNegotiationRequestFromJSON, FetchAPI, IdResponseDtoToJSON, PolicyDefinitionCreateRequestFromJSON, @@ -11,8 +12,10 @@ import { TransferHistoryPageToJSON, UiAssetCreateRequestFromJSON, UiAssetToJSON, + UiContractNegotiationToJSON, } from '@sovity.de/edc-client'; import {assetPage, createAsset, deleteAsset} from './asset-fake-service'; +import {getCatalogPageDataOffers} from './catalog-fake-service'; import { contractAgreementInitiateTransfer, contractAgreementPage, @@ -22,6 +25,10 @@ import { createContractDefinition, deleteContractDefinition, } from './contract-definition-fake-service'; +import { + getContractNegotiation, + initiateContractNegotiation, +} from './contract-negotiation-fake-service'; import { createPolicyDefinition, deletePolicyDefinition, @@ -129,5 +136,26 @@ export const EDC_FAKE_BACKEND: FetchAPI = async ( return ok(UiAssetToJSON(asset)); }) + .url('pages/catalog-page/data-offers') + .on('GET', (connectorEndpoint) => { + let dataOffers = getCatalogPageDataOffers(connectorEndpoint); + return ok(dataOffers); + }) + + .url('pages/catalog-page/contract-negotiations') + .on('POST', () => { + let createRequest = ContractNegotiationRequestFromJSON(body); + + let contractNegotiation = initiateContractNegotiation(createRequest); + + return ok(UiContractNegotiationToJSON(contractNegotiation)); + }) + + .url('pages/catalog-page/contract-negotiations') + .on('POST', (contractNegotiationId) => { + let contractNegotiation = getContractNegotiation(contractNegotiationId); + return ok(contractNegotiation); + }) + .tryMatch(); }; diff --git a/src/app/core/services/models/contract-offer-dto.ts b/src/app/core/services/models/contract-offer-dto.ts index e47bf7901..cff433114 100644 --- a/src/app/core/services/models/contract-offer-dto.ts +++ b/src/app/core/services/models/contract-offer-dto.ts @@ -1,12 +1,11 @@ -import {UiAsset} from '@sovity.de/edc-client'; -import {Policy} from '../api/legacy-managent-api-client'; +import {UiAsset, UiPolicy} from '@sovity.de/edc-client'; /** * Contract Offer (API Model) */ export interface ContractOfferDto { id: string; - policy: Policy; + policy: UiPolicy; provider: string; consumer: string; asset: UiAsset; diff --git a/src/app/core/services/models/contract-offer.ts b/src/app/core/services/models/contract-offer.ts index 51b7f31bd..7fe32db22 100644 --- a/src/app/core/services/models/contract-offer.ts +++ b/src/app/core/services/models/contract-offer.ts @@ -1,9 +1,9 @@ +import {UiContractOffer} from '@sovity.de/edc-client'; import {Asset} from './asset'; -import {ContractOfferDto} from './contract-offer-dto'; /** * Contract Offer (UI Dto) */ -export type ContractOffer = Omit & { +export type ContractOffer = Omit & { asset: Asset; }; diff --git a/src/app/routes/connector-ui/catalog-browser-page/catalog-browser-page/catalog-browser-page-service.ts b/src/app/routes/connector-ui/catalog-browser-page/catalog-browser-page/catalog-browser-page-service.ts index 9fbf92abf..1a536ec05 100644 --- a/src/app/routes/connector-ui/catalog-browser-page/catalog-browser-page/catalog-browser-page-service.ts +++ b/src/app/routes/connector-ui/catalog-browser-page/catalog-browser-page/catalog-browser-page-service.ts @@ -1,9 +1,10 @@ import {Injectable} from '@angular/core'; import {Observable, combineLatest} from 'rxjs'; import {map, switchMap} from 'rxjs/operators'; +import {UiContractOffer, UiDataOffer} from '@sovity.de/edc-client'; import {CatalogApiUrlService} from '../../../../core/services/api/catalog-api-url.service'; -import {ContractOfferService} from '../../../../core/services/api/contract-offer.service'; -import {ContractOffer} from '../../../../core/services/models/contract-offer'; +import {EdcApiService} from '../../../../core/services/api/edc-api.service'; +import {AssetPropertyMapper} from '../../../../core/services/asset-property-mapper'; import {Fetched} from '../../../../core/services/models/fetched'; import {MultiFetched} from '../../../../core/services/models/multi-fetched'; import {assetSearchTargets, search} from '../../../../core/utils/search-utils'; @@ -15,7 +16,8 @@ import { @Injectable({providedIn: 'root'}) export class CatalogBrowserPageService { constructor( - private contractOfferService: ContractOfferService, + private edcApiService: EdcApiService, + private assetPropertyMapper: AssetPropertyMapper, private catalogApiUrlService: CatalogApiUrlService, ) {} @@ -30,7 +32,6 @@ export class CatalogBrowserPageService { map(([data, searchText]): CatalogBrowserPageData => { // Merge fetch results const contractOffers = data.requestTotals.data.flat(); - // Apply filter const filteredContractOffers = this.filterContractOffers( contractOffers, @@ -48,12 +49,18 @@ export class CatalogBrowserPageService { } filterContractOffers( - contractOffers: ContractOffer[], + dataOffers: UiDataOffer[], searchText: string, - ): ContractOffer[] { - return search(contractOffers, searchText, (contractOffer) => - assetSearchTargets(contractOffer.asset), + ): UiContractOffer[] { + const dataoffersResult = search(dataOffers, searchText, (dataOffer) => + assetSearchTargets( + this.assetPropertyMapper.buildAsset({ + connectorEndpoint: dataOffer.endpoint, + uiAsset: dataOffer.asset, + }), + ), ); + return dataoffersResult.flatMap((dataOffer) => dataOffer.contractOffers); } fetchCatalogs(): Observable< @@ -62,8 +69,8 @@ export class CatalogBrowserPageService { // Prepare to fetch individual Catalogs const urls = this.catalogApiUrlService.getAllProviders(); const sources = urls.map((it) => - this.contractOfferService - .getContractOffers(it) + this.edcApiService + .getCatalogPageDataOffers(it) .pipe(Fetched.wrap({failureMessage: 'Failed fetching catalog.'})), ); @@ -71,7 +78,7 @@ export class CatalogBrowserPageService { map((results) => MultiFetched.aggregate(results)), map( ( - requestTotals: MultiFetched, + requestTotals: MultiFetched, ): Pick => { const presetUrls = this.catalogApiUrlService.getPresetProviders(); return { diff --git a/src/app/routes/connector-ui/catalog-browser-page/catalog-browser-page/catalog-browser-page.data.ts b/src/app/routes/connector-ui/catalog-browser-page/catalog-browser-page/catalog-browser-page.data.ts index 3df56ec99..631cdf406 100644 --- a/src/app/routes/connector-ui/catalog-browser-page/catalog-browser-page/catalog-browser-page.data.ts +++ b/src/app/routes/connector-ui/catalog-browser-page/catalog-browser-page/catalog-browser-page.data.ts @@ -1,11 +1,11 @@ -import {ContractOffer} from '../../../../core/services/models/contract-offer'; +import {UiContractOffer, UiDataOffer} from '@sovity.de/edc-client'; import {Fetched} from '../../../../core/services/models/fetched'; import {MultiFetched} from '../../../../core/services/models/multi-fetched'; export interface CatalogBrowserPageData { - requestTotals: MultiFetched; + requestTotals: MultiFetched; requests: ContractOfferRequest[]; - filteredContractOffers: ContractOffer[]; + filteredContractOffers: UiContractOffer[]; numTotalContractOffers: number; } @@ -21,5 +21,5 @@ export function emptyCatalogBrowserPageData(): CatalogBrowserPageData { export interface ContractOfferRequest { url: string; isPresetUrl: boolean; - data: Fetched; + data: Fetched; } From d1f1ba388e12dfcacf29c3c94824298c8aa81c0e Mon Sep 17 00:00:00 2001 From: Richard Treier Date: Mon, 25 Sep 2023 14:37:50 +0200 Subject: [PATCH 2/8] reverted some files --- .../asset-detail-dialog-data.service.ts | 7 ++-- .../asset-property-grid-group-builder.ts | 42 ------------------- .../services/models/contract-offer-dto.ts | 5 ++- 3 files changed, 6 insertions(+), 48 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 104c41897..a670c4a52 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 @@ -1,7 +1,6 @@ import {Injectable} from '@angular/core'; -import {UiContractOffer, UiDataOffer} from '@sovity.de/edc-client'; -import {AssetPropertyMapper} from '../../../core/services/asset-property-mapper'; import {Asset} from '../../../core/services/models/asset'; +import {ContractOffer} from '../../../core/services/models/contract-offer'; import {BrokerDataOffer} from '../../../routes/broker-ui/catalog-page/catalog-page/mapping/broker-data-offer'; import {ContractAgreementCardMapped} from '../../../routes/connector-ui/contract-agreement-page/contract-agreement-cards/contract-agreement-card-mapped'; import {AssetDetailDialogData} from './asset-detail-dialog-data'; @@ -10,7 +9,6 @@ import {AssetPropertyGridGroupBuilder} from './asset-property-grid-group-builder @Injectable() export class AssetDetailDialogDataService { constructor( - private assetPropertyMapper: AssetPropertyMapper, private assetPropertyGridGroupBuilder: AssetPropertyGridGroupBuilder, ) {} @@ -28,7 +26,8 @@ export class AssetDetailDialogDataService { }; } - contractOfferDetails(contractOffer: UiContractOffer): AssetDetailDialogData { + contractOfferDetails(contractOffer: ContractOffer): AssetDetailDialogData { + let asset = contractOffer.asset; let contractPolicy = contractOffer.policy; const propertyGridGroups = [ 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 989599166..1f2b82730 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 @@ -1,7 +1,6 @@ import {Injectable} from '@angular/core'; import {MatDialog} from '@angular/material/dialog'; import {CatalogContractOffer} from '@sovity.de/broker-server-client'; -import {UiPolicy} from '@sovity.de/edc-client'; import {ActiveFeatureSet} from '../../../core/config/active-feature-set'; import {Policy} from '../../../core/services/api/legacy-managent-api-client'; import {AssetProperties} from '../../../core/services/asset-properties'; @@ -177,20 +176,6 @@ export class AssetPropertyGridGroupBuilder { this.matDialog.open(JsonDialogComponent, {data}); } - onShowUiPolicyDetailsClick( - title: string, - subtitle: string, - policyDetails: UiPolicy, - ) { - const data: JsonDialogData = { - title, - subtitle, - icon: 'policy', - objectForJson: policyDetails, - }; - this.matDialog.open(JsonDialogComponent, {data}); - } - buildContractOfferGroup( asset: Asset, contractOffer: CatalogContractOffer, @@ -240,20 +225,6 @@ export class AssetPropertyGridGroupBuilder { return {groupLabel, properties}; } - buildUiPolicyGroup( - asset: Asset, - contractPolicy: UiPolicy | null, - groupLabel: string = 'Policies', - ) { - let properties: PropertyGridField[] = []; - if (contractPolicy) { - properties.push( - this.buildUiContractPolicyField(contractPolicy, asset.name), - ); - } - return {groupLabel, properties}; - } - buildContractPolicyField(contractPolicy: Policy, subtitle: string) { return { icon: 'policy', @@ -268,19 +239,6 @@ export class AssetPropertyGridGroupBuilder { }; } - buildUiContractPolicyField(contractPolicy: UiPolicy, subtitle: string) { - return { - icon: 'policy', - label: 'Contract Policy', - text: 'Show Policy Details', - onclick: () => - this.onShowUiPolicyDetailsClick( - 'Contract Policy', - subtitle, - contractPolicy, - ), - }; - } buildContractAgreementGroup(contractAgreement: ContractAgreementCardMapped) { let properties: PropertyGridField[] = [ { diff --git a/src/app/core/services/models/contract-offer-dto.ts b/src/app/core/services/models/contract-offer-dto.ts index cff433114..e47bf7901 100644 --- a/src/app/core/services/models/contract-offer-dto.ts +++ b/src/app/core/services/models/contract-offer-dto.ts @@ -1,11 +1,12 @@ -import {UiAsset, UiPolicy} from '@sovity.de/edc-client'; +import {UiAsset} from '@sovity.de/edc-client'; +import {Policy} from '../api/legacy-managent-api-client'; /** * Contract Offer (API Model) */ export interface ContractOfferDto { id: string; - policy: UiPolicy; + policy: Policy; provider: string; consumer: string; asset: UiAsset; From 83f31c66fa2c3bbe1bf567245237d727e09fe222 Mon Sep 17 00:00:00 2001 From: Richard Treier Date: Tue, 26 Sep 2023 08:59:32 +0200 Subject: [PATCH 3/8] feat: migrate catalog + contract negotiation to API Wrapper (initial, no multiple contract offers per asset) --- .env.local-dev | 6 +- src/app/app.module.ts | 9 - .../asset-detail-dialog-data.service.ts | 21 +- .../asset-detail-dialog-data.ts | 6 +- .../asset-detail-dialog.component.html | 10 +- .../asset-detail-dialog.component.ts | 17 +- .../asset-property-grid-group-builder.ts | 81 +- .../asset-detail-dialog/policy-utils.ts | 7 +- .../contract-offer-cards.component.html | 10 +- .../contract-offer-cards.component.ts | 14 +- .../contract-offer-icon.component.ts | 16 +- .../api/contract-negotiation.service.ts | 156 ---- .../services/api/contract-offer.service.ts | 93 --- .../api/fake-backend/asset-fake-service.ts | 3 + .../api/fake-backend/catalog-fake-service.ts | 8 +- .../contract-agreement-fake-service.ts | 6 + .../contract-definition-fake-service.ts | 4 +- .../contract-negotiation-fake-service.ts | 97 ++- .../api/fake-backend/edc-fake-backend.ts | 32 +- .../policy-definition-fake-service.ts | 3 + .../api/fake-backend/utils/request-utils.ts | 5 + .../{ => api}/last-commit-info.service.ts | 4 +- .../api/legacy-managent-api-client/.gitignore | 4 - .../api/legacy-managent-api-client/api/api.ts | 44 - .../api/applicationObservability.service.ts | 411 --------- .../api/catalog.service.ts | 203 ----- .../api/contractAgreement.service.ts | 342 -------- .../api/contractDefinition.service.ts | 520 ------------ .../api/contractNegotiation.service.ts | 789 ------------------ .../api/dataPlaneControlAPI.service.ts | 293 ------- .../api/dataPlanePublicAPI.service.ts | 486 ----------- .../api/dataplaneSelector.service.ts | 370 -------- .../api/default.service.ts | 207 ----- .../api/hTTPProvisionerWebhook.service.ts | 323 ------- .../api/identityHub.service.ts | 473 ----------- .../api/tokenValidation.service.ts | 201 ----- .../api/transferProcess.service.ts | 702 ---------------- .../configuration.ts | 126 --- .../api/legacy-managent-api-client/encoder.ts | 21 - .../api/legacy-managent-api-client/index.ts | 6 - .../model/action.ts | 20 - .../legacy-managent-api-client/model/asset.ts | 17 - .../model/assetDto.ts | 17 - .../model/assetEntryDto.ts | 20 - .../model/catalog.ts | 19 - .../model/constraint.ts | 17 - .../model/contractAgreementDto.ts | 25 - .../model/contractDefinitionDto.ts | 21 - .../model/contractNegotiationDto.ts | 30 - .../model/contractOffer.ts | 28 - .../model/contractOfferDescription.ts | 20 - .../model/contractOfferRequest.ts | 30 - .../model/criterion.ts | 19 - .../model/dataAddress.ts | 17 - .../model/dataAddressDto.ts | 17 - .../model/dataAddressInformationDto.ts | 17 - .../model/dataFlowRequest.ts | 24 - .../model/dataPlaneInstance.ts | 21 - .../model/dataRequest.ts | 30 - .../model/dataRequestDto.ts | 19 - .../model/deprovisionedResource.ts | 20 - .../legacy-managent-api-client/model/duty.ts | 27 - .../model/failure.ts | 17 - .../model/federatedCatalogCacheQuery.ts | 18 - .../model/healthCheckResult.ts | 20 - .../model/healthStatus.ts | 19 - .../model/models.ts | 39 - .../model/negotiationId.ts | 17 - .../model/negotiationInitiateRequestDto.ts | 21 - .../model/negotiationState.ts | 17 - .../model/permission.ts | 26 - .../model/policy.ts | 36 - .../model/policyDefinition.ts | 20 - .../model/prohibition.ts | 24 - .../model/provisionerWebhookRequest.ts | 23 - .../legacy-managent-api-client/model/rule.ts | 12 - .../model/selectionRequest.ts | 20 - .../model/transferId.ts | 17 - .../model/transferProcessDto.ts | 26 - .../model/transferRequestDto.ts | 28 - .../model/transferState.ts | 17 - .../model/transferType.ts | 18 - .../legacy-managent-api-client/variables.ts | 14 - .../api/{ => model}/criterion-type-ext.ts | 0 .../{models => api/model}/last-commit-info.ts | 0 .../api/{ => model}/policy-type-ext.ts | 0 ...et-property-mapper.ts => asset-builder.ts} | 10 +- ...der.ts => asset-create-request-builder.ts} | 2 +- src/app/core/services/asset-properties.ts | 62 -- ...set-service-mapped.ts => asset.service.ts} | 23 +- ...nector-info-property-grid-group-builder.ts | 2 +- .../services/contract-definition-builder.ts | 4 +- .../services/contract-negotiation.service.ts | 107 +++ .../services/http-params-mapper.service.ts | 8 +- src/app/core/services/models/asset-dto.ts | 8 - .../core/services/models/asset-properties.ts | 5 + src/app/core/services/models/asset.ts | 2 +- .../services/models/contract-offer-dto.ts | 13 - .../models/contract-offer-response-dto.ts | 9 - .../core/services/models/contract-offer.ts | 9 - .../{ => models}/data-address-properties.ts | 0 src/app/core/services/models/data-offer.ts | 9 + ...-params.ts => http-data-address-params.ts} | 2 +- .../models/http-datasink-properties.ts | 31 - .../services/models/negotiation-result.ts | 4 - src/app/core/services/models/storage-type.ts | 4 - .../models/transfer-process-states.ts | 16 - .../services/policy-definition-builder.ts | 2 +- .../core/services/transfer-process-utils.ts | 13 - .../mapping/broker-catalog-mapper.ts | 12 +- .../asset-create-dialog.component.ts | 10 +- .../assets-id-validator-builder.ts | 4 +- .../asset-page/asset-page.component.ts | 4 +- ...g-browser-fetch-detail-dialog.component.ts | 4 +- .../catalog-api-url.service.ts | 2 +- .../catalog-browser-page-service.ts | 50 +- .../catalog-browser-page.component.html | 12 +- .../catalog-browser-page.component.ts | 9 +- .../catalog-browser-page.data.ts | 10 +- .../contract-agreement-card-mapped.service.ts | 12 +- .../contract-agreement-cards.component.html | 2 +- ...ntract-agreement-transfer-dialog-result.ts | 4 +- ...act-agreement-transfer-dialog.component.ts | 4 +- .../contract-definition-card-builder.ts | 8 +- ...ract-definition-editor-dialog.component.ts | 4 +- .../contract-definition-page.service.ts | 4 +- .../dashboard-page-data.service.ts | 57 +- .../policy-cards/policy-card-builder.ts | 2 +- .../transfer-history-page.component.ts | 14 +- 129 files changed, 461 insertions(+), 7165 deletions(-) delete mode 100644 src/app/core/services/api/contract-negotiation.service.ts delete mode 100644 src/app/core/services/api/contract-offer.service.ts rename src/app/core/services/{ => api}/last-commit-info.service.ts (87%) delete mode 100644 src/app/core/services/api/legacy-managent-api-client/.gitignore delete mode 100644 src/app/core/services/api/legacy-managent-api-client/api/api.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/api/applicationObservability.service.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/api/catalog.service.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/api/contractAgreement.service.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/api/contractDefinition.service.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/api/contractNegotiation.service.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/api/dataPlaneControlAPI.service.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/api/dataPlanePublicAPI.service.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/api/dataplaneSelector.service.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/api/default.service.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/api/hTTPProvisionerWebhook.service.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/api/identityHub.service.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/api/tokenValidation.service.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/api/transferProcess.service.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/configuration.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/encoder.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/index.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/model/action.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/model/asset.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/model/assetDto.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/model/assetEntryDto.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/model/catalog.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/model/constraint.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/model/contractAgreementDto.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/model/contractDefinitionDto.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/model/contractNegotiationDto.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/model/contractOffer.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/model/contractOfferDescription.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/model/contractOfferRequest.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/model/criterion.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/model/dataAddress.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/model/dataAddressDto.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/model/dataAddressInformationDto.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/model/dataFlowRequest.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/model/dataPlaneInstance.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/model/dataRequest.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/model/dataRequestDto.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/model/deprovisionedResource.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/model/duty.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/model/failure.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/model/federatedCatalogCacheQuery.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/model/healthCheckResult.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/model/healthStatus.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/model/models.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/model/negotiationId.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/model/negotiationInitiateRequestDto.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/model/negotiationState.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/model/permission.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/model/policy.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/model/policyDefinition.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/model/prohibition.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/model/provisionerWebhookRequest.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/model/rule.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/model/selectionRequest.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/model/transferId.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/model/transferProcessDto.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/model/transferRequestDto.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/model/transferState.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/model/transferType.ts delete mode 100644 src/app/core/services/api/legacy-managent-api-client/variables.ts rename src/app/core/services/api/{ => model}/criterion-type-ext.ts (100%) rename src/app/core/services/{models => api/model}/last-commit-info.ts (100%) rename src/app/core/services/api/{ => model}/policy-type-ext.ts (100%) rename src/app/core/services/{asset-property-mapper.ts => asset-builder.ts} (91%) rename src/app/core/services/{asset-request-builder.ts => asset-create-request-builder.ts} (98%) delete mode 100644 src/app/core/services/asset-properties.ts rename src/app/core/services/{asset-service-mapped.ts => asset.service.ts} (55%) create mode 100644 src/app/core/services/contract-negotiation.service.ts delete mode 100644 src/app/core/services/models/asset-dto.ts create mode 100644 src/app/core/services/models/asset-properties.ts delete mode 100644 src/app/core/services/models/contract-offer-dto.ts delete mode 100644 src/app/core/services/models/contract-offer-response-dto.ts delete mode 100644 src/app/core/services/models/contract-offer.ts rename src/app/core/services/{ => models}/data-address-properties.ts (100%) create mode 100644 src/app/core/services/models/data-offer.ts rename src/app/core/services/models/{http-request-params.ts => http-data-address-params.ts} (94%) delete mode 100644 src/app/core/services/models/http-datasink-properties.ts delete mode 100644 src/app/core/services/models/negotiation-result.ts delete mode 100644 src/app/core/services/models/storage-type.ts delete mode 100644 src/app/core/services/models/transfer-process-states.ts delete mode 100644 src/app/core/services/transfer-process-utils.ts rename src/app/{core/services/api => routes/connector-ui/catalog-browser-page/catalog-browser-page}/catalog-api-url.service.ts (95%) diff --git a/.env.local-dev b/.env.local-dev index 68360b73a..131d53dd2 100644 --- a/.env.local-dev +++ b/.env.local-dev @@ -5,11 +5,11 @@ EDC_UI_ACTIVE_PROFILE=sovity-open-source EDC_UI_USE_FAKE_BACKEND=true EDC_UI_DATA_MANAGEMENT_API_URL=http://edc.fake-backend EDC_UI_DATA_MANAGEMENT_API_KEY=no-api-key-required-in-local-dev -EDC_UI_CATALOG_URLS=http://existing-other-connector/v1/ids/data,http://does-not-exist-but-is-super-long-so-we-can-test/v1/ids/data, http://how-wrapping-works-in-subtext-of-catalog-url-select/v1/ids/data +EDC_UI_CATALOG_URLS=http://existing-other-connector/api/dsp,http://does-not-exist-but-is-super-long-so-we-can-test/api/dsp, http://how-wrapping-works-in-subtext-of-catalog-url-select/api/dsp EDC_UI_LOGOUT_URL=https://example.com/logout -EDC_UI_CONNECTOR_ENDPOINT=http://localhost:3000/v1/ids/data +EDC_UI_CONNECTOR_ENDPOINT=http://localhost:3000/api/dsp -EDC_UI_CONNECTOR_ID=https://example-connector-id/ +EDC_UI_CONNECTOR_ID=https://localhost:3000 EDC_UI_CONNECTOR_NAME=example-connector-name EDC_UI_IDS_ID=urn:connector:example EDC_UI_IDS_TITLE=Example Connector Title diff --git a/src/app/app.module.ts b/src/app/app.module.ts index cd65d149f..c0da7ce11 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -22,12 +22,7 @@ import {AppRoutingModule} from './app-routing.module'; import {AppComponent} from './app.component'; import {PageNotFoundComponent} from './component-library/error-404-component/page-not-found.component'; import {provideAppConfig} from './core/config/app-config-initializer'; -import {provideAppConfigProperty} from './core/config/app-config-injection-utils'; import {ApiKeyInterceptor} from './core/services/api/api-key.interceptor'; -import { - API_KEY, - CONNECTOR_DATAMANAGEMENT_API, -} from './core/services/api/legacy-managent-api-client'; @NgModule({ imports: [ @@ -61,10 +56,6 @@ import { providers: [ provideAppConfig(), - // Provide individual properties of config for better Angular Component APIs - provideAppConfigProperty(CONNECTOR_DATAMANAGEMENT_API, 'managementApiUrl'), - provideAppConfigProperty(API_KEY, 'managementApiKey'), - {provide: HTTP_INTERCEPTORS, multi: true, useClass: ApiKeyInterceptor}, {provide: MAT_DATE_LOCALE, useValue: 'en-GB'}, 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 a670c4a52..2b2d45096 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 @@ -1,6 +1,6 @@ import {Injectable} from '@angular/core'; import {Asset} from '../../../core/services/models/asset'; -import {ContractOffer} from '../../../core/services/models/contract-offer'; +import {DataOffer} from '../../../core/services/models/data-offer'; import {BrokerDataOffer} from '../../../routes/broker-ui/catalog-page/catalog-page/mapping/broker-data-offer'; import {ContractAgreementCardMapped} from '../../../routes/connector-ui/contract-agreement-page/contract-agreement-cards/contract-agreement-card-mapped'; import {AssetDetailDialogData} from './asset-detail-dialog-data'; @@ -26,9 +26,9 @@ export class AssetDetailDialogDataService { }; } - contractOfferDetails(contractOffer: ContractOffer): AssetDetailDialogData { - let asset = contractOffer.asset; - let contractPolicy = contractOffer.policy; + dataOfferDetails(dataOffer: DataOffer): AssetDetailDialogData { + let asset = dataOffer.asset; + let contractPolicy = dataOffer.contractOffers[0].policy; const propertyGridGroups = [ this.assetPropertyGridGroupBuilder.buildAssetPropertiesGroup(asset, null), @@ -40,9 +40,9 @@ export class AssetDetailDialogDataService { ].filter((it) => it.properties.length); return { - type: 'contract-offer', - asset: contractOffer.asset, - contractOffer, + type: 'data-offer', + asset: dataOffer.asset, + dataOffer, propertyGridGroups, }; } @@ -51,9 +51,6 @@ export class AssetDetailDialogDataService { contractAgreement: ContractAgreementCardMapped, ): AssetDetailDialogData { let asset = contractAgreement.asset; - let contractPolicy = JSON.parse( - contractAgreement.contractPolicy.policyJsonLd, - ); const propertyGridGroups = [ this.assetPropertyGridGroupBuilder.buildContractAgreementGroup( @@ -61,7 +58,7 @@ export class AssetDetailDialogDataService { ), this.assetPropertyGridGroupBuilder.buildPolicyGroup( asset, - contractPolicy, + contractAgreement.contractPolicy, ), this.assetPropertyGridGroupBuilder.buildAssetPropertiesGroup( asset, @@ -89,7 +86,7 @@ export class AssetDetailDialogDataService { ), this.assetPropertyGridGroupBuilder.buildAdditionalPropertiesGroup(asset), ...dataOffer.contractOffers.map((contractOffer, i) => - this.assetPropertyGridGroupBuilder.buildContractOfferGroup( + this.assetPropertyGridGroupBuilder.buildBrokerContractOfferGroup( asset, contractOffer, i, 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 c896e769f..2677414e3 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 @@ -1,5 +1,5 @@ import {Asset} from 'src/app/core/services/models/asset'; -import {ContractOffer} from '../../../core/services/models/contract-offer'; +import {DataOffer} from '../../../core/services/models/data-offer'; import {BrokerDataOffer} from '../../../routes/broker-ui/catalog-page/catalog-page/mapping/broker-data-offer'; 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'; @@ -7,12 +7,12 @@ import {PropertyGridGroup} from '../../property-grid/property-grid-group/propert export interface AssetDetailDialogData { type: | 'asset-details' - | 'contract-offer' + | 'data-offer' | 'contract-agreement' | 'broker-data-offer'; propertyGridGroups: PropertyGridGroup[]; asset: Asset; - contractOffer?: ContractOffer; + dataOffer?: DataOffer; contractAgreement?: ContractAgreementCardMapped; brokerDataOffer?: BrokerDataOffer; showDeleteButton?: boolean; 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 af0ebcb10..870ca534f 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 @@ -13,8 +13,8 @@ }} + *ngIf="data.type === 'data-offer'" + [dataOffer]="data.dataOffer!">
{{ asset.name }} @@ -29,8 +29,8 @@
diff --git a/src/app/routes/connector-ui/catalog-browser-page/catalog-browser-page/catalog-browser-page.component.ts b/src/app/routes/connector-ui/catalog-browser-page/catalog-browser-page/catalog-browser-page.component.ts index aff1fe0fd..9cea0a04e 100644 --- a/src/app/routes/connector-ui/catalog-browser-page/catalog-browser-page/catalog-browser-page.component.ts +++ b/src/app/routes/connector-ui/catalog-browser-page/catalog-browser-page/catalog-browser-page.component.ts @@ -11,11 +11,11 @@ import { import {filter, map} from 'rxjs/operators'; import {AssetDetailDialogDataService} from '../../../../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 {CatalogApiUrlService} from '../../../../core/services/api/catalog-api-url.service'; -import {ContractOffer} from '../../../../core/services/models/contract-offer'; +import {DataOffer} from '../../../../core/services/models/data-offer'; import {value$} from '../../../../core/utils/form-group-utils'; import {CatalogBrowserFetchDetailDialogComponent} from '../catalog-browser-fetch-detail-dialog/catalog-browser-fetch-detail-dialog.component'; import {CatalogBrowserFetchDetailDialogData} from '../catalog-browser-fetch-detail-dialog/catalog-browser-fetch-detail-dialog.data'; +import {CatalogApiUrlService} from './catalog-api-url.service'; import {CatalogBrowserPageService} from './catalog-browser-page-service'; import {emptyCatalogBrowserPageData} from './catalog-browser-page.data'; @@ -53,9 +53,8 @@ export class CatalogBrowserPageComponent implements OnInit, OnDestroy { this.presetProvidersMessage = this.buildPresetCatalogUrlsMessage(); } - onContractOfferClick(contractOffer: ContractOffer) { - const data = - this.assetDetailDialogDataService.contractOfferDetails(contractOffer); + onDataOfferClick(dataOffer: DataOffer) { + const data = this.assetDetailDialogDataService.dataOfferDetails(dataOffer); this.assetDetailDialogService .open(data, this.ngOnDestroy$) .pipe(filter((it) => !!it?.refreshList)) diff --git a/src/app/routes/connector-ui/catalog-browser-page/catalog-browser-page/catalog-browser-page.data.ts b/src/app/routes/connector-ui/catalog-browser-page/catalog-browser-page/catalog-browser-page.data.ts index 631cdf406..d5aab9bf6 100644 --- a/src/app/routes/connector-ui/catalog-browser-page/catalog-browser-page/catalog-browser-page.data.ts +++ b/src/app/routes/connector-ui/catalog-browser-page/catalog-browser-page/catalog-browser-page.data.ts @@ -1,11 +1,11 @@ -import {UiContractOffer, UiDataOffer} from '@sovity.de/edc-client'; +import {DataOffer} from '../../../../core/services/models/data-offer'; import {Fetched} from '../../../../core/services/models/fetched'; import {MultiFetched} from '../../../../core/services/models/multi-fetched'; export interface CatalogBrowserPageData { - requestTotals: MultiFetched; + requestTotals: MultiFetched; requests: ContractOfferRequest[]; - filteredContractOffers: UiContractOffer[]; + filteredDataOffers: DataOffer[]; numTotalContractOffers: number; } @@ -13,7 +13,7 @@ export function emptyCatalogBrowserPageData(): CatalogBrowserPageData { return { requests: [], requestTotals: MultiFetched.empty(), - filteredContractOffers: [], + filteredDataOffers: [], numTotalContractOffers: 0, }; } @@ -21,5 +21,5 @@ export function emptyCatalogBrowserPageData(): CatalogBrowserPageData { export interface ContractOfferRequest { url: string; isPresetUrl: boolean; - data: Fetched; + data: Fetched; } 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 13ec5226b..4507efb22 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 @@ -1,12 +1,12 @@ import {Injectable} from '@angular/core'; import {ContractAgreementCard} from '@sovity.de/edc-client'; -import {AssetPropertyMapper} from '../../../../core/services/asset-property-mapper'; +import {AssetBuilder} from '../../../../core/services/asset-builder'; import {assetSearchTargets, search} from '../../../../core/utils/search-utils'; import {ContractAgreementCardMapped} from './contract-agreement-card-mapped'; @Injectable({providedIn: 'root'}) export class ContractAgreementCardMappedService { - constructor(private assetPropertyMapper: AssetPropertyMapper) {} + constructor(private assetBuilder: AssetBuilder) {} /** * Replace the asset with the parsed asset and add the other required fields of the UI model @@ -18,10 +18,10 @@ export class ContractAgreementCardMappedService { buildContractAgreementCardMapped( contractAgreement: ContractAgreementCard, ): ContractAgreementCardMapped { - let asset = this.assetPropertyMapper.buildAsset({ - uiAsset: contractAgreement.asset, - connectorEndpoint: contractAgreement.counterPartyAddress, - }); + let asset = this.assetBuilder.buildAsset( + contractAgreement.asset, + contractAgreement.counterPartyAddress, + ); return { ...contractAgreement, 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 914b382f9..2f99fbfe3 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 @@ -97,7 +97,7 @@ -
+
{{ card.asset.version diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-transfer-dialog/contract-agreement-transfer-dialog-result.ts b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-transfer-dialog/contract-agreement-transfer-dialog-result.ts index 7215c6061..db4068420 100644 --- a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-transfer-dialog/contract-agreement-transfer-dialog-result.ts +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-transfer-dialog/contract-agreement-transfer-dialog-result.ts @@ -1,6 +1,4 @@ -import {TransferId} from '../../../../core/services/api/legacy-managent-api-client'; - export interface ContractAgreementTransferDialogResult { - transferProcessId: TransferId; + transferProcessId: string; contractId: string; } diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-transfer-dialog/contract-agreement-transfer-dialog.component.ts b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-transfer-dialog/contract-agreement-transfer-dialog.component.ts index 5f5e0a530..fa2789504 100644 --- a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-transfer-dialog/contract-agreement-transfer-dialog.component.ts +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-transfer-dialog/contract-agreement-transfer-dialog.component.ts @@ -92,9 +92,9 @@ export class ContractAgreementTransferDialogComponent implements OnDestroy { }), ) .subscribe({ - next: (transferProcessId) => + next: (response) => this.close({ - transferProcessId, + transferProcessId: response.id!, contractId: this.data.contractId, }), error: (err) => { diff --git a/src/app/routes/connector-ui/contract-definition-page/contract-definition-cards/contract-definition-card-builder.ts b/src/app/routes/connector-ui/contract-definition-page/contract-definition-cards/contract-definition-card-builder.ts index 4ea383009..822c57c53 100644 --- a/src/app/routes/connector-ui/contract-definition-page/contract-definition-cards/contract-definition-card-builder.ts +++ b/src/app/routes/connector-ui/contract-definition-page/contract-definition-cards/contract-definition-card-builder.ts @@ -5,9 +5,9 @@ import { PolicyDefinitionDto, UiCriterion, } from '@sovity.de/edc-client'; -import {CRITERION_OPERATOR_SYMBOLS} from '../../../../core/services/api/criterion-type-ext'; -import {AssetProperties} from '../../../../core/services/asset-properties'; +import {CRITERION_OPERATOR_SYMBOLS} from '../../../../core/services/api/model/criterion-type-ext'; import {Asset} from '../../../../core/services/models/asset'; +import {AssetProperty} from '../../../../core/services/models/asset-properties'; import {associateBy} from '../../../../core/utils/map-utils'; import {assetSearchTargets} from '../../../../core/utils/search-utils'; import { @@ -76,7 +76,7 @@ export class ContractDefinitionCardBuilder { private extractCriterionOperation(criterion: UiCriterion): string { const {operandLeft, operator} = criterion; if ( - operandLeft.toLowerCase() === AssetProperties.id.toLowerCase() && + operandLeft === AssetProperty.id && (operator === 'EQ' || operator === 'IN') ) { return 'Assets'; @@ -107,7 +107,7 @@ export class ContractDefinitionCardBuilder { }; // Try to find asset - if (operandLeft === AssetProperties.id) { + if (operandLeft === AssetProperty.id) { let asset = assetsById.get(it); if (asset) { return { diff --git a/src/app/routes/connector-ui/contract-definition-page/contract-definition-editor-dialog/contract-definition-editor-dialog.component.ts b/src/app/routes/connector-ui/contract-definition-page/contract-definition-editor-dialog/contract-definition-editor-dialog.component.ts index a77938604..51d4e730a 100644 --- a/src/app/routes/connector-ui/contract-definition-page/contract-definition-editor-dialog/contract-definition-editor-dialog.component.ts +++ b/src/app/routes/connector-ui/contract-definition-page/contract-definition-editor-dialog/contract-definition-editor-dialog.component.ts @@ -4,7 +4,7 @@ import {Subject} from 'rxjs'; import {finalize, takeUntil} from 'rxjs/operators'; import {PolicyDefinitionDto} from '@sovity.de/edc-client'; import {EdcApiService} from '../../../../core/services/api/edc-api.service'; -import {AssetServiceMapped} from '../../../../core/services/asset-service-mapped'; +import {AssetService} from '../../../../core/services/asset.service'; import {ContractDefinitionBuilder} from '../../../../core/services/contract-definition-builder'; import {Asset} from '../../../../core/services/models/asset'; import {NotificationService} from '../../../../core/services/notification.service'; @@ -23,7 +23,7 @@ export class ContractDefinitionEditorDialog implements OnInit, OnDestroy { loading = false; constructor( - private assetServiceMapped: AssetServiceMapped, + private assetServiceMapped: AssetService, public form: ContractDefinitionEditorDialogForm, private notificationService: NotificationService, private edcApiService: EdcApiService, diff --git a/src/app/routes/connector-ui/contract-definition-page/contract-definition-page/contract-definition-page.service.ts b/src/app/routes/connector-ui/contract-definition-page/contract-definition-page/contract-definition-page.service.ts index 09658b41d..e867c2daf 100644 --- a/src/app/routes/connector-ui/contract-definition-page/contract-definition-page/contract-definition-page.service.ts +++ b/src/app/routes/connector-ui/contract-definition-page/contract-definition-page/contract-definition-page.service.ts @@ -2,7 +2,7 @@ import {Injectable} from '@angular/core'; import {Observable, combineLatest, of} from 'rxjs'; import {catchError, map, switchMap} from 'rxjs/operators'; import {EdcApiService} from '../../../../core/services/api/edc-api.service'; -import {AssetServiceMapped} from '../../../../core/services/asset-service-mapped'; +import {AssetService} from '../../../../core/services/asset.service'; import {Fetched} from '../../../../core/services/models/fetched'; import {search} from '../../../../core/utils/search-utils'; import {ContractDefinitionCard} from '../contract-definition-cards/contract-definition-card'; @@ -17,7 +17,7 @@ export interface ContractDefinitionList { export class ContractDefinitionPageService { constructor( private edcApiService: EdcApiService, - private assetServiceMapped: AssetServiceMapped, + private assetServiceMapped: AssetService, private contractDefinitionCardBuilder: ContractDefinitionCardBuilder, ) {} diff --git a/src/app/routes/connector-ui/dashboard-page/dashboard-page/dashboard-page-data.service.ts b/src/app/routes/connector-ui/dashboard-page/dashboard-page/dashboard-page-data.service.ts index fb82a9f09..77e7366c3 100644 --- a/src/app/routes/connector-ui/dashboard-page/dashboard-page/dashboard-page-data.service.ts +++ b/src/app/routes/connector-ui/dashboard-page/dashboard-page/dashboard-page-data.service.ts @@ -1,17 +1,12 @@ import {Injectable} from '@angular/core'; -import {Observable, combineLatest, merge, of, scan} from 'rxjs'; -import {map} from 'rxjs/operators'; -import {TransferHistoryEntry} from '@sovity.de/edc-client'; -import {CatalogApiUrlService} from '../../../../core/services/api/catalog-api-url.service'; -import {ContractOfferService} from '../../../../core/services/api/contract-offer.service'; +import {Observable, combineLatest, merge, of, sampleTime, scan} from 'rxjs'; +import {catchError, map} from 'rxjs/operators'; +import {TransferHistoryEntry, UiDataOffer} from '@sovity.de/edc-client'; import {EdcApiService} from '../../../../core/services/api/edc-api.service'; -import { - ContractAgreementService, - ContractDefinitionService, -} from '../../../../core/services/api/legacy-managent-api-client'; +import {LastCommitInfoService} from '../../../../core/services/api/last-commit-info.service'; import {ConnectorInfoPropertyGridGroupBuilder} from '../../../../core/services/connector-info-property-grid-group-builder'; -import {LastCommitInfoService} from '../../../../core/services/last-commit-info.service'; import {Fetched} from '../../../../core/services/models/fetched'; +import {CatalogApiUrlService} from '../../catalog-browser-page/catalog-browser-page/catalog-api-url.service'; import {DonutChartData} from '../dashboard-donut-chart/donut-chart-data'; import {DashboardPageData, defaultDashboardData} from './dashboard-page-data'; @@ -19,9 +14,6 @@ import {DashboardPageData, defaultDashboardData} from './dashboard-page-data'; export class DashboardPageDataService { constructor( private edcApiService: EdcApiService, - private catalogBrowserService: ContractOfferService, - private contractDefinitionService: ContractDefinitionService, - private contractAgreementService: ContractAgreementService, private catalogApiUrlService: CatalogApiUrlService, private lastCommitInfoService: LastCommitInfoService, private connectorInfoPropertyGridGroupBuilder: ConnectorInfoPropertyGridGroupBuilder, @@ -61,20 +53,18 @@ export class DashboardPageDataService { } private contractDefinitionKpis(): Observable> { - return this.contractDefinitionService - .getAllContractDefinitions(0, 10_000_000) - .pipe( - map((contractDefinitions) => contractDefinitions.length), - Fetched.wrap({ - failureMessage: 'Failed fetching number of contract definitions.', - }), - map((numContractDefinitions) => ({numContractDefinitions})), - ); + return this.edcApiService.getContractDefinitionPage().pipe( + map((page) => page.contractDefinitions.length), + Fetched.wrap({ + failureMessage: 'Failed fetching number of contract definitions.', + }), + map((numContractDefinitions) => ({numContractDefinitions})), + ); } private contractAgreementKpis(): Observable> { - return this.contractAgreementService.getAllAgreements(0, 10_000_000).pipe( - map((contractAgreements) => contractAgreements.length), + return this.edcApiService.getContractAgreementPage().pipe( + map((page) => page.contractAgreements.length), Fetched.wrap({ failureMessage: 'Failed fetching contract agreements.', }), @@ -83,8 +73,8 @@ export class DashboardPageDataService { } private catalogBrowserKpis(): Observable> { - return this.catalogBrowserService.getAllContractOffers().pipe( - map((contractDefinitions) => contractDefinitions.length), + return this.getAllDataOffers().pipe( + map((dataOffers) => dataOffers.length), Fetched.wrap({ failureMessage: 'Failed fetching data offers.', }), @@ -92,6 +82,21 @@ export class DashboardPageDataService { ); } + private getAllDataOffers(): Observable { + const catalogUrls = this.catalogApiUrlService.getAllProviders(); + + const dataOffers = catalogUrls.map((it) => + this.edcApiService + .getCatalogPageDataOffers(it) + .pipe(catchError(() => of([]))), + ); + + return merge(...dataOffers).pipe( + sampleTime(50), + map((results) => results.flat()), + ); + } + private assetKpis(): Observable> { return this.edcApiService.getAssetPage().pipe( map((assetPage) => assetPage.assets.length), diff --git a/src/app/routes/connector-ui/policy-definition-page/policy-cards/policy-card-builder.ts b/src/app/routes/connector-ui/policy-definition-page/policy-cards/policy-card-builder.ts index aedd62d23..6bbd4f927 100644 --- a/src/app/routes/connector-ui/policy-definition-page/policy-cards/policy-card-builder.ts +++ b/src/app/routes/connector-ui/policy-definition-page/policy-cards/policy-card-builder.ts @@ -4,7 +4,7 @@ import { PolicyDefinitionPage, UiPolicyLiteral, } from '@sovity.de/edc-client'; -import {OPERATOR_SYMBOLS} from '../../../../core/services/api/policy-type-ext'; +import {OPERATOR_SYMBOLS} from '../../../../core/services/api/model/policy-type-ext'; import {PolicyCard, PolicyCardConstraint} from './policy-card'; @Injectable({providedIn: 'root'}) diff --git a/src/app/routes/connector-ui/transfer-history-page/transfer-history-page/transfer-history-page.component.ts b/src/app/routes/connector-ui/transfer-history-page/transfer-history-page/transfer-history-page.component.ts index b696a95dc..3492d9b30 100644 --- a/src/app/routes/connector-ui/transfer-history-page/transfer-history-page/transfer-history-page.component.ts +++ b/src/app/routes/connector-ui/transfer-history-page/transfer-history-page/transfer-history-page.component.ts @@ -18,7 +18,7 @@ import {AssetDetailDialogDataService} from '../../../../component-library/catalo import {AssetDetailDialogService} from '../../../../component-library/catalog/asset-detail-dialog/asset-detail-dialog.service'; import {JsonDialogService} from '../../../../component-library/json-dialog/json-dialog/json-dialog.service'; import {EdcApiService} from '../../../../core/services/api/edc-api.service'; -import {AssetPropertyMapper} from '../../../../core/services/asset-property-mapper'; +import {AssetBuilder} from '../../../../core/services/asset-builder'; import {Asset} from '../../../../core/services/models/asset'; import {Fetched} from '../../../../core/services/models/fetched'; import {NotificationService} from '../../../../core/services/notification.service'; @@ -45,7 +45,7 @@ export class TransferHistoryPageComponent implements OnInit, OnDestroy { private edcApiService: EdcApiService, private assetDetailDialogDataService: AssetDetailDialogDataService, private assetDetailDialogService: AssetDetailDialogService, - private assetPropertyMapper: AssetPropertyMapper, + private assetBuilder: AssetBuilder, private notificationService: NotificationService, private jsonDialogService: JsonDialogService, ) {} @@ -66,11 +66,11 @@ export class TransferHistoryPageComponent implements OnInit, OnDestroy { return this.edcApiService .getTransferProcessAsset(item.transferProcessId) .pipe( - map((uiAsset: UiAsset) => { - return this.assetPropertyMapper.buildAsset({ - uiAsset, - connectorEndpoint: item.counterPartyConnectorEndpoint, - }); + map((asset: UiAsset) => { + return this.assetBuilder.buildAsset( + asset, + item.counterPartyConnectorEndpoint, + ); }), ); } From 56e65475b4a29c96b78d9c6b6c1b7b79280f4441 Mon Sep 17 00:00:00 2001 From: Richard Treier Date: Tue, 26 Sep 2023 12:58:17 +0200 Subject: [PATCH 4/8] minor code quality improvements --- .../asset-property-grid-group-builder.ts | 3 +-- .../core/services/api/fake-backend/asset-fake-service.ts | 2 +- .../core/services/api/fake-backend/catalog-fake-service.ts | 4 ++-- .../api/fake-backend/contract-agreement-fake-service.ts | 2 +- .../api/fake-backend/contract-definition-fake-service.ts | 2 +- .../api/fake-backend/contract-negotiation-fake-service.ts | 2 +- .../api/fake-backend/policy-definition-fake-service.ts | 2 +- .../api/fake-backend/transfer-history-fake-service.ts | 6 +++--- 8 files changed, 11 insertions(+), 12 deletions(-) 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 5a4933d1f..5011f4c30 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 @@ -163,8 +163,7 @@ export class AssetPropertyGridGroupBuilder { title: `${groupLabel} Contract Policy)`, subtitle: asset.name, icon: 'policy', - objectForJson: getLegacyPolicy(contractOffer.contractPolicy) - .policyJsonLd, + objectForJson: getLegacyPolicy(contractOffer.contractPolicy), }), }, { diff --git a/src/app/core/services/api/fake-backend/asset-fake-service.ts b/src/app/core/services/api/fake-backend/asset-fake-service.ts index 5dfdbd3d1..aecf3f826 100644 --- a/src/app/core/services/api/fake-backend/asset-fake-service.ts +++ b/src/app/core/services/api/fake-backend/asset-fake-service.ts @@ -6,7 +6,7 @@ import { } from '@sovity.de/edc-client'; import {TestAssets} from './data/test-assets'; -export let assets: UiAsset[] = [TestAssets.full, TestAssets.boring]; +let assets: UiAsset[] = [TestAssets.full, TestAssets.boring]; export const assetPage = (): AssetPage => { return { diff --git a/src/app/core/services/api/fake-backend/catalog-fake-service.ts b/src/app/core/services/api/fake-backend/catalog-fake-service.ts index 9d51203a1..73d71589b 100644 --- a/src/app/core/services/api/fake-backend/catalog-fake-service.ts +++ b/src/app/core/services/api/fake-backend/catalog-fake-service.ts @@ -2,7 +2,7 @@ import {UiDataOffer} from '@sovity.de/edc-client'; import {TestAssets} from './data/test-assets'; import {TestPolicies} from './data/test-policies'; -export let uiDataOffers: UiDataOffer[] = [ +let dataOffers: UiDataOffer[] = [ { endpoint: 'http://existing-other-connector/api/dsp', participantId: 'existing-other-connector', @@ -34,5 +34,5 @@ export let uiDataOffers: UiDataOffer[] = [ export const getCatalogPageDataOffers = ( connectorEndpoint: string, ): UiDataOffer[] => { - return uiDataOffers.filter((it) => it.endpoint === connectorEndpoint); + return dataOffers.filter((it) => it.endpoint === connectorEndpoint); }; diff --git a/src/app/core/services/api/fake-backend/contract-agreement-fake-service.ts b/src/app/core/services/api/fake-backend/contract-agreement-fake-service.ts index 0b75af483..b81ea8bfa 100644 --- a/src/app/core/services/api/fake-backend/contract-agreement-fake-service.ts +++ b/src/app/core/services/api/fake-backend/contract-agreement-fake-service.ts @@ -9,7 +9,7 @@ import {Patcher, patchObj} from '../../../utils/object-utils'; import {TestAssets} from './data/test-assets'; import {TestPolicies} from './data/test-policies'; -export let contractAgreements: ContractAgreementCard[] = [ +let contractAgreements: ContractAgreementCard[] = [ { contractAgreementId: 'my-own-asset-cd:f52a5d30-6356-4a55-a75a-3c45d7a88c3e', contractNegotiationId: diff --git a/src/app/core/services/api/fake-backend/contract-definition-fake-service.ts b/src/app/core/services/api/fake-backend/contract-definition-fake-service.ts index d2ec36bd6..2ce83f9ea 100644 --- a/src/app/core/services/api/fake-backend/contract-definition-fake-service.ts +++ b/src/app/core/services/api/fake-backend/contract-definition-fake-service.ts @@ -6,7 +6,7 @@ import { } from '@sovity.de/edc-client'; import {AssetProperty} from '../../models/asset-properties'; -export let contractDefinitions: ContractDefinitionEntry[] = [ +let contractDefinitions: ContractDefinitionEntry[] = [ { contractDefinitionId: 'test-contract-definition-1', contractPolicyId: 'test-policy-definition-1', diff --git a/src/app/core/services/api/fake-backend/contract-negotiation-fake-service.ts b/src/app/core/services/api/fake-backend/contract-negotiation-fake-service.ts index 4a8fc0e05..cc600aaa6 100644 --- a/src/app/core/services/api/fake-backend/contract-negotiation-fake-service.ts +++ b/src/app/core/services/api/fake-backend/contract-negotiation-fake-service.ts @@ -21,7 +21,7 @@ const agreed: ContractNegotiationState = { simplifiedState: ContractNegotiationStateSimplifiedStateEnum.Agreed, }; -export let negotiations: UiContractNegotiation[] = [ +let negotiations: UiContractNegotiation[] = [ { contractNegotiationId: 'test-contract-negotiation-1', createdAt: new Date(), diff --git a/src/app/core/services/api/fake-backend/policy-definition-fake-service.ts b/src/app/core/services/api/fake-backend/policy-definition-fake-service.ts index 1e76985c0..d109b6252 100644 --- a/src/app/core/services/api/fake-backend/policy-definition-fake-service.ts +++ b/src/app/core/services/api/fake-backend/policy-definition-fake-service.ts @@ -6,7 +6,7 @@ import { } from '@sovity.de/edc-client'; import {TestPolicies} from './data/test-policies'; -export let policyDefinitions: PolicyDefinitionDto[] = [ +let policyDefinitions: PolicyDefinitionDto[] = [ { policyDefinitionId: 'test-policy-definition-1', policy: TestPolicies.connectorRestricted, diff --git a/src/app/core/services/api/fake-backend/transfer-history-fake-service.ts b/src/app/core/services/api/fake-backend/transfer-history-fake-service.ts index f972331e9..18dbcbd60 100644 --- a/src/app/core/services/api/fake-backend/transfer-history-fake-service.ts +++ b/src/app/core/services/api/fake-backend/transfer-history-fake-service.ts @@ -3,10 +3,10 @@ import { TransferHistoryPage, UiAsset, } from '@sovity.de/edc-client'; -import {assets} from './asset-fake-service'; +import {getAssetById} from './asset-fake-service'; import {TestAssets} from './data/test-assets'; -export let transferHistoryEntries: TransferHistoryEntry[] = [ +let transferHistoryEntries: TransferHistoryEntry[] = [ { transferProcessId: '339b2a27-3b66-49f5-8b43-6a400d5914b5', createdDate: new Date('2023-03-20T11:18:59.659Z'), @@ -88,7 +88,7 @@ export const transferProcessAsset = (transferProcessId: string): UiAsset => { TestAssets.dummyAsset(assetId), ); - const assetEntry = assets.find((it) => it.assetId === assetId); + const assetEntry = getAssetById(assetId); return isProviding && assetEntry ? TestAssets.toAssetDto(assetEntry) From 6eef7fdc0d5e97aecf5cd985053676ebab4e0679 Mon Sep 17 00:00:00 2001 From: Richard Treier Date: Tue, 26 Sep 2023 13:03:15 +0200 Subject: [PATCH 5/8] rename contract-offer-cards to data-offer-cards, fix contract-agreement-cards --- package-lock.json | 14 +++++++------- package.json | 2 +- .../asset-property-grid-group-builder.ts | 16 ---------------- .../component-library/catalog/catalog.module.ts | 6 +++--- .../data-offer-cards.component.html} | 0 .../data-offer-cards.component.ts} | 6 +++--- .../contract-agreement-fake-service.ts | 8 -------- .../contract-negotiation-fake-service.ts | 2 -- .../api/fake-backend/edc-fake-backend.ts | 2 +- .../broker-data-offer-cards.component.html} | 0 .../broker-data-offer-cards.component.ts} | 6 +++--- .../catalog-page/catalog-page.module.ts | 4 ++-- .../catalog-page/catalog-page.component.html | 4 ++-- .../catalog-browser-page.component.html | 4 ++-- .../contract-agreement-cards.component.html | 12 ------------ 15 files changed, 24 insertions(+), 62 deletions(-) rename src/app/component-library/catalog/{contract-offer-cards/contract-offer-cards.component.html => data-offer-cards/data-offer-cards.component.html} (100%) rename src/app/component-library/catalog/{contract-offer-cards/contract-offer-cards.component.ts => data-offer-cards/data-offer-cards.component.ts} (84%) rename src/app/routes/broker-ui/catalog-page/{data-offer-cards/data-offer-cards.component.html => broker-data-offer-cards/broker-data-offer-cards.component.html} (100%) rename src/app/routes/broker-ui/catalog-page/{data-offer-cards/data-offer-cards.component.ts => broker-data-offer-cards/broker-data-offer-cards.component.ts} (74%) diff --git a/package-lock.json b/package-lock.json index b24ec3946..fe10f78a1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,7 +23,7 @@ "@ng-apimock/core": "^3.11.0", "@ngxs/store": "^3.8.1", "@sovity.de/broker-server-client": "0.20230712.71619-main-a4860cff", - "@sovity.de/edc-client": "0.20230921.115850-main-5e87f14f", + "@sovity.de/edc-client": "0.20230926.105529-main-44861eac", "clean-deep": "^3.4.0", "date-fns": "^2.30.0", "dotenv": "^16.3.1", @@ -59,9 +59,9 @@ } }, "node_modules/@adobe/css-tools": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/@adobe/css-tools/-/css-tools-4.2.0.tgz", - "integrity": "sha512-E09FiIft46CmH5Qnjb0wsW54/YQd69LsxeKUOWawmws1XWvyFGURnAChH0mlr7YPFR1ofwvUQfcL0J3lMxXqPA==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/@adobe/css-tools/-/css-tools-4.3.1.tgz", + "integrity": "sha512-/62yikz7NLScCGAAST5SHdnjaDJQBDq0M2muyRTpf2VQhw6StBg2ALiu73zSJQ4fMVLA+0uBhBHAle7Wg+2kSg==", "dev": true }, "node_modules/@alloc/quick-lru": { @@ -3607,9 +3607,9 @@ "integrity": "sha512-305vHJj38Ma9x9YADM3SJh3sdqePeLcrUB1hHlYsuPdx7wYe9vwgb503KYStJ+5iN/ojP2xu8k6Unt+y+Bu5iQ==" }, "node_modules/@sovity.de/edc-client": { - "version": "0.20230921.115850-main-5e87f14f", - "resolved": "https://registry.npmjs.org/@sovity.de/edc-client/-/edc-client-0.20230921.115850-main-5e87f14f.tgz", - "integrity": "sha512-G875A/e88tKgsqcZCq6NS4bHb8FLMcxjjpixJ7qnnG9BNety3cG76IM+Iesii8Ino4+T/J2+9MG9lGquV+Au2g==" + "version": "0.20230926.105529-main-44861eac", + "resolved": "https://registry.npmjs.org/@sovity.de/edc-client/-/edc-client-0.20230926.105529-main-44861eac.tgz", + "integrity": "sha512-mhvZvwcN7ZNLKgg9ApbDVmGhyA5BAAYmpUeEmG//uTGU9abfmepRxHozv59anN3SpixhnU2MDCQJSlADmEfZsQ==" }, "node_modules/@tootallnate/once": { "version": "2.0.0", diff --git a/package.json b/package.json index 78d738497..c3edb3894 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "@ng-apimock/core": "^3.11.0", "@ngxs/store": "^3.8.1", "@sovity.de/broker-server-client": "0.20230712.71619-main-a4860cff", - "@sovity.de/edc-client": "0.20230921.115850-main-5e87f14f", + "@sovity.de/edc-client": "0.20230926.105529-main-44861eac", "clean-deep": "^3.4.0", "date-fns": "^2.30.0", "dotenv": "^16.3.1", 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 5011f4c30..46e6b4b0c 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 @@ -207,22 +207,6 @@ export class AssetPropertyGridGroupBuilder { ), ), }, - { - icon: 'category', - label: 'Valid From', - ...this.propertyGridUtils.guessValue( - this.propertyGridUtils.formatDate( - contractAgreement.contractStartDate, - ), - ), - }, - { - icon: 'category', - label: 'Valid To', - ...this.propertyGridUtils.guessValue( - this.propertyGridUtils.formatDate(contractAgreement.contractEndDate), - ), - }, { icon: 'policy', label: 'Direction', diff --git a/src/app/component-library/catalog/catalog.module.ts b/src/app/component-library/catalog/catalog.module.ts index 0a94bc9a5..aaf951c47 100644 --- a/src/app/component-library/catalog/catalog.module.ts +++ b/src/app/component-library/catalog/catalog.module.ts @@ -15,7 +15,7 @@ import {AssetDetailDialogDataService} from './asset-detail-dialog/asset-detail-d import {AssetDetailDialogComponent} from './asset-detail-dialog/asset-detail-dialog.component'; import {AssetDetailDialogService} from './asset-detail-dialog/asset-detail-dialog.service'; import {AssetPropertyGridGroupBuilder} from './asset-detail-dialog/asset-property-grid-group-builder'; -import {ContractOfferCardsComponent} from './contract-offer-cards/contract-offer-cards.component'; +import {DataOfferCardsComponent} from './data-offer-cards/data-offer-cards.component'; import {ContractOfferIconComponent} from './contract-offer-icon/contract-offer-icon.component'; import {IconWithOnlineStatusComponent} from './icon-with-online-status/icon-with-online-status.component'; import {TransferHistoryMiniListComponent} from './transfer-history-mini-list/transfer-history-mini-list.component'; @@ -42,15 +42,15 @@ import {TransferHistoryMiniListComponent} from './transfer-history-mini-list/tra ], declarations: [ AssetDetailDialogComponent, - ContractOfferCardsComponent, ContractOfferIconComponent, + DataOfferCardsComponent, TransferHistoryMiniListComponent, IconWithOnlineStatusComponent, ], exports: [ AssetDetailDialogComponent, - ContractOfferCardsComponent, ContractOfferIconComponent, + DataOfferCardsComponent, TransferHistoryMiniListComponent, IconWithOnlineStatusComponent, ], diff --git a/src/app/component-library/catalog/contract-offer-cards/contract-offer-cards.component.html b/src/app/component-library/catalog/data-offer-cards/data-offer-cards.component.html similarity index 100% rename from src/app/component-library/catalog/contract-offer-cards/contract-offer-cards.component.html rename to src/app/component-library/catalog/data-offer-cards/data-offer-cards.component.html diff --git a/src/app/component-library/catalog/contract-offer-cards/contract-offer-cards.component.ts b/src/app/component-library/catalog/data-offer-cards/data-offer-cards.component.ts similarity index 84% rename from src/app/component-library/catalog/contract-offer-cards/contract-offer-cards.component.ts rename to src/app/component-library/catalog/data-offer-cards/data-offer-cards.component.ts index e45b4fe72..2c87c6c87 100644 --- a/src/app/component-library/catalog/contract-offer-cards/contract-offer-cards.component.ts +++ b/src/app/component-library/catalog/data-offer-cards/data-offer-cards.component.ts @@ -9,10 +9,10 @@ import {ContractNegotiationService} from '../../../core/services/contract-negoti import {DataOffer} from '../../../core/services/models/data-offer'; @Component({ - selector: 'contract-offer-cards', - templateUrl: './contract-offer-cards.component.html', + selector: 'data-offer-cards', + templateUrl: './data-offer-cards.component.html', }) -export class ContractOfferCardsComponent { +export class DataOfferCardsComponent { @HostBinding('class.flex') @HostBinding('class.flex-wrap') @HostBinding('class.gap-[10px]') diff --git a/src/app/core/services/api/fake-backend/contract-agreement-fake-service.ts b/src/app/core/services/api/fake-backend/contract-agreement-fake-service.ts index b81ea8bfa..042910e6f 100644 --- a/src/app/core/services/api/fake-backend/contract-agreement-fake-service.ts +++ b/src/app/core/services/api/fake-backend/contract-agreement-fake-service.ts @@ -18,8 +18,6 @@ let contractAgreements: ContractAgreementCard[] = [ counterPartyAddress: 'http://edc2:11003/api/v1/ids/data', counterPartyId: 'urn:connector:example-connector', contractSigningDate: new Date('2022-03-20T11:18:59.659Z'), - contractStartDate: new Date('2022-03-20T11:18:59.659Z'), - contractEndDate: new Date('2022-04-20T20:04:35.658Z'), asset: TestAssets.toAssetDto(TestAssets.full), contractPolicy: TestPolicies.connectorRestricted, transferProcesses: [ @@ -71,8 +69,6 @@ let contractAgreements: ContractAgreementCard[] = [ counterPartyAddress: 'http://edc2:11003/api/v1/ids/data', counterPartyId: 'my-connector', contractSigningDate: new Date('2022-03-25T11:18:59.659Z'), - contractStartDate: new Date('2022-03-25T11:18:59.659Z'), - contractEndDate: new Date('2022-05-01T20:04:35.658Z'), asset: TestAssets.toAssetDto(TestAssets.toDummyAsset(TestAssets.boring)), contractPolicy: TestPolicies.connectorRestricted, transferProcesses: [ @@ -96,8 +92,6 @@ let contractAgreements: ContractAgreementCard[] = [ counterPartyAddress: 'http://edc2:11003/api/v1/ids/data', counterPartyId: 'my-connector', contractSigningDate: new Date('2022-03-25T11:18:59.659Z'), - contractStartDate: new Date('2022-03-25T11:18:59.659Z'), - contractEndDate: new Date('2022-05-01T20:04:35.658Z'), asset: TestAssets.toAssetDto(TestAssets.toDummyAsset(TestAssets.boring)), contractPolicy: TestPolicies.connectorRestricted, transferProcesses: [], @@ -110,8 +104,6 @@ let contractAgreements: ContractAgreementCard[] = [ counterPartyAddress: 'http://edc2:11003/api/v1/ids/data', counterPartyId: 'my-connector', contractSigningDate: new Date('2022-03-25T11:18:59.659Z'), - contractStartDate: new Date('2022-03-25T11:18:59.659Z'), - contractEndDate: new Date('2022-05-01T20:04:35.658Z'), asset: TestAssets.toAssetDto(TestAssets.toDummyAsset(TestAssets.boring)), contractPolicy: TestPolicies.connectorRestricted, transferProcesses: [ diff --git a/src/app/core/services/api/fake-backend/contract-negotiation-fake-service.ts b/src/app/core/services/api/fake-backend/contract-negotiation-fake-service.ts index cc600aaa6..9e66e2c7d 100644 --- a/src/app/core/services/api/fake-backend/contract-negotiation-fake-service.ts +++ b/src/app/core/services/api/fake-backend/contract-negotiation-fake-service.ts @@ -66,8 +66,6 @@ export const initiateContractNegotiation = ( counterPartyId: request.counterPartyParticipantId, asset: getAssetById(request.assetId)!, contractSigningDate: new Date(), - contractStartDate: new Date(), - contractEndDate: new Date(), contractPolicy: getPolicyDefinitionByJsonLd(request.policyJsonLd)!, }); }, 4000); 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 334af657b..61a685529 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 @@ -166,7 +166,7 @@ export const EDC_FAKE_BACKEND: FetchAPI = async ( }) .url('pages/catalog-page/contract-negotiations/*') - .on('POST', (contractNegotiationId) => { + .on('GET', (contractNegotiationId) => { let contractNegotiation = getContractNegotiation(contractNegotiationId); return ok(UiContractNegotiationToJSON(contractNegotiation)); }) diff --git a/src/app/routes/broker-ui/catalog-page/data-offer-cards/data-offer-cards.component.html b/src/app/routes/broker-ui/catalog-page/broker-data-offer-cards/broker-data-offer-cards.component.html similarity index 100% rename from src/app/routes/broker-ui/catalog-page/data-offer-cards/data-offer-cards.component.html rename to src/app/routes/broker-ui/catalog-page/broker-data-offer-cards/broker-data-offer-cards.component.html diff --git a/src/app/routes/broker-ui/catalog-page/data-offer-cards/data-offer-cards.component.ts b/src/app/routes/broker-ui/catalog-page/broker-data-offer-cards/broker-data-offer-cards.component.ts similarity index 74% rename from src/app/routes/broker-ui/catalog-page/data-offer-cards/data-offer-cards.component.ts rename to src/app/routes/broker-ui/catalog-page/broker-data-offer-cards/broker-data-offer-cards.component.ts index ad482a646..8077afbef 100644 --- a/src/app/routes/broker-ui/catalog-page/data-offer-cards/data-offer-cards.component.ts +++ b/src/app/routes/broker-ui/catalog-page/broker-data-offer-cards/broker-data-offer-cards.component.ts @@ -8,10 +8,10 @@ import { import {BrokerDataOffer} from '../catalog-page/mapping/broker-data-offer'; @Component({ - selector: 'data-offer-cards', - templateUrl: './data-offer-cards.component.html', + selector: 'broker-data-offer-cards', + templateUrl: './broker-data-offer-cards.component.html', }) -export class DataOfferCardsComponent { +export class BrokerDataOfferCardsComponent { @HostBinding('class.flex') @HostBinding('class.flex-wrap') @HostBinding('class.gap-[10px]') diff --git a/src/app/routes/broker-ui/catalog-page/catalog-page.module.ts b/src/app/routes/broker-ui/catalog-page/catalog-page.module.ts index 8ab94d9b4..58b2798ed 100644 --- a/src/app/routes/broker-ui/catalog-page/catalog-page.module.ts +++ b/src/app/routes/broker-ui/catalog-page/catalog-page.module.ts @@ -32,7 +32,7 @@ import {CatalogModule} from '../../../component-library/catalog/catalog.module'; import {PipesAndDirectivesModule} from '../../../component-library/pipes-and-directives/pipes-and-directives.module'; import {UiElementsModule} from '../../../component-library/ui-elements/ui-elements.module'; import {CatalogPageComponent} from './catalog-page/catalog-page.component'; -import {DataOfferCardsComponent} from './data-offer-cards/data-offer-cards.component'; +import {BrokerDataOfferCardsComponent} from './broker-data-offer-cards/broker-data-offer-cards.component'; import {FilterValueSelectComponent} from './filter-value-select/filter-value-select.component'; import {CatalogPageState} from './state/catalog-page-state'; @@ -83,7 +83,7 @@ import {CatalogPageState} from './state/catalog-page-state'; ], declarations: [ CatalogPageComponent, - DataOfferCardsComponent, + BrokerDataOfferCardsComponent, FilterValueSelectComponent, ], exports: [CatalogPageComponent], diff --git a/src/app/routes/broker-ui/catalog-page/catalog-page/catalog-page.component.html b/src/app/routes/broker-ui/catalog-page/catalog-page/catalog-page.component.html index 72fdcbb07..c1f48803c 100644 --- a/src/app/routes/broker-ui/catalog-page/catalog-page/catalog-page.component.html +++ b/src/app/routes/broker-ui/catalog-page/catalog-page/catalog-page.component.html @@ -79,9 +79,9 @@ state.fetchedData.isReady && state.fetchedData.data.dataOffers.length " class="flex flex-row flex-wrap"> - + (dataOfferClick)="onDataOfferClick($event)">
diff --git a/src/app/routes/connector-ui/catalog-browser-page/catalog-browser-page/catalog-browser-page.component.html b/src/app/routes/connector-ui/catalog-browser-page/catalog-browser-page/catalog-browser-page.component.html index 8844d5bfa..f6c805bb4 100644 --- a/src/app/routes/connector-ui/catalog-browser-page/catalog-browser-page/catalog-browser-page.component.html +++ b/src/app/routes/connector-ui/catalog-browser-page/catalog-browser-page/catalog-browser-page.component.html @@ -107,8 +107,8 @@
- + (dataOfferClick)="onDataOfferClick($event)">
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 2f99fbfe3..1a1666313 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 @@ -37,18 +37,6 @@ - -
-
- Validity -
-
- - - - -
-
-
From 7ea648f34b61a762a7130758c8e69be5cfdd72ff Mon Sep 17 00:00:00 2001 From: Richard Treier Date: Tue, 26 Sep 2023 13:57:02 +0200 Subject: [PATCH 6/8] minor code quality improvements --- src/app/app-routing.module.ts | 21 ++++++++----------- src/app/app.component.ts | 1 - .../asset-detail-dialog.component.html | 6 ++++-- .../asset-property-grid-group-builder.ts | 4 ++-- .../catalog/catalog.module.ts | 2 +- .../contract-offer-icon.component.ts | 4 ++-- .../icon-with-online-status.component.ts | 4 ++-- .../json-dialog/json-dialog.component.html | 2 +- .../ui-elements/ago/date-input.ts | 2 +- .../api/fake-backend/edc-fake-backend.ts | 14 ++++++------- .../{ => impl}/asset-fake-service.ts | 0 .../{ => impl}/catalog-fake-service.ts | 0 .../contract-agreement-fake-service.ts | 10 ++++----- .../contract-definition-fake-service.ts | 2 +- .../contract-negotiation-fake-service.ts | 2 +- .../{ => impl}/data/test-assets.ts | 11 +--------- .../{ => impl}/data/test-policies.ts | 0 .../policy-definition-fake-service.ts | 0 .../transfer-history-fake-service.ts | 6 ++---- .../api/fake-backend/utils/response-utils.ts | 6 ++++-- src/app/core/services/asset-builder.ts | 6 ++++-- src/app/core/services/models/asset.ts | 11 ++-------- .../catalog-page/catalog-page.module.ts | 2 +- ...browser-fetch-detail-dialog.component.html | 2 +- .../connector-ui/connector-ui.component.ts | 1 - .../contract-agreement-cards.component.html | 2 +- src/theme.scss | 14 ++++++++----- 27 files changed, 61 insertions(+), 74 deletions(-) rename src/app/core/services/api/fake-backend/{ => impl}/asset-fake-service.ts (100%) rename src/app/core/services/api/fake-backend/{ => impl}/catalog-fake-service.ts (100%) rename src/app/core/services/api/fake-backend/{ => impl}/contract-agreement-fake-service.ts (93%) rename src/app/core/services/api/fake-backend/{ => impl}/contract-definition-fake-service.ts (95%) rename src/app/core/services/api/fake-backend/{ => impl}/contract-negotiation-fake-service.ts (97%) rename src/app/core/services/api/fake-backend/{ => impl}/data/test-assets.ts (88%) rename src/app/core/services/api/fake-backend/{ => impl}/data/test-policies.ts (100%) rename src/app/core/services/api/fake-backend/{ => impl}/policy-definition-fake-service.ts (100%) rename src/app/core/services/api/fake-backend/{ => impl}/transfer-history-fake-service.ts (96%) diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index bd24b9e0f..452cff27c 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -1,12 +1,7 @@ import {NgModule} from '@angular/core'; -import { - ROUTES, - RouterModule, - Routes, -} from '@angular/router'; +import {ROUTES, RouterModule, Routes} from '@angular/router'; +import {PageNotFoundComponent} from './component-library/error-404-component/page-not-found.component'; import {APP_CONFIG, AppConfig} from './core/config/app-config'; -import {PageNotFoundComponent} from "./component-library/error-404-component/page-not-found.component"; - @NgModule({ imports: [RouterModule.forRoot([], {paramsInheritanceStrategy: 'always'})], @@ -22,24 +17,26 @@ import {PageNotFoundComponent} from "./component-library/error-404-component/pag switch (config.routes) { case 'broker-ui': routes.push({ - path: '', loadChildren: () => + path: '', + loadChildren: () => import('./routes/broker-ui/broker-ui.module').then( (m) => m.BrokerUiModule, - ) + ), }); break; case 'connector-ui': routes.push({ - path: '', loadChildren: () => + path: '', + loadChildren: () => import('./routes/connector-ui/connector-ui.module').then( (m) => m.ConnectorUiModule, - ) + ), }); break; default: throw new Error(`Unhandled PageSet: ${config.routes}`); } - routes.push({path: '**', component: PageNotFoundComponent}) + routes.push({path: '**', component: PageNotFoundComponent}); return routes; }, }, diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 0729036c4..97215ff6c 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -7,7 +7,6 @@ import {FaviconService} from './core/services/favicon.service'; templateUrl: './app.component.html', }) export class AppComponent implements OnInit { - constructor( @Inject(APP_CONFIG) private config: AppConfig, private faviconService: FaviconService, 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 870ca534f..3cacbe1ee 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 @@ -1,5 +1,5 @@
- + upload - + {{ data.contractAgreement!!.direction === 'PROVIDING' ? 'upload' : '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 46e6b4b0c..595649b7c 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 @@ -90,7 +90,7 @@ export class AssetPropertyGridGroupBuilder { } fields.push( - ...asset.additionalProperties.map((prop) => { + ...asset.mergedAdditionalProperties.map((prop) => { return { icon: 'category ', label: prop.key, @@ -221,7 +221,7 @@ export class AssetPropertyGridGroupBuilder { }, { icon: 'link', - label: 'Other Connector ID', + label: 'Other Connector Participant ID', ...this.propertyGridUtils.guessValue(contractAgreement.counterPartyId), }, { diff --git a/src/app/component-library/catalog/catalog.module.ts b/src/app/component-library/catalog/catalog.module.ts index aaf951c47..5fb5e39b3 100644 --- a/src/app/component-library/catalog/catalog.module.ts +++ b/src/app/component-library/catalog/catalog.module.ts @@ -15,8 +15,8 @@ import {AssetDetailDialogDataService} from './asset-detail-dialog/asset-detail-d import {AssetDetailDialogComponent} from './asset-detail-dialog/asset-detail-dialog.component'; import {AssetDetailDialogService} from './asset-detail-dialog/asset-detail-dialog.service'; import {AssetPropertyGridGroupBuilder} from './asset-detail-dialog/asset-property-grid-group-builder'; -import {DataOfferCardsComponent} from './data-offer-cards/data-offer-cards.component'; import {ContractOfferIconComponent} from './contract-offer-icon/contract-offer-icon.component'; +import {DataOfferCardsComponent} from './data-offer-cards/data-offer-cards.component'; import {IconWithOnlineStatusComponent} from './icon-with-online-status/icon-with-online-status.component'; import {TransferHistoryMiniListComponent} from './transfer-history-mini-list/transfer-history-mini-list.component'; diff --git a/src/app/component-library/catalog/contract-offer-icon/contract-offer-icon.component.ts b/src/app/component-library/catalog/contract-offer-icon/contract-offer-icon.component.ts index b402122cc..96b79484f 100644 --- a/src/app/component-library/catalog/contract-offer-icon/contract-offer-icon.component.ts +++ b/src/app/component-library/catalog/contract-offer-icon/contract-offer-icon.component.ts @@ -8,7 +8,7 @@ import {DataOffer} from '../../../core/services/models/data-offer';
sim_card + sim_card `, }) export class ContractOfferIconComponent { diff --git a/src/app/component-library/catalog/icon-with-online-status/icon-with-online-status.component.ts b/src/app/component-library/catalog/icon-with-online-status/icon-with-online-status.component.ts index 83941eb5c..462f65980 100644 --- a/src/app/component-library/catalog/icon-with-online-status/icon-with-online-status.component.ts +++ b/src/app/component-library/catalog/icon-with-online-status/icon-with-online-status.component.ts @@ -15,11 +15,11 @@ import { >{{ onlineStatusIcon }} - {{ mainIcon }} + {{ mainIcon }} `, }) export class IconWithOnlineStatusComponent { - @HostBinding('class.mat-icon-[40px]') + @HostBinding('class.mat-card-avatar-icon') cls = true; @Input() diff --git a/src/app/component-library/json-dialog/json-dialog/json-dialog.component.html b/src/app/component-library/json-dialog/json-dialog/json-dialog.component.html index ed3ed3ba6..fdb52eb62 100644 --- a/src/app/component-library/json-dialog/json-dialog/json-dialog.component.html +++ b/src/app/component-library/json-dialog/json-dialog/json-dialog.component.html @@ -1,5 +1,5 @@
- + {{ data.icon }}
diff --git a/src/app/component-library/ui-elements/ago/date-input.ts b/src/app/component-library/ui-elements/ago/date-input.ts index 83c854788..2f6676956 100644 --- a/src/app/component-library/ui-elements/ago/date-input.ts +++ b/src/app/component-library/ui-elements/ago/date-input.ts @@ -1 +1 @@ -export type DateInput = Date | string +export type DateInput = Date | string; 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 61a685529..f639ca863 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 @@ -15,30 +15,30 @@ import { UiContractNegotiationToJSON, UiDataOfferToJSON, } from '@sovity.de/edc-client'; -import {assetPage, createAsset, deleteAsset} from './asset-fake-service'; -import {getCatalogPageDataOffers} from './catalog-fake-service'; +import {assetPage, createAsset, deleteAsset} from './impl/asset-fake-service'; +import {getCatalogPageDataOffers} from './impl/catalog-fake-service'; import { contractAgreementInitiateTransfer, contractAgreementPage, -} from './contract-agreement-fake-service'; +} from './impl/contract-agreement-fake-service'; import { contractDefinitionPage, createContractDefinition, deleteContractDefinition, -} from './contract-definition-fake-service'; +} from './impl/contract-definition-fake-service'; import { getContractNegotiation, initiateContractNegotiation, -} from './contract-negotiation-fake-service'; +} from './impl/contract-negotiation-fake-service'; import { createPolicyDefinition, deletePolicyDefinition, policyDefinitionPage, -} from './policy-definition-fake-service'; +} from './impl/policy-definition-fake-service'; import { transferHistoryPage, transferProcessAsset, -} from './transfer-history-fake-service'; +} from './impl/transfer-history-fake-service'; import { getBody, getMethod, diff --git a/src/app/core/services/api/fake-backend/asset-fake-service.ts b/src/app/core/services/api/fake-backend/impl/asset-fake-service.ts similarity index 100% rename from src/app/core/services/api/fake-backend/asset-fake-service.ts rename to src/app/core/services/api/fake-backend/impl/asset-fake-service.ts diff --git a/src/app/core/services/api/fake-backend/catalog-fake-service.ts b/src/app/core/services/api/fake-backend/impl/catalog-fake-service.ts similarity index 100% rename from src/app/core/services/api/fake-backend/catalog-fake-service.ts rename to src/app/core/services/api/fake-backend/impl/catalog-fake-service.ts diff --git a/src/app/core/services/api/fake-backend/contract-agreement-fake-service.ts b/src/app/core/services/api/fake-backend/impl/contract-agreement-fake-service.ts similarity index 93% rename from src/app/core/services/api/fake-backend/contract-agreement-fake-service.ts rename to src/app/core/services/api/fake-backend/impl/contract-agreement-fake-service.ts index 042910e6f..92b97d9e0 100644 --- a/src/app/core/services/api/fake-backend/contract-agreement-fake-service.ts +++ b/src/app/core/services/api/fake-backend/impl/contract-agreement-fake-service.ts @@ -5,7 +5,7 @@ import { ContractAgreementTransferRequest, IdResponseDto, } from '@sovity.de/edc-client'; -import {Patcher, patchObj} from '../../../utils/object-utils'; +import {Patcher, patchObj} from '../../../../utils/object-utils'; import {TestAssets} from './data/test-assets'; import {TestPolicies} from './data/test-policies'; @@ -18,7 +18,7 @@ let contractAgreements: ContractAgreementCard[] = [ counterPartyAddress: 'http://edc2:11003/api/v1/ids/data', counterPartyId: 'urn:connector:example-connector', contractSigningDate: new Date('2022-03-20T11:18:59.659Z'), - asset: TestAssets.toAssetDto(TestAssets.full), + asset: TestAssets.full, contractPolicy: TestPolicies.connectorRestricted, transferProcesses: [ { @@ -69,7 +69,7 @@ let contractAgreements: ContractAgreementCard[] = [ counterPartyAddress: 'http://edc2:11003/api/v1/ids/data', counterPartyId: 'my-connector', contractSigningDate: new Date('2022-03-25T11:18:59.659Z'), - asset: TestAssets.toAssetDto(TestAssets.toDummyAsset(TestAssets.boring)), + asset: TestAssets.toDummyAsset(TestAssets.boring), contractPolicy: TestPolicies.connectorRestricted, transferProcesses: [ { @@ -92,7 +92,7 @@ let contractAgreements: ContractAgreementCard[] = [ counterPartyAddress: 'http://edc2:11003/api/v1/ids/data', counterPartyId: 'my-connector', contractSigningDate: new Date('2022-03-25T11:18:59.659Z'), - asset: TestAssets.toAssetDto(TestAssets.toDummyAsset(TestAssets.boring)), + asset: TestAssets.toDummyAsset(TestAssets.boring), contractPolicy: TestPolicies.connectorRestricted, transferProcesses: [], }, @@ -104,7 +104,7 @@ let contractAgreements: ContractAgreementCard[] = [ counterPartyAddress: 'http://edc2:11003/api/v1/ids/data', counterPartyId: 'my-connector', contractSigningDate: new Date('2022-03-25T11:18:59.659Z'), - asset: TestAssets.toAssetDto(TestAssets.toDummyAsset(TestAssets.boring)), + asset: TestAssets.toDummyAsset(TestAssets.boring), contractPolicy: TestPolicies.connectorRestricted, transferProcesses: [ { diff --git a/src/app/core/services/api/fake-backend/contract-definition-fake-service.ts b/src/app/core/services/api/fake-backend/impl/contract-definition-fake-service.ts similarity index 95% rename from src/app/core/services/api/fake-backend/contract-definition-fake-service.ts rename to src/app/core/services/api/fake-backend/impl/contract-definition-fake-service.ts index 2ce83f9ea..2d6b8567c 100644 --- a/src/app/core/services/api/fake-backend/contract-definition-fake-service.ts +++ b/src/app/core/services/api/fake-backend/impl/contract-definition-fake-service.ts @@ -4,7 +4,7 @@ import { ContractDefinitionRequest, IdResponseDto, } from '@sovity.de/edc-client'; -import {AssetProperty} from '../../models/asset-properties'; +import {AssetProperty} from '../../../models/asset-properties'; let contractDefinitions: ContractDefinitionEntry[] = [ { diff --git a/src/app/core/services/api/fake-backend/contract-negotiation-fake-service.ts b/src/app/core/services/api/fake-backend/impl/contract-negotiation-fake-service.ts similarity index 97% rename from src/app/core/services/api/fake-backend/contract-negotiation-fake-service.ts rename to src/app/core/services/api/fake-backend/impl/contract-negotiation-fake-service.ts index 9e66e2c7d..91540fa41 100644 --- a/src/app/core/services/api/fake-backend/contract-negotiation-fake-service.ts +++ b/src/app/core/services/api/fake-backend/impl/contract-negotiation-fake-service.ts @@ -4,7 +4,7 @@ import { ContractNegotiationStateSimplifiedStateEnum, UiContractNegotiation, } from '@sovity.de/edc-client'; -import {Patcher, patchObj} from '../../../utils/object-utils'; +import {Patcher, patchObj} from '../../../../utils/object-utils'; import {getAssetById} from './asset-fake-service'; import {addContractAgreement} from './contract-agreement-fake-service'; import {getPolicyDefinitionByJsonLd} from './policy-definition-fake-service'; diff --git a/src/app/core/services/api/fake-backend/data/test-assets.ts b/src/app/core/services/api/fake-backend/impl/data/test-assets.ts similarity index 88% rename from src/app/core/services/api/fake-backend/data/test-assets.ts rename to src/app/core/services/api/fake-backend/impl/data/test-assets.ts index e0f243934..cc11f9770 100644 --- a/src/app/core/services/api/fake-backend/data/test-assets.ts +++ b/src/app/core/services/api/fake-backend/impl/data/test-assets.ts @@ -39,14 +39,6 @@ export namespace TestAssets { privateProperties: {}, }; - export function toAssetDto(entry: UiAsset): UiAsset { - return { - assetId: entry.assetId, - name: entry.name, - additionalProperties: {}, - }; - } - export function toDummyAsset(entry: UiAsset): UiAsset { return dummyAsset(entry.assetId); } @@ -54,8 +46,7 @@ export namespace TestAssets { export function dummyAsset(assetId: string): UiAsset { return { assetId, - name: 'Dummy Asset', - privateProperties: {}, + name: assetId, }; } } diff --git a/src/app/core/services/api/fake-backend/data/test-policies.ts b/src/app/core/services/api/fake-backend/impl/data/test-policies.ts similarity index 100% rename from src/app/core/services/api/fake-backend/data/test-policies.ts rename to src/app/core/services/api/fake-backend/impl/data/test-policies.ts diff --git a/src/app/core/services/api/fake-backend/policy-definition-fake-service.ts b/src/app/core/services/api/fake-backend/impl/policy-definition-fake-service.ts similarity index 100% rename from src/app/core/services/api/fake-backend/policy-definition-fake-service.ts rename to src/app/core/services/api/fake-backend/impl/policy-definition-fake-service.ts diff --git a/src/app/core/services/api/fake-backend/transfer-history-fake-service.ts b/src/app/core/services/api/fake-backend/impl/transfer-history-fake-service.ts similarity index 96% rename from src/app/core/services/api/fake-backend/transfer-history-fake-service.ts rename to src/app/core/services/api/fake-backend/impl/transfer-history-fake-service.ts index 18dbcbd60..8dff21494 100644 --- a/src/app/core/services/api/fake-backend/transfer-history-fake-service.ts +++ b/src/app/core/services/api/fake-backend/impl/transfer-history-fake-service.ts @@ -84,13 +84,11 @@ export const transferProcessAsset = (transferProcessId: string): UiAsset => { const assetId = transfer?.assetId ?? 'unknown'; const isProviding = transfer?.direction === 'PROVIDING'; - const dummyAsset: UiAsset = TestAssets.toAssetDto( - TestAssets.dummyAsset(assetId), - ); + const dummyAsset: UiAsset = TestAssets.dummyAsset(assetId); const assetEntry = getAssetById(assetId); return isProviding && assetEntry - ? TestAssets.toAssetDto(assetEntry) + ? TestAssets.toDummyAsset(assetEntry) : dummyAsset; }; diff --git a/src/app/core/services/api/fake-backend/utils/response-utils.ts b/src/app/core/services/api/fake-backend/utils/response-utils.ts index 0ddc3235f..7d8b6a8b7 100644 --- a/src/app/core/services/api/fake-backend/utils/response-utils.ts +++ b/src/app/core/services/api/fake-backend/utils/response-utils.ts @@ -1,5 +1,7 @@ -export const ok = (body: any): Promise => - new Promise((resolve) => { +export function ok(body: any): Promise { + console.log('Fake Backend returns: ', body); + return new Promise((resolve) => { const response = new Response(JSON.stringify(body), {status: 200}); setTimeout(() => resolve(response), 400); }); +} diff --git a/src/app/core/services/asset-builder.ts b/src/app/core/services/asset-builder.ts index 67fc23e51..11626dd28 100644 --- a/src/app/core/services/asset-builder.ts +++ b/src/app/core/services/asset-builder.ts @@ -52,12 +52,14 @@ export class AssetBuilder { return { ...assetProperties, - additionalProperties: this.buildAdditionalProperties(asset), + connectorEndpoint: connectorEndpoint, + creatorOrganizationName: + asset.creatorOrganizationName || 'Unknown Organization', language: languageSelectItem, dataCategory: dataCategorySelectItem, dataSubcategory: dataSubcategorySelectItem, transportMode: transportModeSelectItem, - connectorEndpoint: connectorEndpoint, + mergedAdditionalProperties: this.buildAdditionalProperties(asset), }; } diff --git a/src/app/core/services/models/asset.ts b/src/app/core/services/models/asset.ts index 46072f093..0eaee8fb2 100644 --- a/src/app/core/services/models/asset.ts +++ b/src/app/core/services/models/asset.ts @@ -11,14 +11,7 @@ import {TransportModeSelectItem} from '../../../routes/connector-ui/asset-page/t */ export type Asset = Omit< UiAsset, - | 'language' - | 'dataCategory' - | 'dataSubcategory' - | 'transportMode' - | 'additionalProperties' - | 'additionalJsonProperties' - | 'privateProperties' - | 'privateJsonProperties' + 'language' | 'dataCategory' | 'dataSubcategory' | 'transportMode' > & { connectorEndpoint: string; @@ -30,7 +23,7 @@ export type Asset = Omit< transportMode: TransportModeSelectItem | null; // Unhandled Additional Properties - additionalProperties: AdditionalAssetProperty[]; + mergedAdditionalProperties: AdditionalAssetProperty[]; }; export interface AdditionalAssetProperty { diff --git a/src/app/routes/broker-ui/catalog-page/catalog-page.module.ts b/src/app/routes/broker-ui/catalog-page/catalog-page.module.ts index 58b2798ed..e5fa7ed63 100644 --- a/src/app/routes/broker-ui/catalog-page/catalog-page.module.ts +++ b/src/app/routes/broker-ui/catalog-page/catalog-page.module.ts @@ -31,8 +31,8 @@ import {NgxsModule} from '@ngxs/store'; import {CatalogModule} from '../../../component-library/catalog/catalog.module'; import {PipesAndDirectivesModule} from '../../../component-library/pipes-and-directives/pipes-and-directives.module'; import {UiElementsModule} from '../../../component-library/ui-elements/ui-elements.module'; -import {CatalogPageComponent} from './catalog-page/catalog-page.component'; import {BrokerDataOfferCardsComponent} from './broker-data-offer-cards/broker-data-offer-cards.component'; +import {CatalogPageComponent} from './catalog-page/catalog-page.component'; import {FilterValueSelectComponent} from './filter-value-select/filter-value-select.component'; import {CatalogPageState} from './state/catalog-page-state'; diff --git a/src/app/routes/connector-ui/catalog-browser-page/catalog-browser-fetch-detail-dialog/catalog-browser-fetch-detail-dialog.component.html b/src/app/routes/connector-ui/catalog-browser-page/catalog-browser-fetch-detail-dialog/catalog-browser-fetch-detail-dialog.component.html index 7d242b05d..39a4602b0 100644 --- a/src/app/routes/connector-ui/catalog-browser-page/catalog-browser-fetch-detail-dialog/catalog-browser-fetch-detail-dialog.component.html +++ b/src/app/routes/connector-ui/catalog-browser-page/catalog-browser-fetch-detail-dialog/catalog-browser-fetch-detail-dialog.component.html @@ -1,5 +1,5 @@
- view_timeline + view_timeline
Fetch Status
Other Connector Endpoint Catalogs
diff --git a/src/app/routes/connector-ui/connector-ui.component.ts b/src/app/routes/connector-ui/connector-ui.component.ts index bbb6e22d4..7bcc2ac5c 100644 --- a/src/app/routes/connector-ui/connector-ui.component.ts +++ b/src/app/routes/connector-ui/connector-ui.component.ts @@ -15,7 +15,6 @@ import {routes} from './connector-ui-routing.module'; providers: [TitleUtilsService], }) export class ConnectorUiComponent implements OnInit { - isHandset$: Observable = this.breakpointObserver .observe(Breakpoints.Handset) .pipe( 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 1a1666313..ffe86fa2e 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 @@ -18,7 +18,7 @@ - {{ card.asset.originatorOrganization }} + {{ card.asset.creatorOrganizationName }} diff --git a/src/theme.scss b/src/theme.scss index c15940f0a..94b642835 100644 --- a/src/theme.scss +++ b/src/theme.scss @@ -35,11 +35,15 @@ mat-paginator { } // Fix Icon sizes used in card avatars -mat-icon[mat-card-avatar] { - font-size: 40px; - width: 40px; - height: 40px; - line-height: 40px; +mat-icon[mat-card-avatar], +.mat-card-avatar-icon { + font-size: 40px !important; + width: 40px !important; + height: 40px !important; + line-height: 40px !important; + margin-top: 1px; + margin-right: -3px; + margin-left: 2px; } // Fix mat-chips exploding out and/or having multiline exploding strings From 7c85dd95e7e915778f1e9c1ddc8c4d3ea3b81cd1 Mon Sep 17 00:00:00 2001 From: Richard Treier Date: Tue, 26 Sep 2023 14:08:35 +0200 Subject: [PATCH 7/8] remove docker-compose.yaml in favor of edc-extensions getting started guide --- README.md | 17 +------ docs/getting-started/docker-compose.yaml | 59 ------------------------ 2 files changed, 2 insertions(+), 74 deletions(-) delete mode 100644 docs/getting-started/docker-compose.yaml diff --git a/README.md b/README.md index d3fb5a1f5..faea5d4cc 100644 --- a/README.md +++ b/README.md @@ -86,21 +86,8 @@ for a list of extensions used. ## Getting Started -The fastest way to get started is to run our -[docker-compose.yaml](docs/getting-started/docker-compose.yaml). - -```shell -cd docs/getting-started - -# Pull latest images -docker compose pull - -# On ARM64, e.g. MAC with M1, you need to cross compile your own UI image -# (cd ../../ && docker buildx build -f "docker/Dockerfile" --platform linux/arm64 -t "ghcr.io/sovity/edc-ui:latest" .) - -# Runs EDC and EDC UI at localhost:11000 -docker compose up -``` +The fastest way to get started is using our Getting Started Guide in +[sovity EDC CE Getting Started Guide](https://github.com/sovity/edc-extensions#getting-started).

(back to top)

diff --git a/docs/getting-started/docker-compose.yaml b/docs/getting-started/docker-compose.yaml deleted file mode 100644 index 34305a563..000000000 --- a/docs/getting-started/docker-compose.yaml +++ /dev/null @@ -1,59 +0,0 @@ -version: '3.8' -services: - edc-ui: - image: ghcr.io/sovity/edc-ui:latest - ports: - - '11000:80' - environment: - - EDC_UI_ACTIVE_PROFILE=sovity-open-source - - EDC_UI_CONFIG_URL=edc-ui-config - - EDC_UI_DATA_MANAGEMENT_API_URL=http://localhost:11002/api/v1/management - - EDC_UI_DATA_MANAGEMENT_API_KEY=ApiKeyDefaultValue - - EDC_UI_CATALOG_URLS=http://edc:11003/api/v1/ids/data - edc: - image: ghcr.io/sovity/edc-dev:latest - depends_on: - - postgresql - environment: - MY_EDC_NAME_KEBAB_CASE: 'example-connector' - MY_EDC_TITLE: 'EDC Connector' - MY_EDC_DESCRIPTION: 'sovity Community Edition EDC Connector' - MY_EDC_CURATOR_URL: 'https://example.com' - MY_EDC_CURATOR_NAME: 'Example GmbH' - MY_EDC_MAINTAINER_URL: 'https://sovity.de' - MY_EDC_MAINTAINER_NAME: 'sovity GmbH' - - # Data Management API Key - EDC_API_AUTH_KEY: ApiKeyDefaultValue - - MY_EDC_FQDN: 'edc' - MY_EDC_PROTOCOL: 'http://' - MY_EDC_IDS_BASE_URL: 'http://edc:11003' # adds missing port - - MY_EDC_JDBC_URL: jdbc:postgresql://postgresql:5432/edc - MY_EDC_JDBC_USER: edc - MY_EDC_JDBC_PASSWORD: edc - EDC_WEB_REST_CORS_ENABLED: 'true' - EDC_WEB_REST_CORS_HEADERS: 'origin,content-type,accept,authorization,x-api-key' - EDC_WEB_REST_CORS_ORIGINS: '*' - ports: - - '11001:11001' - - '11002:11002' - - '11003:11003' - - '11004:11004' - - '11005:5005' - postgresql: - image: docker.io/bitnami/postgresql:11 - restart: always - environment: - POSTGRESQL_USERNAME: edc - POSTGRESQL_PASSWORD: edc - POSTGRESQL_DATABASE: edc - ports: - - '54321:5432' - volumes: - - 'postgresql:/bitnami/postgresql' - -volumes: - postgresql: - driver: local From a1fc078dc5f113edec681e5c185957506b62c42b Mon Sep 17 00:00:00 2001 From: Richard Treier Date: Tue, 26 Sep 2023 14:39:55 +0200 Subject: [PATCH 8/8] =?UTF-8?q?chore:=20minor=20code=20quality=20improveme?= =?UTF-8?q?nts=C3=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../asset-detail-dialog.component.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 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 4240eaa01..0ef070ff2 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 @@ -41,16 +41,15 @@ export class AssetDetailDialogComponent implements OnDestroy { get negotiationState(): 'ready' | 'negotiating' | 'negotiated' { const dataOffer = this.data.dataOffer!; - if ( - this.contractNegotiationService.isNegotiated(dataOffer.contractOffers[0]) - ) { + let contractOffer = dataOffer.contractOffers[0]; + let isNegotiated = + this.contractNegotiationService.isNegotiated(contractOffer); + if (isNegotiated) { return 'negotiated'; - } else if ( - this.contractNegotiationService.isBusy(dataOffer.contractOffers[0]) - ) { - return 'negotiating'; } - return 'ready'; + + let isBusy = this.contractNegotiationService.isBusy(contractOffer); + return isBusy ? 'negotiating' : 'ready'; } constructor(