<!--
* 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 class="left-navbar" xmlns="http://www.w3.org/1999/html">
  <div class="panel panel-default">
    <div class="panel-heading"><span class="glyphicon glyphicon-cloud"></span> Clusters</div>
    <div class="panel-body">
      <div class="cluster-section" ng-show="cluster">
        <div id="cluster-name"  ng-switch on="editCluster.editingName">
          <h5 ng-switch-when="false">{{cluster.Clusters.cluster_name}}
            <i ng-show="cluster.Clusters.provisioning_state == 'INSTALLED'" ng-click="toggleEditName()" class="glyphicon glyphicon-edit pull-right edit-cluster-name" tooltip="Rename Cluster"></i>
          </h5>

          <form ng-keyup="toggleEditName($event)" tabindex="1" name="editClusterNameForm" class="editClusterNameForm" ng-switch-when="true"
                ng-submit="editCluster.name !== cluster.Clusters.cluster_name && editClusterNameForm.newClusterName.$valid && confirmClusterNameChange()">
            <div class="form-group" ng-class="{'has-error': editClusterNameForm.newClusterName.$invalid && !editClusterNameForm.newClusterName.$pristine }">
              <input
                  autofocus
                  type="text"
                  name="newClusterName"
                  ng-required="true"
                  ng-pattern="/^\w*$/"
                  ng-trim="false"
                  ng-model="editCluster.name"
                  class="form-control input-sm"
                  tooltip="Only alpha-numeric characters."
                  tooltip-trigger="focus">
              <button ng-click="toggleEditName()"
                      class="btn btn-xs">
                <i class="glyphicon glyphicon-remove"></i>
              </button>
              <button
                    type="submit"
                    class="btn btn-primary btn-xs"
                    ng-class="{'disabled': editClusterNameForm.newClusterName.$invalid || editCluster.name == cluster.Clusters.cluster_name}">
                <i class="glyphicon glyphicon-ok"></i>
              </button>
            </div>
          </form>

        </div>

        <ul class="nav nav-pills nav-stacked" ng-show="cluster.Clusters.provisioning_state == 'INSTALLED' ">
          <li ng-class="{active: isActive('clusters.manageAccess')}">
            <a href="#/clusters/{{cluster.Clusters.cluster_name}}/manageAccess" class="permissions">Permissions</a>
          </li>
          <li><a href="#/dashboard"  class="gotodashboard">Go to Dashboard</a></li>
        </ul>
        <span class="cluster-installation-progress-label" ng-show="cluster.Clusters.provisioning_state == 'INIT'"><a href="/#/">Cluster creation in progress...</a></span>
      </div>


      <div ng-hide="cluster">
        <ul class="nav nav-pills nav-stacked">
          <li><p class="noclusters">No clusters</p></li>
        </ul>
      </div>
      <ul class="nav nav-pills nav-stacked" ng-show="cluster && totalRepos > 0">
        <li ng-class="{active: isActive('stackVersions.list')}">
          <a href="#/stackVersions">Versions</a>
        </li>
      </ul>
    </div>
  </div>

  <div class="panel panel-default">
    <div class="panel-heading"><span class="glyphicon glyphicon-th"></span> Views</div>
    <div class="panel-body">
      <ul class="nav nav-pills nav-stacked">
        <li ng-class="{active: isActive('views.list')}"><link-to route="views.list" class="viewslist-link">Views</link-to></li>
      </ul>
    </div>
  </div>

  <div class="panel panel-default">
    <div class="panel-heading"><span class="glyphicon glyphicon-user"></span> User + Group Management</div>
    <div class="panel-body">
      <ul class="nav nav-pills nav-stacked">
        <li ng-class="{active: isActive('users.list')}"><link-to route="users.list" class="userslist-link">Users</link-to></li>
        <li ng-class="{active: isActive('groups.list')}"><link-to route="groups.list" class="groupslist-link">Groups</link-to></li>
      </ul>
        
    </div>
  </div>
</div>
  
