Add checkbox option in table

Change-Id: I758b229d2beb0c5ba86f9c4ddd8b91f80d4cd53c
This commit is contained in:
Vincent Fournier 2015-07-07 11:10:01 -04:00
parent 2f54e8a1e4
commit 174a7efc88
5 changed files with 18 additions and 3 deletions

View File

@ -56,6 +56,7 @@
}
},
"isWrappable": false,
"checkColumn": true,
"noRepeatCell": ""
}
},
@ -100,6 +101,7 @@
}
},
"isWrappable": true,
"checkColumn": true,
"noRepeatCell": "host"
}
},
@ -137,6 +139,7 @@
}
},
"isWrappable": false,
"checkColumn": true,
"noRepeatCell": ""
}
},
@ -172,6 +175,7 @@
}
},
"isWrappable": true,
"checkColumn": true,
"noRepeatCell": "host"
}
}
@ -211,6 +215,7 @@
},
"isWrappable": false,
"noRepeatCell": "",
"checkColumn": true,
"containsActionBar": true
}
}
@ -248,6 +253,7 @@
},
"isWrappable": false,
"noRepeatCell": "host",
"checkColumn": true,
"containsActionBar": true
}
@ -286,6 +292,7 @@
},
"isWrappable": false,
"noRepeatCell": "",
"checkColumn": false,
"containsActionBar": false
}
}

View File

@ -1,7 +1,7 @@
<table class="data-table" ng-controller="TableCtrl">
<thead class="moving-thead">
<tr>
<th class="data-table__checkbox">
<th data-ng-show="checkColumn" class="data-table__checkbox">
<md-checkbox aria-label='Check all' ng-model="isCheckAll" ng-change="onCheckChange()"></md-checkbox>
</th>
<th ng-repeat="i in cellIndexes" class="data-table__{{cellsName[i]}}">
@ -14,7 +14,7 @@
<thead class="static-thead">
<tr>
<th class="data-table__checkbox">
<th data-ng-show="checkColumn" class="data-table__checkbox">
<md-checkbox aria-label='Check all' ng-model="isCheckAll" ng-change="onCheckChange()"></md-checkbox>
</th>
<th ng-repeat="i in cellIndexes" class="data-table__{{cellsName[i]}}">
@ -26,7 +26,7 @@
<tbody class="{{entry.child_class}}" ng-repeat="(groupByKey, groupByItems) in entries | groupBy:'host_name'">
<tr ng-repeat="entry in groupByItems | actionbarSelectFilter:actionbarFilters.activeFilter | filter:actionbarFilters.searchFilter | noRepeat:this | wrappableStyle:this">
<td>
<td data-ng-show="checkColumn">
<md-checkbox aria-label='Check' ng-model="entry.is_checked"></md-checkbox>
</td>
<td bansho-cell cell-name="{{cell}}" ng-repeat="cell in cellsName"></td>

View File

@ -153,6 +153,8 @@ angular.module('bansho.table', ['bansho.surveil',
conf.isWrappable = JSON.parse(attrs.isWrappable);
conf.noRepeatCell = attrs.noRepeatCell;
tableGlobalConfig.tableId = attrs.tableId;
scope.checkColumn = scope.$eval(attrs.checkColumn);
if (!!attrs.refreshInterval) {
tableGlobalConfig.refreshInterval = parseInt(attrs.refreshInterval * 1000, 10);
@ -206,6 +208,7 @@ angular.module('bansho.table', ['bansho.surveil',
this.InputSource = config.inputSource;
this.IsWrappable = config.isWrappable;
this.ContainsActionBar = config.containsActionBar;
this.CheckColumn = config.checkColumn;
this.NoRepeatCell = config.noRepeatCell;
})

View File

@ -58,6 +58,7 @@
filters="{{dashboardTables[0].Filters}}"
is-wrappable="{{dashboardTables[0].IsWrappable}}"
no-repeat-cell="{{dashboardTables[0].NoRepeatCell}}"
check-column="{{dashboardTables[0].CheckColumn}}"
refresh-interval="{{dashboardRefreshInterval}}"
additionnal-query-fields="{{dashboardTables[0].additionnalQueryFields}}"
table-id="0"></bansho-table>
@ -83,6 +84,7 @@
filters="{{dashboardTables[1].Filters}}"
is-wrappable="{{dashboardTables[1].IsWrappable}}"
no-repeat-cell="{{dashboardTables[1].NoRepeatCell}}"
check-column="{{dashboardTables[1].CheckColumn}}"
refresh-interval="{{dashboardRefreshInterval}}"
additionnal-query-fields="{{dashboardTables[1].additionnalQueryFields}}"
table-id="1"></bansho-table>
@ -110,6 +112,7 @@
filters="{{dashboardTables[2].Filters}}"
is-wrappable="{{dashboardTables[2].IsWrappable}}"
no-repeat-cell="{{dashboardTables[2].NoRepeatCell}}"
check-column="{{dashboardTables[2].CheckColumn}}"
refresh-interval="{{dashboardRefreshInterval}}"
table-id="2"></bansho-table>
</span>
@ -133,6 +136,7 @@
filters="{{dashboardTables[3].Filters}}"
is-wrappable="{{dashboardTables[3].IsWrappable}}"
no-repeat-cell="{{dashboardTables[3].NoRepeatCell}}"
check-column="{{dashboardTables[3].CheckColumn}}"
refresh-interval="{{dashboardRefreshInterval}}"
table-id="3"></bansho-table>
</span>

View File

@ -17,6 +17,7 @@
input-source="{{tableConfig.InputSource}}"
filters="{{tableConfig.Filters}}"
is-wrappable="{{tableConfig.IsWrappable}}"
check-column="{{tableConfig.CheckColumn}}"
no-repeat-cell="{{tableConfig.NoRepeatCell}}"
refresh-interval="{{singleTableRefreshInterval}}"
table-id="0"></bansho-table>