77
77
</ ngx-datatable-column >
78
78
< ngx-datatable-column name ="Actions " [flexGrow] ="0.1 ">
79
79
< ng-template let-row ="row " let-value ="value " ngx-datatable-cell-template >
80
- < a class ="btn btn--small btn--icon btn--primary " title ="Update " (click) ='openModal(editTemplate ,row) '>
81
- < span data-balloon ="Update " data-balloon-pos ="left ">
80
+ < a class ="btn btn--small btn--icon btn--primary " title ="Edit " (click) ='openModal(addtemplate ,row) '>
81
+ < span data-balloon ="Edit " data-balloon-pos ="left ">
82
82
< span class ="icon-pencil "> </ span >
83
83
</ span >
84
84
</ a >
@@ -112,14 +112,14 @@ <h4>
112
112
< ng-template #addtemplate >
113
113
< form #fabricForm ="ngForm " (ngSubmit) ="onSubmit() ">
114
114
< div class ="modal-body ">
115
- < h6 >
116
- Add a new fabric
117
- </ h6 >
115
+ < h6 *ngIf ="fabric.is_new "> Add a new fabric </ h6 >
116
+ < h6 *ngIf ="!fabric.is_new "> Edit fabric </ h6 >
118
117
< div class ="row ">
119
118
< div class ="col-md-12 ">
120
119
< div class ="form-group ">
121
120
< div class ="form-group__text ">
122
- < input id ="fabric " type ="text " required [(ngModel)] ="fabric.fabric " name ="name ">
121
+ < input id ="fabric " type ="text " [disabled] ="!fabric.is_new " [required] ="fabric.is_new "
122
+ [(ngModel)] ="fabric.fabric " name ="name ">
123
123
< label for ="fabric "> Name</ label >
124
124
</ div >
125
125
</ div >
@@ -137,65 +137,24 @@ <h6>
137
137
</ div >
138
138
< div class ="form-group ">
139
139
< div class ="form-group__text ">
140
- < input id ="apic_password " type ="password " required [(ngModel)] ="fabric.apic_password "
140
+ < input id ="apic_password " type ="password " [ required] =" fabric.is_new " [(ngModel)] ="fabric.apic_password "
141
141
name ="apic_password ">
142
142
< label for ="apic_password "> Password</ label >
143
143
</ div >
144
144
</ div >
145
- </ div >
146
- < div class ="col-md-12 ">
147
-
148
- </ div >
149
- </ div >
150
- </ div >
151
- < br >
152
- < div class ="modal-footer ">
153
- < button type ="submit " class ="btn btn--small btn--primary " [disabled] ="!fabricForm.form.valid "> Add</ button >
154
- < button type ="reset " class ="btn btn--small " (click) ="hideModal() "> Cancel</ button >
155
- </ div >
156
- </ form >
157
- </ ng-template >
158
- < ng-template #editTemplate >
159
- < form #editfabricForm ="ngForm " (ngSubmit) ="updateValue() ">
160
- < div class ="modal-body ">
161
- < h6 >
162
- Edit fabric
163
- </ h6 >
164
- < div class ="row ">
165
- < div class ="col-md-12 ">
166
- < div class ="form-group ">
145
+ < div class ="form-group " [ngClass] ="{'form-group--error':fabric.apic_password !== fabric.password_confirm} ">
167
146
< div class ="form-group__text ">
168
- < input id ="editfabric " type ="text " required [ngModel] ="fabric.fabric " name ="name " readonly >
169
- < label for ="editfabric "> Name</ label >
147
+ < input id ="password_confirm " type ="password " [required] ="fabric.is_new " [(ngModel)] ="fabric.password_confirm "
148
+ name ="password_confirm ">
149
+ < label for ="password_confirm "> Confirm password</ label >
170
150
</ div >
171
151
</ div >
172
- < div class ="form-group ">
173
- < div class ="form-group__text ">
174
- < input id ="edit_apic_hostname " type ="text " required [(ngModel)] ="fabric.apic_hostname "
175
- name ="apic_hostname ">
176
- < label for ="edit_apic_hostname "> Hostname</ label >
177
- </ div >
178
- </ div >
179
- < div class ="form-group ">
180
- < div class ="form-group__text ">
181
- < input id ="edit_apic_username " type ="text " required [(ngModel)] ="fabric.apic_username "
182
- name ="apic_username ">
183
- < label for ="edit_apic_username "> Username</ label >
184
- </ div >
185
- </ div >
186
- < div class ="form-group ">
187
- < div class ="form-group__text ">
188
- < input id ="edit_apic_password " type ="password " required [(ngModel)] ="fabric.apic_password "
189
- name ="apic_password ">
190
- < label for ="edit_apic_password "> Password</ label >
191
- </ div >
192
- </ div >
193
- < div class ="form-group ">
194
- < div class ="form-group__text ">
195
- < input id ="confirm_apic_password " type ="password " required [(ngModel)] ="confirmPassword "
196
- name ="confirm_apic_password ">
197
- < label for ="confirm_apic_password "> Confirm Password</ label >
198
- </ div >
152
+ < div class ="form-group form-group--inline ">
153
+ < label class ="checkbox ">
154
+ < input type ="checkbox " [(ngModel)] ="fabric.validate " name ="validate ">
155
+ < span class ="checkbox__input "> </ span >
156
+ < span class ="checkbox__label "> Validate credentials</ span >
157
+ </ label >
199
158
</ div >
200
159
</ div >
201
160
< div class ="col-md-12 ">
205
164
</ div >
206
165
< br >
207
166
< div class ="modal-footer ">
208
- < button type ="submit " class ="btn btn--small btn--primary " [disabled] ="!editfabricForm.form.valid "> Update</ button >
167
+ < button type ="submit " class ="btn btn--small btn--primary " [disabled] ="!fabricForm.form.valid ">
168
+ {{ fabric.is_new?'Add':'Save'}}
169
+ </ button >
209
170
< button type ="reset " class ="btn btn--small " (click) ="hideModal() "> Cancel</ button >
210
171
</ div >
211
172
</ form >
0 commit comments