<!--
  #%L
  thinkbig-ui-operations-manager
  %%
  Copyright (C) 2017 ThinkBig Analytics
  %%
  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.
  #L%
  -->
<card-layout class="right-card">
    <header-section layout="row" >
        <ng-md-icon icon="error_outline " size="20"
                   class="error right-card-title-text">
        </ng-md-icon><div class="card-title right-card-title-text" style="padding-left:5px;">Alerts</div>
        <span flex></span>
    </header-section>
    <body-section>
        <md-divider></md-divider>
        <md-list  layout-fill layout="column" class="list-item-table">
            <md-list-item  ng-repeat="alert in vm.alerts|orderBy:'sinceTime' "  ng-click="vm.navigateToAlert(alert)">
                <div style="width:100%" class="item-column" >
                    <div layout="row" layout-align="space-between-stretch" flex layout-fill>
                        <span class="item-title" >{{alert.summary}}</span>
                        <span class="item-title" style="float:right;">{{alert.type}}</span>
                    </div>
                    <div layout="row" layout-align="space-between-stretch" flex layout-fill>
                        <span class="error column-title-bottom" ng-if="alert.count ==1">{{alert.count}} ALERT</span>
                        <span class="error column-title-bottom" ng-if="alert.count > 1">{{alert.count}} ALERTS</span>
                        <span class="md-caption column-title-bottom" style="float:right;">{{alert.since}}</span>
                    </div>
                </div>
                <md-divider ng-if="!$last"></md-divider>
            </md-list-item>
            <md-list-item ng-if="vm.alerts.length == 0">
                <div style="width:100%" class="item-column" >
                    <span class="item-title" >No alerts</span>
                    </div>
            </md-list-item>
        </md-list>
    </body-section>
</card-layout>
