Skip to content

Commit 8306439

Browse files
committed
Merge branch 'develop'
2 parents b7b85cd + b39b9b0 commit 8306439

File tree

26 files changed

+653
-960
lines changed

26 files changed

+653
-960
lines changed

package-lock.json

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

package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "inesdata-connector-interface",
3-
"version": "0.9.1",
3+
"version": "0.10.0",
44
"project": "com.gmv.inesdata",
55
"scripts": {
66
"ng": "ng",
@@ -14,17 +14,17 @@
1414
},
1515
"private": true,
1616
"dependencies": {
17-
"@angular/animations": "^17.1.2",
17+
"@angular/animations": "^17.3.11",
1818
"@angular/cdk": "~15.2.9",
19-
"@angular/common": "^17.1.2",
20-
"@angular/compiler": "^17.1.2",
21-
"@angular/core": "^17.1.2",
19+
"@angular/common": "^17.3.11",
20+
"@angular/compiler": "^17.3.11",
21+
"@angular/core": "^17.3.11",
2222
"@angular/flex-layout": "~15.0.0-beta.42",
2323
"@angular/forms": "^17.3.4",
2424
"@angular/material": "~15.2.9",
25-
"@angular/platform-browser": "^17.1.2",
26-
"@angular/platform-browser-dynamic": "^17.1.2",
27-
"@angular/router": "^17.1.2",
25+
"@angular/platform-browser": "^17.3.11",
26+
"@angular/platform-browser-dynamic": "^17.3.11",
27+
"@angular/router": "^17.3.11",
2828
"@auth0/angular-jwt": "^5.2.0",
2929
"@ckeditor/ckeditor5-angular": "^7.0.1",
3030
"@ckeditor/ckeditor5-build-classic": "^43.1.0",
@@ -52,9 +52,9 @@
5252
"zone.js": "~0.14.2"
5353
},
5454
"devDependencies": {
55-
"@angular-devkit/build-angular": "^17.1.2",
56-
"@angular/cli": "^17.1.2",
57-
"@angular/compiler-cli": "^17.1.2",
55+
"@angular-devkit/build-angular": "^17.3.11",
56+
"@angular/cli": "^17.3.11",
57+
"@angular/compiler-cli": "^17.3.11",
5858
"@types/jasmine": "~4.0.3",
5959
"@types/jsonld": "^1.5.13",
6060
"@types/node": "^20.8.7",

src/app/app.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export function jwtOptionsFactory(authService: AuthService) {
105105
},
106106
{
107107
provide: 'TRANSFER_TYPES',
108-
useFactory: () => [{id: DATA_ADDRESS_TYPES.httpData, name: DATA_ADDRESS_TYPES.httpData}, {id: DATA_ADDRESS_TYPES.amazonS3, name: 'ExternalStoreS3'}, {id: DATA_ADDRESS_TYPES.inesDataStore, name: DATA_ADDRESS_TYPES.inesDataStore}],
108+
useFactory: () => [{id: DATA_ADDRESS_TYPES.amazonS3, name: 'ExternalStoreS3'}, {id: DATA_ADDRESS_TYPES.inesDataStore, name: DATA_ADDRESS_TYPES.inesDataStore}],
109109
},
110110
{ provide: HTTP_INTERCEPTORS, useClass: Oauth2Interceptor, multi: true },
111111
{

src/app/pages/assets/asset-create/asset-create.component.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
</div>
6565
</mat-tab>
6666

67-
<mat-tab label="Detailed information" *ngIf="vocabularies?.length > 0">
67+
<mat-tab label="Detailed information" *ngIf="vocabularies?.length > 0 && ((defaultVocabularies?.length>0 && defaultForms?.length>0) || selectedVocabularies?.length>0)">
6868
<mat-tab-group animationDuration="0ms" mat-stretch-tabs="false" mat-align-tabs="start">
6969
<mat-tab label="Default information" *ngIf="defaultVocabularies?.length>0 && defaultForms?.length>0">
7070
<div class="asset-creation-vocabularies">
@@ -140,7 +140,7 @@
140140

141141
<mat-form-field class="form-field" color="accent">
142142
<mat-label>Base URL</mat-label>
143-
<input [(ngModel)]="httpDataAddress.baseUrl" [pattern]="urlPattern" matInput required>
143+
<input [(ngModel)]="httpDataAddress.baseUrl" matInput required>
144144
</mat-form-field>
145145

146146
<mat-form-field class="form-field" color="accent">
@@ -197,7 +197,7 @@
197197

198198
<mat-form-field class="form-field" color="accent">
199199
<mat-label>Bucket Name</mat-label>
200-
<input [(ngModel)]="amazonS3DataAddress.bucketName" matInput>
200+
<input required [(ngModel)]="amazonS3DataAddress.bucketName" matInput>
201201
</mat-form-field>
202202

203203
<mat-form-field class="form-field" color="accent">
@@ -212,17 +212,17 @@
212212

213213
<mat-form-field class="form-field" color="accent">
214214
<mat-label>Access Key Id</mat-label>
215-
<input [(ngModel)]="amazonS3DataAddress.accessKeyId" matInput>
215+
<input required [(ngModel)]="amazonS3DataAddress.accessKeyId" matInput>
216216
</mat-form-field>
217217

218218
<mat-form-field class="form-field" color="accent">
219219
<mat-label>Secret Access Key</mat-label>
220-
<input [(ngModel)]="amazonS3DataAddress.secretAccessKey" matInput>
220+
<input required [(ngModel)]="amazonS3DataAddress.secretAccessKey" matInput>
221221
</mat-form-field>
222222

223223
<mat-form-field class="form-field" color="accent">
224224
<mat-label>Endpoint Override</mat-label>
225-
<input [(ngModel)]="amazonS3DataAddress.endpointOverride" matInput>
225+
<input required [(ngModel)]="amazonS3DataAddress.endpointOverride" matInput>
226226
</mat-form-field>
227227
</div>
228228

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,6 @@ export class AssetCreateComponent implements OnInit {
103103
config = CKEDITOR_CONFIG
104104
selectedAssetTypeVocabularies: Vocabulary[]
105105

106-
urlPattern: RegExp = /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z]{2,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)$/;
107-
108106
private fetch$ = new BehaviorSubject(null);
109107

110108
ngOnInit(): void {
@@ -295,7 +293,7 @@ export class AssetCreateComponent implements OnInit {
295293
if (this.storageTypeId === DATA_ADDRESS_TYPES.httpData && (!this.httpDataAddress.name || !this.httpDataAddress.baseUrl || !this.validateUrl())) {
296294
return false;
297295
}
298-
if (this.storageTypeId === DATA_ADDRESS_TYPES.amazonS3 && !this.amazonS3DataAddress.region) {
296+
if (this.storageTypeId === DATA_ADDRESS_TYPES.amazonS3 && (!this.amazonS3DataAddress.region || !this.amazonS3DataAddress.accessKeyId || !this.amazonS3DataAddress.secretAccessKey || !this.amazonS3DataAddress.bucketName || !this.amazonS3DataAddress.endpointOverride)) {
299297
return false;
300298
} else if (this.storageTypeId === DATA_ADDRESS_TYPES.inesDataStore && !this.inesDataStoreAddress.file) {
301299
return false;
@@ -370,8 +368,12 @@ export class AssetCreateComponent implements OnInit {
370368
}
371369

372370
validateUrl(): boolean {
373-
const regex = new RegExp(this.urlPattern);
374-
return regex.test(this.httpDataAddress.baseUrl);
371+
try {
372+
var url = new URL(this.httpDataAddress.baseUrl);
373+
} catch (e) {
374+
return false;
375+
}
376+
return url.protocol === "http:" || url.protocol === "https:";
375377
}
376378

377379

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { Router } from '@angular/router';
1717
})
1818
export class AssetViewerComponent implements OnInit {
1919

20-
assets: Asset[];
20+
assets: Asset[] = [];
2121

2222
isTransferring = false;
2323
private fetch$ = new BehaviorSubject(null);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { Router } from '@angular/router';
1515
})
1616
export class CatalogBrowserComponent implements OnInit {
1717

18-
dataOffers: DataOffer[];
18+
dataOffers: DataOffer[] = [];
1919

2020
// Pagination
2121
pageSize = 10;

src/app/pages/catalog/contract-offers-viewer/contract-offers-viewer.component.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,4 +174,5 @@ mat-expansion-panel-header {
174174
mat-card-actions {
175175
padding-right: 10px !important;
176176
padding-bottom: 15px !important;
177+
text-align: end !important;
177178
}

src/app/pages/catalog/contract-offers-viewer/contract-offers-viewer.component.ts

Lines changed: 46 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { JsonDialogData } from '../../json-dialog/json-dialog/json-dialog.data';
1313
import { JsonDialogComponent } from '../../json-dialog/json-dialog/json-dialog.component'
1414
import { PolicyBuilder } from '@think-it-labs/edc-connector-client';
1515
import { Router } from '@angular/router';
16+
import { catchError, filter, from, interval, of, switchMap, takeUntil, tap, timer } from 'rxjs';
1617

1718
export interface ContractOffersDialogData {
1819
assetId: string;
@@ -192,48 +193,66 @@ export class ContractOffersViewerComponent {
192193
offerId: initiateRequest.policy["@id"]
193194
});
194195

195-
196-
if (!this.pollingHandleNegotiation) {
197-
this.checkActiveNegotiations();
198-
}
196+
this.checkActiveNegotiations(negotiationId, initiateRequest.policy["@id"]);
199197
}, error => {
200198
console.error(error);
201199
this.notificationService.showError("Error starting negotiation");
202200
});
203201
}
204202

205-
checkActiveNegotiations() {
206-
// there are no active negotiations
207-
this.pollingHandleNegotiation = setInterval(() => {
208-
209-
const finishedNegotiationStates = [
210-
"VERIFIED",
211-
"TERMINATED",
212-
"FINALIZED",
213-
"ERROR"];
214-
215-
for (const negotiation of this.runningNegotiations.values()) {
216-
this.apiService.getNegotiationState(negotiation.id).subscribe(updatedNegotiation => {
217-
if (finishedNegotiationStates.includes(updatedNegotiation.state)) {
218-
let offerId = negotiation.offerId;
203+
checkActiveNegotiations(negotiationId: string, offerId: string) {
204+
const timeout$ = timer(30000).pipe(
205+
tap(() => {
206+
if (this.runningNegotiations.has(offerId)) {
207+
this.notificationService.showWarning(
208+
`Negotiation [${negotiationId}] timed out after 30 seconds.`
209+
);
210+
this.runningNegotiations.delete(offerId);
211+
}
212+
})
213+
);
214+
215+
this.pollingHandleNegotiation = interval(2000).pipe(
216+
takeUntil(timeout$),
217+
switchMap(() => from([...this.runningNegotiations.values()])),
218+
switchMap(negotiation =>
219+
this.apiService.getNegotiationState(negotiation.id).pipe(
220+
catchError(error => {
221+
console.error("Polling error:", error);
222+
this.notificationService.showError("Error polling negotiation");
223+
this.runningNegotiations.delete(negotiation.offerId);
224+
return of(null);
225+
})
226+
)
227+
),
228+
filter(updatedNegotiation => updatedNegotiation !== null),
229+
tap(updatedNegotiation => {
230+
const finishedStates = ["VERIFIED", "TERMINATED", "FINALIZED", "ERROR"];
231+
if (finishedStates.includes(updatedNegotiation.state)) {
219232
this.runningNegotiations.delete(offerId);
233+
234+
if (updatedNegotiation.state === "VERIFIED" || updatedNegotiation.state === "FINALIZED") {
235+
this.finishedNegotiations.set(offerId, updatedNegotiation);
236+
this.notificationService.showInfo("Contract Negotiation complete!");
237+
} else if (updatedNegotiation.state === "TERMINATED") {
220238
const errorDetail = updatedNegotiation.optionalValue("edc", "errorDetail");
221-
if (updatedNegotiation["state"] === "VERIFIED" || updatedNegotiation["state"] === "FINALIZED") {
222-
this.finishedNegotiations.set(offerId, updatedNegotiation);
223-
this.notificationService.showInfo("Contract Negotiation complete!");
224-
} else if (updatedNegotiation["state"] === "TERMINATED" && typeof errorDetail === 'string' && errorDetail.includes("Contract offer is not valid")) {
239+
if (typeof errorDetail === 'string' && errorDetail.includes("Contract offer is not valid")) {
225240
this.finishedNegotiations.set(offerId, updatedNegotiation);
226241
this.notificationService.showError("Contract offer is not valid.");
227242
}
228243
}
229244

230245
if (this.runningNegotiations.size === 0) {
231-
clearInterval(this.pollingHandleNegotiation);
232-
this.pollingHandleNegotiation = undefined;
246+
this.cleanupPolling();
233247
}
234-
});
235-
}
236-
}, 1000);
248+
}
249+
})
250+
).subscribe();
251+
}
252+
253+
private cleanupPolling() {
254+
this.pollingHandleNegotiation?.unsubscribe();
255+
this.pollingHandleNegotiation = undefined;
237256
}
238257

239258
getJsonPolicy(policy: Policy): any {

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
@@ -17,7 +17,7 @@ import { Router } from '@angular/router';
1717
})
1818
export class ContractDefinitionViewerComponent implements OnInit {
1919

20-
contractDefinitions: ContractDefinition[];
20+
contractDefinitions: ContractDefinition[] = [];
2121
private fetch$ = new BehaviorSubject(null);
2222

2323
// Pagination

0 commit comments

Comments
 (0)