<!--
 Licensed to the Apache Software Foundation (ASF) under one or more
 contributor license agreements.  See the NOTICE file distributed with
 this work for additional information regarding copyright ownership.
 The ASF licenses this file to You 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.
-->
<script id="cluster-summary-template" type="text/html">
<table id="cluster-summary-table" class="table compact">
  <thead>
    <tr>
      <th>
        <span data-toggle="tooltip" data-placement="right" title="The version of storm installed on the UI node. (Hopefully, this is the same on all storm nodes!)">
          Version
        </span>
      </th>
      <th>
        <span data-toggle="tooltip" data-placement="top" title="The number of nodes in the cluster currently.">
          Supervisors
        </span>
      </th>
      <th>
        <span data-toggle="tooltip" data-placement="top" title="Total number of Slots. Slots are Workers (processes).">
          Used slots
        </span>
      </th>
      <th>
        <span data-toggle="tooltip" data-placement="top" title="Total number of Slots. Slots are Workers (processes).">
          Free slots
        </span>
      </th>
      <th>
        <span data-toggle="tooltip" data-placement="top" title="Total number of Slots. Slots are Workers (processes).">
          Total slots
        </span>
      </th>
      <th>
        <span data-toggle="tooltip" data-placement="top" title="Executors are threads in a Worker process.">
          Executors
        </span>
      </th>
      <th>
        <span data-toggle="tooltip" data-placement="left" title="A Task is an instance of a Bolt or Spout. The number of Tasks is almost always equal to the number of Executors.">
          Tasks
        </span>
      </th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>
          <div data-toggle="toggle">
            {{#stormVersionInfo}}
            <a toggle="link">{{version}}</a>
            <div toggle="details">
              URL: {{url}}
              </br>Revision: {{revision}}
              </br>Compiled from branch {{branch}} by {{user}} on {{date}}
            </div>
          </div>
          {{/stormVersionInfo}}
          {{#alternativeWorkerVersions}}
          <div data-toggle="toggle">
              Topologies matching {{versionMatch}} will run under <a toggle="link">{{version}}</a>.
              <div toggle="details">
                  URL: {{url}}
                  </br>Revision: {{revision}}
                  </br>Compiled from branch {{branch}} by {{user}} on {{date}}
              </div>
          </div>
          {{/alternativeWorkerVersions}}
      </td>
      <td>{{supervisors}}</td>
      <td>{{slotsUsed}}</td>
      <td>{{slotsFree}}</td>
      <td>{{slotsTotal}}</td>
      <td>{{executorsTotal}}</td>
      <td>{{tasksTotal}}</td>
    </tr>
  </tbody>
</table>
</script>

<script id="nimbus-summary-template" type="text/html">
    <table class="zebra-striped" id="nimbus-summary-table">
        <thead>
        <tr>
            <th>
                <span data-toggle="tooltip" data-placement="right" title="nimbus host name.">Host</span>
            </th>
            <th>
                <span data-toggle="tooltip" data-placement="top" title="Nimbus Thrift port number.">Port</span>
            </th>
            <th>
                <span data-toggle="tooltip" data-placement="top" title="Leader if this host is leader, Not a Leader for all other live hosts,
                note that these hosts may or may not be in leader lock queue, and Dead for hosts that are part of nimbus.seeds list but are not alive.">Status</span>
            </th>
            <th>
                <span data-toggle="tooltip" data-placement="top" title="Storm version this nimbus host is running.">Version</span>
            </th>
            <th>
                <span data-toggle="tooltip" data-placement="left" title="Time since this nimbus host has been running.">Uptime</span>
            </th>
        </tr>
        </thead>
        <tbody>
        {{#nimbuses}}
        <tr>
            <td>{{host}}</td>
            <td><a href="{{nimbusLogLink}}">{{port}}</a></td>
            <td>{{status}}</td>
            <td>{{version}}</td>
            <td>{{nimbusUpTime}}</td>
        </tr>
        {{/nimbuses}}
        </tbody>
    </table>
</script>
<script id="cluster-resources-template" type="text/html">
    <table id="cluster-resources-table" class="table compact">
      <thead>
      <tr>
        <th>
            <span data-toggle="tooltip" data-placement="right" title="Total Available Memory in Cluster in MB.">
              Total Memory (MB)
            </span>
        </th>
        <th>
            <span data-toggle="tooltip" data-placement="right" title="Total Available Memory in Cluster in MB.">
              Total Available Memory (MB)
            </span>
        </th>
        <th>
          <span data-toggle="tooltip" data-placement="right" title="Total Fragmented Memory in Cluster in MB.">
            Total Fragmented Memory (MB)
          </span>
        </th>
        <th>
            <span data-toggle="tooltip" data-placement="top" title="Percent Utilization of Memory Resources in Cluster.">
              Memory Utilization (%)
            </span>
        </th>
        <th>
            <span data-toggle="tooltip" data-placement="top" title="Total CPU Resources in Cluster. Every 100 means 1 core.">
              Total CPU (%)
            </span>
        </th>
        <th>
            <span data-toggle="tooltip" data-placement="top" title="Total Available CPU Resources in Cluster. Every 100 means 1 core.">
              Available CPU (%)
            </span>
        </th>
        <th>
          <span data-toggle="tooltip" data-placement="top" title="Total Fragmented CPU Resources in Cluster. Every 100 means 1 core.">
            Fragmented CPU (%)
          </span>
        </th>
        <th>
            <span data-toggle="tooltip" data-placement="top" title="Percent Utilization of CPU Resources in Cluster.">
             CPU Utilization (%)
            </span>
        </th>
        <th>
        <span data-toggle="tooltip" data-placement="top" title="Total Generic Resources in Cluster.">
             Total Generic Resources
            </span>
        </th>
        <th>
        <span data-toggle="tooltip" data-placement="top" title="Available Generic Resources in Cluster.">
             Available Generic Resources
            </span>
        </th>
      </thead>
      <tbody>
      <tr>
        <td>{{totalMem}}</td>
        <td>{{availMem}}</td>
        <td>{{fragmentedMem}}</td>
        <td>{{memAssignedPercentUtil}}</td>
        <td>{{totalCpu}}</td>
        <td>{{availCpu}}</td>
        <td>{{fragmentedCpu}}</td>
        <td>{{cpuAssignedPercentUtil}}</td>
        <td>{{totalGenerics}}</td>
        <td>{{availGenerics}}</td>
      </tr>
      </tbody>
    </table>
</script>
<script id="owner-summary-template" type="text/html">
  <table class="table table-striped compact" id="owner-summary-table">
    <thead>
    <tr>
      <th>
        Owner
      </th>
      <th>
        <span data-toggle="tooltip" data-placement="top" title="Total number of topologies owned by user.">
          Total Topologies
        </span>
      </th>
      <th>
        <span data-toggle="tooltip" data-placement="top" title="Total number of executors used by user.">
          Total Executors
      </span>
      </th>
      <th>
        <span data-toggle="tooltip" data-placement="top" title="Total number of workers used by user.">
          Total Workers
      </span>
      </th>
      <th>
        <span data-toggle="tooltip" data-placement="top" title="The amount of memory resource (in MB) used by user.">
          Memory Usage (MB)
        </span>
      </th>
      {{#schedulerDisplayResource}}
      <th>
        <span data-toggle="tooltip" data-placement="top" title="The amount of memory resource (in MB) guaranteed to user.">
            Memory Guarantee (MB)
        </span>
      </th>
      <th>
        <span data-toggle="tooltip" data-placement="top" title="The amount of guaranteed memory resources (in MB) remaining.">
          Memory Guarantee Remaining (MB)
        </span>
      </th>
      <th>
          <span data-toggle="tooltip" data-placement="top" title="Total CPU Resource Assigned on behalf of Owner. Every 100 means 1 core.">
           CPU Usage (%)
          </span>
      </th>
      <th>
        <span data-toggle="tooltip" data-placement="top" title="The amount of CPU resource (every 100 means 1 core) guaranteed to user.">
            CPU Guarantee (%)
        </span>
      </th>
      <th>
        <span data-toggle="tooltip" data-placement="top" title="The amount of guaranteed CPU resource (every 100 means 1 core) remaining.">
          CPU Guarantee Remaining (%)
        </span>
      </th>
      <th>
        <span data-toggle="tooltip" data-placement="top" title="The amount of isolated nodes user may use">
          Isolated Nodes Guarantee
        </span>
      </th>
      {{/schedulerDisplayResource}}
    </tr>
    </thead>
    <tbody>
    </tbody>
  </table>
</script>
<script id="topology-summary-template" type="text/html">
  <table class="table table-striped compact" id="topology-summary-table">
    <thead>
      <tr>
        <th>
          <span data-toggle="tooltip" data-placement="right" title="The name given to the topology by when it was submitted. Click the name to view the Topology's information.">
            Name
          </span>
        </th>
        <th>
          <span data-toggle="tooltip" data-placement="top" title="The user that submitted the Topology, if authentication is enabled.">
            Owner
          </span>
        </th>
        <th>
          <span data-toggle="tooltip" data-placement="top" title="The status can be one of ACTIVE, INACTIVE, KILLED, or REBALANCING.">
            Status
          </span>
        </th>
        <th>
          <span data-toggle="tooltip" data-placement="top" title="The time since the Topology was submitted.">
            Uptime
          </span>
        </th>
        <th>
          <span data-toggle="tooltip" data-placement="top" title="The number of Workers (processes).">
            Num workers
          </span>
        </th>
        <th>
          <span data-toggle="tooltip" data-placement="top" title="Executors are threads in a Worker process.">
            Num executors
          </span>
        </th>
        <th>
          <span data-toggle="tooltip" data-placement="top" title="A Task is an instance of a Bolt or Spout. The number of Tasks is almost always equal to the number of Executors.">
            Num tasks
          </span>
        </th>
        <th>
          <span data-toggle="tooltip" data-placement="top" title="Number of nimbus hosts on which this topology's code is replicated. ">
            Replication count
          </span>
        </th>
        <th>
          <span data-toggle="tooltip" data-placement="top" title="Assigned Total Memory by Scheduler.">
            Assigned Mem (MB)
          </span>
        </th>
        {{#schedulerDisplayResource}}
        <th>
          <span data-toggle="tooltip" data-placement="top" title="Assigned Total CPU by Scheduler. Every 100 means 1 core.">
            Assigned CPU (%)
          </span>
        </th>
        {{/schedulerDisplayResource}}
        <th>
          <span data-toggle="tooltip" data-placement="top" title="Assigned Generic Rescources by Scheduler.">
            Assigned Generic Resources
          </span>
        </th>
        <th>
          <span data-toggle="tooltip" data-placement="left" title="This shows information from the scheduler about the latest attempt to schedule the Topology on the cluster.">
            Scheduler Info
          </span>
        </th>
        <th>
          <span data-toggle="tooltip" data-placement="left" title="The version of this topology">
            Topology Version
          </span>
        </th>
        <th>
          <span data-toggle="tooltip" data-placement="left" title="The version of the storm client that this topology request (was launched with)">
            Storm Version
          </span>
        </th>
      </tr>
    </thead>
    <tbody>
      {{#topologies}}
      <tr>
        <td><a href="/topology.html?id={{encodedId}}">{{name}}</a></td>
        <td><a href="/owner.html?id={{owner}}">{{owner}}</a></td>
        <td>{{status}}</td>
        <td>{{uptime}}</td>
        <td>{{workersTotal}}</td>
        <td>{{executorsTotal}}</td>
        <td>{{tasksTotal}}</td>
        <td>{{replicationCount}}</td>
        <td>{{assignedTotalMem}}</td>
        {{#schedulerDisplayResource}}
        <td>{{assignedCpu}}</td>
        {{/schedulerDisplayResource}}
        <td>{{assignedGenericResources}}</td>
        <td>{{schedulerInfo}}</td>
        <td>{{topologyVersion}}</td>
        <td>{{stormVersion}}</td>
      </tr>
      {{/topologies}}
    </tbody>
  </table>
</script>
<script id="supervisor-summary-template" type="text/html">
<table class="table table-striped compact" id="supervisor-summary-table">
  <thead>
    <tr>
      <th>
        <span data-toggle="tooltip" data-placement="right" title="The hostname reported by the remote host. (Note that this hostname is not the result of a reverse lookup at the Nimbus node.)">
          Host
        </span>
      </th>
      <th>
        <span data-toggle="tooltip" data-placement="top" title="A unique identifier given to a Supervisor when it joins the cluster.">
          Id
        </span>
      </th>
      <th>
        <span data-toggle="tooltip" data-placement="top" title="The length of time a Supervisor has been registered to the cluster.">
          Uptime
        </span>
      </th>
      <th>
        <span data-toggle="tooltip" data-placement="top" title="Total number of Slots. Slots are Workers (processes).">
          Slots
        </span>
      </th>
      <th>
        <span data-toggle="tooltip" data-placement="left" title="Total number of Slots. Slots are Workers (processes).">
          Used slots
        </span>
      </th>
      <th>
        <span data-toggle="tooltip" data-placement="left" title="The number of Slots available. Slots are Workers (processes).">
          Avail slots
        </span>
      </th>
      {{#schedulerDisplayResource}}
      <th>
        <span data-toggle="tooltip" data-placement="top" title="The total memory capacity of a supervisor in megabytes.">
          Total Mem (MB)
        </span>
      </th>
      {{/schedulerDisplayResource}}
      <th>
        <span data-toggle="tooltip" data-placement="left" title="The amount of memory that has been allocated in megabytes.">
          Used Mem (MB)
        </span>
      </th>
      {{#schedulerDisplayResource}}
      <th>
        <span data-toggle="tooltip" data-placement="left" title="The amount of Memory available in megabytes.">
          Avail Mem (MB)
        </span>
      </th>
      <th>
        <span data-toggle="tooltip" data-placement="top" title="The total CPU capacity of a supervisor. Every 100 means one core.">
          Total CPU (%)
        </span>
      </th>
      <th>
        <span data-toggle="tooltip" data-placement="left" title="The amount of CPU that has been allocated. Every 100 means one core.">
          Used CPU (%)
        </span>
      </th>
      <th>
        <span data-toggle="tooltip" data-placement="left" title="The amount of CPU that is available. Every 100 means one core.">
          Avail CPU (%)
        </span>
      </th>

      <th>
        <span data-toggle="tooltip" data-placement="left" title="The generic resources capacity of a supervisor.">
          Total Generic Resources
        </span>
      </th>
      <th>
        <span data-toggle="tooltip" data-placement="left" title="The generic resources that have been allocated.">
          Used Generic Resources
        </span>
      </th>
      <th>
        <span data-toggle="tooltip" data-placement="left" title="The generic resources that are available.">
          Avail Generic Resources
        </span>
      </th>

      {{/schedulerDisplayResource}}
      <th>
        <span data-toggle="tooltip" data-placement="left" title="Version">
          Version
        </span>
      </th>
      <th>
        <span data-toggle="tooltip" data-placement="top" title="Whether this supervisor is blacklisted or not">
          Blacklisted
        </span>
      </th>
    </tr>
  </thead>
  <tbody>
    {{#supervisors}}
    <tr>
      <td><a href="/supervisor.html?host={{host}}">{{host}}</a> (<a href="{{logLink}}" title="View log">log</a>)</td>
      <td><a href="/supervisor.html?id={{id}}">{{id}}</a></td>
      <td>{{uptime}}</td>
      <td>{{slotsTotal}}</td>
      <td>{{slotsUsed}}</td>
      <td>{{slotsFree}}</td>
      {{#schedulerDisplayResource}}
      <td>{{totalMem}}</td>
      {{/schedulerDisplayResource}}
      <td>{{usedMem}}</td>
      {{#schedulerDisplayResource}}
      <td>{{availMem}}</td>
      <td>{{totalCpu}}</td>
      <td>{{usedCpu}}</td>
      <td>{{availCpu}}</td>
      <td>{{totalGenericResources}}</td>
      <td>{{usedGenericResources}}</td>
      <td>{{availGenericResources}}</td>
      {{/schedulerDisplayResource}}
      <td>{{version}}</td>
      <td>{{blacklisted}}</td>
    </tr>
    {{/supervisors}}
  </tbody>
</table>
</script>

<script id="configuration-template" type="text/html">
  <table class="table table-striped compact" id="nimbus-configuration-table">
    <thead>
      <tr>
        <th>Key</th>
        <th>Value</th>
    </tr>
    </thead>
    <tbody>
      {{#config}}
      <tr>
        <td>{{key}}</td>
        <td>{{value}}</td>
      </tr>
      {{/config}}
    </tbody>
  </table>
</script>
