#*
 * 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/jquery.twbsPagination.min.js"></script>

  <script type="text/javascript" src="${context}/js/azkaban/util/ajax.js"></script>
  <script type="text/javascript" src="${context}/js/azkaban/model/job-log.js"></script>
  <script type="text/javascript" src="${context}/js/azkaban/view/job-details.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};

    var attemptPageSettings = {
      projectName: "${projectName}",
      flowId: "${flowid}",
      attempt: ${attempt},
      pastAttempts: ${pastAttempts},
    };

    $(function () {
      initAttemptPage(attemptPageSettings);
    });
  </script>
</head>
<body>

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

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

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

  ## Log content.

  <div class="container-full container-fill" id="jobLogView">
    <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-default">Refresh
                </button>
              </div>
              Job Logs
            </div>
            <div class="panel-body">
              <pre id="logSection"></pre>
            </div>
          </div>
        </div>
      </div>
    </div>
    <ul id="attemptsPagination" class="pagination"></ul>
  </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>
      </div>
    </div>

  </div>
  #end
</body>
</html>