<!--

    Copyright (C) 2015-2016 Jeeva Kandasamy (jkandasa@gmail.com)

    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.

-->
<div class="container-fluid"> <!-- Container-fluid -->

  <!-- Loading icon disaplay -->
  <div ng-if="!data.$resolved">
    <div ng-include src="'partials/common-html/loading.html'"></div>
  </div>

  <div ng-if="data.$resolved"> <!-- Main Message -->

    <!-- Page Header -->
    <div class="mc-top-space-header">
      <legend style="margin-bottom:10px;">{{headerStringList}}</legend>
    </div>

    <div ng-if="isEmpty(data.items)" class="mc-top-space-1x">
      <div class="blank-slate-pf">
        <div class="blank-slate-pf-icon">
          <i class="{{noItemsSystemIcon}}"></i>
        </div>
        <h1>{{noItemsSystemMsg}}</h1>
      </div>
    </div>

    <div ng-if="!isEmpty(data.items)">

      <div class="col-md-12">
        <div class="btn-toolbar pull-right" role="toolbar">
          <div class="btn-group mc-side-space">
            <label class="mc-align-center mc-top-space-5px checkbox-inline">
              <input id="box" ng-change="refresh()" ng-false-value="false" ng-model="query.realtime" ng-true-value="true" type="checkbox" class="ng-pristine ng-untouched ng-valid ng-empty">
              {{ 'REALTIME' | translate }}
            </label>
          </div>
          <div class="btn-group mc-side-space">
            <label class="mc-align-center mc-top-space-5px checkbox-inline">
              <input id="box" ng-change="show_hide_names(checkboxModel.value)" ng-false-value="false" ng-model="checkboxModel.value" ng-true-value="true" type="checkbox" class="ng-pristine ng-untouched ng-valid ng-empty">
              {{ 'DISPLAY_NAMES' | translate }}
            </label>
          </div>
          <button class="btn btn-default mc-side-space" ng-click="refresh()">
            <i class="fa fa-refresh fa-lg"></i>
            {{ 'REFRESH' | translate }}
          </button>
        </div>

        <div class="btn-toolbar pull-left" role="toolbar">
          <form role="form" style="width: 250px;" class="search-pf has-button">
            <div class="form-group has-clear">
              <div class="search-pf-input-group">
                <label for="search" class="sr-only">{{ 'SEARCH' | translate }}</label>
                <input id="search" type="search" class="form-control" ng-model="search.query" placeholder="{{ 'SEARCH' | translate }}">
                <button type="button" class="clear" ng-click="resetSearch()" aria-hidden="true"><span class="pficon pficon-close"></span></button>
              </div>
            </div>
            <div class="form-group">
              <button class="btn btn-default" ng-click="searchNode()" type="button"><span class="fa fa-search"></span></button>
            </div>
          </form>
        </div>

      </div>

      <div class="container_topology" id="topology_kind_list">
        <div class="legend">
          <kubernetes-topology-icon kind="Gateway" ng-if="displayKinds.gateway">
           <svg class="kube-topology">
             <use xlink:href="#vertex-Gateway" x="21" y="22"></use>
           </svg>
           <label>{{ 'GATEWAYS' | translate }}</label>
          </kubernetes-topology-icon>

          <kubernetes-topology-icon kind="Node"  ng-if="displayKinds.node">
            <svg class="kube-topology">
              <use xlink:href="#vertex-Node" x="21" y="22"></use>
            </svg>
            <label>{{ 'NODES' | translate }}</label>
          </kubernetes-topology-icon>

          <kubernetes-topology-icon kind="Sensor" ng-if="displayKinds.sensor">
            <svg class="kube-topology">
              <use xlink:href="#vertex-Sensor" x="21" y="22"></use>
            </svg>
            <label>{{ 'SENSORS' | translate }}</label>
          </kubernetes-topology-icon>

          <kubernetes-topology-icon kind="SensorVariable" ng-if="displayKinds.sensorVariable">
            <svg class="kube-topology">
              <use xlink:href="#vertex-SensorVariable" x="21" y="22"></use>
            </svg>
            <label>{{ 'SENSOR_VARIABLES' | translate }}</label>
          </kubernetes-topology-icon>

        </div>
      </div>

      <kubernetes-topology-graph style="height: {{topologyHeight}}px" items="data.items" relations="data.relations" kinds="kinds">
      </kubernetes-topology-graph>

    </div>

</div> <!-- Container-fluid -->

<!-- define icon to list -->
<svg class="kube-topology" hidden>
  <defs>
    <g class="Gateway" id="vertex-Gateway">
      <circle r="15"></circle>
      <text y="6" style="font-family:FontAwesome;fill:#663333">&#xf1e6;</text>
    </g>
    <g class="McNode" id="vertex-Node">
      <circle r="15"></circle>
      <text y="6" style="font-family:FontAwesome;fill:#1186C1">&#xf0e8;</text>
    </g>
    <g class="Sensor" id="vertex-Sensor">
      <circle r="15"></circle>
      <text y="6" style="font-family:FontAwesome;fill:#9467bd">&#xf06e;</text>
    </g>
    <g class="SensorVariable" id="vertex-SensorVariable">
      <circle r="15"></circle>
      <text y="6" style="font-family:FontAwesome;fill:#ff7f0e">&#xf005;</text>
    </g>
  </defs>
</svg>
