header.js
This commit is contained in:
parent
2aa7c9731d
commit
b4d167bbb7
|
@ -13,9 +13,9 @@
|
|||
</vn-horizontal>
|
||||
</vn-card>
|
||||
<vn-card margin-medium-top>
|
||||
<vn-item-client ng-repeat="client in index.model.instances" title="View client" client="client"></vn-item-client>
|
||||
<vn-item-client ng-repeat="client in index.model" title="View client" client="client"></vn-item-client>
|
||||
</vn-card>
|
||||
<vn-paging index="index" total="index.model.count"></vn-paging>
|
||||
<vn-paging index="index"></vn-paging>
|
||||
</div>
|
||||
<a ui-sref="create" fixed-bottom-right>
|
||||
<vn-float-button icon="person_add"></vn-float-button>
|
||||
|
|
|
@ -26,11 +26,13 @@ module.exports = function(self) {
|
|||
//this.disableRemoteMethod(method, disableMethods[method]);
|
||||
}
|
||||
|
||||
var find = self.find;
|
||||
self.find = function(filter,cb){
|
||||
cb(null,'This is a overridden method')
|
||||
}
|
||||
console.log(self.find);
|
||||
self.on('find', function() {
|
||||
self.printModelName();
|
||||
});
|
||||
|
||||
self.list = function(filter, cb){
|
||||
self.find(filter, cb);
|
||||
}
|
||||
}
|
||||
|
||||
self.installMethod = function(methodName, filterCb) {
|
||||
|
@ -61,31 +63,9 @@ module.exports = function(self) {
|
|||
|
||||
this.filter = (params, cb) => {
|
||||
let filter = removeEmpty(filterCb(params));
|
||||
data = {};
|
||||
function check () {
|
||||
if (data.count && data.instances)
|
||||
cb(null, data);
|
||||
}
|
||||
function error(){
|
||||
cb(null, data);
|
||||
}
|
||||
this.count(filter, function (err, count) {
|
||||
if(!err) {
|
||||
data.count = count;
|
||||
check();
|
||||
}
|
||||
else{
|
||||
error();
|
||||
}
|
||||
})
|
||||
this.find(filter, function(err, instances) {
|
||||
if(!err) {
|
||||
data.instances = instances;
|
||||
check();
|
||||
}
|
||||
else{
|
||||
error();
|
||||
}
|
||||
if(!err)
|
||||
cb(null, instances);
|
||||
})
|
||||
};
|
||||
};
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
module.exports = function(app) {
|
||||
|
||||
/*function modifyResponse(ctx, model, next) {
|
||||
var result = ctx.result;
|
||||
var status = ctx.res.statusCode;
|
||||
if(Array.isArray(result)){
|
||||
/*app.models.Client.count(null, function (err, count) {
|
||||
if(!err) {
|
||||
ctx.res.set('Count-elements', count);
|
||||
}
|
||||
})
|
||||
ctx.res.set('Count-elements', 3);
|
||||
ctx.res.status(status).next();
|
||||
}
|
||||
}
|
||||
|
||||
app.models.Client.afterRemote('**', modifyResponse);*/
|
||||
|
||||
};
|
Loading…
Reference in New Issue