1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

M #~: Fix sunstone dialogs (#1148)

(cherry picked from commit 5ed1b8e3769ebe6d97ece2ea4231fe634cf76fe3)
This commit is contained in:
Sergio Betanzos 2021-04-26 17:31:31 +02:00 committed by Ruben S. Montero
parent e42ed54315
commit 3359245890
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87
3 changed files with 56 additions and 41 deletions

View File

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

View File

@ -550,7 +550,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");
@ -580,7 +583,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"));
@ -591,7 +597,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({
@ -608,16 +617,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

@ -142,9 +142,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" : {
@ -155,42 +155,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",
@ -434,11 +434,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,