#*
 * Copyright 2012 LinkedIn, Inc
 * 
 * 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/style.vm" )
		<script type="text/javascript" src="${context}/js/jquery/jquery.js"></script>    
		<script type="text/javascript" src="${context}/js/jqueryui/jquery-ui.custom.min.js"></script>   
		<script type="text/javascript" src="${context}/js/namespace.js"></script>
		<script type="text/javascript" src="${context}/js/underscore-1.2.1-min.js"></script>
		<script type="text/javascript" src="${context}/js/azkaban.date.utils.js"></script>
		<script type="text/javascript" src="${context}/js/backbone-0.5.3-min.js"></script>
		<script type="text/javascript" src="${context}/js/jquery.simplemodal.js"></script>
		<script type="text/javascript" src="${context}/js/jquery.contextMenu.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.flow.graph.view.js"></script>
		<script type="text/javascript" src="${context}/js/azkaban.exflow.view.js"></script>
		<script type="text/javascript" src="${context}/js/azkaban.exflow.options.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 projectName = "${projectName}";
			var flowName = "${flowid}";
			var execId = "${execid}";
		</script>
		<link rel="stylesheet" type="text/css" href="${context}/css/jquery.contextMenu.custom.css" /> 
	</head>
	<body>
#set($current_page="all")
#parse( "azkaban/webapp/servlet/velocity/nav.vm" )
		<div class="messaging"><p id="messageClose">X</p><p id="message"></p></div>  
		<div class="content">
#if($errorMsg)
				<div class="box-error-message">$errorMsg</div>
#else
#if($error_message != "null")
				<div class="box-error-message">$error_message</div>
#elseif($success_message != "null")
				<div class="box-success-message">$success_message</div>
#end

				<div id="all-jobs-content">
					<div class="section-hd flow-header">
						<h2><a href="${context}/executor?execid=${execid}">Flow Execution <span>$execid</span></a></h2>
						<div class="section-sub-hd">
							<h4><a href="${context}/manager?project=${projectName}">Project <span>$projectName</span></a></h4>
							<h4 class="separator">&gt;</h4>
							<h4><a href="${context}/manager?project=${projectName}&flow=${flowid}">Flow <span>$flowid</span></a></h4>
						</div>
					</div>
					
					<div id="headertabs" class="headertabs">
						<ul>
							<li><a id="graphViewLink" href="#graph">Graph</a></li>
							<li class="lidivider">|</li>
							<li><a id="jobslistViewLink" href="#jobslist">Job List</a></li>
							<li class="lidivider">|</li>
							<li><a id="flowLogViewLink" href="#log">Flow Log</a></li>
						</ul>
						<ul id="actionsBtns" class="buttons">
							<li><div id="pausebtn" class="btn2">Pause</div></li>
							<li><div id="resumebtn" class="btn2">Resume</div></li>
							<li><div id="cancelbtn" class="btn6">Cancel</div></li>
							<li><div id="executebtn" class="btn1">Prepare Execution</div></li>
						</ul>
					</div>
					<div id="graphView">
						<div class="relative">
							<div id="jobList" class="jobList">
								<div id="filterList" class="filterList">
									<input id="filter" class="filter" placeholder="  Job Filter" />
								</div>
								<div id="list" class="list">
								</div>
								<div id="resetPanZoomBtn" class="btn5 resetPanZoomBtn" >Reset Pan Zoom</div>
							</div>
							<div id="svgDiv" class="svgDiv">
								<svg id="svgGraph" class="svgGraph" xmlns="http://www.w3.org/2000/svg" version="1.1" shape-rendering="optimize-speed" text-rendering="optimize-speed" >
								</svg>
							</div>
						</div>
					</div>
					<div id="jobListView" class="executionInfo">
						<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">Logs</th>
								</tr>
							</thead>
							<tbody id="executableBody">
							</tbody>
						</table>
					</div>
					<div id="flowLogView" class="logView">
						<div class="logHeader"><div class="logButtonRow"><div id="updateLogBtn" class="btn7">Refresh</div></div></div>
						<div class="logViewer">
							<pre id="logSection" class="log"></pre>
						</div>
					</div>
				</div>
				
				<div id="flow-status">
					<table class="status">
						<tr><td class="first">Status</td><td id="flowStatus">-</td></tr>
						<tr><td class="first">Submit User</td><td id="submitUser">-</td></tr>
					</table>
					<table class="time">
						<tr><td class="first">Start Time</td><td id="startTime">-</td></tr>
						<tr><td class="first">End Time</td><td id="endTime">-</td></tr>
						<tr><td class="first">Duration</td><td id="duration">-</td></tr>
					</table>
				</div>
						
	            <div id="modalBackground" class="modalBackground2">
	                <div id="executing-options" class="modal modalContainer2">
	                	<a href='#' title='Close' class='modal-close'>x</a>
	                		<h3>Executing Flow Options</h3>
	                		<div>
	                			<ul class="optionsPicker">
	                				<li id="generalOptions">General Options</li>
	                				<li id="flowOptions">Flow Options</li>
	                			</ul>
	                		</div>
	                		<div class="optionsPane">
	                			<div id="generalPanel" class="generalPanel panel">
	                				<div id="completeActions">
	                					<h4>Completion Actions</h4>
		                				<dl>
		                					<dt>Failure Action</dt>
		                					<dd>
		                						<select id="failureAction" name="failureAction">
		                							<option value="finishCurrent">Finish Current Running</option>
		                							<option value="cancelImmediately">Cancel All</option>
		                							<option value="finishPossible">Finish All Possible</option>
		                						</select>
											</dd>
		                					<dt>Failure Email</dt>
		                					<dd>
		                						<textarea id="failureEmails"></textarea>
		                					</dd>
		                					<dt>Notify on Failure</dt>
		                					<dd>
		                						<input id="notifyFailureFirst" class="checkbox" type="checkbox" name="notify" value="first" checked >First Failure</input>
		                						<input id="notifyFailureLast" class="checkbox" type="checkbox" name="notify" value="last">Flow Stop</input>
		                					</dd>
		                					<dt>Success Email</dt>
		                					<dd>
		                						<textarea id="successEmails"></textarea>
		                					</dd>
		                					<dt>Concurrent Execution</dt>
		                					<dd id="executingJob" class="disabled">
		                						<input id="ignore" class="radio" type="radio" name="concurrent" value="ignore" checked /><label class="radioLabel" for="ignore">Run Concurrently</label>
		                						<input id="pipeline" class="radio" type="radio" name="concurrent" value="pipeline" /><label class="radioLabel" for="pipeline">Pipeline</label>
		                						<input id="queue" class="radio" type="radio" name="concurrent" value="queue" /><label class="radioLabel" for="queue">Queue Job</label>
		                					</dd>
		                				</dl>
	                				</div>
	                				<div id="flowPropertyOverride">
	                					<h4>Flow Property Override</h4>
	                					<div class="tableDiv">
		                					<table>
		                						<thead>
		                							<tr>
			                							<th>Name</th>
			                							<th>Value</th>
			                						</tr>
		                						</thead>
		                						<tbody>
		                							<tr id="addRow"><td id="addRow-col" colspan="2"><span class="addIcon"></span><a href="#">Add Row</a></td></tr>
		                						</tbody>
		                					</table>
	                					</div>
	                				</div>
	                			</div>
								<div id="graphPanel" class="graphPanel panel">
									<div id="jobListCustom" class="jobList">
										<div class="filterList">
											<input class="filter" placeholder="  Job Filter" />
										</div>
										<div class="list">
										</div>
										<div class="btn5 resetPanZoomBtn" >Reset Pan Zoom</div>
									</div>
								    <div id="svgDivCustom" class="svgDiv" >
								    	<svg class="svgGraph" xmlns="http://www.w3.org/2000/svg" version="1.1" shape-rendering="optimize-speed" text-rendering="optimize-speed" >
										</svg>
									</div>
		                        </div>
	                        </div>
                    		<div class="actions">
	                                <a class="yes btn1" id="execute-btn" href="#">Execute Now</a>
	                                <a class="no simplemodal-close btn3" id="cancel-btn" href="#">Cancel</a>
	                        </div>
	                </div>
                </div>
#end
		<ul id="jobMenu" class="contextMenu">  
			<li class="open"><a href="#open">Open...</a></li>
			<li class="openwindow"><a href="#openwindow">Open in New Window...</a></li>
		</ul>

		<ul id="disableJobMenu" class="contextMenu flowSubmenu">  
			<li class="openwindow"><a href="#openwindow">Open in New Window...</a></li>
			<li id="disable" class="disable separator"><a href="#disable">Disable</a><div id="disableArrow" class="context-sub-icon"></div></li>
			<ul id="disableSub" class="subMenu">
				<li class="disableAll"><a href="#disableAll">All</a></li>
				<li class="parents"><a href="#disableParents">Parents</a></li>
				<li class="ancestors"><a href="#disableAncestors">All Ancestors</a></li>
				<li class="children"><a href="#disableChildren">Children</a></li>
				<li class="decendents"><a href="#disableDescendents">All Descendents</a></li>
			</ul>
			<li id="enable" class="enable"><a href="#enable">Enable</a> <div id="enableArrow" class="context-sub-icon"></div></li>
			<ul id="enableSub" class="subMenu">
				<li class="enableAll"><a href="#enableAll">All</a></li>
				<li class="parents"><a href="#enableParents">Parents</a></li>
				<li class="ancestors"><a href="#enableAncestors">All Ancestors</a></li>
				<li class="children"><a href="#enableChildren">Children</a></li>
				<li class="decendents"><a href="#enableDescendents">All Descendents</a></li>
			</ul>
		</ul>
		</div>
		
		<div id="messageDialog" class="modal">
			<h3 id="messageTitle">Error</h3>
			<div class="messageDiv">
				<p id="messageBox"></p>
			</div>
		</div>
		
		<div id="invalid-session" class="modal">
			<h3>Invalid Session</h3>
			<p>Session has expired. Please re-login.</p>
			<div class="actions">
				<a class="yes btn2" id="login-btn" href="#">Re-login</a>
			</div>
		</div>
	</body>
</html>

