From 4dc359e733e9fb90dd8f526b25b6a6585d7535f3 Mon Sep 17 00:00:00 2001 From: phamt Date: Fri, 20 Apr 2012 03:50:58 +0000 Subject: [PATCH] Added groups panel in service config tab. Added create, edit, and delete functionality into zVM service profile config panel. Removed /opt/xcat from .spec file. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@12286 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-UI/js/custom/esx.js | 8 +- xCAT-UI/js/custom/kvm.js | 8 +- xCAT-UI/js/custom/zvm.js | 14 +- xCAT-UI/js/custom/zvmUtils.js | 259 ++++++++++++++++++++++++++++++++-- xCAT-UI/lib/cmd.php | 16 +++ xCAT-UI/xCAT-UI.spec | 8 +- xCAT-UI/xcat/plugins/web.pm | 46 +++++- 7 files changed, 340 insertions(+), 19 deletions(-) diff --git a/xCAT-UI/js/custom/esx.js b/xCAT-UI/js/custom/esx.js index 79f74bc00..2caa2bb5b 100644 --- a/xCAT-UI/js/custom/esx.js +++ b/xCAT-UI/js/custom/esx.js @@ -40,6 +40,12 @@ esxPlugin.prototype.loadConfigPage = function(tabId) { }); + // Create accordion panel for groups + var groupsSection = $('
'); + var groupsLnk = $('

Groups

').click(function () { + + }); + // Create accordion panel for nodes var nodeSection = $('
'); nodeSection.append(createInfoBar('Modify node attributes')); @@ -47,7 +53,7 @@ esxPlugin.prototype.loadConfigPage = function(tabId) { }); - configAccordion.append(userLnk, userSection, profileLnk, profileSection, nodeLnk, nodeSection); + configAccordion.append(userLnk, userSection, profileLnk, profileSection, groupsLnk, groupsSection, nodeLnk, nodeSection); $('#' + tabId).append(configAccordion); configAccordion.accordion(); diff --git a/xCAT-UI/js/custom/kvm.js b/xCAT-UI/js/custom/kvm.js index c81c906a4..f534c5625 100644 --- a/xCAT-UI/js/custom/kvm.js +++ b/xCAT-UI/js/custom/kvm.js @@ -40,6 +40,12 @@ kvmPlugin.prototype.loadConfigPage = function(tabId) { }); + // Create accordion panel for groups + var groupsSection = $('
'); + var groupsLnk = $('

Groups

').click(function () { + + }); + // Create accordion panel for nodes var nodeSection = $('
'); nodeSection.append(createInfoBar('Modify node attributes')); @@ -47,7 +53,7 @@ kvmPlugin.prototype.loadConfigPage = function(tabId) { }); - configAccordion.append(userLnk, userSection, profileLnk, profileSection, nodeLnk, nodeSection); + configAccordion.append(userLnk, userSection, profileLnk, profileSection, groupsLnk, groupsSection, nodeLnk, nodeSection); $('#' + tabId).append(configAccordion); configAccordion.accordion(); diff --git a/xCAT-UI/js/custom/zvm.js b/xCAT-UI/js/custom/zvm.js index 97b5d708b..7e1da9090 100644 --- a/xCAT-UI/js/custom/zvm.js +++ b/xCAT-UI/js/custom/zvm.js @@ -45,6 +45,18 @@ zvmPlugin.prototype.loadConfigPage = function(tabId) { queryProfiles('zvmConfigProfile'); }); + // Create accordion panel for groups + var groupsSection = $('
'); + var groupsLnk = $('

Groups

').click(function () { + // Do not load panel again if it is already loaded + if ($('#zvmConfigGroups').find('.dataTables_wrapper').length) + return; + else + $('#zvmConfigGroups').append(createLoader('')); + +// queryGroups('zvmConfigGroups'); + }); + // Create accordion panel for nodes var nodeSection = $('
'); nodeSection.append(createInfoBar('Modify node attributes')); @@ -52,7 +64,7 @@ zvmPlugin.prototype.loadConfigPage = function(tabId) { }); - configAccordion.append(userLnk, userSection, profileLnk, profileSection, nodeLnk, nodeSection); + configAccordion.append(userLnk, userSection, profileLnk, profileSection, groupsLnk, groupsSection, nodeLnk, nodeSection); $('#' + tabId).append(configAccordion); configAccordion.accordion(); diff --git a/xCAT-UI/js/custom/zvmUtils.js b/xCAT-UI/js/custom/zvmUtils.js index d0594924c..6fb81071f 100644 --- a/xCAT-UI/js/custom/zvmUtils.js +++ b/xCAT-UI/js/custom/zvmUtils.js @@ -3419,7 +3419,7 @@ function configProfilePanel(panelId) { $('#' + panelId).empty(); // Add info bar - $('#' + panelId).append(createInfoBar('Create, edit, and delete profiles for the self-service portal. Double-click on a cell to edit a users properties. Click outside the table to save changes. Hit the Escape key to ignore changes.')); + $('#' + panelId).append(createInfoBar('Create, edit, and delete profiles for the self-service portal. It is important to note the default z/VM user ID for any profile should be LXUSR.')); // Create table var tableId = 'zvmProfileTable'; @@ -3456,23 +3456,47 @@ function configProfilePanel(panelId) { // Create action bar var actionBar = $('
'); + // Create a profile var createLnk = $('Create'); createLnk.click(function() { profileDialog(); }); + + // Edit a profile + var editLnk = $('Edit'); + editLnk.click(function() { + var profiles = $('#' + tableId + ' input[type=checkbox]:checked'); + for (var i in profiles) { + var profile = profiles.eq(i).attr('name'); + if (profile) { + // Column order is: profile, selectable, disk pool, disk size, and directory entry + var cols = profiles.eq(i).parents('tr').find('td'); + var pool = cols.eq(3).text(); + var size = cols.eq(4).text(); + var entry = cols.eq(5).html().replace(new RegExp('
', 'g'), '\n'); + + openEditProfileDialog(profile, pool, size, entry); + } + } + }); + // Delete a profile var deleteLnk = $('Delete'); deleteLnk.click(function() { - + var profiles = getNodesChecked(tableId); + if (profiles) { + openDeleteProfileDialog(profiles); + } }); + // Refresh profiles table var refreshLnk = $('Refresh'); refreshLnk.click(function() { queryProfiles(panelId); }); // Create an action menu - var actionsMenu = createMenu([createLnk, deleteLnk, refreshLnk]); + var actionsMenu = createMenu([createLnk, editLnk, deleteLnk, refreshLnk]); actionsMenu.superfish(); actionsMenu.css('display', 'inline-block'); actionBar.append(actionsMenu); @@ -3505,7 +3529,7 @@ function configProfilePanel(panelId) { msg : 'out=' + panelId + ';profile=' + profiles[i] }, - success: insertDirectoryentry + success: insertDirectoryEntry }); $.ajax({ @@ -3530,7 +3554,7 @@ function configProfilePanel(panelId) { * Data from HTTP request * @return Nothing */ -function insertDirectoryentry(data) { +function insertDirectoryEntry(data) { var tableId = 'zvmProfileTable'; var args = data.msg.split(';'); @@ -3612,13 +3636,24 @@ function insertDiskInfo(data) { */ function profileDialog() { // Create form to add profile - var profileForm = $('
'); + var dialogId = 'zvmCreateProfile'; + var profileForm = $('
'); // Create info bar var info = createInfoBar('Configure the default settings for a profile'); profileForm.append(info); - profileForm.append('
'); + // Insert profiles into select + var profileSelect = $(''); + var profiles = $.cookie('profiles').split(','); + profiles.push('default'); // Add default profile + for (var i in profiles) { + if (profiles[i]) { + profileSelect.append($('')); + } + } + + profileForm.append($('
').append(profileSelect)); profileForm.append('
'); profileForm.append('
'); profileForm.append('