#*
 * 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")

#if ($errorMsg)
  #parse ("azkaban/webapp/servlet/velocity/errormsg.vm")
#else

	## Page header

		<div class="az-page-header">
			<div class="container-full" id="flow-status">
        <div class="row">
          <div class="header-title">
            <h1>
              <a href="${context}/executor?execid=${execid}">
                Flow Execution <small>$execid <span id="flowStatus">-</span></small>
              </a>
            </h1>
          </div>
          <div class="header-control">
            <div class="az-exflow-stats">
              <div class="col-xs-5">
                <p><strong>Submit User</strong> <span id="submitUser">-</span></p>
                <p><strong>Duration</strong> <span id="duration">-</span></p>
              </div>
              <div class="col-xs-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-full">

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

	## 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>
    </div>

	## Graph View

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

    <div class="container-full" id="jobListView">
			<div class="row">
				<div class="col-xs-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><!-- /.col-xs-12 -->
      </div><!-- /.row -->
    </div><!-- /.container-full -->

	## Flow Log View

    <div class="container-full container-fill" id="flowLogView">
			<div class="row">
				<div class="col-xs-12 col-content">
          <div class="log-viewer">
            <div class="panel panel-default">
              <div class="panel-heading">
                <div class="pull-right">
                  <button type="button" id="updateLogBtn" class="btn btn-xs btn-info">Refresh</button>
                </div>
                Flow log
              </div>
              <div class="panel-body">
                <pre id="logSection"></pre>
              </div>
            </div><!-- /.panel -->
          </div><!-- /.log-viewer -->
        </div><!-- /.col-xs-12 -->
      </div><!-- /.row -->
    </div><!-- /. -->
	
	## Error message message dialog.

    <div class="container-full">
			<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")
		</div>
#end
	</body>
</html>
