mirror of https://github.com/apache/cloudstack.git
Merge branch 'master' of ssh://anthony@git.cloud.com/var/lib/git/cloudstack-oss
This commit is contained in:
commit
9fb5ec1165
|
|
@ -117,6 +117,14 @@ public class CreateVolumeCmd extends BaseCmd {
|
|||
size = Long.valueOf(0);
|
||||
}
|
||||
|
||||
if(diskOfferingId != null){
|
||||
DiskOfferingVO dOffering = getManagementServer().findDiskOfferingById(diskOfferingId.longValue());
|
||||
|
||||
if(dOffering == null){
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR,"Diskoffering id:"+diskOfferingId+" is invalid");
|
||||
}
|
||||
}
|
||||
|
||||
boolean useSnapshot = false;
|
||||
if (snapshotId == null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import org.apache.log4j.Logger;
|
|||
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.offering.DiskOffering;
|
||||
import com.cloud.storage.DiskOfferingVO;
|
||||
import com.cloud.user.User;
|
||||
import com.cloud.utils.Pair;
|
||||
|
|
@ -62,7 +63,12 @@ public class DeleteDiskOfferingCmd extends BaseCmd {
|
|||
if (disk == null) {
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "unable to find a disk offering with id " + id);
|
||||
}
|
||||
|
||||
|
||||
if(disk.getName().equals("Private") && disk.getDisplayText().equals("Private Disk")){
|
||||
//block deletion of these disks
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR,"Cannot delete this diskoffering as it is private");
|
||||
}
|
||||
|
||||
boolean result = getManagementServer().deleteDiskOffering(userId, id);
|
||||
|
||||
List<Pair<String, Object>> returnValues = new ArrayList<Pair<String, Object>>();
|
||||
|
|
|
|||
|
|
@ -2158,6 +2158,26 @@ a:visited {
|
|||
border-right:1px solid #CCC;
|
||||
}
|
||||
|
||||
.grid_header_formbox {
|
||||
width:auto;
|
||||
height:auto;
|
||||
float:right;
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
.grid_header_cell .select {
|
||||
height:15px;
|
||||
float:left;
|
||||
margin:2px 10px 0 0;
|
||||
display:inline;
|
||||
padding:0;
|
||||
border:1px solid #999;
|
||||
background:#e7e7e7;
|
||||
color:#333;
|
||||
font-size:11px;
|
||||
}
|
||||
|
||||
.grid_header_title {
|
||||
width:auto;
|
||||
height:auto;
|
||||
|
|
@ -2389,4 +2409,74 @@ a:visited {
|
|||
margin:0;
|
||||
padding:0;
|
||||
z-index:1002;
|
||||
}
|
||||
|
||||
.dbrow {
|
||||
width:100%;
|
||||
height:44px;
|
||||
float:left;
|
||||
border-bottom:1px solid #e2e2e2;
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
.dbrow.even {
|
||||
background:url(../images/dbrow_even.gif) repeat-x top left;
|
||||
}
|
||||
|
||||
.dbrow.odd {
|
||||
background:url(../images/dbrow_odd.gif) repeat-x top left;
|
||||
}
|
||||
|
||||
.dbrow_cell {
|
||||
height:44px;
|
||||
float:left;
|
||||
border-right:1px solid #e2e2e2;
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
.dbgraph_titlebox {
|
||||
width:95%;
|
||||
height:auto;
|
||||
float:left;
|
||||
margin:5px 0 0 10px;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
.dbgraph_titlebox h2{
|
||||
width:80%;
|
||||
height:auto;
|
||||
float:left;
|
||||
color:#333;
|
||||
font-size:11px;
|
||||
font-weight:normal;
|
||||
text-align:left;
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
.dbgraph_title_usedbox {
|
||||
width:170px;
|
||||
height:16px;
|
||||
float:left;
|
||||
background:url(../images/db_usedbox.gif) no-repeat top left;
|
||||
margin:3px 0 0 0;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
.dbgraph_title_usedbox p {
|
||||
width: auto;
|
||||
height:auto;
|
||||
float:left;
|
||||
color:#FFF;
|
||||
font-size:11px;
|
||||
font-weight:normal;
|
||||
text-align:left;
|
||||
margin:2px 0 0 5px;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
.dbgraph_title_usedbox span {
|
||||
font-weight:bold;
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 529 B |
Binary file not shown.
|
After Width: | Height: | Size: 124 B |
Binary file not shown.
|
After Width: | Height: | Size: 133 B |
|
|
@ -83,7 +83,7 @@ long milliseconds = new Date().getTime();
|
|||
<div id="contentwrapper">
|
||||
<!-- Action Panel starts here-->
|
||||
<div class="actionpanel">
|
||||
<div class="searchpanel">
|
||||
<div class="searchpanel" id="search_panel">
|
||||
<form method="post" action="#">
|
||||
<ol>
|
||||
<li>
|
||||
|
|
@ -252,7 +252,7 @@ long milliseconds = new Date().getTime();
|
|||
</div>
|
||||
-->
|
||||
</div>
|
||||
<div class="midmenu_navigationbox">
|
||||
<div class="midmenu_navigationbox" id="middle_menu_pagination">
|
||||
<div class="midmenu_prevbutton">
|
||||
</div>
|
||||
<div class="midmenu_nextbutton">
|
||||
|
|
@ -261,7 +261,7 @@ long milliseconds = new Date().getTime();
|
|||
<!-- Right Panel ends here-->
|
||||
</div>
|
||||
<!-- Mid Menu starts here-->
|
||||
<div class="midmenu_panel">
|
||||
<div class="midmenu_panel" id="middle_menu">
|
||||
<div class="midmenu_box" id="midmenu_container">
|
||||
|
||||
<!--
|
||||
|
|
|
|||
|
|
@ -0,0 +1,53 @@
|
|||
<%@ page import="java.util.*" %>
|
||||
<%@ page import="com.cloud.utils.*" %>
|
||||
|
||||
<%
|
||||
Locale browserLocale = request.getLocale();
|
||||
CloudResourceBundle t = CloudResourceBundle.getBundle("resources/resource", browserLocale);
|
||||
%>
|
||||
|
||||
<!-- event detail panel (begin) -->
|
||||
<div class="main_title" id="right_panel_header">
|
||||
|
||||
<div class="main_titleicon">
|
||||
<img src="images/title_dashboardicon.gif" alt="Event" /></div>
|
||||
|
||||
<h1>Dashboard
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<!--Dashboard-->
|
||||
<div class="contentbox" id="right_panel_content">
|
||||
<div class="info_detailbox errorbox" id="after_action_info_container" style="display:none">
|
||||
<p id="after_action_info"></p>
|
||||
</div>
|
||||
|
||||
<div class="grid_container">
|
||||
<div class="grid_header">
|
||||
<div class="grid_header_cell" style="width:60%; border:none;">
|
||||
<div class="grid_header_title">System Wide Capacity</div>
|
||||
</div>
|
||||
<div class="grid_header_cell" style="width:40%; border:none;">
|
||||
<div class="grid_header_formbox">
|
||||
<select class="select" style="width:70px; "><option value="opt1">Op1</option> <option value="opt2">Op2</option></select>
|
||||
<select class="select" style="width:70px;"><option value="opt1">All</option> <option value="opt2">Op2</option></select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="dbrow even">
|
||||
<div class="dbrow_cell" style="width:40%;">
|
||||
<div class="dbgraph_titlebox">
|
||||
<h2>Public IP Addresses</h2>
|
||||
<div class="dbgraph_title_usedbox">
|
||||
<p>Used: <span> 2 / 11 </span></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="dbrow_cell" style="width:50%; border:none;"></div>
|
||||
<div class="dbrow_cell" style="width:9%; border:none;"></div>
|
||||
</div>
|
||||
<div class="dbrow odd"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
|
@ -75,12 +75,10 @@
|
|||
<div class="grid_rows odd">
|
||||
<div class="grid_row_cell" style="width: 20%;">
|
||||
<div class="row_celltitles">
|
||||
<%=t.t("HA")%>:</div>
|
||||
<%=t.t("HA.Enabled")%>:</div>
|
||||
</div>
|
||||
<div class="grid_row_cell" style="width: 79%;">
|
||||
<div class="row_celltitles" id="ha">
|
||||
<div id="icon">
|
||||
</div>
|
||||
<div class="row_celltitles" id="haenable">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -127,12 +125,10 @@
|
|||
<div class="grid_rows odd">
|
||||
<div class="grid_row_cell" style="width: 20%;">
|
||||
<div class="row_celltitles">
|
||||
<%=t.t("ISO")%>:</div>
|
||||
<%=t.t("ISO.attached")%>:</div>
|
||||
</div>
|
||||
<div class="grid_row_cell" style="width: 79%;">
|
||||
<div class="row_celltitles" id="iso">
|
||||
<div id="icon">
|
||||
</div>
|
||||
<div class="row_celltitles" id="iso">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid_editbox">
|
||||
<div class="grid_editbox" id="edit_button">
|
||||
</div>
|
||||
<div class="gridheader_loaderbox" id="spinning_wheel" style="border: 1px solid #999;
|
||||
display: none;">
|
||||
|
|
@ -79,6 +79,8 @@
|
|||
<div class="grid_row_cell" style="width: 79%;">
|
||||
<div class="row_celltitles" id="name">
|
||||
</div>
|
||||
<input class="text" id="name_edit" style="width: 200px; display: none;" type="text" />
|
||||
<div id="name_edit_errormsg" style="display:none"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid_rows odd">
|
||||
|
|
@ -89,6 +91,8 @@
|
|||
<div class="grid_row_cell" style="width: 79%;">
|
||||
<div class="row_celltitles" id="displaytext">
|
||||
</div>
|
||||
<input class="text" id="displaytext_edit" style="width: 200px; display: none;" type="text" />
|
||||
<div id="displaytext_edit_errormsg" style="display:none"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid_rows odd">
|
||||
|
|
@ -107,9 +111,7 @@
|
|||
<%=t.t("Bootable")%>:</div>
|
||||
</div>
|
||||
<div class="grid_row_cell" style="width: 79%;">
|
||||
<div class="row_celltitles" id="bootable">
|
||||
<div id="icon">
|
||||
</div>
|
||||
<div class="row_celltitles" id="bootable">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -142,8 +144,12 @@
|
|||
<div class="row_celltitles" id="size">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid_botactionpanel">
|
||||
<div class="gridbot_buttons" id="save_button" style="display:none;">Save</div>
|
||||
<div class="gridbot_buttons" id="cancel_button" style="display:none;">Cancel</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- ISO detail panel (end) -->
|
||||
|
|
|
|||
|
|
@ -112,9 +112,7 @@
|
|||
<%=t.t("Password.Enabled")%>:</div>
|
||||
</div>
|
||||
<div class="grid_row_cell" style="width: 79%;">
|
||||
<div class="row_celltitles" id="passwordenabled">
|
||||
<div id="icon">
|
||||
</div>
|
||||
<div class="row_celltitles" id="passwordenabled">
|
||||
</div>
|
||||
<select class="select" id="passwordenabled_edit" style="width: 202px; display: none;">
|
||||
<option value="false">No</option>
|
||||
|
|
@ -128,9 +126,7 @@
|
|||
<%=t.t("Public")%>:</div>
|
||||
</div>
|
||||
<div class="grid_row_cell" style="width: 79%;">
|
||||
<div class="row_celltitles" id="ispublic">
|
||||
<div id="icon">
|
||||
</div>
|
||||
<div class="row_celltitles" id="ispublic">
|
||||
</div>
|
||||
<select class="select" id="ispublic_edit" style="width: 202px; display: none;">
|
||||
<option value="true">Yes</option>
|
||||
|
|
@ -144,9 +140,7 @@
|
|||
<%=t.t("Featured")%>:</div>
|
||||
</div>
|
||||
<div class="grid_row_cell" style="width: 79%;">
|
||||
<div class="row_celltitles" id="isfeatured">
|
||||
<div id="icon">
|
||||
</div>
|
||||
<div class="row_celltitles" id="isfeatured">
|
||||
</div>
|
||||
<select class="select" id="isfeatured_edit" style="width: 202px; display: none;">
|
||||
<option value="true">Yes</option>
|
||||
|
|
@ -160,9 +154,7 @@
|
|||
<%=t.t("Cross.Zones")%>:</div>
|
||||
</div>
|
||||
<div class="grid_row_cell" style="width: 79%;">
|
||||
<div class="row_celltitles" id="crossZones">
|
||||
<div id="icon">
|
||||
</div>
|
||||
<div class="row_celltitles" id="crossZones">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -267,3 +259,82 @@
|
|||
</div>
|
||||
</div>
|
||||
<!-- Create VM from template (end) -->
|
||||
|
||||
<!-- Add Template Dialog (begin) -->
|
||||
<div id="dialog_add_template" title="Add Template" style="display:none">
|
||||
<p>Please enter the following data to create your new template</p>
|
||||
<div class="dialog_formcontent">
|
||||
<form action="#" method="post" id="form_acquire">
|
||||
<ol>
|
||||
<li>
|
||||
<label for="user_name">Name:</label>
|
||||
<input class="text" type="text" name="add_template_name" id="add_template_name" style="width:250px"/>
|
||||
<div id="add_template_name_errormsg" class="dialog_formcontent_errormsg" style="display:none;"></div>
|
||||
</li>
|
||||
<li>
|
||||
<label for="user_name">Display Text:</label>
|
||||
<input class="text" type="text" name="add_template_display_text" id="add_template_display_text" style="width:250px"/>
|
||||
<div id="add_template_display_text_errormsg" class="dialog_formcontent_errormsg" style="display:none;"></div>
|
||||
</li>
|
||||
<li>
|
||||
<label for="user_name">URL:</label>
|
||||
<input class="text" type="text" name="add_template_url" id="add_template_url" style="width:250px"/>
|
||||
<div id="add_template_url_errormsg" class="dialog_formcontent_errormsg" style="display:none;"></div>
|
||||
</li>
|
||||
<li>
|
||||
<label>Zone:</label>
|
||||
<select class="select" id="add_template_zone">
|
||||
</select>
|
||||
</li>
|
||||
<li>
|
||||
<label for="add_template_os_type">OS Type:</label>
|
||||
<select class="select" name="add_template_os_type" id="add_template_os_type">
|
||||
</select>
|
||||
</li>
|
||||
<li>
|
||||
<label for="add_template_format">Format:</label>
|
||||
<select class="select" name="add_template_format" id="add_template_format">
|
||||
</select>
|
||||
</li>
|
||||
<!--
|
||||
<li>
|
||||
<label for="user_name">Require HVM?:</label>
|
||||
<select class="select" name="add_template_hvm" id="add_template_hvm">
|
||||
<option value="true">Yes</option>
|
||||
<option value="false">No</option>
|
||||
</select>
|
||||
</li>
|
||||
<li>
|
||||
<label for="user_name">OS Arch:</label>
|
||||
<select class="select" name="add_template_os" id="add_template_os">
|
||||
<option value="64">64 Bit</option>
|
||||
<option value="32">32 Bit</option>
|
||||
</select>
|
||||
</li>
|
||||
!-->
|
||||
<li>
|
||||
<label>Password Enabled?:</label>
|
||||
<select class="select" id="add_template_password">
|
||||
<option value="false">No</option>
|
||||
<option value="true">Yes</option>
|
||||
</select>
|
||||
</li>
|
||||
<li>
|
||||
<label>Public?:</label>
|
||||
<select class="select" id="add_template_public">
|
||||
<option value="false">No</option>
|
||||
<option value="true">Yes</option>
|
||||
</select>
|
||||
</li>
|
||||
<li id="add_template_featured_container" style="display:none">
|
||||
<label>Featured?:</label>
|
||||
<select class="select" id="add_template_featured">
|
||||
<option value="false">No</option>
|
||||
<option value="true">Yes</option>
|
||||
</select>
|
||||
</li>
|
||||
</ol>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Add Template Dialog (end) -->
|
||||
|
|
|
|||
|
|
@ -24,10 +24,11 @@ $(document).ready(function() {
|
|||
selected_leftmenu_id = leftmenuId;
|
||||
$(this).addClass("selected");
|
||||
|
||||
$("#midmenu_container").selectable("destroy" ); //midmenu doesn't need multiple selection
|
||||
showMiddleMenu();
|
||||
$("#midmenu_container").selectable("destroy" ); //Most pages don't need multiple selection in middle menu.
|
||||
|
||||
clearLeftMenu();
|
||||
clearMidMenu();
|
||||
clearMiddleMenu();
|
||||
|
||||
$("#right_panel").load(rightPanelJSP, function(){
|
||||
$("#right_panel_content #tab_content_details #action_message_box #close_button").bind("click", function(event){
|
||||
|
|
@ -97,13 +98,18 @@ $(document).ready(function() {
|
|||
listMidMenuItems("leftmenu_submenu_community_iso", "listIsos&isofilter=community", "listisosresponse", "iso", "jsp/iso.jsp", afterLoadIsoJSP, isoToMidmenu, isoToRigntPanel);
|
||||
|
||||
$("#leftmenu_instance_group_header").bind("click", function(event) {
|
||||
clearMidMenu();
|
||||
showMiddleMenu();
|
||||
clearMiddleMenu();
|
||||
var $arrowIcon = $(this).find("#arrow_icon");
|
||||
clickInstanceGroupHeader($arrowIcon);
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
$("#leftmenu_dashboard").bind("click", function(event) {
|
||||
hideMiddleMenu();
|
||||
$("#right_panel").load("jsp/dashboard.jsp", function(){});
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -377,7 +377,12 @@ function clickInstanceGroupHeader($arrowIcon) {
|
|||
}
|
||||
|
||||
function vmToRightPanel($midmenuItem) {
|
||||
//details tab
|
||||
var jsonObj = $midmenuItem.data("jsonObj");
|
||||
|
||||
var vmName = getVmName(jsonObj.name, jsonObj.displayname);
|
||||
$("right_panel_header").find("#vm_name").text(fromdb(vmName));
|
||||
|
||||
var $rightPanelContent = $("#right_panel_content");
|
||||
if($midmenuItem.find("#info_icon").css("display") != "none") {
|
||||
$rightPanelContent.find("#after_action_info").text($midmenuItem.data("afterActionInfo"));
|
||||
if($midmenuItem.find("#info_icon").hasClass("error"))
|
||||
|
|
@ -391,22 +396,27 @@ function clickInstanceGroupHeader($arrowIcon) {
|
|||
$rightPanelContent.find("#after_action_info_container").hide();
|
||||
}
|
||||
|
||||
var jsonObj = $midmenuItem.data("jsonObj");
|
||||
var vmName = getVmName(jsonObj.name, jsonObj.displayname);
|
||||
$rightPanelHeader.find("#vm_name").text(fromdb(vmName));
|
||||
vmJsonToDetailsTab(jsonObj, $midmenuItem);
|
||||
}
|
||||
|
||||
function vmJsonToDetailsTab(jsonObj, $midmenuItem){
|
||||
var $detailsTab = $("#right_panel_content #tab_content_details");
|
||||
$detailsTab.data("jsonObj", jsonObj);
|
||||
|
||||
//details tab
|
||||
updateVirtualMachineStateInRightPanel(jsonObj.state);
|
||||
$rightPanelContent.find("#ipAddress").text(jsonObj.ipaddress);
|
||||
$rightPanelContent.find("#zoneName").text(fromdb(jsonObj.zonename));
|
||||
$rightPanelContent.find("#templateName").text(fromdb(jsonObj.templatename));
|
||||
$rightPanelContent.find("#serviceOfferingName").text(fromdb(jsonObj.serviceofferingname));
|
||||
$rightPanelContent.find("#created").text(jsonObj.created);
|
||||
$rightPanelContent.find("#account").text(fromdb(jsonObj.account));
|
||||
$rightPanelContent.find("#domain").text(fromdb(jsonObj.domain));
|
||||
$rightPanelContent.find("#hostName").text(fromdb(jsonObj.hostname));
|
||||
$rightPanelContent.find("#group").text(fromdb(jsonObj.group));
|
||||
$detailsTab.find("#ipAddress").text(jsonObj.ipaddress);
|
||||
$detailsTab.find("#zoneName").text(fromdb(jsonObj.zonename));
|
||||
$detailsTab.find("#templateName").text(fromdb(jsonObj.templatename));
|
||||
$detailsTab.find("#serviceOfferingName").text(fromdb(jsonObj.serviceofferingname));
|
||||
$detailsTab.find("#created").text(jsonObj.created);
|
||||
$detailsTab.find("#account").text(fromdb(jsonObj.account));
|
||||
$detailsTab.find("#domain").text(fromdb(jsonObj.domain));
|
||||
$detailsTab.find("#hostName").text(fromdb(jsonObj.hostname));
|
||||
$detailsTab.find("#group").text(fromdb(jsonObj.group));
|
||||
|
||||
setBooleanField(jsonObj.haenable, $rightPanelContent.find("#ha"));
|
||||
setBooleanField((jsonObj.isoid != null && jsonObj.isoid.length > 0), $rightPanelContent.find("#iso"));
|
||||
setBooleanField(jsonObj.haenable, $detailsTab.find("#haenable"));
|
||||
setBooleanField((jsonObj.isoid != null && jsonObj.isoid.length > 0), $detailsTab.find("#iso"));
|
||||
|
||||
//volume tab
|
||||
//if (getHypervisorType() == "kvm")
|
||||
|
|
@ -418,7 +428,7 @@ function clickInstanceGroupHeader($arrowIcon) {
|
|||
success: function(json) {
|
||||
var items = json.listvolumesresponse.volume;
|
||||
if (items != null && items.length > 0) {
|
||||
var container = $rightPanelContent.find("#tab_content_volume").empty();
|
||||
var container = $detailsTab.find("#tab_content_volume").empty();
|
||||
var template = $("#volume_tab_template");
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
var newTemplate = template.clone(true);
|
||||
|
|
@ -561,13 +571,15 @@ function clickInstanceGroupHeader($arrowIcon) {
|
|||
data: createURL("command=listVirtualMachines&group="+group1+"&pagesize="+midmenuItemCount),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var instances = json.listvirtualmachinesresponse.virtualmachine;
|
||||
for(var i=0; i<instances.length;i++) {
|
||||
var $midmenuItem1 = $midmenuItem.clone();
|
||||
$midmenuItem1.data("toRightPanelFn", vmToRightPanel);
|
||||
vmToMidmenu(instances[i], $midmenuItem1);
|
||||
$("#midmenu_container").append($midmenuItem1.show());
|
||||
}
|
||||
var instances = json.listvirtualmachinesresponse.virtualmachine;
|
||||
if (instances != null && instances.length > 0) {
|
||||
for(var i=0; i<instances.length;i++) {
|
||||
var $midmenuItem1 = $midmenuItem.clone();
|
||||
$midmenuItem1.data("toRightPanelFn", vmToRightPanel);
|
||||
vmToMidmenu(instances[i], $midmenuItem1);
|
||||
$("#midmenu_container").append($midmenuItem1.show());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return false;
|
||||
|
|
@ -1174,19 +1186,14 @@ function clickInstanceGroupHeader($arrowIcon) {
|
|||
moreCriteria.push("&group="+todb(group));
|
||||
|
||||
vmWizardClose();
|
||||
|
||||
var $t = $("#midmenu_item").clone();
|
||||
$t.find("#first_row").text("Adding....");
|
||||
$t.find("#content").addClass("inaction");
|
||||
$t.find("#spinning_wheel").show();
|
||||
$("#midmenu_container").append($t.show());
|
||||
|
||||
|
||||
var $midmenuItem1 = beforeAddingMidMenuItem() ;
|
||||
|
||||
$.ajax({
|
||||
data: createURL("command=deployVirtualMachine"+moreCriteria.join("")),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var jobId = json.deployvirtualmachineresponse.jobid;
|
||||
$t.attr("id","vmNew"+jobId).data("jobId", jobId);
|
||||
var jobId = json.deployvirtualmachineresponse.jobid;
|
||||
var timerKey = "vmNew"+jobId;
|
||||
|
||||
// Process the async job
|
||||
|
|
@ -1202,35 +1209,23 @@ function clickInstanceGroupHeader($arrowIcon) {
|
|||
if (result.jobstatus == 0) {
|
||||
return; //Job has not completed
|
||||
} else {
|
||||
$("body").stopTime(timerKey);
|
||||
$t.find("#content").removeClass("inaction");
|
||||
$t.find("#spinning_wheel").hide();
|
||||
$("body").stopTime(timerKey);
|
||||
if (result.jobstatus == 1) {
|
||||
// Succeeded
|
||||
$t.find("#info_icon").removeClass("error").show();
|
||||
$t.data("afterActionInfo", ("Adding succeeded."));
|
||||
afterAddingMidMenuItem($midmenuItem1, true);
|
||||
if("virtualmachine" in result)
|
||||
vmToMidmenu(result.virtualmachine[0], $t);
|
||||
|
||||
} else if (result.jobstatus == 2) {
|
||||
// Failed
|
||||
$t.find("#first_row").text("Adding failed");
|
||||
$t.find("#info_icon").addClass("error").show();
|
||||
$t.data("afterActionInfo", ("Adding failed. Reason: " + fromdb(result.jobresult)));
|
||||
$t.bind("click", function(event) {
|
||||
$rightPanelContent.find("#after_action_info").text($(this).data("afterActionInfo"));
|
||||
$rightPanelContent.find("#after_action_info_container").addClass("errorbox");
|
||||
$rightPanelContent.find("#after_action_info_container").show();
|
||||
vmClearRightPanel();
|
||||
return false;
|
||||
});
|
||||
afterAddingMidMenuItem($midmenuItem1, false);
|
||||
$("#dialog_error").html("<p><b>Adding Instance failed</b></p><br/><p>"+fromdb(result.jobresult)+"</p>").dialog("open");
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpResponse) {
|
||||
$("body").stopTime(timerKey);
|
||||
$t.find("#info_icon").addClass("error").show();
|
||||
$t.find("#first_row").text("Adding failed");
|
||||
$("body").stopTime(timerKey);
|
||||
afterAddingMidMenuItem($midmenuItem1, false);
|
||||
handleError(XMLHttpResponse);
|
||||
}
|
||||
});
|
||||
|
|
@ -1238,9 +1233,8 @@ function clickInstanceGroupHeader($arrowIcon) {
|
|||
0
|
||||
);
|
||||
},
|
||||
error: function(XMLHttpResponse) {
|
||||
$t.find("#info_icon").addClass("error").show();
|
||||
$t.find("#first_row").text("Adding failed");
|
||||
error: function(XMLHttpResponse) {
|
||||
afterAddingMidMenuItem($midmenuItem1, false);
|
||||
handleError(XMLHttpResponse);
|
||||
}
|
||||
});
|
||||
|
|
@ -1300,8 +1294,7 @@ function doCreateTemplateFromVmVolume($actionLink, listAPIMap, $subgridItem) {
|
|||
|
||||
$("#dialog_create_template")
|
||||
.dialog('option', 'buttons', {
|
||||
"Create": function() {
|
||||
//debugger;
|
||||
"Create": function() {
|
||||
var thisDialog = $(this);
|
||||
thisDialog.dialog("close");
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,28 @@ var g_zoneNames = [];
|
|||
function afterLoadIsoJSP() {
|
||||
var $detailsTab = $("#right_panel_content #tab_content_details");
|
||||
|
||||
//edit button ***
|
||||
var $readonlyFields = $detailsTab.find("#name, #displaytext");
|
||||
var $editFields = $detailsTab.find("#name_edit, #displaytext_edit");
|
||||
$("#edit_button").bind("click", function(event){
|
||||
$readonlyFields.hide();
|
||||
$editFields.show();
|
||||
$("#cancel_button, #save_button").show()
|
||||
return false;
|
||||
});
|
||||
$("#cancel_button").bind("click", function(event){
|
||||
$editFields.hide();
|
||||
$readonlyFields.show();
|
||||
$("#save_button, #cancel_button").hide();
|
||||
return false;
|
||||
});
|
||||
$("#save_button").bind("click", function(event){
|
||||
doUpdateIso();
|
||||
$editFields.hide();
|
||||
$readonlyFields.show();
|
||||
$("#save_button, #cancel_button").hide();
|
||||
return false;
|
||||
});
|
||||
|
||||
//populate dropdown ***
|
||||
$.ajax({
|
||||
|
|
@ -107,8 +129,13 @@ function isoJsonToDetailsTab(jsonObj) {
|
|||
$detailsTab.data("jsonObj", jsonObj);
|
||||
$detailsTab.find("#id").text(fromdb(jsonObj.id));
|
||||
$detailsTab.find("#zonename").text(fromdb(jsonObj.zonename));
|
||||
|
||||
$detailsTab.find("#name").text(fromdb(jsonObj.name));
|
||||
$detailsTab.find("#name_edit").val(fromdb(jsonObj.name));
|
||||
|
||||
$detailsTab.find("#displaytext").text(fromdb(jsonObj.displaytext));
|
||||
$detailsTab.find("#displaytext_edit").val(fromdb(jsonObj.displaytext));
|
||||
|
||||
$detailsTab.find("#account").text(fromdb(jsonObj.account));
|
||||
|
||||
if(jsonObj.size != null)
|
||||
|
|
@ -158,7 +185,22 @@ function isoJsonToDetailsTab(jsonObj) {
|
|||
}
|
||||
|
||||
function isoClearRightPanel() {
|
||||
|
||||
var $detailsTab = $("#right_panel_content #tab_content_details");
|
||||
|
||||
$detailsTab.find("#id").text("");
|
||||
$detailsTab.find("#zonename").text("");
|
||||
|
||||
$detailsTab.find("#name").text("");
|
||||
$detailsTab.find("#name_edit").val("");
|
||||
|
||||
$detailsTab.find("#displaytext").text("");
|
||||
$detailsTab.find("#displaytext_edit").val("");
|
||||
|
||||
$detailsTab.find("#account").text("");
|
||||
$detailsTab.find("#size").text("");
|
||||
$detailsTab.find("#status").text("");
|
||||
$detailsTab.find("#bootable").text("");
|
||||
$detailsTab.find("#created").text("");
|
||||
}
|
||||
|
||||
var isoActionMap = {
|
||||
|
|
@ -167,7 +209,7 @@ var isoActionMap = {
|
|||
isAsyncJob: true,
|
||||
asyncJobResponse: "deleteisosresponse",
|
||||
inProcessText: "Deleting ISO....",
|
||||
afterActionSeccessFn: function(jsonObj) {
|
||||
afterActionSeccessFn: function(jsonObj) {
|
||||
var $midmenuItem1 = $("#midmenuItem_"+jsonObj.id);
|
||||
$midmenuItem1.remove();
|
||||
clearRightPanel();
|
||||
|
|
@ -192,11 +234,38 @@ var isoActionMap = {
|
|||
}
|
||||
|
||||
var isoListAPIMap = {
|
||||
listAPI: "listisos&isofilter=self",
|
||||
listAPI: "listIsos&isofilter=self",
|
||||
listAPIResponse: "listisosresponse",
|
||||
listAPIResponseObj: "iso"
|
||||
};
|
||||
|
||||
function doUpdateIso() {
|
||||
var $detailsTab = $("#right_panel_content #tab_content_details");
|
||||
|
||||
// validate values
|
||||
var isValid = true;
|
||||
isValid &= validateString("Name", $detailsTab.find("#name_edit"), $detailsTab.find("#name_edit_errormsg"));
|
||||
isValid &= validateString("Display Text", $detailsTab.find("#displaytext_edit"), $detailsTab.find("#displaytext_edit_errormsg"));
|
||||
if (!isValid)
|
||||
return;
|
||||
|
||||
var jsonObj = $detailsTab.data("jsonObj");
|
||||
var id = jsonObj.id;
|
||||
|
||||
var name = trim($detailsTab.find("#name_edit").val());
|
||||
var displaytext = trim($detailsTab.find("#displaytext_edit").val());
|
||||
|
||||
$.ajax({
|
||||
data: createURL("command=updateIso&id="+id+"&name="+todb(name)+"&displayText="+todb(displaytext)),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var jsonObj = json.updateisoresponse;
|
||||
isoToMidmenu(jsonObj, $("#midmenuItem_"+jsonObj.id));
|
||||
isoJsonToDetailsTab(jsonObj);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function populateZoneFieldExcludeSourceZone(zoneField, excludeZoneId) {
|
||||
zoneField.empty();
|
||||
if (g_zoneIds != null && g_zoneIds.length > 0) {
|
||||
|
|
|
|||
|
|
@ -20,6 +20,166 @@
|
|||
|
||||
// Version: @VERSION@
|
||||
|
||||
|
||||
//***** actions for details tab in right panel (begin) ************************************************************************
|
||||
function buildActionLinkForDetailsTab(label, actionMap, $actionMenu, listAPIMap) {
|
||||
var apiInfo = actionMap[label];
|
||||
var $listItem = $("#action_list_item").clone();
|
||||
$actionMenu.find("#action_list").append($listItem.show());
|
||||
var $link = $listItem.find("#link").text(label);
|
||||
$link.data("label", label);
|
||||
$link.data("inProcessText", apiInfo.inProcessText);
|
||||
$link.data("api", apiInfo.api);
|
||||
$link.data("isAsyncJob", apiInfo.isAsyncJob);
|
||||
$link.data("asyncJobResponse", apiInfo.asyncJobResponse);
|
||||
$link.data("afterActionSeccessFn", apiInfo.afterActionSeccessFn);
|
||||
$link.data("dialogBeforeActionFn", apiInfo.dialogBeforeActionFn);
|
||||
|
||||
var $detailsTab = $("#right_panel_content #tab_content_details");
|
||||
var id = $detailsTab.data("jsonObj").id;
|
||||
|
||||
$link.bind("click", function(event) {
|
||||
$actionMenu.hide();
|
||||
var $actionLink = $(this);
|
||||
var dialogBeforeActionFn = $actionLink.data("dialogBeforeActionFn");
|
||||
if(dialogBeforeActionFn == null) {
|
||||
var apiCommand = "command="+$actionLink.data("api")+"&id="+id;
|
||||
doActionToDetailsTab(id, $actionLink, apiCommand, listAPIMap);
|
||||
}
|
||||
else {
|
||||
dialogBeforeActionFn($actionLink, listAPIMap, $detailsTab);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
function doActionToDetailsTab(id, $actionLink, apiCommand, listAPIMap) {
|
||||
var label = $actionLink.data("label");
|
||||
var inProcessText = $actionLink.data("inProcessText");
|
||||
var isAsyncJob = $actionLink.data("isAsyncJob");
|
||||
var asyncJobResponse = $actionLink.data("asyncJobResponse");
|
||||
var afterActionSeccessFn = $actionLink.data("afterActionSeccessFn");
|
||||
var listAPI = listAPIMap["listAPI"];
|
||||
var listAPIResponse = listAPIMap["listAPIResponse"];
|
||||
var listAPIResponseObj = listAPIMap["listAPIResponseObj"];
|
||||
|
||||
var $detailsTab = $("#right_panel_content #tab_content_details");
|
||||
var $spinningWheel = $detailsTab.find("#spinning_wheel");
|
||||
$spinningWheel.find("#description").text(inProcessText);
|
||||
$spinningWheel.show();
|
||||
|
||||
//Async job (begin) *****
|
||||
if(isAsyncJob == true) {
|
||||
$.ajax({
|
||||
data: createURL(apiCommand),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var jobId = json[asyncJobResponse].jobid;
|
||||
var timerKey = "asyncJob_" + jobId;
|
||||
$("body").everyTime(
|
||||
10000,
|
||||
timerKey,
|
||||
function() {
|
||||
$.ajax({
|
||||
data: createURL("command=queryAsyncJobResult&jobId="+jobId),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var result = json.queryasyncjobresultresponse;
|
||||
if (result.jobstatus == 0) {
|
||||
return; //Job has not completed
|
||||
} else {
|
||||
$("body").stopTime(timerKey);
|
||||
$spinningWheel.hide();
|
||||
if (result.jobstatus == 1) { // Succeeded
|
||||
$detailsTab.find("#action_message_box #description").text(label + " action succeeded.");
|
||||
$detailsTab.find("#action_message_box").removeClass("error").show();
|
||||
|
||||
//DestroyVirtualMachine API doesn't return an embedded object on success (Bug 6041)
|
||||
//Before Bug 6041 get fixed, use the temporary solution below.
|
||||
$.ajax({
|
||||
cache: false,
|
||||
data: createURL("command="+listAPI+"&id="+id),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
afterActionSeccessFn(json[listAPIResponse][listAPIResponseObj][0]);
|
||||
}
|
||||
});
|
||||
//After Bug 6037 is fixed, remove temporary solution above and uncomment the line below
|
||||
//afterActionSeccessFn(json[listAPIResponse][listAPIResponseObj][0]);
|
||||
|
||||
} else if (result.jobstatus == 2) { // Failed
|
||||
$detailsTab.find("#action_message_box #description").text(label + " action failed. Reason: " + sanitizeXSS(result.jobresult));
|
||||
$detailsTab.find("#action_message_box").addClass("error").show();
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpResponse) {
|
||||
$("body").stopTime(timerKey);
|
||||
handleErrorInDetailsTab(XMLHttpResponse, $detailsTab, label);
|
||||
}
|
||||
});
|
||||
},
|
||||
0
|
||||
);
|
||||
},
|
||||
error: function(XMLHttpResponse) {
|
||||
handleErrorInDetailsTab(XMLHttpResponse, $detailsTab, label);
|
||||
}
|
||||
});
|
||||
}
|
||||
//Async job (end) *****
|
||||
|
||||
//Sync job (begin) *****
|
||||
else {
|
||||
$.ajax({
|
||||
data: createURL(apiCommand),
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function(json) {
|
||||
$spinningWheel.hide();
|
||||
|
||||
//RecoverVirtualMachine API doesn't return an embedded object on success (Bug 6037)
|
||||
//Before Bug 6037 get fixed, use the temporary solution below.
|
||||
$.ajax({
|
||||
cache: false,
|
||||
data: createURL("command="+listAPI+"&id="+id),
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function(json) {
|
||||
$detailsTab.find("#action_message_box #description").text(label + " action succeeded.");
|
||||
$detailsTab.find("#action_message_box").removeClass("error").show();
|
||||
|
||||
afterActionSeccessFn(json[listAPIResponse][listAPIResponseObj][0]);
|
||||
}
|
||||
});
|
||||
//After Bug 6037 is fixed, remove temporary solution above and uncomment the line below
|
||||
//afterActionSeccessFn(json[listAPIResponse][listAPIResponseObj][0]);
|
||||
},
|
||||
error: function(XMLHttpResponse) {
|
||||
handleErrorInDetailsTab(XMLHttpResponse, $detailsTab, label);
|
||||
}
|
||||
});
|
||||
}
|
||||
//Sync job (end) *****
|
||||
}
|
||||
|
||||
function handleErrorInDetailsTab(XMLHttpResponse, $detailsTab, label) {
|
||||
$detailsTab.find("#spinning_wheel").hide();
|
||||
|
||||
var errorMsg = "";
|
||||
if(XMLHttpResponse.responseText != null & XMLHttpResponse.responseText.length > 0) {
|
||||
var start = XMLHttpResponse.responseText.indexOf("h1") + 3;
|
||||
var end = XMLHttpResponse.responseText.indexOf("</h1");
|
||||
errorMsg = XMLHttpResponse.responseText.substring(start, end);
|
||||
}
|
||||
if(errorMsg.length > 0)
|
||||
$detailsTab.find("#action_message_box #description").text(label + " action failed. Reason: " + sanitizeXSS(unescape(errorMsg)));
|
||||
else
|
||||
$detailsTab.find("#action_message_box #description").text(label + " action failed.");
|
||||
$detailsTab.find("#action_message_box").addClass("error").show();
|
||||
}
|
||||
//***** actions for details tab in right panel (end) **************************************************************************
|
||||
|
||||
//***** actions for middle menu (begin) ************************************************************************
|
||||
var selectedItemsInMidMenu = {};
|
||||
|
||||
|
|
@ -180,164 +340,6 @@ function handleErrorInMidMenu(XMLHttpResponse, $midmenuItem) {
|
|||
}
|
||||
//***** actions for middle menu (end) **************************************************************************
|
||||
|
||||
//***** actions for details tab in right panel (begin) ************************************************************************
|
||||
function buildActionLinkForDetailsTab(label, actionMap, $actionMenu, listAPIMap) {
|
||||
var apiInfo = actionMap[label];
|
||||
var $listItem = $("#action_list_item").clone();
|
||||
$actionMenu.find("#action_list").append($listItem.show());
|
||||
var $link = $listItem.find("#link").text(label);
|
||||
$link.data("label", label);
|
||||
$link.data("inProcessText", apiInfo.inProcessText);
|
||||
$link.data("api", apiInfo.api);
|
||||
$link.data("isAsyncJob", apiInfo.isAsyncJob);
|
||||
$link.data("asyncJobResponse", apiInfo.asyncJobResponse);
|
||||
$link.data("afterActionSeccessFn", apiInfo.afterActionSeccessFn);
|
||||
$link.data("dialogBeforeActionFn", apiInfo.dialogBeforeActionFn);
|
||||
|
||||
var $detailsTab = $("#right_panel_content #tab_content_details");
|
||||
var id = $detailsTab.data("jsonObj").id;
|
||||
|
||||
$link.bind("click", function(event) {
|
||||
$actionMenu.hide();
|
||||
var $actionLink = $(this);
|
||||
var dialogBeforeActionFn = $actionLink.data("dialogBeforeActionFn");
|
||||
if(dialogBeforeActionFn == null) {
|
||||
var apiCommand = "command="+$actionLink.data("api")+"&id="+id;
|
||||
doActionToDetailsTab(id, $actionLink, apiCommand, listAPIMap);
|
||||
}
|
||||
else {
|
||||
dialogBeforeActionFn($actionLink, listAPIMap, $detailsTab);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
function doActionToDetailsTab(id, $actionLink, apiCommand, listAPIMap) {
|
||||
var label = $actionLink.data("label");
|
||||
var inProcessText = $actionLink.data("inProcessText");
|
||||
var isAsyncJob = $actionLink.data("isAsyncJob");
|
||||
var asyncJobResponse = $actionLink.data("asyncJobResponse");
|
||||
var afterActionSeccessFn = $actionLink.data("afterActionSeccessFn");
|
||||
var listAPI = listAPIMap["listAPI"];
|
||||
var listAPIResponse = listAPIMap["listAPIResponse"];
|
||||
var listAPIResponseObj = listAPIMap["listAPIResponseObj"];
|
||||
|
||||
var $detailsTab = $("#right_panel_content #tab_content_details");
|
||||
var $spinningWheel = $detailsTab.find("#spinning_wheel");
|
||||
$spinningWheel.find("#description").text(inProcessText);
|
||||
$spinningWheel.show();
|
||||
|
||||
//Async job (begin) *****
|
||||
if(isAsyncJob == true) {
|
||||
$.ajax({
|
||||
data: createURL(apiCommand),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var jobId = json[asyncJobResponse].jobid;
|
||||
var timerKey = "asyncJob_" + jobId;
|
||||
$("body").everyTime(
|
||||
10000,
|
||||
timerKey,
|
||||
function() {
|
||||
$.ajax({
|
||||
data: createURL("command=queryAsyncJobResult&jobId="+jobId),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var result = json.queryasyncjobresultresponse;
|
||||
if (result.jobstatus == 0) {
|
||||
return; //Job has not completed
|
||||
} else {
|
||||
$("body").stopTime(timerKey);
|
||||
$spinningWheel.hide();
|
||||
if (result.jobstatus == 1) { // Succeeded
|
||||
$detailsTab.find("#action_message_box #description").text(label + " action succeeded.");
|
||||
$detailsTab.find("#action_message_box").removeClass("error").show();
|
||||
|
||||
//DestroyVirtualMachine API doesn't return an embedded object on success (Bug 6041)
|
||||
//Before Bug 6041 get fixed, use the temporary solution below.
|
||||
$.ajax({
|
||||
cache: false,
|
||||
data: createURL("command="+listAPI+"&id="+id),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
afterActionSeccessFn(json[listAPIResponse][listAPIResponseObj][0]);
|
||||
}
|
||||
});
|
||||
//After Bug 6037 is fixed, remove temporary solution above and uncomment the line below
|
||||
//afterActionSeccessFn(json[listAPIResponse][listAPIResponseObj][0]);
|
||||
|
||||
} else if (result.jobstatus == 2) { // Failed
|
||||
$detailsTab.find("#action_message_box #description").text(label + " action failed. Reason: " + sanitizeXSS(result.jobresult));
|
||||
$detailsTab.find("#action_message_box").addClass("error").show();
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpResponse) {
|
||||
$("body").stopTime(timerKey);
|
||||
handleErrorInDetailsTab(XMLHttpResponse, $detailsTab, label);
|
||||
}
|
||||
});
|
||||
},
|
||||
0
|
||||
);
|
||||
},
|
||||
error: function(XMLHttpResponse) {
|
||||
handleErrorInDetailsTab(XMLHttpResponse, $detailsTab, label);
|
||||
}
|
||||
});
|
||||
}
|
||||
//Async job (end) *****
|
||||
|
||||
//Sync job (begin) *****
|
||||
else {
|
||||
$.ajax({
|
||||
data: createURL(apiCommand),
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function(json) {
|
||||
$spinningWheel.hide();
|
||||
|
||||
//RecoverVirtualMachine API doesn't return an embedded object on success (Bug 6037)
|
||||
//Before Bug 6037 get fixed, use the temporary solution below.
|
||||
$.ajax({
|
||||
cache: false,
|
||||
data: createURL("command="+listAPI+"&id="+id),
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function(json) {
|
||||
$detailsTab.find("#action_message_box #description").text(label + " action succeeded.");
|
||||
$detailsTab.find("#action_message_box").removeClass("error").show();
|
||||
|
||||
afterActionSeccessFn(json[listAPIResponse][listAPIResponseObj][0]);
|
||||
}
|
||||
});
|
||||
//After Bug 6037 is fixed, remove temporary solution above and uncomment the line below
|
||||
//afterActionSeccessFn(json[listAPIResponse][listAPIResponseObj][0]);
|
||||
},
|
||||
error: function(XMLHttpResponse) {
|
||||
handleErrorInDetailsTab(XMLHttpResponse, $detailsTab, label);
|
||||
}
|
||||
});
|
||||
}
|
||||
//Sync job (end) *****
|
||||
}
|
||||
|
||||
function handleErrorInDetailsTab(XMLHttpResponse, $detailsTab, label) {
|
||||
$detailsTab.find("#spinning_wheel").hide();
|
||||
|
||||
var errorMsg = "";
|
||||
if(XMLHttpResponse.responseText != null & XMLHttpResponse.responseText.length > 0) {
|
||||
var start = XMLHttpResponse.responseText.indexOf("h1") + 3;
|
||||
var end = XMLHttpResponse.responseText.indexOf("</h1");
|
||||
errorMsg = XMLHttpResponse.responseText.substring(start, end);
|
||||
}
|
||||
if(errorMsg.length > 0)
|
||||
$detailsTab.find("#action_message_box #description").text(label + " action failed. Reason: " + sanitizeXSS(unescape(errorMsg)));
|
||||
else
|
||||
$detailsTab.find("#action_message_box #description").text(label + " action failed.");
|
||||
$detailsTab.find("#action_message_box").addClass("error").show();
|
||||
}
|
||||
//***** actions for details tab in right panel (end) **************************************************************************
|
||||
|
||||
//***** actions for a subgrid item in right panel (begin) ************************************************************************
|
||||
function buildActionLinkForSubgridItem(label, actionMap, $actionMenu, listAPIMap, $subgridItem) {
|
||||
|
|
@ -513,12 +515,12 @@ function todb(val) {
|
|||
var midmenuItemCount = 20;
|
||||
|
||||
function setBooleanField(value, $field) {
|
||||
if(value == "true")
|
||||
$field.find("#icon").removeClass("cross_icon").addClass("tick_icon").show();
|
||||
else if(value == "false")
|
||||
$field.find("#icon").removeClass("tick_icon").addClass("cross_icon").show();
|
||||
if(value == "true" || value == true)
|
||||
$field.text("Yes").show();
|
||||
else if(value == "false" || value == false)
|
||||
$field.text("No").show();
|
||||
else
|
||||
$field.find("#icon").hide();
|
||||
$field.hide();
|
||||
}
|
||||
|
||||
function clearLeftMenu() {
|
||||
|
|
@ -529,7 +531,7 @@ function clearLeftMenu() {
|
|||
}
|
||||
}
|
||||
|
||||
function clearMidMenu() {
|
||||
function clearMiddleMenu() {
|
||||
$("#midmenu_container").empty();
|
||||
$("#midmenu_action_link").hide();
|
||||
$("#midmenu_add_link").hide();
|
||||
|
|
@ -542,10 +544,38 @@ function clearRightPanel() {
|
|||
var selected_leftmenu_id = null;
|
||||
var selected_midmenu_id = null;
|
||||
|
||||
|
||||
|
||||
function hideMiddleMenu() {
|
||||
$("#middle_menu, #search_panel, #middle_menu_pagination").hide();
|
||||
$("#right_panel").removeClass("main_contentarea").addClass("main_contentarea_dashboard");
|
||||
}
|
||||
function showMiddleMenu() {
|
||||
$("#middle_menu, #search_panel, #middle_menu_pagination").show();
|
||||
$("#right_panel").removeClass("main_contentarea_dashboard").addClass("main_contentarea");
|
||||
}
|
||||
|
||||
|
||||
// adding middle menu item ***
|
||||
function beforeAddingMidMenuItem() {
|
||||
var $midmenuItem1 = $("#midmenu_item").clone();
|
||||
$midmenuItem1.find("#first_row").text("Adding....");
|
||||
$midmenuItem1.find("#content").addClass("inaction");
|
||||
$midmenuItem1.find("#spinning_wheel").show();
|
||||
$("#midmenu_container").append($midmenuItem1.show());
|
||||
return $midmenuItem1;
|
||||
}
|
||||
function afterAddingMidMenuItem($midmenuItem1, isSuccessful) {
|
||||
$midmenuItem1.find("#content").removeClass("inaction");
|
||||
$midmenuItem1.find("#spinning_wheel").hide();
|
||||
|
||||
if(isSuccessful == true) {
|
||||
$midmenuItem1.find("#info_icon").removeClass("error").show();
|
||||
$midmenuItem1.data("afterActionInfo", ("Adding succeeded."));
|
||||
}
|
||||
else {
|
||||
$midmenuItem1.find("#info_icon").addClass("error").show();
|
||||
$midmenuItem1.find("#first_row").text("Adding failed");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,47 +1,121 @@
|
|||
var g_zoneIds = [];
|
||||
var g_zoneNames = [];
|
||||
|
||||
function afterLoadTemplateJSP() {
|
||||
var $detailsTab = $("#right_panel_content #tab_content_details");
|
||||
function afterLoadTemplateJSP() {
|
||||
var $detailsTab = $("#right_panel_content #tab_content_details");
|
||||
|
||||
//add button ***
|
||||
$("#midmenu_add_link").show();
|
||||
$("#midmenu_add_link").bind("click", function(event) {
|
||||
$("#dialog_add_template")
|
||||
.dialog('option', 'buttons', {
|
||||
"Create": function() {
|
||||
var thisDialog = $(this);
|
||||
thisDialog.dialog("close");
|
||||
|
||||
debugger;
|
||||
// validate values
|
||||
var isValid = true;
|
||||
isValid &= validateString("Name", thisDialog.find("#add_template_name"), thisDialog.find("#add_template_name_errormsg"));
|
||||
isValid &= validateString("Display Text", thisDialog.find("#add_template_display_text"), thisDialog.find("#add_template_display_text_errormsg"));
|
||||
isValid &= validateString("URL", thisDialog.find("#add_template_url"), thisDialog.find("#add_template_url_errormsg"));
|
||||
if (!isValid) return;
|
||||
|
||||
var name = trim(thisDialog.find("#add_template_name").val());
|
||||
var desc = trim(thisDialog.find("#add_template_display_text").val());
|
||||
var url = trim(thisDialog.find("#add_template_url").val());
|
||||
var zoneId = thisDialog.find("#add_template_zone").val();
|
||||
var format = thisDialog.find("#add_template_format").val();
|
||||
var password = thisDialog.find("#add_template_password").val();
|
||||
var isPublic = thisDialog.find("#add_template_public").val();
|
||||
var osType = thisDialog.find("#add_template_os_type").val();
|
||||
|
||||
var moreCriteria = [];
|
||||
if(thisDialog.find("#add_template_featured_container").css("display")!="none") {
|
||||
var isFeatured = thisDialog.find("#add_template_featured").val();
|
||||
moreCriteria.push("&isfeatured="+isFeatured);
|
||||
}
|
||||
|
||||
//middle menu spinning wheel....
|
||||
|
||||
$.ajax({
|
||||
data: createURL("command=registerTemplate&name="+encodeURIComponent(name)+"&displayText="+encodeURIComponent(desc)+"&url="+encodeURIComponent(url)+"&zoneid="+zoneId+"&ispublic="+isPublic+moreCriteria.join("")+"&format="+format+"&passwordEnabled="+password+"&osTypeId="+osType+"&response=json"),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var result = json.registertemplateresponse;
|
||||
debugger;
|
||||
//spinning wheel disappear
|
||||
},
|
||||
error: function(XMLHttpResponse) {
|
||||
debugger;
|
||||
|
||||
}
|
||||
});
|
||||
},
|
||||
"Cancel": function() {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}).dialog("open");
|
||||
return false;
|
||||
});
|
||||
|
||||
//edit button ***
|
||||
var $readonlyFields = $detailsTab.find("#name, #displaytext, #passwordenabled, #ispublic, #isfeatured, #ostypename");
|
||||
var $editFields = $detailsTab.find("#name_edit, #displaytext_edit, #passwordenabled_edit, #ispublic_edit, #isfeatured_edit, #ostypename_edit");
|
||||
$("#edit_button").bind("click", function(event){
|
||||
$readonlyFields.hide();
|
||||
$editFields.show();
|
||||
$(this).hide();
|
||||
$editFields.show();
|
||||
$("#cancel_button, #save_button").show()
|
||||
return false;
|
||||
});
|
||||
$("#cancel_button").bind("click", function(event){
|
||||
$editFields.hide();
|
||||
$readonlyFields.show();
|
||||
$("#save_button, #cancel_button").hide();
|
||||
$("#edit_button").show();
|
||||
$("#save_button, #cancel_button").hide();
|
||||
return false;
|
||||
});
|
||||
$("#save_button").bind("click", function(event){
|
||||
doUpdateTemplate();
|
||||
$editFields.hide();
|
||||
$readonlyFields.show();
|
||||
$("#save_button, #cancel_button").hide();
|
||||
$("#edit_button").show();
|
||||
$("#save_button, #cancel_button").hide();
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
//populate dropdown ***
|
||||
//populate dropdown ***
|
||||
var addTemplateZoneField = $("#dialog_add_template #add_template_zone");
|
||||
if (isAdmin())
|
||||
addTemplateZoneField.append("<option value='-1'>All Zones</option>");
|
||||
$.ajax({
|
||||
data: createURL("command=listZones&available=true"+maxPageSize),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var zones = json.listzonesresponse.zone;
|
||||
if (zones != null && zones.length > 0) {
|
||||
for (var i = 0; i < zones.length; i++) {
|
||||
addTemplateZoneField.append("<option value='" + zones[i].id + "'>" + sanitizeXSS(zones[i].name) + "</option>");
|
||||
g_zoneIds.push(zones[i].id);
|
||||
g_zoneNames.push(zones[i].name);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
data: createURL("command=listOsTypes&response=json"+maxPageSize),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
types = json.listostypesresponse.ostype;
|
||||
if (types != null && types.length > 0) {
|
||||
var osTypeDropdown = $detailsTab.find("#ostypename_edit").empty();
|
||||
for (var i = 0; i < types.length; i++) {
|
||||
var html = "<option value='" + types[i].id + "'>" + types[i].description + "</option>";
|
||||
osTypeDropdown.append(html);
|
||||
if (types != null && types.length > 0) {
|
||||
var osTypeDropdownAdd = $("#dialog_add_template #add_template_os_type");
|
||||
var osTypeDropdownEdit = $detailsTab.find("#ostypename_edit").empty();
|
||||
if(types != null && types.length > 0) {
|
||||
for(var i = 0; i < types.length; i++) {
|
||||
var html = "<option value='" + types[i].id + "'>" + types[i].description + "</option>";
|
||||
osTypeDropdownAdd.append(html);
|
||||
osTypeDropdownEdit.append(html);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -75,6 +149,13 @@ function afterLoadTemplateJSP() {
|
|||
});
|
||||
|
||||
//initialize dialog box ***
|
||||
activateDialog($("#dialog_add_template").dialog({
|
||||
width:450,
|
||||
autoOpen: false,
|
||||
modal: true,
|
||||
zIndex: 2000
|
||||
}));
|
||||
|
||||
activateDialog($("#dialog_copy_template").dialog({
|
||||
width:300,
|
||||
autoOpen: false,
|
||||
|
|
@ -88,28 +169,6 @@ function afterLoadTemplateJSP() {
|
|||
modal: true,
|
||||
zIndex: 2000
|
||||
}));
|
||||
|
||||
//populate zone dropdown excluding source zone ***
|
||||
var addTemplateZoneField = $("#dialog_add_template #add_template_zone");
|
||||
|
||||
// Add default zone
|
||||
if (isAdmin()) {
|
||||
addTemplateZoneField.append("<option value='-1'>All Zones</option>");
|
||||
}
|
||||
$.ajax({
|
||||
data: createURL("command=listZones&available=true"+maxPageSize),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var zones = json.listzonesresponse.zone;
|
||||
if (zones != null && zones.length > 0) {
|
||||
for (var i = 0; i < zones.length; i++) {
|
||||
addTemplateZoneField.append("<option value='" + zones[i].id + "'>" + sanitizeXSS(zones[i].name) + "</option>");
|
||||
g_zoneIds.push(zones[i].id);
|
||||
g_zoneNames.push(zones[i].name);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function templateToMidmenu(jsonObj, $midmenuItem1) {
|
||||
|
|
@ -223,16 +282,16 @@ function templateClearRightPanel() {
|
|||
|
||||
$detailsTab.find("#status").text("");
|
||||
|
||||
setBooleanField(null, $detailsTab.find("#passwordenabled"));
|
||||
$detailsTab.find("#passwordenabled").text("");
|
||||
$detailsTab.find("#passwordenabled_edit").val(null);
|
||||
|
||||
setBooleanField(null, $detailsTab.find("#ispublic"));
|
||||
$detailsTab.find("#ispublic").text("");
|
||||
$detailsTab.find("#ispublic_edit").val(null);
|
||||
|
||||
setBooleanField(null, $detailsTab.find("#isfeatured"));
|
||||
$detailsTab.find("#isfeatured").text("");
|
||||
$detailsTab.find("#isfeatured_edit").val(null);
|
||||
|
||||
setBooleanField(null, $detailsTab.find("#crossZones"));
|
||||
$detailsTab.find("#crossZones").text("");
|
||||
|
||||
$detailsTab.find("#ostypename").text("");
|
||||
$detailsTab.find("#ostypename_edit").val(null);
|
||||
|
|
|
|||
Loading…
Reference in New Issue