Skip to content

Commit 5e7261b

Browse files
authored
Add extra support to DSP configuration params (#244)
1 parent 29dfb60 commit 5e7261b

6 files changed

Lines changed: 563 additions & 146 deletions

File tree

src/app/pages/seller-offerings/offerings/seller-product-spec/create-product-spec/create-product-spec.component.html

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ <h2 class="text-3xl font-bold text-primary-100 ml-4 dark:text-white pb-4">{{ 'CR
204204
</button>
205205
</div>-->
206206
}
207-
@if ((currentStep === 1 && !BUNDLE_ENABLED) || (currentStep === 2 && BUNDLE_ENABLED)) {
207+
@if (isCurrentStep('compliance')) {
208208
<h3 class="font-bold text-primary-100 dark:text-primary-50 text-left ml-4">
209209
{{ 'CREATE_PROD_SPEC._self_attestation' | translate }}
210210
</h3>
@@ -459,8 +459,8 @@ <h3 class="font-bold text-primary-100 dark:text-primary-50 text-left ml-4">
459459
}
460460

461461
}
462-
@if ((currentStep === 2 && !BUNDLE_ENABLED) || (currentStep === 3 && BUNDLE_ENABLED)) {
463-
@if (prodChars.length === 0){
462+
@if (isCurrentStep('characteristics') || isCurrentStep('dataspace')) {
463+
@if (getFilteredCharacteristicsForCurrentStep().length === 0){
464464
<div class="flex justify-center w-full m-4">
465465
<div class="flex w-full items-center p-4 text-sm text-primary-100 rounded-lg bg-blue-50 dark:bg-secondary-200 dark:text-primary-50" role="alert">
466466
<svg class="flex-shrink-0 inline w-4 h-4 me-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
@@ -492,8 +492,7 @@ <h3 class="font-bold text-primary-100 dark:text-primary-50 text-left ml-4">
492492
</tr>
493493
</thead>
494494
<tbody>
495-
@for (prod of prodChars; track prod;) {
496-
@if(!prod.name?.startsWith('Compliance:')){
495+
@for (prod of getFilteredCharacteristicsForCurrentStep(); track prod.id) {
497496
<tr class="border-b hover:bg-gray-200 dark:bg-secondary-300 dark:border-gray-700 dark:hover:bg-secondary-200">
498497
<td [ngClass]="{
499498
'break-all': hasLongWord(prod.name, 20),
@@ -510,7 +509,7 @@ <h3 class="font-bold text-primary-100 dark:text-primary-50 text-left ml-4">
510509
<td class="px-6 py-4 text-wrap break-all">
511510
@for (char of prod.productSpecCharacteristicValue; track char; let last=$last) {
512511
@if(char.value || char.value == 0){
513-
@if(prod.valueType === 'credentialsConfiguration' || prod.valueType === 'authorizationPolicy'){
512+
@if(isJsonCharacteristicType(prod.valueType)){
514513
@if(!last){
515514
{{getValuePreview(char.value)}},
516515
} @else {
@@ -546,16 +545,15 @@ <h3 class="font-bold text-primary-100 dark:text-primary-50 text-left ml-4">
546545
</button>
547546
</td>
548547
</tr>
549-
}
550548
}
551549
</tbody>
552550
</table>
553551
</div>
554552
}
555553
@if(!showCreateChar){
556554
<div class="flex w-full justify-items-center justify-center">
557-
<button data-cy="btnNewCharacteristic" type="button" (click)="showCreateChar=!showCreateChar" class="flex text-white justify-center bg-primary-100 hover:bg-primary-50 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center inline-flex items-center">
558-
{{ 'CREATE_PROD_SPEC._new_char' | translate }}
555+
<button data-cy="btnNewCharacteristic" type="button" (click)="toggleCreateCharacteristicForm()" class="flex text-white justify-center bg-primary-100 hover:bg-primary-50 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center inline-flex items-center">
556+
{{ isDataspaceConfigurationStep() ? 'Add Dataspace Configuration' : ('CREATE_PROD_SPEC._new_char' | translate) }}
559557
<svg class="rtl:rotate-180 w-3.5 h-3.5 ms-2" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
560558
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 12h14m-7 7V5"/>
561559
</svg>
@@ -572,13 +570,19 @@ <h3 class="font-bold text-primary-100 dark:text-primary-50 text-left ml-4">
572570
<label class="font-bold text-lg dark:text-white">{{ 'CREATE_PROD_SPEC._type' | translate }}</label>
573571
<select data-cy="charType" id="type" [(ngModel)]="charTypeSelected" [ngModelOptions]="{standalone: true}" (change)="onTypeChange($event)"
574572
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">
575-
<option value="string">String</option>
576-
<option value="number">Number</option>
577-
<option value="range">Number range</option>
578-
<option value="boolean">Boolean</option>
579-
@if(DATA_SPACE_ENABLED){
573+
@if(isDataspaceConfigurationStep()){
574+
<option value="endpointUrl">Endpoint URL</option>
575+
<option value="upstreamAddress">Upstream Address</option>
576+
<option value="endpointDescription">Endpoint Description</option>
577+
<option value="targetSpecification">Target Specification</option>
578+
<option value="serviceConfiguration">Service Configuration</option>
580579
<option value="credentialsConfiguration">Credentials Configuration</option>
581580
<option value="authorizationPolicy">Authorization Policy</option>
581+
} @else {
582+
<option value="string">String</option>
583+
<option value="number">Number</option>
584+
<option value="range">Number range</option>
585+
<option value="boolean">Boolean</option>
582586
}
583587
</select>
584588
</div>
@@ -587,7 +591,7 @@ <h3 class="font-bold text-primary-100 dark:text-primary-50 text-left ml-4">
587591
<textarea data-cy="charDescription" id="description" formControlName="description" rows="4" maxLength="500"
588592
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"></textarea>
589593
</div>
590-
@if(charTypeSelected !== 'boolean' && charTypeSelected !== 'credentialsConfiguration' && charTypeSelected !== 'authorizationPolicy'){
594+
@if(!isDataspaceConfigurationStep() && charTypeSelected !== 'boolean' && !isJsonCharacteristicType(charTypeSelected)){
591595
<div class="col-span-2 flex align-items-middle h-fit">
592596
<label for="is-optional" class="font-bold text-lg dark:text-white">{{ 'CREATE_PROD_SPEC._make_optional' | translate }}</label>
593597
<label class="inline-flex items-center me-5 cursor-pointer ml-4">
@@ -634,7 +638,7 @@ <h3 class="font-bold text-primary-100 dark:text-primary-50 text-left ml-4">
634638
class="w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded-full focus:ring-blue-500 focus:ring-2">
635639
@if(charTypeSelected === 'number'){
636640
<label for="disabled-checked-checkbox" class="ms-2 text-sm font-medium text-gray-700 dark:text-white text-wrap break-all">{{char.value}} (<i>{{char?.unitOfMeasure}}</i>)</label>
637-
} @else if (charTypeSelected === 'credentialsConfiguration' || charTypeSelected === 'authorizationPolicy') {
641+
} @else if (isJsonCharacteristicType(charTypeSelected)) {
638642
<label for="disabled-checked-checkbox" class="ms-2 text-sm font-medium text-gray-700 dark:text-white text-wrap break-all">{{getValuePreview(char.value)}}</label>
639643
} @else {
640644
<label for="disabled-checked-checkbox" class="ms-2 text-sm font-medium text-gray-700 dark:text-white text-wrap break-all">{{char.value}}</label>
@@ -651,7 +655,7 @@ <h3 class="font-bold text-primary-100 dark:text-primary-50 text-left ml-4">
651655
</div>
652656
}
653657
<label for="values" [ngClass]="((charTypeSelected === 'range' && creatingChars.length==1) || charTypeSelected === 'boolean') ? 'hidden' : ''" class="font-bold text-lg dark:text-white">{{ 'CREATE_PROD_SPEC._add_values' | translate }}</label>
654-
@if(charTypeSelected === 'string'){
658+
@if(isTextCharacteristicType(charTypeSelected)){
655659
<div class="flex flex-row items-center align-items-middle">
656660
<input data-cy="charStringValue" type="text" id="value" [(ngModel)]="stringValue"
657661
class="mr-4 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" />
@@ -721,7 +725,7 @@ <h3 class="font-bold text-primary-100 dark:text-primary-50 text-left ml-4">
721725
</svg>
722726
</button>
723727
</div>
724-
} @else if (charTypeSelected == "credentialsConfiguration" || charTypeSelected == "authorizationPolicy"){
728+
} @else if (isJsonCharacteristicType(charTypeSelected)){
725729
@if(creatingChars.length === 0){
726730
<div class="flex flex-col w-full">
727731
<label for="json-value" class="font-bold text-sm dark:text-white mb-2">{{ 'CREATE_PROD_SPEC._json_value' | translate }}</label>
@@ -758,7 +762,7 @@ <h3 class="font-bold text-primary-100 dark:text-primary-50 text-left ml-4">
758762
</div>-->
759763
}
760764

761-
@if ((currentStep === 3 && !BUNDLE_ENABLED) || (currentStep === 4 && BUNDLE_ENABLED)) {
765+
@if (isCurrentStep('resource')) {
762766
@if(loadingResourceSpec){
763767
<div role="status" class="w-full h-fit flex justify-center align-middle">
764768
<svg aria-hidden="true" class="w-12 h-12 text-gray-200 animate-spin dark:text-gray-600 fill-secondary-400" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -860,7 +864,7 @@ <h3 class="font-bold text-primary-100 dark:text-primary-50 text-left ml-4">
860864
</button>
861865
</div>-->
862866
}
863-
@if ((currentStep === 4 && !BUNDLE_ENABLED) || (currentStep === 5 && BUNDLE_ENABLED)) {
867+
@if (isCurrentStep('service')) {
864868
@if(loadingServiceSpec){
865869
<div role="status" class="w-full h-fit flex justify-center align-middle">
866870
<svg aria-hidden="true" class="w-12 h-12 text-gray-200 animate-spin dark:text-gray-600 fill-secondary-400" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -962,7 +966,7 @@ <h3 class="font-bold text-primary-100 dark:text-primary-50 text-left ml-4">
962966
</button>
963967
</div>-->
964968
}
965-
@if ((currentStep === 5 && !BUNDLE_ENABLED) || (currentStep === 6 && BUNDLE_ENABLED)) {
969+
@if (isCurrentStep('attachments')) {
966970
<div class="inline-flex">
967971
<h4 class="text-lg font-bold ml-4 dark:text-white">{{ 'CREATE_PROD_SPEC._add_prod_img' | translate }}</h4>
968972
<div class="ml-4 flex">
@@ -1163,7 +1167,7 @@ <h4 class="text-lg font-bold ml-4 dark:text-white">{{ 'CREATE_PROD_SPEC._add_att
11631167
</button>
11641168
</div> -->
11651169
}
1166-
@if ((currentStep === 6 && !BUNDLE_ENABLED) || (currentStep === 7 && BUNDLE_ENABLED)) {
1170+
@if (isCurrentStep('relationships')) {
11671171
<div class="m-4">
11681172
@if (prodRelationships.length === 0){
11691173
<div class="flex justify-center w-full mb-4">
@@ -1358,7 +1362,7 @@ <h4 class="text-lg font-bold ml-4 dark:text-white">{{ 'CREATE_PROD_SPEC._add_att
13581362
</button>
13591363
</div> -->
13601364
}
1361-
@if ((currentStep === 7 && !BUNDLE_ENABLED) || (currentStep === 8 && BUNDLE_ENABLED)) {
1365+
@if (isCurrentStep('summary')) {
13621366
<div class="m-8">
13631367
@if(loading){
13641368
<div role="status" class="w-full h-full flex justify-center align-middle">
@@ -1506,7 +1510,7 @@ <h4 class="text-lg font-bold ml-4 dark:text-white">{{ 'CREATE_PROD_SPEC._add_att
15061510
<td class="px-6 py-4 text-wrap break-all">
15071511
@for (char of prod.productSpecCharacteristicValue; track char; let last = $last) {
15081512
@if(char.value || char.value == 0){
1509-
@if(prod.valueType === 'credentialsConfiguration' || prod.valueType === 'authorizationPolicy'){
1513+
@if(isJsonCharacteristicType(prod.valueType)){
15101514
@if(!last){
15111515
{{getValuePreview(char.value)}},
15121516
} @else {
@@ -1725,7 +1729,7 @@ <h4 class="text-lg font-bold ml-4 dark:text-white">{{ 'CREATE_PROD_SPEC._add_att
17251729
256 73.4 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z"/>
17261730
</svg>
17271731
</button>
1728-
@if ((currentStep === 7 && !BUNDLE_ENABLED) || (currentStep === 8 && BUNDLE_ENABLED)) {
1732+
@if (isCurrentStep('summary')) {
17291733
<button data-cy="btnCreateProduct"
17301734
(click)="createProduct()"
17311735
[disabled]="isStepDisabled() || loading"

0 commit comments

Comments
 (0)