#*
 * 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/moment.min.js"></script>
		<script type="text/javascript" src="${context}/js/bootstrap-datetimepicker.min.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.layout.js"></script>
		<script type="text/javascript" src="${context}/js/azkaban.exflow.view.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/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/bootstrap-datetimepicker.css" />
	</head>
	<body>

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

		<div class="container">
#parse ("azkaban/webapp/servlet/velocity/message.vm")
#if ($errorMsg)
  #parse ("azkaban/webapp/servlet/velocity/errormsg.vm")
#else
  #parse ("azkaban/webapp/servlet/velocity/alerts.vm")
		</div>


	## Page header

		<div class="az-page-header">
			<div class="container" id="flow-status">
        <div class="row">
          <div class="col-lg-7">
            <h1>
              <a href="${context}/executor?execid=${execid}">
                Flow Execution <small>$execid <span id="flowStatus">-</span></small>
              </a>
            </h1>
          </div>
          <div class="col-lg-5">
            <div class="az-exflow-stats">
              <div class="col-md-5">
                <p><strong>Submit User</strong> <span id="submitUser">-</span></p>
                <p><strong>Duration</strong> <span id="duration">-</span></p>
              </div>
              <div class="col-md-7">
                <p><strong>Start Time</strong> <span id="startTime">-</span></p>
                <p><strong>End Time</strong> <span id="endTime">-</span></p>
              </div>
            </div>
            <div class="clearfix"></div>
          </div>
        </div>
			</div>
		</div>

		<div class="container">

	## 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 class="active"><strong>Execution</strong> $execid</li>
			</ol>
		
	## Tabs and buttons.

			<ul class="nav nav-tabs" 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>
				<li class="nav-button pull-right"><button type="button" id="pausebtn" class="btn btn-primary">Pause</button></li>
				<li class="nav-button pull-right"><button type="button" id="resumebtn" class="btn btn-primary">Resume</button></li>
				<li class="nav-button pull-right"><button type="button" id="cancelbtn" class="btn btn-danger">Cancel</button></li>
				<li class="nav-button pull-right"><button type="button" id="retrybtn" class="btn btn-success">Retry Failed</button></li>
				<li class="nav-button pull-right"><button type="button" id="executebtn" class="btn btn-success">Prepare Execution</button></li>
			</ul>

	## 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 table-condensed table-hover executions-table">
						<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">Details</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 log-viewer">
							<pre id="logSection"></pre>
						</div>
					</div>
				</div>
			</div>
	
	## Error message message dialog.

			<div class="modal" 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 class="modal-footer">
							<button type="button" class="btn btn-primary" data-dismiss="modal">Dismiss</button>
						</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>
