Skip to content

Commit

Permalink
feat: Participant ID / Connector ID concept clean-up (#559)
Browse files Browse the repository at this point in the history
  • Loading branch information
richardtreier authored Dec 1, 2023
1 parent a68ebee commit 3ce9161
Show file tree
Hide file tree
Showing 29 changed files with 192 additions and 73 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ the detailed section referring to by linking pull requests or issues.

#### Minor

- MDS Connector UI: Renamed Participant IDs to MDS Connector IDs
- Connector Restricted Policy now supports entry of multiple connectors.
- New Transfer History Page Column: Participant ID / Connector ID

#### Patch

#### Deployment Migration Notes
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@ng-apimock/core": "^3.11.0",
"@ngxs/store": "^3.8.1",
"@sovity.de/broker-server-client": "0.20231117.82827-main-daa9d330",
"@sovity.de/edc-client": "0.20231013.91512-main-9754e5d2",
"@sovity.de/edc-client": "0.20231130.160808-main-b064eb10",
"clean-deep": "^3.4.0",
"date-fns": "^2.30.0",
"dotenv": "^16.3.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {CatalogContractOffer} from '@sovity.de/broker-server-client';
import {UiPolicy} from '@sovity.de/edc-client';
import {ActiveFeatureSet} from '../../../core/config/active-feature-set';
import {UiAssetMapped} from '../../../core/services/models/ui-asset-mapped';
import {ParticipantIdLocalization} from '../../../core/services/participant-id-localization';
import {CatalogDataOfferMapped} from '../../../routes/broker-ui/catalog-page/catalog-page/mapping/catalog-page-result-mapped';
import {ContractAgreementCardMapped} from '../../../routes/connector-ui/contract-agreement-page/contract-agreement-cards/contract-agreement-card-mapped';
import {JsonDialogService} from '../../json-dialog/json-dialog/json-dialog.service';
Expand All @@ -19,6 +20,7 @@ import {PolicyPropertyFieldBuilder} from './policy-property-field-builder';
@Injectable()
export class AssetPropertyGridGroupBuilder {
constructor(
private participantIdLocalization: ParticipantIdLocalization,
private activeFeatureSet: ActiveFeatureSet,
private propertyGridUtils: PropertyGridFieldService,
private jsonDialogService: JsonDialogService,
Expand Down Expand Up @@ -60,17 +62,17 @@ export class AssetPropertyGridGroupBuilder {
label: 'Standard License',
...this.propertyGridUtils.guessValue(asset.licenseUrl),
},
this.buildConnectorEndpointField(asset.connectorEndpoint),
{
icon: 'category',
label: this.participantIdLocalization.participantId,
...this.propertyGridUtils.guessValue(asset.participantId),
},
{
icon: 'account_circle',
label: 'Organization',
...this.propertyGridUtils.guessValue(asset.creatorOrganizationName),
},
{
icon: 'category',
label: 'Participant ID',
...this.propertyGridUtils.guessValue(asset.participantId),
},
this.buildConnectorEndpointField(asset.connectorEndpoint),
...this.buildHttpDatasourceFields(asset),
];

Expand Down Expand Up @@ -242,22 +244,22 @@ export class AssetPropertyGridGroupBuilder {
...this.propertyGridUtils.guessValue(contractAgreement.direction),
},
{
icon: 'link',
label: 'Other Connector Endpoint',
icon: 'category',
label: 'Contract Agreement ID',
...this.propertyGridUtils.guessValue(
contractAgreement.counterPartyAddress,
contractAgreement.contractAgreementId,
),
},
{
icon: 'link',
label: 'Other Connector Participant ID',
label: `Counter-Party ${this.participantIdLocalization.participantId}`,
...this.propertyGridUtils.guessValue(contractAgreement.counterPartyId),
},
{
icon: 'category',
label: 'Contract Agreement ID',
icon: 'link',
label: 'Counter-Party Connector Endpoint',
...this.propertyGridUtils.guessValue(
contractAgreement.contractAgreementId,
contractAgreement.counterPartyAddress,
),
},
];
Expand Down
5 changes: 4 additions & 1 deletion src/app/core/config/profiles/edc-ui-feature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ export type EdcUiFeature =
// Enables MDS Specific Asset Fields such as Data Category, Transport Mode
| 'mds-fields'

// Enables MDS Specific Connector ID support
| 'mds-connector-id'

// Enables support functionalities of connectors commercially hosted by sovity.
| 'sovity-zammad-integration'

Expand All @@ -15,4 +18,4 @@ export type EdcUiFeature =
| 'connector-limits'

// Enterprise Edition specific flag to enable marketing for other Enterprise Edition variants in basic connectors
| 'mds-ee-basic-marketing';
| 'mds-marketing';
11 changes: 6 additions & 5 deletions src/app/core/config/profiles/edc-ui-profile-data.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {MDS_THEME, SOVITY_THEME} from './edc-ui-theme-data';
import {COMMUNITY_EDITION_FEATURES} from './feature-sets/community-edition-features';
import {ENTERPRISE_EDITION_FEATURES} from './feature-sets/enterprise-edition-features';
import {MDS_FEATURES} from './feature-sets/mds-features';
import {inferEdcUiProfileType} from './infer-edc-ui-profile-type';

/**
Expand All @@ -22,25 +23,25 @@ export const EDC_UI_PROFILE_DATA = inferEdcUiProfileType({
'mds-open-source': {
...MDS_THEME,
routes: 'connector-ui',
features: new Set(['mds-fields', ...COMMUNITY_EDITION_FEATURES]),
features: new Set([...MDS_FEATURES, ...COMMUNITY_EDITION_FEATURES]),
},
'mds-hosted-by-sovity': {
...MDS_THEME,
routes: 'connector-ui',
features: new Set([
'mds-fields',
'mds-ee-basic-marketing',
'mds-marketing',
...MDS_FEATURES,
...ENTERPRISE_EDITION_FEATURES,
]),
},
'mds-blue-hosted-by-sovity': {
...SOVITY_THEME,
routes: 'connector-ui',
features: new Set(['mds-fields', ...ENTERPRISE_EDITION_FEATURES]),
features: new Set([...MDS_FEATURES, ...ENTERPRISE_EDITION_FEATURES]),
},
broker: {
...MDS_THEME,
routes: 'broker-ui',
features: new Set(['mds-fields']),
features: new Set(MDS_FEATURES),
},
});
3 changes: 3 additions & 0 deletions src/app/core/config/profiles/feature-sets/mds-features.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import {EdcUiFeature} from '../edc-ui-feature';

export const MDS_FEATURES: EdcUiFeature[] = ['mds-connector-id', 'mds-fields'];
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const createAsset = (asset: UiAssetCreateRequest): IdResponseDto => {
assetId: asset.id,
title: asset.title ?? asset.id,
connectorEndpoint: 'https://my-connector/api/dsp',
participantId: 'my-connector',
participantId: 'MDSL1234XX.C1234XX',
description: asset.description,
creatorOrganizationName: 'My Org',
publisherHomepage: asset.publisherHomepage,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {TestPolicies} from './data/test-policies';
let dataOffers: UiDataOffer[] = [
{
endpoint: 'http://existing-other-connector/api/dsp',
participantId: 'existing-other-connector',
participantId: 'MDSL1234XX.C1234XX',
asset: TestAssets.full,
contractOffers: [
{
Expand All @@ -23,7 +23,7 @@ let dataOffers: UiDataOffer[] = [
{
endpoint: 'http://existing-other-connector/api/dsp',
asset: TestAssets.boring,
participantId: 'existing-other-connector',
participantId: 'MDSL1234XX.C1234XX',
contractOffers: [
{
contractOfferId: 'test-contract-offer-3',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ let contractAgreements: ContractAgreementCard[] = [
'my-own-asset-neg:f52a5d30-6356-4a55-a75a-3c45d7a88c3e',
direction: 'PROVIDING',
counterPartyAddress: 'http://edc2:11003/api/v1/ids/data',
counterPartyId: 'urn:connector:example-connector',
counterPartyId: 'MDSL1234XX.C1234XX',
contractSigningDate: new Date('2022-03-20T11:18:59.659Z'),
asset: TestAssets.full,
contractPolicy: TestPolicies.connectorRestricted,
Expand Down Expand Up @@ -67,7 +67,7 @@ let contractAgreements: ContractAgreementCard[] = [
'my-test-asset-neg:6ebbc301-9b1e-4cd7-9f17-97b5b7867531',
direction: 'CONSUMING',
counterPartyAddress: 'http://edc2:11003/api/v1/ids/data',
counterPartyId: 'my-connector',
counterPartyId: 'MDSL1234XX.C1234XX',
contractSigningDate: new Date('2022-03-25T11:18:59.659Z'),
asset: TestAssets.toDummyAsset(TestAssets.boring),
contractPolicy: TestPolicies.connectorRestricted,
Expand All @@ -90,7 +90,7 @@ let contractAgreements: ContractAgreementCard[] = [
'my-test-asset-2-neg:6ebbc301-9b1e-4cd7-9f17-08b5b7867533',
direction: 'CONSUMING',
counterPartyAddress: 'http://edc2:11003/api/v1/ids/data',
counterPartyId: 'my-connector',
counterPartyId: 'MDSL1234XX.C1234XX',
contractSigningDate: new Date('2022-03-25T11:18:59.659Z'),
asset: TestAssets.toDummyAsset(TestAssets.boring),
contractPolicy: TestPolicies.connectorRestricted,
Expand All @@ -102,7 +102,7 @@ let contractAgreements: ContractAgreementCard[] = [
'my-test-asset-neg:6ebbc301-9b1e-4cd7-9f17-97b5b786752',
direction: 'CONSUMING',
counterPartyAddress: 'http://edc2:11003/api/v1/ids/data',
counterPartyId: 'my-connector',
counterPartyId: 'MDSL1234XX.C1234XX',
contractSigningDate: new Date('2022-03-25T11:18:59.659Z'),
asset: TestAssets.toDummyAsset(TestAssets.boring),
contractPolicy: TestPolicies.connectorRestricted,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const dashboardPage = (): DashboardPage => ({
numError: 0,
numRunning: 0,
},
connectorParticipantId: 'my-connector',
connectorParticipantId: 'MDSL1234XX.C1234XX',
connectorTitle: 'My Connector',
connectorDescription: 'Example Connector with Fake Backend',
connectorMaintainerName: 'sovity GmbH',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ export namespace TestAssets {
assetId: 'data-sample-ckd-skd-demands-2023-Jan',
title: 'data-sample-ckd-skd-demands-2023-Jan',
connectorEndpoint: 'https://my-other-connector/api/dsp',
participantId: 'my-other-connector',
participantId: 'MDSL1234XX.C1234XX',
creatorOrganizationName: 'my-other-connector',
};

export const full: UiAsset = {
assetId: 'ckd-skd-demands-2023-Jan',
title: 'CKD / SKD Demands January 2023',
connectorEndpoint: 'https://my-other-connector/api/dsp',
participantId: 'my-other-connector',
participantId: 'MDSL1234XX.C1234XX',
version: '2023-A-Program',
creatorOrganizationName: 'My-German-OEM',
keywords: ['automotive', 'part-demands', '2023', 'January'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export namespace TestPolicies {
{
left: 'REFERRING_CONNECTOR',
operator: 'EQ',
right: {type: 'STRING', value: 'https://my-other-connector'},
right: {type: 'STRING', value: 'MDSL1234XX.C1234XX'},
},
]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ let transferHistoryEntries: TransferHistoryEntry[] = [
contractAgreementId: 'test-asset-1-cd:f52a5d30-6356-4a55-a75a-3c45d7a88c3e',
direction: 'CONSUMING',
counterPartyConnectorEndpoint: 'https://sovity-demo4-mds/api/v1/ids/data',
assetName: 'urn:artifact:test-asset-1',
assetId: 'urn:artifact:test-asset-1',
counterPartyParticipantId: 'MDSL1234XX.C1234XX',
assetName: 'test-asset-1',
assetId: 'test-asset-1',
},
{
transferProcessId: '1317d0da-cdc6-42ab-b54b-1f90bcfed508',
Expand All @@ -32,10 +33,11 @@ let transferHistoryEntries: TransferHistoryEntry[] = [
simplifiedState: 'ERROR',
},
contractAgreementId: 'test-asset-2-cd:5816a60b-86c1-489a-b26a-ed129947f973',
counterPartyParticipantId: 'MDSL1234XX.C1234XX',
direction: 'CONSUMING',
counterPartyConnectorEndpoint: 'http://edc2:11003/api/v1/ids/data',
assetName: 'urn:artifact:test-asset-2',
assetId: 'urn:artifact:test-asset-2',
assetName: 'test-asset-2',
assetId: 'test-asset-2',
errorMessage:
'TransferProcessManager: attempt #8 failed to send transfer. Retry limit exceeded, TransferProcess 1317d0da-cdc6-42ab-b54b-1f90bcfed508 moves to ERROR state. Cause: java.net.SocketException: Connection reset',
},
Expand All @@ -51,8 +53,9 @@ let transferHistoryEntries: TransferHistoryEntry[] = [
contractAgreementId: 'test-asset-3-cd:6ebbc301-9b1e-4cd7-9f17-97b5b7867531',
direction: 'CONSUMING',
counterPartyConnectorEndpoint: 'https://sovity-demo2-edc/api/v1/ids/data',
assetName: 'urn:artifact:test-asset-3',
assetId: 'urn:artifact:test-asset-3',
counterPartyParticipantId: 'MDSL1234XX.C1234XX',
assetName: 'test-asset-3',
assetId: 'test-asset-3',
},
{
transferProcessId: '47240a35-d8fc-41d9-b020-07b87f3cc7b6',
Expand All @@ -66,6 +69,7 @@ let transferHistoryEntries: TransferHistoryEntry[] = [
contractAgreementId: 'test-asset-4-cd:f52a5d30-6356-4a55-a75a-3c45d7a88c3e',
direction: 'PROVIDING',
counterPartyConnectorEndpoint: 'https://sovity-demo2-edc/api/v1/ids/data',
counterPartyParticipantId: 'MDSL1234XX.C1234XX',
assetName: TestAssets.full.title,
assetId: TestAssets.full.assetId,
},
Expand Down
2 changes: 1 addition & 1 deletion src/app/core/services/api/model/policy-type-ext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const OPERATOR_SYMBOLS: Record<OperatorDto, string> = {
NEQ: '≠',
GEQ: '≥',
LEQ: '≤',
IN: '',
IN: 'IN',
HAS_PART: '`HAS_PART`',
IS_A: '`IS_A`',
IS_ALL_OF: '`IS_ALL_OF`',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ import {PropertyGridField} from '../../component-library/property-grid/property-
import {PropertyGridFieldService} from '../../component-library/property-grid/property-grid/property-grid-field.service';
import {LastCommitInfo} from './api/model/last-commit-info';
import {Fetched} from './models/fetched';
import {ParticipantIdLocalization} from './participant-id-localization';

@Injectable({providedIn: 'root'})
export class ConnectorInfoPropertyGridGroupBuilder {
constructor(
private participantIdLocalization: ParticipantIdLocalization,
private propertyGridUtils: PropertyGridFieldService,
private matDialog: MatDialog,
) {}
Expand Down Expand Up @@ -168,7 +170,7 @@ export class ConnectorInfoPropertyGridGroupBuilder {
},
{
icon: 'category',
label: 'Participant ID',
label: this.participantIdLocalization.participantId,
...this.propertyGridUtils.guessValue(data.connectorParticipantId),
},
{
Expand Down
14 changes: 14 additions & 0 deletions src/app/core/services/participant-id-localization.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import {Inject, Injectable} from '@angular/core';
import {APP_CONFIG, AppConfig} from '../config/app-config';

@Injectable({providedIn: 'root'})
export class ParticipantIdLocalization {
private mds = this.config.features.has('mds-connector-id');
participantId = this.mds ? 'Connector ID' : 'Participant ID';
participantIdPlural = this.participantId + 's';
participantIdPlaceholder = this.mds
? 'MDSL1234XX.C1234XX'
: 'other-connector-participant-id';

constructor(@Inject(APP_CONFIG) private config: AppConfig) {}
}
27 changes: 23 additions & 4 deletions src/app/core/services/policy-definition-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,31 @@ export class PolicyDefinitionBuilder {
private buildConnectorRestrictedConstraint(
formValue: NewPolicyDialogFormValue,
): UiPolicyConstraint {
return this.inOrEqIfOne(
PolicyLeftExpressions.ReferringConnector,
formValue.participantIds!,
);
}

private inOrEqIfOne(left: string, values: string[]): UiPolicyConstraint {
if (values.length === 1) {
const value = values[0];
return {
left,
operator: 'EQ',
right: {
type: 'STRING',
value,
},
};
}

return {
left: PolicyLeftExpressions.ReferringConnector,
operator: 'EQ',
left,
operator: 'IN',
right: {
type: 'STRING',
value: formValue.connectorId!,
type: 'STRING_LIST',
valueList: values,
},
};
}
Expand Down
Loading

0 comments on commit 3ce9161

Please sign in to comment.