<!--
  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="list-group-search" ng-if="!summary">
    <div class="form-group">
        <div class="input-group">
            <div class="input-group-btn" uib-dropdown keyboard-nav="true">
                <button id="single-button" type="button" class="btn btn-default" uib-dropdown-toggle>
                    Filters <span class="caret"></span>
                </button>
                <ul class="dropdown-menu" uib-dropdown-menu role="menu" aria-labelledby="single-button">
                    <li role="menuitem" class="dropdown-header">Filters</li>
                    <li role="menuitem" ng-repeat="types in filters.types track by $index" ng-class="{'active': types.active}" class="layer">
                        <a href="#" ng-click="$event.preventDefault(); types.active = !types.active"><i class="fa fa-fw fa-circle"></i> {{types.value | lowercase}}</a>
                    </li>
                </ul>
            </div>

            <input type="text" class="form-control" placeholder="Search anything (e.g. autoscaler, replacer, etc)" ng-model="filters.search" auto-focus />
        </div>
    </div>

    <ng-transclude class="extra"></ng-transclude>
</div>


<div class="list-group">
    <a ui-sref="main.inspect.management.detail({adjunctId: adjunct.id})" class="list-group-item" ng-repeat="adjunct in adjuncts | filter:predicate track by adjunct.id">
      <div class="row">
        <div class="col-lg-5">
            <div class="media">
                <div class="media-left">
                    <img class="media-object" ng-src="{{adjunct | iconGeneratorPipe}}" alt="{{adjunct.name}}'s logo">
                </div>
                <div class="media-body"><div>
                    <div class="adjunct-name">{{adjunct.name | usefulName}}</div>
                    {{adjunct.adjunctType | capitalize}}{{(adjunct.state != 'RUNNING' ? ', '+adjunct.state : '') | lowercase}}
                </div></div>
            </div>
        </div>
        <div class="col-lg-7">
            <p ng-if="adjunct.description && !summary">{{adjunct.description}}</p>
            <p ng-if="(adjunct.highlights | json) === '{}'" class="no-highlights">No highlights</p>
            <p ng-repeat="(id, highlight) in adjunctsWithHighlightsSorted[adjunct.id] track by id" ng-show="showHighlight(id)" class="highlight"
                    ng-class="{'adjunct-last-action': id === 'lastAction', 'adjunct-last-confirmation': id === 'lastConfirmation', 'adjunct-last-violation': id === 'lastViolation', 'adjunct-trigger': id === 'triggers'}">
                <span class="highlight-description">{{highlight.description}}</span>
                <span class="highlight-time">{{highlight.time > 0 ? (highlight.time | timeAgo) : 'ongoing'}}</span>
            </p>
        </div>
      </div>
    </a>
</div>
