Enable UI component to display property constraints
[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="default-value-container i-sdc-form-item" *ngIf="showDefaultValue()">
44       <label class="i-sdc-form-label">{{'PROPERTY_DEFAULT_VALUE_LABEL' | translate}}</label>
45       <ng-container *ngIf="!readOnly">
46         <input type="checkbox" formControlName="hasDefaultValue" [attr.disabled]="readOnly ? readOnly : null"/> {{'PROPERTY_SET_DEFAULT_VALUE_MSG' | translate}}
47       </ng-container>
48       <ng-container *ngIf="hasDefaultValueForm.value">
49         <ul>
50           <app-input-list-item
51               [name]="nameForm.value"
52               [type]="getDataType(typeForm.value)"
53               [dataTypeMap]="dataTypeMap"
54               [valueObjRef]="defaultValueForm.value"
55               [schema]="buildSchemaGroupProperty()"
56               [nestingLevel]="0"
57               [isViewOnly]="readOnly"
58               [allowDeletion]="false"
59               [isExpanded]="true"
60               (onValueChange)="onPropertyValueChange($event)">
61           </app-input-list-item>
62         </ul>
63       </ng-container>
64     </div>
65   </form>
66 </div>