status.js 777 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. console.log("Reloading controller");
  2. module.exports = {
  3. memory(context,done) {
  4. // Wait call?
  5. //
  6. // Get first result
  7. var [ret] = context.manager.call("core-monitor:getStat");
  8. if(ret != undefined) {
  9. done(ret.result);
  10. }
  11. },
  12. bundles(context,done) {
  13. var tbl = [];
  14. for(var k in context.manager.registry) {
  15. var v = context.manager.registry[k];
  16. if(v == undefined) {
  17. continue;
  18. }
  19. tbl.push({
  20. id: v.id,
  21. name:v.name,
  22. state: v.info.state,
  23. package: (v.info.pkgInfo)?v.info.pkgInfo.name:"",
  24. version: (v.info.pkgInfo)?v.info.pkgInfo.version:"",
  25. author: ((v.info.pkgInfo)?v.info.pkgInfo.author.name:"") || "?",
  26. modulePath: v.modulePath,
  27. });
  28. }
  29. tbl = tbl.sort((a,b) => { return a.id - b.id});
  30. done(tbl);
  31. }
  32. }