forked from eclipse-edc/DataDashboard
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support multiple contract offers per data offer (#496)
- Loading branch information
1 parent
9d8ba39
commit dfa651c
Showing
19 changed files
with
333 additions
and
123 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
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
45 changes: 45 additions & 0 deletions
45
src/app/component-library/catalog/asset-detail-dialog/policy-property-field-builder.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,45 @@ | ||
import {Injectable} from '@angular/core'; | ||
import {UiPolicy} from '@sovity.de/edc-client'; | ||
import {PolicyCardBuilder} from '../../../routes/connector-ui/policy-definition-page/policy-cards/policy-card-builder'; | ||
import {JsonDialogService} from '../../json-dialog/json-dialog/json-dialog.service'; | ||
import {PropertyGridField} from '../../property-grid/property-grid/property-grid-field'; | ||
|
||
@Injectable() | ||
export class PolicyPropertyFieldBuilder { | ||
constructor( | ||
private policyCardBuilder: PolicyCardBuilder, | ||
private jsonDialogService: JsonDialogService, | ||
) {} | ||
|
||
buildPolicyPropertyFields( | ||
policy: UiPolicy, | ||
policyDetailDialogTitle: string, | ||
policyDetailDialogSubtitle: string, | ||
): PropertyGridField[] { | ||
let constraints = this.policyCardBuilder.buildPolicyCardConstraints(policy); | ||
let irregularities = policy.errors; | ||
return [ | ||
{ | ||
icon: 'policy', | ||
label: 'Policy', | ||
additionalClasses: 'whitespace-pre-line', | ||
text: [ | ||
...constraints.map((it) => `${it.left} ${it.operator} ${it.right}`), | ||
...irregularities, | ||
].join('\n'), | ||
}, | ||
{ | ||
icon: 'policy', | ||
label: 'Policy JSON-LD', | ||
text: 'Show JSON-LD', | ||
onclick: () => | ||
this.jsonDialogService.showJsonDetailDialog({ | ||
title: policyDetailDialogTitle, | ||
subtitle: policyDetailDialogSubtitle, | ||
icon: 'policy', | ||
objectForJson: JSON.parse(policy.policyJsonLd), | ||
}), | ||
}, | ||
]; | ||
} | ||
} |
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
44 changes: 44 additions & 0 deletions
44
...omponent-library/catalog/contract-offer-mini-list/contract-offer-mini-list.component.html
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,44 @@ | ||
<ng-container *ngIf="!contractOffers?.length"> | ||
<div class="flex flex-row flex-wrap property-grid-group-title"> | ||
Contract Offers | ||
</div> | ||
<i>No contract offers available.</i> | ||
</ng-container> | ||
|
||
<ng-container *ngFor="let contractOffer of contractOffers; let i = index"> | ||
<div | ||
class="flex flex-row items-center space-x-[5px] property-grid-group-title"> | ||
<span> Contract Offer {{ contractOffers.length >= 2 ? i + 1 : '' }} </span> | ||
|
||
<mat-progress-spinner | ||
*ngIf="contractNegotiationService.isBusy(contractOffer)" | ||
class="mat-icon-[14px]" | ||
diameter="14" | ||
color="primary" | ||
mode="indeterminate"> | ||
</mat-progress-spinner> | ||
</div> | ||
|
||
<property-grid | ||
[columns]="3" | ||
[props]="contractOffer.properties"></property-grid> | ||
|
||
<div *ngIf="contractOffers.length > 1" class="flex flex-row mt-[15px]"> | ||
<button | ||
mat-raised-button | ||
color="primary" | ||
[disabled]=" | ||
contractNegotiationService.negotiationState(contractOffer) != 'ready' | ||
" | ||
[ngSwitch]="contractNegotiationService.negotiationState(contractOffer)" | ||
(click)="negotiateClick.emit(contractOffer)"> | ||
<ng-container *ngSwitchCase="'ready'">Negotiate</ng-container> | ||
<ng-container *ngSwitchCase="'negotiating'"> | ||
Negotiating... | ||
</ng-container> | ||
<ng-container *ngSwitchCase="'negotiated'"> | ||
Successfully Negotiated | ||
</ng-container> | ||
</button> | ||
</div> | ||
</ng-container> |
27 changes: 27 additions & 0 deletions
27
.../component-library/catalog/contract-offer-mini-list/contract-offer-mini-list.component.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,27 @@ | ||
import { | ||
Component, | ||
EventEmitter, | ||
HostBinding, | ||
Input, | ||
Output, | ||
} from '@angular/core'; | ||
import {ContractNegotiationService} from '../../../core/services/contract-negotiation.service'; | ||
import {ContractOffer} from '../../../core/services/models/contract-offer'; | ||
|
||
@Component({ | ||
selector: 'contract-offer-mini-list', | ||
templateUrl: 'contract-offer-mini-list.component.html', | ||
}) | ||
export class ContractOfferMiniListComponent { | ||
@Input() | ||
contractOffers!: ContractOffer[]; | ||
|
||
@HostBinding('class.flex') | ||
@HostBinding('class.flex-col') | ||
cls = true; | ||
|
||
@Output() | ||
negotiateClick = new EventEmitter<ContractOffer>(); | ||
|
||
constructor(public contractNegotiationService: ContractNegotiationService) {} | ||
} |
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
Oops, something went wrong.