From 4ce4ee5850ecdb0182b3d5c2779919d71d5187ab Mon Sep 17 00:00:00 2001 From: Richard Treier Date: Fri, 25 Oct 2024 17:10:01 +0200 Subject: [PATCH] feat: Eclipse EDC 0.7.2 migration (WIP) --- .env.local-dev | 2 +- package-lock.json | 14 +- package.json | 2 +- src/app/core/services/api/edc-api.service.ts | 6 +- .../catalog-fake-service.ts | 8 +- .../contract-negotiation-fake-service.ts | 2 +- .../dashboard-fake-service.ts | 10 +- .../services/connector-endpoint-url-mapper.ts | 31 ++++ ...nector-info-property-grid-group-builder.ts | 30 ++- .../services/contract-negotiation.service.ts | 2 +- .../services/transfer-data-sink-mapper.ts | 40 ---- .../catalog-browser-page-service.ts | 11 +- .../catalog-browser-page.component.html | 2 +- ...ct-agreement-transfer-dialog-form-model.ts | 12 -- ...contract-agreement-transfer-dialog-form.ts | 30 --- ...t-agreement-transfer-dialog.component.html | 175 ------------------ ...act-agreement-transfer-dialog.component.ts | 58 +----- .../dashboard-page-data.service.ts | 26 ++- .../dashboard-page/dashboard-page-data.ts | 4 +- .../dashboard-page.component.html | 8 +- .../data-address-type-select-items.ts | 33 ++-- src/assets/i18n/de.json | 2 +- src/assets/i18n/en.json | 6 +- 23 files changed, 141 insertions(+), 373 deletions(-) create mode 100644 src/app/core/services/connector-endpoint-url-mapper.ts diff --git a/.env.local-dev b/.env.local-dev index ccb1d67d5..ff7a4aac7 100644 --- a/.env.local-dev +++ b/.env.local-dev @@ -5,7 +5,7 @@ EDC_UI_ACTIVE_PROFILE=sovity-open-source EDC_UI_USE_FAKE_BACKEND=true EDC_UI_MANAGEMENT_API_URL=http://edc.fake-backend EDC_UI_MANAGEMENT_API_KEY=no-api-key-required-in-local-dev -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_CATALOG_URLS="https://existing-other-connector/api/dsp?participantId=MDSL1234XX.C1234XX, https://does-not-exist-but-is-super-long-so-we-can-test/api/dsp?participantId=MDSL1234XX.C1235XX, https://how-wrapping-works-in-subtext-of-catalog-url-select/api/dsp?participantId=MDSL1234XX.C1237XX" EDC_UI_LOGOUT_URL=https://example.com/logout EDC_UI_CONNECTOR_ENDPOINT=http://localhost:3000/api/dsp EDC_UI_MANAGEMENT_API_URL_SHOWN_IN_DASHBOARD=http://localhost:3000/api/control/management diff --git a/package-lock.json b/package-lock.json index 4c553d9c6..3a36243d7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,7 +24,7 @@ "@ngx-translate/core": "^14.0.0", "@ngx-translate/http-loader": "^7.0.0", "@ngxs/store": "^3.8.1", - "@sovity.de/edc-client": "10.4.0", + "@sovity.de/edc-client": "0.0.1-20241025-2408-alpha1", "clean-deep": "^3.4.0", "date-fns": "^2.30.0", "date-fns-tz": "^2.0.1", @@ -3601,9 +3601,9 @@ "dev": true }, "node_modules/@sovity.de/edc-client": { - "version": "10.4.0", - "resolved": "https://registry.npmjs.org/@sovity.de/edc-client/-/edc-client-10.4.0.tgz", - "integrity": "sha512-CBC7bHdIWD1K5plc+tgdJOb5YT82YyyaZ1xMKCy5Ox77KgQEOKG5W/95VzzZkap91xV5zNO5j7I5KJXj18jz8g==", + "version": "0.0.1-20241025-2408-alpha1", + "resolved": "https://registry.npmjs.org/@sovity.de/edc-client/-/edc-client-0.0.1-20241025-2408-alpha1.tgz", + "integrity": "sha512-piQyzb1U2m+xWZoRvE0OVwrdCHXKyRBsu0/T/OtojXQ5TRUy0tQUrq0drFD5cSZBb1mhuaVew7gTPlarl2w1sw==", "dependencies": { "zod": "^3.22.4" } @@ -16683,9 +16683,9 @@ "dev": true }, "@sovity.de/edc-client": { - "version": "10.4.0", - "resolved": "https://registry.npmjs.org/@sovity.de/edc-client/-/edc-client-10.4.0.tgz", - "integrity": "sha512-CBC7bHdIWD1K5plc+tgdJOb5YT82YyyaZ1xMKCy5Ox77KgQEOKG5W/95VzzZkap91xV5zNO5j7I5KJXj18jz8g==", + "version": "0.0.1-20241025-2408-alpha1", + "resolved": "https://registry.npmjs.org/@sovity.de/edc-client/-/edc-client-0.0.1-20241025-2408-alpha1.tgz", + "integrity": "sha512-piQyzb1U2m+xWZoRvE0OVwrdCHXKyRBsu0/T/OtojXQ5TRUy0tQUrq0drFD5cSZBb1mhuaVew7gTPlarl2w1sw==", "requires": { "zod": "^3.22.4" } diff --git a/package.json b/package.json index cc540581f..73b9fd4d4 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "@ngx-translate/core": "^14.0.0", "@ngx-translate/http-loader": "^7.0.0", "@ngxs/store": "^3.8.1", - "@sovity.de/edc-client": "10.4.0", + "@sovity.de/edc-client": "0.0.1-20241025-2408-alpha1", "clean-deep": "^3.4.0", "date-fns": "^2.30.0", "date-fns-tz": "^2.0.1", diff --git a/src/app/core/services/api/edc-api.service.ts b/src/app/core/services/api/edc-api.service.ts index 2575fb157..482baad18 100644 --- a/src/app/core/services/api/edc-api.service.ts +++ b/src/app/core/services/api/edc-api.service.ts @@ -140,9 +140,13 @@ export class EdcApiService { getCatalogPageDataOffers( connectorEndpoint: string, + participantId: string, ): Observable { return toObservable(() => - this.edcClient.uiApi.getCatalogPageDataOffers({connectorEndpoint}), + this.edcClient.uiApi.getCatalogPageDataOffers({ + connectorEndpoint, + participantId, + }), ); } diff --git a/src/app/core/services/api/fake-backend/connector-fake-impl/catalog-fake-service.ts b/src/app/core/services/api/fake-backend/connector-fake-impl/catalog-fake-service.ts index 23976bd55..82c3f8396 100644 --- a/src/app/core/services/api/fake-backend/connector-fake-impl/catalog-fake-service.ts +++ b/src/app/core/services/api/fake-backend/connector-fake-impl/catalog-fake-service.ts @@ -4,7 +4,7 @@ import {TestPolicies} from './data/test-policies'; let dataOffers: UiDataOffer[] = [ { - endpoint: 'http://existing-other-connector/api/dsp', + endpoint: 'https://existing-other-connector/api/dsp', participantId: 'MDSL1234XX.C1234XX', asset: TestAssets.full, contractOffers: [ @@ -21,7 +21,7 @@ let dataOffers: UiDataOffer[] = [ ], }, { - endpoint: 'http://existing-other-connector/api/dsp', + endpoint: 'https://existing-other-connector/api/dsp', participantId: 'MDSL1234XX.C1234XX', asset: TestAssets.onRequestAsset, contractOffers: [ @@ -32,7 +32,7 @@ let dataOffers: UiDataOffer[] = [ ], }, { - endpoint: 'http://existing-other-connector/api/dsp', + endpoint: 'https://existing-other-connector/api/dsp', asset: TestAssets.boring, participantId: 'MDSL1234XX.C1234XX', contractOffers: [ @@ -43,7 +43,7 @@ let dataOffers: UiDataOffer[] = [ ], }, { - endpoint: 'http://existing-other-connector/api/dsp', + endpoint: 'https://existing-other-connector/api/dsp', asset: TestAssets.short, participantId: 'MDSL1234XX.C1234XX', contractOffers: [ diff --git a/src/app/core/services/api/fake-backend/connector-fake-impl/contract-negotiation-fake-service.ts b/src/app/core/services/api/fake-backend/connector-fake-impl/contract-negotiation-fake-service.ts index 8a38398cd..063b3d77c 100644 --- a/src/app/core/services/api/fake-backend/connector-fake-impl/contract-negotiation-fake-service.ts +++ b/src/app/core/services/api/fake-backend/connector-fake-impl/contract-negotiation-fake-service.ts @@ -63,7 +63,7 @@ export const initiateContractNegotiation = ( direction: 'CONSUMING', counterPartyAddress: request.counterPartyAddress, transferProcesses: [], - counterPartyId: request.counterPartyParticipantId, + counterPartyId: request.counterPartyId, asset: getAssetById(request.assetId)!, contractSigningDate: new Date(), contractPolicy: getPolicyDefinitionByJsonLd(request.policyJsonLd)!, diff --git a/src/app/core/services/api/fake-backend/connector-fake-impl/dashboard-fake-service.ts b/src/app/core/services/api/fake-backend/connector-fake-impl/dashboard-fake-service.ts index a853b1f61..eed45a3f8 100644 --- a/src/app/core/services/api/fake-backend/connector-fake-impl/dashboard-fake-service.ts +++ b/src/app/core/services/api/fake-backend/connector-fake-impl/dashboard-fake-service.ts @@ -26,10 +26,12 @@ export const dashboardPage = (): DashboardPage => ({ connectorCuratorName: 'Example GmbH', connectorCuratorUrl: 'https://example.com', connectorEndpoint: 'https://edc.fake-backend/api/dsp', - connectorMiwConfig: { - url: 'https://miw.fake-backend', - tokenUrl: 'https://miw.fake-backend/token', - authorityId: 'fake-miw', + connectorCxDidConfig: { + myDid: 'your-did-long-number:1234567890:idk', + bdrsUrl: 'https://bdrs.fake-backend', + dimUrl: 'https://dim.fake-backend', + trustedVcIssuer: 'https://trusted-vc-issuer.fake-backend', + walletTokenUrl: 'https://wallet-token.fake-backend', }, connectorDapsConfig: { tokenUrl: 'https://daps.fake-backend/token', diff --git a/src/app/core/services/connector-endpoint-url-mapper.ts b/src/app/core/services/connector-endpoint-url-mapper.ts new file mode 100644 index 000000000..8c1b3c5e0 --- /dev/null +++ b/src/app/core/services/connector-endpoint-url-mapper.ts @@ -0,0 +1,31 @@ +import {Injectable} from '@angular/core'; + +@Injectable({providedIn: 'root'}) +export class ConnectorEndpointUrlMapper { + /** + * Builds strings like "https://my-connector.com/api/dsp, participantId=CXL-1234567890". + * + * Connectors now require both the connector endpoint and the participant ID for catalog requests, but we + * still want to be able to offer the "copy + paste" User Experience + */ + separator = '?participantId='; + + mergeConnectorEndpointAndParticipantId( + connectorEndpoint: string, + participantId: string, + ): string { + return `${connectorEndpoint}${this.separator}${participantId}`; + } + + extractConnectorEndpointAndParticipantId(combined: string): { + connectorEndpoint: string; + participantId: string; + } { + const parts = combined.split(this.separator); + if (parts.length !== 2) { + return {connectorEndpoint: combined, participantId: ''}; + } + + return {connectorEndpoint: parts[0], participantId: parts[1]}; + } +} diff --git a/src/app/core/services/connector-info-property-grid-group-builder.ts b/src/app/core/services/connector-info-property-grid-group-builder.ts index 64faf64af..a2c6fae67 100644 --- a/src/app/core/services/connector-info-property-grid-group-builder.ts +++ b/src/app/core/services/connector-info-property-grid-group-builder.ts @@ -214,25 +214,39 @@ export class ConnectorInfoPropertyGridGroupBuilder { ); } - if (data.connectorMiwConfig != null) { + if (data.connectorCxDidConfig != null) { fields.push( { icon: 'category', - label: 'MIW Authority ID', + label: 'Your DID', + ...this.propertyGridUtils.guessValue(data.connectorCxDidConfig.myDid), + }, + { + icon: 'vpn_key', + label: 'Wallet Token URL', + ...this.propertyGridUtils.guessValue( + data.connectorCxDidConfig.walletTokenUrl, + ), + }, + { + icon: 'category', + label: 'Trusted VC Issuer', ...this.propertyGridUtils.guessValue( - data.connectorMiwConfig.authorityId, + data.connectorCxDidConfig.trustedVcIssuer, ), }, { icon: 'link', - label: 'MIW URL', - ...this.propertyGridUtils.guessValue(data.connectorMiwConfig.url), + label: 'BDRS URL', + ...this.propertyGridUtils.guessValue( + data.connectorCxDidConfig.bdrsUrl, + ), }, { - icon: 'vpn_key', - label: 'MIW Token URL', + icon: 'link', + label: 'DIM URL', ...this.propertyGridUtils.guessValue( - data.connectorMiwConfig.tokenUrl, + data.connectorCxDidConfig.dimUrl, ), }, ); diff --git a/src/app/core/services/contract-negotiation.service.ts b/src/app/core/services/contract-negotiation.service.ts index d813ee12c..b1571b1ac 100644 --- a/src/app/core/services/contract-negotiation.service.ts +++ b/src/app/core/services/contract-negotiation.service.ts @@ -58,7 +58,7 @@ export class ContractNegotiationService { negotiate(dataOffer: DataOffer, contractOffer: UiContractOffer) { const contractOfferId = contractOffer.contractOfferId; const initiateRequest: ContractNegotiationRequest = { - counterPartyParticipantId: dataOffer.participantId, + counterPartyId: dataOffer.participantId, counterPartyAddress: dataOffer.endpoint!, assetId: dataOffer.asset.assetId, contractOfferId, diff --git a/src/app/core/services/transfer-data-sink-mapper.ts b/src/app/core/services/transfer-data-sink-mapper.ts index 77f6f4c05..a79ce7b57 100644 --- a/src/app/core/services/transfer-data-sink-mapper.ts +++ b/src/app/core/services/transfer-data-sink-mapper.ts @@ -5,7 +5,6 @@ import {getAuthFields} from '../utils/form-value-utils'; import {mapKeys, removeNullValues} from '../utils/record-utils'; import {DataAddressProperty} from './models/data-address-properties'; import {HttpDataAddressParams} from './models/http-data-address-params'; -import {UiAssetMapped} from './models/ui-asset-mapped'; import {QueryParamsMapper} from './query-params-mapper'; @Injectable({providedIn: 'root'}) @@ -18,45 +17,6 @@ export class TransferDataSinkMapper { const params = this.buildHttpRequestParams(formValue); return this.encodeHttpRequestParams(params); } - - encodeHttpProxyTransferRequestProperties( - asset: UiAssetMapped, - value: ContractAgreementTransferDialogFormValue, - ): Record { - const method = value.httpProxiedMethod?.trim() ?? ''; - const pathSegments = this.queryParamsMapper.getBaseUrlWithoutQueryParams( - value.httpProxiedPath!!, - ); - const queryParams = this.queryParamsMapper.getFullQueryString( - value.httpProxiedPath!!, - value.httpProxiedQueryParams ?? [], - ); - const body = value.httpProxiedBody?.trim() || null; - const contentType = value.httpProxiedBodyContentType?.trim() || null; - - const proxyMethod = - value.showAllHttpParameterizationFields || - asset.httpDatasourceHintsProxyMethod; - const proxyPath = - value.showAllHttpParameterizationFields || - asset.httpDatasourceHintsProxyPath; - const proxyQueryParams = - value.showAllHttpParameterizationFields || - asset.httpDatasourceHintsProxyQueryParams; - const proxyBody = - value.showAllHttpParameterizationFields || - asset.httpDatasourceHintsProxyBody; - - return removeNullValues({ - [DataAddressProperty.method]: proxyMethod && method ? method : null, - [DataAddressProperty.pathSegments]: proxyPath ? pathSegments : null, - [DataAddressProperty.queryParams]: proxyQueryParams ? queryParams : null, - [DataAddressProperty.body]: proxyBody ? body : null, - [DataAddressProperty.contentType]: proxyBody ? contentType : null, - [DataAddressProperty.mediaType]: proxyBody ? contentType : null, - }); - } - encodeHttpRequestParams( httpRequestParams: HttpDataAddressParams, ): Record { 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 db5c98d8e..3db7cea35 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 @@ -2,6 +2,7 @@ import {Injectable} from '@angular/core'; import {Observable, combineLatest} from 'rxjs'; import {map, switchMap} from 'rxjs/operators'; import {EdcApiService} from '../../../../core/services/api/edc-api.service'; +import {ConnectorEndpointUrlMapper} from '../../../../core/services/connector-endpoint-url-mapper'; import {DataOffer} from '../../../../core/services/models/data-offer'; import {Fetched} from '../../../../core/services/models/fetched'; import {MultiFetched} from '../../../../core/services/models/multi-fetched'; @@ -19,6 +20,7 @@ export class CatalogBrowserPageService { private edcApiService: EdcApiService, private catalogApiUrlService: CatalogApiUrlService, private dataOfferBuilder: DataOfferBuilder, + private connectorEndpointUrlMapper: ConnectorEndpointUrlMapper, ) {} contractOfferPageData$( @@ -90,9 +92,14 @@ export class CatalogBrowserPageService { ); } - private fetchDataOffers(endpoint: string) { + private fetchDataOffers(endpointAndParticipantId: string) { + const {connectorEndpoint, participantId} = + this.connectorEndpointUrlMapper.extractConnectorEndpointAndParticipantId( + endpointAndParticipantId, + ); + return this.edcApiService - .getCatalogPageDataOffers(endpoint) + .getCatalogPageDataOffers(connectorEndpoint, participantId) .pipe( map((dataOffers) => dataOffers.map((dataOffer) => 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 f08c5c141..759f2ca03 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 @@ -31,7 +31,7 @@ link ; httpMethod: FormControl; - showAllHttpParameterizationFields: FormControl; - httpAuthHeaderType: FormControl; httpAuthHeaderName: FormControl; httpAuthHeaderValue: FormControl; httpAuthHeaderSecretName: FormControl; httpHeaders: FormArray>; - - // Http Datasource Parameterization - httpProxiedPath: FormControl; - httpProxiedMethod: FormControl; - httpProxiedQueryParams: FormArray< - FormGroup - >; - httpProxiedBody: FormControl; - httpProxiedBodyContentType: FormControl; } diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-transfer-dialog/contract-agreement-transfer-dialog-form.ts b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-transfer-dialog/contract-agreement-transfer-dialog-form.ts index 288b34753..1789657e3 100644 --- a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-transfer-dialog/contract-agreement-transfer-dialog-form.ts +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-transfer-dialog/contract-agreement-transfer-dialog-form.ts @@ -54,16 +54,6 @@ export class ContractAgreementTransferDialogForm { httpHeaders: this.formBuilder.array( new Array>(), ), - - showAllHttpParameterizationFields: [false], - - httpProxiedPath: [''], - httpProxiedMethod: ['', Validators.required], - httpProxiedQueryParams: this.formBuilder.array( - new Array>(), - ), - httpProxiedBody: [''], - httpProxiedBodyContentType: [''], }); switchDisabledControls( @@ -80,8 +70,6 @@ export class ContractAgreementTransferDialogForm { const httpAuthByValue = value.httpAuthHeaderType === 'Value'; const httpAuthByVault = value.httpAuthHeaderType === 'Vault-Secret'; - const httpProxiedMethod = !!value.showAllHttpParameterizationFields; - return { dataAddressType: true, @@ -99,14 +87,6 @@ export class ContractAgreementTransferDialogForm { httpAuthHeaderSecretName: http && httpAuthByVault, httpHeaders: http, - - showAllHttpParameterizationFields: !customTransferProcessRequest, - - httpProxiedPath: !customTransferProcessRequest, - httpProxiedMethod: !customTransferProcessRequest && httpProxiedMethod, - httpProxiedQueryParams: !customTransferProcessRequest, - httpProxiedBody: !customTransferProcessRequest, - httpProxiedBodyContentType: !customTransferProcessRequest, }; }, ); @@ -134,14 +114,4 @@ export class ContractAgreementTransferDialogForm { onHttpHeadersRemoveClick(index: number) { this.all.controls.httpHeaders.removeAt(index); } - - onHttpQueryParamsAddClick() { - this.all.controls.httpProxiedQueryParams.push( - this.buildQueryParamFormGroup(), - ); - } - - onHttpQueryParamsRemoveClick(index: number) { - this.all.controls.httpProxiedQueryParams.removeAt(index); - } } diff --git a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-transfer-dialog/contract-agreement-transfer-dialog.component.html b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-transfer-dialog/contract-agreement-transfer-dialog.component.html index 1414fa2cb..3e303c7f0 100644 --- a/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-transfer-dialog/contract-agreement-transfer-dialog.component.html +++ b/src/app/routes/connector-ui/contract-agreement-page/contract-agreement-transfer-dialog/contract-agreement-transfer-dialog.component.html @@ -212,181 +212,6 @@

- - -
- {{ 'contract_agreement_page.http_para' | translate }} -
- -
- {{ 'contract_agreement_page.http_message' | translate }} -
- -
- {{ 'contract_agreement_page.res_url' | translate }} - {{ - '{baseUrl}{customSubPath}?{baseQueryParams}&{customQueryParams}' - }} -
- -
- - - - {{ - 'contract_agreement_page.cus_meth' | translate - }} - - - {{ method }} - - - {{ - 'contract_agreement_page.proxy_method' | translate - }} - - - - - - - {{ - 'contract_agreement_page.cus_sub' | translate - }} - - {{ - 'contract_agreement_page.proxy_path' | translate - }} - - -
- - -
- - - {{ - 'contract_agreement_page.cus_query' | translate - }} - - - {{ 'contract_agreement_page.proxy_query' | translate }} - - - - - - {{ 'general.value' | translate }} - - - - - -
- -
- - -
-
- - - - - {{ - 'contract_agreement_page.req_cont' | translate - }} - - - {{ 'contract_agreement_page.proxy_body' | translate }} - - - - - - {{ - 'contract_agreement_page.req_body' | translate - }} - - - {{ 'contract_agreement_page.proxy_body' | translate }} - - - - -
- -
-
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 c2ae2e7c2..639a7cc7f 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 @@ -10,12 +10,8 @@ import { import {EdcApiService} from '../../../../core/services/api/edc-api.service'; import {DataAddressMapper} from '../../../../core/services/data-address-mapper'; import {NotificationService} from '../../../../core/services/notification.service'; -import {TransferDataSinkMapper} from '../../../../core/services/transfer-data-sink-mapper'; import {ValidationMessages} from '../../../../core/validators/validation-messages'; -import { - DATA_SINK_HTTP_METHODS, - DATA_SOURCE_HTTP_METHODS, -} from '../../../../shared/business/edit-asset-form/form/http-methods'; +import {DATA_SINK_HTTP_METHODS} from '../../../../shared/business/edit-asset-form/form/http-methods'; import {ContractAgreementTransferDialogData} from './contract-agreement-transfer-dialog-data'; import {ContractAgreementTransferDialogForm} from './contract-agreement-transfer-dialog-form'; import {ContractAgreementTransferDialogFormValue} from './contract-agreement-transfer-dialog-form-model'; @@ -30,48 +26,6 @@ export class ContractAgreementTransferDialogComponent implements OnDestroy { loading = false; dataSinkMethods = DATA_SINK_HTTP_METHODS; - dataSourceMethods = DATA_SOURCE_HTTP_METHODS; - - get proxyMethod(): boolean { - return ( - this.showAllHttpParameterizationFields || - this.data.asset.httpDatasourceHintsProxyMethod === true - ); - } - - get proxyPath(): boolean { - return ( - this.showAllHttpParameterizationFields || - this.data.asset.httpDatasourceHintsProxyPath === true - ); - } - - get proxyQueryParams(): boolean { - return ( - this.showAllHttpParameterizationFields || - this.data.asset.httpDatasourceHintsProxyQueryParams === true - ); - } - - get proxyBody(): boolean { - return ( - this.showAllHttpParameterizationFields || - this.data.asset.httpDatasourceHintsProxyBody === true - ); - } - - get showHttpParameterizationToggleButton(): boolean { - return ( - this.data.asset.httpDatasourceHintsProxyMethod !== true || - this.data.asset.httpDatasourceHintsProxyPath !== true || - this.data.asset.httpDatasourceHintsProxyQueryParams !== true || - this.data.asset.httpDatasourceHintsProxyBody !== true - ); - } - - get showAllHttpParameterizationFields(): boolean { - return this.form.all.controls.showAllHttpParameterizationFields.value; - } constructor( public form: ContractAgreementTransferDialogForm, @@ -79,7 +33,6 @@ export class ContractAgreementTransferDialogComponent implements OnDestroy { private dialogRef: MatDialogRef, private edcApiService: EdcApiService, private notificationService: NotificationService, - private httpRequestParamsMapper: TransferDataSinkMapper, private dataAddressMapper: DataAddressMapper, @Inject(MAT_DIALOG_DATA) public data: ContractAgreementTransferDialogData, ) {} @@ -140,19 +93,14 @@ export class ContractAgreementTransferDialogComponent implements OnDestroy { private buildTransferRequest( value: ContractAgreementTransferDialogFormValue, ): InitiateTransferRequest { - const transferProcessProperties = - this.httpRequestParamsMapper.encodeHttpProxyTransferRequestProperties( - this.data.asset, - value, - ); - const dataSinkProperties = this.dataAddressMapper.buildDataAddressProperties(value) ?? {}; return { contractAgreementId: this.data.contractId, - transferProcessProperties, + transferProcessProperties: {}, dataSinkProperties, + transferType: 'HttpData-PUSH', }; } 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 c2afe5432..031e36696 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 @@ -5,6 +5,7 @@ import {TranslateService} from '@ngx-translate/core'; import {DashboardTransferAmounts, UiDataOffer} from '@sovity.de/edc-client'; import {EdcApiService} from '../../../../core/services/api/edc-api.service'; import {LastCommitInfoService} from '../../../../core/services/api/last-commit-info.service'; +import {ConnectorEndpointUrlMapper} from '../../../../core/services/connector-endpoint-url-mapper'; import {ConnectorInfoPropertyGridGroupBuilder} from '../../../../core/services/connector-info-property-grid-group-builder'; import {Fetched} from '../../../../core/services/models/fetched'; import {CatalogApiUrlService} from '../../catalog-browser-page/catalog-browser-page/catalog-api-url.service'; @@ -19,6 +20,7 @@ export class DashboardPageDataService { private lastCommitInfoService: LastCommitInfoService, private connectorInfoPropertyGridGroupBuilder: ConnectorInfoPropertyGridGroupBuilder, private translateService: TranslateService, + private connectorEndpointUrlMapper: ConnectorEndpointUrlMapper, ) {} /** @@ -56,11 +58,17 @@ export class DashboardPageDataService { private getAllDataOffers(): Observable { const catalogUrls = this.catalogApiUrlService.getAllProviders(); - const dataOffers = catalogUrls.map((it) => - this.edcApiService - .getCatalogPageDataOffers(it) - .pipe(catchError(() => of([]))), - ); + const dataOffers = catalogUrls + .map((it) => + this.connectorEndpointUrlMapper.extractConnectorEndpointAndParticipantId( + it, + ), + ) + .map((it) => + this.edcApiService + .getCatalogPageDataOffers(it.connectorEndpoint, it.participantId) + .pipe(catchError(() => of([]))), + ); return merge(...dataOffers).pipe( sampleTime(50), @@ -165,9 +173,11 @@ export class DashboardPageDataService { it.numContractAgreementsConsuming + it.numContractAgreementsProviding, ), - connectorEndpoint: this.extractString( - fetched, - (it) => it.connectorEndpoint, + connectorEndpointAndParticipantId: this.extractString(fetched, (it) => + this.connectorEndpointUrlMapper.mergeConnectorEndpointAndParticipantId( + it.connectorEndpoint, + it.connectorParticipantId, + ), ), incomingTransfersChart: fetched.map((it) => this.buildTransferChart(it.transferProcessesConsuming, 'CONSUMING'), diff --git a/src/app/routes/connector-ui/dashboard-page/dashboard-page/dashboard-page-data.ts b/src/app/routes/connector-ui/dashboard-page/dashboard-page/dashboard-page-data.ts index 41b9d8b7d..d082e9927 100644 --- a/src/app/routes/connector-ui/dashboard-page/dashboard-page/dashboard-page-data.ts +++ b/src/app/routes/connector-ui/dashboard-page/dashboard-page/dashboard-page-data.ts @@ -12,7 +12,7 @@ export interface DashboardPageData { numPolicies: Fetched; numCatalogs: Fetched; connectorProperties: PropertyGridGroup[]; - connectorEndpoint: string; + connectorEndpointAndParticipantId: string; title: string; description: string; } @@ -28,7 +28,7 @@ export function defaultDashboardData(): DashboardPageData { numContractDefinitions: Fetched.empty(), numCatalogs: Fetched.empty(), connectorProperties: [], - connectorEndpoint: 'Loading...', + connectorEndpointAndParticipantId: 'Loading...', title: 'Loading...', description: 'Loading...', }; diff --git a/src/app/routes/connector-ui/dashboard-page/dashboard-page/dashboard-page.component.html b/src/app/routes/connector-ui/dashboard-page/dashboard-page/dashboard-page.component.html index 1919707c9..2eefe9ff7 100644 --- a/src/app/routes/connector-ui/dashboard-page/dashboard-page/dashboard-page.component.html +++ b/src/app/routes/connector-ui/dashboard-page/dashboard-page/dashboard-page.component.html @@ -84,20 +84,22 @@ {{ 'dashboard_page.descrip' | translate }}

- {{ 'dashboard_page.conn_end' | translate }} + {{ + 'dashboard_page.connector_endpoint' | translate + }} link diff --git a/src/app/shared/form-elements/data-address-type-select/data-address-type-select-items.ts b/src/app/shared/form-elements/data-address-type-select/data-address-type-select-items.ts index 94191e27c..07f90e541 100644 --- a/src/app/shared/form-elements/data-address-type-select/data-address-type-select-items.ts +++ b/src/app/shared/form-elements/data-address-type-select/data-address-type-select-items.ts @@ -15,23 +15,30 @@ export const dataAddressTypeSelectItems = ( }); } - items.push( - { - id: 'Http', - label: 'REST-API Endpoint', - }, - { - id: 'Custom-Data-Address-Json', - label: `Custom ${type} Config (JSON)`, - }, - ); + items.push({ + id: 'Http', + label: 'REST-API Endpoint', + }); - if (type === 'Datasink') { + if (type === 'Datasource-Create') { items.push({ - id: 'Custom-Transfer-Process-Request', - label: 'Custom Transfer Process Request (JSON)', + id: 'Custom-Data-Address-Json', + label: `Custom Datasource Config (JSON)`, }); } + if (type === 'Datasink') { + items.push( + { + id: 'Custom-Data-Address-Json', + label: `Custom Datasink Config (JSON) for Transfer Type 'HttpData-PUSH'`, + }, + { + id: 'Custom-Transfer-Process-Request', + label: 'Custom Transfer Process Request (JSON)', + }, + ); + } + return items; }; diff --git a/src/assets/i18n/de.json b/src/assets/i18n/de.json index bd16c0bd2..b7a903342 100644 --- a/src/assets/i18n/de.json +++ b/src/assets/i18n/de.json @@ -219,7 +219,7 @@ "completed": "Abgeschlossen", "con_agree": "Vertragliche Vereinbarungen", "con_def": "Vertragsefinitions", - "conn_end": "Konnektor Endpunkte", + "connector_endpoint": "Konnektor Endpunkte", "conn_prop": "Konnektor Eigenschaften", "conn_service": "Konnektor als Dienstleistung", "contact": "Kontaktieren Sie uns", diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index 357a604d3..d8efa6804 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -41,7 +41,7 @@ "asset_list_page.search_assets": "Search assets", "asset_list_page.title": "Assets", "asset_list_page.version": "Version", - "catalog_browser_page.con_endpoints": "Connector Endpoints", + "catalog_browser_page.con_endpoints": "Connector Endpoints + Participant IDs", "catalog_browser_page.contract": "Contract Offer", "catalog_browser_page.endpoint_catalogs": "Other Connector Endpoint Catalogs", "catalog_browser_page.enter_endpoints": "Please enter other connector endpoints to fetch catalogs.", @@ -103,7 +103,7 @@ "contract_agreement_page.http_message": "When the data offer on the provider side is of the type HttpData and certain data source fields are set, certain parts of the request to the data source can be customized from the consumer side and will be passed to the other connector when initiating the transfer. This allows an asset to contain more than just one kind of data, allowing additional filtering or even sharing of entire APIs with multiple data sets via a single asset and a single contract.", "contract_agreement_page.http_para": "Http Datasource Parameterization", "contract_agreement_page.ini_transfer": "Initiate Transfer", - "contract_agreement_page.json_hint": "JSON-LD values for edc:connectorId, edc:contractId, edc:connectorId and edc:connectorAddress will be overridden.", + "contract_agreement_page.json_hint": "JSON-LD values for edc:contractId and edc:connectorAddress will be overridden.", "contract_agreement_page.new_def": "Publish New Data Offer", "contract_agreement_page.no_agree_found": "No contract agreements found with given filter.", "contract_agreement_page.no_agree": "No contract agreements yet.", @@ -265,7 +265,7 @@ "dashboard_page.completed": "Completed", "dashboard_page.con_agree": "Contract Agreements", "dashboard_page.con_def": "Contract Definitions", - "dashboard_page.conn_end": "Connector Endpoint", + "dashboard_page.connector_endpoint": "Connector Endpoint + Participant ID", "dashboard_page.conn_prop": "Connector Properties", "dashboard_page.conn_service": "Connector-as-a-Service", "dashboard_page.contact_us": "Contact Us",