mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-10-26 08:42:29 +01:00 
			
		
		
		
	new UI - domain page - remove obsolete code.
This commit is contained in:
		
							parent
							
								
									273313aa25
								
							
						
					
					
						commit
						9e543b2c12
					
				| @ -1,46 +1,21 @@ | |||||||
| function afterLoadDomainJSP() { | function afterLoadDomainJSP() { | ||||||
|     var defaultRootDomainId = g_domainid; |     var defaultRootDomainId = g_domainid; | ||||||
|     var defaultRootLevel = 0;	    |     var defaultRootLevel = 0;	    | ||||||
|     var index = 1;	        |  | ||||||
|     var treeContentBox = $("#midmenu_container");       |  | ||||||
|     var treenodeTemplate = $("#treenode_template");	  	     |  | ||||||
|     var grid = $("#right_panel_grid");   |  | ||||||
|     var gridRowTemplate = $("#grid_row_template");   |  | ||||||
|     var gridContent = grid.find("#grid_content");	 |  | ||||||
| 	var gridHeader = grid.find("#grid_header");	     |  | ||||||
| 	var rightPanelDetailContent = $("#right_panel_detail_content");	 |  | ||||||
| 	var rightPanelSearchResult = $("#right_panel_search_result");		     |  | ||||||
| 	var rightPanelGrid = rightPanelDetailContent.find("#right_panel_grid"); |  | ||||||
| 	var domainDetail = rightPanelDetailContent.find("#domain_detail");	 |  | ||||||
| 	var submenuContent = $("#submenu_content_domains"); |  | ||||||
|     var searchButton = submenuContent.find("#search_button"); |  | ||||||
|     var searchInput = submenuContent.find("#search_input"); |  | ||||||
|     var searchResultsContainer = submenuContent.find("#search_results_container"); |  | ||||||
|     var searchResultTemplate = $("#search_result_template"); |  | ||||||
|     //var breadcrumbBox = submenuContent.find("#breadcrumb_box");
 |  | ||||||
|     //var breadcrumbPieceTemplate = $("#breadcrumb_piece_template");
 |  | ||||||
|     var childParentMap = {};  //map childDomainId to parentDomainId
 |     var childParentMap = {};  //map childDomainId to parentDomainId
 | ||||||
|     var domainIdNameMap = {}; //map domainId to domainName
 |     var domainIdNameMap = {}; //map domainId to domainName
 | ||||||
|      |      | ||||||
|  |     var $treeContentBox = $("#midmenu_container");       | ||||||
|  |     var $treenodeTemplate = $("#treenode_template");	  | ||||||
| 	var $detailsTab = $("#right_panel_content #tab_content_details");    | 	var $detailsTab = $("#right_panel_content #tab_content_details");    | ||||||
| 	var $resourceLimitsTab = $("#right_panel_content #tab_content_resource_limits"); | 	var $resourceLimitsTab = $("#right_panel_content #tab_content_resource_limits"); | ||||||
| 	  			     | 	  			     | ||||||
| 	/* |  | ||||||
| 	activateDialog($("#dialog_resource_limits").dialog({  |  | ||||||
| 		autoOpen: false, |  | ||||||
| 		modal: true, |  | ||||||
| 		zIndex: 2000 |  | ||||||
| 	})); |  | ||||||
| 	*/ |  | ||||||
|   			     |  | ||||||
|     function drawNode(json, level, container) {		   |     function drawNode(json, level, container) {		   | ||||||
|         if("parentdomainid" in json) |         if("parentdomainid" in json) | ||||||
|             childParentMap[json.id] = json.parentdomainid;	 //map childDomainId to parentDomainId   
 |             childParentMap[json.id] = json.parentdomainid;	//map childDomainId to parentDomainId   
 | ||||||
|         domainIdNameMap[json.id] = json.name;           //map domainId to domainName
 |         domainIdNameMap[json.id] = json.name;               //map domainId to domainName
 | ||||||
|      |      | ||||||
|         var template = treenodeTemplate.clone(true);	             |         var template = $treenodeTemplate.clone(true);	             | ||||||
|         template.attr("id", "domain_"+json.id);	          |         template.attr("id", "domain_"+json.id);	          | ||||||
|         //template.data("domainId", json.id).data("domainName", fromdb(json.name)).data("domainLevel", level); 	   
 |  | ||||||
|         template.data("jsonObj", json).data("domainLevel", level); 	       |         template.data("jsonObj", json).data("domainLevel", level); 	       | ||||||
|         template.find("#domain_title_container").attr("id", "domain_title_container_"+json.id); 	         |         template.find("#domain_title_container").attr("id", "domain_title_container_"+json.id); 	         | ||||||
|         template.find("#domain_expand_icon").attr("id", "domain_expand_icon_"+json.id);  |         template.find("#domain_expand_icon").attr("id", "domain_expand_icon_"+json.id);  | ||||||
| @ -104,9 +79,6 @@ function afterLoadDomainJSP() { | |||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| 	function listAdminAccounts(domainId) {   	   	 | 	function listAdminAccounts(domainId) {   	   	 | ||||||
| 	    //gridContent.empty();
 |  | ||||||
| 	    //index = 0;		    
 |  | ||||||
| 	    //rightPanelDetailContent.find("#loading_gridtable").show(); 		
 |  | ||||||
| 	    var accountType = (domainId==1)? 1: 2; 	    		 | 	    var accountType = (domainId==1)? 1: 2; 	    		 | ||||||
| 	    $.ajax({ | 	    $.ajax({ | ||||||
| 			cache: false,				 | 			cache: false,				 | ||||||
| @ -123,12 +95,11 @@ function afterLoadDomainJSP() { | |||||||
| 		                $container.append($newTemplate.show());	 | 		                $container.append($newTemplate.show());	 | ||||||
| 					}				    				 | 					}				    				 | ||||||
| 				} 			          | 				} 			          | ||||||
| 			    //rightPanelDetailContent.find("#loading_gridtable").hide();                  
 |  | ||||||
| 			}		 | 			}		 | ||||||
| 		});		 | 		});		 | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| 	treenodeTemplate.bind("click", function(event) {			      | 	$treenodeTemplate.bind("click", function(event) {			      | ||||||
| 		var template = $(this); | 		var template = $(this); | ||||||
| 		var target = $(event.target); | 		var target = $(event.target); | ||||||
| 		var action = target.attr("id"); | 		var action = target.attr("id"); | ||||||
| @ -236,56 +207,9 @@ function afterLoadDomainJSP() { | |||||||
| 		return false; | 		return false; | ||||||
|     }); |     }); | ||||||
| 		 | 		 | ||||||
| 	/* |  | ||||||
| 	searchResultTemplate.bind("click", function(event) { |  | ||||||
| 	    var template = $(this); |  | ||||||
| 		var target = $(event.target); |  | ||||||
| 		var action = target.attr("id"); |  | ||||||
| 		var id = template.attr("id");	 |  | ||||||
| 		var domainId = template.data("domainId");			 |  | ||||||
| 		if(action=="domain_name") 			     |  | ||||||
| 		    refreshWholeTree(domainId, defaultRootLevel);										 |  | ||||||
| 	}); |  | ||||||
| 	*/ |  | ||||||
| 	 |  | ||||||
| 	/* |  | ||||||
| 	searchButton.bind("click", function(event) { |  | ||||||
| 	    searchResultsContainer.empty();		 |  | ||||||
| 	    rightPanelDetailContent.hide(); |  | ||||||
| 	    rightPanelSearchResult.show();	                	        	 |  | ||||||
|         var keyword = searchInput.val();              |  | ||||||
|         $.ajax({ |  | ||||||
| 	        data: createURL("command=listDomains&keyword="+keyword+"&pageSize=-1"), //pageSize=-1 will return all items (no limitation)
 |  | ||||||
| 	        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++) { |  | ||||||
| 		                var template = searchResultTemplate.clone(true).attr("id", "searchresult"+domains[i].id).data("domainId", domains[i].id); |  | ||||||
| 		                template.find("#domain_name").text(domains[i].name); |  | ||||||
| 		                searchResultsContainer.append(template.show()); |  | ||||||
| 		            } |  | ||||||
| 		        }    				 |  | ||||||
| 	        } |  | ||||||
|         }); 	            	         |  | ||||||
|         return false; |  | ||||||
|     }); |  | ||||||
| 	*/ |  | ||||||
| 	 |  | ||||||
| 	/* |  | ||||||
|     searchInput.bind("keypress", function(event) {		         |  | ||||||
|         if(event.keyCode == keycode_Enter) {                 		         |  | ||||||
|             searchButton.click();			 |  | ||||||
|             return false;      |  | ||||||
|         }		     |  | ||||||
|     });  |  | ||||||
|     */  	     |  | ||||||
| 
 |  | ||||||
| 			 |  | ||||||
| 	//draw root node
 | 	//draw root node
 | ||||||
| 	function drawRootNode(rootDomainId) { | 	function drawRootNode(rootDomainId) { | ||||||
| 	    treeContentBox.empty(); | 	    $treeContentBox.empty(); | ||||||
| 	    $.ajax({ | 	    $.ajax({ | ||||||
| 	        data: createURL("command=listDomains&id="+rootDomainId+"&pageSize=-1"), //pageSize=-1 will return all items (no limitation)
 | 	        data: createURL("command=listDomains&id="+rootDomainId+"&pageSize=-1"), //pageSize=-1 will return all items (no limitation)
 | ||||||
| 	        dataType: "json", | 	        dataType: "json", | ||||||
| @ -293,7 +217,7 @@ function afterLoadDomainJSP() { | |||||||
| 	        success: function(json) {					         | 	        success: function(json) {					         | ||||||
| 	            var domains = json.listdomainsresponse.domain;				        	     | 	            var domains = json.listdomainsresponse.domain;				        	     | ||||||
| 		        if (domains != null && domains.length > 0) {				   					     | 		        if (domains != null && domains.length > 0) {				   					     | ||||||
| 				    var node = drawNode(domains[0], defaultRootLevel, treeContentBox);  | 				    var node = drawNode(domains[0], defaultRootLevel, $treeContentBox);  | ||||||
| 				     | 				     | ||||||
| 				    var treeLevelsbox = node.find(".tree_levelsbox");	//root node shouldn't have margin-left:20px				   
 | 				    var treeLevelsbox = node.find(".tree_levelsbox");	//root node shouldn't have margin-left:20px				   
 | ||||||
| 				    if(treeLevelsbox!=null && treeLevelsbox.length >0) | 				    if(treeLevelsbox!=null && treeLevelsbox.length >0) | ||||||
| @ -303,37 +227,11 @@ function afterLoadDomainJSP() { | |||||||
|         }); 		 |         }); 		 | ||||||
|     }	 |     }	 | ||||||
| 	 | 	 | ||||||
| 	/* |  | ||||||
| 	breadcrumbPieceTemplate.bind("click", function(event) {	 |  | ||||||
| 	    var domainId = $(this).data("domainId");	 |  | ||||||
| 	    refreshWholeTree(domainId); |  | ||||||
| 	}); |  | ||||||
| 	*/ |  | ||||||
| 	 |  | ||||||
| 	//draw breadcrumb all the way up
 |  | ||||||
| 	/* |  | ||||||
| 	function drawBreadcrumb(domainId) {		     |  | ||||||
| 	    var domainName = domainIdNameMap[domainId]; |  | ||||||
| 	    if(domainName == null) |  | ||||||
| 	        return; |  | ||||||
| 	     |  | ||||||
| 	    var onePiece = breadcrumbPieceTemplate.clone(true).attr("id", "breadcrumb_"+domainId).data("domainId", domainId).text(" > "+domainName); |  | ||||||
| 	    breadcrumbBox.prepend(onePiece.show());		     |  | ||||||
| 	     |  | ||||||
| 	    var parentDomainId = childParentMap[domainId]; |  | ||||||
| 	    if(parentDomainId!=null) |  | ||||||
| 	        drawBreadcrumb(parentDomainId); |  | ||||||
| 	} |  | ||||||
| 	*/ |  | ||||||
| 	 |  | ||||||
| 	function refreshWholeTree(rootDomainId, rootLevel) { | 	function refreshWholeTree(rootDomainId, rootLevel) { | ||||||
| 	    drawRootNode(rootDomainId); | 	    drawRootNode(rootDomainId); | ||||||
| 	    drawTree(rootDomainId, (rootLevel+1), $("#domain_children_container_"+rootDomainId));  //draw the whole tree (under root node)			
 | 	    drawTree(rootDomainId, (rootLevel+1), $("#domain_children_container_"+rootDomainId));  //draw the whole tree (under root node)			
 | ||||||
| 	    $("#domain_"+rootDomainId).show();	//show root node
 | 	    $("#domain_"+rootDomainId).show();	//show root node
 | ||||||
| 	    clickExpandIcon(rootDomainId);      //expand root node	    
 | 	    clickExpandIcon(rootDomainId);      //expand root node	    
 | ||||||
| 	     |  | ||||||
| 	    //breadcrumbBox.empty();
 |  | ||||||
| 	    //drawBreadcrumb(rootDomainId);
 |  | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| 	refreshWholeTree(defaultRootDomainId, defaultRootLevel); | 	refreshWholeTree(defaultRootDomainId, defaultRootLevel); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user