#*
 * 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")
#parse("azkaban/webapp/servlet/velocity/svgflowincludes.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/raphael.min.js"></script>
    <script type="text/javascript" src="${context}/js/morris.min.js"></script>

    <script type="text/javascript" src="${context}/js/dust-full-2.2.3.min.js"></script>
    <script type="text/javascript" src="${context}/js/flowsummary.js?version=20161003"></script>
    <script type="text/javascript" src="${context}/js/flowstats-no-data.js"></script>
    <script type="text/javascript" src="${context}/js/flowstats.js"></script>

    <script type="text/javascript" src="${context}/js/azkaban/view/time-graph.js"></script>
    <script type="text/javascript" src="${context}/js/azkaban/util/schedule.js"></script>
    <script type="text/javascript" src="${context}/js/azkaban/view/schedule-sla.js"></script>
    <script type="text/javascript" src="${context}/js/azkaban/view/flow-stats.js"></script>
    <script type="text/javascript" src="${context}/js/azkaban/view/flow-execute-dialog.js"></script>
    <script type="text/javascript" src="${context}/js/azkaban/view/flow.js"></script>
    <script type="text/javascript">
      var contextURL = "${context}";
      var currentTime = ${currentTime};
      var timezone = "${timezone}";
      var errorMessage = null;
      var successMessage = null;

      var projectId = ${project.id};
      var projectName = "${project.name}";
      var flowId = "${flowid}";
      var execId = null;
    </script>
    <link rel="stylesheet" type="text/css" href="${context}/css/morris.css" />
    <link rel="stylesheet" type="text/css" href="${context}/css/bootstrap-datetimepicker.css" />
  </head>
  <body>

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

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

  ## Page header.

    <div class="az-page-header page-header-bare">
      <div class="container-full">
        <div class="row">
          <div class="header-title">
            <h1><a href="${context}/manager?project=${project.name}&flow=${flowid}">Flow <small>$flowid</small></a></h1>
          </div>
          <div class="header-control">
            <div class="pull-right header-form">
              <button type="button" class="btn btn-sm btn-success" id="executebtn">Schedule / Execute Flow</button>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="page-breadcrumb">
      <div class="container-full">
        <ol class="breadcrumb">
          <li><a href="${context}/manager?project=${project.name}"><strong>Project</strong> $project.name</a></li>
          <li class="active"><strong>Flow</strong> $flowid</li>
        </ol>
      </div>
    </div>

    <div class="container-full">

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

  ## Tabs

      <ul class="nav nav-tabs nav-sm" id="headertabs">
        <li id="graphViewLink"><a href="#graph">Graph</a></li>
        <li id="executionsViewLink"><a href="#executions">Executions</a></li>
        <li id="summaryViewLink"><a href="#summary">Summary</a></li>
      </ul>
    </div>

  ## Graph view.

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

  ## Executions view.

    <div class="container-full" id="executionsView">
      <div class="row">
        <div class="col-xs-12">
          <div class="well well-clear well-sm" id="timeGraph">
          </div>

          <table class="table table-striped table-bordered table-condensed table-hover" id="execTable">
            <thead>
              <tr>
                <th>Execution Id</th>
                <th>User</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="action">Action</th>
              </tr>
            </thead>
            <tbody id="execTableBody">
            </tbody>
          </table>
          <ul id="pageSelection" class="pagination">
            <li id="previous" class="first"><a><span class="arrow">&larr;</span>Previous</a></li>
            <li id="page1"><a href="#page1">1</a></li>
            <li id="page2"><a href="#page2">2</a></li>
            <li id="page3"><a href="#page3">3</a></li>
            <li id="page4"><a href="#page4">4</a></li>
            <li id="page5"><a href="#page5">5</a></li>
            <li id="next"><a>Next<span class="arrow">&rarr;</span></a></li>
          </ul>
        </div>
      </div>
    </div><!-- /.container-fill -->

  ## Summary view.

    <div class="container-full" id="summaryView">
      <div id="summary-view-content">
      </div>
      <div id="flow-stats-container">
        <div class="row">
          <div class="col-xs-12">
            <div class="callout callout-info">
              <h4>Analyze last run</h4>
              <p>Analyze the last run for aggregate performance statistics. Note: this may take a few minutes, especially if your flow is large.</p>
              <p>
                <button type="button" id="analyze-btn" class="btn btn-primary">Analyze</button>
              </p>
            </div>
          </div>
        </div><!-- /.col-lg-12 -->
      </div>
    </div><!-- /.container-fill -->

  ## Context menu and the rest of the page.

    <div class="container-full">
      <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")
  #parse ("azkaban/webapp/servlet/velocity/slapanel.vm")
    </div><!-- /.container -->
#end
  </body>
</body>
