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 61ff6d89..7ad1864e 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 @@ -567,11 +567,13 @@

There's no char }
-
@@ -682,8 +684,21 @@

There's no char + + + + } @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 71d5dd87..09804bab 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; booleanCharSelected:boolean=false; prodChars:ProductSpecificationCharacteristic[]=[]; finishChars:ProductSpecificationCharacteristic[]=[]; @@ -172,6 +174,7 @@ export class CreateProductSpecComponent implements OnInit { toValue: string = ''; booleanValue: boolean = false; rangeUnit: string = ''; + jsonValue: string = ''; filenameRegex = /^[A-Za-z0-9_.-]+$/; @@ -627,6 +630,8 @@ export class CreateProductSpecComponent implements OnInit { this.stringCharSelected=true; this.numberCharSelected=false; this.rangeCharSelected=false; + this.credentialsConfigSelected=false; + this.policyConfigSelected=false; this.booleanCharSelected=false; this.showPreview=false; this.refreshChars(); @@ -932,9 +937,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.booleanCharSelected=false; this.creatingChars=[]; } @@ -999,24 +1007,48 @@ export class CreateProductSpecComponent implements OnInit { this.stringCharSelected=true; this.numberCharSelected=false; this.rangeCharSelected=false; + this.credentialsConfigSelected=false; + this.policyConfigSelected=false; this.booleanCharSelected=false; this.charsForm.reset(); }else if (event.target.value=='number'){ this.stringCharSelected=false; this.numberCharSelected=true; this.rangeCharSelected=false; + this.credentialsConfigSelected=false; + this.policyConfigSelected=false; this.booleanCharSelected=false; this.charsForm.reset(); - }else if (event.target.value=='range'){ + }else if(event.target.value=='range'){ this.stringCharSelected=false; this.numberCharSelected=false; this.rangeCharSelected=true; + this.credentialsConfigSelected=false; + this.policyConfigSelected=false; + this.booleanCharSelected=false; + this.charsForm.reset(); + }else if(event.target.value=='credentialsConfiguration'){ + this.stringCharSelected=false; + this.numberCharSelected=false; + this.rangeCharSelected=false; + this.credentialsConfigSelected=true; + this.policyConfigSelected=false; + this.booleanCharSelected=false; + this.charsForm.reset(); + }else if(event.target.value=='authorizationPolicy'){ + this.stringCharSelected=false; + this.numberCharSelected=false; + this.rangeCharSelected=false; + this.credentialsConfigSelected=false; + this.policyConfigSelected=true; this.booleanCharSelected=false; this.charsForm.reset(); } else { this.stringCharSelected=false; this.numberCharSelected=false; this.rangeCharSelected=false; + this.credentialsConfigSelected=false; + this.policyConfigSelected=false; this.booleanCharSelected=true; // Set default only if not already selected if (!this.charsForm.get('name')?.value && this.nonBooleanChars.length > 0) { @@ -1044,7 +1076,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){ @@ -1077,7 +1109,33 @@ 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); + } } else { console.log('boolean') if(this.creatingChars.length==0){ @@ -1125,12 +1183,22 @@ export class CreateProductSpecComponent implements OnInit { ] } 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); // Check if it's not a boolean-enabled characteristic if (!this.charsForm.value.name.endsWith('- enabled')) { @@ -1159,6 +1227,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/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 5c163bf7..84df4494 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 @@ -332,6 +332,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 }); @@ -1476,11 +1478,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/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 8114a98b..6c98af2d 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 9b6b3819..5b5a8596 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 @@ -35,7 +35,8 @@ export class OrgInfoComponent implements OnInit { name: new FormControl('', [Validators.required]), website: new FormControl(''), description: new FormControl(''), - country: new FormControl('',[Validators.required]), + country: new FormControl('', [Validators.required]), + 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)]), @@ -189,7 +190,13 @@ export class OrgInfoComponent implements OnInit { 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 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 8145a7e2..495b8beb 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]); } } @@ -187,6 +190,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/price-plan-drawer/price-plan-drawer.component.ts b/src/app/shared/price-plan-drawer/price-plan-drawer.component.ts index e41576af..8ec00b1a 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 @@ -216,11 +216,13 @@ export class PricePlanDrawerComponent implements OnInit, OnDestroy { this.filteredCharacteristics = this.characteristics.filter(char => { const isCertification = certifications.some(cert => cert.name === char.name); const isSelfAtt = char.name === 'Compliance:SelfAtt'; + const iscredentialConfig = char.valueType === 'credentialsConfiguration'; + const isAuthPolicy = char.valueType === 'authorizationPolicy'; /*const isDisabledByPrefix = disabledPrefixes.some(prefix => char.name === prefix || char.name === `${prefix} - enabled` );*/ - return !isCertification && !isSelfAtt; + return !isCertification && !isSelfAtt && !iscredentialConfig && !isAuthPolicy; }); const characteristicsGroup = this.fb.group({}); diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index 9d6b1434..c6365eea 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -286,6 +286,7 @@ "_birthdate": "Birthdate", "_date": "Date", "_country": "Country", + "_did": "DID", "_city": "City", "_mybills": "My billing addresses", "_user_id": "User id", @@ -515,6 +516,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 9d6b1434..c6365eea 100644 --- a/src/assets/i18n/es.json +++ b/src/assets/i18n/es.json @@ -286,6 +286,7 @@ "_birthdate": "Birthdate", "_date": "Date", "_country": "Country", + "_did": "DID", "_city": "City", "_mybills": "My billing addresses", "_user_id": "User id", @@ -515,6 +516,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",