Constraints in data type view
[sdc.git] / catalog-ui / src / app / ng2 / pages / type-workspace / type-workspace-properties / add-property / add-property.component.html
1 <div class="add-property-container">
2   <loader [display]="isLoading" [size]="'large'" [relative]="true" [loaderDelay]="500"></loader>
3   <form class="w-sdc-form" [formGroup]="formGroup">
4
5     <div class="side-by-side">
6       <div class="i-sdc-form-item">
7         <label class="i-sdc-form-label required">{{'PROPERTY_NAME_LABEL' | translate}}</label>
8         <input class="i-sdc-form-input"
9                type="text"
10                data-tests-id="property-name"
11                formControlName="name"
12                [readOnly]="readOnly"/>
13       </div>
14       <div class="i-sdc-form-item">
15         <label class="i-sdc-form-label required">{{'PROPERTY_TYPE_LABEL' | translate}}</label>
16         <select formControlName="type" (change)="onTypeChange()" [attr.disabled]="readOnly ? readOnly : null">
17           <option [ngValue]="null">{{'GENERAL_LABEL_SELECT' | translate}}</option>
18           <option *ngFor="let type of typeList"
19                   [ngValue]="type">{{type}}</option>
20         </select>
21       </div>
22       <div class="i-sdc-form-item">
23         <input type="checkbox" formControlName="required" [attr.disabled]="readOnly ? readOnly : null"/> {{'PROPERTY_REQUIRED_LABEL' | translate}}
24       </div>
25       <div class="i-sdc-form-item propertySchemaType" *ngIf="showSchema">
26         <label class="i-sdc-form-label required">{{'PROPERTY_SCHEMA_LABEL' | translate}}</label>
27         <select formControlName="schema" (change)="onSchemaChange()" [attr.disabled]="readOnly ? readOnly : null">
28           <option [ngValue]="null">{{'GENERAL_LABEL_SELECT' | translate}}</option>
29           <option *ngFor="let type of schemaTypeList"
30                   [ngValue]="type">{{type}}</option>
31         </select>
32       </div>
33     </div>
34
35     <div class="i-sdc-form-item">
36       <label class="i-sdc-form-label">{{'PROPERTY_DESCRIPTION_LABEL' | translate}}</label>
37       <textarea class="i-sdc-form-textarea"
38                 formControlName="description"
39                 data-tests-id="property-description"
40                 [readOnly]="readOnly">
41       </textarea>
42     </div>
43       <div class="constraints-section i-sdc-form-item">
44           <label class="i-sdc-form-label" *ngIf="property ? property.constraints: false">Constraints</label>
45           <ng-container>
46               <app-constraints [propertyConstraints]="property ? property.constraints ? property.constraints : null : null"
47                                [isViewOnly]="readOnly"
48                                [propertyType]="property ? property.type : typeForm.value"
49                                (onConstraintChange)="onConstraintChange($event)">
50               </app-constraints>
51           </ng-container>
52       </div>
53
54       <div class="default-value-container i-sdc-form-item" *ngIf="showDefaultValue()">
55       <label class="i-sdc-form-label">{{'PROPERTY_DEFAULT_VALUE_LABEL' | translate}}</label>
56       <ng-container *ngIf="!readOnly">
57         <input type="checkbox" formControlName="hasDefaultValue" [attr.disabled]="readOnly ? readOnly : null"/> {{'PROPERTY_SET_DEFAULT_VALUE_MSG' | translate}}
58       </ng-container>
59       <ng-container *ngIf="hasDefaultValueForm.value">
60         <ul>
61           <app-input-list-item
62               [name]="nameForm.value"
63               [type]="getDataType(typeForm.value)"
64               [dataTypeMap]="dataTypeMap"
65               [valueObjRef]="defaultValueForm.value"
66               [schema]="buildSchemaGroupProperty()"
67               [nestingLevel]="0"
68               [isViewOnly]="readOnly"
69               [allowDeletion]="false"
70               [isExpanded]="true"
71               (onValueChange)="onPropertyValueChange($event)">
72           </app-input-list-item>
73         </ul>
74       </ng-container>
75     </div>
76   </form>
77 </div>