You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vcl.apache.org by jf...@apache.org on 2014/09/25 17:40:56 UTC

svn commit: r1627559 - in /vcl/trunk/web: .ht-inc/computer.php .ht-inc/managementnode.php .ht-inc/states.php .ht-inc/utils.php js/resources.js js/resources/computer.js js/resources/managementnode.js

Author: jfthomps
Date: Thu Sep 25 15:40:56 2014
New Revision: 1627559

URL: http://svn.apache.org/r1627559
Log:
VCL-170 - option to power off blades after reservation - new reload module
VCL-780 - combine new reservation and current reservations pages

computer.php:
-modified fieldWidth, fieldDisplayName, addEditDialogHTML, AJsaveResource, validateResourceData, and addResource: added predictive loading module
-modified extraResourceFilters: added section to change predictive loading module; reordered items to be alphabetical
-added AJcompPredictiveModuleChange
-added AJsubmitCompPredictiveModuleChange

managementnode.php: modified fieldWidth, fieldDisplayName, addEditDialogHTML, AJsaveResource, validateResourceData, and addResource: removed predictive loading module

states.php: added AJcompPredictiveModuleChange and AJsubmitCompPredictiveModuleChange to resource section

utils.php:
-modified getManagementNodes: removed predictive loading module
-modified getComputers: added predictive loading module
-modified addSublogEntry: get predictivemoduleid from computer table instead of managementnode table

computer.js:
-modified inlineEditResourceCB, resetEditResource, saveResource, and saveResourceCB: added predictive loading module
-added confirmPredictiveModuleChange

managementnode.js: modified inlineEditResourceCB, resetEditResource, saveResource, and saveResourceCB: removed predictive loading module

resources.js: modified initViewResources: added setTimeout to call resourcegrid.sort - was still seeing times when the data was not properly sorted

Modified:
    vcl/trunk/web/.ht-inc/computer.php
    vcl/trunk/web/.ht-inc/managementnode.php
    vcl/trunk/web/.ht-inc/states.php
    vcl/trunk/web/.ht-inc/utils.php
    vcl/trunk/web/js/resources.js
    vcl/trunk/web/js/resources/computer.js
    vcl/trunk/web/js/resources/managementnode.js

Modified: vcl/trunk/web/.ht-inc/computer.php
URL: http://svn.apache.org/viewvc/vcl/trunk/web/.ht-inc/computer.php?rev=1627559&r1=1627558&r2=1627559&view=diff
==============================================================================
--- vcl/trunk/web/.ht-inc/computer.php (original)
+++ vcl/trunk/web/.ht-inc/computer.php Thu Sep 25 15:40:56 2014
@@ -98,6 +98,9 @@ class Computer extends Resource {
 			case 'location':
 				$w = 9;
 				break;
+			case 'predictivemodule':
+				$w = 10;
+				break;
 			case 'provisioning':
 				$w = 11;
 				break;
@@ -149,6 +152,8 @@ class Computer extends Resource {
 				return 'VM Host';
 			case 'provisioning':
 				return 'Provisioning Engine';
+			case 'predictivemodule':
+				return 'Predictive Loading Module';
 		}
 		return ucfirst($field);
 	}
@@ -171,47 +176,33 @@ class Computer extends Resource {
 		$h .= "<span>" . _("Actions for selected computers") . "</span>\n";
 		$h .= "<div dojoType=\"dijit.Menu\" id=\"actionmenu\">\n";
 
-		# reload
-		$resources = getUserResources(array("imageAdmin", "imageCheckOut"));
-		if(count($resources['image'])) {
-			$h .= "  <div dojoType=\"dijit.PopupMenuItem\">\n";
-			$h .= "    <span>Reload with an Image</span>\n";
-			$h .= "    <div dojoType=\"dijit.layout.ContentPane\"\n";
-			$h .= "         style=\"background-color: white; padding: 5px; border: 1px solid black;\">\n";
-			$h .= "      Reload computers with the following image:<br>\n";
-			$extra = 'autoComplete="false"';
-			$h .= selectInputAutoDijitHTML('', $resources['image'], 'reloadimageid', $extra);
-			$cont = addContinuationsEntry('AJreloadComputers', $this->basecdata);
-			$h .= "      <input type=\"hidden\" id=\"reloadcont\" value=\"$cont\"><br>\n";
-			$h .= dijitButton('', 'Confirm Reload Computers', 'confirmReload();', 0);
-			$h .= "    </div>\n";
-			$h .= "  </div>\n";
-		}
-
-		# delete
-		$h .= "  <div dojoType=\"dijit.MenuItem\"\n";
-		$h .= "       onClick=\"confirmDelete\">\n";
-		$h .= "    Delete Computers\n";
-		$cont = addContinuationsEntry('AJdeleteComputers', $this->basecdata);
-		$h .= "      <input type=\"hidden\" id=\"deletecont\" value=\"$cont\"><br>\n";
+		# change predictive loading module
+		$premodules = getPredictiveModules();
+		$h .= "  <div dojoType=\"dijit.PopupMenuItem\">\n";
+		$h .= "    <span>Change Predictive Loading Module</span>\n";
+		$h .= "    <div dojoType=\"dijit.layout.ContentPane\"\n";
+		$h .= "         style=\"background-color: white; padding: 5px; border: 1px solid black;\">\n";
+		$h .= "      Change Predictive Loading Module to:<br>\n";
+		$h .= selectInputAutoDijitHTML('', $premodules, 'newpredictivemoduleid');
+		$cdata = $this->basecdata;
+		$cont = addContinuationsEntry('AJcompPredictiveModuleChange', $cdata);
+		$h .= "      <input type=\"hidden\" id=\"predictivemodulechangecont\" value=\"$cont\"><br>\n";
+		$h .= dijitButton('', 'Confirm Predictive Loading Module Change', 'confirmPredictiveModuleChange();', 0);
+		$h .= "    </div>\n";
 		$h .= "  </div>\n";
 
-		# change state
-		$states = array("2" => "available",
-		                "23" => "hpc",
-		                "10" => "maintenance",
-		                "20" => "convert to vmhostinuse");
+		# change provisioning engine
+		$provisioning = getProvisioning();
 		$h .= "  <div dojoType=\"dijit.PopupMenuItem\">\n";
-		$h .= "    <span>Change State</span>\n";
+		$h .= "    <span>Change Provisioning Engine</span>\n";
 		$h .= "    <div dojoType=\"dijit.layout.ContentPane\"\n";
 		$h .= "         style=\"background-color: white; padding: 5px; border: 1px solid black;\">\n";
-		$h .= "      Change state to:<br>\n";
-		$h .= selectInputAutoDijitHTML('', $states, 'newstateid');
+		$h .= "      Change Provisioning Engine to:<br>\n";
+		$h .= selectInputAutoDijitHTML('', $provisioning, 'newprovisioningid');
 		$cdata = $this->basecdata;
-		$cdata['states'] = $states;
-		$cont = addContinuationsEntry('AJcompStateChange', $cdata);
-		$h .= "      <input type=\"hidden\" id=\"statechangecont\" value=\"$cont\"><br>\n";
-		$h .= dijitButton('', 'Confirm State Change', 'confirmStateChange();', 0);
+		$cont = addContinuationsEntry('AJcompProvisioningChange', $cdata);
+		$h .= "      <input type=\"hidden\" id=\"provisioningchangecont\" value=\"$cont\"><br>\n";
+		$h .= dijitButton('', 'Confirm Provisioning Engine Change', 'confirmProvisioningChange();', 0);
 		$h .= "    </div>\n";
 		$h .= "  </div>\n";
 
@@ -231,21 +222,41 @@ class Computer extends Resource {
 			$h .= "  </div>\n";
 		}
 
-		# change provisioning engine
-		$provisioning = getProvisioning();
+		# change state
+		$states = array("2" => "available",
+		                "23" => "hpc",
+		                "10" => "maintenance",
+		                "20" => "convert to vmhostinuse");
 		$h .= "  <div dojoType=\"dijit.PopupMenuItem\">\n";
-		$h .= "    <span>Change Provisioning Engine</span>\n";
+		$h .= "    <span>Change State</span>\n";
 		$h .= "    <div dojoType=\"dijit.layout.ContentPane\"\n";
 		$h .= "         style=\"background-color: white; padding: 5px; border: 1px solid black;\">\n";
-		$h .= "      Change Provisioning Engine to:<br>\n";
-		$h .= selectInputAutoDijitHTML('', $provisioning, 'newprovisioningid');
+		$h .= "      Change state to:<br>\n";
+		$h .= selectInputAutoDijitHTML('', $states, 'newstateid');
 		$cdata = $this->basecdata;
-		$cont = addContinuationsEntry('AJcompProvisioningChange', $cdata);
-		$h .= "      <input type=\"hidden\" id=\"provisioningchangecont\" value=\"$cont\"><br>\n";
-		$h .= dijitButton('', 'Confirm Provisioning Engine Change', 'confirmProvisioningChange();', 0);
+		$cdata['states'] = $states;
+		$cont = addContinuationsEntry('AJcompStateChange', $cdata);
+		$h .= "      <input type=\"hidden\" id=\"statechangecont\" value=\"$cont\"><br>\n";
+		$h .= dijitButton('', 'Confirm State Change', 'confirmStateChange();', 0);
 		$h .= "    </div>\n";
 		$h .= "  </div>\n";
 
+		# delete
+		$h .= "  <div dojoType=\"dijit.MenuItem\"\n";
+		$h .= "       onClick=\"confirmDelete\">\n";
+		$h .= "    Delete Computers\n";
+		$cont = addContinuationsEntry('AJdeleteComputers', $this->basecdata);
+		$h .= "      <input type=\"hidden\" id=\"deletecont\" value=\"$cont\"><br>\n";
+		$h .= "  </div>\n";
+
+		# generate /etc/hosts data
+		$h .= "  <div dojoType=\"dijit.MenuItem\"\n";
+		$h .= "       onClick=\"hostsData\">\n";
+		$h .= "    Generate /etc/hosts Data\n";
+		$cont = addContinuationsEntry('AJhostsData', $this->basecdata);
+		$h .= "      <input type=\"hidden\" id=\"hostsdatacont\" value=\"$cont\"><br>\n";
+		$h .= "  </div>\n";
+
 		# generate private dhcpd data
 		$h .= "  <div dojoType=\"dijit.PopupMenuItem\">\n";
 		$h .= "    <span>Generate Private dhcpd Data</span>\n";
@@ -280,13 +291,22 @@ class Computer extends Resource {
 		$h .= "    </div>\n";
 		$h .= "  </div>\n";
 
-		# generate /etc/hosts data
-		$h .= "  <div dojoType=\"dijit.MenuItem\"\n";
-		$h .= "       onClick=\"hostsData\">\n";
-		$h .= "    Generate /etc/hosts Data\n";
-		$cont = addContinuationsEntry('AJhostsData', $this->basecdata);
-		$h .= "      <input type=\"hidden\" id=\"hostsdatacont\" value=\"$cont\"><br>\n";
-		$h .= "  </div>\n";
+		# reload
+		$resources = getUserResources(array("imageAdmin", "imageCheckOut"));
+		if(count($resources['image'])) {
+			$h .= "  <div dojoType=\"dijit.PopupMenuItem\">\n";
+			$h .= "    <span>Reload with an Image</span>\n";
+			$h .= "    <div dojoType=\"dijit.layout.ContentPane\"\n";
+			$h .= "         style=\"background-color: white; padding: 5px; border: 1px solid black;\">\n";
+			$h .= "      Reload computers with the following image:<br>\n";
+			$extra = 'autoComplete="false"';
+			$h .= selectInputAutoDijitHTML('', $resources['image'], 'reloadimageid', $extra);
+			$cont = addContinuationsEntry('AJreloadComputers', $this->basecdata);
+			$h .= "      <input type=\"hidden\" id=\"reloadcont\" value=\"$cont\"><br>\n";
+			$h .= dijitButton('', 'Confirm Reload Computers', 'confirmReload();', 0);
+			$h .= "    </div>\n";
+			$h .= "  </div>\n";
+		}
 
 		$h .= "</div>\n"; # close Menu
 		$h .= "</div>\n"; # close DropDownButton
@@ -610,6 +630,10 @@ class Computer extends Resource {
 		$tmpArr = array("10" => "10", "100" => "100", "1000" => "1000", "10000" => "10000", "100000" => "100000");
 		$h .= labeledFormItem('network', 'Network', 'select', $tmpArr);
 
+		# predictive loading module
+		$vals = getPredictiveModules();
+		$h .= labeledFormItem('predictivemoduleid', 'Predictive Loading Module', 'select', $vals);
+
 		# compid
 		$h .= "<div id=\"compidspan\">\n";
 		$h .= "<label for=\"compid\">Computer ID:</label>\n";
@@ -767,7 +791,7 @@ class Computer extends Resource {
 			# other fields
 			$fields = array('type', 'IPaddress', 'privateIPaddress',
 			                'provisioningid', 'platformid', 'scheduleid', 'ram',
-			                'procspeed', 'network', 'location');
+			                'procspeed', 'network', 'predictivemoduleid', 'location');
 			foreach($fields as $field) {
 				if($data[$field] != $olddata[$field])
 					$updates[] = "`$field` = '{$data[$field]}'";
@@ -1445,6 +1469,7 @@ class Computer extends Resource {
 	/// \b cores\n
 	/// \b procspeed\n
 	/// \b network\n
+	/// \b predictivemoduleid - id of module to use when preloading nodes\n
 	/// \b location - free string describing location\n
 	/// \b mode - 'edit' or 'add'\n
 	/// \b addmode - 'single' or 'multiple'\n
@@ -1493,6 +1518,7 @@ class Computer extends Resource {
 		$return['cores'] = processInputVar('cores', ARG_NUMERIC);
 		$return['procspeed'] = processInputVar('procspeed', ARG_NUMERIC);
 		$return['network'] = processInputVar('network', ARG_NUMERIC);
+		$return['predictivemoduleid'] = processInputVar('predictivemoduleid', ARG_NUMERIC);
 		$return['location'] = processInputVar('location', ARG_STRING);
 		$addmode = processInputVar('addmode', ARG_STRING);
 
@@ -1778,6 +1804,12 @@ class Computer extends Resource {
 			$return['error'] = 1;
 			$errormsg[] = "Invalid value submitted for Network";
 		}
+		# predictivemoduleid
+		$premodules = getPredictiveModules();
+		if(! array_key_exists($return['predictivemoduleid'], $premodules)) {
+			$return['error'] = 1;
+			$errormsg[] = "Invalid value submitted for Predictive Loading Module";
+		}
 		# location
 		if(! preg_match('/^([-a-zA-Z0-9_\. ,@#\(\)]{0,255})$/', $return['location'])) {
 			$return['error'] = 1;
@@ -1902,7 +1934,8 @@ class Computer extends Resource {
 		              'scheduleid',       'RAM',
 		              'procnumber',       'procspeed',
 		              'network',          'currentimageid',
-		              'imagerevisionid',  'location');
+		              'imagerevisionid',  'location',
+		              'predictivemoduleid');
 		if($data['addmode'] == 'single') {
 			$eth0 = "'{$data['eth0macaddress']}'";
 			if($data['eth0macaddress'] == '')
@@ -1918,7 +1951,8 @@ class Computer extends Resource {
 			                   $data['scheduleid'],          $data['ram'],
 			                   $data['cores'],               $data['procspeed'],
 			                   $data['network'],             $noimageid,
-			                   $norevid,                  "'{$data['location']}'");
+			                   $norevid,                  "'{$data['location']}'",
+			                   $data['predictivemoduleid']);
 	
 			$query = "INSERT INTO computer ("
 			       . implode(', ', $keys) . ") VALUES ("
@@ -3958,6 +3992,101 @@ class Computer extends Resource {
 
 	/////////////////////////////////////////////////////////////////////////////
 	///
+	/// \fn AJcompPredictiveModuleChange()
+	///
+	/// \brief confirms changing provisioning engine of submitted computers
+	///
+	/////////////////////////////////////////////////////////////////////////////
+	function AJcompPredictiveModuleChange() {
+		$predictivemoduleid = processInputVar('predictivemoduleid', ARG_NUMERIC);
+		$premodules = getPredictiveModules();
+		if(! array_key_exists($predictivemoduleid, $premodules)) {
+			$ret = array('status' => 'error',
+			             'errormsg' => 'Invalid Predictive Loading Module submitted.');
+			sendJSON($ret);
+			return;
+		}
+		$compids = $this->validateCompIDs();
+		if(array_key_exists('error', $compids)) {
+			$ret = array('status' => 'error', 'errormsg' => $compids['msg']);
+			sendJSON($ret);
+			return;
+		}
+		if(count($compids) == 0) {
+			$ret = array('status' => 'noaction');
+			sendJSON($ret);
+			return;
+		}
+
+		$tmp = getUserResources(array($this->restype . "Admin"), array("administer"), 0, 1);
+		$computers = $tmp['computer'];
+
+		$msg  = "Change the Predictive Loading Module of the following<br>computers to ";
+		$msg .= "<strong>{$premodules[$predictivemoduleid]['prettyname']}</strong>?<br><br>\n";
+		$complist = '';
+		foreach($compids as $compid)
+			$complist .= $computers[$compid] . "<br>\n";
+		$complist .= "<br>\n";
+
+		$cdata = $this->basecdata;
+		$cdata['compids'] = $compids;
+		$cdata['predictivemoduleid'] = $predictivemoduleid;
+		$cdata['predictivemodulename'] = $premodules[$predictivemoduleid]['prettyname'];
+		$cont = addContinuationsEntry('AJsubmitCompPredictiveModuleChange', $cdata, SECINDAY, 1, 0);
+		$ret = array('status' => 'success',
+		             'title' => "Predictive Loading Module Change",
+		             'btntxt' => 'Submit Predictive Loading Module Change',
+		             'cont' => $cont,
+		             'actionmsg' => $msg,
+		             'complist' => $complist);
+		sendJSON($ret);
+	}
+
+	/////////////////////////////////////////////////////////////////////////////
+	///
+	/// \fn AJsubmitCompPredictiveModuleChange
+	///
+	/// \brief changes provisioning engine of submitted computers
+	///
+	/////////////////////////////////////////////////////////////////////////////
+	function AJsubmitCompPredictiveModuleChange() {
+		$predictivemoduleid = getContinuationVar('predictivemoduleid');
+		$predictivename = getContinuationVar('predictivemodulename');
+		$compids = getContinuationVar('compids');
+
+		$startcheck = time() + 900;
+		$startcheckdt = unixToDatetime($startcheck);
+		$allids = implode(',', $compids);
+
+		$query = "UPDATE computer "
+		       . "SET predictivemoduleid = $predictivemoduleid "
+		       . "WHERE id in ($allids)";
+		doQuery($query);
+
+		$resources = getUserResources(array($this->restype . "Admin"), array("administer"));
+		$compdata = $resources[$this->restype];
+
+		$msg  = "The following computers had their Predictive Loading Module<br>set to $predictivename:<br><br>\n";
+		foreach($compids as $compid)
+			$msg .= "{$compdata[$compid]}<br>\n";
+		$msg .= "<br>";
+
+		# clear user resource cache for this type
+		$key = getKey(array(array($this->restype . "Admin"), array("administer"), 0, 1, 0));
+		unset($_SESSION['userresources'][$key]);
+		$key = getKey(array(array($this->restype . "Admin"), array("administer"), 0, 0, 0));
+		unset($_SESSION['userresources'][$key]);
+
+		$ret = array('status' => 'success',
+		             'title' => "Change Predictive Loading Module",
+		             'clearselection' => 0,
+		             'refreshcount' => 1,
+		             'msg' => $msg);
+		sendJSON($ret);
+	}
+
+	/////////////////////////////////////////////////////////////////////////////
+	///
 	/// \fn AJcompScheduleChange()
 	///
 	/// \brief confirms changing schedule of submitted computers

Modified: vcl/trunk/web/.ht-inc/managementnode.php
URL: http://svn.apache.org/viewvc/vcl/trunk/web/.ht-inc/managementnode.php?rev=1627559&r1=1627558&r2=1627559&view=diff
==============================================================================
--- vcl/trunk/web/.ht-inc/managementnode.php (original)
+++ vcl/trunk/web/.ht-inc/managementnode.php Thu Sep 25 15:40:56 2014
@@ -95,7 +95,6 @@ class ManagementNode extends Resource {
 				break;
 			case 'imagelibgroup':
 			case 'imagelibkey':
-			case 'predictivemodule':
 			case 'federatedauth':
 				$w = 9.5;
 				break;
@@ -162,8 +161,6 @@ class ManagementNode extends Resource {
 				return 'Sysadmin Email Address';
 			case 'sharedmailbox':
 				return 'Shadow Email Address';
-			case 'predictivemodule':
-				return 'Predictive Loading Module';
 			case 'federatedauth':
 				return 'Federated Auth. Affiliations';
 			case 'timeservers':
@@ -267,11 +264,6 @@ class ManagementNode extends Resource {
 		$h .= labeledFormItem('sharedmailbox', 'Address for Shadow Emails', 'text', $reg, 0, '',
 		                      $errmsg, '', '', '', helpIcon('sharedmailboxhelp')); 
 
-		# predictive loading module
-		$vals = getPredictiveModules();
-		$h .= labeledFormItem('premoduleid', 'Predictive Loading Module', 'select', $vals, -1, '',
-		                      '', '', '', '', helpIcon('predictivehelp'));
-
 		# checkininterval
 		$extra = array('smallDelta' => 1, 'largeDelta' => 2);
 		$h .= labeledFormItem('checkininterval', 'Check-in Interval (sec)', 'spinner', '{min:5,max:30,places:0}',
@@ -400,7 +392,6 @@ class ManagementNode extends Resource {
 		$h .= "<div id=\"tooltips\">\n";
 		$h .= helpTooltip('sysadminemailhelp', _("Comma delimited list of email addresses for sysadmins who should receive error emails from this management node. Leave empty to disable this feature."));
 		$h .= helpTooltip('sharedmailboxhelp', _("Single email address to which copies of all user emails should be sent. This is a high traffic set of emails. Leave empty to disable this feature."));
-		$h .= helpTooltip('predictivehelp', _("This is the method used to determine which image should be loaded on a computer at the end of a reservation."));
 		$h .= helpTooltip('checkinhelp', _("the number of seconds that this management node will wait before checking the database for tasks."));
 		$h .= helpTooltip('installpathhelp', _("path to parent directory of image repository directories (typically /install) - only needed with bare metal installs or VMWare with local disk"));
 		$h .= helpTooltip('timeservershelp', _("comma delimited list of time servers for this management node"));
@@ -487,9 +478,6 @@ class ManagementNode extends Resource {
 			# keys
 			if($data['keys'] != $olddata['keys'])
 				$updates[] = "keys = '{$data['keys']}'";
-			# predictivemoduleid
-			if($data['premoduleid'] != $olddata['predictivemoduleid'])
-				$updates[] = "predictivemoduleid = '{$data['premoduleid']}'";
 			# sshport
 			if($data['sshport'] != $olddata['sshport'])
 				$updates[] = "sshport = '{$data['sshport']}'";
@@ -589,7 +577,6 @@ class ManagementNode extends Resource {
 	/// \b publicnetmask - public netmask if doing static configuration\n
 	/// \b publicgateway - public gateway if doing static configuration\n
 	/// \b publicdnsserver - public DNS server if doing static configuration\n
-	/// \b premoduleid - id of module to use when preloading nodes\n
 	/// \b checkininterval - time in seconds between database checkins\n
 	/// \b availablenetworks - networks available to nodes managed by this
 	///    management node when requesting a fixed IP address\n
@@ -625,7 +612,6 @@ class ManagementNode extends Resource {
 		$return['publicnetmask'] = processInputVar('publicnetmask', ARG_STRING);
 		$return['publicgateway'] = processInputVar('publicgateway', ARG_STRING);
 		$return['publicdnsserver'] = processInputVar('publicdnsserver', ARG_STRING);
-		$return['premoduleid'] = processInputVar('premoduleid', ARG_NUMERIC);
 		$return['checkininterval'] = processInputVar('checkininterval', ARG_NUMERIC);
 		$return['availablenetworks'] = processInputVar('availablenetworks', ARG_STRING);
 		$return['federatedauth'] = processInputVar('federatedauth', ARG_STRING);
@@ -790,12 +776,6 @@ class ManagementNode extends Resource {
 			$return['error'] = 1;
 			$errormsg[] = "Invalid value submitted for State";
 		}
-		# premoduleid
-		$premodules = getPredictiveModules();
-		if(! array_key_exists($return['premoduleid'], $premodules)) {
-			$return['error'] = 1;
-			$errormsg[] = "Invalid value submitted for Predictive Loading Module";
-		}
 		# checkininterval
 		if($return['checkininterval'] < 5)
 			$return['checkininterval'] = 5;
@@ -873,22 +853,20 @@ class ManagementNode extends Resource {
 		$keys = array('IPaddress',            'hostname',
 		              'ownerid',              'stateid',
 		              'checkininterval',      'installpath',
-		              '`keys`',               'predictivemoduleid',
-		              'sshport',              'sysadminEmailAddress',
-		              'sharedMailBox',        'availablenetworks',
-		              'NOT_STANDALONE',       'imagelibenable',
-		              'publicIPconfiguration','imagelibgroupid',
-		              'imagelibuser',         'imagelibkey',
-		              'publicSubnetMask',     'publicDefaultGateway',
-		              'publicDNSserver');
-		$values = array("'{$data['ipaddress']}'",      "'{$data['name']}'",
-		                   $ownerid,                      $data['stateid'],
-		                   $data['checkininterval'],   "'{$data['installpath']}'",
-		                "'{$data['keys']}'",              $data['premoduleid'],
-		                   $data['sshport'],            "'{$esc['sysadminemail']}'",
-		                 "'{$esc['sharedmailbox']}'",  "'{$data['availablenetworks']}'",
-		                "'{$data['federatedauth']}'",     $data['imagelibenable'],
-		                "'{$data['publicIPconfig']}'");
+		              '`keys`',               'sshport',
+		              'sysadminEmailAddress', 'sharedMailBox',
+		              'availablenetworks',    'NOT_STANDALONE',
+		              'imagelibenable',       'publicIPconfiguration',
+		              'imagelibgroupid',      'imagelibuser',
+		              'imagelibkey',          'publicSubnetMask',
+		              'publicDefaultGateway', 'publicDNSserver');
+		$values = array("'{$data['ipaddress']}'",        "'{$data['name']}'",
+		                   $ownerid,                        $data['stateid'],
+		                   $data['checkininterval'],     "'{$data['installpath']}'",
+		                "'{$data['keys']}'",                $data['sshport'],
+		                 "'{$esc['sysadminemail']}'",     "'{$esc['sharedmailbox']}'",
+		                "'{$data['availablenetworks']}'","'{$data['federatedauth']}'",
+		                   $data['imagelibenable'],      "'{$data['publicIPconfig']}'");
 		if($data['imagelibenable'] == 1) {
 			$values[] = $data['imagelibgroupid'];
 			$values[] = "'{$data['imagelibuser']}'";

Modified: vcl/trunk/web/.ht-inc/states.php
URL: http://svn.apache.org/viewvc/vcl/trunk/web/.ht-inc/states.php?rev=1627559&r1=1627558&r2=1627559&view=diff
==============================================================================
--- vcl/trunk/web/.ht-inc/states.php (original)
+++ vcl/trunk/web/.ht-inc/states.php Thu Sep 25 15:40:56 2014
@@ -197,6 +197,8 @@ $noHTMLwrappers = array('sendRDPfile',
                         'AJcompStateChange',
                         'AJcompProvisioningChange',
                         'AJsubmitCompProvisioningChange',
+                        'AJcompPredictiveModuleChange',
+                        'AJsubmitCompPredictiveModuleChange',
                         'AJsubmitCompStateChange',
                         'AJsubmitComputerStateLater',
                         'AJconnectRequest',
@@ -610,6 +612,8 @@ $actions['mode']['AJhostsData'] = "AJhos
 $actions['mode']['AJcompStateChange'] = "AJcompStateChange";
 $actions['mode']['AJcompProvisioningChange'] = "AJcompProvisioningChange";
 $actions['mode']['AJsubmitCompProvisioningChange'] = "AJsubmitCompProvisioningChange";
+$actions['mode']['AJcompPredictiveModuleChange'] = "AJcompPredictiveModuleChange";
+$actions['mode']['AJsubmitCompPredictiveModuleChange'] = "AJsubmitCompPredictiveModuleChange";
 $actions['mode']['AJsubmitCompStateChange'] = "AJsubmitCompStateChange";
 $actions['mode']['AJsubmitComputerStateLater'] = "AJsubmitComputerStateLater";
 $actions['mode']['jsonImageConnectMethods'] = "jsonImageConnectMethods";
@@ -664,6 +668,8 @@ $actions['pages']['AJhostsData'] = "reso
 $actions['pages']['AJcompStateChange'] = "resource";
 $actions['pages']['AJcompProvisioningChange'] = "resource";
 $actions['pages']['AJsubmitCompProvisioningChange'] = "resource";
+$actions['pages']['AJcompPredictiveModuleChange'] = "resource";
+$actions['pages']['AJsubmitCompPredictiveModuleChange'] = "resource";
 $actions['pages']['AJsubmitCompStateChange'] = "resource";
 $actions['pages']['AJsubmitComputerStateLater'] = "resource";
 $actions['pages']['jsonImageConnectMethods'] = "resource";

Modified: vcl/trunk/web/.ht-inc/utils.php
URL: http://svn.apache.org/viewvc/vcl/trunk/web/.ht-inc/utils.php?rev=1627559&r1=1627558&r2=1627559&view=diff
==============================================================================
--- vcl/trunk/web/.ht-inc/utils.php (original)
+++ vcl/trunk/web/.ht-inc/utils.php Thu Sep 25 15:40:56 2014
@@ -6748,8 +6748,6 @@ function getManagementNodes($alive="neit
 	       .        "m.sysadminEmailAddress AS sysadminemail, "
 	       .        "m.sharedMailBox AS sharedmailbox, "
 	       .        "r.id as resourceid, "
-	       .        "m.predictivemoduleid, "
-	       .        "mo.prettyname AS predictivemodule, "
 	       .        "m.availablenetworks, "
 	       .        "m.NOT_STANDALONE AS federatedauth "
 	       . "FROM user u, "
@@ -6757,7 +6755,6 @@ function getManagementNodes($alive="neit
 	       .      "resource r, "
 	       .      "resourcetype rt, "
 	       .      "affiliation a, "
-	       .      "module mo, "
 	       .      "managementnode m "
 	       . "LEFT JOIN resourcegroup rg ON (m.imagelibgroupid = rg.id) "
 	       . "WHERE m.ownerid = u.id AND "
@@ -6765,8 +6762,7 @@ function getManagementNodes($alive="neit
 	       .       "m.id = r.subid AND "
 	       .       "r.resourcetypeid = rt.id AND "
 	       .       "rt.name = 'managementnode' AND "
-	       .       "u.affiliationid = a.id AND "
-	       .       "m.predictivemoduleid = mo.id";
+	       .       "u.affiliationid = a.id";
 	if($id != 0)
 		$query .= " AND m.id = $id";
 	if($includedeleted == 0)
@@ -8165,7 +8161,9 @@ function getComputers($sort=0, $included
 	       .        "c.location, "
 	       .        "c.provisioningid, "
 	       .        "pr.prettyname AS provisioning, "
-	       .        "vh2.vmprofileid "
+	       .        "vh2.vmprofileid, "
+	       .        "c.predictivemoduleid, "
+	       .        "m.prettyname AS predictivemodule "
 	       . "FROM state st, "
 	       .      "platform p, "
 	       .      "schedule sc, "
@@ -8174,6 +8172,7 @@ function getComputers($sort=0, $included
 	       .      "resourcetype t, "
 	       .      "user u, "
 	       .      "affiliation a, "
+	       .      "module m, "
 	       .      "computer c "
 	       . "LEFT JOIN vmhost vh ON (c.vmhostid = vh.id) "
 	       . "LEFT JOIN vmhost vh2 ON (c.id = vh2.computerid) "
@@ -8188,7 +8187,8 @@ function getComputers($sort=0, $included
 	       .       "t.name = 'computer' AND "
 	       .       "r.subid = c.id AND "
 	       .       "c.ownerid = u.id AND "
-	       .       "u.affiliationid = a.id ";
+	       .       "u.affiliationid = a.id AND "
+	       .       "c.predictivemoduleid = m.id ";
 	if(! $includedeleted)
 		$query .= "AND c.deleted = 0 ";
 	if(! empty($compid))
@@ -9844,8 +9844,8 @@ function addChangeLogEntryOther($logid, 
 function addSublogEntry($logid, $imageid, $imagerevisionid, $computerid,
                         $mgmtnodeid, $fromblock, $blockdata) {
 	$query = "SELECT predictivemoduleid "
-	       . "FROM managementnode "
-	       . "WHERE id = $mgmtnodeid";
+	       . "FROM computer "
+	       . "WHERE id = $computerid";
 	$qh = doQuery($query, 101);
 	$row = mysql_fetch_assoc($qh);
 	$predictiveid = $row['predictivemoduleid'];

Modified: vcl/trunk/web/js/resources.js
URL: http://svn.apache.org/viewvc/vcl/trunk/web/js/resources.js?rev=1627559&r1=1627558&r2=1627559&view=diff
==============================================================================
--- vcl/trunk/web/js/resources.js (original)
+++ vcl/trunk/web/js/resources.js Thu Sep 25 15:40:56 2014
@@ -217,6 +217,7 @@ function initViewResources() {
 	   resourcestore.comparatorMap = {};
 	}
 	resourcestore.comparatorMap['name'] = resource.nocasesort;
+	setTimeout(function() {resourcegrid.sort();}, 100);
 }
 
 function toggleCmapFieldDisplay(obj, field) {

Modified: vcl/trunk/web/js/resources/computer.js
URL: http://svn.apache.org/viewvc/vcl/trunk/web/js/resources/computer.js?rev=1627559&r1=1627558&r2=1627559&view=diff
==============================================================================
--- vcl/trunk/web/js/resources/computer.js (original)
+++ vcl/trunk/web/js/resources/computer.js Thu Sep 25 15:40:56 2014
@@ -600,6 +600,7 @@ function inlineEditResourceCB(data, ioAr
 		dijit.byId('cores').set('value', data.items.data.procnumber);
 		dijit.byId('procspeed').set('value', data.items.data.procspeed);
 		dijit.byId('network').set('value', data.items.data.network);
+		dijit.byId('predictivemoduleid').set('value', data.items.data.predictivemoduleid);
 		dojo.byId('compid').innerHTML = data.items.data.id;
 		dijit.byId('location').set('value', data.items.data.location);
 		dojo.byId('addeditdlgerrmsg').innerHTML = '';
@@ -695,7 +696,7 @@ function resetEditResource() {
 	              'vmprofileid', 'platformid', 'scheduleid', 'ram', 'cores',
 	              'procspeed', 'network', 'location', 'startnum', 'endnum',
 	              'startpubipaddress', 'endpubipaddress', 'startprivipaddress',
-	              'endprivipaddress', 'startmac', 'notes'];
+	              'endprivipaddress', 'startmac', 'notes', 'predictivemoduleid'];
 	for(var i = 0; i < fields.length; i++) {
 		dijit.byId(fields[i]).reset();
 	}
@@ -748,6 +749,7 @@ function saveResource() {
 	data['platformid'] = dijit.byId('platformid').get('value');
 	data['scheduleid'] = dijit.byId('scheduleid').get('value');
 	data['network'] = dijit.byId('network').get('value');
+	data['predictivemoduleid'] = dijit.byId('predictivemoduleid').get('value');
 	data['addmode'] = dijit.byId('mode').get('value');
 
 	dijit.byId('addeditbtn').set('disabled', true);
@@ -830,6 +832,7 @@ function saveResourceCB(data, ioArgs) {
 					resourcegrid.store.setValue(item, 'deleted', data.items.data.deleted);
 					resourcegrid.store.setValue(item, 'notes', data.items.data.notes);
 					resourcegrid.store.setValue(item, 'vmhost', data.items.data.vmhost);
+					resourcegrid.store.setValue(item, 'predictivemodule', data.items.data.predictivemodule);
 					resourcegrid.store.setValue(item, 'location', data.items.data.location);
 					resourcegrid.store.setValue(item, 'provisioning', data.items.data.provisioning);
 				},
@@ -909,6 +912,12 @@ function confirmProvisioningChange() {
 	confirmAction(data);
 }
 
+function confirmPredictiveModuleChange() {
+	var data = {continuation: dojo.byId('predictivemodulechangecont').value,
+	            predictivemoduleid: dijit.byId('newpredictivemoduleid').get('value')};
+	confirmAction(data);
+}
+
 function generateDHCPdata(type) {
 	var data = {continuation: dojo.byId(type + 'dhcpcont').value,
 	            type: type};

Modified: vcl/trunk/web/js/resources/managementnode.js
URL: http://svn.apache.org/viewvc/vcl/trunk/web/js/resources/managementnode.js?rev=1627559&r1=1627558&r2=1627559&view=diff
==============================================================================
--- vcl/trunk/web/js/resources/managementnode.js (original)
+++ vcl/trunk/web/js/resources/managementnode.js Thu Sep 25 15:40:56 2014
@@ -103,7 +103,6 @@ function inlineEditResourceCB(data, ioAr
 		dijit.byId('stateid').set('value', data.items.data.stateid);
 		dijit.byId('sysadminemail').set('value', data.items.data.sysadminemail);
 		dijit.byId('sharedmailbox').set('value', data.items.data.sharedmailbox);
-		dijit.byId('premoduleid').set('value', data.items.data.predictivemoduleid);
 		dijit.byId('checkininterval').set('value', data.items.data.checkininterval);
 		dijit.byId('installpath').set('value', data.items.data.installpath);
 		dijit.byId('timeservers').set('value', data.items.data.timeservers);
@@ -131,7 +130,7 @@ function inlineEditResourceCB(data, ioAr
 }
 
 function resetEditResource() {
-	var fields = ['name', 'owner', 'ipaddress', 'stateid', 'sysadminemail', 'sharedmailbox', 'premoduleid', 'checkininterval', 'installpath', 'timeservers', 'keys', 'sshport', 'imagelibenable', 'imagelibgroupid', 'imagelibuser', 'imagelibkey', 'publicIPconfig', 'publicnetmask', 'publicgateway', 'publicdnsserver', 'availablenetworks', 'federatedauth'];
+	var fields = ['name', 'owner', 'ipaddress', 'stateid', 'sysadminemail', 'sharedmailbox', 'checkininterval', 'installpath', 'timeservers', 'keys', 'sshport', 'imagelibenable', 'imagelibgroupid', 'imagelibuser', 'imagelibkey', 'publicIPconfig', 'publicnetmask', 'publicgateway', 'publicdnsserver', 'availablenetworks', 'federatedauth'];
 	for(var i = 0; i < fields.length; i++) {
 		dijit.byId(fields[i]).reset();
 	}
@@ -196,7 +195,6 @@ function saveResource() {
 		data[fields[i]] = dijit.byId(fields[i]).get('value');
 	}
 	data['stateid'] = dijit.byId('stateid').get('value');
-	data['premoduleid'] = dijit.byId('premoduleid').get('value');
 	data['checkininterval'] = dijit.byId('checkininterval').get('value');
 	data['sshport'] = dijit.byId('sshport').get('value');
 	data['imagelibgroupid'] = dijit.byId('imagelibgroupid').get('value');
@@ -249,7 +247,6 @@ function saveResourceCB(data, ioArgs) {
 					resourcegrid.store.setValue(item, 'installpath', data.items.data.installpath);
 					resourcegrid.store.setValue(item, 'keys', data.items.data.keys);
 					resourcegrid.store.setValue(item, 'lastcheckin', data.items.data.lastcheckin);
-					resourcegrid.store.setValue(item, 'predictivemodule', data.items.data.predictivemodule);
 					resourcegrid.store.setValue(item, 'publicIPconfig', data.items.data.publicIPconfig);
 					resourcegrid.store.setValue(item, 'publicdnsserver', data.items.data.publicdnsserver);
 					resourcegrid.store.setValue(item, 'publicgateway', data.items.data.publicgateway);