Skip to content

Commit d25a35f

Browse files
committed
Improve create container UX
1 parent b769414 commit d25a35f

File tree

3 files changed

+32
-4
lines changed

3 files changed

+32
-4
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ Unreleased
22

33
Changed
44
Used buttons instead of dropdown to change instance state
5+
Slight improvement to create container UX
56

67
0.9.3
78

src/views/index.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,9 @@
552552
]
553553

554554
if(loadServerOviewDescriptions.includes(msg.metadata.description) && msg.metadata.status_code == 200 && $("#mainBreadcrumb").find(".active").text()){
555-
loadContainerTreeAfter();
555+
if($(`.nav-item[data-hostid='${msg.hostId}']`).hasClass("open")){
556+
loadContainerTreeAfter(0, msg.hostId, msg.hostAlias);
557+
}
556558
}
557559

558560
if(hostList.length == 0){

src/views/modals/containers/createContainer.php

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@
1818
</div>
1919
<div class="col-md-6">
2020
<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>
2227
<select id="newContainerInstanceType" class="form-control"></select>
2328
</div>
2429
</div>
@@ -202,16 +207,30 @@
202207
});
203208
204209
$("#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+
205215
let profileIds = mapObjToSignleDimension($("#newContainerProfiles").tokenInput("get"), "profile");
206216
let hosts = mapObjToSignleDimension($("#newContainerHosts").tokenInput("get"), "hostId");
207217
let image = $("#newContainerImage").tokenInput("get");
208218
let instanceType = $("#newContainerInstanceType").val();
209219
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);
211223
makeToastr(JSON.stringify({state: "error", message: "Please select image"}));
212224
return false;
213225
}
214226
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+
215234
let gpus = [];
216235
217236
if(hosts.length == 1){
@@ -240,6 +259,8 @@
240259
});
241260
242261
if(invalid){
262+
btn.html('Create Container');
263+
$("#modal-container-create").find(".btn").attr("disabled", false);
243264
makeToastr(JSON.stringify({state: "error", message: message}));
244265
return false;
245266
}
@@ -256,11 +277,15 @@
256277
257278
ajaxRequest(globalUrls.instances.create, x, function(data){
258279
let x = makeToastr(data);
280+
btn.html('Create Container');
281+
$("#modal-container-create").find(".btn").attr("disabled", false);
259282
if(x.state == "error"){
260283
return false;
261284
}
262285
$("#modal-container-create").modal("hide");
263-
createDashboardSidebar();
286+
if(typeof io == "undefined"){
287+
createDashboardSidebar();
288+
}
264289
});
265290
});
266291
</script>

0 commit comments

Comments
 (0)