|
2 | 2 | <ng-container i18n="form title" |
3 | 3 | class="modal-title">{{ action | titlecase }} {{ groupType | upperFirst }} Flow</ng-container> |
4 | 4 |
|
5 | | - <ng-container class="modal-content"> |
6 | | - <form name="flowForm" |
7 | | - #frm="ngForm" |
8 | | - [formGroup]="currentFormGroupContext" |
9 | | - novalidate> |
10 | | - <div class="modal-body"> |
| 5 | + <ng-container class="modal-content"> |
| 6 | + <form name="flowForm" |
| 7 | + #frm="ngForm" |
| 8 | + [formGroup]="currentFormGroupContext" |
| 9 | + novalidate> |
| 10 | + <div class="modal-body"> |
| 11 | + <div class="form-group row"> |
| 12 | + <label class="cd-col-form-label required" |
| 13 | + for="flow_id" |
| 14 | + i18n>Name</label> |
| 15 | + <div class="cd-col-form-input"> |
| 16 | + <input class="form-control" |
| 17 | + type="text" |
| 18 | + placeholder="Flow Name..." |
| 19 | + id="flow_id" |
| 20 | + name="flow_id" |
| 21 | + formControlName="flow_id"/> |
| 22 | + </div> |
| 23 | + </div> |
| 24 | + <div class="form-group row"> |
| 25 | + <label class="cd-col-form-label" |
| 26 | + for="bucket" |
| 27 | + i18n>Bucket Name</label> |
| 28 | + <div class="cd-col-form-input"> |
| 29 | + <input id="bucket" |
| 30 | + name="bucket" |
| 31 | + class="form-control" |
| 32 | + type="text" |
| 33 | + i18n-placeholder |
| 34 | + placeholder="Bucket Name..." |
| 35 | + formControlName="bucket_name"/> |
| 36 | + <span class="invalid-feedback" |
| 37 | + *ngIf="currentFormGroupContext.showError('bucket_name', frm, 'bucketNameNotAllowed')" |
| 38 | + i18n>The bucket with chosen name does not exist.</span> |
| 39 | + </div> |
| 40 | + </div> |
| 41 | + <ng-container *ngIf="groupType == flowType.symmetrical; else directionalFlow"> |
11 | 42 | <div class="form-group row"> |
12 | 43 | <label class="cd-col-form-label required" |
13 | | - for="flow_id" |
14 | | - i18n>Name</label> |
| 44 | + for="zones"> |
| 45 | + <ng-container i18n>Zones</ng-container> |
| 46 | + <cd-helper> |
| 47 | + <span i18n>Flow need to be associated with atleast one zone</span> |
| 48 | + </cd-helper> |
| 49 | + </label> |
15 | 50 | <div class="cd-col-form-input"> |
16 | | - <input class="form-control" |
17 | | - type="text" |
18 | | - placeholder="Flow Name..." |
19 | | - id="flow_id" |
20 | | - name="flow_id" |
21 | | - formControlName="flow_id"/> |
| 51 | + <ng-container *ngTemplateOutlet="zoneMultiSelect;context: { name: 'zones', zone: zones }"></ng-container> |
22 | 52 | </div> |
23 | 53 | </div> |
| 54 | + </ng-container> |
| 55 | + <ng-template #directionalFlow> |
24 | 56 | <div class="form-group row"> |
25 | | - <label class="cd-col-form-label" |
26 | | - for="bucket" |
27 | | - i18n>Bucket Name</label> |
| 57 | + <label class="cd-col-form-label required" |
| 58 | + for="source_zone" |
| 59 | + i18n>Source Zone |
| 60 | + </label> |
28 | 61 | <div class="cd-col-form-input"> |
29 | | - <input id="bucket" |
30 | | - name="bucket" |
31 | | - class="form-control" |
32 | | - type="text" |
33 | | - i18n-placeholder |
34 | | - placeholder="Bucket Name..." |
35 | | - formControlName="bucket_name"/> |
36 | | - <span class="invalid-feedback" |
37 | | - *ngIf="currentFormGroupContext.showError('bucket_name', frm, 'bucketNameNotAllowed')" |
38 | | - i18n>The bucket with chosen name does not exist.</span> |
| 62 | + <ng-container *ngTemplateOutlet="sourceAndDestZone;context: { name: 'source_zone', zones: zones }"></ng-container> |
39 | 63 | </div> |
40 | 64 | </div> |
41 | | - <ng-container *ngIf="groupType == flowType.symmetrical; else directionalFlow"> |
42 | | - <div class="form-group row"> |
43 | | - <label class="cd-col-form-label required" |
44 | | - for="zones"> |
45 | | - <ng-container i18n>Zones</ng-container> |
46 | | - <cd-helper> |
47 | | - <span i18n>Flow need to be associated with atleast one zone</span> |
48 | | - </cd-helper> |
49 | | - </label> |
50 | | - <div class="cd-col-form-input"> |
51 | | - <ng-container *ngTemplateOutlet="zoneMultiSelect;context: { name: 'zones', zone: zones }"></ng-container> |
52 | | - </div> |
53 | | - </div> |
54 | | - </ng-container> |
55 | | - <ng-template #directionalFlow> |
56 | | - <div class="form-group row"> |
57 | | - <label class="cd-col-form-label required" |
58 | | - for="source_zone" |
59 | | - i18n>Source Zone |
60 | | - </label> |
61 | | - <div class="cd-col-form-input"> |
62 | | - <select id="sourceZone" |
63 | | - name="sourceZone" |
64 | | - class="form-select" |
65 | | - formControlName="source_zone" |
66 | | - [autofocus]="editing"> |
67 | | - <option i18n |
68 | | - *ngIf="zones.data.available.length == 0" |
69 | | - [ngValue]="null">Loading...</option> |
70 | | - <option i18n |
71 | | - *ngIf="zones.data.available.length > 0" |
72 | | - [ngValue]="null">-- Select source zone --</option> |
73 | | - <option *ngFor="let sourceZone of zones.data.available" |
74 | | - [value]="sourceZone.name">{{ sourceZone.name }}</option> |
75 | | - </select> |
76 | | - <span class="invalid-feedback" |
77 | | - *ngIf="currentFormGroupContext.showError('source_zone', frm, 'required')" |
78 | | - i18n>This field is required.</span> |
79 | | - </div> |
80 | | - </div> |
81 | | - <div class="form-group row"> |
82 | | - <label class="cd-col-form-label required" |
83 | | - for="destination_zone" |
84 | | - i18n>Destination Zone</label> |
85 | | - <div class="cd-col-form-input"> |
86 | | - <input id="destination_zone" |
87 | | - name="destination_zone" |
88 | | - class="form-control" |
89 | | - type="text" |
90 | | - i18n-placeholder |
91 | | - placeholder="Destination Zone..." |
92 | | - formControlName="destination_zone"/> |
93 | | - <span class="invalid-feedback" |
94 | | - *ngIf="currentFormGroupContext.showError('destination_zone', frm, 'required')" |
95 | | - i18n>This field is required.</span> |
96 | | - </div> |
| 65 | + <div class="form-group row"> |
| 66 | + <label class="cd-col-form-label required" |
| 67 | + for="destination_zone" |
| 68 | + i18n>Destination Zone</label> |
| 69 | + <div class="cd-col-form-input"> |
| 70 | + <ng-container *ngTemplateOutlet="sourceAndDestZone;context: { name: 'destination_zone', zones: zones }"></ng-container> |
97 | 71 | </div> |
98 | | - </ng-template> |
99 | | - </div> |
100 | | - <div class="modal-footer"> |
101 | | - <cd-form-button-panel (submitActionEvent)="submit()" |
102 | | - [form]="currentFormGroupContext" |
103 | | - [submitText]="(action | titlecase) + ' ' + (groupType | upperFirst) + ' ' + 'Flow'"></cd-form-button-panel> |
104 | | - </div> |
105 | | - </form> |
106 | | - </ng-container> |
107 | | - </cd-modal> |
| 72 | + </div> |
| 73 | + </ng-template> |
| 74 | + </div> |
| 75 | + <div class="modal-footer"> |
| 76 | + <cd-form-button-panel (submitActionEvent)="submit()" |
| 77 | + [form]="currentFormGroupContext" |
| 78 | + [submitText]="(action | titlecase) + ' ' + (groupType | upperFirst) + ' ' + 'Flow'"></cd-form-button-panel> |
| 79 | + </div> |
| 80 | + </form> |
| 81 | + </ng-container> |
| 82 | +</cd-modal> |
108 | 83 |
|
109 | 84 | <ng-template #zoneMultiSelect |
110 | 85 | let-name="name" |
|
128 | 103 | i18n>{{name?.split('_').join(' ')}} selection is required! |
129 | 104 | </span> |
130 | 105 | </ng-template> |
| 106 | + |
| 107 | +<ng-template #sourceAndDestZone |
| 108 | + let-name="name" |
| 109 | + let-zones="zones"> |
| 110 | + <select [id]="name" |
| 111 | + [name]="name" |
| 112 | + class="form-select" |
| 113 | + (change)="onChangeZoneDropdown(name, $event)" |
| 114 | + [autofocus]="editing"> |
| 115 | + <option i18n |
| 116 | + *ngIf="zones.data.available.length == 0" |
| 117 | + [ngValue]="null">Loading...</option> |
| 118 | + <option i18n |
| 119 | + *ngIf="zones.data.available.length > 0" |
| 120 | + [ngValue]="null">-- Select {{name.split('_').join(' ')}} --</option> |
| 121 | + <option *ngFor="let destinationZone of zones.data.available" |
| 122 | + [value]="destinationZone.name">{{ destinationZone.name }}</option> |
| 123 | + </select> |
| 124 | + <span class="invalid-feedback" |
| 125 | + *ngIf="currentFormGroupContext.showError(name, frm, 'required')" |
| 126 | + i18n>This field is required.</span> |
| 127 | +</ng-template> |
0 commit comments