forked from eclipse-edc/DataDashboard
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: migrate Broker UI to EDC 0 (#546)
- Loading branch information
1 parent
64a130f
commit 27aeaa9
Showing
70 changed files
with
1,002 additions
and
581 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
142 changes: 142 additions & 0 deletions
142
src/app/core/services/api/fake-backend/broker-fake-impl/catalog-fake-impl.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
import { | ||
CatalogContractOffer, | ||
CatalogDataOffer, | ||
CatalogPageQuery, | ||
CatalogPageResult, | ||
DataOfferDetailContractOffer, | ||
DataOfferDetailPageQuery, | ||
DataOfferDetailPageResult, | ||
UiAsset, | ||
} from '@sovity.de/broker-server-client'; | ||
import {subDays, subMinutes} from 'date-fns'; | ||
import {TestAssets} from '../connector-fake-impl/data/test-assets'; | ||
import {TestPolicies} from '../connector-fake-impl/data/test-policies'; | ||
|
||
const DATA_OFFERS: DataOfferDetailPageResult[] = [ | ||
{ | ||
assetId: TestAssets.full.assetId, | ||
asset: TestAssets.full as UiAsset, | ||
connectorEndpoint: 'https://example-connector/api/dsp', | ||
viewCount: 103, | ||
connectorOfflineSinceOrLastUpdatedAt: subMinutes(new Date(), 5), | ||
updatedAt: subMinutes(new Date(), 5), | ||
createdAt: subDays(new Date(), 7), | ||
connectorOnlineStatus: 'ONLINE', | ||
contractOffers: [ | ||
{ | ||
contractOfferId: 'contract-offer-1', | ||
updatedAt: subMinutes(new Date(), 5), | ||
createdAt: subDays(new Date(), 7), | ||
contractPolicy: TestPolicies.warnings, | ||
}, | ||
], | ||
}, | ||
{ | ||
assetId: TestAssets.withSuffix(TestAssets.boring, '2').assetId, | ||
asset: TestAssets.withSuffix(TestAssets.boring, '2') as UiAsset, | ||
connectorEndpoint: 'https://example-connector/api/dsp', | ||
viewCount: 103, | ||
connectorOfflineSinceOrLastUpdatedAt: subMinutes(new Date(), 5), | ||
updatedAt: subMinutes(new Date(), 5), | ||
createdAt: subDays(new Date(), 7), | ||
connectorOnlineStatus: 'OFFLINE', | ||
contractOffers: [ | ||
{ | ||
contractOfferId: 'contract-offer-1', | ||
updatedAt: subMinutes(new Date(), 5), | ||
createdAt: subDays(new Date(), 7), | ||
contractPolicy: TestPolicies.warnings, | ||
}, | ||
], | ||
}, | ||
{ | ||
assetId: TestAssets.boring.assetId, | ||
asset: TestAssets.boring as UiAsset, | ||
connectorEndpoint: 'https://example-connector/api/dsp', | ||
viewCount: 103, | ||
connectorOfflineSinceOrLastUpdatedAt: subDays(new Date(), 3), | ||
updatedAt: subMinutes(new Date(), 5), | ||
createdAt: subDays(new Date(), 7), | ||
connectorOnlineStatus: 'DEAD', | ||
contractOffers: [ | ||
{ | ||
contractOfferId: 'contract-offer-1', | ||
updatedAt: subMinutes(new Date(), 5), | ||
createdAt: subDays(new Date(), 7), | ||
contractPolicy: TestPolicies.warnings, | ||
}, | ||
], | ||
}, | ||
]; | ||
|
||
export const getCatalogPage = (query: CatalogPageQuery): CatalogPageResult => { | ||
const dataOffers: CatalogDataOffer[] = DATA_OFFERS.map(buildCatalogDataOffer); | ||
|
||
return { | ||
dataOffers, | ||
availableFilters: { | ||
fields: [ | ||
{ | ||
id: 'example-filter', | ||
title: 'Example Filter', | ||
values: [ | ||
{id: 'example-value', title: 'Example Value'}, | ||
{id: 'other-value', title: 'Other Value'}, | ||
{id: '', title: ''}, | ||
], | ||
}, | ||
{ | ||
id: 'other-filter', | ||
title: 'Other Filter', | ||
values: [ | ||
{id: 'example-value', title: 'Example Value'}, | ||
{id: 'other-value', title: 'Other Value'}, | ||
{id: '', title: ''}, | ||
], | ||
}, | ||
], | ||
}, | ||
paginationMetadata: { | ||
pageSize: 20, | ||
numVisible: dataOffers.length, | ||
pageOneBased: 0, | ||
numTotal: dataOffers.length, | ||
}, | ||
availableSortings: [ | ||
{sorting: 'TITLE', title: 'Test Sorting'}, | ||
{sorting: 'MOST_RECENT', title: 'Other Sorting'}, | ||
], | ||
}; | ||
}; | ||
|
||
export const getDataOfferDetailPage = ( | ||
query: DataOfferDetailPageQuery, | ||
): DataOfferDetailPageResult => { | ||
return DATA_OFFERS.find( | ||
(it) => | ||
it.connectorEndpoint === query.connectorEndpoint && | ||
it.assetId === query.assetId, | ||
)!; | ||
}; | ||
|
||
const buildCatalogDataOffer = ( | ||
it: DataOfferDetailPageResult, | ||
): CatalogDataOffer => ({ | ||
assetId: it.assetId, | ||
connectorEndpoint: it.connectorEndpoint, | ||
asset: it.asset, | ||
contractOffers: it.contractOffers.map(buildCatalogContractOffer), | ||
updatedAt: it.updatedAt, | ||
createdAt: it.createdAt, | ||
connectorOfflineSinceOrLastUpdatedAt: it.connectorOfflineSinceOrLastUpdatedAt, | ||
connectorOnlineStatus: it.connectorOnlineStatus, | ||
}); | ||
|
||
const buildCatalogContractOffer = ( | ||
co: DataOfferDetailContractOffer, | ||
): CatalogContractOffer => ({ | ||
contractOfferId: co.contractOfferId, | ||
contractPolicy: co.contractPolicy, | ||
createdAt: co.createdAt, | ||
updatedAt: co.updatedAt, | ||
}); |
Oops, something went wrong.