Skip to content

Commit 11aadbf

Browse files
committed
#422753 - Upgrade 'edc-connector-client' version. Adaptation of assets section
1 parent 2184e61 commit 11aadbf

File tree

16 files changed

+141
-58
lines changed

16 files changed

+141
-58
lines changed

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"@angular/platform-browser": "~17.0.8",
2727
"@angular/platform-browser-dynamic": "~17.0.8",
2828
"@angular/router": "~17.0.8",
29-
"@think-it-labs/edc-connector-client": "0.2.0",
29+
"@think-it-labs/edc-connector-client": "^0.3.0",
3030
"rxjs": "~7.8.1",
3131
"zone.js": "~0.14.2"
3232
},

src/app/app.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ import { HttpClientModule } from '@angular/common/http';
6767
},
6868
{
6969
provide: 'STORAGE_TYPES',
70-
useFactory: () => [{id: "AzureStorage", name: "AzureStorage"}, {id: "AmazonS3", name: "AmazonS3"}],
70+
useFactory: () => [{id: "HttpData", name: "HttpData"}, {id: "AmazonS3", name: "AmazonS3"}],
7171
},
7272
{
7373
provide: HTTP_INTERCEPTORS, multi: true, useFactory: () => {

src/app/pages/assets/asset-editor-dialog/asset-editor-dialog.component.html

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,28 +24,46 @@
2424
<div>
2525
<mat-form-field class="form-field" color="accent" id="form-field-destination">
2626
<mat-label>Destination</mat-label>
27-
<mat-select [(ngModel)]="storageTypeId" disabled>
27+
<mat-select [(ngModel)]="storageTypeId">
2828
<mat-option *ngFor="let storageType of storageTypes " [value]="storageType.id">
2929
{{storageType.name}}
3030
</mat-option>
3131
</mat-select>
3232
</mat-form-field>
33+
</div>
3334

34-
<mat-form-field class="form-field" color="accent" id="form-field-account">
35-
<mat-label>Account</mat-label>
36-
<input [(ngModel)]="account" matInput>
35+
<div *ngIf="storageTypeId == 'HttpData'">
36+
<mat-form-field class="form-field" color="accent" id="form-field-name">
37+
<mat-label>Name</mat-label>
38+
<input [(ngModel)]="name" matInput>
3739
</mat-form-field>
3840

39-
<mat-form-field class="form-field" color="accent" id="form-field-container">
40-
<mat-label>Container</mat-label>
41-
<input disabled [(ngModel)]="container" matInput>
41+
<mat-form-field class="form-field" color="accent" id="form-field-base-url">
42+
<mat-label>Base URL</mat-label>
43+
<input [(ngModel)]="baseUrl" matInput>
4244
</mat-form-field>
4345

44-
<mat-form-field class="form-field" color="accent" id="form-field-blobname">
45-
<mat-label>Blob Name</mat-label>
46-
<input [(ngModel)]="blobname" matInput>
46+
<mat-form-field class="form-field" color="accent" id="form-field-proxy-path">
47+
<mat-label>Proxy Path</mat-label>
48+
<input [(ngModel)]="proxyPath" matInput>
4749
</mat-form-field>
4850
</div>
51+
52+
<div *ngIf="storageTypeId == 'AmazonS3'">
53+
<mat-form-field class="form-field" color="accent" id="form-field-region">
54+
<mat-label>Region</mat-label>
55+
<input [(ngModel)]="region" matInput>
56+
</mat-form-field>
57+
<mat-form-field class="form-field" color="accent" id="form-field-key-name">
58+
<mat-label>Key Name</mat-label>
59+
<input [(ngModel)]="keyName" matInput>
60+
</mat-form-field>
61+
<mat-form-field class="form-field" color="accent" id="form-field-bucket-name">
62+
<mat-label>Bucket Name</mat-label>
63+
<input [(ngModel)]="bucketName" matInput>
64+
</mat-form-field>
65+
</div>
66+
4967
</mat-dialog-content>
5068

5169

Lines changed: 50 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import { Component, Inject, OnInit } from '@angular/core';
2-
import { AssetInput } from "@think-it-labs/edc-connector-client";
2+
import { AssetInput, DataAddress } from "@think-it-labs/edc-connector-client";
33
import { MatDialogRef } from "@angular/material/dialog";
44
import { StorageType } from "../../../shared/models/storage-type";
5+
import { NotificationService } from 'src/app/shared/services/notification.service';
56

67

78
@Component({
8-
selector: 'edc-demo-asset-editor-dialog',
9+
selector: 'app-asset-editor-dialog',
910
templateUrl: './asset-editor-dialog.component.html',
1011
styleUrls: ['./asset-editor-dialog.component.scss']
1112
})
@@ -15,36 +16,72 @@ export class AssetEditorDialog implements OnInit {
1516
version: string = '';
1617
name: string = '';
1718
contenttype: string = '';
19+
storageTypeId: string = '';
20+
21+
// AmazonS3 dataAddress attributes
22+
region: string = '';
23+
keyName: string = '';
24+
bucketName: string = '';
25+
26+
// HttpData dataAddress attributes
27+
httpDataName: string = '';
28+
baseUrl: string = '';
29+
proxyPath: string = '';
1830

19-
storageTypeId: string = 'AzureStorage';
20-
account: string = '';
21-
container: string = 'src-container';
22-
blobname: string = '';
2331

2432
constructor(private dialogRef: MatDialogRef<AssetEditorDialog>,
33+
private notificationService: NotificationService,
2534
@Inject('STORAGE_TYPES') public storageTypes: StorageType[]) {
2635
}
2736

2837
ngOnInit(): void {
2938
}
3039

3140
onSave() {
41+
if (!this.checkRequiredFields()) {
42+
this.notificationService.showError("Review required fields");
43+
return;
44+
}
45+
46+
let dataAddress: any;
47+
48+
if (this.storageTypeId === 'AmazonS3') {
49+
dataAddress = {
50+
"type": this.storageTypeId,
51+
"region": this.region,
52+
"keyName": this.keyName,
53+
"bucketName": this.bucketName
54+
};
55+
} else if (this.storageTypeId === 'HttpData') {
56+
dataAddress = {
57+
"type": this.storageTypeId,
58+
"name": this.httpDataName,
59+
"baseUrl": this.baseUrl,
60+
"proxyPath": this.proxyPath
61+
};
62+
} else {
63+
this.notificationService.showError("Incorrect destination value");
64+
return;
65+
}
66+
3267
const assetInput: AssetInput = {
3368
"@id": this.id,
3469
properties: {
3570
"name": this.name,
3671
"version": this.version,
3772
"contenttype": this.contenttype,
3873
},
39-
dataAddress: {
40-
"type": this.storageTypeId,
41-
"account": this.account,
42-
"container": this.container,
43-
"blobname": this.blobname,
44-
"keyName": `${this.account}-key1`
45-
}
74+
dataAddress: dataAddress
4675
};
4776

4877
this.dialogRef.close({ assetInput });
4978
}
79+
80+
private checkRequiredFields(): boolean {
81+
if(!this.id || !this.storageTypeId){
82+
return false;
83+
} else {
84+
return true;
85+
}
86+
}
5087
}

src/app/pages/assets/asset-viewer/asset-viewer.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {NotificationService} from "../../../shared/services/notification.service
1010

1111

1212
@Component({
13-
selector: 'edc-demo-asset-viewer',
13+
selector: 'app-asset-viewer',
1414
templateUrl: './asset-viewer.component.html',
1515
styleUrls: ['./asset-viewer.component.scss']
1616
})

src/app/pages/catalog/catalog-browser/catalog-browser.component.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,13 @@
7575

7676
<mat-divider inset></mat-divider>
7777
<mat-card-actions class="card-actions">
78-
<button (click)="onNegotiateClicked(contractOffer)"
78+
<!-- TODO: Pendiente de abordar en #422765 -->
79+
<!-- <button (click)="onNegotiateClicked(contractOffer)"
7980
[disabled]="isBusy(contractOffer) || isNegotiated(contractOffer)"
8081
color="accent" mat-stroked-button>
8182
<mat-icon>drive_file_rename_outline</mat-icon>
8283
Negotiate
83-
</button>
84+
</button> -->
8485
</mat-card-actions>
8586
<mat-card-footer>
8687
<mat-progress-bar *ngIf="isBusy(contractOffer)" color="accent" mode="indeterminate"></mat-progress-bar>

src/app/pages/catalog/catalog-browser/catalog-browser.component.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ interface RunningTransferProcess {
1717
}
1818

1919
@Component({
20-
selector: 'edc-demo-catalog-browser',
20+
selector: 'app-catalog-browser',
2121
templateUrl: './catalog-browser.component.html',
2222
styleUrls: ['./catalog-browser.component.scss']
2323
})
@@ -54,7 +54,8 @@ export class CatalogBrowserComponent implements OnInit {
5454
this.fetch$.next(null);
5555
}
5656

57-
onNegotiateClicked(contractOffer: ContractOffer) {
57+
// TODO: Pendiente de abordar en #422765
58+
/* onNegotiateClicked(contractOffer: ContractOffer) {
5859
const initiateRequest: ContractNegotiationRequest = {
5960
connectorAddress: contractOffer.originator,
6061
offer: {
@@ -108,7 +109,7 @@ export class CatalogBrowserComponent implements OnInit {
108109
console.error(error);
109110
this.notificationService.showError("Error starting negotiation");
110111
});
111-
}
112+
} */
112113

113114
isBusy(contractOffer: ContractOffer) {
114115
return this.runningNegotiations.get(contractOffer.id) !== undefined || !!this.runningTransferProcesses.find(tp => tp.assetId === contractOffer.assetId);

src/app/pages/contract-definitions/contract-definition-editor-dialog/contract-definition-editor-dialog.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Asset, ContractDefinitionInput, PolicyDefinition } from "../../../share
66

77

88
@Component({
9-
selector: 'edc-demo-contract-definition-editor-dialog',
9+
selector: 'app-contract-definition-editor-dialog',
1010
templateUrl: './contract-definition-editor-dialog.component.html',
1111
styleUrls: ['./contract-definition-editor-dialog.component.scss']
1212
})

src/app/pages/contract-definitions/contract-definition-viewer/contract-definition-viewer.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { ContractDefinitionInput, ContractDefinition } from "../../../shared/mod
1212

1313

1414
@Component({
15-
selector: 'edc-demo-contract-definition-viewer',
15+
selector: 'app-contract-definition-viewer',
1616
templateUrl: './contract-definition-viewer.component.html',
1717
styleUrls: ['./contract-definition-viewer.component.scss']
1818
})

0 commit comments

Comments
 (0)