<!DOCTYPE html>

<%@ include file="EgTrackerA.jsp" %>
<%@ include file="listSearchJson.jsp" %>
<%@ taglib prefix="egui" uri="../WEB-INF/eg-taglib.tld"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>

<%
	response.setHeader("Cache-Control","no-store");
	response.setHeader("Pragma","no-cache");
	response.setDateHeader("Expires", -1);
	
	String reqfrom = request.getParameter("reqfrom");
	if(reqfrom == null)
		reqfrom = "";
	com.eg.EgServicesInfo servicesInfo = new com.eg.EgServicesInfo("manager");
	boolean isAllowHostName = servicesInfo.isAllowHostNames();

	String selCategory = request.getParameter("category");
	String selCompType = request.getParameter("comptype");
	if (selCategory == null)
		selCategory = "-1";

	if (selCompType == null)
		selCompType = "-1";

	String showOverviewBackButton = request.getParameter("showOverviewBackButton");
	showOverviewBackButton=(showOverviewBackButton != null && showOverviewBackButton.equals("yes"))?"true":"false";

	// for limited components
	String fromWizard = request.getParameter("fromWizard");
	if(com.egurkha.util.StringUtils.isNull(fromWizard))
	{
		fromWizard = "";
	}

	String compGlanceCompType = request.getParameter("compGlanceCompType");
	if(com.egurkha.util.StringUtils.isNull(compGlanceCompType))
	{
		compGlanceCompType = "";
	}
	if(!reqfrom.equalsIgnoreCase("agg_show_types") && request.getQueryString()!= null)
	{
		session.setAttribute("redirectPageURL","/final/admin/aggDispServer.jsp?"+request.getQueryString());
	}
%>

<html>
<head>
	<meta charset="utf-8">
	<title>Components List</title>

	<egui:skin ui="admin"/>

	<script type="text/javascript" src="../extjs/ext-all.js"></script>

	<!-- Fancy Scroll-->
	<script src="/final/jquery/jquery.js"></script>
	<script src="/final/styles/jscrollpane/jquery.jscrollpane.js" ></script>
	<script src="/final/styles/jscrollpane/jquery.mousewheel.js" ></script>
	<script src="/final/styles/jscrollpane/mwheelIntent.js" ></script>
	<script src="/final/scripts/utilities/EncodeDecodeParams.js"></script>
	<link rel="stylesheet" href="/final/styles/jscrollpane/jquery.jscrollpane.css"/>

	<script language="JavaScript1.2" src="eg_scripts/validate.js"></script>
	<script language="JavaScript1.2" src="../scripts/<%=script_src%>"></script>
	<!-- Application folder -->
	<script type="text/javascript" src="AggregateComponent/app/app.js"></script>
	<script language="JavaScript1.2">
	var csrfToken = '<%=strCsrfToken%>';
	var pageDesc = '<egui:intnl description="aggDispServer.jsp"/>';
	//var pageDesc2 = '<egui:intnl description="EgChangeIP.jsp"/>';
	var pageTitle = '<egui:intnl text="admin.server.Aggregate Components"/>';
	var testsAndMeasures = '<egui:intnl text="admin.server.Show Tests and Measures"/>';
	var addButtonText = '<egui:intnl text="admin.server.Add New Aggregate Component"/>';
	var noCompTypeSelectedAlert = '<egui:intnl text="admin.server.Please select an aggregate component type"/>';
	var noCompsAlert = '<egui:intnl text="admin.server.No managed aggregate components found for the chosen component type"/>';
	var srcNotFnd = '<egui:intnl text="admin.server.No managed aggregate components found for your current search"/>';
	var publicJSON = '';
	var ctrler = '';
	var categoryChosen = '<%=selCategory%>';
	var compTypeChosen = '<%=selCompType%>';
	var showOverviewBackButton = '<%=showOverviewBackButton%>';
	var isAllowHostName='<%=isAllowHostName%>';
	var oraAlert1 = '<egui:intnl text="admin.server.The following Oracle components have not been configured yet"/>';
	var oraAlert2 = '<egui:intnl text="admin.server.Please configure SID for these components"/>';
	
	var label_ShowCompTypeOnly = '<egui:intnl text="admin.server.Show managed component types only"/>';
	var label_Category = '<egui:intnl text="admin.server.Category"/>';
	var label_CompTyep = '<egui:intnl text="admin.server.Aggregate component type"/>';
	var label_HostIP = '<egui:intnl text="admin.server.Host IP/Name"/>';
	//var label_associations = '<egui:intnl text="admin.server.Associations"/>';
	//var label_Monitoring = '<egui:intnl text="admin.server.Monitoring"/>';
	var label_Component = '<egui:intnl text="admin.server.Nick name"/>';
	//var label_changeIPText = '<egui:intnl text="admin.server.New Host IP"/>';
	var label_Back = '<egui:intnl text="admin.common.Back"/>';
	//if (isAllowHostName)
	//{
		//label_changeIPText = '<egui:intnl text="admin.server.New Host IP/Name"/>';
	//}
	var changeIPAlrtMsg1 = '<egui:intnl text="admin.server.The old host IP is also associated with the following component(s)"/>.&nbsp;<egui:intnl text="admin.server.Select the components to which the new host IP is to be assigned"/>';
	var changeIPAlrtMsg2 = '<egui:intnl text="admin.server.Since the nick name and host IP combination is used by the following component types too, the new host IP will be automatically assigned to them"/>';
	var label_Update = '<egui:intnl text="admin.common.Update"/>';
	var label_Cancel = '<egui:intnl text="admin.common.Cancel"/>';
	var updating = '<egui:intnl text="admin.common.Updating"/>';
	var plsWait = '<egui:intnl text="admin.common.Please wait"/>';
	var alertMsg32 = '<egui:intnl text="admin.server.Please enter the host IP"/>';
	var alertMsg33 = '<egui:intnl text="admin.server.Please enter the host IP/Name"/>';
	var alertMsg34 = '<egui:intnl text="admin.server.Old host IP and new host IP are same"/>';
	var alertMsg35 = '<egui:intnl text="admin.server.Old host IP/Name and new host IP/Name are same"/>';
	var alertMsg36 = '<egui:intnl text="admin.server.Please choose a aggregate component type"/>';

	var probsErrorMessage = '<egui:intnl text="admin.error.Problem encountered while loading the user interface"/>.';
	var requestTimeOut = '<egui:intnl text="admin.error.Response timed out"/>';
	var errorTitle = '<egui:intnl text="admin.user.Error"/>';

	var intnlLabel10 = '<egui:intnl text="admin.server.Show Associated Components"/>';
	var intnlLabel11 = '<egui:intnl text="admin.server.Hide Associated Components"/>';
	var LoadAlert1 = '<div class="egFlexCenterByColumnWise" style="height:100%"><div class="iconInformation"></div><div class="commonErrorMsgText" id="noCompAlrtDiv">'+noCompsAlert+'.</div></div>';

	// popup variables
	//var popupLabel = '<egui:intnl text="admin.server.AGGREGATE TESTS AND MEASURES"/>';
	var intnlLabel5 = '<egui:intnl text="No aggregate tests associated" />';
	var testsCountLabel = '<egui:intnl text="admin.infrastructure.Total Aggregate Tests : "/>';
	var agg_measures_count = '<egui:intnl text="admin.common.Measures count"/>';
	var agg_test_name = '<egui:intnl text="admin.common.Aggregate test and measures"/>';
	var intnlLabel12 = '<egui:intnl text="admin.server.Show Measures"/>';
	var intnlLabel13 = '<egui:intnl text="admin.server.Hide Measures"/>';

	var associatedEntitiesTitle1 = '<egui:intnl text="admin.common.Entities"/>';
	var associatedEntitiesTitle2 = '<egui:intnl text="admin.common.Affected Entities"/>';

	// wizard design starts...
	var fromWizard = '<%=fromWizard%>';
	var compGlanceCompType = '<%=compGlanceCompType%>';
	var homeTitle = '<div>'+pageTitle+' <img src="/final/images/spacer.gif" id="homeTitle" class="iconInfoCircle" style="vertical-align:text-top;position:relative;top:2px"/></div>';
	//var createZoneTitle = '<div>'+pageTitle+' <img src="/final/images/spacer.gif" id="createZoneTitle" class="iconInfoCircle" style="vertical-align:text-top;position:relative;top:2px"/></div>';
	//var childPageTitle = '<div>'+subPageTitle+' <img src="/final/images/spacer.gif" id="childPageTitle" class="iconInfoCircle" style="vertical-align:text-top;position:relative;top:2px"/></div>';
	var reqfrom = '<%=reqfrom%>';

	// wizard design ends..

	var publicJsonCopy = null;
	Ext.onReady(function(){
		Ext.Ajax.extraParams = {"com.eg.CSRF_NONCE" : csrfToken};
		Ext.data.Connection.prototype.extraParams = {"com.eg.CSRF_NONCE" : csrfToken};
		Ext.data.ScriptTagProxy.prototype.extraParams = {"com.eg.CSRF_NONCE" : csrfToken};

		Ext.Ajax.on('requestexception', function (conn, response, options) {
			var errorStr = response.responseText;
			if (errorStr != undefined && errorStr != 'undefined' && errorStr.indexOf("customerror") != -1)
			{
				if (errorStr.indexOf("user-session-invalid") != -1)
				{
					callWindow(1);
				}
				else if (errorStr.indexOf("user-deleted") != -1)
				{
					callWindow(2);
				}
				else if (errorStr.indexOf("user-timedout") != -1)
				{
					callWindow(3);
				}
			}
			else
			{
				if (response.status == 302 || (response.timedout != undefined && response.timedout == true))
				{
					Ext.Msg.show({
						title : errorTitle,
						msg : requestTimeOut,
						buttons : Ext.Msg.OK,
						icon : 'iconError'
					});
				}
				else
				{
					console.log(response.responseText);
					Ext.Msg.show({
						title : errorTitle,
						msg : probsErrorMessage,
						buttons : Ext.Msg.OK,
						icon : 'iconError'
					});
				}
			}
		});
	});

	</script>
</head>
<BODY>
	<div id="loadmask" class="x-mask-msg x-layer x-mask-msg-default" style="z-index: 19001;left:45%;top:35%;"><div class="x-mask-loading" style="position:relative">Loading...</div></div>
</BODY>
</html>
<%

	if (com.egurkha.util.StringUtils.isNull(fromWizard))
	{
		if(request.getQueryString()!= null)
		{
			session.setAttribute("adminLastAccessedURL","/final/admin/EgAggregateTree.jsp?"+request.getQueryString());
		}
		else
		{
			session.setAttribute("adminLastAccessedURL","/final/admin/EgAggregateTree.jsp");
		}
	}
%>



