Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ export default defineConfig({
{
connectorName: 'cypress',
managementUrl: 'http://test.connector/management',
managementApiVersion: 'v3',
defaultUrl: 'http://test.connector/api',
protocolUrl: 'http://test.connector/protocol',
federatedCatalogEnabled: true,
federatedCatalogUrl: 'http://fc.connector/catalog',
protocolVersion: 'dataspace-protocol-http:2025-1',
did: 'http://ih.connector/',
},
],
Expand Down
28 changes: 18 additions & 10 deletions cypress/e2e/catalog-view.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,21 @@ describe('catalog view e2e tests', () => {
const edcConfigs: EdcConfig[] = Cypress.env('edcConfig');
const edcConfig = edcConfigs[0];

const requestCatalog = () => {
cy.get('lib-catalog-request .btn').click();
cy.get('lib-catalog-request-form input[name="counterPartyId"]').type('did:web:test');
cy.get('lib-catalog-request-form input[name="counterPartyAddress"]').type('http://e2e');
cy.get('lib-catalog-request-form .btn').click();

cy.wait('@request');
};

beforeEach(() => {
cy.intercept('GET', `${Cypress.config('baseUrl')}/config/edc-connector-config.json`, {
body: edcConfigs,
statusCode: 200,
});

cy.intercept('POST', `${edcConfig.federatedCatalogUrl}/v1alpha/catalog/query?`, {
fixture: 'catalog/query-200.json',
statusCode: 200,
}).as('dataset');

cy.intercept('POST', `${edcConfig.managementUrl}/v3/catalog/request?`, {
fixture: 'catalog/query-200.json',
statusCode: 200,
Expand All @@ -48,27 +52,29 @@ describe('catalog view e2e tests', () => {
cy.get('ul.menu button').contains('book_ribbon').click();
});

it('shows federated catalog dataset', () => {
cy.get('lib-catalog-request').should('contain', 'Federated Catalog Enabled');
it('shows catalog dataset', () => {
cy.get('lib-catalog-request').should('contain', 'Request Manually');
cy.get('lib-catalog-request').should('not.contain', 'Federated Catalog Enabled');
cy.get('lib-pagination')
.should('have.length', 1)
.find('div.join > button')
.each($btn => {
cy.wrap($btn).should('be.disabled');
});

cy.wait('@dataset').then(() => {
cy.get('lib-catalog-card').should('have.length.at.least', 1);
});
requestCatalog();
cy.get('lib-catalog-card').should('have.length.at.least', 1);
});

it('can filter datasets', () => {
requestCatalog();
cy.get('lib-filter-input input').type('asset1');

cy.get('lib-catalog-card').should('have.length', 1);
});

it('can show details of dataset', () => {
requestCatalog();
cy.get('lib-catalog-card').first().contains('i', 'info').click();

cy.get('lib-jsonld-viewer').should('have.length.at.least', 1);
Expand Down Expand Up @@ -107,6 +113,7 @@ describe('catalog view e2e tests', () => {
});

it('should negotiate successfully', () => {
requestCatalog();
cy.get('lib-catalog-card').contains('Negotiate').click();
cy.get('lib-catalog-negotiation').should('exist');
cy.get('lib-catalog-negotiation button[type="submit"]').should('be.disabled');
Expand All @@ -127,6 +134,7 @@ describe('catalog view e2e tests', () => {
statusCode: 400,
}).as('negotiation');

requestCatalog();
cy.get('lib-catalog-card').contains('Negotiate').click();
cy.get('label').contains('Offer 1').click();
cy.get('lib-catalog-negotiation button[type="submit"]').click();
Expand Down
24 changes: 1 addition & 23 deletions cypress/e2e/transfer-history.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@ describe('transfer history view e2e tests', () => {
body: edcConfigs,
statusCode: 200,
});
//What to intercept here?
cy.intercept('POST', `${edcConfig.federatedCatalogUrl}/v1alpha/transferprocesses/query?`, {
cy.intercept('POST', `${edcConfig.managementUrl}/v1alpha/transferprocesses/query?`, {
fixture: 'transfer-history/query-200.json',
statusCode: 200,
}).as('dataset');
//What to intercept here?
cy.intercept('POST', `${edcConfig.managementUrl}/v3/transferprocesses/request?`, {
fixture: 'transfer-history/query-200.json',
statusCode: 200,
Expand Down Expand Up @@ -101,25 +99,5 @@ describe('transfer history view e2e tests', () => {
});
});

it('can delete transfer', () => {
cy.get('lib-transfer-history-table').first().contains('i', 'delete').click();
cy.get('lib-delete-confirm').contains('button', 'Delete').click();

cy.wait('@deprovision').then(() => {
cy.wait('@request').then(() => {
cy.get('lib-alert .alert-success').should('exist');
});
});
});

it('can cancel deprivision of transfer', () => {
cy.intercept('DELETE', `$edcConfig.managementUrl}/v3/transferprocesses/*/deprovision`, cy.spy().as('deleteSpy'));
cy.get('lib-transfer-history-table').first().contains('i', 'delete').click();
cy.get('lib-delete-confirm').contains('button', 'Cancel').click();

cy.get('@deleteSpy').should('not.have.been.called');
cy.get('lib-delete-confirm').should('not.exist');
cy.get('lib-alert .alert-success').should('not.exist');
});

});
12 changes: 6 additions & 6 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 @@ -27,7 +27,7 @@
"@angular/platform-browser": "^21.0.0",
"@angular/platform-browser-dynamic": "^21.0.0",
"@angular/router": "^21.0.0",
"@think-it-labs/edc-connector-client": "0.9.5",
"@think-it-labs/edc-connector-client": "0.10.0",
"material-symbols": "^0.44.10",
"mime": "^4.1.0",
"ngx-float-ui": "^21.0.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import { Component, EventEmitter, Input, OnChanges, Output, inject } from '@angu
import {
Asset,
AssetInput,
AssetInputV4,
BaseDataAddress,
compact,
DataAddress,
EdcConnectorClientError,
IdResponse,
Expand All @@ -28,6 +28,7 @@ import {
AlertComponent,
DataAddressFormComponent,
DataTypeInputComponent,
EdcClientService,
JsonObjectInputComponent,
JsonObjectTableComponent,
} from '@eclipse-edc/dashboard-core';
Expand All @@ -52,6 +53,7 @@ import { JsonValue } from '@angular-devkit/core';
export class AssetCreateComponent implements OnChanges {
private readonly assetService = inject(AssetService);
private readonly formBuilder = inject(FormBuilder);
private readonly edc = inject(EdcClientService);

@Input() asset?: Asset;
@Output() created = new EventEmitter<IdResponse>();
Expand Down Expand Up @@ -82,9 +84,9 @@ export class AssetCreateComponent implements OnChanges {
}

private async updateAssetAndSyncForm() {
this.properties = await compact(this.asset!.properties);
this.privateProperties = await compact(this.asset!.privateProperties);
this.dataAddress = (await compact(this.asset!.dataAddress)) as unknown as BaseDataAddress;
this.properties = await this.edc.compact(this.asset!.properties);
this.privateProperties = await this.edc.compact(this.asset!.privateProperties);
this.dataAddress = (await this.edc.compact(this.asset!.dataAddress)) as unknown as BaseDataAddress;
this.assetForm.get('id')?.setValue(this.asset!.id);
this.assetForm.get('name')?.setValue(this.properties['name']);
this.assetForm.get('contenttype')?.setValue(this.properties['contenttype']);
Expand Down Expand Up @@ -113,8 +115,9 @@ export class AssetCreateComponent implements OnChanges {
}
}

private createAssetInput(): AssetInput {
const asset: AssetInput = {
private createAssetInput(): AssetInputV4 {
const asset: AssetInputV4 = {
'@type': 'Asset',
dataAddress: this.dataAddress!,
properties: this.properties,
privateProperties: this.privateProperties,
Expand Down
4 changes: 2 additions & 2 deletions projects/dashboard-core/catalog/src/catalog.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ export class CatalogService {
}

/**
* Retrieves all catalogs from the federated catalog API.
* Retrieves all catalogs from the federated catalog cache via the management API.
* @returns A promise that resolves to an array of catalog.
*/
private async getAllFederatedCatalogs(): Promise<Catalog[]> {
return (await this.edc.getClient()).federatedCatalog.queryAll();
return (await this.edc.getClient()).management.catalogs.queryAll();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
*/

import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges, inject } from '@angular/core';
import { compact, EdcConnectorClientError, IdResponse } from '@think-it-labs/edc-connector-client';
import { EdcConnectorClientError, IdResponse } from '@think-it-labs/edc-connector-client';
import { AsyncPipe, NgClass } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { AlertComponent, JsonObjectTableComponent } from '@eclipse-edc/dashboard-core';
import { AlertComponent, EdcClientService, JsonObjectTableComponent } from '@eclipse-edc/dashboard-core';
import { CatalogService } from '../catalog.service';
import { ContractNegotiationRequest } from '@think-it-labs/edc-connector-client/dist/src/entities';
import { CatalogDataset } from '../catalog-dataset';
Expand All @@ -31,6 +31,7 @@ import { JsonValue } from '@angular-devkit/core';
})
export class ContractNegotiationComponent implements OnChanges {
private readonly catalogService = inject(CatalogService);
private readonly edc = inject(EdcClientService);

@Input() catalogDataset!: CatalogDataset;
@Output() negotiationRequested = new EventEmitter<IdResponse>();
Expand All @@ -50,7 +51,7 @@ export class ContractNegotiationComponent implements OnChanges {
private async loadDataset() {
if (this.catalogDataset) {
try {
this.dataset = await compact(this.catalogDataset.dataset);
this.dataset = await this.edc.compact(this.catalogDataset.dataset);
this.catalog = this.getCatalogAsRecord();
} catch (error) {
console.error('Error compacting dataset:', error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ export class ContractDefinitionCreateComponent implements OnInit, OnChanges {
});

const contractDefinition: ContractDefinitionInput = {
'@type': 'ContractDefinition',
accessPolicyId: this.contractDefinitionForm.value.accessPolicyId,
contractPolicyId: this.contractDefinitionForm.value.contractPolicyId,
assetsSelector: assetsSelector,
Expand Down
2 changes: 1 addition & 1 deletion projects/dashboard-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"@angular/common": "^21.0.0",
"@angular/core": "^21.0.0",
"@tailwindcss/postcss": "^4.0.0",
"@think-it-labs/edc-connector-client": "0.9.5",
"@think-it-labs/edc-connector-client": "0.10.0",
"daisyui": "^5.0.0",
"tailwindcss": "^4.0.0",
"postcss": "^8.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ import { Component, EventEmitter, Input, OnChanges, Output, inject } from '@angu
import { NgClass } from '@angular/common';
import { FormBuilder, FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms';
import { PolicyService } from '../policy.service';
import { AlertComponent } from '@eclipse-edc/dashboard-core';
import { AlertComponent, EdcClientService } from '@eclipse-edc/dashboard-core';
import { PolicyType } from '@think-it-labs/edc-connector-client/dist/src/entities/policy/policy';
import {
compact,
EdcConnectorClientError,
IdResponse,
PolicyBuilder,
Expand All @@ -38,6 +37,7 @@ import {
export class PolicyCreateComponent implements OnChanges {
private readonly policyService = inject(PolicyService);
private readonly formBuilder = inject(FormBuilder);
private readonly edc = inject(EdcClientService);

@Input() policyDefinition?: PolicyDefinition;

Expand Down Expand Up @@ -68,7 +68,7 @@ export class PolicyCreateComponent implements OnChanges {
this.mode = 'update';

const { policy } = this.policyDefinition;
const compactPolicy = await compact(policy);
const compactPolicy = await this.edc.compact<{ '@type': string }>(policy);
const typeSegments = compactPolicy['@type'].split('/');

this.policyForm.patchValue({
Expand Down Expand Up @@ -121,7 +121,10 @@ export class PolicyCreateComponent implements OnChanges {
.raw(policyInput)
.build();

const policyDefinitionInput: PolicyDefinitionInput = { policy };
const policyDefinitionInput: PolicyDefinitionInput = {
'@type': 'PolicyDefinition',
policy: policy,
};
if (id) {
policyDefinitionInput.id = id;
policyDefinitionInput['@id'] = id;
Expand All @@ -132,7 +135,7 @@ export class PolicyCreateComponent implements OnChanges {

/** Compacts a list of rules to a JSON string, or returns an empty string when there are none. */
private async rulesToJson(rules: unknown[]): Promise<string> {
return rules.length > 0 ? JSON.stringify(await compact(rules)) : '';
return rules.length > 0 ? JSON.stringify(await this.edc.compact(rules)) : '';
}

/** Parses a JSON rule field and assigns it to the policy input, throwing a labelled error on failure. */
Expand Down
4 changes: 2 additions & 2 deletions projects/dashboard-core/policies/src/policy.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ export class PolicyService {
*
* @param {string} policyDefinitionId - The unique identifier of the policy definition to update.
* @param {PolicyDefinitionInput} policyInput - The input containing the updated properties of the policy definition.
* @return {Promise<IdResponse>} A promise that resolves to the response containing the identifier of the updated policy definition.
* @return {Promise<void>} A promise that resolves once the policy definition has been updated.
*/
public async updatePolicy(policyDefinitionId: string, policyInput: PolicyDefinitionInput): Promise<IdResponse> {
public async updatePolicy(policyDefinitionId: string, policyInput: PolicyDefinitionInput): Promise<void> {
return (await this.edc.getClient()).management.policyDefinitions.update(policyDefinitionId, policyInput);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ describe('Test ConnectorConfigFormComponent', () => {
expect(wrapper.component.connectorForm.valid).to.be.false;
});
cy.get('input[formControlName="did"]').type('did:web:test');
cy.get('input[formControlName="identityUrl"]').type(url);
cy.get('input[formControlName="presentationUrl"]').type(url);
cy.then(() => {
expect(wrapper.component.connectorForm.valid).to.be.true;
});
Expand All @@ -71,9 +73,9 @@ describe('Test ConnectorConfigFormComponent', () => {
const edcConfig: EdcConfig = {
connectorName: 'Test Connector',
managementUrl: 'https://management.test',
managementApiVersion: 'v4',
defaultUrl: 'https://default.test',
protocolUrl: 'https://protocol.test',
federatedCatalogEnabled: false,
};

const mockHealthCheck = (component: any, resolve: boolean, success: boolean) => {
Expand Down
Loading
Loading