#*
 * 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>
	<head>

#parse("azkaban/webapp/servlet/velocity/style2.vm")
#parse("azkaban/webapp/servlet/velocity/javascript.vm")

		<script type="text/javascript" src="${context}/js/jqueryui/jquery-ui-1.10.1.custom.js"></script>
		<script type="text/javascript" src="${context}/js/azkaban.common.utils.js"></script>
		<script type="text/javascript" src="${context}/js/azkaban.date.utils.js"></script>
		<script type="text/javascript" src="${context}/js/azkaban.context.menu.js"></script>
		<script type="text/javascript" src="${context}/js/azkaban.ajax.utils.js"></script>
		<script type="text/javascript" src="${context}/js/azkaban.job.status.utils.js"></script>
		<script type="text/javascript" src="${context}/js/azkaban.nav.js"></script>
		<script type="text/javascript" src="${context}/js/azkaban.layout.js"></script>
		<script type="text/javascript" src="${context}/js/azkaban.flow.job.view.js"></script>
		<script type="text/javascript" src="${context}/js/azkaban.svg.graph.view.js"></script>
		<script type="text/javascript" src="${context}/js/azkaban.exflow.view.js"></script>
		<script type="text/javascript" src="${context}/js/svgNavigate.js"></script>
		<script type="text/javascript">
			var contextURL = "${context}";
			var currentTime = ${currentTime};
			var timezone = "${timezone}";
			var errorMessage = null;
			var successMessage = null;;
			var projectId = "${projectId}";
			var projectName = "${projectName}";
			var flowId = "${flowid}";
			var execId = "${execid}";
		</script>
		<link rel="stylesheet" type="text/css" href="${context}/css/azkaban-svg.css">
		<link rel="stylesheet" type="text/css" href="${context}/css/jquery-ui-1.10.1.custom.css">
	</head>
	<body>

#set ($current_page="all")
#set ($show_schedule="false")
#parse ("azkaban/webapp/servlet/velocity/nav2.vm")

		<div class="container">

#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

	## Alert message

			<div class="alert alert-dismissable alert-messaging" id="messaging">
				<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
				<p id="messaging-message"></p>
			</div>

	## Page header

			<div class="page-header">
				<h1>
					<a href="${context}/executor?execid=${execid}">Flow Execution <small>$execid</small></a>
				</h1>
			</div>

	## Breadcrumb
				
			<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}"><strong>Execution</strong> $execid</a></li>
			</ol>
		
	## Flow status
			
			<div class="well">
				<div class="row" id="flow-status">
					<div class="col-lg-6">
						<p><strong>Status</strong> <span id="flowStatus">-</span></p>
						<p><strong>Submit User</strong> <span id="submitUser">-</span></p>
					</div>
					<div class="col-lg-6">
						<p><strong>Start Time</strong> <span id="startTime">-</span></p>
						<p><strong>End Time</strong> <span id="endTime">-</span></p>
						<p><strong>Duration</strong> <span id="duration">-</span></p>
					</div>
				</div>
			</div>

	## Tabs and buttons.

			<div class="row">
				<div class="col-lg-8">
					<ul class="nav nav-pills" id="headertabs">
						<li id="graphViewLink"><a href="#graph">Graph</a></li>
						<li id="jobslistViewLink"><a href="#jobslist">Job List</a></li>
						<li id="flowLogViewLink"><a href="#log">Flow Log</a></li>
					</ul>
				</div>
				<div class="col-lg-4">
					<div class="pull-right">
						<button id="pausebtn" class="btn btn-primary">Pause</button>
						<button id="resumebtn" class="btn btn-primary">Resume</button>
						<button id="cancelbtn" class="btn btn-danger">Cancel</button>
						<button id="retrybtn" class="btn btn-success">Retry Failed</button>
						<button id="executebtn" class="btn btn-success">Prepare Execution</button>
					</div>
					<div class="clearfix"></div>
				</div>
			</div>

	## Graph View

	#parse ("azkaban/webapp/servlet/velocity/flowgraphview.vm")
	
	## Job List View

			<div class="row" id="jobListView">
				<div class="col-lg-12">
					<table class="table table-striped table-bordered">
						<thead>
							<tr>
								<th>Name</th>
								<th class="timeline">Timeline</th>
								<th class="date">Start Time</th>
								<th class="date">End Time</th>
								<th class="elapse">Elapsed</th>
								<th class="status">Status</th>
								<th class="logs">Logs</th>
							</tr>
						</thead>
						<tbody id="executableBody">
						</tbody>
					</table>
				</div>
			</div>

	## Flow Log View

			<div class="row" id="flowLogView">
				<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>
							Flow log
						</div>
						<div class="panel-body">
							<pre id="logSection" class="log"></pre>
						</div>
					</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>

		<div id="contextMenu"></div>

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