2016-07-06 22:52:31 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
angular.module('ffhb')
|
|
|
|
.controller('NodesSortCtrl',function(NgTableParams,$scope,store){
|
|
|
|
$scope.tableParams = new NgTableParams({
|
|
|
|
sorting: { hostname: 'asc' },
|
|
|
|
total: 0,
|
|
|
|
count: 50
|
|
|
|
}, {
|
|
|
|
dataset: []
|
|
|
|
});
|
|
|
|
function render(prom){
|
|
|
|
prom.then(function(data){
|
2016-07-09 02:58:47 +02:00
|
|
|
var result = Object.keys(data.merged).map(function(nodeid){
|
2016-07-06 22:52:31 +02:00
|
|
|
data.merged[nodeid].nodeid = nodeid;
|
|
|
|
return data.merged[nodeid];
|
|
|
|
});
|
|
|
|
$scope.tableParams.settings({dataset: result,total: data.nodesCount});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
render(store.getData);
|
|
|
|
$scope.$on('store', function(ev, prom) {
|
|
|
|
render(prom);
|
|
|
|
});
|
|
|
|
});
|