<!--
   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.
-->

<h2>Status</h2>
<table class="table table-bordered table-striped" class="col-md-6">
    <tbody>
    <tr>
        <td>Rpc port</td>
        <td>{{$ctrl.overview.jmx.RpcPort}}</td>
    </tr>
    <tr>
        <td>OM Id</td>
        <td>{{$ctrl.role.Id}}</td>
    </tr>
    <tr>
        <td>Current-Role</td>
        <td>{{$ctrl.role.Role}}</td>
    </tr>
    <tr>
        <td>Group-Id</td>
        <td>{{$ctrl.role.GroupId}}</td>
    </tr>
    <tr ng-hide="!$ctrl.electionCount.Count || $ctrl.electionCount.Count==-1">
        <td>Election-Count</td>
        <td>{{$ctrl.electionCount.Count}}</td>
    </tr>
    <tr ng-hide="!$ctrl.elapsedTime.Value || $ctrl.elapsedTime.Value==-1">
        <td>Last Election Elapsed Time</td>
        <td>{{$ctrl.elapsedTime.Value}}</td>
    </tr>
    </tbody>
</table>

<h2>OM Roles (HA)</h2>
<h4 ng-show="$ctrl.overview.jmx.RatisRoles.length == 1 && $ctrl.overview.jmx.RatisRoles[0].length == 1">{{$ctrl.overview.jmx.RatisRoles[0][0]}}</h4>
<div ng-show="$ctrl.overview.jmx.RatisRoles.length > 1">
    <table class="table table-striped table-bordered" class="col-md-6">
        <thead>
        <tr>
            <th>Host Name</th>
            <th>Node ID</th>
            <th>Ratis Port</th>
            <th>Role</th>
            <th>Leader Readiness</th>
        </tr>
        </thead>
        <tbody ng-repeat="roles in $ctrl.overview.jmx.RatisRoles">
        <tr class="om-roles-background" ng-if="$ctrl.role.Id == roles[1]">
            <td>{{roles[0]}}</td>
            <td>{{roles[1]}}</td>
            <td>{{roles[2]}}</td>
            <td>{{roles[3]}}</td>
            <td>{{roles[4]}}</td>
        </tr>
        <tr ng-if="$ctrl.role.Id != roles[1]">
            <td>{{roles[0]}}</td>
            <td>{{roles[1]}}</td>
            <td>{{roles[2]}}</td>
            <td>{{roles[3]}}</td>
            <td>{{roles[4]}}</td>
        </tr>
        </tbody>
    </table>
</div>


<h2>Meta-Data Volume Information</h2>
<table class="table table-bordered table-striped" class="col-md-6">
    <tbody>
    <tr>
        <td>Ratis Log directory</td>
        <td>{{$ctrl.overview.jmx.RatisLogDirectory}}</td>
    </tr>
    <tr>
        <td>RocksDB Directory</td>
        <td>{{$ctrl.overview.jmx.RocksDbDirectory}}</td>
    </tr>
    </tbody>
</table>
