#*
 * Copyright 2012 LinkedIn Corp.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
*#

<!DOCTYPE html> 
<html lang="en">
	<head>
		
#parse ("azkaban/webapp/servlet/velocity/style.vm")
#parse ("azkaban/webapp/servlet/velocity/javascript.vm")

		<script type="text/javascript" src="${context}/js/azkaban.jmx.view.js"></script>
		<script type="text/javascript">
			var contextURL = "${context}";
			var currentTime = ${currentTime};
			var timezone = "${timezone}";
			var errorMessage = null;
			var successMessage = null;
		</script>
	</head>
	<body>
		
#set ($current_page="all")
#set ($counter = 0)
#parse ("azkaban/webapp/servlet/velocity/nav.vm")

		<div class="container-full">
			
#if ($errorMsg)
  #parse ("azkaban/webapp/servlet/velocity/errormsg.vm")
#end

		</div>

		<div class="az-page-header">
			<div class="container-full">
				<h1>Admin JMX Http Page</h1>
			</div>
		</div>

		<div class="container-full">

## Web Client JMX 

			<div class="row">
				<div class="col-lg-12">
					<div class="panel panel-default">
						<div class="panel-heading">Web Client JMX</div>
						<table id="all-jmx" class="table table-condensed table-bordered table-striped table-hover">
							<thead>
								<tr>
									<th>Name</th>
									<th>Domain</th>
									<th>Canonical Name</th>
									<th></th>
								</tr>
							</thead>
							<tbody>
#foreach ($bean in $mbeans)
							<tr>
								<td>${bean.keyPropertyList.get("name")}</td>
								<td>${bean.domain}</td>
								<td>${bean.canonicalName}</td>
								<td><button type="button" class="btn btn-default btn-sm query-btn" id="expandBtn-$counter" domain="${bean.domain}" name="${bean.keyPropertyList.get("name")}">Query</button></td>
							</tr>

							<tr class="childrow" id="expandBtn-${counter}-child"  style="display: none;">
								<td class="expandedFlow" colspan="3">
									<table class="table table-condensed table-bordered table-striped table-hover">
										<thead>
											<tr>
												<th>Attribute Name</th>
												<th>Value</th>
											</tr>
										</thead>
										<tbody id="expandBtn-${counter}-tbody">
										</tbody>
									</table>
								</td>

								<td>
									<button type="button" class="btn btn-default btn-sm collapse-btn">Collapse</button>
								</td>
							</tr>
	#set ($counter = $counter + 1)
#end
							</tbody>
						</table>

					</div>
				</div>
			</div>
			
#foreach ($executor in $executorRemoteMBeans.entrySet())
			<div class="row">
				<div class="col-lg-12">
					<div class="panel panel-default">
						<div class="panel-heading">Remote Executor JMX $executor.key</div>
						<table class="remoteJMX table table-striped table-condensed table-bordered table-hover">
							<thead>
								<tr>
									<th>Name</th>
									<th>Domain</th>
									<th>Canonical Name</th>
									<th></th>
								</tr>
							</thead>
							<tbody>
	#foreach ($bean in $executor.value)
								<tr>
									<td>${bean.get("keyPropertyList").get("name")}</td>
									<td>${bean.get("domain")}</td>
									<td>${bean.get("canonicalName")}</td>
									<td><button type="button" class="btn btn-default btn-sm query-btn" id="expandBtn-$counter" domain="${bean.get("domain")}" name="${bean.get("keyPropertyList").get("name")}" hostport="$executor.key">Query</button></td>
								</tr>
								<tr class="childrow" id="expandBtn-${counter}-child"  style="display: none;">
									<td class="expandedFlow" colspan="3">
										<table class="table table-striped table-condensed table-bordered table-hover">
											<thead>
												<tr>
													<th>Attribute Name</th>
													<th>Value</th>
												</tr>
											</thead>
											<tbody id="expandBtn-${counter}-tbody">
											</tbody>
										</table>
									</td>

									<td>
										<button type="button" class="btn btn-default btn-sm collapse-btn">Collapse</button>
									</td>
							</tr>
		#set ($counter = $counter + 1)
	#end 
							</tbody>
						</table>
					</div>
				</div>
			</div>
#end
			
#foreach ($triggerserver in $triggerserverRemoteMBeans.entrySet())
			<div class="row">
				<div class="col-lg-12">
					<div class="panel panel-default">
						<div class="panel-heading">Remote Trigger Server JMX $triggerserver.key</div>
						<table class="remoteJMX table table-condensed table-striped table-bordered table-hover">
							<thead>
								<tr>
									<th>Name</th>
									<th>Domain</th>
									<th>Canonical Name</th>
									<th></th>
								</tr>
							</thead>
							<tbody>
	#foreach ($bean in $triggerserver.value)
								<tr>
									<td>${bean.get("keyPropertyList").get("name")}</td>
									<td>${bean.get("domain")}</td>
									<td>${bean.get("canonicalName")}</td>
									<td><button type="button" class="btn btn-default btn-sm querybtn" id="expandBtn-$counter" domain="${bean.get("domain")}" name="${bean.get("keyPropertyList").get("name")}" hostport="$triggerserver.key">Query</button></td>
								</tr>
								<tr class="childrow" id="expandBtn-${counter}-child"  style="display: none;">
									<td class="expandedFlow" colspan="3">
										<table class="table table-striped table-condensed table-bordered table-hover">
											<thead>
												<tr>
													<th>Attribute Name</th>
													<th>Value</th>
												</tr>
											</thead>
											<tbody id="expandBtn-${counter}-tbody">
											</tbody>
										</table>
									</td>

									<td>
										<button type="button" class="btn btn-default btn-sm collapse-btn">Collapse</button>
									</td>
							</tr>
		#set ($counter = $counter + 1)
	#end 
							</tbody>
						</table>

					</div>
				</div>
			</div>
#end

#parse ("azkaban/webapp/servlet/velocity/footer.vm")
		</div>
	</body>
</html>
