Merge branch 'master' of ssh://git.cloud.com/var/lib/git/cloudstack-oss

This commit is contained in:
nit 2010-11-11 15:55:39 +05:30
commit dbba9a5f21
23 changed files with 756 additions and 535 deletions

View File

@ -235,7 +235,6 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
private String _dcId;
private String _pod;
private String _clusterId;
private String _premium;
private long _hvVersion;
private KVMHAMonitor _monitor;
private final String _SSHKEYSPATH = "/root/.ssh";
@ -735,17 +734,12 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
}
_premium = (String)params.get("premium");
if (_premium == null) {
_premium = "false";
}
if (_premium.equalsIgnoreCase("true")) {
String[] info = NetUtils.getNetworkParams(_privateNic);
_monitor = new KVMHAMonitor(null, _conn, info[0], _heartBeatPath);
Thread ha = new Thread(_monitor);
ha.start();
}
String[] info = NetUtils.getNetworkParams(_privateNic);
_monitor = new KVMHAMonitor(null, _conn, info[0], _heartBeatPath);
Thread ha = new Thread(_monitor);
ha.start();
try {
Class<?> clazz = Class.forName("com.cloud.storage.JavaStorageLayer");
@ -865,8 +859,14 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
boolean isDirectAttachedNetwork(String type) {
if ("untagged".equalsIgnoreCase(type))
return true;
else
else {
try {
Long vnetId = Long.valueOf(type);
} catch (NumberFormatException e) {
return true;
}
return false;
}
}
protected synchronized String startDomainRouter(StartRouterCommand cmd) {
@ -1252,14 +1252,14 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
pool.destroy();
pool.undefine();
if (_premium.equalsIgnoreCase("true")) {
KVMHABase.NfsStoragePool sp = new KVMHABase.NfsStoragePool(cmd.getPool().getUuid(),
cmd.getPool().getHostAddress(),
cmd.getPool().getPath(),
_mountPoint + File.separator + cmd.getPool().getUuid(),
PoolType.PrimaryStorage);
_monitor.removeStoragePool(sp);
}
KVMHABase.NfsStoragePool sp = new KVMHABase.NfsStoragePool(cmd.getPool().getUuid(),
cmd.getPool().getHostAddress(),
cmd.getPool().getPath(),
_mountPoint + File.separator + cmd.getPool().getUuid(),
PoolType.PrimaryStorage);
_monitor.removeStoragePool(sp);
return new Answer(cmd);
} catch (LibvirtException e) {
@ -1903,14 +1903,14 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
spi.capacity,
spi.allocation,
tInfo);
if (_premium.equalsIgnoreCase("true")) {
KVMHABase.NfsStoragePool pool = new KVMHABase.NfsStoragePool(cmd.getPool().getUuid(),
cmd.getPool().getHostAddress(),
cmd.getPool().getPath(),
_mountPoint + File.separator + cmd.getPool().getUuid(),
PoolType.PrimaryStorage);
_monitor.addStoragePool(pool);
}
KVMHABase.NfsStoragePool pool = new KVMHABase.NfsStoragePool(cmd.getPool().getUuid(),
cmd.getPool().getHostAddress(),
cmd.getPool().getPath(),
_mountPoint + File.separator + cmd.getPool().getUuid(),
PoolType.PrimaryStorage);
_monitor.addStoragePool(pool);
try {
storagePool.free();
} catch (LibvirtException e) {
@ -2237,7 +2237,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
return new MigrateAnswer(cmd, result == null, result, null);
}
private Answer execute(PrepareForMigrationCommand cmd) {
private synchronized Answer execute(PrepareForMigrationCommand cmd) {
final String vmName = cmd.getVmName();
String result = null;

View File

@ -3718,23 +3718,7 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
return vlanNetwork;
}
protected void disableVlanNetwork(Network network) throws InternalErrorException {
try {
Connection conn = getConnection();
if (network.getVIFs(conn).isEmpty()) {
Iterator<PIF> pifs = network.getPIFs(conn).iterator();
while (pifs.hasNext()) {
PIF pif = pifs.next();
pif.unplug(conn);
}
}
} catch (XenAPIException e) {
String msg = "Unable to disable VLAN network due to " + e.toString();
s_logger.warn(msg, e);
} catch (Exception e) {
String msg = "Unable to disable VLAN network due to " + e.getMessage();
s_logger.warn(msg, e);
}
protected void disableVlanNetwork(Network network) {
}
protected SR getLocalLVMSR() {
@ -4142,7 +4126,6 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
return null;
}
destroyStoppedVm();
StartupRoutingCommand cmd = new StartupRoutingCommand();
fillHostInfo(cmd);

View File

@ -30,7 +30,6 @@ def vm_data(args):
cmd.append("-d")
cmd.append(tmp_path)
except:
util.SMlog(" vmdata failed to write tempfile " )
os.close(fd)
os.remove(tmp_path)
return ''

View File

@ -77,6 +77,7 @@ then
mount $NfsSvrIP:$NfsSvrPath $MountPoint -o sync,soft,proto=tcp,acregmin=0,acregmax=0,acdirmin=0,acdirmax=0,noac,timeo=133,retrans=10 &> /dev/null
if [ $? -gt 0 ]
then
printf "Failed to remount $NfsSvrIP:$NfsSvrPath under $MountPoint"
exit 1
fi
if [ "$rflag" == "0" ]
@ -98,6 +99,7 @@ write_hbLog() {
touch $hbFile &> /dev/null
if [ $? -gt 0 ]
then
printf "Failed to create $hbFile"
return 2
fi
fi

23
scripts/vm/network/vnet/modifyvlan.sh Normal file → Executable file
View File

@ -22,8 +22,12 @@ addVlan() {
if [ $? -gt 0 ]
then
printf "Failed to create vlan $vlanId on pif: $pif."
return 1
# race condition that someone already creates the vlan
if [ ! -d /sys/class/net/$vlanDev ]
then
printf "Failed to create vlan $vlanId on pif: $pif."
return 1
fi
fi
fi
@ -40,8 +44,11 @@ addVlan() {
if [ $? -gt 0 ]
then
printf "Failed to create br: $vlanBr"
return 2
if [ ! -d /sys/class/net/$vlanBr ]
then
printf "Failed to create br: $vlanBr"
return 2
fi
fi
fi
@ -52,8 +59,12 @@ addVlan() {
brctl addif $vlanBr $vlanDev > /dev/null
if [ $? -gt 0 ]
then
printf "Failed to add vlan: $vlanDev to $vlanBr"
return 3
ls /sys/class/net/$vlanBr/brif/ |grep -w "$vlanDev" > /dev/null
if [ $? -gt 0 ]
then
printf "Failed to add vlan: $vlanDev to $vlanBr"
return 3
fi
fi
fi
# is vlanBr up?

View File

@ -154,30 +154,30 @@ public class ApiXmlDocWriter {
}
}
//Get response parameters
Method getResponseMethod = clas.getMethod("getResponse");
Class responseClas = (Class)getResponseMethod.getReturnType();
Type returnType = getResponseMethod.getGenericReturnType();
if(returnType != null && returnType instanceof ParameterizedType){
ParameterizedType type = (ParameterizedType) returnType;
Type[] typeArguments = type.getActualTypeArguments();
responseClas = (Class)typeArguments[0];
}
//Get response parameters
Field[] responseFields = responseClas.getDeclaredFields();
for (Field responseField : responseFields) {
SerializedName nameAnnotation = responseField.getAnnotation(SerializedName.class);
Param descAnnotation = responseField.getAnnotation(Param.class);
Argument respArg = new Argument(nameAnnotation.value());
if (descAnnotation != null)
respArg.setDescription(descAnnotation.description());
response.add(respArg);
}
// //Get response parameters
// Method getResponseMethod = clas.getMethod("getResponse");
// Class responseClas = (Class)getResponseMethod.getReturnType();
// Type returnType = getResponseMethod.getGenericReturnType();
//
// if(returnType != null && returnType instanceof ParameterizedType){
// ParameterizedType type = (ParameterizedType) returnType;
// Type[] typeArguments = type.getActualTypeArguments();
// responseClas = (Class)typeArguments[0];
// }
//
// //Get response parameters
// Field[] responseFields = responseClas.getDeclaredFields();
// for (Field responseField : responseFields) {
// SerializedName nameAnnotation = responseField.getAnnotation(SerializedName.class);
// Param descAnnotation = responseField.getAnnotation(Param.class);
// Argument respArg = new Argument(nameAnnotation.value());
// if (descAnnotation != null)
// respArg.setDescription(descAnnotation.description());
// response.add(respArg);
// }
apiCommand.setRequest(request);
apiCommand.setResponse(response);
//apiCommand.setResponse(response);
commands.add(apiCommand);
//Write command to xml file

View File

@ -884,7 +884,7 @@ public class SnapshotManagerImpl implements SnapshotManager {
throw new InvalidParameterValueException("maxSnaps exceeds limit: " + intervalMaxSnaps + " for interval type: " + cmd.getIntervalType());
}
SnapshotPolicyVO policy = new SnapshotPolicyVO(volumeId, cmd.getSchedule(), timezoneId, (short)type.ordinal(), intervalMaxSnaps);
SnapshotPolicyVO policy = new SnapshotPolicyVO(volumeId, cmd.getSchedule(), timezoneId, (short)type.ordinal(), cmd.getMaxSnaps());
// Create an event
EventVO event = new EventVO();
try{
@ -898,7 +898,7 @@ public class SnapshotManagerImpl implements SnapshotManager {
policy.setSchedule(cmd.getSchedule());
policy.setTimezone(timezoneId);
policy.setInterval((short)type.ordinal());
policy.setMaxSnaps(intervalMaxSnaps);
policy.setMaxSnaps(cmd.getMaxSnaps());
policy.setActive(true);
_snapshotPolicyDao.update(policy.getId(), policy);
} finally {
@ -921,13 +921,12 @@ public class SnapshotManagerImpl implements SnapshotManager {
public boolean deletePolicy(long userId, long policyId) {
SnapshotPolicyVO snapshotPolicy = _snapshotPolicyDao.findById(policyId);
VolumeVO volume = _volsDao.findById(snapshotPolicy.getVolumeId());
snapshotPolicy.setActive(false);
_snapSchedMgr.removeSchedule(snapshotPolicy.getVolumeId(), snapshotPolicy.getId());
EventVO event = new EventVO();
event.setAccountId(volume.getAccountId());
event.setUserId(userId);
event.setType(EventTypes.EVENT_SNAPSHOT_POLICY_DELETE);
boolean success = _snapshotPolicyDao.update(policyId, snapshotPolicy);
boolean success = _snapshotPolicyDao.remove(policyId);
if(success){
event.setLevel(EventVO.LEVEL_INFO);
event.setDescription("Successfully deleted snapshot policy with Id: "+policyId);
@ -1092,13 +1091,16 @@ public class SnapshotManagerImpl implements SnapshotManager {
Long userId = getSnapshotUserId();
if ((policyId == null) && (policyIds == null)) {
throw new ServerApiException(BaseCmd.PARAM_ERROR, "No policy id (or list off ids) specified.");
throw new ServerApiException(BaseCmd.PARAM_ERROR, "No policy id (or list of ids) specified.");
}
if(policyIds.size()<=0){
if (policyIds == null) {
policyIds = new ArrayList<Long>();
policyIds.add(policyId);
} else if(policyIds.size()<=0){
// Not even sure how this is even possible
throw new ServerApiException(BaseCmd.INTERNAL_ERROR,"There are no policy ids");
}
for (Long policy : policyIds) {
SnapshotPolicyVO snapshotPolicyVO = _snapshotPolicyDao.findById(policy);

View File

@ -1868,20 +1868,20 @@ a:hover.search_button {
width:auto;
height:auto;
color:#FFF;
font-size:11px;
font-size:10px;
font-weight:normal;
text-decoration:none;
float:left;
margin:7px 15px 0 7px;
margin:7px 11px 0 5px;
padding:0;
}
.actionpanel_button_icons {
width:30px;
height:20px;
width:25px;
height:18px;
float:left;
margin:3px 0 0 8px;
margin:5px 0 0 7px;
padding:0;
}
@ -1917,18 +1917,21 @@ a:hover.search_button {
width:380px;
height:auto;
float:left;
margin:8px 0 0 10px;
padding:0;
background:#eef2f4 repeat top left;
border:1px solid #CCC;
margin:5px 0 0 10px;
padding:4px 0;
}
.help_dropdown_box_titlebox h2 {
width:auto;
height:auto;
float:left;
color:#999;
color:#333;
text-align:left;
font-size:14px;
margin:0;
margin:0 0 0 10px;
display:inline;
padding:0;
}
@ -1938,7 +1941,7 @@ a:hover.search_button {
font-size:10px;
font-weight:normal;
text-align:left;
margin:0;
margin:0 10px 0 0;
padding:0;
text-decoration:none;
}
@ -4710,7 +4713,7 @@ a:hover.search_button {
----------------------------------*/
.dialog_snapshotbox {width:auto; height:auto; float:left; display:block; margin:0; padding:0;}
.dialog_snapshotcontainer {width:auto height:auto; display:block; float:left; margin:0; padding:0;}
.dialog_snapshotleft {width:500px; height:135px; float:left;display:block; margin:0; padding:0;}
.dialog_snapshotleft {width:400px; height:10px; float:left;display:block; margin:0; padding:0;}
.dialog_snapshotleft_list {width:705px; height:auto; float:left; margin:0 0 10px 0; padding:0; color:#333; font-size:11px;}
.dialog_snapshotleft_info {width:470px; height:auto; float:left; margin:0 0 10px 0; padding:0; color:#333; font-size:11px;}
.dialog_snapshotleft_info p {width:auto; height:auto; float:left; color:#333; font-size:11px; font-weight:normal; margin:0; padding:0;}
@ -4723,7 +4726,7 @@ a:hover.search_button {
.dialog_snapshotleft_actions a:link {width:auto; height:auto; margin:0 5px 0 0; padding:0; color:#2c8bbc; text-decoration:none; font-size:11px;}
.dialog_snapshotleft_actions a:visited {width:auto; height:auto; margin:0 5px 0 0; padding:0; color:#2c8bbc; text-decoration:none; font-size:11px;}
.dialog_snapshotleft_actions a:hover {width:auto; height:auto; margin:0 5px 0 0; padding:0; color:#2c8bbc; text-decoration:underline; font-size:11px;}
.dialog_snapshotright {width:705px; height:0px; float:left; display:none; margin:0; padding:15px 0 0 0; border-top:1px solid #666;}
.dialog_snapshotright {width:400px; height:150px; float:left; margin:0; padding:15px 0 0 0; }
.dialog_snapshotright_infotext{width:360px; height:160px; float:left; display:none; margin:0; padding:0; font-size:15px; font-family:Arial, Helvetica, sans-serif; font-size:normal; text-align:left; margin:10px; color:#333;}
.dialog_snapshots_editcontent {width:350px; height:auto; float:left; margin:0; padding:0;}
.dialog_snapshots_editcontent_title {width:280px; height:auto; float:left; margin:0; padding:0;}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 809 B

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 744 B

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -306,15 +306,18 @@ long milliseconds = new Date().getTime();
</ul>
<h3>Topic 1<a id="topic1" name="topic1"></a>&nbsp;<a href="#help_top">Top</a></h3>
<h3>Topic 1<a id="topic1" name="topic1"></a>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. </p>
<p><a style="float:right;" href="#help_top">Top</a></h3></p>
<h3>Topic 2 <a id="topic2" name="topic2"></a></h3>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. </p><p>It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. </p><p>It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
<p><a style="float:right;" href="#help_top">Top</a></h3></p>
<h3>Topic 3<a id="topic3" name="topic3"></a></h3>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. </p><p>It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
<p><a style="float:right;" href="#help_top">Top</a></h3></p>
</div>
</div>
</div>

View File

@ -34,7 +34,7 @@
</div>
</div>
<div class="dbrow_cell" style="width: 10%; border: none;">
<div class="resadd_button" title="Add Zone"></div>
<div id="add_zone_shortcut" class="resadd_button" title="Add Zone"></div>
</div>
</div>
<div class="dbrow odd" style="margin-top:10px; border:1px solid #CCC;">
@ -49,7 +49,7 @@
</div>
</div>
<div class="dbrow_cell" style="width: 10%; border: none;">
<div class="resadd_button" title="Add Pod"></div>
<div id="add_pod_shortcut" class="resadd_button" title="Add Pod"></div>
</div>
</div>
@ -66,7 +66,7 @@
</div>
</div>
<div class="dbrow_cell" style="width: 10%; border: none;">
<div class="resadd_button" title="Add Host"></div>
<div id="add_host_shortcut" class="resadd_button" title="Add Host"></div>
</div>
</div>
@ -83,7 +83,7 @@
</div>
</div>
<div class="dbrow_cell" style="width: 10%; border: none;">
<div class="resadd_button" title="Add Primary Storage"></div>
<div id="add_primarystorage_shortcut" class="resadd_button" title="Add Primary Storage"></div>
</div>
</div>
@ -93,8 +93,10 @@
<!-- Zone wizard (begin)-->
<div class="ui-widget-overlay" style="display:none;"></div>
<div class="zonepopup_container" style="display: none">
<div id="wizard_overlay" class="ui-widget-overlay" style="display:none;"></div>
<div id="add_zone_wizard" class="zonepopup_container" style="display: none">
<!-- step 1 (begin) -->
<div id="step1" style="display: block;">
<div class="zonepopup_container_top">
<div class="vmpopup_steps" style="color: #FFF; background: url(images/step1_bg.png) no-repeat top left">
@ -121,7 +123,7 @@
<div class="zonepopup_selectionpanel">
<div class="zonepopup_selectionbox">
<input type="radio" name="radiogroup" class="radio" />
<input type="radio" name="basic_advanced" value="basic_mode" id="basic_mode" class="radio" checked />
<label class="label">
Basic Mode</label>
<div class="zonepopup_selectiondescriptionbox">
@ -129,29 +131,29 @@
</div>
<div class="zonepopup_selectiondescriptionbox_bot">
<p>
Some decription about Basic Mode will appear here.. Some decription about Basic Mode will appear here.. Some decription about Basic Mode will appear here.. Some decription about Basic Mode will appear here.. Some decription about Basic Mode will appear here.. Some decription about Basic Mode will appear here..</p>
Create VLAN when adding a pod
</p>
</div>
</div>
</div>
<div class="zonepopup_selectionbox">
<input type="radio" name="radiogroup" class="radio" />
<input type="radio" name="basic_advanced" value="advanced_mode" id="advanced_mode" class="radio" />
<label class="label">
Advance Mode</label>
Advanced Mode</label>
<div class="zonepopup_selectiondescriptionbox">
<div class="zonepopup_selectiondescriptionbox_top">
</div>
<div class="zonepopup_selectiondescriptionbox_bot">
<p>
Some decription about Advance Mode will appear here.. Some decription about Advance Mode will appear here.. Some decription about Advance Mode will appear here.. Some decription about Advance Mode will appear here.. Some decription about Advance Mode will appear here.. </p>
Create VLAN when add a zone
</p>
</div>
</div>
</div>
</div>
</div>
<div class="zonepopup_navigationpanel">
<div class="vmpop_prevbutton" id="prev_step" style="display: none;">
</div>
<div class="vmpop_nextbutton" id="next_step">
<div class="zonepopup_navigationpanel">
<div class="vmpop_nextbutton" id="go_to_step_2">
Go to Step 2</div>
</div>
</div>
@ -159,8 +161,9 @@
<div class="zonepopup_container_bot">
</div>
</div>
<!-- step 1 (end) -->
<!-- step 2 (begin) -->
<div id="step2" style="display: none;">
<div class="zonepopup_container_top">
<div class="vmpopup_steps" style="background: url(images/step1_bg_unselected.png) no-repeat top left">
@ -212,8 +215,8 @@
<input class="text" type="text" id="add_zone_internaldns2"/>
<div id="add_zone_internaldns2_errormsg" class="dialog_formcontent_errormsg" style="display:none;" ></div>
</li>
<li id="add_zone_container">
<label>Zone VLAN Range:</label>
<li id="add_zone_vlan_container">
<label>VLAN Range:</label>
<input class="text" style="width:92px" type="text" name="add_zone_startvlan" id="add_zone_startvlan"/><span>-</span>
<input class="text" style="width:92px" type="text" name="add_zone_endvlan" id="add_zone_endvlan"/>
<div id="add_zone_startvlan_errormsg" class="dialog_formcontent_errormsg" style="display:none;" ></div>
@ -245,10 +248,10 @@
</div>
</div>
<div class="zonepopup_navigationpanel">
<div class="vmpop_prevbutton" id="prev_step" style="display: block;">
<div class="vmpop_prevbutton" id="back_to_step_1" style="display: block;">
Back
</div>
<div class="vmpop_nextbutton" id="next_step">
<div class="vmpop_nextbutton" id="go_to_step_3">
Go to Step 3</div>
</div>
</div>
@ -256,9 +259,9 @@
<div class="zonepopup_container_bot">
</div>
</div>
<!-- step 2 (end) -->
<!-- step 3 (begin) -->
<div id="step3" style="display: none;">
<div class="zonepopup_container_top">
<div class="vmpopup_steps" style="background: url(images/step1_bg_unselected.png) no-repeat top left">
@ -308,7 +311,7 @@
</li>
<li>
<label for="user_name" style="width: 115px;">
Private IP Range:</label>
Reserved System IP:</label>
<input class="text" style="width: 92px" type="text" name="add_pod_startip" id="add_pod_startip" /><span>-</span>
<input class="text" style="width: 92px" type="text" name="add_pod_endip" id="add_pod_endip" />
<div id="add_pod_startip_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
@ -316,25 +319,44 @@
<div id="add_pod_endip_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li id="guestip_container">
<label style="width: 115px;">
Guest IP Range:</label>
<input class="text" style="width: 92px" type="text" id="startguestip" /><span>-</span>
<input class="text" style="width: 92px" type="text" id="endguestip" />
<div id="startguestip_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
<div id="endguestip_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li id="guestnetmask_container">
<label style="width: 115px;">
Guest Netmask:</label>
<input class="text" type="text" id="guestnetmask" />
<div id="guestnetmask_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
</ol>
</form>
</div>
</div>
<div class="zonepopup_navigationpanel">
<div class="vmpop_prevbutton" id="prev_step" style="display: block;">
Back
<div class="vmpop_prevbutton" id="back_to_step_2" style="display: block;">
Back
</div>
<div class="vmpop_nextbutton" id="submit_button">
Submit
</div>
<div class="vmpop_nextbutton" id="next_step">
Submit</div>
</div>
</div>
</div>
<div class="zonepopup_container_bot">
</div>
</div>
<!-- step 3 (end) -->
<div id="step4" style="display: none;">
<!-- after submit screen (begin) -->
<div id="after_submit_screen" style="display: none;">
<div class="zonepopup_container_top">
<div class="vmpopup_steps" style="background: url(images/step1_bg_unselected.png) no-repeat top left">
Step 1</div>
@ -351,25 +373,23 @@
<div class="zonepopup_maincontentarea">
<div class="zonepopup_contentpanel">
<div class="zonepoup_loadingbox" style="display:none;">
<div id="spinning_wheel" class="zonepoup_loadingbox" style="display:none;">
<div class="zonepoup_loader"></div>
<p> Adding Zone to Physical Resources</p>
<p> Adding zone and pod....</p>
</div>
<div class="zonepoup_msgbox"> Confirmation msg will appear here</div>
<div id="after_action_message" class="zonepoup_msgbox"></div>
</div>
<div class="zonepopup_navigationpanel">
<div class="vmpop_prevbutton" id="prev_step" style="display: block;">
Cancel
</div>
<div class="vmpop_nextbutton" id="next_step">
OK</div>
<div class="zonepopup_navigationpanel">
<div class="vmpop_nextbutton" id="close_button">
Close</div>
</div>
</div>
</div>
<div class="zonepopup_container_bot">
</div>
</div>
<!-- after submit screen (end) -->
</div>
<!-- Zone wizard (end)-->

View File

@ -252,83 +252,22 @@
<!-- Recurring Snapshots Dialog (begin) -->
<div id="dialog_recurring_snapshot" title="Recurring Snapshot" style="display:none;">
<div class="dialog_snapshotcontainer">
<div class="dialog_snapshotleft" id="dialog_snapshotleft">
<div class="dialog_snapshotleft_list">
<div class="dialog_snapshotleft_label">
Hourly:</div>
<div class="dialog_snapshotleft_info" id="dialog_snapshot_hourly_info_unset">
<p><i>&nbsp;Please click <b>'Edit'</b> to set your <b>hourly</b> recurring snapshot schedule</i></p>
</div>
<div class="dialog_snapshotleft_info" id="dialog_snapshot_hourly_info_set" style="display:none">
<span id="read_hourly_minute">mm</span></span><span> Minute(s) Past the Hour</span><span id="read_hourly_timezone"></span>
</div>
<div class="dialog_snapshotleft_max">
<p>Keeping:</p>
<span id="read_hourly_max">N/A</span></div>
<div class="dialog_snapshotleft_actions">
<a id="hourly_edit_link" href="#">Edit</a> | <a id="hourly_delete_link" href="#">&nbsp;Delete</a></div>
</div>
<div class="dialog_snapshotleft_list">
<div class="dialog_snapshotleft_label">
Daily:</div>
<div class="dialog_snapshotleft_info" id="dialog_snapshot_daily_info_unset">
<p><i>&nbsp;Please click <b>'Edit'</b> to set your <b>daily</b> recurring snapshot schedule</i></p>
</div>
<div class="dialog_snapshotleft_info" id="dialog_snapshot_daily_info_set" style="display:none">
<span id="read_daily_hour">hh</span><span>:</span><span id="read_daily_minute">mm</span>
<span id="read_daily_meridiem">AM</span><span id="read_daily_timezone"></span>
</div>
<div class="dialog_snapshotleft_max">
<p>
Keeping:</p>
<span id="read_daily_max">N/A</span></div>
<div class="dialog_snapshotleft_actions">
<a id="daily_edit_link" href="#">Edit</a> | <a id="daily_delete_link" href="#">&nbsp;Delete</a></div>
</div>
<div class="dialog_snapshotleft_list">
<div class="dialog_snapshotleft_label">
Weekly:</div>
<div class="dialog_snapshotleft_info" id="dialog_snapshot_weekly_info_unset">
<p><i>&nbsp;Please click <b>'Edit'</b> to set your <b>weekly</b> recurring snapshot schedule</i></p>
</div>
<div class="dialog_snapshotleft_info" id="dialog_snapshot_weekly_info_set" style="display:none">
<span id="read_weekly_hour">hh</span><span>:</span><span id="read_weekly_minute">mm</span>
<span id="read_weekly_meridiem">AM</span><span id="read_weekly_timezone"></span>
<span id="read_weekly_day_of_week">day-of-week</span>
</div>
<div class="dialog_snapshotleft_max">
<p>Keeping:</p>
<span id="read_weekly_max">N/A</span></div>
<div class="dialog_snapshotleft_actions">
<a id="weekly_edit_link" href="#">Edit</a> | <a id="weekly_delete_link" href="#">&nbsp;Delete</a></div>
</div>
<div class="dialog_snapshotleft_list">
<div class="dialog_snapshotleft_label">
Monthly:</div>
<div class="dialog_snapshotleft_info" id="dialog_snapshot_monthly_info_unset">
<p><i>&nbsp;Please click <b>'Edit'</b> to set your <b>monthly</b> recurring snapshot schedule</i></p>
</div>
<div class="dialog_snapshotleft_info" id="dialog_snapshot_monthly_info_set" style="display:none">
<span id="read_monthly_hour">hh</span><span>:</span><span id="read_monthly_minute">mm</span>
<span id="read_monthly_meridiem">AM</span><span id="read_monthly_timezone"></span>
<span id="read_monthly_day_of_month">day-of-month</span>
</div>
<div class="dialog_snapshotleft_max">
<p>Keeping:</p>
<span id="read_monthly_max">N/A</span></div>
<div class="dialog_snapshotleft_actions">
<a id="monthly_edit_link" href="#">Edit</a> | <a id="monthly_delete_link" href="#">&nbsp;Delete</a></div>
</div>
</div>
<div class="dialog_snapshotleft" id="dialog_snapshotleft" >
<p>Your snapshot schedule is currently set to:<br/><br/></p>
</div>
<div class="dialog_snapshotright" id="dialog_snapshotright">
<div class="dialog_snapshotright_infotext" style="display:none"> Cick Edit to Schedule</div>
<div class="dialog_snapshots_editcontent" style="display:block;">
<div class="dialog_snapshots_editcontent_title">
<p>&nbsp;Edit:</p>
<span id="edit_interval_type" style="text-decoration:underline">Interval Type</span>
<div class="dialog_snapshotleft_label" style="width:120px">&nbsp;Snapshot Schedule: &nbsp;&nbsp;</div>
<select class="snapselect" id="snapshot_interval">
<option value="-1">Disabled</option>
<option value="0">Hourly</option>
<option value="1">Weekly</option>
<option value="2">Daily</option>
<option value="3">Monthly</option>
</select>
</div>
<div class="dialog_formcontent">
<div class="dialog_formcontent" id="snapshot_form">
<form action="#" method="post" id="form4">
<ol>
<li>
@ -338,7 +277,6 @@
<span id="edit_hour_container">
<select class="snapselect" id="edit_hour">
<option value="00">00</option>
<option value="01">01</option>
<option value="02">02</option>
<option value="03">03</option>
@ -349,7 +287,8 @@
<option value="08">08</option>
<option value="09">09</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="11">11</option>
<option value="00">12</option>
</select>
</span>
@ -549,7 +488,6 @@
<div id="edit_max_errormsg" class="dialog_formcontent_errormsg" style="display:none;"></div>
</li>
</ol>
<input class="ui-state-default" type="submit" id="apply_button" value="Apply Schedule" style="background-color:Yellow; width: 150px; height:20px; margin:15px 0 0 0;"/>
</form>
</div>
</div>

View File

@ -1013,6 +1013,13 @@ function handleErrorInDialog(XMLHttpResponse, $thisDialog) {
$infoContainer.show();
}
function parseXMLHttpResponse(XMLHttpResponse) {
var start = XMLHttpResponse.responseText.indexOf("h1") + 3;
var end = XMLHttpResponse.responseText.indexOf("</h1");
var errorMsg = XMLHttpResponse.responseText.substring(start, end);
return fromdb(errorMsg);
}
function showLeftNavigationBasedOnRole() {
if (isAdmin()) {
$("#leftmenu_domain, #leftmenu_account, #leftmenu_system, #leftmenu_resources, #leftmenu_alert_container, #launch_test").show();

View File

@ -175,7 +175,10 @@ function initAddHostButton($midmenuAddLink1, currentPageInRightPanel) {
var isValid = true;
isValid &= validateString("Host name", $thisDialog.find("#host_hostname"), $thisDialog.find("#host_hostname_errormsg"));
isValid &= validateString("User name", $thisDialog.find("#host_username"), $thisDialog.find("#host_username_errormsg"));
isValid &= validateString("Password", $thisDialog.find("#host_password"), $thisDialog.find("#host_password_errormsg"));
isValid &= validateString("Password", $thisDialog.find("#host_password"), $thisDialog.find("#host_password_errormsg"));
if(clusterRadio == "new_cluster_radio") {
isValid &= validateString("Cluster Name", $thisDialog.find("#new_cluster_name"), $thisDialog.find("#new_cluster_name_errormsg"));
}
if (!isValid)
return;

View File

@ -86,14 +86,15 @@ function primarystorageJsonToDetailsTab($midmenuItem1) {
buildActionLinkForTab("Delete Primary Storage", primarystorageActionMap, $actionMenu, $midmenuItem1, $detailsTab);
}
function primarystorageClearRigntPanel() {
primarystorageJsonClearDetailsTab(jsonObj);
function primarystorageClearRightPanel() {
primarystorageJsonClearDetailsTab();
}
function primarystorageJsonClearDetailsTab() {
var $detailsTab = $("#tab_content_details");
$detailsTab.find("#id").text("");
$detailsTab.find("#name").text("");
$detailsTab.find("#name").text("");
$detailsTab.find("#state").text("");
$detailsTab.find("#zonename").text("");
$detailsTab.find("#podname").text("");
$detailsTab.find("#clustername").text("");

View File

@ -249,8 +249,12 @@ function afterLoadResourceJSP($midmenuItem1) {
initAddZoneButton($("#midmenu_add_link"));
initUpdateConsoleCertButton($("#midmenu_add2_link"));
initDialog("dialog_add_zone");
initDialog("dialog_update_cert", 450);
initDialog("dialog_update_cert", 450);
resourceCountTotal();
initAddZoneShortcut();
}
function resourceCountTotal() {
$.ajax({
data: createURL("command=listZones&available=true"),
dataType: "json",
@ -295,7 +299,317 @@ function afterLoadResourceJSP($midmenuItem1) {
$("#primarystorage_total").text(items.length.toString());
}
}
});
});
}
function refreshAddZoneWizard() {
var $addZoneWizard = $("#add_zone_wizard");
$addZoneWizard.find("#step2, #step3, #after_submit_screen").hide();
$addZoneWizard.find("#step1").show();
$addZoneWizard.find("#basic_mode").click();
}
function openAddZoneWizard() {
refreshAddZoneWizard();
$("#add_zone_wizard").show();
$("#wizard_overlay").show();
}
function closeAddZoneWizard() {
$("#add_zone_wizard").hide();
$("#wizard_overlay").hide();
}
function initAddZoneShortcut() {
var $addZoneWizard = $("#add_zone_wizard");
$addZoneWizard.find("#add_zone_public").unbind("change").bind("change", function(event) {
if($(this).val() == "true") { //public zone
$addZoneWizard.find("#domain_dropdown_container").hide();
}
else { //private zone
$addZoneWizard.find("#domain_dropdown_container").show();
}
return false;
});
var domainDropdown = $addZoneWizard.find("#domain_dropdown").empty();
$.ajax({
data: createURL("command=listDomains"+maxPageSize),
dataType: "json",
async: false,
success: function(json) {
var domains = json.listdomainsresponse.domain;
if (domains != null && domains.length > 0) {
for (var i = 0; i < domains.length; i++) {
domainDropdown.append("<option value='" + domains[i].id + "'>" + fromdb(domains[i].name) + "</option>");
}
}
}
});
$("#add_zone_shortcut").unbind("click").bind("click", function(event) {
/*
if($("#leftmenu_physical_resource").find("#physical_resource_arrow").hasClass("expanded_close") == true)
$("#leftmenu_physical_resource").click(); //if Physical Resource arrow shows closed (i.e. zonetree is hidden), expand and show zonetree.
*/
//$addZoneWizard.find("#info_container").hide();
openAddZoneWizard();
return false;
});
$addZoneWizard.unbind("click").bind("click", function(event) {
var $thisWizard = $(this);
var $target = $(event.target);
switch($target.attr("id")) {
case "close_button":
closeAddZoneWizard();
break;
case "basic_mode": //create VLAN in pod-level
//hide Zone VLAN Range in Add Zone(step 2), show Guest IP Range in Add Pod(step3)
$thisWizard.find("#step2").find("#add_zone_vlan_container").hide();
$thisWizard.find("#step3").find("#guestip_container, #guestnetmask_container").show();
return true;
break;
case "advanced_mode": //create VLAN in zone-level
//show Zone VLAN Range in Add Zone(step 2), hide Guest IP Range in Add Pod(step3)
$thisWizard.find("#step2").find("#add_zone_vlan_container").show();
$thisWizard.find("#step3").find("#guestip_container, #guestnetmask_container").hide();
return true;
break;
case "go_to_step_2": //step 1 => step 2
$thisWizard.find("#step1").hide();
$thisWizard.find("#step2").show();
break;
case "go_to_step_3": //step 2 => step 3
var isValid = addZoneWizardValidateZond($thisWizard);
if (!isValid)
return;
$thisWizard.find("#step2").hide();
$thisWizard.find("#step3").show();
break;
case "back_to_step_2": //step 3 => step 2
$thisWizard.find("#step3").hide();
$thisWizard.find("#step2").show();
break;
case "back_to_step_1": //step 2 => step 1
$thisWizard.find("#step2").hide();
$thisWizard.find("#step1").show();
break;
case "submit_button": //step 3 => make API call
var isValid = addZoneWizardValidatePod($thisWizard);
if($thisWizard.find("#step3").find("#guestip_container").css("display") != "none")
isValid &= addZoneWizardValidateGuestIPRange($thisWizard);
if (!isValid)
return;
$thisWizard.find("#step3").hide();
$thisWizard.find("#after_submit_screen").show();
addZoneWizardSubmit($thisWizard);
break;
}
return false;
});
}
function addZoneWizardValidateZond($thisWizard) {
var isValid = true;
isValid &= validateString("Name", $thisWizard.find("#add_zone_name"), $thisWizard.find("#add_zone_name_errormsg"));
isValid &= validateIp("DNS 1", $thisWizard.find("#add_zone_dns1"), $thisWizard.find("#add_zone_dns1_errormsg"), false); //required
isValid &= validateIp("DNS 2", $thisWizard.find("#add_zone_dns2"), $thisWizard.find("#add_zone_dns2_errormsg"), true); //optional
isValid &= validateIp("Internal DNS 1", $thisWizard.find("#add_zone_internaldns1"), $thisWizard.find("#add_zone_internaldns1_errormsg"), false); //required
isValid &= validateIp("Internal DNS 2", $thisWizard.find("#add_zone_internaldns2"), $thisWizard.find("#add_zone_internaldns2_errormsg"), true); //optional
if($thisWizard.find("#step2").find("#add_zone_vlan_container").css("display") != "none") {
isValid &= validateString("VLAN Range", $thisWizard.find("#add_zone_startvlan"), $thisWizard.find("#add_zone_startvlan_errormsg"), false); //required
isValid &= validateString("VLAN Range", $thisWizard.find("#add_zone_endvlan"), $thisWizard.find("#add_zone_endvlan_errormsg"), true); //optional
}
isValid &= validateCIDR("Guest CIDR", $thisWizard.find("#add_zone_guestcidraddress"), $thisWizard.find("#add_zone_guestcidraddress_errormsg"), false); //required
return isValid;
}
function addZoneWizardValidatePod($thisWizard) {
var isValid = true;
isValid &= validateString("Name", $thisWizard.find("#add_pod_name"), $thisWizard.find("#add_pod_name_errormsg"));
isValid &= validateCIDR("CIDR", $thisWizard.find("#add_pod_cidr"), $thisWizard.find("#add_pod_cidr_errormsg"));
isValid &= validateIp("Reserved System IP", $thisWizard.find("#add_pod_startip"), $thisWizard.find("#add_pod_startip_errormsg")); //required
isValid &= validateIp("Reserved System IP", $thisWizard.find("#add_pod_endip"), $thisWizard.find("#add_pod_endip_errormsg"), true); //optional
return isValid;
}
function addZoneWizardValidateGuestIPRange($thisWizard) {
var isValid = true;
isValid &= validateIp("Guest IP Range", $thisWizard.find("#startguestip"), $thisWizard.find("#startguestip_errormsg")); //required
isValid &= validateIp("Guest IP Range", $thisWizard.find("#endguestip"), $thisWizard.find("#endguestip_errormsg"), true); //optional
isValid &= validateIp("Guest Gateway", $thisWizard.find("#guestnetmask"), $thisWizard.find("#guestnetmask_errormsg")); //required when creating
return isValid;
}
function addZoneWizardSubmit($thisWizard) {
$thisWizard.find("#spinning_wheel").show();
var moreCriteria = [];
var name = trim($thisWizard.find("#add_zone_name").val());
moreCriteria.push("&name="+todb(name));
var dns1 = trim($thisWizard.find("#add_zone_dns1").val());
moreCriteria.push("&dns1="+encodeURIComponent(dns1));
var dns2 = trim($thisWizard.find("#add_zone_dns2").val());
if (dns2 != null && dns2.length > 0)
moreCriteria.push("&dns2="+encodeURIComponent(dns2));
var internaldns1 = trim($thisWizard.find("#add_zone_internaldns1").val());
moreCriteria.push("&internaldns1="+encodeURIComponent(internaldns1));
var internaldns2 = trim($thisWizard.find("#add_zone_internaldns2").val());
if (internaldns2 != null && internaldns2.length > 0)
moreCriteria.push("&internaldns2="+encodeURIComponent(internaldns2));
if($thisWizard.find("#step2").find("#add_zone_vlan_container").css("display") != "none") {
var vlanStart = trim($thisWizard.find("#add_zone_startvlan").val());
var vlanEnd = trim($thisWizard.find("#add_zone_endvlan").val());
if (vlanEnd != null && vlanEnd.length > 0)
moreCriteria.push("&vlan=" + encodeURIComponent(vlanStart + "-" + vlanEnd));
else
moreCriteria.push("&vlan=" + encodeURIComponent(vlanStart));
}
else {
moreCriteria.push("&vlan=30"); //temporary hacking before bug 7143 is fixed ("VLAN parameter in CreateZone shouldn't be required")
}
var guestcidraddress = trim($thisWizard.find("#add_zone_guestcidraddress").val());
moreCriteria.push("&guestcidraddress="+encodeURIComponent(guestcidraddress));
if($thisWizard.find("#domain_dropdown_container").css("display") != "none") {
var domainId = trim($thisWizard.find("#domain_dropdown").val());
moreCriteria.push("&domainid="+domainId);
}
var zoneId, podId, vlanId, $zoneNode, $podNode, gateway;
var afterActionMsg = "";
$.ajax({
data: createURL("command=createZone"+moreCriteria.join("")),
dataType: "json",
async: false,
success: function(json) {
afterActionMsg += "Zone was created successfully<br>";
$thisWizard.find("#spinning_wheel").hide();
$zoneNode = $("#leftmenu_zone_node_template").clone(true);
var $zoneTree = $("#leftmenu_zone_tree").find("#tree_container");
$zoneTree.prepend($zoneNode);
$zoneNode.fadeIn("slow");
var item = json.createzoneresponse.zone;
zoneJSONToTreeNode(item, $zoneNode);
zoneId = item.id;
},
error: function(XMLHttpResponse) {
handleError(XMLHttpResponse, function() {
afterActionMsg += ("Failed to create zone. " + parseXMLHttpResponse(XMLHttpResponse) + "<br>");
$thisWizard.find("#spinning_wheel").hide();
});
}
});
if(zoneId != null) {
var name = trim($thisWizard.find("#add_pod_name").val());
var cidr = trim($thisWizard.find("#add_pod_cidr").val());
var startip = trim($thisWizard.find("#add_pod_startip").val());
var endip = trim($thisWizard.find("#add_pod_endip").val()); //optional
gateway = trim($thisWizard.find("#add_pod_gateway").val());
var array1 = [];
array1.push("&zoneId="+zoneId);
array1.push("&name="+todb(name));
array1.push("&cidr="+encodeURIComponent(cidr));
array1.push("&startIp="+encodeURIComponent(startip));
if (endip != null && endip.length > 0)
array1.push("&endIp="+encodeURIComponent(endip));
array1.push("&gateway="+encodeURIComponent(gateway));
$.ajax({
data: createURL("command=createPod"+array1.join("")),
dataType: "json",
async: false,
success: function(json) {
afterActionMsg += "Pod was created successfully<br>";
$thisWizard.find("#spinning_wheel").hide();
var item = json.createpodresponse.pod;
podId = item.id;
$podNode = $("#leftmenu_pod_node_template").clone(true);
podJSONToTreeNode(item, $podNode);
$zoneNode.find("#zone_content").show();
$zoneNode.find("#pods_container").prepend($podNode.show());
$zoneNode.find("#zone_arrow").removeClass("white_nonexpanded_close").addClass("expanded_open");
$podNode.fadeIn("slow");
forceLogout = false; // We don't force a logout if pod(s) exit.
if (forceLogout) {
$("#dialog_confirmation")
.html("<p>You have successfully added your first Zone and Pod. After clicking 'OK', this UI will automatically refresh to give you access to the rest of cloud features.</p>")
.dialog('option', 'buttons', {
"OK": function() {
window.location.reload();
}
}).dialog("open");
}
},
error: function(XMLHttpResponse) {
handleError(XMLHttpResponse, function() {
afterActionMsg += ("Failed to create Pod. " + parseXMLHttpResponse(XMLHttpResponse) + "<br>");
$thisWizard.find("#spinning_wheel").hide();
});
}
});
}
if(podId != null && $thisWizard.find("#step3").find("#guestip_container").css("display") != "none") {
var netmask = $thisWizard.find("#step3").find("#guestnetmask").val();
var startip = $thisWizard.find("#step3").find("#startguestip").val();
var endip = $thisWizard.find("#step3").find("#endguestip").val();
var array1 = [];
array1.push("&vlan=untagged");
array1.push("&zoneid=" + zoneId);
array1.push("&podId=" + podId);
array1.push("&forVirtualNetwork=false"); //direct VLAN
array1.push("&gateway="+encodeURIComponent(gateway));
array1.push("&netmask="+encodeURIComponent(netmask));
array1.push("&startip="+encodeURIComponent(startip));
if(endip != null && endip.length > 0)
array1.push("&endip="+encodeURIComponent(endip));
$.ajax({
data: createURL("command=createVlanIpRange" + array1.join("")),
dataType: "json",
success: function(json) {
afterActionMsg += "Guest IP range was created successfully<br>";
var item = json.createvlaniprangeresponse.vlan;
vlanId = item.id;
},
error: function(XMLHttpResponse) {
handleError(XMLHttpResponse, function() {
afterActionMsg += ("Failed to create Guest IP range. " + parseXMLHttpResponse(XMLHttpResponse) + "<br>");
$thisWizard.find("#spinning_wheel").hide();
});
}
});
}
$thisWizard.find("#after_action_message").html(afterActionMsg);
}
function initUpdateConsoleCertButton($midMenuAddLink2) {
@ -375,20 +689,22 @@ function initUpdateConsoleCertButton($midMenuAddLink2) {
function initAddZoneButton($midmenuAddLink1) {
$midmenuAddLink1.find("#label").text("Add Zone");
$midmenuAddLink1.show();
var $dialogAddZone = $("#dialog_add_zone");
$dialogAddZone.find("#add_zone_public").unbind("change").bind("change", function(event) {
$midmenuAddLink1.show();
initAddZoneDialog($("#dialog_add_zone"), $midmenuAddLink1);
}
function initAddZoneDialog($addZoneDialog, $addZoneLink) {
$addZoneDialog.find("#add_zone_public").unbind("change").bind("change", function(event) {
if($(this).val() == "true") { //public zone
$dialogAddZone.find("#domain_dropdown_container").hide();
$addZoneDialog.find("#domain_dropdown_container").hide();
}
else { //private zone
$dialogAddZone.find("#domain_dropdown_container").show();
$addZoneDialog.find("#domain_dropdown_container").show();
}
return false;
});
var domainDropdown = $dialogAddZone.find("#domain_dropdown").empty();
var domainDropdown = $addZoneDialog.find("#domain_dropdown").empty();
$.ajax({
data: createURL("command=listDomains"+maxPageSize),
dataType: "json",
@ -403,13 +719,13 @@ function initAddZoneButton($midmenuAddLink1) {
}
});
$midmenuAddLink1.unbind("click").bind("click", function(event) {
$addZoneLink.unbind("click").bind("click", function(event) {
if($("#leftmenu_physical_resource").find("#physical_resource_arrow").hasClass("expanded_close") == true)
$("#leftmenu_physical_resource").click(); //if Physical Resource arrow shows closed (i.e. zonetree is hidden), expand and show zonetree.
$("#dialog_add_zone").find("#info_container").hide();
$addZoneDialog.find("#info_container").hide();
$("#dialog_add_zone")
$addZoneDialog
.dialog('option', 'buttons', {
"Add": function() {
var $thisDialog = $(this);

View File

@ -19,7 +19,7 @@
function afterLoadVolumeJSP() {
initDialog("dialog_create_template", 400);
initDialog("dialog_create_snapshot");
initDialog("dialog_recurring_snapshot", 735);
initDialog("dialog_recurring_snapshot", 420);
initDialog("dialog_add_volume");
initDialog("dialog_attach_volume");
initDialog("dialog_add_volume_from_snapshot");
@ -173,216 +173,109 @@ function afterLoadVolumeJSP() {
return false;
});
// *** recurring snapshot dialog - event binding (begin) ******************************
$("#dialog_recurring_snapshot").bind("click", function(event) {
event.preventDefault();
event.stopPropagation();
var target = event.target;
var targetId = target.id;
var thisDialog = $(this);
var volumeId = thisDialog.data("volumeId");
var topPanel = thisDialog.find("#dialog_snapshotleft");
var bottomPanel = thisDialog.find("#dialog_snapshotright");
if(targetId.indexOf("_edit_link")!=-1) {
clearBottomPanel();
bottomPanel.animate({
height: 200
}, 1000, function() {}
);
}
else if(targetId.indexOf("_delete_link")!=-1) {
clearBottomPanel();
var snapshotPolicyId = $("#"+targetId).data("snapshotPolicyId");
if(snapshotPolicyId == null || snapshotPolicyId.length==0)
return;
$.ajax({
data: createURL("command=deleteSnapshotPolicies&id="+snapshotPolicyId),
dataType: "json",
success: function(json) {
clearTopPanel($("#"+targetId).data("intervalType"));
},
error: function(XMLHttpResponse) {
handleError(XMLHttpResponse);
}
});
}
var thisLink;
switch(targetId) {
case "hourly_edit_link":
$("#edit_interval_type").text("Hourly");
$("#edit_time_colon, #edit_hour_container, #edit_meridiem_container, #edit_day_of_week_container, #edit_day_of_month_container").hide();
$("#edit_past_the_hour, #edit_minute_container").show();
thisLink = thisDialog.find("#hourly_edit_link");
thisDialog.find("#edit_minute").val(thisLink.data("minute"));
thisDialog.find("#edit_max").val(thisLink.data("max"));
thisDialog.find("#edit_timezone").val(thisLink.data("timezone"));
break;
case "daily_edit_link":
$("#edit_interval_type").text("Daily");
$("#edit_past_the_hour, #edit_day_of_week_container, #edit_day_of_month_container").hide();
$("#edit_minute_container, #edit_hour_container, #edit_meridiem_container").show();
thisLink = thisDialog.find("#daily_edit_link");
thisDialog.find("#edit_minute").val(thisLink.data("minute"));
thisDialog.find("#edit_hour").val(thisLink.data("hour12"));
thisDialog.find("#edit_meridiem").val(thisLink.data("meridiem"));
thisDialog.find("#edit_max").val(thisLink.data("max"));
thisDialog.find("#edit_timezone").val(thisLink.data("timezone"));
break;
case "weekly_edit_link":
$("#edit_interval_type").text("Weekly");
$("#edit_past_the_hour, #edit_day_of_month_container").hide();
$("#edit_minute_container, #edit_hour_container, #edit_meridiem_container, #edit_day_of_week_container").show();
thisLink = thisDialog.find("#weekly_edit_link");
thisDialog.find("#edit_minute").val(thisLink.data("minute"));
thisDialog.find("#edit_hour").val(thisLink.data("hour12"));
thisDialog.find("#edit_meridiem").val(thisLink.data("meridiem"));
thisDialog.find("#edit_day_of_week").val(thisLink.data("dayOfWeek"));
thisDialog.find("#edit_max").val(thisLink.data("max"));
thisDialog.find("#edit_timezone").val(thisLink.data("timezone"));
break;
case "monthly_edit_link":
$("#edit_interval_type").text("Monthly");
$("#edit_past_the_hour, #edit_day_of_week_container").hide();
$("#edit_minute_container, #edit_hour_container, #edit_meridiem_container, #edit_day_of_month_container").show();
thisLink = thisDialog.find("#monthly_edit_link");
thisDialog.find("#edit_minute").val(thisLink.data("minute"));
thisDialog.find("#edit_hour").val(thisLink.data("hour12"));
thisDialog.find("#edit_meridiem").val(thisLink.data("meridiem"));
thisDialog.find("#edit_day_of_month").val(thisLink.data("dayOfMonth"));
thisDialog.find("#edit_max").val(thisLink.data("max"));
thisDialog.find("#edit_timezone").val(thisLink.data("timezone"));
break;
case "apply_button":
var intervalType = bottomPanel.find("#edit_interval_type").text().toLowerCase();
var minute, hour12, hour24, meridiem, dayOfWeek, dayOfWeekString, dayOfMonth, schedule, max, timezone;
switch(intervalType) {
case "hourly":
var isValid = true;
isValid &= validateNumber("Keep # of snapshots", bottomPanel.find("#edit_max"), bottomPanel.find("#edit_max_errormsg"));
if (!isValid) return;
minute = bottomPanel.find("#edit_minute").val();
schedule = minute;
max = bottomPanel.find("#edit_max").val();
timezone = bottomPanel.find("#edit_timezone").val();
break;
case "daily":
var isValid = true;
isValid &= validateNumber("Keep # of snapshots", bottomPanel.find("#edit_max"), bottomPanel.find("#edit_max_errormsg"));
if (!isValid) return;
minute = bottomPanel.find("#edit_minute").val();
hour12 = bottomPanel.find("#edit_hour").val();
meridiem = bottomPanel.find("#edit_meridiem").val();
if(meridiem=="AM")
hour24 = hour12;
else //meridiem=="PM"
hour24 = (parseInt(hour12)+12).toString();
schedule = minute + ":" + hour24;
max = bottomPanel.find("#edit_max").val();
timezone = bottomPanel.find("#edit_timezone").val();
break;
case "weekly":
var isValid = true;
isValid &= validateNumber("Keep # of snapshots", bottomPanel.find("#edit_max"), bottomPanel.find("#edit_max_errormsg"));
if (!isValid) return;
minute = bottomPanel.find("#edit_minute").val();
hour12 = bottomPanel.find("#edit_hour").val();
meridiem = bottomPanel.find("#edit_meridiem").val();
if(meridiem=="AM")
hour24 = hour12;
else //meridiem=="PM"
hour24 = (parseInt(hour12)+12).toString();
dayOfWeek = bottomPanel.find("#edit_day_of_week").val();
dayOfWeekString = bottomPanel.find("#edit_day_of_week option:selected").text();
schedule = minute + ":" + hour24 + ":" + dayOfWeek;
max = bottomPanel.find("#edit_max").val();
timezone = bottomPanel.find("#edit_timezone").val();
break;
case "monthly":
var isValid = true;
isValid &= validateNumber("Keep # of snapshots", bottomPanel.find("#edit_max"), bottomPanel.find("#edit_max_errormsg"));
if (!isValid) return;
minute = bottomPanel.find("#edit_minute").val();
hour12 = bottomPanel.find("#edit_hour").val();
meridiem = bottomPanel.find("#edit_meridiem").val();
if(meridiem=="AM")
hour24 = hour12;
else //meridiem=="PM"
hour24 = (parseInt(hour12)+12).toString();
dayOfMonth = bottomPanel.find("#edit_day_of_month").val();
schedule = minute + ":" + hour24 + ":" + dayOfMonth;
max = bottomPanel.find("#edit_max").val();
timezone = bottomPanel.find("#edit_timezone").val();
break;
}
var thisLink;
$.ajax({
data: createURL("command=createSnapshotPolicy&intervaltype="+intervalType+"&schedule="+schedule+"&volumeid="+volumeId+"&maxsnaps="+max+"&timezone="+encodeURIComponent(timezone)),
dataType: "json",
success: function(json) {
switch(intervalType) {
case "hourly":
topPanel.find("#dialog_snapshot_hourly_info_unset").hide();
topPanel.find("#dialog_snapshot_hourly_info_set").show();
topPanel.find("#read_hourly_minute").text(minute);
topPanel.find("#read_hourly_timezone").text("("+timezones[timezone]+")");
topPanel.find("#read_hourly_max").text(max);
topPanel.find("#hourly_edit_link, #hourly_delete_link").data("intervalType", "hourly").data("snapshotPolicyId", json.createsnapshotpolicyresponse.snapshotpolicy.id).data("max",max).data("timezone",timezone).data("minute", minute);
break;
case "daily":
topPanel.find("#dialog_snapshot_daily_info_unset").hide();
topPanel.find("#dialog_snapshot_daily_info_set").show();
topPanel.find("#read_daily_minute").text(minute);
topPanel.find("#read_daily_hour").text(hour12);
topPanel.find("#read_daily_meridiem").text(meridiem);
topPanel.find("#read_daily_timezone").text("("+timezones[timezone]+")");
topPanel.find("#read_daily_max").text(max);
topPanel.find("#daily_edit_link, #daily_delete_link").data("intervalType", "daily").data("snapshotPolicyId", json.createsnapshotpolicyresponse.snapshotpolicy.id).data("max",max).data("timezone",timezone).data("minute", minute).data("hour12", hour12).data("meridiem", meridiem);
break;
case "weekly":
topPanel.find("#dialog_snapshot_weekly_info_unset").hide();
topPanel.find("#dialog_snapshot_weekly_info_set").show();
topPanel.find("#read_weekly_minute").text(minute);
topPanel.find("#read_weekly_hour").text(hour12);
topPanel.find("#read_weekly_meridiem").text(meridiem);
topPanel.find("#read_weekly_timezone").text("("+timezones[timezone]+")");
topPanel.find("#read_weekly_day_of_week").text(dayOfWeekString);
topPanel.find("#read_weekly_max").text(max);
topPanel.find("#weekly_edit_link, #weekly_delete_link").data("intervalType", "weekly").data("snapshotPolicyId", json.createsnapshotpolicyresponse.snapshotpolicy.id).data("max",max).data("timezone",timezone).data("minute", minute).data("hour12", hour12).data("meridiem", meridiem).data("dayOfWeek",dayOfWeek);
break;
case "monthly":
topPanel.find("#dialog_snapshot_monthly_info_unset").hide();
topPanel.find("#dialog_snapshot_monthly_info_set").show();
topPanel.find("#read_monthly_minute").text(minute);
topPanel.find("#read_monthly_hour").text(hour12);
topPanel.find("#read_monthly_meridiem").text(meridiem);
topPanel.find("#read_monthly_timezone").text("("+timezones[timezone]+")");
topPanel.find("#read_monthly_day_of_month").text(toDayOfMonthDesp(dayOfMonth));
topPanel.find("#read_monthly_max").text(max);
topPanel.find("#monthly_edit_link, #monthly_delete_link").data("intervalType", "monthly").data("snapshotPolicyId", json.createsnapshotpolicyresponse.snapshotpolicy.id).data("max",max).data("timezone",timezone).data("minute", minute).data("hour12", hour12).data("meridiem", meridiem).data("dayOfMonth",dayOfMonth);
break;
}
},
error: function(XMLHttpResponse) {
handleError(XMLHttpResponse);
}
});
break;
}
});
$("#snapshot_interval").change(function(event) {
var thisElement = $(this);
var snapshotInterval = thisElement.val();
var jsonObj = thisElement.data("jsonObj");
var $dialog = $("#dialog_recurring_snapshot");
switch (snapshotInterval) {
case "-1":
$dialog.find("#snapshot_form").hide();
break;
case "0":
$dialog.find("#edit_time_colon, #edit_hour_container, #edit_meridiem_container, #edit_day_of_week_container, #edit_day_of_month_container").hide();
$dialog.find("#edit_past_the_hour, #edit_minute_container").show();
if (jsonObj != null) {
$dialog.find("#edit_minute").val(jsonObj.schedule);
$dialog.find("#edit_max").val(jsonObj.maxsnaps);
$dialog.find("#edit_timezone").val(jsonObj.timezone);
}
$dialog.find("#snapshot_form").show();
break;
case "1":
$dialog.find("#edit_past_the_hour, #edit_day_of_week_container, #edit_day_of_month_container").hide();
$dialog.find("#edit_minute_container, #edit_hour_container, #edit_meridiem_container").show();
if (jsonObj != null) {
var parts = jsonObj.schedule.split(":");
var hour12, meridiem;
var hour24 = parts[1];
if(hour24 < 12) {
hour12 = hour24;
meridiem = "AM";
}
else {
hour12 = hour24 - 12;
meridiem = "PM"
}
if (hour12 < 10 && hour12.toString().length==1)
hour12 = "0"+hour12.toString();
$dialog.find("#edit_minute").val(parts[0]);
$dialog.find("#edit_hour").val(hour12);
$dialog.find("#edit_meridiem").val(meridiem);
$dialog.find("#edit_max").val(jsonObj.maxsnaps);
$dialog.find("#edit_timezone").val(jsonObj.timezone);
}
$dialog.find("#snapshot_form").show();
break;
case "2":
$dialog.find("#edit_past_the_hour, #edit_day_of_month_container").hide();
$dialog.find("#edit_minute_container, #edit_hour_container, #edit_meridiem_container, #edit_day_of_week_container").show();
if (jsonObj != null) {
var parts = jsonObj.schedule.split(":");
var hour12, meridiem;
var hour24 = parts[1];
if(hour24 < 12) {
hour12 = hour24;
meridiem = "AM";
}
else {
hour12 = hour24 - 12;
meridiem = "PM"
}
if (hour12 < 10 && hour12.toString().length==1)
hour12 = "0"+hour12.toString();
$dialog.find("#edit_minute").val(parts[0]);
$dialog.find("#edit_hour").val(hour12);
$dialog.find("#edit_meridiem").val(meridiem);
$dialog.find("#edit_day_of_week").val(parts[2]);
$dialog.find("#edit_max").val(jsonObj.maxsnaps);
$dialog.find("#edit_timezone").val(jsonObj.timezone);
}
$dialog.find("#snapshot_form").show();
break;
case "3":
$dialog.find("#edit_past_the_hour, #edit_day_of_week_container").hide();
$dialog.find("#edit_minute_container, #edit_hour_container, #edit_meridiem_container, #edit_day_of_month_container").show();
if (jsonObj != null) {
var parts = jsonObj.schedule.split(":");
var hour12, meridiem;
var hour24 = parts[1];
if(hour24 < 12) {
hour12 = hour24;
meridiem = "AM";
}
else {
hour12 = hour24 - 12;
meridiem = "PM"
}
if (hour12 < 10 && hour12.toString().length==1)
hour12 = "0"+hour12.toString();
$dialog.find("#edit_minute").val(parts[0]);
$dialog.find("#edit_hour").val(hour12);
$dialog.find("#edit_meridiem").val(meridiem);
$dialog.find("#edit_day_of_month").val(parts[2]);
$dialog.find("#edit_max").val(jsonObj.maxsnaps);
$dialog.find("#edit_timezone").val(jsonObj.timezone);
}
$dialog.find("#snapshot_form").show();
break;
}
});
// *** recurring snapshot dialog - event binding (end) ******************************
//***** switch between different tabs (begin) ********************************************************************
@ -721,106 +614,146 @@ function doRecurringSnapshot($actionLink, $detailsTab, $midmenuItem1) {
dataType: "json",
async: false,
success: function(json) {
var items = json.listsnapshotpoliciesresponse.snapshotpolicy;
if(items!=null && items.length>0) {
for(var i=0; i<items.length; i++) {
var item = items[i];
switch(item.intervaltype) {
case "0": //hourly
dialogBox.find("#dialog_snapshot_hourly_info_unset").hide();
dialogBox.find("#dialog_snapshot_hourly_info_set").show();
dialogBox.find("#read_hourly_max").text(item.maxsnaps);
dialogBox.find("#read_hourly_minute").text(item.schedule);
dialogBox.find("#read_hourly_timezone").text("("+timezones[item.timezone]+")");
dialogBox.find("#hourly_edit_link, #hourly_delete_link").data("intervalType", "hourly").data("snapshotPolicyId", item.id).data("max",item.maxsnaps).data("timezone",item.timezone).data("minute", item.schedule);
break;
case "1": //daily
dialogBox.find("#dialog_snapshot_daily_info_unset").hide();
dialogBox.find("#dialog_snapshot_daily_info_set").show();
dialogBox.find("#read_daily_max").text(item.maxsnaps);
var parts = item.schedule.split(":");
dialogBox.find("#read_daily_minute").text(parts[0]);
var hour12, meridiem;
var hour24 = parts[1];
if(hour24 < 12) {
hour12 = hour24;
meridiem = "AM";
}
else {
hour12 = hour24 - 12;
meridiem = "PM"
}
if (hour12 < 10 && hour12.toString().length==1)
hour12 = "0"+hour12.toString();
dialogBox.find("#read_daily_hour").text(hour12);
dialogBox.find("#read_daily_meridiem").text(meridiem);
dialogBox.find("#read_daily_timezone").text("("+timezones[item.timezone]+")");
dialogBox.find("#daily_edit_link, #daily_delete_link").data("intervalType", "daily").data("snapshotPolicyId", item.id).data("max",item.maxsnaps).data("timezone",item.timezone).data("minute", parts[0]).data("hour12", hour12).data("meridiem", meridiem);
break;
case "2": //weekly
dialogBox.find("#dialog_snapshot_weekly_info_unset").hide();
dialogBox.find("#dialog_snapshot_weekly_info_set").show();
dialogBox.find("#read_weekly_max").text(item.maxsnaps);
var parts = item.schedule.split(":");
dialogBox.find("#read_weekly_minute").text(parts[0]);
var hour12, meridiem;
var hour24 = parts[1];
if(hour24 < 12) {
hour12 = hour24;
meridiem = "AM";
}
else {
hour12 = hour24 - 12;
meridiem = "PM"
}
if (hour12 < 10 && hour12.toString().length==1)
hour12 = "0"+hour12.toString();
dialogBox.find("#read_weekly_hour").text(hour12);
dialogBox.find("#read_weekly_meridiem").text(meridiem);
dialogBox.find("#read_weekly_timezone").text("("+timezones[item.timezone]+")");
dialogBox.find("#read_weekly_day_of_week").text(toDayOfWeekDesp(parts[2]));
dialogBox.find("#weekly_edit_link, #weekly_delete_link").data("intervalType", "weekly").data("snapshotPolicyId", item.id).data("max",item.maxsnaps).data("timezone",item.timezone).data("minute", parts[0]).data("hour12", hour12).data("meridiem", meridiem).data("dayOfWeek",parts[2]);
break;
case "3": //monthly
dialogBox.find("#dialog_snapshot_monthly_info_unset").hide();
dialogBox.find("#dialog_snapshot_monthly_info_set").show();
dialogBox.find("#read_monthly_max").text(item.maxsnaps);
var parts = item.schedule.split(":");
dialogBox.find("#read_monthly_minute").text(parts[0]);
var hour12, meridiem;
var hour24 = parts[1];
if(hour24 < 12) {
hour12 = hour24;
meridiem = "AM";
}
else {
hour12 = hour24 - 12;
meridiem = "PM"
}
if (hour12 < 10 && hour12.toString().length==1)
hour12 = "0"+hour12.toString();
dialogBox.find("#read_monthly_hour").text(hour12);
dialogBox.find("#read_monthly_meridiem").text(meridiem);
dialogBox.find("#read_monthly_timezone").text("("+timezones[item.timezone]+")");
dialogBox.find("#read_monthly_day_of_month").text(toDayOfMonthDesp(parts[2]));
dialogBox.find("#monthly_edit_link, #monthly_delete_link").data("intervalType", "monthly").data("snapshotPolicyId", item.id).data("max",item.maxsnaps).data("timezone",item.timezone).data("minute", parts[0]).data("hour12", hour12).data("meridiem", meridiem).data("dayOfMonth",parts[2]);
break;
}
}
}
var items = json.listsnapshotpoliciesresponse.snapshotpolicy;
var $snapInterval = dialogBox.find("#snapshot_interval");
if(items!=null && items.length>0) {
var item = items[0]; // We only expect a single policy.
$snapInterval.val(item.intervaltype).data("jsonObj", item);
} else {
$snapInterval.val("-1").data("jsonObj", null);
}
clearBottomPanel();
$snapInterval.change();
dialogBox.dialog('option', 'buttons', {
"Apply": function() {
var thisDialog = $(this);
var volumeId = thisDialog.data("volumeId");
var bottomPanel = thisDialog.find("#dialog_snapshotright");
var intervalType = thisDialog.find("#snapshot_interval").val();
var minute, hour12, hour24, meridiem, dayOfWeek, dayOfWeekString, dayOfMonth, schedule, max, timezone;
switch(intervalType) {
case "-1":
var $snapshotInterval = $(this).find("#snapshot_interval");
var jsonObj = $snapshotInterval.data("jsonObj");
if(jsonObj != null) {
$.ajax({
data: createURL("command=deleteSnapshotPolicies&id="+jsonObj.id),
dataType: "json",
success: function(json) {
$snapshotInterval.val("-1");
},
error: function(XMLHttpResponse) {
handleError(XMLHttpResponse);
}
});
}
thisDialog.dialog("close");
return false;
case "0":
var isValid = true;
isValid &= validateNumber("Keep # of snapshots", bottomPanel.find("#edit_max"), bottomPanel.find("#edit_max_errormsg"));
if (!isValid) return;
intervalType = "hourly";
minute = bottomPanel.find("#edit_minute").val();
schedule = minute;
max = bottomPanel.find("#edit_max").val();
timezone = bottomPanel.find("#edit_timezone").val();
break;
case "1":
var isValid = true;
isValid &= validateNumber("Keep # of snapshots", bottomPanel.find("#edit_max"), bottomPanel.find("#edit_max_errormsg"));
if (!isValid) return;
intervalType = "daily";
minute = bottomPanel.find("#edit_minute").val();
hour12 = bottomPanel.find("#edit_hour").val();
meridiem = bottomPanel.find("#edit_meridiem").val();
if(meridiem=="AM")
hour24 = hour12;
else //meridiem=="PM"
hour24 = (parseInt(hour12)+12).toString();
schedule = minute + ":" + hour24;
max = bottomPanel.find("#edit_max").val();
timezone = bottomPanel.find("#edit_timezone").val();
break;
case "2":
var isValid = true;
isValid &= validateNumber("Keep # of snapshots", bottomPanel.find("#edit_max"), bottomPanel.find("#edit_max_errormsg"));
if (!isValid) return;
intervalType = "weekly";
minute = bottomPanel.find("#edit_minute").val();
hour12 = bottomPanel.find("#edit_hour").val();
meridiem = bottomPanel.find("#edit_meridiem").val();
if(meridiem=="AM")
hour24 = hour12;
else //meridiem=="PM"
hour24 = (parseInt(hour12)+12).toString();
dayOfWeek = bottomPanel.find("#edit_day_of_week").val();
dayOfWeekString = bottomPanel.find("#edit_day_of_week option:selected").text();
schedule = minute + ":" + hour24 + ":" + dayOfWeek;
max = bottomPanel.find("#edit_max").val();
timezone = bottomPanel.find("#edit_timezone").val();
break;
case "3":
var isValid = true;
isValid &= validateNumber("Keep # of snapshots", bottomPanel.find("#edit_max"), bottomPanel.find("#edit_max_errormsg"));
if (!isValid) return;
intervalType = "monthly";
minute = bottomPanel.find("#edit_minute").val();
hour12 = bottomPanel.find("#edit_hour").val();
meridiem = bottomPanel.find("#edit_meridiem").val();
if(meridiem=="AM")
hour24 = hour12;
else //meridiem=="PM"
hour24 = (parseInt(hour12)+12).toString();
dayOfMonth = bottomPanel.find("#edit_day_of_month").val();
schedule = minute + ":" + hour24 + ":" + dayOfMonth;
max = bottomPanel.find("#edit_max").val();
timezone = bottomPanel.find("#edit_timezone").val();
break;
}
var thisLink;
$.ajax({
data: createURL("command=createSnapshotPolicy&intervaltype="+intervalType+"&schedule="+schedule+"&volumeid="+volumeId+"&maxsnaps="+max+"&timezone="+encodeURIComponent(timezone)),
dataType: "json",
success: function(json) {
thisDialog.dialog("close");
},
error: function(XMLHttpResponse) {
handleError(XMLHttpResponse);
}
});
},
"Disable": function() {
var $snapshotInterval = $(this).find("#snapshot_interval");
var jsonObj = $snapshotInterval.data("jsonObj");
if(jsonObj != null) {
$.ajax({
data: createURL("command=deleteSnapshotPolicies&id="+jsonObj.id),
dataType: "json",
success: function(json) {
$snapshotInterval.val("-1");
},
error: function(XMLHttpResponse) {
handleError(XMLHttpResponse);
}
});
}
$(this).dialog("close");
},
"Close": function() {
$(this).dialog("close");
}
}).dialog("open").data("volumeId", volumeId);
},
error: function(XMLHttpResponse) {
handleError(XMLHttpResponse);
}
});
dialogBox
.dialog('option', 'buttons', {
"Close": function() {
$("#dialog_snapshotright").hide(0, function() { $(this).height("0px");});
$(this).dialog("close");
}
}).dialog("open").data("volumeId", volumeId);
}
function populateVirtualMachineField(domainId, account, zoneId) {