|
18 | 18 | </div>
|
19 | 19 | <div class="col-md-6">
|
20 | 20 | <div class="form-group">
|
21 |
| - <label> Instance Type (Optional) </label> |
| 21 | + <label |
| 22 | + data-toggle="tooltip" |
| 23 | + data-placement="bottom" |
| 24 | + title="Used to impose resource limits akin to different cloud provider limits!"> |
| 25 | + Instance Type (Optional) |
| 26 | + <i class="fas fa-question-circle"></i></label> |
22 | 27 | <select id="newContainerInstanceType" class="form-control"></select>
|
23 | 28 | </div>
|
24 | 29 | </div>
|
|
202 | 207 | });
|
203 | 208 |
|
204 | 209 | $("#modal-container-create").on("click", "#create", function(){
|
| 210 | + let btn = $(this); |
| 211 | +
|
| 212 | + btn.html('<i class="fa fa-cog fa-spin"></i>Creating..'); |
| 213 | + $("#modal-container-create").find(".btn").attr("disabled", true); |
| 214 | +
|
205 | 215 | let profileIds = mapObjToSignleDimension($("#newContainerProfiles").tokenInput("get"), "profile");
|
206 | 216 | let hosts = mapObjToSignleDimension($("#newContainerHosts").tokenInput("get"), "hostId");
|
207 | 217 | let image = $("#newContainerImage").tokenInput("get");
|
208 | 218 | let instanceType = $("#newContainerInstanceType").val();
|
209 | 219 |
|
210 |
| - if(image.legnth == 0 || !image[0].hasOwnProperty("details")){ |
| 220 | + if(image.length == 0 || !image[0].hasOwnProperty("details")){ |
| 221 | + btn.html('Create Container'); |
| 222 | + $("#modal-container-create").find(".btn").attr("disabled", false); |
211 | 223 | makeToastr(JSON.stringify({state: "error", message: "Please select image"}));
|
212 | 224 | return false;
|
213 | 225 | }
|
214 | 226 |
|
| 227 | + if(hosts.length == 0 || !image[0].hasOwnProperty("details")){ |
| 228 | + btn.html('Create Container'); |
| 229 | + $("#modal-container-create").find(".btn").attr("disabled", false); |
| 230 | + makeToastr(JSON.stringify({state: "error", message: "Please select host/s"})); |
| 231 | + return false; |
| 232 | + } |
| 233 | +
|
215 | 234 | let gpus = [];
|
216 | 235 |
|
217 | 236 | if(hosts.length == 1){
|
|
240 | 259 | });
|
241 | 260 |
|
242 | 261 | if(invalid){
|
| 262 | + btn.html('Create Container'); |
| 263 | + $("#modal-container-create").find(".btn").attr("disabled", false); |
243 | 264 | makeToastr(JSON.stringify({state: "error", message: message}));
|
244 | 265 | return false;
|
245 | 266 | }
|
|
256 | 277 |
|
257 | 278 | ajaxRequest(globalUrls.instances.create, x, function(data){
|
258 | 279 | let x = makeToastr(data);
|
| 280 | + btn.html('Create Container'); |
| 281 | + $("#modal-container-create").find(".btn").attr("disabled", false); |
259 | 282 | if(x.state == "error"){
|
260 | 283 | return false;
|
261 | 284 | }
|
262 | 285 | $("#modal-container-create").modal("hide");
|
263 |
| - createDashboardSidebar(); |
| 286 | + if(typeof io == "undefined"){ |
| 287 | + createDashboardSidebar(); |
| 288 | + } |
264 | 289 | });
|
265 | 290 | });
|
266 | 291 | </script>
|
0 commit comments