blob: b7aaa9613556d81b99d2a25a83939fc52677fff2 [file] [log] [blame]
Matteo Scandolo500e4c42017-08-08 13:05:24 -07001
2<!--
3Copyright 2017-present Open Networking Foundation
4
5Licensed under the Apache License, Version 2.0 (the "License");
6you may not use this file except in compliance with the License.
7You may obtain a copy of the License at
8
9http://www.apache.org/licenses/LICENSE-2.0
10
11Unless required by applicable law or agreed to in writing, software
12distributed under the License is distributed on an "AS IS" BASIS,
13WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14See the License for the specific language governing permissions and
15limitations under the License.
16-->
Matteo Scandolo710dc152017-04-11 13:54:23 -070017<div ng-show="vm.data.length > 0 && vm.loader == false">
Matteo Scandolo9f87f302016-12-13 18:11:10 -080018 <div class="row" ng-if="vm.config.filter == 'fulltext'">
19 <div class="col-xs-12">
20 <input
21 class="form-control"
22 placeholder="Type to search.."
23 type="text"
24 ng-model="vm.query"/>
25 </div>
26 </div>
Matteo Scandolod62ea792016-12-22 14:02:28 -080027 <div class="table-responsive">
28 <table ng-class="vm.classes">
Matteo Scandolo9f87f302016-12-13 18:11:10 -080029 <thead>
30 <tr>
Matteo Scandolo5d962a32017-08-01 18:16:14 -070031 <th ng-repeat="col in vm.config.columns">
Matteo Scandolo9f87f302016-12-13 18:11:10 -080032 {{col.label}}
Matteo Scandolod62ea792016-12-22 14:02:28 -080033 <div ng-if="vm.config.order">
Matteo Scandolo9f87f302016-12-13 18:11:10 -080034 <a href="" ng-click="vm.orderBy = col.prop; vm.reverse = false">
Matteo Scandolod58d5042016-12-16 16:59:21 -080035 <i class="fa fa-chevron-up"></i>
Matteo Scandolo9f87f302016-12-13 18:11:10 -080036 </a>
37 <a href="" ng-click="vm.orderBy = col.prop; vm.reverse = true">
Matteo Scandolod58d5042016-12-16 16:59:21 -080038 <i class="fa fa-chevron-down"></i>
Matteo Scandolo9f87f302016-12-13 18:11:10 -080039 </a>
Matteo Scandolod62ea792016-12-22 14:02:28 -080040 </div>
Matteo Scandolo9f87f302016-12-13 18:11:10 -080041 </th>
42 <th ng-if="vm.config.actions">Actions:</th>
43 </tr>
44 </thead>
45 <tbody ng-if="vm.config.filter == 'field'">
Matteo Scandoloee655a12016-12-19 15:38:43 -080046 <tr>
Matteo Scandolo5d962a32017-08-01 18:16:14 -070047 <td ng-repeat="col in vm.config.columns">
Matteo Scandoloee655a12016-12-19 15:38:43 -080048 <input
49 ng-if="col.type !== 'boolean' && col.type !== 'array' && col.type !== 'object' && col.type !== 'custom'"
50 class="form-control"
51 placeholder="Type to search by {{col.label}}"
52 type="text"
53 ng-model="vm.query[col.prop]"/>
54 <select
55 ng-if="col.type === 'boolean'"
56 class="form-control"
57 ng-model="vm.query[col.prop]">
58 <option value="">-</option>
59 <option value="true">True</option>
60 <option value="false">False</option>
61 </select>
62 </td>
63 <td ng-if="vm.config.actions"></td>
64 </tr>
Matteo Scandolo9f87f302016-12-13 18:11:10 -080065 </tbody>
66 <tbody>
Matteo Scandoloc8a58c82017-08-17 17:14:38 -070067 <tr ng-class="{active: vm.config.selectedRow == $index}" ng-repeat="item in (vm.config.filteredData = (vm.data | filter:vm.query | orderBy:vm.orderBy:vm.reverse | pagination:vm.currentPage * vm.config.pagination.pageSize | limitTo: (vm.config.pagination.pageSize || vm.data.length))) track by $index">
Matteo Scandolo5d962a32017-08-01 18:16:14 -070068 <td ng-repeat="col in vm.config.columns" xos-link-wrapper>
Matteo Scandolo9f87f302016-12-13 18:11:10 -080069 <span ng-if="!col.type || col.type === 'text'">{{item[col.prop]}}</span>
70 <span ng-if="col.type === 'boolean'">
Matteo Scandolod58d5042016-12-16 16:59:21 -080071 <i class="fa"
72 ng-class="{'fa-ok': item[col.prop], 'fa-remove': !item[col.prop]}">
Matteo Scandolo9f87f302016-12-13 18:11:10 -080073 </i>
74 </span>
75 <span ng-if="col.type === 'date'">
76 {{item[col.prop] | date:'H:mm MMM d, yyyy'}}
77 </span>
78 <span ng-if="col.type === 'array'">
79 {{item[col.prop] | arrayToList}}
80 </span>
81 <span ng-if="col.type === 'object'">
82 <dl class="dl-horizontal">
83 <span ng-repeat="(k,v) in item[col.prop]">
84 <dt>{{k}}</dt>
85 <dd>{{v}}</dd>
86 </span>
87 </dl>
88 </span>
89 <span ng-if="col.type === 'custom'">
Matteo Scandolo04964232017-01-07 12:53:46 -080090 {{item[col.prop + '-formatted']}}
91 <i class="ng-hide">{{col.formatter(item)}}</i>
Matteo Scandolo9f87f302016-12-13 18:11:10 -080092 </span>
93 <span ng-if="col.type === 'icon'">
Matteo Scandolod58d5042016-12-16 16:59:21 -080094 <i class="fa fa-{{col.formatter(item)}}">
Matteo Scandolo9f87f302016-12-13 18:11:10 -080095 </i>
Matteo Scandolo8b2370c2017-02-02 17:19:07 -080096 </span>
97 <div class="xos-table-hover" ng-if="col.hover">
98 <div class="alert alert-info">
99 {{col.hover(item)}}
100 </div>
101 </div>
Matteo Scandolo9f87f302016-12-13 18:11:10 -0800102 </td>
Matteo Scandolocc4bce82017-08-07 13:11:47 -0700103 <td class="xos-table-actions" ng-if="vm.config.actions">
Matteo Scandolo9f87f302016-12-13 18:11:10 -0800104 <a href=""
105 ng-repeat="action in vm.config.actions"
106 ng-click="action.cb(item)"
107 title="{{action.label}}">
108 <i
Matteo Scandolod58d5042016-12-16 16:59:21 -0800109 class="fa fa-{{action.icon}}"
Matteo Scandolo9f87f302016-12-13 18:11:10 -0800110 style="color: {{action.color}};"></i>
111 </a>
112 </td>
113 </tr>
114 </tbody>
115 </table>
Matteo Scandolo8b2370c2017-02-02 17:19:07 -0800116 <xos-pagination
117 ng-if="vm.config.pagination"
118 page-size="vm.config.pagination.pageSize"
119 total-elements="vm.data.length"
120 change="vm.goToPage">
121 </xos-pagination>
Matteo Scandolod62ea792016-12-22 14:02:28 -0800122 </div>
Matteo Scandolo710dc152017-04-11 13:54:23 -0700123</div>
124<div ng-show="(vm.data.length == 0 || !vm.data) && vm.loader == false">
125 <xos-alert config="{type: 'info'}" show="true">
126 No data to show.
127 </xos-alert>
128</div>
129<div ng-show="vm.loader == true">
130 <div class="loader"></div>
131</div>