Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: migrating transfer history page to api wrapper #351

Merged
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
bc44910
feat: migrating transfer history page to api wrapper
AnurosePrakash Jul 12, 2023
4a11203
chore: run format and cleaned test data
AnurosePrakash Jul 12, 2023
585aa20
Merge branch 'main' into feat/transfer_history_page_migrations_to_api…
AnurosePrakash Jul 19, 2023
b254b76
chore: minor type additions and removing blank lines
AnurosePrakash Jul 19, 2023
4dfa4c5
feat: migrating transfer history page to api wrapper
AnurosePrakash Jul 12, 2023
5e7b91a
chore: run format and cleaned test data
AnurosePrakash Jul 12, 2023
50cff68
chore: minor type additions and removing blank lines
AnurosePrakash Jul 19, 2023
344a48a
chore: update in the edc-api.service.ts to consume new wrapper endpoints
AnurosePrakash Aug 8, 2023
ec28f36
Merge remote-tracking branch 'origin/feat/transfer_history_page_migra…
AnurosePrakash Aug 8, 2023
f796b4c
chore: updated the test data and renamed transfer history page object…
AnurosePrakash Aug 8, 2023
a1a0702
chore: minor refactorings - renaming variables and removing unwanted …
AnurosePrakash Aug 10, 2023
2bd44f3
Merge branch 'main' into feat/transfer_history_page_migrations_to_api…
AnurosePrakash Aug 11, 2023
aa248a3
chore: adding icons as per transfer process states and minor refactor…
AnurosePrakash Aug 14, 2023
6728faa
Merge branch 'main' into feat/transfer_history_page_migrations_to_api…
AnurosePrakash Aug 14, 2023
4d691c6
Merge branch 'main' of https://github.com/sovity/edc-ui into feat/tra…
AnurosePrakash Aug 14, 2023
975d288
Merge remote-tracking branch 'origin/feat/transfer_history_page_migra…
AnurosePrakash Aug 14, 2023
52dd8f9
fix: invalid date in test data
richardtreier Aug 14, 2023
24f5007
fix: dialog headers not working in transfer history page
richardtreier Aug 14, 2023
a70cfc3
Merge remote-tracking branch 'origin/feat/transfer_history_page_migra…
AnurosePrakash Aug 14, 2023
a9a8b4b
chore: adding polling to the transfer history page
AnurosePrakash Aug 14, 2023
0b092b7
chore: updating the dashboard page component to get data from transfe…
AnurosePrakash Aug 14, 2023
dbbb1f2
chore: updating icons on transfer-history-page.component.html
AnurosePrakash Aug 14, 2023
acadb0f
fix: issues with contract agreement page's asset detail dialog
richardtreier Aug 14, 2023
132b00d
chore: fix formatDateAgo nullability
richardtreier Aug 14, 2023
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ the detailed section referring to by linking pull requests or issues.

#### Changed

- Migrated transfer history page to api wrapper

#### Removed

#### Fixed
Expand Down
21 changes: 21 additions & 0 deletions fake-backend/json/transferHistoryAssetDetails.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"properties": {
"asset:prop:id": "urn:artifact:test-asset-1",
"asset:prop:name": "Test Asset 1",
"asset:prop:version": "1.1",
"asset:prop:originator": "https://example-connector.de/api/v1/ids/data",
"asset:prop:originatorOrganization": "Organization",
"asset:prop:keywords": "test, example",
"asset:prop:contenttype": "application/json",
"asset:prop:description": "Test asset for checking asset fetch in transfer history page",
"asset:prop:language": "https://w3id.org/idsa/code/EN",
"asset:prop:publisher": "https://my.cool-api.gg/about",
"asset:prop:standardLicense": "https://my.cool-api.gg/license",
"asset:prop:endpointDocumentation": "https://my.cool-api.gg/docs",
"http://w3id.org/mds#dataCategory": "Example",
"http://w3id.org/mds#dataSubcategory": "example-data",
"http://w3id.org/mds#dataModel": "data-model-001",
"http://w3id.org/mds#geoReferenceMethod": "example-reference-method",
"http://w3id.org/mds#transportMode": "Mode"
}
}
68 changes: 68 additions & 0 deletions fake-backend/json/transferHistoryPage.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"transferEntries": [
{
"transferProcessId": "339b2a27-3b66-49f5-8b43-6a400d5914b5",
"createdDate": "2022-01-20T11:18:59.659Z",
"lastUpdatedDate": "2022-06-25T11:18:59.659Z",
"state": {
"code": 800,
"name": "COMPLETED",
"simplifiedState": "OK"
},
"contractAgreementId": "test-asset-1-cd:f52a5d30-6356-4a55-a75a-3c45d7a88c3e",
"direction": "CONSUMING",
"counterPartyConnectorEndpoint": "https://sovity-demo4-mds/api/v1/ids/data",
"assetName": "Test Asset 1",
"assetId": "urn:artifact:test-asset-1",
"errorMessage": null
},
{
"transferProcessId": "1317d0da-cdc6-42ab-b54b-1f90bcfed508",
"createdDate": "2022-03-20T11:18:59.659Z",
"lastUpdatedDate": "2022-03-25T11:18:59.659Z",
"state": {
"code": -1,
"name": "ERROR",
"simplifiedState": "ERROR"
},
"contractAgreementId": "test-asset-2-cd:5816a60b-86c1-489a-b26a-ed129947f973",
"direction": "CONSUMING",
"counterPartyConnectorEndpoint": "http://edc2:11003/api/v1/ids/data",
"assetName": "Test Asset 2",
"assetId": "urn:artifact: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"
},
{
"transferProcessId": "81cdf4cf-8427-480f-9662-8a29d66ddd3b",
"createdDate": "2022-03-25T11:18:59.659Z",
"lastUpdatedDate": "2022-11-20T11:18:59.659Z",
"state": {
"code": 800,
"name": "COMPLETED",
"simplifiedState": "OK"
},
"contractAgreementId": "test-asset-3-cd:6ebbc301-9b1e-4cd7-9f17-97b5b7867531",
"direction": "CONSUMING",
"counterPartyConnectorEndpoint": "https://sovity-demo2-edc/api/v1/ids/data",
"assetName": "Test Asset 3",
"assetId": "urn:artifact:test-asset-3",
"errorMessage": null
},
{
"transferProcessId": "47240a35-d8fc-41d9-b020-07b87f3cc7b6",
"createdDate": "2023-01-29T11:18:59.659Z",
"lastUpdatedDate": "2023-02-29T11:18:59.659Z",
"state": {
"code": 600,
"name": "IN_PROGRESS",
"simplifiedState": "RUNNING"
},
"contractAgreementId": "test-asset-4-cd:f52a5d30-6356-4a55-a75a-3c45d7a88c3e",
"direction": "PROVIDING",
"counterPartyConnectorEndpoint": "https://sovity-demo2-edc/api/v1/ids/data",
"assetName": "Test Asset 4",
"assetId": "urn:artifact:test-asset-4",
"errorMessage": null
}
]
}
128 changes: 0 additions & 128 deletions fake-backend/json/transferProcess.json

This file was deleted.

20 changes: 15 additions & 5 deletions fake-backend/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@ app.get('/api/v1/data/contractdefinitions', (req, res) => {
res.json(contractDefinitions);
});

const transferProcess = json('json/transferProcess.json');
app.get('/api/v1/data/transferprocess', (req, res) => {
res.json(transferProcess);
});

const contractAgreements = json('json/contractAgreements.json');
app.get('/api/v1/data/contractagreements', (req, res) => {
res.json(contractAgreements);
Expand Down Expand Up @@ -106,6 +101,21 @@ app.get('/api/v1/data/wrapper/ui/pages/contract-agreement-page', (_, res) => {
res.json(contractAgreementPage);
});

const transferProcess = json('json/transferHistoryPage.json');
app.get('/api/v1/data/wrapper/ui/pages/transfer-history-page', (req, res) => {
res.json(transferProcess);
});

const transferHistoryAssetDetails = json(
'json/transferHistoryAssetDetails.json',
);
app.get(
'/api/v1/data/wrapper/ui/pages/transfer-history-page/transfer-processes/47240a35-d8fc-41d9-b020-07b87f3cc7b6/asset',
(req, res) => {
res.json(transferHistoryAssetDetails);
},
);

// Connector Limits
const connectorLimits = json('json/connectorLimits.json');
app.get('/api/v1/data/wrapper/ee/connector-limits', (_, res) => {
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.20230712.71619-main-a4860cff",
"@sovity.de/edc-client": "0.20230711.54203-main-f9c4b8f7",
"@sovity.de/edc-client": "0.20230807.130256-main-c3447970",
"clean-deep": "^3.4.0",
"date-fns": "^2.30.0",
"dotenv": "^16.3.1",
Expand Down
2 changes: 2 additions & 0 deletions src/app/component-library/ui-elements/ago/date-input.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export type DateInput = Date | string | null
AnurosePrakash marked this conversation as resolved.
Show resolved Hide resolved

7 changes: 5 additions & 2 deletions src/app/component-library/ui-elements/ago/formatDateAgo.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import {formatDistanceToNow} from 'date-fns';
import {DateInput} from "./date-input";

/**
* Formats date as "{n} {timeUnit} ago" or "in {n} {timeUnit}s".
* @param date date
*/
export function formatDateAgo(date?: Date | null): string {
export function formatDateAgo(date?: DateInput): string {
if (!date) {
return '';
}

if (typeof date === 'string') {
date = new Date(date);
}
return formatDistanceToNow(date, {addSuffix: true});
}
16 changes: 14 additions & 2 deletions src/app/core/services/api/edc-api.service.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import {Inject, Injectable} from '@angular/core';
import {Observable, from} from 'rxjs';
import {
AssetDto,
ConnectorLimits,
ContractAgreementPage,
ContractAgreementTransferRequest,
EdcClient,
IdResponseDto,
IdResponse,
TransferHistoryPage,
buildEdcClient,
} from '@sovity.de/edc-client';
import {APP_CONFIG, AppConfig} from '../../config/app-config';
Expand All @@ -27,12 +29,22 @@ export class EdcApiService {

initiateTranfer(
contractAgreementTransferRequest: ContractAgreementTransferRequest,
): Observable<IdResponseDto> {
): Observable<IdResponse> {
return from(
this.edcClient.uiApi.initiateTransfer({contractAgreementTransferRequest}),
);
}

getTransferHistoryPage(): Observable<TransferHistoryPage> {
return from(this.edcClient.uiApi.transferHistoryPageEndpoint());
}

getTransferProcessAsset(transferProcessId: string): Observable<AssetDto> {
return from(
this.edcClient.uiApi.getTransferProcessAsset({transferProcessId}),
);
}

getEnterpriseEditionConnectorLimits(): Observable<ConnectorLimits> {
return from(this.edcClient.enterpriseEditionApi.connectorLimits());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ import {
} from '@angular/common/http';
import {Inject, Injectable, Optional} from '@angular/core';
import {Observable} from 'rxjs';
// @ts-ignore
import {TransferProcessDto} from '../../../../core/services/models/transfer-history-entry';
import {Configuration} from '../configuration';
import {CustomHttpParameterCodec} from '../encoder';
// @ts-ignore
import {TransferId} from '../model/transferId';
// @ts-ignore
import {TransferProcessDto} from '../model/transferProcessDto';
// @ts-ignore
import {TransferRequestDto} from '../model/transferRequestDto';
// @ts-ignore
import {TransferState} from '../model/transferState';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {ContractAgreementCardMapped} from '../contract-agreement-cards/contract-
import {ContractAgreementCardMappedService} from '../contract-agreement-cards/contract-agreement-card-mapped.service';
import {ContractAgreementPageData} from './contract-agreement-page.data';


@Injectable({providedIn: 'root'})
export class ContractAgreementPageService {
constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export class ContractAgreementTransferDialogComponent implements OnDestroy {
type: 'PARAMS_ONLY',
params: {
contractAgreementId: this.data.contractId,
properties: transferRequestProperties,
privateProperties: transferRequestProperties,
AnurosePrakash marked this conversation as resolved.
Show resolved Hide resolved
dataSinkProperties,
},
};
Expand Down
Loading
Loading