Skip to content

Commit 0f739ac

Browse files
committed
UI Changes
1 parent 6094536 commit 0f739ac

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

proxstar/static/js/script.js

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ $(document).ready(function(){
44
$('[data-toggle="tooltip"]').tooltip();
55
});
66

7-
function confirmDialog(url, confirm, confirmButton, complete, error, location) {
7+
function confirmDialog(url, confirm, confirmButton, complete, error, location, danger) {
88
swal({
99
title: confirm,
1010
icon: "warning",
@@ -13,7 +13,7 @@ function confirmDialog(url, confirm, confirmButton, complete, error, location) {
1313
action: {
1414
text: confirmButton,
1515
closeModal: false,
16-
className: "swal-button--danger",
16+
className: danger ? "swal-button--danger" : "swal-button--confirm",
1717
}
1818
},
1919
dangerMode: true,
@@ -44,31 +44,31 @@ function confirmDialog(url, confirm, confirmButton, complete, error, location) {
4444
$("#delete-vm").click(function(){
4545
const vmname = $(this).data('vmname');
4646
const vmid = $(this).data('vmid')
47-
confirmDialog(`/vm/${vmid}/delete`, `Are you sure you want to delete ${vmname}?`, "Delete", `${vmname} is now being deleted.`, `Unable to delete ${vmname}. Please try again later.`, '/')
47+
confirmDialog(`/vm/${vmid}/delete`, `Are you sure you want to delete ${vmname}?`, "Delete", `${vmname} is now being deleted.`, `Unable to delete ${vmname}. Please try again later.`, '/', true)
4848
});
4949

5050
$("#stop-vm").click(function(){
5151
const vmname = $(this).data('vmname');
5252
const vmid = $(this).data('vmid')
53-
confirmDialog(`/vm/${vmid}/power/stop`, `Are you sure you want to stop ${vmname}?`, "Stop", `${vmname} is now stopping!`, `Unable to stop ${vmname}. Please try again later.`, `/vm/${vmid}`)
53+
confirmDialog(`/vm/${vmid}/power/stop`, `Are you sure you want to stop ${vmname}?`, "Stop", `${vmname} is now stopping!`, `Unable to stop ${vmname}. Please try again later.`, `/vm/${vmid}`, true)
5454
});
5555

5656
$("#reset-vm").click(function(){
5757
const vmname = $(this).data('vmname');
5858
const vmid = $(this).data('vmid')
59-
confirmDialog(`/vm/${vmid}/power/reset`, `Are you sure you want to reset ${vmname}?`, "Reset", `${vmname} is now resetting!`, `Unable to reset ${vmname}. Please try again later.`, `/vm/${vmid}`)
59+
confirmDialog(`/vm/${vmid}/power/reset`, `Are you sure you want to reset ${vmname}?`, "Reset", `${vmname} is now resetting!`, `Unable to reset ${vmname}. Please try again later.`, `/vm/${vmid}`, true)
6060
});
6161

6262
$("#shutdown-vm").click(function(){
6363
const vmname = $(this).data('vmname');
6464
const vmid = $(this).data('vmid')
65-
confirmDialog(`/vm/${vmid}/power/shutdown`, `Are you sure you want to shutdown ${vmname}?`, "Shutdown", `${vmname} is now shutting down!`, `Unable to shutdown ${vmname}. Please try again later.`, `/vm/${vmid}`)
65+
confirmDialog(`/vm/${vmid}/power/shutdown`, `Are you sure you want to shutdown ${vmname}?`, "Shutdown", `${vmname} is now shutting down!`, `Unable to shutdown ${vmname}. Please try again later.`, `/vm/${vmid}`, true)
6666
});
6767

6868
$("#suspend-vm").click(function(){
6969
const vmname = $(this).data('vmname');
7070
const vmid = $(this).data('vmid')
71-
confirmDialog(`/vm/${vmid}/power/suspend`, `Are you sure you want to suspend ${vmname}?`, "Suspend", `${vmname} is now suspending!`, `Unable to suspend ${vmname}. Please try again later.`, `/vm/${vmid}`)
71+
confirmDialog(`/vm/${vmid}/power/suspend`, `Are you sure you want to suspend ${vmname}?`, "Suspend", `${vmname} is now suspending!`, `Unable to suspend ${vmname}. Please try again later.`, `/vm/${vmid}`, true)
7272
});
7373

7474
$("#start-vm").click(function(){
@@ -118,7 +118,7 @@ $("#resume-vm").click(function(){
118118
$(".eject-iso").click(function(){
119119
const iso = $(this).data('iso');
120120
const vmid = $(this).data('vmid');
121-
confirmDialog(`/vm/${vmid}/iso/${iso}/eject`, `Are you sure you want to eject this ISO?`, "Eject", `Ejecting ISO!`, `Unable to eject ISO. Please try again later.`, `/vm/${vmid}`)
121+
confirmDialog(`/vm/${vmid}/iso/${iso}/eject`, `Are you sure you want to eject this ISO?`, "Eject", `Ejecting ISO!`, `Unable to eject ISO. Please try again later.`, `/vm/${vmid}`, true)
122122
});
123123

124124

@@ -794,7 +794,8 @@ $(".resize-disk").click(function(){
794794
const usage = $(this).data('usage');
795795
const limit = $(this).data('limit');
796796
swal({
797-
title: 'Enter how many GB you would like to expand this disk by:',
797+
title: 'Expand Disk',
798+
text: 'Enter how many GB you would like to expand this disk by (GB)',
798799
content: {
799800
element: 'input',
800801
attributes: {
@@ -809,7 +810,7 @@ $(".resize-disk").click(function(){
809810
className: "",
810811
},
811812
confirm: {
812-
text: "Select",
813+
text: "Expand",
813814
closeModal: false,
814815
}
815816
},
@@ -1069,24 +1070,24 @@ $(document).on('focus click', "[id^=boot-order-]", function() {
10691070

10701071
$("#create-net").click(function(){
10711072
const vmid = $(this).data('vmid')
1072-
confirmDialog(`/vm/${vmid}/net/create`, `Are you sure you want to create a new interface?`, "Create", `Creating new interface!`, `Unable to create interface. Please try again later.`, `/vm/${vmid}`)
1073+
confirmDialog(`/vm/${vmid}/net/create`, `Are you sure you want to create a new interface?`, "Create", `Creating new interface!`, `Unable to create interface. Please try again later.`, `/vm/${vmid}`, false)
10731074
});
10741075

10751076
$(".delete-net").click(function(){
10761077
const vmid = $(this).data('vmid')
10771078
const interface = $(this).data('interface')
1078-
confirmDialog(`/vm/${vmid}/net/${interface}/delete`, `Are you sure you want to delete ${interface}?`, "Delete", `Deleting ${interface}!`, `Unable to delete interface. Please try again later.`, `/vm/${vmid}`)
1079+
confirmDialog(`/vm/${vmid}/net/${interface}/delete`, `Are you sure you want to delete ${interface}?`, "Delete", `Deleting ${interface}!`, `Unable to delete interface. Please try again later.`, `/vm/${vmid}`, true)
10791080
});
10801081

10811082
$("#create-iso").click(function(){
10821083
const vmid = $(this).data('vmid')
1083-
confirmDialog(`/vm/${vmid}/iso/create`, `Are you sure you want to create a new ISO drive?`, "Create", `Creating new ISO drive!`, `Unable to create ISO drive. Please try again later.`, `/vm/${vmid}`)
1084+
confirmDialog(`/vm/${vmid}/iso/create`, `Are you sure you want to create a new ISO drive?`, "Create", `Creating new ISO drive!`, `Unable to create ISO drive. Please try again later.`, `/vm/${vmid}`, false)
10841085
});
10851086

10861087
$(".delete-iso").click(function(){
10871088
const vmid = $(this).data('vmid')
10881089
const iso = $(this).data('iso')
1089-
confirmDialog(`/vm/${vmid}/iso/${iso}/delete`, `Are you sure you want to delete ${iso}?`, "Delete", `Deleting ${iso}!`, `Unable to delete ISO drive. Please try again later.`, `/vm/${vmid}`)
1090+
confirmDialog(`/vm/${vmid}/iso/${iso}/delete`, `Are you sure you want to delete ${iso}?`, "Delete", `Deleting ${iso}!`, `Unable to delete ISO drive. Please try again later.`, `/vm/${vmid}`, true)
10901091
});
10911092

10921093
$("#create-disk").click(function(){
@@ -1095,7 +1096,8 @@ $("#create-disk").click(function(){
10951096
const usage = $(this).data('usage');
10961097
const limit = $(this).data('limit');
10971098
swal({
1098-
title: 'Enter how many GB you would like to make this disk:',
1099+
title: 'Create New Disk',
1100+
text: 'Enter new disk size (GB)',
10991101
content: {
11001102
element: 'input',
11011103
attributes: {
@@ -1110,7 +1112,7 @@ $("#create-disk").click(function(){
11101112
className: "",
11111113
},
11121114
confirm: {
1113-
text: "Select",
1115+
text: "Create",
11141116
closeModal: false,
11151117
}
11161118
},
@@ -1152,5 +1154,5 @@ $("#create-disk").click(function(){
11521154
$(".delete-disk").click(function(){
11531155
const vmid = $(this).data('vmid')
11541156
const disk = $(this).data('disk')
1155-
confirmDialog(`/vm/${vmid}/disk/${disk}/delete`, `Are you sure you want to delete ${disk}?`, "Delete", `Deleting ${disk}!`, `Unable to delete disk. Please try again later.`, `/vm/${vmid}`)
1157+
confirmDialog(`/vm/${vmid}/disk/${disk}/delete`, `Are you sure you want to delete ${disk}?`, "Delete", `Deleting ${disk}!`, `Unable to delete disk. Please try again later.`, `/vm/${vmid}`, true)
11561158
});

0 commit comments

Comments
 (0)