<!--
 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>{{stormVersion}}</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="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="Percent Utilization of CPU Resources in Cluster.">
             CPU Utilization (%)
            </span>
        </th>
      </tr>
      </thead>
      <tbody>
      <tr>
        <td>{{totalMem}}</td>
        <td>{{availMem}}</td>
        <td>{{memAssignedPercentUtil}}</td>
        <td>{{totalCpu}}</td>
        <td>{{availCpu}}</td>
        <td>{{cpuAssignedPercentUtil}}</td>
      </tr>
      </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="left" title="This shows information from the scheduler about the latest attempt to schedule the Topology on the cluster.">
            Scheduler Info
          </span>
        </th>
      </tr>
    </thead>
    <tbody>
      {{#topologies}}
      <tr>
        <td><a href="/topology.html?id={{encodedId}}">{{name}}</a></td>
        <td>{{owner}}</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>{{schedulerInfo}}</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>
      {{/schedulerDisplayResource}}
      <th>
        <span data-toggle="tooltip" data-placement="left" title="Version">
          Version
        </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>
      {{/schedulerDisplayResource}}
      <td>{{version}}</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>
