diff --git a/src/sunstone/public/app/tabs/oneflow-services-tab/panels/roles.js b/src/sunstone/public/app/tabs/oneflow-services-tab/panels/roles.js index 8f7c9c6d34..b3c44ebbc8 100644 --- a/src/sunstone/public/app/tabs/oneflow-services-tab/panels/roles.js +++ b/src/sunstone/public/app/tabs/oneflow-services-tab/panels/roles.js @@ -12,6 +12,9 @@ define(function(require) { var DomDataTable = require('utils/dom-datatable'); var VMsTableUtils = require('tabs/vms-tab/utils/datatable-common'); var SunstoneConfig = require('sunstone-config'); + var Vnc = require('utils/vnc'); + var Spice = require('utils/spice'); + var Notifier = require('utils/notifier'); var VMS_TAB_ID = require('tabs/vms-tab/tabId'); @@ -206,6 +209,34 @@ define(function(require) { if(this.servicePanel) { var role = this.element.TEMPLATE.BODY.roles[role_index]; + $(".vnc", context).off("click"); + $(".vnc", context).on("click", function() { + var vmId = $(this).attr('vm_id'); + + if (!Vnc.lockStatus()) { + Vnc.lock(); + Sunstone.runAction("VM.startvnc_action", vmId); + } else { + Notifier.notifyError(tr("VNC Connection in progress")); + } + + return false; + }); + + $(".spice", context).off("click"); + $(".spice", context).on("click", function() { + var vmId = $(this).attr('vm_id'); + + if (!Spice.lockStatus()) { + Spice.lock(); + Sunstone.runAction("VM.startspice_action", vmId); + } else { + Notifier.notifyError(Locale.tr("SPICE Connection in progress")); + } + + return false; + }); + // This table has 2 more columns to the left compared to the normal VM table // The visibility index array needs to be adjusted var visibleColumns = [0,1].concat(