From 0250e3240dda75911e6b401156aa76041c20a6e2 Mon Sep 17 00:00:00 2001 From: SHENGXING LU Date: Wed, 8 Oct 2025 11:09:20 +0200 Subject: [PATCH 1/3] did party char --- .../org-info/org-info.component.html | 5 +++++ .../profile-sections/org-info/org-info.component.ts | 13 +++++++++++-- src/assets/i18n/en.json | 1 + src/assets/i18n/es.json | 1 + 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/app/pages/user-profile/profile-sections/org-info/org-info.component.html b/src/app/pages/user-profile/profile-sections/org-info/org-info.component.html index ba74fa4e..a1dc3334 100644 --- a/src/app/pages/user-profile/profile-sections/org-info/org-info.component.html +++ b/src/app/pages/user-profile/profile-sections/org-info/org-info.component.html @@ -33,6 +33,11 @@

{{ 'PROFILE._did' | translate }} + +
diff --git a/src/app/pages/user-profile/profile-sections/org-info/org-info.component.ts b/src/app/pages/user-profile/profile-sections/org-info/org-info.component.ts index 46bd181b..b2c81349 100644 --- a/src/app/pages/user-profile/profile-sections/org-info/org-info.component.ts +++ b/src/app/pages/user-profile/profile-sections/org-info/org-info.component.ts @@ -36,6 +36,7 @@ export class OrgInfoComponent { website: new FormControl(''), description: new FormControl(''), country: new FormControl(''), + did: new FormControl(''), }); mediumForm = new FormGroup({ email: new FormControl('', [Validators.required, Validators.email, Validators.pattern('^[a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,4}$'), Validators.maxLength(320)]), @@ -186,7 +187,13 @@ export class OrgInfoComponent { chars.push({ name: 'country', value: this.profileForm.value.country - }) + }) + } + if(this.profileForm.value.did != ''){ + chars.push({ + name: 'did', + value: this.profileForm.value.did + }) } for(let i=0; i Date: Wed, 8 Oct 2025 18:06:06 +0200 Subject: [PATCH 2/3] product spec creation with 2 more chars --- .../create-product-spec.component.html | 21 ++++- .../create-product-spec.component.ts | 79 ++++++++++++++++--- src/assets/i18n/en.json | 2 + src/assets/i18n/es.json | 2 + 4 files changed, 92 insertions(+), 12 deletions(-) diff --git a/src/app/pages/seller-offerings/offerings/seller-product-spec/create-product-spec/create-product-spec.component.html b/src/app/pages/seller-offerings/offerings/seller-product-spec/create-product-spec/create-product-spec.component.html index 09ba92b0..08385989 100644 --- a/src/app/pages/seller-offerings/offerings/seller-product-spec/create-product-spec/create-product-spec.component.html +++ b/src/app/pages/seller-offerings/offerings/seller-product-spec/create-product-spec/create-product-spec.component.html @@ -545,11 +545,13 @@

{{ 'CREATE_

-
@@ -659,8 +661,21 @@

{{ 'CREATE_ + + +

+ } @else if (credentialsConfigSelected || policyConfigSelected){ +
+ + +
}
diff --git a/src/app/pages/seller-offerings/offerings/seller-product-spec/create-product-spec/create-product-spec.component.ts b/src/app/pages/seller-offerings/offerings/seller-product-spec/create-product-spec/create-product-spec.component.ts index b7645ebf..85c259da 100644 --- a/src/app/pages/seller-offerings/offerings/seller-product-spec/create-product-spec/create-product-spec.component.ts +++ b/src/app/pages/seller-offerings/offerings/seller-product-spec/create-product-spec/create-product-spec.component.ts @@ -89,6 +89,8 @@ export class CreateProductSpecComponent implements OnInit { stringCharSelected:boolean=true; numberCharSelected:boolean=false; rangeCharSelected:boolean=false; + credentialsConfigSelected:boolean=false; + policyConfigSelected:boolean=false; prodChars:ProductSpecificationCharacteristic[]=[]; finishChars:ProductSpecificationCharacteristic[]=[]; creatingChars:CharacteristicValueSpecification[]=[]; @@ -169,6 +171,7 @@ export class CreateProductSpecComponent implements OnInit { fromValue: string = ''; toValue: string = ''; rangeUnit: string = ''; + jsonValue: string = ''; filenameRegex = /^[A-Za-z0-9_.-]+$/; @@ -624,6 +627,8 @@ export class CreateProductSpecComponent implements OnInit { this.stringCharSelected=true; this.numberCharSelected=false; this.rangeCharSelected=false; + this.credentialsConfigSelected=false; + this.policyConfigSelected=false; this.showPreview=false; this.refreshChars(); } @@ -928,9 +933,12 @@ export class CreateProductSpecComponent implements OnInit { this.fromValue = ''; this.toValue = ''; this.rangeUnit = ''; + this.jsonValue = ''; this.stringCharSelected=true; this.numberCharSelected=false; this.rangeCharSelected=false; + this.credentialsConfigSelected=false; + this.policyConfigSelected=false; this.creatingChars=[]; } @@ -994,14 +1002,32 @@ export class CreateProductSpecComponent implements OnInit { this.stringCharSelected=true; this.numberCharSelected=false; this.rangeCharSelected=false; + this.credentialsConfigSelected=false; + this.policyConfigSelected=false; }else if (event.target.value=='number'){ this.stringCharSelected=false; this.numberCharSelected=true; this.rangeCharSelected=false; - }else{ + this.credentialsConfigSelected=false; + this.policyConfigSelected=false; + }else if(event.target.value=='range'){ this.stringCharSelected=false; this.numberCharSelected=false; this.rangeCharSelected=true; + this.credentialsConfigSelected=false; + this.policyConfigSelected=false; + }else if(event.target.value=='credentialsConfiguration'){ + this.stringCharSelected=false; + this.numberCharSelected=false; + this.rangeCharSelected=false; + this.credentialsConfigSelected=true; + this.policyConfigSelected=false; + }else if(event.target.value=='authorizationPolicy'){ + this.stringCharSelected=false; + this.numberCharSelected=false; + this.rangeCharSelected=false; + this.credentialsConfigSelected=false; + this.policyConfigSelected=true; } this.creatingChars=[]; } @@ -1020,7 +1046,7 @@ export class CreateProductSpecComponent implements OnInit { value:this.stringValue as any }) } - this.stringValue=''; + this.stringValue=''; } else if (this.numberCharSelected){ console.log('number') if(this.creatingChars.length==0){ @@ -1038,7 +1064,7 @@ export class CreateProductSpecComponent implements OnInit { } this.numberUnit=''; this.numberValue=''; - }else{ + }else if(this.rangeCharSelected){ console.log('range') if(this.creatingChars.length==0){ this.creatingChars.push({ @@ -1053,11 +1079,34 @@ export class CreateProductSpecComponent implements OnInit { valueFrom:this.fromValue as any, valueTo:this.toValue as any, unitOfMeasure:this.rangeUnit}) - } + } + this.fromValue=''; + this.toValue=''; + this.rangeUnit=''; + }else if(this.credentialsConfigSelected || this.policyConfigSelected){ + console.log('json') + try { + const jsonObj = JSON.parse(this.jsonValue); + if(this.creatingChars.length==0){ + this.creatingChars.push({ + isDefault:true, + value:jsonObj as any + }) + } else{ + this.creatingChars.push({ + isDefault:false, + value:jsonObj as any + }) + } + this.jsonValue=''; + } catch (e) { + this.errorMessage='Invalid JSON format'; + this.showError=true; + setTimeout(() => { + this.showError = false; + }, 3000); + } } - this.fromValue=''; - this.toValue=''; - this.rangeUnit=''; } removeCharValue(char:any,idx:any){ @@ -1078,12 +1127,22 @@ export class CreateProductSpecComponent implements OnInit { saveChar(){ if(this.charsForm.value.name!=null){ - this.prodChars.push({ + let characteristic: any = { id: 'urn:ngsi-ld:characteristic:'+uuidv4(), name: this.charsForm.value.name, description: this.charsForm.value.description != null ? this.charsForm.value.description : '', productSpecCharacteristicValue: this.creatingChars - }) + }; + + if(this.credentialsConfigSelected){ + characteristic.valueType = 'credentialsConfiguration'; + characteristic['@schemaLocation'] = 'https://raw.githubusercontent.com/FIWARE/contract-management/refs/heads/main/schemas/credentials/credentialConfigCharacteristic.json'; + } else if(this.policyConfigSelected){ + characteristic.valueType = 'authorizationPolicy'; + characteristic['@schemaLocation'] = 'https://raw.githubusercontent.com/FIWARE/contract-management/refs/heads/policy-support/schemas/odrl/policyCharacteristic.json'; + } + + this.prodChars.push(characteristic); } this.charsForm.reset(); @@ -1092,6 +1151,8 @@ export class CreateProductSpecComponent implements OnInit { this.stringCharSelected=true; this.numberCharSelected=false; this.rangeCharSelected=false; + this.credentialsConfigSelected=false; + this.policyConfigSelected=false; this.refreshChars(); this.cdr.detectChanges(); } diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index 4bd30328..9024f9c2 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -514,6 +514,8 @@ "_from": "From", "_to": "To", "_save_char": "Save characteristic", + "_json_value": "JSON Value", + "_add_json": "Add JSON Value", "_resource_specs": "Resource specifications", "_service_specs": "Service specifications", "_add_prod_img": "Add product image", diff --git a/src/assets/i18n/es.json b/src/assets/i18n/es.json index 4bd30328..9024f9c2 100644 --- a/src/assets/i18n/es.json +++ b/src/assets/i18n/es.json @@ -514,6 +514,8 @@ "_from": "From", "_to": "To", "_save_char": "Save characteristic", + "_json_value": "JSON Value", + "_add_json": "Add JSON Value", "_resource_specs": "Resource specifications", "_service_specs": "Service specifications", "_add_prod_img": "Add product image", From 1b52128a6034b8b2cf3f16602ace173850dc49e0 Mon Sep 17 00:00:00 2001 From: SHENGXING LU Date: Wed, 8 Oct 2025 18:06:55 +0200 Subject: [PATCH 3/3] characteristics post and patch --- .../update-product-spec/update-product-spec.component.ts | 5 +++-- .../configuration-profile-drawer.component.ts | 5 ++++- .../price-component-drawer.component.ts | 6 +++++- .../offer/procurement-mode/procurement-mode.component.ts | 4 ---- .../shared/price-plan-drawer/price-plan-drawer.component.ts | 6 +++++- 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/app/pages/seller-offerings/offerings/seller-product-spec/update-product-spec/update-product-spec.component.ts b/src/app/pages/seller-offerings/offerings/seller-product-spec/update-product-spec/update-product-spec.component.ts index 62ce2e9d..b17e0263 100644 --- a/src/app/pages/seller-offerings/offerings/seller-product-spec/update-product-spec/update-product-spec.component.ts +++ b/src/app/pages/seller-offerings/offerings/seller-product-spec/update-product-spec/update-product-spec.component.ts @@ -326,6 +326,8 @@ export class UpdateProductSpecComponent implements OnInit { id: 'urn:ngsi-ld:characteristic:'+uuidv4(), name: this.prod.productSpecCharacteristic[i].name, description: this.prod.productSpecCharacteristic[i].description ? this.prod.productSpecCharacteristic[i].description : '', + valueType: this.prod.productSpecCharacteristic[i].valueType, + '@schemaLocation': this.prod.productSpecCharacteristic[i]['@schemaLocation'], productSpecCharacteristicValue: this.prod.productSpecCharacteristic[i].productSpecCharacteristicValue }); } @@ -1361,11 +1363,10 @@ export class UpdateProductSpecComponent implements OnInit { lifecycleStatus: this.prodStatus, //isBundle: this.bundleChecked, //bundledProductSpecification: this.prodSpecsBundle, - productSpecCharacteristic: this.finishChars, productSpecificationRelationship: rels, attachment: this.prodAttachments, resourceSpecification: this.selectedResourceSpecs, - serviceSpecification: this.selectedServiceSpecs + serviceSpecification: this.selectedServiceSpecs } } this.selectStep('summary','summary-circle'); diff --git a/src/app/shared/forms/offer/price-plans/configuration-profile-drawer/configuration-profile-drawer.component.ts b/src/app/shared/forms/offer/price-plans/configuration-profile-drawer/configuration-profile-drawer.component.ts index 1406d325..28531eed 100644 --- a/src/app/shared/forms/offer/price-plans/configuration-profile-drawer/configuration-profile-drawer.component.ts +++ b/src/app/shared/forms/offer/price-plans/configuration-profile-drawer/configuration-profile-drawer.component.ts @@ -34,7 +34,10 @@ export class ConfigurationProfileDrawerComponent implements OnInit { //const characteristicsData = this.profileData || []; let profileChars = []; for(let i=0;i certification.name === this.profileData[i].name) && this.profileData[i].name != 'Compliance:SelfAtt') { + if (!certifications.some(certification => certification.name === this.profileData[i].name) + && this.profileData[i].name != 'Compliance:SelfAtt' + && this.profileData[i].valueType != 'credentialsConfiguration' + && this.profileData[i].valueType != 'authorizationPolicy') { profileChars.push(this.profileData[i]); } } diff --git a/src/app/shared/forms/offer/price-plans/price-component-drawer/price-component-drawer.component.ts b/src/app/shared/forms/offer/price-plans/price-component-drawer/price-component-drawer.component.ts index 8c02a48c..b4ff589c 100644 --- a/src/app/shared/forms/offer/price-plans/price-component-drawer/price-component-drawer.component.ts +++ b/src/app/shared/forms/offer/price-plans/price-component-drawer/price-component-drawer.component.ts @@ -62,7 +62,10 @@ export class PriceComponentDrawerComponent implements OnInit { }, 50); for(let i=0;i certification.name === this.prodChars[i].name) && this.prodChars[i].name != 'Compliance:SelfAtt') { + if (!certifications.some(certification => certification.name === this.prodChars[i].name) + && this.prodChars[i].name != 'Compliance:SelfAtt' + && this.prodChars[i].valueType != 'credentialsConfiguration' + && this.prodChars[i].valueType != 'authorizationPolicy') { this.filteredChars.push(this.prodChars[i]); } } @@ -185,6 +188,7 @@ export class PriceComponentDrawerComponent implements OnInit { id: this.selectedCharacteristic.id, name: this.selectedCharacteristic.name, description: this.selectedCharacteristic.description || '', + valueType: this.selectedCharacteristic.valueType } // Add the productSpecCharacteristicValue only if needed diff --git a/src/app/shared/forms/offer/procurement-mode/procurement-mode.component.ts b/src/app/shared/forms/offer/procurement-mode/procurement-mode.component.ts index ce9cbfac..1c361ad4 100644 --- a/src/app/shared/forms/offer/procurement-mode/procurement-mode.component.ts +++ b/src/app/shared/forms/offer/procurement-mode/procurement-mode.component.ts @@ -166,10 +166,6 @@ export class ProcurementModeComponent implements ControlValueAccessor, AfterView this.errorMessage = ""; this.showProcurementError = false; this.form.setErrors(null) - } else if (this.gatewayCount == 0){ - this.errorMessage = "You can't select this procurement mode as you are not registered on the payment gateway."; - this.showProcurementError = true; - this.form.setErrors({ invalidProcurement: true }); } const mode = this.procurementModes.find(m => m.id === value.mode) || this.procurementModes[0]; diff --git a/src/app/shared/price-plan-drawer/price-plan-drawer.component.ts b/src/app/shared/price-plan-drawer/price-plan-drawer.component.ts index 34e753f4..82a781ec 100644 --- a/src/app/shared/price-plan-drawer/price-plan-drawer.component.ts +++ b/src/app/shared/price-plan-drawer/price-plan-drawer.component.ts @@ -196,7 +196,11 @@ export class PricePlanDrawerComponent implements OnInit, OnDestroy { filterCharacteristics() { this.filteredCharacteristics = []; for(let i = 0; i < this.characteristics.length; i++){ - if (!certifications.some(certification => certification.name === this.characteristics[i].name) && this.characteristics[i].name != 'Compliance:SelfAtt') { + if (!certifications.some(certification => certification.name === this.characteristics[i].name) + && this.characteristics[i].name != 'Compliance:SelfAtt' + && this.characteristics[i].valueType != 'credentialsConfiguration' + && this.characteristics[i].valueType != 'authorizationPolicy' + ) { this.filteredCharacteristics.push(this.characteristics[i]); } }