1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-26 06:50:09 +03:00

M #~: Fix sunstone dialogs (#1148)

This commit is contained in:
Sergio Betanzos 2021-04-26 17:31:31 +02:00 committed by GitHub
parent 6bb89b2f5e
commit 5ed1b8e376
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 56 additions and 41 deletions

View File

@ -126,7 +126,7 @@ class SunstoneGuac < SunstoneRemoteConnections
'hostname' => hostname,
'port' => vm_resource['TEMPLATE/GRAPHICS/PORT'],
'password' => vm_resource['TEMPLATE/GRAPHICS/PASSWD']
}.compact
}
)
end
@ -153,7 +153,7 @@ class SunstoneGuac < SunstoneRemoteConnections
'port' => vm_resource['TEMPLATE/CONTEXT/RDP_PORT'],
'username' => vm_resource['TEMPLATE/CONTEXT/USERNAME'],
'password' => vm_resource['TEMPLATE/CONTEXT/PASSWORD']
}.compact
}
)
end
@ -180,7 +180,7 @@ class SunstoneGuac < SunstoneRemoteConnections
'port' => vm_resource['TEMPLATE/CONTEXT/SSH_PORT'],
'username' => vm_resource['TEMPLATE/CONTEXT/USERNAME'],
'password' => vm_resource['TEMPLATE/CONTEXT/PASSWORD']
}.compact
}
)
end

View File

@ -549,7 +549,10 @@ define(function(require) {
//Listen for .action_buttons
//An action buttons runs a predefined action. If it has type
//"multiple" it runs that action on the elements of a datatable.
$(document).on("click", ".action_button", function() {
$(document).on("click", ".action_button", function(event) {
event.preventDefault();
event.stopPropagation();
var error = 0;
var value = $(this).val();
var data = ($(this).attr("data") == "")? undefined: $(this).attr("data");
@ -578,7 +581,10 @@ define(function(require) {
//Listen .confirm_buttons. These buttons show a confirmation dialog
//before running the action.
$(document).on("click", ".confirm_button", function() {
$(document).on("click", ".confirm_button", function(event) {
event.preventDefault();
event.stopPropagation();
var dialogInstance = _getDialogInstance(CONFIRM_DIALOG_ID);
dialogInstance.reset();
$("#" + CONFIRM_DIALOG_ID).data("buttonAction", $(this).attr("href"));
@ -589,7 +595,10 @@ define(function(require) {
//Listen .confirm_buttons. These buttons show a confirmation dialog
//with a select box before running the action.
$(document).on("click", ".confirm_with_select_button", function() {
$(document).on("click", ".confirm_with_select_button", function(event) {
event.preventDefault();
event.stopPropagation();
var dialogInstance = _getDialogInstance(CONFIRM_WITH_SELECT_DIALOG_ID);
dialogInstance.setParams({
@ -606,16 +615,21 @@ define(function(require) {
//$(document).foundation('dropdown', 'reflow');
// Button to return to the list view from the detailed view
$(document).on("click", "button[href='back']", function(e) {
$(document).on("click", "button[href='back']", function(event) {
event.preventDefault();
event.stopPropagation();
if(window.sunstoneNoMultipleRedirects){
window.history.back();
window.sunstoneNoMultipleRedirects = false;
}
e.preventDefault();
});
// Reload foundation ips dropdown when change page on datatables
$(document).on("click", ".paginate_button", function() {
$(document).on("click", ".paginate_button", function(event) {
event.preventDefault();
event.stopPropagation();
UtilsFoundation.update(null);
});
};

View File

@ -136,9 +136,9 @@ define(function(require) {
"VM.deploy" : {
type: "custom",
call: function() {
Sunstone.getDialog(DEPLOY_DIALOG_ID)
.reset()
.show();
var dialog = Sunstone.getDialog(DEPLOY_DIALOG_ID);
dialog.reset();
dialog.show();
}
},
"VM.silent_deploy_action" : {
@ -149,42 +149,42 @@ define(function(require) {
"VM.migrate" : {
type: "custom",
call: function() {
Sunstone.getDialog(MIGRATE_DIALOG_ID)
.reset()
.setLive(false)
.setType(0)
.show();
}
var dialog = Sunstone.getDialog(MIGRATE_DIALOG_ID);
dialog.reset();
dialog.setLive(false);
dialog.setType(0);
dialog.show();
}
},
"VM.migrate_poff" : {
type: "custom",
call: function() {
Sunstone.getDialog(MIGRATE_DIALOG_ID)
.reset()
.setLive(false)
.setType(1)
.show();
}
var dialog = Sunstone.getDialog(MIGRATE_DIALOG_ID);
dialog.reset();
dialog.setLive(false);
dialog.setType(1);
dialog.show();
}
},
"VM.migrate_poff_hard" : {
type: "custom",
call: function() {
Sunstone.getDialog(MIGRATE_DIALOG_ID)
.reset()
.setLive(false)
.setType(2)
.show();
}
var dialog = Sunstone.getDialog(MIGRATE_DIALOG_ID);
dialog.reset();
dialog.setLive(false);
dialog.setType(2);
dialog.show();
}
},
"VM.migrate_live" : {
type: "custom",
call: function() {
Sunstone.getDialog(MIGRATE_DIALOG_ID)
.reset()
.setLive(true)
.setType(0)
.show();
}
var dialog = Sunstone.getDialog(MIGRATE_DIALOG_ID);
dialog.reset();
dialog.setLive(true);
dialog.setType(0);
dialog.show();
}
},
"VM.save_rdp" : {
type: "custom",
@ -431,11 +431,12 @@ define(function(require) {
id: resourceId
},
success: function(_, vmTemplate){
if (vmTemplate &&
vmTemplate.VM &&
vmTemplate.VM.USER_TEMPLATE &&
vmTemplate.VM.USER_TEMPLATE.HYPERVISOR &&
vmTemplate.VM.USER_TEMPLATE.HYPERVISOR !== "vcenter"){
if (
vmTemplate &&
vmTemplate.VM &&
vmTemplate.VM.USER_TEMPLATE &&
vmTemplate.VM.USER_TEMPLATE.HYPERVISOR !== "vcenter"
){
Sunstone.showTab(MARKETPLACEAPPS_TAB_ID);
Sunstone.showFormPanel(
MARKETPLACEAPPS_TAB_ID,