scheduledflowpage.vm

178 lines | 6.757 kB Blame History Raw Download
#*
 * 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")

  <link rel="stylesheet" type="text/css" href="${context}/css/bootstrap-datetimepicker.css"/>

  <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/azkaban/view/table-sort.js"></script>
  <script type="text/javascript" src="${context}/js/azkaban/view/schedule-sla.js"></script>
  <script type="text/javascript" src="${context}/js/azkaban/view/scheduled.js"></script>
  <script type="text/javascript" src="${context}/js/azkaban/util/schedule.js"></script>
  <script type="text/javascript" src="${context}/js/jquery/jquery.tablesorter.js"></script>
  <script type="text/javascript">
    var contextURL = "${context}";
    var currentTime = ${currentTime};
    var timezone = "${timezone}";
    var errorMessage = null;
    var successMessage = null;

    $(document).ready(function () {
      var flowTable = $("#scheduledFlowsTbl");
      flowTable.tablesorter();
    });
  </script>
</head>
<body>

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

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

  ## Page header.

  <div class="az-page-header">
    <div class="container-full">
      <h1><a href="${context}/schedule">Scheduled Flows</a></h1>
    </div>
  </div>

  ## Page content.

  <div class="container-full">

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

    <div class="row">
      <div class="col-xs-12">
        <i>* Click column headers to sort.</i>
        <table id="scheduledFlowsTbl"
               class="table table-striped table-condensed table-bordered table-hover">
          <thead>
          <tr>
            <!--th class="execid">Execution Id</th-->
            <th>#</th>
            <th>ID</th>
            <th>Flow</th>
            <th>Project</th>
            <th>Submitted By</th>
            <th class="date">First Scheduled to Run</th>
            <th class="date">Next Execution Time</th>
            <th class="date">Repeats Every</th>
            <th class="date">Cron Expression</th>
            <th>Execution Options</th>
            <th>Has SLA</th>
            <th colspan="2" class="action ignoresort">Action</th>
          </tr>
          </thead>
          <tbody>
            #if(!$schedules.isEmpty())
              #foreach($sched in $schedules)
              <tr>
                <td class="tb-name">
                  $velocityCount
                </td>
                <td>${sched.scheduleId}</td>
                <td class="tb-name">
                  <a href="${context}/manager?project=${sched.projectName}&flow=${sched.flowName}">${sched.flowName}</a>
                </td>
                <td>
                  <a href="${context}/manager?project=${sched.projectName}">${sched.projectName}</a>
                </td>
                <td>${sched.submitUser}</td>
                <td>$utils.formatDateTime(${sched.firstSchedTime})</td>
                <td>$utils.formatDateTime(${sched.nextExecTime})</td>
                #if (${sched.period})
                  <td> $utils.formatPeriod(${sched.period})</td>
                #else
                  <td>Not Applicable</td>
                #end
                #if (${sched.cronExpression})
                  <td> ${sched.cronExpression}</td>
                #else
                  <td>Not Applicable</td>
                #end
                <td>
                ## Changed the style of "Show" button to be consistent with other buttons.
                  <button type="button" class="btn btn-sm btn-info" data-toggle="modal"
                          data-target="#executionOptions-${velocityCount}">Show
                  </button>
                </td>

              ## Distinguished executionOptions of each schedule with unique count number to fix
              ## the issue of same display for all schedules
                <div class="modal fade" id="executionOptions-${velocityCount}" tabindex="-1"
                     role="dialog"
                     aria-labelledby="executionOptionsLabel">
                      <div class="modal-dialog" role="document">
                          <div class="modal-content">
                              <div class="modal-header">
                                  <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                  <h4 class="modal-title" id="executionOptionsLabel">Execution Options</h4>
                              </div>
                              <div class="modal-body">
                              ## Used <pre> to display text with code format
                                <pre>${sched.executionOptions.toJSON()}</pre>
                              </div>
                              <div class="modal-footer">
                                  <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                              </div>
                          </div>
                      </div>
                  </div>
                <td>#if(${sched.slaOptions}) true #else false #end</td>
                <td>
                  <button type="button" id="removeSchedBtn" class="btn btn-sm btn-danger"
                          onclick="removeSched(${sched.scheduleId})">Remove Schedule
                  </button>
                </td>
                <td>
                  <button type="button" id="addSlaBtn" class="btn btn-sm btn-primary"
                          onclick="slaView.initFromSched(${sched.scheduleId}, '${sched.flowName}')">
                    Set SLA
                  </button>
                </td>
              </tr>
              #end
            #else
            <tr>
              <td colspan="12">No scheduled flow found.</td>
            </tr>
            #end
          </tbody>
        </table>
      </div><!-- /col-xs-12 -->
    </div><!-- /row -->

  ## Set SLA modal.

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

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