Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -567,11 +567,13 @@ <h3 class="text-sm italic text-gray-600 ml-4 dark:text-gray-200">There's no char
}
<div>
<label class="font-bold text-lg dark:text-white">{{ 'CREATE_PROD_SPEC._type' | translate }}</label>
<select id="type" (change)="onTypeChange($event)"
<select id="type" (change)="onTypeChange($event)"
class="mb-2 bg-gray-50 dark:bg-secondary-300 border border-gray-300 dark:border-secondary-200 dark:text-white text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5">
<option selected value="string">String</option>
<option value="number">Number</option>
<option value="range">Number range</option>
<option value="credentialsConfiguration">Credentials Configuration</option>
<option value="authorizationPolicy">Authorization Policy</option>
<option value="boolean">Boolean</option>
</select>
</div>
Expand Down Expand Up @@ -682,8 +684,21 @@ <h3 class="text-sm italic text-gray-600 ml-4 dark:text-gray-200">There's no char
<button (click)="addCharValue()" [disabled]="(fromValue === '' || fromValue === null || fromValue === undefined) || (toValue === '' || toValue === null || toValue === undefined) || !rangeUnit" [ngClass]="(fromValue === '' || fromValue === null || fromValue === undefined) || (toValue === '' || toValue === null || toValue === undefined) || !rangeUnit ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer'" type="button" class="text-white w-fit h-full bg-primary-100 hover:bg-primary-50 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-full text-sm p-1 text-center inline-flex items-center">
<svg class="w-6 h-6 text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 12h14m-7 7V5"/>
</svg>
</button>
</svg>
</button>
</div>
} @else if (credentialsConfigSelected || policyConfigSelected){
<div class="flex flex-col w-full">
<label for="json-value" class="font-bold text-sm dark:text-white mb-2">{{ 'CREATE_PROD_SPEC._json_value' | translate }}</label>
<textarea id="json-value" [(ngModel)]="jsonValue" rows="10"
class="mb-2 min-h-fit bg-gray-50 dark:bg-secondary-300 border border-gray-300 dark:border-secondary-200 dark:text-white text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 font-mono"
placeholder='{"example": "Enter your JSON here"}'></textarea>
<button (click)="addCharValue()" [disabled]="!jsonValue" [ngClass]="!jsonValue ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer'" type="button" class="text-white w-fit bg-primary-100 hover:bg-primary-50 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-4 py-2 text-center inline-flex items-center">
<svg class="w-4 h-4 mr-2 text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 12h14m-7 7V5"/>
</svg>
{{ 'CREATE_PROD_SPEC._add_json' | translate }}
</button>
</div>
}
<div class="flex w-full justify-items-center justify-center mt-4">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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[]=[];
Expand Down Expand Up @@ -172,6 +174,7 @@ export class CreateProductSpecComponent implements OnInit {
toValue: string = '';
booleanValue: boolean = false;
rangeUnit: string = '';
jsonValue: string = '';

filenameRegex = /^[A-Za-z0-9_.-]+$/;

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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=[];
}
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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){
Expand Down Expand Up @@ -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){
Expand Down Expand Up @@ -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')) {
Expand Down Expand Up @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
});

Expand Down Expand Up @@ -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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ <h2 class="md:text-3xl lg:text-4xl font-bold text-primary-100 ml-4 dark:text-whi
</option>
</select>
</div>
<div>
<span class="font-bold dark:text-white">{{ 'PROFILE._did' | translate }}</span>
<input type="text" formControlName="did" id="did"
class="mb-2 bg-gray-50 border border-gray-300 text-gray-900 dark:bg-secondary-300 dark:border-secondary-200 dark:text-white text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5" />
</div>

<label class="font-bold text-lg col-span-2 dark:text-white">{{ 'UPDATE_OFFER._description' | translate }}</label>
<div class="w-full col-span-2 mb-4 border border-gray-200 rounded-lg bg-gray-50 dark:bg-secondary-200 dark:border-secondary-200">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)]),
Expand Down Expand Up @@ -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<this.contactmediums.length; i++){
console.log(this.contactmediums)
Expand Down Expand Up @@ -310,9 +317,11 @@ export class OrgInfoComponent implements OnInit {
this.profileForm.controls['description'].setValue(profile.partyCharacteristic[i].value);
this.description=profile.partyCharacteristic[i].value;
}else if(profile.partyCharacteristic[i].name=='website') {
this.profileForm.controls['website'].setValue(profile.partyCharacteristic[i].value);
this.profileForm.controls['website'].setValue(profile.partyCharacteristic[i].value);
} else if(profile.partyCharacteristic[i].name=='country') {
this.profileForm.controls['country'].setValue(profile.partyCharacteristic[i].value);
} else if(profile.partyCharacteristic[i].name=='did') {
this.profileForm.controls['did'].setValue(profile.partyCharacteristic[i].value);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ export class ConfigurationProfileDrawerComponent implements OnInit {
//const characteristicsData = this.profileData || [];
let profileChars = [];
for(let i=0;i<this.profileData.length;i++){
if (!certifications.some(certification => 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]);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ export class PriceComponentDrawerComponent implements OnInit {
}, 50);

for(let i=0;i<this.prodChars.length;i++){
if (!certifications.some(certification => 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]);
}
}
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({});
Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@
"_birthdate": "Birthdate",
"_date": "Date",
"_country": "Country",
"_did": "DID",
"_city": "City",
"_mybills": "My billing addresses",
"_user_id": "User id",
Expand Down Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@
"_birthdate": "Birthdate",
"_date": "Date",
"_country": "Country",
"_did": "DID",
"_city": "City",
"_mybills": "My billing addresses",
"_user_id": "User id",
Expand Down Expand Up @@ -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",
Expand Down
Loading