<script type="text/javascript" src="${context}/js/azkaban.layout.js"></script>
<script type="text/javascript" src="${context}/js/svgNavigate.js"></script>
<script type="text/javascript" src="${context}/js/azkaban.context.menu.js"></script>
<script type="text/javascript" src="${context}/js/azkaban.svg.graph.view.js"></script>
<script type="text/javascript" src="${context}/js/azkaban.flow.execute.view.js"></script>

<div id="modalBackground" class="modalBackground2">
<div id="execute-flow-panel" class="modal modalContainer2">
	<h3 id="execute-flow-panel-title"></h3>
	<a title="Close" class="modal-close closeExecPanel">x</a>
	<div id="execute-message" class="message">
	</div>
	
	<div class="panel">
		<div id="executionGraphOptions">
			<div id="graphOptions" class="sideMenu">
				<h3 id="flowOption" viewpanel="svgDivCustom">Flow View</h3>
				<div>
					<p>Right click on the jobs to disable and enable jobs in the flow.</p>
				</div>
				<h3 viewpanel="notificationPanel">Notification</h3>
				<div>
					<p>Change the addresses where success and failure emails will be sent.</p>
				</div>
				<h3 viewpanel="failureOptions">Failure Options</h3>
				<div>
					<p>Select flow behavior when a failure is detected.</p>
				</div>
				<h3 viewpanel="concurrentPanel">Concurrent</h3>
				<div>
					<p>Change the behavior of the flow if it is already running.</p>
				</div>
				<h3 viewpanel="flowParametersPanel">Flow Parameters</h3>
				<div>
					<p>Add temporary flow parameters that are used to override global properties for each job.</p>
				</div>
			</div>
		</div>
		<div id="executionGraphOptionsPanel" class="rightPanel">
			<div id="svgDivCustom" class="svgDiv sidePanel" >
				<svg class="svgGraph" xmlns="http://www.w3.org/2000/svg" version="1.1" shape-rendering="optimize-speed" text-rendering="optimize-speed" >
				</svg>
			</div>
			<div id="notificationPanel" class="sidePanel">
				<div>
					<h4>Notify on Failure</h4>
					<p>On a job failure, notify on either the first failure, and/or when the failed flow finishes.</p>
					<input id="notifyFailureFirst" class="checkbox" type="checkbox" name="notify" value="first" checked /> <label for="notify">First Failure</label>
					<input id="notifyFailureLast" class="checkbox" type="checkbox" name="notify" value="last"></input> <label for="notify">Flow Finished</label>
					
					<h4>Failure Emails</h4>
					<p>Notify these addresses on failure. Comma, space or semi-colon delimited list.</p>
					<textarea id="failureEmails"></textarea>
				</div>
			
				<div>
					<h4>Success Emails</h4>
					<p>Notify when the flow finishes successfully. Comma, space or semi-colon delimited list.</p>
					<textarea id="successEmails"></textarea>
				</div>
			</div> 
			<div id="failureOptions" class="failureOptions sidePanel">
				<h4>Failure Options</h4>
				<p>When a failure first occurs in the flow, select the execution behavior.</p>
				<ul>
					<li><span class="bold">Finish Current Running</span> finishes only the currently running jobs. It will not start any new jobs.</p></li>
					<li><span class="bold">Cancel All</span> immediately kills all jobs and fails the flow.</p></li>
					<li><span class="bold">Finish All Possible</span> will keep executing jobs as long as its dependencies are met.</p></li>
				</ul>

				<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>
			</div>
			<div id="concurrentPanel" class="sidePanel">
				<h4>Concurrent Execution Options</h4>
				<p>If the flow is currently running, these are the options that can be set.</p>

				<input id="skip" class="radio" type="radio" name="concurrent" value="skip" checked /><label for="skip">Skip Execution</label>
				<p>Do not run flow if it is already running.</p>
				
				<input id="ignore" class="radio" type="radio" name="concurrent" value="ignore" checked /><label for="ignore">Run Concurrently</label>
				<p>Run the flow anyways. Previous execution is unaffected.</p>

				<input id="pipeline" class="radio" type="radio" name="concurrent" value="pipeline" /><label for="pipeline">Pipeline</label>
				<select id="pipelineLevel" name="pipelineLevel">
					<option value="1">Level 1</option>
					<option value="2">Level 2</option>
				</select>
				<p>Pipeline the flow, so the current execution will not be overrun.</p>
				<ul>
					<li>Level 1: block job A until the previous flow job A has completed.</li>
					<li>Level 2: block job A until the previous flow job A's children have completed.</li>
				</ul>
				<!--
				<input id="queue" class="radio" type="radio" name="concurrent" value="queue" /><label for="queue">Queue Job</label>
				<select id="queueLevel" name="queueLevel">
					<option value="1">1</option>
					<option value="2">2</option>
				</select>
				<p>Queue up to 2. Wait until the previous execution has completed before running.</p>
				-->
			</div>
			<div id="flowParametersPanel" class="sidePanel">
				<h4>Flow Property Override</h4>
				<div id="editTable" class="tableDiv">
					<table>
						<thead>
							<tr>
								<th>Name</th>
								<th>Value</th>
							</tr>
						</thead>
						<tbody>
							<tr id="addRow" class="addRow"><td id="addRow-col" colspan="2"><span class="addIcon"></span><a>Add Row</a></td></tr>
						</tbody>
					</table>
				</div>
			</div>
		</div>
	</div>
	
	<div class="actions">
		#if(!$show_schedule || $show_schedule == 'true') 
		<a class="btn2" id="schedule-btn">Schedule</a>
		#end

		<a class="yes btn1" id="execute-btn">Execute</a>
		<a class="no simplemodal-close btn3 closeExecPanel">Cancel</a>
	</div>
</div>
</div>

#if(!$show_schedule || $show_schedule == 'true') 
#parse( "azkaban/webapp/servlet/velocity/schedulepanel.vm" )
#end

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