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 2010/08/06 17:46:49 UTC
svn commit: r983029 - in /incubator/vcl/trunk/web: .ht-inc/vm.php js/vm.js
Author: jfthomps
Date: Fri Aug 6 15:46:48 2010
New Revision: 983029
URL: http://svn.apache.org/viewvc?rev=983029&view=rev
Log:
VCL-338
vmprofiles that are in use can be deleted
vm.php: modified AJdelProfile - added query to check for profile being in use
js/vm.js: modified delProfileCB - added check for data.items.failed to be set to inuse; if so display appropriate error message
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=983029&r1=983028&r2=983029&view=diff
==============================================================================
--- incubator/vcl/trunk/web/.ht-inc/vm.php (original)
+++ incubator/vcl/trunk/web/.ht-inc/vm.php Fri Aug 6 15:46:48 2010
@@ -872,6 +872,23 @@ function AJdelProfile() {
return;
}
$profileid = processInputVar('profileid', ARG_NUMERIC);
+ # check to see if profile is in use
+ $query = "SELECT vh.computerid, "
+ . "s.name "
+ . "FROM vmhost vh, "
+ . "computer c, "
+ . "state s "
+ . "WHERE vh.computerid = c.id AND "
+ . "c.stateid = s.id AND "
+ . "s.name IN ('vmhostinuse', 'tovmhostinuse') AND "
+ . "vh.vmprofileid = $profileid";
+ $qh = doQuery($query, 101);
+ if($row = mysql_fetch_assoc($qh)) {
+ $arr = array('failed' => 'inuse');
+ header('Content-Type: text/json-comment-filtered; charset=utf-8');
+ print '/*{"items":' . json_encode($arr) . '}*/';
+ return;
+ }
$query = "DELETE FROM vmprofile WHERE id = $profileid";
doQuery($query, 101);
header('Content-Type: text/json-comment-filtered; charset=utf-8');
Modified: incubator/vcl/trunk/web/js/vm.js
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/web/js/vm.js?rev=983029&r1=983028&r2=983029&view=diff
==============================================================================
--- incubator/vcl/trunk/web/js/vm.js (original)
+++ incubator/vcl/trunk/web/js/vm.js Fri Aug 6 15:46:48 2010
@@ -698,7 +698,12 @@ function delProfile(cont) {
function delProfileCB(data, ioArgs) {
if(data.items.failed) {
- alert('You do not have access to manage this vm profile.');
+ if(data.items.failed == 'noaccess') {
+ alert('You do not have access to manage this vm profile.');
+ }
+ else if(data.items.failed == 'inuse') {
+ alert('This profile is currently in use on a vmhost. You must reload\nthe host with another profile to delete this one.');
+ }
dijit.byId('messages').hide();
document.body.style.cursor = 'default';
return;