#*
 * 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.ajax.utils.js"></script>
		<script type="text/javascript" src="${context}/js/azkaban.jobdetails.view.js"></script>
		<script type="text/javascript">
			var contextURL = "${context}";
			var currentTime = ${currentTime};
			var timezone = "${timezone}";
			var errorMessage = null;
			var successMessage = null;
			
			var projectName = "${projectName}";
			var flowName = "${flowid}";
			var execId = "${execid}";
			var jobId = "${jobid}";
			var attempt = ${attempt};
		</script>
	</head>
	<body>

#set ($current_page="executing")
#parse ("azkaban/webapp/servlet/velocity/nav.vm")

		<div class="container">

## Page error or success message.

#if ($errorMsg)
			<div class="panel panel-danger">
				<div class="panel-heading">Error</div>
				<div class="panel-body">
					$errorMsg
				</div>
			</div>
#else
	#if ($error_message != "null")
			<div class="alert alert-danger">$error_message</div>
	#elseif ($success_message != "null")
			<div class="alert alert-success">$success_message</div>
	#end

		</div>

	## Page header.

		<div class="az-page-header">
			<div class="container">
				<h1><a href="${context}/executor?execid=${execid}&job=${jobid}">Job Execution <small>$jobid</small></a></h1>
			</div>
		</div>
	
	## Breadcrumb

		<div class="container">
			<ol class="breadcrumb">
				<li><a href="${context}/manager?project=${projectName}"><strong>Project</strong> $projectName</a></li>
				<li><a href="${context}/manager?project=${projectName}&flow=${flowid}"><strong>Flow</strong> $flowid</a></li>
				<li><a href="${context}/executor?execid=${execid}#jobslist"><strong>Execution</strong> $execid</a></li>
        <li class="active"><strong>Job</strong> $jobid</li>
			</ol>
			
      <div class="row">
				<div class="col-lg-8">
					<ul class="nav nav-pills" id="headertabs">
            <li id="jobSummaryViewLink"><a href="#jobsummary">Summary</a></li>
            <li id="jobLogViewLink"><a href="#joblog">Log</a></li>
            <li><a href="${context}/pigvisualizer?execid=${execid}&jobid=${jobid}">Visualization</a></li>
					</ul>
				</div>
				<div class="col-lg-4">
					<div class="pull-right">
            <a href="${context}/manager?project=${projectName}&flow=${flowid}&job=$jobid" class="btn btn-default">Job Properties</a>
					</div>
					<div class="clearfix"></div>
				</div>
			</div>

	## Log content.

			<div class="row" id="jobLogView">
				<div class="col-lg-12">
					<div class="panel panel-default">
						<div class="panel-heading">
							<div class="pull-right">
								<button type="button" id="updateLogBtn" class="btn btn-xs btn-default">Refresh</button>
							</div>
							Job Logs
						</div>
						<div class="panel-body">
							<pre id="logSection" class="log"></pre>
						</div>
					</div>
				</div>
			</div>

	## Job Summary
			<div id="jobSummaryView" class="row">
				<div class="col-lg-12">
					<table id="commandTable" class="table table-striped table-bordered table-hover">
					</table>
				
					<div class="panel panel-default" id="jobsummary">
						<div class="panel-heading">Job Summary</div>
						<table class="table table-striped table-bordered table-hover">
							<thead id="summaryHeader">
							</thead>
							<tbody id="summaryBody">
							</tbody>
						</table>
					</div>
				
					<div class="panel panel-default" id="jobstats">
						<div class="panel-heading">Job Stats</div>
						<table class="table table-striped table-bordered table-hover table-condensed">
							<thead id="statsHeader">
							</thead>
							<tbody id="statsBody">
							</tbody>
						</table>
					</div>
					
					<div class="panel panel-default" id="hiveTable">
						<div class="panel-heading">Job Summary</div>
						<table class="table table-striped table-bordered table-hover">
							<thead id="hiveTableHeader">
							</thead>
							<tbody id="hiveTableBody">
							</tbody>
						</table>
					</div>
				</div>
			</div>
			
	## Error message message dialog.

			<div class="modal fade" id="messageDialog">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header" id="messageTitle">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
							<h4 class="modal-title">Error</h4>
						</div>
						<div class="modal-body" id="messageDiv">
							<p id="messageBox"></p>
						</div>
					</div>
				</div>
			</div>

#end

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