<!--
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.
-->
<div id="overview-controller" ng-controller="QDR.OverviewController" ng-include="tmplOverviewTree"></div>

<script type="text/ng-template" id="overviewGrid.html">
    <div class="gridDetails" ng-include="template.url"></div>
</script>


<!-- the following scripts are content that gets loaded into the above div that has the temple.url -->
<script type="text/ng-template" id="routers.html">
    <div class="row-fluid">
        <h3>Routers</h3>
        <div class="overview">
            <div class="gridStyle" ng-grid="allRouters"></div>
        </div>
    </div>
</script>
<script type="text/ng-template" id="router.html">
    <div class="row-fluid">
        <h3>Router {{router.data.title}} attributes</h3>
        <div class="gridStyle noHighlight" ng-grid="routerGrid"></div>
    </div>
</script>

<script type="text/ng-template" id="addresses.html">
    <div class="row-fluid">
        <h3>Addresses</h3>
        <div class="overview">
            <div class="gridStyle" ng-grid="addressesGrid"></div>
        </div>
    </div>
</script>
<script type="text/ng-template" id="address.html">
    <div class="row-fluid">
        <ul class="nav nav-tabs">
            <li ng-repeat="mode in gridModes" ng-click="selectMode(mode,'Address')" ng-class="{active : isModeSelected(mode,'Address')}" title="{{mode.title}}" ng-bind-html-unsafe="mode.content"> </li>
        </ul>
        <div ng-if="isModeVisible('Address','attributes')" class="selectedItems">
            <h3>Address {{address.data.title}}</h3>
            <div class="gridStyle noHighlight" ng-grid="addressGrid"></div>
        </div>
        <div ng-if="isModeVisible('Address','links')" class="selectedItems">
            <h3>Links for address {{address.data.title}}</h3>
            <div class="gridStyle" ng-grid="linksGrid"></div>
        </div>
    </div>
</script>

<script type="text/ng-template" id="links.html">
    <div class="row-fluid">
        <h3>Links <button type='button' ng-click="filterToggle()" class='btn btn-secondary btn-filter'>Filter</button></h3>
        <div id="linkFilter">
            <div class="filter-title">
                <h6>Filter links</h6>
                <button ng-click="filterToggle()" type="button" class="btn btn-primary filter-close">x</button>
            </div>
            <div class="formLine"><label for="hideConsoles">Hide console links</label><input name="hideConsoles" id="hideConsoles" type="checkbox" ng-model="filter.hideConsoles"/></div>
            <div class="formLine"><label for="endpointOnly">Endpoints only</label><input name="linkTypes" id="endpointOnly" type="radio" ng-model="filter.endpointsOnly" value="true"/>
                <label for="allLinks">All link types</label><input name="linkTypes" id="allLinks" type="radio" ng-model="filter.endpointsOnly" value="false"/></div>
        </div>
        <div class="gridStyle" ng-grid="linksGrid"></div>
    </div>
</script>
<script type="text/ng-template" id="link.html">
    <div class="row-fluid">
        <h3>Link {{link.data.title}}</h3>
        <div class="gridStyle noHighlight" ng-grid="linkGrid"></div>
    </div>
</script>

<script type="text/ng-template" id="connections.html">
    <div class="row-fluid">
        <h3>Connections</h3>
        <div class="overview">
            <div class="gridStyle" ng-grid="allConnectionGrid"></div>
        </div>
    </div>
</script>
<script type="text/ng-template" id="connection.html">
    <div class="row-fluid">
        <ul class="nav nav-tabs">
            <li ng-repeat="mode in gridModes" ng-click="selectMode(mode,'Connection')" ng-class="{active : isModeSelected(mode,'Connection')}" title="{{mode.title}}" ng-bind-html-unsafe="mode.content"> </li>
        </ul>
        <div ng-if="isModeVisible('Connection','attributes')" class="selectedItems">
            <h3>Connection {{connection.data.title}}</h3>
            <div class="gridStyle noHighlight" ng-grid="connectionGrid"></div>
        </div>
        <div ng-if="isModeVisible('Connection','links')" class="selectedItems">
            <h3>Links for connection {{connection.data.title}}</h3>
            <div class="gridStyle" ng-grid="linksGrid"></div>
        </div>
    </div>
</script>

<script type="text/ng-template" id="titleHeaderCellTemplate.html">
    <div title="{{col.displayName}}" class="ngHeaderSortColumn {{col.headerClass}}" ng-style="{'cursor': col.cursor}" ng-class="{ 'ngSorted': !noSortVisible }">
        <div ng-click="col.sort($event)" ng-class="'colt' + col.index" class="ngHeaderText">{{col.displayName}}</div>
        <div class="ngSortButtonDown" ng-show="col.showSortButtonDown()"></div>
        <div class="ngSortButtonUp" ng-show="col.showSortButtonUp()"></div>
        <div class="ngSortPriority">{{col.sortPriority}}</div>
    </div>
</script>
<script type="text/ng-template" id="titleCellTemplate.html">
    <div title="{{row.entity[col.field]}}" class="ngCellText">{{row.entity[col.field]}}</div>
</script>
<script type="text/ng-template" id="logs.html">
    <div class="row-fluid">
        <h3>Recent log events</h3>
        <div class="overview">
            <div class="gridStyle" ng-grid="allLogGrid"></div>
        </div>
    </div>
</script>
<script type="text/ng-template" id="logModule.html">
    <div class="row-fluid">
        <h3>{{logModule.module}} events</h3>
        <div class="overview-cell">
            <div class="gridStyle" ng-grid="logModuleGrid"></div>
        </div>
    </div>
</script>
<script type="text/ng-template" id="log.html">
    <div class="row-fluid">
        <h3>{{log.data.title}}</h3>
        <div ng-if="logFields.length > 0">
            <table class="log-entry" ng-repeat="entry in logFields track by $index">
                <tr>
                    <td>Router</td><td>{{entry.nodeId}}</td>
                </tr>
                <tr>
                    <td align="left" colspan="2">{{entry.time}}</td>
                </tr>
                <tr>
                    <td>Source</td><td>{{entry.source}}:{{entry.line}}</td>
                </tr>
                <tr>
                    <td valign="middle">Message</td><td valign="middle"><pre>{{entry.message}}</pre></td>
                </tr>
            </table>
        </div>
        <div ng-if="logFields.length == 0">No log entries for {{log.data.title}}</div>
    </div>
</script>

<script type="text/ng-template" id="linkRowTemplate.html">
    <div ng-class="{linkDirIn: row.getProperty('linkDir') == 'in', linkDirOut: row.getProperty('linkDir') == 'out'}">
        <div ng-style="{ 'cursor': row.cursor }" ng-repeat="col in renderedColumns" ng-class="col.colIndex()" class="ngCell {{col.cellClass}}">
            <div class="ngVerticalBar" ng-style="{height: rowHeight}" ng-class="{ ngVerticalBarVisible: !$last }">&nbsp;</div>
            <div ng-cell></div>
        </div>
    </div>
</script>

<script type="text/ng-template" id="linkAggTemplate.html">
    <div ng-click='row.toggleExpand(); saveGroupState()' ng-style='rowStyle(row)' class='ngAggregate ng-scope' style='top: 0px; height: 48px; left: 0px;'>
    <span class='ngAggregateText ng-binding'>
            {{row.label CUSTOM_FILTERS}} ({{row.totalChildren()}} {{AggItemsLabel}})
        </span>
    <div ng-class="{true: 'ngAggArrowCollapsed', false: 'ngAggArrowExpanded'}[row.collapsed]"></div>
    </div>
</script>

<script type="text/ng-template" id="viewLogs.html">
    <div class="modal-header">
        <h3 class="modal-title">Logs for {{nodeName}} {{module}}:{{level | humanify}}</h3>
    </div>
    <div class="modal-body">
        <div ng-if="loading == false">
            <div class="log-details" ng-if="logFields.length > 0">
                <table class="log-entry" ng-repeat="entry in logFields track by $index">
                    <tr>
                        <td>Router</td><td>{{entry.nodeId}}</td>
                    </tr>
                    <tr>
                        <td align="left" colspan="2">{{entry.time}}</td>
                    </tr>
                    <tr>
                        <td>Source</td><td>{{entry.source}}:{{entry.line}}</td>
                    </tr>
                    <tr>
                        <td valign="middle">Message</td><td valign="middle"><pre>{{entry.message}}</pre></td>
                    </tr>
                </table>
            </div>
            <div ng-if="logFields.length == 0">No log entries</div>
        </div>
        <div ng-if="loading == true">
            Loading...
        </div>
    </div>
    <div class="modal-footer">
        <button class="btn btn-primary" type="button" ng-click="ok()">Close</button>
    </div>
</script>