From 7f905cd94a273696d8f6d3fb405e7fee70998c6a Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Wed, 14 Nov 2012 10:29:35 -0800 Subject: [PATCH] CLOUDSTACK-483: Disable 'update' tab when host updates aren't supported --- ui/scripts/system.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/ui/scripts/system.js b/ui/scripts/system.js index 9e3932fc65c..1f913f5596f 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -8421,6 +8421,33 @@ } }, + tabFilter: function(args) { + var hiddenTabs = []; + var hostUpdatesEnabled = false; + var host = args.context.hosts[0]; + + if (isAdmin()) { + // Host updates are only supported on XenServer and when host.updates.enabled is true; + $.ajax({ + url: createURL('listConfigurations'), + data: { + name: 'host.updates.enable' + }, + async: false, + success: function(json) { + var config = json.listconfigurationsresponse.configuration[0]; + + hostUpdatesEnabled = config.value == 'true' ? true : false; + } + }); + + if (!hostUpdatesEnabled || host.hypervisor != 'XenServer') { + hiddenTabs.push('hostUpdates'); + } + } + + return hiddenTabs; + }, tabs: { details: { title: 'label.details',