#*
 * 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/azkaban/util/ajax.js"></script>
    <script type="text/javascript" src="${context}/jobsummary/js/azkaban/view/job-summary.js"></script>
    <script type="text/javascript" src="${context}/jobsummary/js/azkaban/model/log-data.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}";
      var jobId = "${jobid}";
      var attempt = ${attempt};
    </script>
  </head>
  <body>

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

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

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

    <div class="container-full" id="jobSummaryView">
      <div class="row">
        <div class="col-lg-12">
          <h3>
            Job Summary
            <div class="pull-right">
              <button type="button" id="update-summary-btn" class="btn btn-xs btn-default">Refresh</button>
            </div>
          </h3>

          <div class="callout callout-default" id="placeholder">
            <h4>Job Summary not available</h4>
            <p>There is no summary information available for this job yet. Try waiting and clicking Refresh.</p>
          </div>

          <div id="job-type">
            <table id="job-type-table" class="table table-striped table-bordered table-hover">
            </table>
          </div>

          <div id="command-summary">
            <h4>Command Summary</h4>
            <table id="command-table" class="table table-striped table-bordered table-hover">
            </table>
          </div>

          <div id="pig-job-summary">
            <h4>Pig Job Summary</h4>
            <table class="table table-striped table-bordered table-hover">
              <thead id="summary-header">
              </thead>
              <tbody id="summary-body">
              </tbody>
            </table>
          </div>

          <div id="pig-job-stats">
            <h4>Pig Job Stats</h4>
            <div class="scrollable">
              <table class="table table-striped table-bordered table-hover table-condensed">
                <thead id="stats-header">
                </thead>
                <tbody id="stats-body">
                </tbody>
              </table>
            </div>
          </div>

          <div id="hive-job-summary">
            <h4>Hive Job Summary</h4>
            <table class="table table-striped table-bordered table-hover" id="hive-table">
              <thead id="hive-table-header">
              </thead>
              <tbody id="hive-table-body">
              </tbody>
            </table>
          </div>

          <div id="job-ids">
            <h4>Map Reduce Jobs</h4>
            <table class="table table-striped table-bordered table-hover">
              <tbody id="job-ids-table-body"></tbody>
            </table>
          </div>
        </div>
      </div>
    </div>

#end
    </div><!-- /.container-full -->
  </body>
</html>
