seninel部署
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 line
1.5KB

  1. var app = angular.module('sentinelDashboardApp');
  2. app.service('SystemService', ['$http', function ($http) {
  3. this.queryMachineRules = function (app, ip, port) {
  4. var param = {
  5. app: app,
  6. ip: ip,
  7. port: port
  8. };
  9. return $http({
  10. url: 'system/rules.json',
  11. params: param,
  12. method: 'GET'
  13. });
  14. };
  15. this.newRule = function (rule) {
  16. var param = {
  17. app: rule.app,
  18. ip: rule.ip,
  19. port: rule.port
  20. };
  21. if (rule.grade == 0) {// avgLoad
  22. param.avgLoad = rule.avgLoad;
  23. } else if (rule.grade == 1) {// avgRt
  24. param.avgRt = rule.avgRt;
  25. } else if (rule.grade == 2) {// maxThread
  26. param.maxThread = rule.maxThread;
  27. } else if (rule.grade == 3) {// qps
  28. param.qps = rule.qps;
  29. }
  30. return $http({
  31. url: '/system/new.json',
  32. params: param,
  33. method: 'GET'
  34. });
  35. };
  36. this.saveRule = function (rule) {
  37. var param = {
  38. id: rule.id,
  39. };
  40. if (rule.grade == 0) {// avgLoad
  41. param.avgLoad = rule.avgLoad;
  42. } else if (rule.grade == 1) {// avgRt
  43. param.avgRt = rule.avgRt;
  44. } else if (rule.grade == 2) {// maxThread
  45. param.maxThread = rule.maxThread;
  46. } else if (rule.grade == 3) {// qps
  47. param.qps = rule.qps;
  48. }
  49. return $http({
  50. url: '/system/save.json',
  51. params: param,
  52. method: 'GET'
  53. });
  54. };
  55. this.deleteRule = function (rule) {
  56. var param = {
  57. id: rule.id,
  58. app: rule.app
  59. };
  60. return $http({
  61. url: '/system/delete.json',
  62. params: param,
  63. method: 'GET'
  64. });
  65. };
  66. }]);