Skip to content

Commit

Permalink
feat: switch ContractAgreement to connector client (#116)
Browse files Browse the repository at this point in the history
feat: switch  to connector client
  • Loading branch information
ndr-brt authored Oct 19, 2023
1 parent d06017d commit d80cc00
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 370 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,43 @@
<mat-card *ngFor="let contract of contracts" class="contract-card">
<mat-card-header>
<mat-icon mat-card-avatar>attachment</mat-icon>
<mat-card-title>{{contract['@id']}}</mat-card-title>
<mat-card-title>{{contract.id}}</mat-card-title>
</mat-card-header>
<mat-card-content>
<mat-list>
<!-- asset -->
<mat-list-item>
<mat-icon mat-list-icon>category</mat-icon>
<div class="contract-property-header" mat-line>Asset</div>
<div class="contract-property-value" mat-line>{{contract["edc:assetId"]}}</div>
<div class="contract-property-value" mat-line>{{contract.assetId}}</div>
</mat-list-item>

<!-- provider -->
<mat-list-item>
<mat-icon mat-list-icon>person</mat-icon>
<div class="contract-property-header" mat-line>Provider</div>
<div class="contract-property-value" mat-line>{{contract["edc:providerId"]}}</div>
<div class="contract-property-value" mat-line>{{contract.providerId}}</div>
</mat-list-item>

<!-- sign date -->
<mat-list-item>
<mat-icon mat-list-icon>draw</mat-icon>
<div class="contract-property-header" mat-line>Signing date</div>
<div class="contract-property-value" mat-line>{{asDate(contract["edc:contractSigningDate"])}}</div>
<div class="contract-property-value" mat-line>{{asDate(contract.mandatoryValue('edc', 'contractSigningDate'))}}</div>
</mat-list-item>

<mat-divider inset></mat-divider>
<mat-card-actions class="card-actions">
<button (click)="onTransferClicked(contract)" [disabled]="isTransferInProgress(contract['@id']!)" color="accent"
<button (click)="onTransferClicked(contract)" [disabled]="isTransferInProgress(contract.id!)" color="accent"
mat-stroked-button>
<mat-icon>downloading</mat-icon>
Transfer
</button>
</mat-card-actions>
<mat-card-footer class="contract-card-footer">
<mat-progress-bar *ngIf="isTransferInProgress(contract['@id']!)" color="accent" mode="indeterminate"></mat-progress-bar>
<mat-progress-bar *ngIf="isTransferInProgress(contract.id!)" color="accent" mode="indeterminate"></mat-progress-bar>
</mat-card-footer>


</mat-list>
</mat-card-content>
</mat-card>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import {Component, Inject, OnInit} from '@angular/core';
import {
AssetService,
ContractAgreementDto,
ContractAgreementService, IdResponseDto,
TransferProcessService,
TransferRequestDto
} from "../../../mgmt-api-client";
import {from, Observable, of} from "rxjs";
import { Asset } from "@think-it-labs/edc-connector-client";
import { Asset, ContractAgreement } from "@think-it-labs/edc-connector-client";
import {ContractOffer} from "../../models/contract-offer";
import {filter, first, map, switchMap, tap} from "rxjs/operators";
import {NotificationService} from "../../services/notification.service";
Expand All @@ -32,7 +31,7 @@ interface RunningTransferProcess {
})
export class ContractViewerComponent implements OnInit {

contracts$: Observable<ContractAgreementDto[]> = of([]);
contracts$: Observable<ContractAgreement[]> = of([]);
private runningTransfers: RunningTransferProcess[] = [];
private pollingHandleTransfer?: any;

Expand Down Expand Up @@ -70,7 +69,7 @@ export class ContractViewerComponent implements OnInit {
return assetId ? this.assetService.getAsset(assetId): of();
}

onTransferClicked(contract: ContractAgreementDto) {
onTransferClicked(contract: ContractAgreement) {
const dialogRef = this.dialog.open(CatalogBrowserTransferDialog);

dialogRef.afterClosed().pipe(first()).subscribe(result => {
Expand All @@ -94,11 +93,11 @@ export class ContractViewerComponent implements OnInit {
return !!this.runningTransfers.find(rt => rt.contractId === contractId);
}

private createTransferRequest(contract: ContractAgreementDto, storageTypeId: string): Observable<TransferRequestDto> {
private createTransferRequest(contract: ContractAgreement, storageTypeId: string): Observable<TransferRequestDto> {
return this.getContractOfferForAssetId(contract["edc:assetId"]!).pipe(map(contractOffer => {
return {
assetId: contractOffer.assetId,
contractId: contract["@id"],
contractId: contract.id,
connectorId: "consumer", //doesn't matter, but cannot be null
dataDestination: {
"type": storageTypeId,
Expand Down
Loading

0 comments on commit d80cc00

Please sign in to comment.