
--- plugins/kimchi/ui/js/src/kimchi.guest_edit_main.js | 6 ++-- plugins/kimchi/ui/js/src/kimchi.host.js | 12 ++++---- plugins/kimchi/ui/js/src/kimchi.main.js | 26 ++++++++++++++++++++ .../ui/js/src/kimchi.repository_edit_main.js | 4 +- .../kimchi/ui/js/src/kimchi.template_add_main.js | 4 +- .../kimchi/ui/js/src/kimchi.template_edit_main.js | 4 +- ui/js/src/wok.main.js | 10 ------- 7 files changed, 41 insertions(+), 25 deletions(-) create mode 100644 plugins/kimchi/ui/js/src/kimchi.main.js diff --git a/plugins/kimchi/ui/js/src/kimchi.guest_edit_main.js b/plugins/kimchi/ui/js/src/kimchi.guest_edit_main.js index fd8f0d9..09fb368 100644 --- a/plugins/kimchi/ui/js/src/kimchi.guest_edit_main.js +++ b/plugins/kimchi/ui/js/src/kimchi.guest_edit_main.js @@ -302,7 +302,7 @@ kimchi.guest_edit_main = function() { }; //set up for PAM var userNodes = {}, groupNodes = {}; - authType = wok.capabilities['auth'] + authType = kimchi.capabilities['auth'] if (authType == 'pam') { $("#form-guest-edit-permission .ldap").hide(); kimchi.retrieveVM(kimchi.selectedGuest, function(vm){ @@ -420,7 +420,7 @@ kimchi.guest_edit_main = function() { var setupPCIDevice = function(){ kimchi.getHostPCIDevices(function(hostPCIs){ kimchi.getVMPCIDevices(kimchi.selectedGuest, function(vmPCIs){ - var pciEnabled = wok.capabilities.kernel_vfio; + var pciEnabled = kimchi.capabilities.kernel_vfio; for(var i=0; i<hostPCIs.length; i++){ var itemNode = $.parseHTML(wok.substitute($('#pci-tmpl').html(),{ name: hostPCIs[i].name, @@ -697,7 +697,7 @@ kimchi.guest_edit_main = function() { var permissionSubmit = function(event) { var content = { users: [], groups: [] }; - authType = wok.capabilities['auth'] + authType = kimchi.capabilities['auth'] if (authType == 'pam') { $("#permission-sel-users").children().each(function(){ content.users.push($("label", this).text()); diff --git a/plugins/kimchi/ui/js/src/kimchi.host.js b/plugins/kimchi/ui/js/src/kimchi.host.js index 0b4ffd0..8976813 100644 --- a/plugins/kimchi/ui/js/src/kimchi.host.js +++ b/plugins/kimchi/ui/js/src/kimchi.host.js @@ -507,14 +507,14 @@ kimchi.host_main = function() { }); var setupUI = function() { - if (wok.capabilities == undefined) { + if (kimchi.capabilities == undefined) { setTimeout(setupUI, 2000); return; } - if((wok.capabilities['repo_mngt_tool']) && (wok.capabilities['repo_mngt_tool']!="None")) { - initRepositoriesGrid(wok.capabilities['repo_mngt_tool']); - $('#repositories-section').switchClass('hidden', wok.capabilities['repo_mngt_tool']); + if((kimchi.capabilities['repo_mngt_tool']) && (kimchi.capabilities['repo_mngt_tool']!="None")) { + initRepositoriesGrid(kimchi.capabilities['repo_mngt_tool']); + $('#repositories-section').switchClass('hidden', kimchi.capabilities['repo_mngt_tool']); wok.topic('kimchi/repositoryAdded') .subscribe(listRepositories); wok.topic('kimchi/repositoryUpdated') @@ -523,7 +523,7 @@ kimchi.host_main = function() { .subscribe(listRepositories); } - if(wok.capabilities['update_tool']) { + if(kimchi.capabilities['update_tool']) { $('#software-update-section').removeClass('hidden'); initSoftwareUpdatesGrid(); wok.topic('kimchi/softwareUpdated') @@ -533,7 +533,7 @@ kimchi.host_main = function() { }); } - if(wok.capabilities['system_report_tool']) { + if(kimchi.capabilities['system_report_tool']) { listDebugReports(); wok.topic('kimchi/debugReportAdded') .subscribe(listDebugReports); diff --git a/plugins/kimchi/ui/js/src/kimchi.main.js b/plugins/kimchi/ui/js/src/kimchi.main.js new file mode 100644 index 0000000..2fdeb85 --- /dev/null +++ b/plugins/kimchi/ui/js/src/kimchi.main.js @@ -0,0 +1,26 @@ +/* + * Project Kimchi + * + * Copyright IBM, Corp. 2013-2014 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +kimchi.capabilities = undefined; +kimchi.getCapabilities(function(result) { + kimchi.capabilities = result; + + if(kimchi.capabilities.federation=="on") + $('#peers').removeClass('hide-content'); +}, function() { + kimchi.capabilities = {}; +}); diff --git a/plugins/kimchi/ui/js/src/kimchi.repository_edit_main.js b/plugins/kimchi/ui/js/src/kimchi.repository_edit_main.js index 85e24d4..5bfc51e 100644 --- a/plugins/kimchi/ui/js/src/kimchi.repository_edit_main.js +++ b/plugins/kimchi/ui/js/src/kimchi.repository_edit_main.js @@ -21,10 +21,10 @@ kimchi.repository_edit_main = function() { var saveButton = $('#repository-edit-button-save'); - if(wok.capabilities['repo_mngt_tool']=="yum") { + if(kimchi.capabilities['repo_mngt_tool']=="yum") { editForm.find('input.deb').prop('disabled', true); } - else if(wok.capabilities['repo_mngt_tool']=="deb") { + else if(kimchi.capabilities['repo_mngt_tool']=="deb") { editForm.find('input.yum').prop('disabled', true); } diff --git a/plugins/kimchi/ui/js/src/kimchi.template_add_main.js b/plugins/kimchi/ui/js/src/kimchi.template_add_main.js index 22f9ea4..861fe62 100644 --- a/plugins/kimchi/ui/js/src/kimchi.template_add_main.js +++ b/plugins/kimchi/ui/js/src/kimchi.template_add_main.js @@ -224,12 +224,12 @@ kimchi.template_add_main = function() { $('#iso-remote').css('opacity', 0.3).css('cursor', 'not-allowed'); var enabledRemoteIso = function() { - if (wok.capabilities == undefined) { + if (kimchi.capabilities == undefined) { setTimeout(enabledRemoteIso, 2000); return; } - if (wok.capabilities.qemu_stream != true) { + if (kimchi.capabilities.qemu_stream != true) { return; } diff --git a/plugins/kimchi/ui/js/src/kimchi.template_edit_main.js b/plugins/kimchi/ui/js/src/kimchi.template_edit_main.js index bda6d0b..a17d084 100644 --- a/plugins/kimchi/ui/js/src/kimchi.template_edit_main.js +++ b/plugins/kimchi/ui/js/src/kimchi.template_edit_main.js @@ -49,11 +49,11 @@ kimchi.template_edit_main = function() { $('#template-edit-graphics').append('<option>Spice</option>'); kimchi.select('template-edit-graphics-list', vncOpt); var enableSpice = function() { - if (wok.capabilities == undefined) { + if (kimchi.capabilities == undefined) { setTimeout(enableSpice, 2000); return; } - if (wok.capabilities.qemu_spice == true) { + if (kimchi.capabilities.qemu_spice == true) { spiceOpt = [{label: 'Spice', value: 'spice'}] kimchi.select('template-edit-graphics-list', spiceOpt); } diff --git a/ui/js/src/wok.main.js b/ui/js/src/wok.main.js index 5b1f1bc..b7797dd 100644 --- a/ui/js/src/wok.main.js +++ b/ui/js/src/wok.main.js @@ -17,16 +17,6 @@ */ wok.tabMode = {}; -wok.capabilities = undefined; -wok.getCapabilities(function(result) { - wok.capabilities = result; - - if(wok.capabilities.federation=="on") - $('#peers').removeClass('hide-content'); -}, function() { - wok.capabilities = {}; -}); - wok.main = function() { wok.isLoggingOut = false; wok.popable(); -- 1.7.1