diff --git a/package-lock.json b/package-lock.json index a4e976ea1..b24ec3946 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.20230830.155424-main-b314d7e2", + "@sovity.de/edc-client": "0.20230921.115850-main-5e87f14f", "clean-deep": "^3.4.0", "date-fns": "^2.30.0", "dotenv": "^16.3.1", @@ -779,6 +779,15 @@ "yarn": ">= 1.13.0" } }, + "node_modules/@angular/cli/node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "dev": true, + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/@angular/common": { "version": "14.3.0", "resolved": "https://registry.npmjs.org/@angular/common/-/common-14.3.0.tgz", @@ -3598,9 +3607,9 @@ "integrity": "sha512-305vHJj38Ma9x9YADM3SJh3sdqePeLcrUB1hHlYsuPdx7wYe9vwgb503KYStJ+5iN/ojP2xu8k6Unt+y+Bu5iQ==" }, "node_modules/@sovity.de/edc-client": { - "version": "0.20230830.155424-main-b314d7e2", - "resolved": "https://registry.npmjs.org/@sovity.de/edc-client/-/edc-client-0.20230830.155424-main-b314d7e2.tgz", - "integrity": "sha512-kOx2ZclD3rfhq/hC+9bKVAQRQh8vtWbcp4u3DI4X9chR5/euB41UlJQ1E8vokPkGdEeVmjMTwVOuXwpLRWJj7g==" + "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==" }, "node_modules/@tootallnate/once": { "version": "2.0.0", @@ -12079,6 +12088,15 @@ "websocket-driver": "^0.7.4" } }, + "node_modules/sockjs/node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "dev": true, + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/socks": { "version": "2.7.1", "resolved": "https://registry.npmjs.org/socks/-/socks-2.7.1.tgz", @@ -13183,15 +13201,6 @@ "node": ">= 0.4.0" } }, - "node_modules/uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", - "dev": true, - "bin": { - "uuid": "dist/bin/uuid" - } - }, "node_modules/validate-npm-package-license": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", diff --git a/package.json b/package.json index 9c0c164ca..78d738497 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.20230830.155424-main-b314d7e2", + "@sovity.de/edc-client": "0.20230921.115850-main-5e87f14f", "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-detail-dialog.component.html b/src/app/component-library/catalog/asset-detail-dialog/asset-detail-dialog.component.html index 22dd75f8f..af0ebcb10 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 @@ -20,7 +20,7 @@ {{ asset.name }}
- {{ asset.originatorOrganization }} + {{ asset.creatorOrganizationName }}
@@ -44,7 +44,7 @@ -
+
{{ keyword }} 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 d6672950a..2c0969fcb 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 @@ -7,6 +7,7 @@ import { import {Observable, Subject, isObservable} from 'rxjs'; import {filter, finalize, takeUntil} from 'rxjs/operators'; import {ContractNegotiationService} from '../../../core/services/api/contract-negotiation.service'; +import {EdcApiService} from '../../../core/services/api/edc-api.service'; import {Asset} from '../../../core/services/models/asset'; import {NotificationService} from '../../../core/services/notification.service'; import {ContractAgreementTransferDialogData} from '../../../routes/connector-ui/contract-agreement-page/contract-agreement-transfer-dialog/contract-agreement-transfer-dialog-data'; @@ -18,7 +19,6 @@ import { import {PropertyGridGroup} from '../../property-grid/property-grid-group/property-grid-group'; import {AssetDetailDialogData} from './asset-detail-dialog-data'; import {AssetDetailDialogResult} from './asset-detail-dialog-result'; -import {EdcApiService} from "../../../core/services/api/edc-api.service"; /** * Asset Detail Dialog @@ -76,10 +76,10 @@ export class AssetDetailDialogComponent implements OnDestroy { onDeleteClick() { this.confirmDelete().subscribe(() => { this.blockingRequest({ - successMessage: `Deleted asset ${this.asset.id}.`, - failureMessage: `Failed deleting asset ${this.asset.id}.`, + successMessage: `Deleted asset ${this.asset.assetId}.`, + failureMessage: `Failed deleting asset ${this.asset.assetId}.`, onsuccess: () => this.close({refreshList: true}), - req: () => this.edcApiService.deleteAsset(this.asset.id), + req: () => this.edcApiService.deleteAsset(this.asset.assetId), }); }); } 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 a9b09d19b..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 @@ -36,7 +36,7 @@ export class AssetPropertyGridGroupBuilder { icon: 'category', label: 'ID', labelTitle: AssetProperties.id, - ...this.propertyGridUtils.guessValue(asset.id), + ...this.propertyGridUtils.guessValue(asset.assetId), }, { icon: 'file_copy', @@ -54,32 +54,32 @@ export class AssetPropertyGridGroupBuilder { icon: 'apartment', label: 'Publisher', labelTitle: AssetProperties.publisher, - ...this.propertyGridUtils.guessValue(asset.publisher), + ...this.propertyGridUtils.guessValue(asset.publisherHomepage), }, { icon: 'bookmarks', label: 'Endpoint Documentation', labelTitle: AssetProperties.endpointDocumentation, - ...this.propertyGridUtils.guessValue(asset.endpointDocumentation), + ...this.propertyGridUtils.guessValue(asset.landingPageUrl), }, { icon: 'gavel', label: 'Standard License', labelTitle: AssetProperties.standardLicense, - ...this.propertyGridUtils.guessValue(asset.standardLicense), + ...this.propertyGridUtils.guessValue(asset.licenseUrl), }, - this.buildConnectorEndpointField(asset.originator!!), + this.buildConnectorEndpointField(asset.connectorEndpoint), { icon: 'account_circle', label: 'Organization', labelTitle: AssetProperties.originatorOrganization, - ...this.propertyGridUtils.guessValue(asset.originatorOrganization), + ...this.propertyGridUtils.guessValue(asset.creatorOrganizationName), }, { icon: 'category', label: 'Content Type', labelTitle: AssetProperties.contentType, - ...this.propertyGridUtils.guessValue(asset.contentType), + ...this.propertyGridUtils.guessValue(asset.mediaType), }, ]; diff --git a/src/app/component-library/catalog/contract-offer-cards/contract-offer-cards.component.html b/src/app/component-library/catalog/contract-offer-cards/contract-offer-cards.component.html index bc5b818cd..1788ca50e 100644 --- a/src/app/component-library/catalog/contract-offer-cards/contract-offer-cards.component.html +++ b/src/app/component-library/catalog/contract-offer-cards/contract-offer-cards.component.html @@ -12,7 +12,7 @@ {{ asset.name }} - {{ asset.originatorOrganization }} + {{ asset.creatorOrganizationName }} @@ -29,7 +29,7 @@
-
+
{{ asset.version diff --git a/src/app/core/services/api/contract-negotiation.service.ts b/src/app/core/services/api/contract-negotiation.service.ts index 055a26418..730af9f86 100644 --- a/src/app/core/services/api/contract-negotiation.service.ts +++ b/src/app/core/services/api/contract-negotiation.service.ts @@ -56,7 +56,7 @@ export class ContractNegotiationService { return ( this.runningNegotiations.get(contractOffer.id) !== undefined || !!this.runningTransferProcesses.find( - (tp) => tp.assetId === contractOffer.asset.id, + (tp) => tp.assetId === contractOffer.asset.assetId, ) ); } @@ -67,7 +67,7 @@ export class ContractNegotiationService { getState(contractOffer: ContractOffer): string { const transferProcess = this.runningTransferProcesses.find( - (tp) => tp.assetId === contractOffer.asset.id, + (tp) => tp.assetId === contractOffer.asset.assetId, ); if (transferProcess) { return TransferProcessStates[transferProcess.state]; @@ -83,11 +83,11 @@ export class ContractNegotiationService { negotiate(contractOffer: ContractOffer) { const initiateRequest: NegotiationInitiateRequestDto = { - connectorAddress: contractOffer.asset.originator!, + connectorAddress: contractOffer.asset.connectorEndpoint!, offer: { offerId: contractOffer.id, - assetId: contractOffer.asset.id, + assetId: contractOffer.asset.assetId, policy: contractOffer.policy, }, connectorId: 'my-connector', diff --git a/src/app/core/services/api/contract-offer.service.ts b/src/app/core/services/api/contract-offer.service.ts index e486c3e35..2e1dce287 100644 --- a/src/app/core/services/api/contract-offer.service.ts +++ b/src/app/core/services/api/contract-offer.service.ts @@ -61,7 +61,7 @@ export class ContractOfferService { ...contractOfferDto, asset: this.assetPropertyMapper.buildAsset({ connectorEndpoint, - properties: contractOfferDto.asset.properties, + uiAsset: contractOfferDto.asset, }), }; } diff --git a/src/app/core/services/api/criterion-type-ext.ts b/src/app/core/services/api/criterion-type-ext.ts new file mode 100644 index 000000000..94aa87aa0 --- /dev/null +++ b/src/app/core/services/api/criterion-type-ext.ts @@ -0,0 +1,10 @@ +import {UiCriterionOperatorEnum} from '@sovity.de/edc-client'; + +export const CRITERION_OPERATOR_SYMBOLS: Record< + UiCriterionOperatorEnum, + string +> = { + EQ: '=', + IN: 'in', + LIKE: 'like', +}; diff --git a/src/app/core/services/api/edc-api.service.ts b/src/app/core/services/api/edc-api.service.ts index b43450612..809904320 100644 --- a/src/app/core/services/api/edc-api.service.ts +++ b/src/app/core/services/api/edc-api.service.ts @@ -1,8 +1,6 @@ import {Inject, Injectable} from '@angular/core'; import {Observable, from} from 'rxjs'; import { - AssetCreateRequest, - AssetDto, AssetPage, ConnectorLimits, ContractAgreementPage, @@ -15,6 +13,8 @@ import { PolicyDefinitionCreateRequest, PolicyDefinitionPage, TransferHistoryPage, + UiAsset, + UiAssetCreateRequest, buildEdcClient, } from '@sovity.de/edc-client'; import {APP_CONFIG, AppConfig} from '../../config/app-config'; @@ -35,9 +35,9 @@ export class EdcApiService { } createAsset( - assetCreateRequest: AssetCreateRequest, + uiAssetCreateRequest: UiAssetCreateRequest, ): Observable { - return from(this.edcClient.uiApi.createAsset({assetCreateRequest})); + return from(this.edcClient.uiApi.createAsset({uiAssetCreateRequest})); } getAssetPage(): Observable { @@ -104,7 +104,7 @@ export class EdcApiService { return from(this.edcClient.uiApi.transferHistoryPageEndpoint()); } - getTransferProcessAsset(transferProcessId: string): Observable { + getTransferProcessAsset(transferProcessId: string): Observable { return from( this.edcClient.uiApi.getTransferProcessAsset({transferProcessId}), ); 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 8e062ee34..79a245189 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 @@ -1,13 +1,12 @@ import { - AssetCreateRequest, - AssetEntry, AssetPage, IdResponseDto, + UiAsset, + UiAssetCreateRequest, } from '@sovity.de/edc-client'; -import {AssetProperties} from '../../asset-properties'; import {TestAssets} from './data/test-assets'; -export let assets: AssetEntry[] = [TestAssets.full, TestAssets.boring]; +export let assets: UiAsset[] = [TestAssets.full, TestAssets.boring]; export const assetPage = (): AssetPage => { return { @@ -15,18 +14,33 @@ export const assetPage = (): AssetPage => { }; }; -export const createAsset = (asset: AssetCreateRequest): IdResponseDto => { +export const createAsset = (asset: UiAssetCreateRequest): IdResponseDto => { assets.push({ - properties: asset.properties, + assetId: asset.id, + name: asset.name ?? asset.id, + description: asset.description, + creatorOrganizationName: asset.creatorOrganizationName, + publisherHomepage: asset.publisherHomepage, + licenseUrl: asset.licenseUrl, + version: asset.version, + keywords: asset.keywords, + mediaType: asset.mediaType, + landingPageUrl: asset.landingPageUrl, + dataCategory: asset.dataCategory, + dataSubcategory: asset.dataSubcategory, + dataModel: asset.dataModel, + geoReferenceMethod: asset.geoReferenceMethod, + transportMode: asset.transportMode, + additionalProperties: asset.additionalProperties, privateProperties: asset.privateProperties, }); return { - id: asset.properties[AssetProperties.id], + id: asset.id, lastUpdatedDate: new Date(), }; }; export const deleteAsset = (id: string): IdResponseDto => { - assets = assets.filter((it) => it.properties[AssetProperties.id] !== id); + assets = assets.filter((it) => it.assetId !== id); return {id, lastUpdatedDate: new Date()}; }; diff --git a/src/app/core/services/api/fake-backend/data/test-assets.ts b/src/app/core/services/api/fake-backend/data/test-assets.ts index 054f790c6..e0f243934 100644 --- a/src/app/core/services/api/fake-backend/data/test-assets.ts +++ b/src/app/core/services/api/fake-backend/data/test-assets.ts @@ -1,61 +1,60 @@ -import {AssetDto, AssetEntry} from '@sovity.de/edc-client'; -import {AssetProperties} from '../../../asset-properties'; +import {UiAsset} from '@sovity.de/edc-client'; export namespace TestAssets { - export const boring: AssetEntry = { - properties: { - [AssetProperties.id]: 'test-asset-1', - [AssetProperties.name]: 'Test Asset 1', - [AssetProperties.description]: 'This is a test asset.', - }, + export const boring: UiAsset = { + assetId: 'test-asset-1', + name: 'Test Asset 1', + description: 'This is a test asset.', privateProperties: { 'some-private-property': 'abc', }, }; - export const full: AssetEntry = { - properties: { - [AssetProperties.id]: 'urn:artifact:my-test-asset-4', - [AssetProperties.name]: 'Rail Network 2023 NRW - RailDesigner Export', - [AssetProperties.version]: '1.1', - [AssetProperties.originatorOrganization]: 'Deutsche Bahn AG', - [AssetProperties.keywords]: 'db, bahn, rail, Rail-Designer', - [AssetProperties.contentType]: 'application/json', - [AssetProperties.description]: - 'Train Network Map released on 10.01.2023, valid until 31.02.2023. \nFile format is xyz as exported by Rail-Designer.', - [AssetProperties.language]: 'https://w3id.org/idsa/code/EN', - [AssetProperties.publisher]: 'https://my.cool-api.gg/about', - [AssetProperties.standardLicense]: 'https://my.cool-api.gg/license', - [AssetProperties.endpointDocumentation]: 'https://my.cool-api.gg/docs', - [AssetProperties.dataCategory]: 'Infrastructure and Logistics', - [AssetProperties.dataSubcategory]: - 'General Information About Planning Of Routes', - [AssetProperties.dataModel]: 'my-data-model-001', - [AssetProperties.geoReferenceMethod]: 'my-geo-reference-method', - [AssetProperties.transportMode]: 'Rail', + export const full: UiAsset = { + assetId: 'urn:artifact:my-test-asset-4', + name: 'Rail Network 2023 NRW - RailDesigner Export', + version: '1.1', + creatorOrganizationName: 'Deutsche Bahn AG', + keywords: ['db', 'bahn', 'rail', 'Rail-Designer'], + mediaType: 'application/json', + description: + 'Train Network Map released on 10.01.2023, valid until 31.02.2023. \nFile format is xyz as exported by Rail-Designer.', + language: 'https://w3id.org/idsa/code/EN', + publisherHomepage: 'https://my.cool-api.gg/about', + licenseUrl: 'https://my.cool-api.gg/license', + landingPageUrl: 'https://my.cool-api.gg/docs', + dataCategory: 'Infrastructure and Logistics', + dataSubcategory: 'General Information About Planning Of Routes', + dataModel: 'my-data-model-001', + geoReferenceMethod: 'my-geo-reference-method', + transportMode: 'Rail', + httpDatasourceHintsProxyQueryParams: true, + httpDatasourceHintsProxyPath: false, + httpDatasourceHintsProxyMethod: false, + httpDatasourceHintsProxyBody: false, + additionalProperties: { 'asset:prop:some-unsupported-property': 'F10E2821BBBEA527EA02200352313BC059445190', }, privateProperties: {}, }; - export function toAssetDto(entry: AssetEntry): AssetDto { + export function toAssetDto(entry: UiAsset): UiAsset { return { - assetId: entry.properties[AssetProperties.id], - createdAt: new Date(), - properties: entry.properties, + assetId: entry.assetId, + name: entry.name, + additionalProperties: {}, }; } - export function toDummyAsset(entry: AssetEntry): AssetEntry { - return dummyAsset(entry.properties[AssetProperties.id]); + export function toDummyAsset(entry: UiAsset): UiAsset { + return dummyAsset(entry.assetId); } - export function dummyAsset(assetId: string): AssetEntry { + export function dummyAsset(assetId: string): UiAsset { return { - properties: { - [AssetProperties.id]: assetId, - }, + assetId, + name: 'Dummy Asset', privateProperties: {}, }; } diff --git a/src/app/core/services/api/fake-backend/data/test-policies.ts b/src/app/core/services/api/fake-backend/data/test-policies.ts index 08dfee54b..97e2ddf53 100644 --- a/src/app/core/services/api/fake-backend/data/test-policies.ts +++ b/src/app/core/services/api/fake-backend/data/test-policies.ts @@ -1,7 +1,7 @@ -import {UiPolicyDto} from '@sovity.de/edc-client'; +import {UiPolicy} from '@sovity.de/edc-client'; export namespace TestPolicies { - export const connectorRestricted: UiPolicyDto = { + export const connectorRestricted: UiPolicy = { policyJsonLd: '{"example-policy-jsonld": true}', constraints: [ { @@ -13,7 +13,7 @@ export namespace TestPolicies { errors: [], }; - export const warnings: UiPolicyDto = { + export const warnings: UiPolicy = { policyJsonLd: '{"example-policy-jsonld": true}', constraints: [ { @@ -24,7 +24,7 @@ export namespace TestPolicies { ], errors: ['$.duties: Duties are currently unsupported.'], }; - export const failedMapping: UiPolicyDto = { + export const failedMapping: UiPolicy = { policyJsonLd: '{"example-policy-jsonld": true}', constraints: [], errors: ['No constraints found!'], 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 70563ba20..fd2c4d850 100644 --- a/src/app/core/services/api/fake-backend/edc-fake-backend.ts +++ b/src/app/core/services/api/fake-backend/edc-fake-backend.ts @@ -1,6 +1,4 @@ import { - AssetCreateRequestFromJSON, - AssetDtoToJSON, AssetPageToJSON, ContractAgreementPageToJSON, ContractAgreementTransferRequestFromJSON, @@ -11,6 +9,8 @@ import { PolicyDefinitionCreateRequestFromJSON, PolicyDefinitionPageToJSON, TransferHistoryPageToJSON, + UiAssetCreateRequestFromJSON, + UiAssetToJSON, } from '@sovity.de/edc-client'; import {assetPage, createAsset, deleteAsset} from './asset-fake-service'; import { @@ -55,7 +55,7 @@ export const EDC_FAKE_BACKEND: FetchAPI = async ( .url('pages/asset-page/assets') .on('POST', () => { - let createRequest = AssetCreateRequestFromJSON(body); + let createRequest = UiAssetCreateRequestFromJSON(body); let created = createAsset(createRequest); return ok(IdResponseDtoToJSON(created)); }) @@ -126,7 +126,7 @@ export const EDC_FAKE_BACKEND: FetchAPI = async ( .url('pages/transfer-history-page/transfer-processes/*/asset') .on('GET', (transferProcessId) => { let asset = transferProcessAsset(transferProcessId); - return ok(AssetDtoToJSON(asset)); + return ok(UiAssetToJSON(asset)); }) .tryMatch(); 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 09532dbca..f972331e9 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 @@ -1,9 +1,8 @@ import { - AssetDto, TransferHistoryEntry, TransferHistoryPage, + UiAsset, } from '@sovity.de/edc-client'; -import {AssetProperties} from '../../asset-properties'; import {assets} from './asset-fake-service'; import {TestAssets} from './data/test-assets'; @@ -67,8 +66,8 @@ export let transferHistoryEntries: TransferHistoryEntry[] = [ contractAgreementId: 'test-asset-4-cd:f52a5d30-6356-4a55-a75a-3c45d7a88c3e', direction: 'PROVIDING', counterPartyConnectorEndpoint: 'https://sovity-demo2-edc/api/v1/ids/data', - assetName: TestAssets.full.properties[AssetProperties.name], - assetId: TestAssets.full.properties[AssetProperties.id], + assetName: TestAssets.full.name || TestAssets.full.assetId, + assetId: TestAssets.full.assetId, }, ]; @@ -78,20 +77,18 @@ export const transferHistoryPage = (): TransferHistoryPage => { }; }; -export const transferProcessAsset = (transferProcessId: string): AssetDto => { +export const transferProcessAsset = (transferProcessId: string): UiAsset => { let transfer = transferHistoryEntries.find( (it) => it.transferProcessId === transferProcessId, ); const assetId = transfer?.assetId ?? 'unknown'; const isProviding = transfer?.direction === 'PROVIDING'; - const dummyAsset: AssetDto = TestAssets.toAssetDto( + const dummyAsset: UiAsset = TestAssets.toAssetDto( TestAssets.dummyAsset(assetId), ); - const assetEntry = assets.find( - (it) => it.properties[AssetProperties.id] === assetId, - ); + const assetEntry = assets.find((it) => it.assetId === assetId); return isProviding && assetEntry ? TestAssets.toAssetDto(assetEntry) diff --git a/src/app/core/services/asset-entry-builder.ts b/src/app/core/services/asset-entry-builder.ts index 1561b158f..8fa491d37 100644 --- a/src/app/core/services/asset-entry-builder.ts +++ b/src/app/core/services/asset-entry-builder.ts @@ -1,28 +1,67 @@ -import {Injectable} from '@angular/core'; -import {AssetCreateRequest} from '@sovity.de/edc-client'; +import {Inject, Injectable} from '@angular/core'; +import {UiAssetCreateRequest} from '@sovity.de/edc-client'; import {AssetEditorDialogFormValue} from '../../routes/connector-ui/asset-page/asset-create-dialog/asset-editor-dialog-form-model'; -import {AssetPropertyMapper} from './asset-property-mapper'; +import {APP_CONFIG, AppConfig} from '../config/app-config'; import {DataAddressMapper} from './data-address-mapper'; @Injectable() export class AssetEntryBuilder { constructor( - private assetPropertyMapper: AssetPropertyMapper, + @Inject(APP_CONFIG) private config: AppConfig, private dataAddressMapper: DataAddressMapper, ) {} /** - * Build {@link AssetCreateRequest} from {@link AssetEditorDialogFormValue} + * Build {@link UiAssetCreateRequest} from {@link AssetEditorDialogFormValue} * * @param formValue form value * @return asset create dto */ buildAssetCreateRequest( formValue: AssetEditorDialogFormValue, - ): AssetCreateRequest { - let properties = this.assetPropertyMapper.buildProperties(formValue); + ): UiAssetCreateRequest { + let id = formValue.metadata?.id!; + let name = formValue.metadata?.name!; + let version = formValue.metadata?.version; + let description = formValue.metadata?.description; + let language = formValue.metadata?.language?.id; + let keywords = formValue.metadata?.keywords; + let licenseUrl = formValue.metadata?.standardLicense; + let creatorOrganizationName = this.config.curatorOrganizationName; + let publisherHomepage = formValue.metadata?.publisher; + let mediaType = formValue.metadata?.contentType; + + let dataCategory = formValue.advanced?.dataModel; + let dataSubcategory = formValue.advanced?.dataSubcategory?.id; + let transportMode = formValue.advanced?.transportMode?.id; + let geoReferenceMethod = formValue.advanced?.geoReferenceMethod; + let dataModel = formValue.advanced?.dataModel; + + let landingPageUrl = formValue.datasource?.httpUrl; + const dataAddressProperties = this.dataAddressMapper.buildDataAddressProperties(formValue.datasource); - return {properties, dataAddressProperties, privateProperties: {}}; + return { + id, + name, + language, + description, + creatorOrganizationName, + publisherHomepage, + licenseUrl, + version, + keywords, + mediaType, + landingPageUrl, + dataCategory, + dataSubcategory, + dataModel, + geoReferenceMethod, + transportMode, + dataAddressProperties, + additionalProperties: {}, + privateProperties: {}, + additionalJsonProperties: {}, + }; } } diff --git a/src/app/core/services/asset-property-mapper.ts b/src/app/core/services/asset-property-mapper.ts index 3ff3d3c8b..dbae21b6b 100644 --- a/src/app/core/services/asset-property-mapper.ts +++ b/src/app/core/services/asset-property-mapper.ts @@ -1,15 +1,10 @@ -import {Inject, Injectable} from '@angular/core'; -import {AssetEditorDialogFormValue} from '../../routes/connector-ui/asset-page/asset-create-dialog/asset-editor-dialog-form-model'; +import {Injectable} from '@angular/core'; +import {UiAsset} from '@sovity.de/edc-client'; import {DataCategorySelectItemService} from '../../routes/connector-ui/asset-page/data-category-select/data-category-select-item.service'; import {DataSubcategorySelectItemService} from '../../routes/connector-ui/asset-page/data-subcategory-select/data-subcategory-select-item.service'; import {LanguageSelectItemService} from '../../routes/connector-ui/asset-page/language-select/language-select-item.service'; import {TransportModeSelectItemService} from '../../routes/connector-ui/asset-page/transport-mode-select/transport-mode-select-item.service'; -import {ActiveFeatureSet} from '../config/active-feature-set'; -import {APP_CONFIG, AppConfig} from '../config/app-config'; -import {removeNullValues} from '../utils/record-utils'; -import {trimmedOrNull} from '../utils/string-utils'; -import {AssetProperties} from './asset-properties'; -import {Asset} from './models/asset'; +import {AdditionalAssetProperty, Asset} from './models/asset'; /** * Maps between EDC Asset and our type safe asset @@ -19,148 +14,76 @@ import {Asset} from './models/asset'; }) export class AssetPropertyMapper { constructor( - @Inject(APP_CONFIG) private config: AppConfig, private languageSelectItemService: LanguageSelectItemService, private transportModeSelectItemService: TransportModeSelectItemService, private dataCategorySelectItemService: DataCategorySelectItemService, private dataSubcategorySelectItemService: DataSubcategorySelectItemService, - private activeFeatureSet: ActiveFeatureSet, ) {} - buildAsset(opts: { - connectorEndpoint: string; - properties: Record; - }): Asset { - const props = opts.properties; - const lookup = (key: string, fn: (id: string) => T) => - props[key] ? fn(props[key]!) : null; - - const language = lookup(AssetProperties.language, (id) => - this.languageSelectItemService.findById(id), - ); - const dataCategory = lookup(AssetProperties.dataCategory, (id) => - this.dataCategorySelectItemService.findById(id), - ); - const dataSubcategory = lookup(AssetProperties.dataSubcategory, (id) => - this.dataSubcategorySelectItemService.findById(id), - ); - const transportMode = lookup(AssetProperties.transportMode, (id) => - this.transportModeSelectItemService.findById(id), - ); - const keywords = (props[AssetProperties.keywords] ?? '') - .split(',') - .map((it) => it.trim()) - .filter((it) => it); - - const id = props[AssetProperties.id] ?? 'no-id-was-set'; - const additionalProperties = this.buildAdditionalProperties(props); - - return { - id, - name: props[AssetProperties.name] ?? id, - version: props[AssetProperties.version], - contentType: props[AssetProperties.contentType], - originator: opts.connectorEndpoint, - originatorOrganization: - props[AssetProperties.curatorOrganizationName] ?? - 'Unknown Organization', - keywords, - description: props[AssetProperties.description], + buildAsset(opts: {uiAsset: UiAsset; connectorEndpoint: string}): Asset { + const { + additionalProperties, + additionalJsonProperties, + privateProperties, + privateJsonProperties, language, - publisher: props[AssetProperties.publisher], - standardLicense: props[AssetProperties.standardLicense], - endpointDocumentation: props[AssetProperties.endpointDocumentation], dataCategory, dataSubcategory, - dataModel: props[AssetProperties.dataModel], - geoReferenceMethod: props[AssetProperties.geoReferenceMethod], transportMode, - httpProxyMethod: this._parseBoolean( - props[AssetProperties.httpProxyMethod], - ), - httpProxyPath: this._parseBoolean(props[AssetProperties.httpProxyPath]), - httpProxyQueryParams: this._parseBoolean( - props[AssetProperties.httpProxyQueryParams], - ), - httpProxyBody: this._parseBoolean(props[AssetProperties.httpProxyBody]), - additionalProperties, - }; - } - - private buildAdditionalProperties(props: Record) { - const knownKeys = Object.values(AssetProperties); - return Object.entries(props) - .filter(([k, _]) => !knownKeys.includes(k)) - .map(([key, value]) => ({ - key, - value: value ?? '', - })); - } + ...assetProperties + } = opts.uiAsset; - buildProperties( - formValue: AssetEditorDialogFormValue, - ): Record { - const {metadata, advanced, datasource} = formValue; - const props: Record = {}; - props[AssetProperties.id] = trimmedOrNull(metadata?.id); - props[AssetProperties.name] = trimmedOrNull(metadata?.name); - props[AssetProperties.version] = trimmedOrNull(metadata?.version); - props[AssetProperties.curatorOrganizationName] = trimmedOrNull( - this.config.curatorOrganizationName, - ); - props[AssetProperties.keywords] = trimmedOrNull( - metadata?.keywords?.join(', '), - ); - props[AssetProperties.contentType] = trimmedOrNull(metadata?.contentType); - props[AssetProperties.description] = trimmedOrNull(metadata?.description); - props[AssetProperties.language] = metadata?.language?.id ?? null; + const languageSelectItem = + language == null + ? null + : this.languageSelectItemService.findById(language); + const dataCategorySelectItem = + dataCategory == null + ? null + : this.dataCategorySelectItemService.findById(dataCategory); + const dataSubcategorySelectItem = + dataSubcategory == null + ? null + : this.dataSubcategorySelectItemService.findById(dataSubcategory); + const transportModeSelectItem = + transportMode == null + ? null + : this.transportModeSelectItemService.findById(transportMode); - props[AssetProperties.publisher] = trimmedOrNull(metadata?.publisher); - props[AssetProperties.standardLicense] = trimmedOrNull( - metadata?.standardLicense, - ); - props[AssetProperties.endpointDocumentation] = trimmedOrNull( - metadata?.endpointDocumentation, - ); + return { + ...assetProperties, + additionalProperties: this.buildAdditionalProperties(opts.uiAsset), + language: languageSelectItem, + dataCategory: dataCategorySelectItem, + dataSubcategory: dataSubcategorySelectItem, + transportMode: transportModeSelectItem, + connectorEndpoint: opts.connectorEndpoint, + }; + } - if (this.activeFeatureSet.hasMdsFields()) { - props[AssetProperties.dataCategory] = advanced?.dataCategory?.id ?? null; - props[AssetProperties.dataSubcategory] = - advanced?.dataSubcategory?.id ?? null; - props[AssetProperties.dataModel] = trimmedOrNull(advanced?.dataModel); - props[AssetProperties.geoReferenceMethod] = trimmedOrNull( - advanced?.geoReferenceMethod, - ); - props[AssetProperties.transportMode] = - advanced?.transportMode?.id ?? null; - } + buildAdditionalProperties(asset: UiAsset): AdditionalAssetProperty[] { + let result: AdditionalAssetProperty[] = []; + type AssetKey = + | 'additionalProperties' + | 'additionalJsonProperties' + | 'privateProperties' + | 'privateJsonProperties'; - if (datasource?.dataAddressType === 'Http') { - props[AssetProperties.httpProxyMethod] = this._encodeBoolean( - datasource?.httpProxyMethod, - ); - props[AssetProperties.httpProxyPath] = this._encodeBoolean( - datasource?.httpProxyPath, - ); - props[AssetProperties.httpProxyQueryParams] = this._encodeBoolean( - datasource?.httpProxyQueryParams, - ); - props[AssetProperties.httpProxyBody] = this._encodeBoolean( - datasource?.httpProxyBody, - ); - } + const propertiesToConvert: AssetKey[] = [ + 'additionalProperties', + 'additionalJsonProperties', + 'privateProperties', + 'privateJsonProperties', + ]; - return removeNullValues(props); - } - - private _parseBoolean(value: string | null): boolean | null { - if (!value) { - return null; + for (let propName of propertiesToConvert) { + const propValue = asset[propName]; + if (propValue) { + for (let key in propValue) { + result.push({key: key, value: propValue[key]}); + } + } } - return value === 'true'; - } - - private _encodeBoolean(value?: boolean | null): string { - return value ? 'true' : 'false'; + return result; } } diff --git a/src/app/core/services/asset-service-mapped.ts b/src/app/core/services/asset-service-mapped.ts index 1aee8348f..3a6aade51 100644 --- a/src/app/core/services/asset-service-mapped.ts +++ b/src/app/core/services/asset-service-mapped.ts @@ -22,10 +22,10 @@ export class AssetServiceMapped { fetchAssets(): Observable { return this.edcApiService.getAssetPage().pipe( map((assetPage) => - assetPage.assets.map((asset) => + assetPage.assets.map((uiAsset) => this.assetPropertyMapper.buildAsset({ connectorEndpoint: this.config.connectorEndpoint, - properties: asset.properties, + uiAsset, }), ), ), diff --git a/src/app/core/services/contract-definition-builder.ts b/src/app/core/services/contract-definition-builder.ts index 48f4bc1ef..d51e31c9a 100644 --- a/src/app/core/services/contract-definition-builder.ts +++ b/src/app/core/services/contract-definition-builder.ts @@ -1,7 +1,7 @@ import {Injectable} from '@angular/core'; import { ContractDefinitionRequest, - UiCriterionLiteralDtoTypeEnum, + UiCriterionLiteralTypeEnum, } from '@sovity.de/edc-client'; import {ContractDefinitionEditorDialogFormValue} from '../../routes/connector-ui/contract-definition-page/contract-definition-editor-dialog/contract-definition-editor-dialog-form-model'; import {AssetProperties} from './asset-properties'; @@ -28,8 +28,8 @@ export class ContractDefinitionBuilder { operandLeft: AssetProperties.id, operator: 'IN', operandRight: { - type: UiCriterionLiteralDtoTypeEnum.ValueList, - valueList: formValue.assets!.map((it) => it.id), + type: UiCriterionLiteralTypeEnum.ValueList, + valueList: formValue.assets!.map((it) => it.assetId), }, }, ], diff --git a/src/app/core/services/http-params-mapper.service.ts b/src/app/core/services/http-params-mapper.service.ts index 4f2ba77b0..52a71b523 100644 --- a/src/app/core/services/http-params-mapper.service.ts +++ b/src/app/core/services/http-params-mapper.service.ts @@ -33,13 +33,17 @@ export class HttpRequestParamsMapper { const contentType = value.httpProxiedBodyContentType?.trim() || null; let proxyMethod = - value.showAllHttpParameterizationFields || asset.httpProxyMethod; + value.showAllHttpParameterizationFields || + asset.httpDatasourceHintsProxyMethod; let proxyPath = - value.showAllHttpParameterizationFields || asset.httpProxyPath; + value.showAllHttpParameterizationFields || + asset.httpDatasourceHintsProxyPath; let proxyQueryParams = - value.showAllHttpParameterizationFields || asset.httpProxyQueryParams; + value.showAllHttpParameterizationFields || + asset.httpDatasourceHintsProxyQueryParams; let proxyBody = - value.showAllHttpParameterizationFields || asset.httpProxyBody; + value.showAllHttpParameterizationFields || + asset.httpDatasourceHintsProxyBody; return removeNullValues({ method: proxyMethod ? method : null, diff --git a/src/app/core/services/models/asset.ts b/src/app/core/services/models/asset.ts index e3b131692..c08f5ecdd 100644 --- a/src/app/core/services/models/asset.ts +++ b/src/app/core/services/models/asset.ts @@ -1,3 +1,4 @@ +import {UiAsset} from '@sovity.de/edc-client'; import {DataCategorySelectItem} from '../../../routes/connector-ui/asset-page/data-category-select/data-category-select-item'; import {DataSubcategorySelectItem} from '../../../routes/connector-ui/asset-page/data-subcategory-select/data-subcategory-select-item'; import {LanguageSelectItem} from '../../../routes/connector-ui/asset-page/language-select/language-select-item'; @@ -8,37 +9,29 @@ import {TransportModeSelectItem} from '../../../routes/connector-ui/asset-page/t * * Also includes full items / labels for fixed vocabulary values, e.g. language */ -export interface Asset { - id: string; - name: string; - version: string | null; - contentType: string | null; - originator: string | null; - originatorOrganization: string | null; - keywords: string[]; +export type Asset = Omit< + UiAsset, + | 'language' + | 'dataCategory' + | 'dataSubcategory' + | 'transportMode' + | 'additionalProperties' + | 'additionalJsonProperties' + | 'privateProperties' + | 'privateJsonProperties' +> & { + connectorEndpoint: string; - description: string | null; language: LanguageSelectItem | null; - publisher: string | null; - standardLicense: string | null; - endpointDocumentation: string | null; // MDS Specific dataCategory: DataCategorySelectItem | null; dataSubcategory: DataSubcategorySelectItem | null; - dataModel: string | null; - geoReferenceMethod: string | null; transportMode: TransportModeSelectItem | null; - // HTTP Parameterization Metadata - httpProxyMethod: boolean | null; - httpProxyPath: boolean | null; - httpProxyQueryParams: boolean | null; - httpProxyBody: boolean | null; - // Unhandled Additional Properties additionalProperties: AdditionalAssetProperty[]; -} +}; export interface AdditionalAssetProperty { key: string; diff --git a/src/app/core/services/models/contract-offer-dto.ts b/src/app/core/services/models/contract-offer-dto.ts index 7bf30c169..e47bf7901 100644 --- a/src/app/core/services/models/contract-offer-dto.ts +++ b/src/app/core/services/models/contract-offer-dto.ts @@ -1,5 +1,5 @@ +import {UiAsset} from '@sovity.de/edc-client'; import {Policy} from '../api/legacy-managent-api-client'; -import {AssetDto} from './asset-dto'; /** * Contract Offer (API Model) @@ -9,5 +9,5 @@ export interface ContractOfferDto { policy: Policy; provider: string; consumer: string; - asset: AssetDto; + asset: UiAsset; } diff --git a/src/app/core/utils/search-utils.ts b/src/app/core/utils/search-utils.ts index 287bcceed..ea2bf2cb2 100644 --- a/src/app/core/utils/search-utils.ts +++ b/src/app/core/utils/search-utils.ts @@ -30,5 +30,5 @@ export function search( * @param asset */ export function assetSearchTargets(asset: Asset): (string | null)[] { - return [asset.id, asset.name, ...asset.keywords]; + return [asset.assetId, asset.name, ...(asset.keywords ?? [])]; } diff --git a/src/app/routes/broker-ui/catalog-page/catalog-page/mapping/broker-catalog-mapper.ts b/src/app/routes/broker-ui/catalog-page/catalog-page/mapping/broker-catalog-mapper.ts index ae712e881..e376b3f7e 100644 --- a/src/app/routes/broker-ui/catalog-page/catalog-page/mapping/broker-catalog-mapper.ts +++ b/src/app/routes/broker-ui/catalog-page/catalog-page/mapping/broker-catalog-mapper.ts @@ -23,7 +23,10 @@ export class BrokerCatalogMapper { ...offer, asset: this.assetPropertyMapper.buildAsset({ connectorEndpoint: offer.connectorEndpoint, - properties: offer.properties, + uiAsset: { + assetId: offer.properties['asset:prop:id'], + name: offer.properties['asset:prop:id'], + }, }), }; } 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/data-offer-cards/data-offer-cards.component.html index 512664537..6992bcffa 100644 --- a/src/app/routes/broker-ui/catalog-page/data-offer-cards/data-offer-cards.component.html +++ b/src/app/routes/broker-ui/catalog-page/data-offer-cards/data-offer-cards.component.html @@ -14,7 +14,7 @@ {{ asset.name }} - {{ asset.originatorOrganization }} + {{ asset.creatorOrganizationName }} @@ -25,7 +25,7 @@
-
+
{{ asset.version diff --git a/src/app/routes/connector-ui/asset-page/asset-cards/asset-cards.component.html b/src/app/routes/connector-ui/asset-page/asset-cards/asset-cards.component.html index 3eddc3448..052a6e926 100644 --- a/src/app/routes/connector-ui/asset-page/asset-cards/asset-cards.component.html +++ b/src/app/routes/connector-ui/asset-page/asset-cards/asset-cards.component.html @@ -9,7 +9,7 @@ {{ asset.name }} - {{ asset.originatorOrganization }} + {{ asset.creatorOrganizationName }} @@ -18,7 +18,7 @@
-
+
{{ asset.version diff --git a/src/app/routes/connector-ui/asset-page/asset-create-dialog/asset-create-dialog.component.ts b/src/app/routes/connector-ui/asset-page/asset-create-dialog/asset-create-dialog.component.ts index 71a6966ed..b3542a0fa 100644 --- a/src/app/routes/connector-ui/asset-page/asset-create-dialog/asset-create-dialog.component.ts +++ b/src/app/routes/connector-ui/asset-page/asset-create-dialog/asset-create-dialog.component.ts @@ -39,13 +39,13 @@ export class AssetCreateDialogComponent implements OnDestroy { onSave() { const formValue = this.form.value; - const assetEntry = + const uiAssetCreateRequest = this.assetEntryBuilder.buildAssetCreateRequest(formValue); this.form.all.disable(); this.loading = true; this.edcApiService - .createAsset(assetEntry) + .createAsset(uiAssetCreateRequest) .pipe( takeUntil(this.ngOnDestroy$), finalize(() => { diff --git a/src/app/routes/connector-ui/asset-page/asset-create-dialog/assets-id-validator-builder.ts b/src/app/routes/connector-ui/asset-page/asset-create-dialog/assets-id-validator-builder.ts index 32c641ffc..8776d6f84 100644 --- a/src/app/routes/connector-ui/asset-page/asset-create-dialog/assets-id-validator-builder.ts +++ b/src/app/routes/connector-ui/asset-page/asset-create-dialog/assets-id-validator-builder.ts @@ -30,6 +30,6 @@ export class AssetsIdValidatorBuilder { private fetchAssetIds(): Observable> { return this.assetServiceMapped .fetchAssets() - .pipe(map((assets) => new Set(assets.map((asset) => asset.id)))); + .pipe(map((assets) => new Set(assets.map((asset) => asset.assetId)))); } } 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 7365af173..13ec5226b 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 @@ -19,8 +19,8 @@ export class ContractAgreementCardMappedService { contractAgreement: ContractAgreementCard, ): ContractAgreementCardMapped { let asset = this.assetPropertyMapper.buildAsset({ + uiAsset: contractAgreement.asset, connectorEndpoint: contractAgreement.counterPartyAddress, - properties: contractAgreement.asset.properties, }); return { 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 b03f5ba1c..f1f533580 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 @@ -28,37 +28,37 @@ export class ContractAgreementTransferDialogComponent implements OnDestroy { get proxyMethod(): boolean { return ( this.showAllHttpParameterizationFields || - this.data.asset.httpProxyMethod == true + this.data.asset.httpDatasourceHintsProxyMethod == true ); } get proxyPath(): boolean { return ( this.showAllHttpParameterizationFields || - this.data.asset.httpProxyPath == true + this.data.asset.httpDatasourceHintsProxyPath == true ); } get proxyQueryParams(): boolean { return ( this.showAllHttpParameterizationFields || - this.data.asset.httpProxyQueryParams == true + this.data.asset.httpDatasourceHintsProxyQueryParams == true ); } get proxyBody(): boolean { return ( this.showAllHttpParameterizationFields || - this.data.asset.httpProxyBody == true + this.data.asset.httpDatasourceHintsProxyBody == true ); } get showHttpParameterizationToggleButton(): boolean { return ( - this.data.asset.httpProxyMethod !== true || - this.data.asset.httpProxyPath !== true || - this.data.asset.httpProxyQueryParams !== true || - this.data.asset.httpProxyBody !== true + this.data.asset.httpDatasourceHintsProxyMethod !== true || + this.data.asset.httpDatasourceHintsProxyPath !== true || + this.data.asset.httpDatasourceHintsProxyQueryParams !== true || + this.data.asset.httpDatasourceHintsProxyBody !== true ); } @@ -123,9 +123,9 @@ export class ContractAgreementTransferDialogComponent implements OnDestroy { const customJson: any = JSON.parse( value.transferProcessRequest?.trim() ?? '', ); - customJson.assetId = this.data.asset.id; + customJson.assetId = this.data.asset.assetId; customJson.contractId = this.data.contractId; - customJson.connectorAddress = this.data.asset.originator; + customJson.connectorAddress = this.data.asset.connectorEndpoint; return { type: 'CUSTOM_JSON', @@ -139,7 +139,8 @@ export class ContractAgreementTransferDialogComponent implements OnDestroy { value, ); - let dataSinkProperties = this.dataAddressMapper.buildDataAddressProperties(value) ?? {}; + let dataSinkProperties = + this.dataAddressMapper.buildDataAddressProperties(value) ?? {}; return { type: 'PARAMS_ONLY', 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 fff2eb7b9..4ea383009 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 @@ -3,9 +3,9 @@ import { ContractDefinitionEntry, ContractDefinitionPage, PolicyDefinitionDto, - UiCriterionDto, + UiCriterion, } from '@sovity.de/edc-client'; -import {OPERATOR_SYMBOLS} from '../../../../core/services/api/policy-type-ext'; +import {CRITERION_OPERATOR_SYMBOLS} from '../../../../core/services/api/criterion-type-ext'; import {AssetProperties} from '../../../../core/services/asset-properties'; import {Asset} from '../../../../core/services/models/asset'; import {associateBy} from '../../../../core/utils/map-utils'; @@ -23,7 +23,7 @@ export class ContractDefinitionCardBuilder { assets: Asset[], policyDefinitions: PolicyDefinitionDto[], ): ContractDefinitionCard[] { - const assetById = associateBy(assets, (asset) => asset.id); + const assetById = associateBy(assets, (asset) => asset.assetId); const policyDefinitionById = associateBy( policyDefinitions, (policyDefinition) => policyDefinition.policyDefinitionId, @@ -73,7 +73,7 @@ export class ContractDefinitionCardBuilder { }; } - private extractCriterionOperation(criterion: UiCriterionDto): string { + private extractCriterionOperation(criterion: UiCriterion): string { const {operandLeft, operator} = criterion; if ( operandLeft.toLowerCase() === AssetProperties.id.toLowerCase() && @@ -82,12 +82,12 @@ export class ContractDefinitionCardBuilder { return 'Assets'; } - let operatorStr = OPERATOR_SYMBOLS[operator] ?? operator; + let operatorStr = CRITERION_OPERATOR_SYMBOLS[operator] ?? operator; return `${operandLeft} ${operatorStr}`; } private extractCriterionValues( - criterion: UiCriterionDto, + criterion: UiCriterion, assetsById: Map, ): ContractDefinitionCardCriterionValue[] { let {operandLeft, operandRight} = criterion; 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 695d4b9ab..b696a95dc 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 @@ -9,7 +9,11 @@ import { switchMap, } from 'rxjs'; import {catchError, map} from 'rxjs/operators'; -import {TransferHistoryEntry, TransferHistoryPage} from '@sovity.de/edc-client'; +import { + TransferHistoryEntry, + TransferHistoryPage, + UiAsset, +} from '@sovity.de/edc-client'; 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 {JsonDialogService} from '../../../../component-library/json-dialog/json-dialog/json-dialog.service'; @@ -62,12 +66,12 @@ export class TransferHistoryPageComponent implements OnInit, OnDestroy { return this.edcApiService .getTransferProcessAsset(item.transferProcessId) .pipe( - map((asset) => - this.assetPropertyMapper.buildAsset({ + map((uiAsset: UiAsset) => { + return this.assetPropertyMapper.buildAsset({ + uiAsset, connectorEndpoint: item.counterPartyConnectorEndpoint, - properties: asset.properties, - }), - ), + }); + }), ); }