Author: jfthomps Date: Wed Sep 28 18:09:27 2011 New Revision: 1176997 URL: http://svn.apache.org/viewvc?rev=1176997&view=rev Log: VCL-114
vm.php - modified editVMInfo - print VM profiles tab even if no vm hosts available to edit; wrapped profiles select box and configure button on profiles tab with span that can be hidden when there are no profiles vm.js: -modified newProfileCB - unhide selectprofilediv -modified delProfileCB - hide selectprofilediv if no profiles left -modified updateProfile - unhide selectprofilediv Modified: incubator/vcl/trunk/web/.ht-inc/vm.php incubator/vcl/trunk/web/js/vm.js Modified: incubator/vcl/trunk/web/.ht-inc/vm.php URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/web/.ht-inc/vm.php?rev=1176997&r1=1176996&r2=1176997&view=diff ============================================================================== --- incubator/vcl/trunk/web/.ht-inc/vm.php (original) +++ incubator/vcl/trunk/web/.ht-inc/vm.php Wed Sep 28 18:09:27 2011 @@ -56,117 +56,122 @@ function editVMInfo() { if(empty($vmhosts)) { print "You do not have access to manage any existing virtual hosts.<br><br>\n"; print $newmsg; - return; } - print $newmsg; - print "Select a Virtual Host:<br>\n"; - printSelectInput("vmhostid", $vmhosts, -1, 0, 0, 'vmhostid', 'onChange="dojo.byId(\'vmhostdata\').className = \'hidden\';"'); - $cont = addContinuationsEntry('vmhostdata'); - print "<button dojoType=\"dijit.form.Button\" id=\"fetchCompGrpsButton\">\n"; - print " Configure Host\n"; - print " <script type=\"dojo/method\" event=onClick>\n"; - print " getVMHostData('$cont');\n"; - print " </script>\n"; - print "</button><br><br>\n"; - print "<div id=vmhostdata class=hidden>\n"; - print "<table summary=\"\">\n"; - print " <tr>\n"; - print " <th align=right>VM limit:</th>\n"; - print " <td>\n"; - $cont = addContinuationsEntry('updateVMlimit'); - print " <input dojoType=\"dijit.form.NumberSpinner\"\n"; - print " constraints=\"{min:1,max:" . MAXVMLIMIT . "}\"\n"; - print " maxlength=\"3\"\n"; - print " id=\"vmlimit\"\n"; - print " onChange=\"updateVMlimit('$cont')\">\n"; - print " </td>\n"; - print " </tr>\n"; - #$cont = addContinuationsEntry('changeVMprofile'); - print " <tr>\n"; - print " <th align=right>VM Profile:</th>\n"; - print " <td>\n"; - #printSelectInput("vmprofileid", $profiles, -1, 0, 0, 'vmprofileid', "onchange=changeVMprofile('$cont')"); - print " <div dojoType=\"dijit.TitlePane\" id=vmprofile></div>\n"; - print " </td>\n"; - print " </tr>\n"; - /*if(! empty($data['vmkernalnic'])) { + else { + print $newmsg; + print "Select a Virtual Host:<br>\n"; + printSelectInput("vmhostid", $vmhosts, -1, 0, 0, 'vmhostid', 'onChange="dojo.byId(\'vmhostdata\').className = \'hidden\';"'); + $cont = addContinuationsEntry('vmhostdata'); + print "<button dojoType=\"dijit.form.Button\" id=\"fetchCompGrpsButton\">\n"; + print " Configure Host\n"; + print " <script type=\"dojo/method\" event=onClick>\n"; + print " getVMHostData('$cont');\n"; + print " </script>\n"; + print "</button><br><br>\n"; + print "<div id=vmhostdata class=hidden>\n"; + print "<table summary=\"\">\n"; print " <tr>\n"; - print " <th align=right>VM Kernal NIC:</th>\n"; - print " <td>{$data['vmkernalnic']}</td>\n"; + print " <th align=right>VM limit:</th>\n"; + print " <td>\n"; + $cont = addContinuationsEntry('updateVMlimit'); + print " <input dojoType=\"dijit.form.NumberSpinner\"\n"; + print " constraints=\"{min:1,max:" . MAXVMLIMIT . "}\"\n"; + print " maxlength=\"3\"\n"; + print " id=\"vmlimit\"\n"; + print " onChange=\"updateVMlimit('$cont')\">\n"; + print " </td>\n"; print " </tr>\n"; - }*/ - print "</table><br><br>\n"; - - print "<div id=movevms class=hidden>\n"; - print "The following VM(s) will removed from this host at the listed "; - print "time(s):<br>\n"; - print "<select name=movevmssel multiple id=movevmssel size=3>\n"; - print "</select><br>\n"; - print "<button dojoType=\"dijit.form.Button\" id=\"cancelBtn\">\n"; - print " <div>Cancel Removing of Selected VMs</div>\n"; - print " <script type=\"dojo/method\" event=onClick>\n"; - $cont = addContinuationsEntry('AJcancelVMmove'); - print " cancelVMmove('$cont');\n"; - print " </script>\n"; - print "</button>\n"; - print "<br><br></div>\n"; - - print "<table summary=\"\"><tbody><tr>\n"; - - # select for vms on host - print "<td valign=top>\n"; - print "VMs assigned to host:<br>\n"; - print "<select name=currvms multiple id=currvms size=15 onChange=showVMstate()>\n"; - print "</select><br>\n"; - print "State of selected vm:<br>\n"; - print "<span id=vmstate></span>\n"; - print "</td>\n"; - # transfer buttons - print "<td style=\"vertical-align: middle;\">\n"; - print "<button dojoType=\"dijit.form.Button\" id=\"addBtn1\">\n"; - print " <div style=\"width: 50px;\"><-Add</div>\n"; - print " <script type=\"dojo/method\" event=onClick>\n"; - $cont = addContinuationsEntry('AJvmToHost'); - print " vmToHost('$cont');\n"; - print " </script>\n"; - print "</button>\n"; - print "<br>\n"; - print "<br>\n"; - print "<br>\n"; - print "<button dojoType=\"dijit.form.Button\" id=\"remBtn1\">\n"; - print " <div style=\"width: 50px;\">Remove</div>\n"; - print " <script type=\"dojo/method\" event=onClick>\n"; - $cont = addContinuationsEntry('AJvmFromHost'); - print " vmFromHost('$cont');\n"; - print " </script>\n"; - print "</button>\n"; - print "</td>\n"; - # select for unassigned vms - print "<td valign=top>\n"; - print "Unassigned VMs:<br>\n"; - print "<select name=freevms multiple id=freevms size=20>\n"; - print "</select>\n"; - print "</td>\n"; - print "</tr><tbody/></table>\n"; - print "</div><br><br>\n"; - - /*print "<div dojoType=\"dijit.Dialog\"\n"; - print " id=\"profileDlg\"\n"; - print " title=\"Change Profile\">\n"; - print "You have selected to change the VM Profile for this host.<br>\n"; - print "Doing this will attempt to move any future reservations on the<br>\n"; - print "host's VMs to other VMs and will submit a reload reservation for this<br>\n"; - print "host after any active reservations on its VMs.<br><br>\n"; - print "Are you sure you want to do this?<br><br>\n"; - print "<button onclick=\"submitChangeProfile()\">Update VM Profile</button>\n"; - print "<button onclick=\"dijit.byId('profileDlg').hide()\">Cancel</button>\n"; - print "<input type=hidden id=changevmcont>\n"; - print "</div>\n";*/ + #$cont = addContinuationsEntry('changeVMprofile'); + print " <tr>\n"; + print " <th align=right>VM Profile:</th>\n"; + print " <td>\n"; + #printSelectInput("vmprofileid", $profiles, -1, 0, 0, 'vmprofileid', "onchange=changeVMprofile('$cont')"); + print " <div dojoType=\"dijit.TitlePane\" id=vmprofile></div>\n"; + print " </td>\n"; + print " </tr>\n"; + /*if(! empty($data['vmkernalnic'])) { + print " <tr>\n"; + print " <th align=right>VM Kernal NIC:</th>\n"; + print " <td>{$data['vmkernalnic']}</td>\n"; + print " </tr>\n"; + }*/ + print "</table><br><br>\n"; + + print "<div id=movevms class=hidden>\n"; + print "The following VM(s) will removed from this host at the listed "; + print "time(s):<br>\n"; + print "<select name=movevmssel multiple id=movevmssel size=3>\n"; + print "</select><br>\n"; + print "<button dojoType=\"dijit.form.Button\" id=\"cancelBtn\">\n"; + print " <div>Cancel Removing of Selected VMs</div>\n"; + print " <script type=\"dojo/method\" event=onClick>\n"; + $cont = addContinuationsEntry('AJcancelVMmove'); + print " cancelVMmove('$cont');\n"; + print " </script>\n"; + print "</button>\n"; + print "<br><br></div>\n"; + + print "<table summary=\"\"><tbody><tr>\n"; + + # select for vms on host + print "<td valign=top>\n"; + print "VMs assigned to host:<br>\n"; + print "<select name=currvms multiple id=currvms size=15 onChange=showVMstate()>\n"; + print "</select><br>\n"; + print "State of selected vm:<br>\n"; + print "<span id=vmstate></span>\n"; + print "</td>\n"; + # transfer buttons + print "<td style=\"vertical-align: middle;\">\n"; + print "<button dojoType=\"dijit.form.Button\" id=\"addBtn1\">\n"; + print " <div style=\"width: 50px;\"><-Add</div>\n"; + print " <script type=\"dojo/method\" event=onClick>\n"; + $cont = addContinuationsEntry('AJvmToHost'); + print " vmToHost('$cont');\n"; + print " </script>\n"; + print "</button>\n"; + print "<br>\n"; + print "<br>\n"; + print "<br>\n"; + print "<button dojoType=\"dijit.form.Button\" id=\"remBtn1\">\n"; + print " <div style=\"width: 50px;\">Remove</div>\n"; + print " <script type=\"dojo/method\" event=onClick>\n"; + $cont = addContinuationsEntry('AJvmFromHost'); + print " vmFromHost('$cont');\n"; + print " </script>\n"; + print "</button>\n"; + print "</td>\n"; + # select for unassigned vms + print "<td valign=top>\n"; + print "Unassigned VMs:<br>\n"; + print "<select name=freevms multiple id=freevms size=20>\n"; + print "</select>\n"; + print "</td>\n"; + print "</tr><tbody/></table>\n"; + print "</div><br><br>\n"; + + /*print "<div dojoType=\"dijit.Dialog\"\n"; + print " id=\"profileDlg\"\n"; + print " title=\"Change Profile\">\n"; + print "You have selected to change the VM Profile for this host.<br>\n"; + print "Doing this will attempt to move any future reservations on the<br>\n"; + print "host's VMs to other VMs and will submit a reload reservation for this<br>\n"; + print "host after any active reservations on its VMs.<br><br>\n"; + print "Are you sure you want to do this?<br><br>\n"; + print "<button onclick=\"submitChangeProfile()\">Update VM Profile</button>\n"; + print "<button onclick=\"dijit.byId('profileDlg').hide()\">Cancel</button>\n"; + print "<input type=hidden id=changevmcont>\n"; + print "</div>\n";*/ + } print "</div>\n"; if(! checkUserHasPerm('Manage VM Profiles')) return; print "<div id=\"vmprofiles\" dojoType=\"dijit.layout.ContentPane\" title=\"VM Host Profiles\">\n"; + if(count($profiles)) + print "<span id=\"selectprofilediv\">"; + else + print "<span id=\"selectprofilediv\" class=\"hidden\">"; print "<br>Select a profile to configure:<br>\n"; print "<select name=\"profileid\" id=\"profileid\" onChange=\"dojo.byId('vmprofiledata').className = 'hidden';\">\n"; foreach($profiles as $id => $item) @@ -178,7 +183,8 @@ function editVMInfo() { print " <script type=\"dojo/method\" event=onClick>\n"; print " getVMprofileData('$cont');\n"; print " </script>\n"; - print "</button>"; + print "</button>\n"; + print "</span>\n"; $cont = addContinuationsEntry('AJnewProfile'); print "<button dojoType=\"dijit.form.Button\" id=\"newProfilesBtn\">\n"; print " New Profile...\n"; Modified: incubator/vcl/trunk/web/js/vm.js URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/web/js/vm.js?rev=1176997&r1=1176996&r2=1176997&view=diff ============================================================================== --- incubator/vcl/trunk/web/js/vm.js (original) +++ incubator/vcl/trunk/web/js/vm.js Wed Sep 28 18:09:27 2011 @@ -22,7 +22,7 @@ var curprofile = ''; function getVMHostData(cont) { var hostid = document.getElementById('vmhostid').value; - document.body.style.cursor = 'wait'; + document.body.style.cursor = 'wait'; dijit.byId('messages').hide(); document.getElementById('vmhostdata').className = 'hidden'; document.getElementById('movevms').className = 'hidden'; @@ -118,7 +118,7 @@ function VMHostDataCB(data, ioArgs) { function updateVMlimit(cont) { var hostid = document.getElementById('vmhostid').value; var newlimit = document.getElementById('vmlimit').value; - document.body.style.cursor = 'wait'; + document.body.style.cursor = 'wait'; dojo.xhrPost({ url: 'index.php', @@ -205,7 +205,7 @@ function submitChangeProfileCB(data, ioA } function vmToHost(cont) { - document.body.style.cursor = 'wait'; + document.body.style.cursor = 'wait'; var hostid = document.getElementById('vmhostid').value; var obj = document.getElementById('freevms'); @@ -343,7 +343,7 @@ function vmToHostCB(data, ioArgs) { } function vmFromHost(cont) { - document.body.style.cursor = 'wait'; + document.body.style.cursor = 'wait'; var hostid = document.getElementById('vmhostid').value; var obj = document.getElementById('currvms'); @@ -508,7 +508,7 @@ function setMessageWindow(title, okbtnte } function cancelVMmove(cont) { - document.body.style.cursor = 'wait'; + document.body.style.cursor = 'wait'; var hostid = document.getElementById('vmhostid').value; var obj = document.getElementById('movevmssel'); @@ -535,7 +535,7 @@ function cancelVMmove(cont) { } function getVMprofileData(cont) { - document.body.style.cursor = 'wait'; + document.body.style.cursor = 'wait'; document.getElementById('vmprofiledata').className = 'hidden'; var profileid = document.getElementById('profileid').value; @@ -637,6 +637,7 @@ function newProfileCB(data, ioArgs) { var obj = document.getElementById('profileid'); obj.options[obj.options.length] = new Option(data.items.profile.profilename, data.items.profile.id); obj.options[obj.options.length - 1].selected = true; + dojo.removeClass('selectprofilediv', 'hidden'); // TODO insert new entry in correct order getVMprofileDataCB(data, ioArgs); } @@ -731,10 +732,13 @@ function delProfileCB(data, ioArgs) { var obj = document.getElementById('profileid'); obj.remove(obj.selectedIndex); document.getElementById('vmprofiledata').className = 'hidden'; + if(obj.options.length == 0) + dojo.addClass('selectprofilediv', 'hidden'); document.body.style.cursor = 'default'; } function updateProfile(id, field) { + dojo.removeClass('selectprofilediv', 'hidden'); if(dijit.byId(id)) var newvalue = dijit.byId(id).value; else @@ -743,7 +747,7 @@ function updateProfile(id, field) { return; if(field == 'password') document.getElementById('savestatus').innerHTML = 'Saving...'; - document.body.style.cursor = 'wait'; + document.body.style.cursor = 'wait'; var profileid = document.getElementById('profileid').value; var cont = document.getElementById('pcont').value;