2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2023 Nordix Foundation. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 <div class="sub-operation-filters">
22 <div class="group-with-border content-row">
23 <form novalidate class="w-sdc-form two-columns" [formGroup]="filterForm">
24 <div formArrayName="filterFormList">
25 <label class="filters-label"> Filters </label>
26 <div *ngFor="let filter of filters; let idx = index">
27 <div class="side-by-side group-with-border">
28 <div class="form-item">
29 <div class="side-by-side">
30 <div class="form-item">
31 <label class="sdc-timeout-label">Name: </label>
33 class="i-sdc-form-input"
34 [disabled]="isViewOnly"
36 [ngClass]="{'disabled': isViewOnly}"
37 (input)="onFilterNameChange($event.target.value, idx)"
40 <div class="form-item">
41 <label>Constraint: </label>
42 <div class="sdc-dropdown">
43 <select class="i-sdc-form-select"
44 data-tests-id="filter-type"
45 [value]="filter.constraint"
46 [disabled]="isViewOnly"
47 (change)="onFilterConstraintChange($event.target.value, idx)"
49 <option *ngIf="filter" [value]="filter.constraint" hidden selected>
50 {{ ConstraintTypesMapping[filter.constraint] }}
52 <option *ngFor="let operatorType of operatorTypes"
53 [value]="operatorType">
54 {{ ConstraintTypesMapping[operatorType] }}
61 <div class="form-item">
62 <div class="side-by-side">
63 <div class="form-item-big">
64 <fieldset class="padding-zero" [disabled]="isViewOnly" >
65 <label>Value: </label>
66 <input type="radio" [name]="'hasGetFunctionValue.' + filter.name + idx"
68 [checked]="!isToscaFunction(idx)"
69 (change)="onValueTypeChange($event.target.value, idx)"/> Value
70 <input type="radio" [name]="'hasGetFunctionValue.' + filter.name + idx"
71 [checked]="isToscaFunction(idx)"
72 (change)="onValueTypeChange($event.target.value, idx)"
73 [value]="true"/> {{'TOSCA_FUNCTION_LABEL' | translate}}
75 <div *ngIf="isToscaFunction(idx)">
76 <div *ngIf="componentInstanceMap">
78 [property]="getAsProperty(idx)"
80 [customToscaFunctions]="customToscaFunctions"
81 [componentInstanceMap]="componentInstanceMap"
82 (onValidityChange)="onToscaFunctionValidityChange($event, idx)">
85 <div *ngIf="!componentInstanceMap">
87 [property]="getAsProperty(idx)"
89 [customToscaFunctions]="customToscaFunctions"
90 (onValidityChange)="onToscaFunctionValidityChange($event, idx)">
94 <div *ngIf="!isToscaFunction(idx)">
95 <div *ngIf="filter.constraint == 'validValues'">
96 <div class="add-btn padding-bottom"
97 [ngClass]="{'disabled': isViewOnly}"
98 (click)="addToList(idx)">
101 <div class="w-sdc-form-columns-wrapper padding-bottom" *ngFor="let value of constraintValuesArray(idx); let valueIndex = index; trackBy:trackByFn">
102 <div class="w-sdc-form-column">
103 <input type="text" required
104 (change)="onChangeConstrainValueIndex(idx, $event.target.value, valueIndex)"
105 [disabled]="isViewOnly"
106 [value]="getInRangeValue(idx, valueIndex)"/>
108 <div class="w-sdc-form-column">
109 <span class="sprite-new delete-btn" [ngClass]="{'disabled': isViewOnly}" (click)="removeFromList(idx, valueIndex)"></span>
113 <div *ngIf="filter.constraint == 'inRange'">
114 <div class="side-by-side">
115 <div class="form-item-50">
116 <input type="text" required
117 (input)="onChangeConstrainValueIndex(idx, $event.target.value, 0)"
118 [disabled]="isViewOnly"
119 [value]="getInRangeValue(idx, 0)"/>
121 <div class="form-item-50">
122 <input type="text" required
123 (input)="onChangeConstrainValueIndex(idx, $event.target.value, 1)"
124 [disabled]="isViewOnly"
125 [value]="getInRangeValue(idx, 1)"/>
129 <div *ngIf="filter.constraint != 'inRange' && filter.constraint != 'validValues'">
131 class="i-sdc-form-input"
132 [disabled]="isViewOnly"
133 [ngClass]="{'disabled': isViewOnly}"
134 [value]="filter.filterValue"
135 (input)="onFilterValueChange($event.target.value, idx)"
140 <div class="form-item-icon">
141 <span class="sprite-new delete-btn" [ngClass]="{'disabled': isViewOnly}" (click)="removeFromFilters(idx)"></span>
146 <div class="w-sdc-form-columns-wrapper">
147 <div class="validation-errors">
148 <ng-container *ngFor="let validation of validationMessages.filter">
149 <div class="input-error" *ngIf="filterFormArray.at(idx).hasError(validation.type);">
150 {{ validation.message }}
157 <div class="add-button-container group-with-border" *ngIf="!isViewOnly && activitiesExist">
158 <a class="add-btn" data-tests-id="add-input.add-input-link"
159 (click)="addFilter()">Add Filter</a>
161 <div *ngIf="!activitiesExist">
162 Must have at leat one actifity before adding filters