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.

95 lines
3.1 KiB

  1. 'use strict';
  2. angular.module('app.main', ['ngRoute'])
  3. .config(['$routeProvider', function($routeProvider) {
  4. $routeProvider.when('/main', {
  5. templateUrl: 'views/main/main.html',
  6. controller: 'MainCtrl'
  7. });
  8. }])
  9. .controller('MainCtrl', function($scope, $http) {
  10. $scope.stats = [];
  11. $scope.current=0;
  12. $scope.max=100;
  13. $scope.blockProgress={
  14. "width": "0%"
  15. };
  16. $http.get(urlapi + 'stats')
  17. .then(function(data, status, headers, config) {
  18. console.log(data);
  19. $scope.stats = data.data;
  20. var tantpercent = ($scope.stats.realblockcount/$scope.stats.blockcount)*100;
  21. $scope.blockProgress={
  22. "width": tantpercent+"%"
  23. };
  24. $scope.current=80;
  25. }, function(data, status, headers, config) {
  26. console.log('data error');
  27. });
  28. //last addr
  29. $scope.addresses = [];
  30. $http.get(urlapi + 'addresses/1/10')
  31. .then(function(data, status, headers, config) {
  32. console.log(data);
  33. $scope.addresses = data.data;
  34. }, function(data, status, headers, config) {
  35. console.log('data error');
  36. });
  37. //last tx
  38. $scope.txs = [];
  39. $http.get(urlapi + 'txs/1/10')
  40. .then(function(data, status, headers, config) {
  41. console.log(data);
  42. $scope.txs = data.data;
  43. }, function(data, status, headers, config) {
  44. console.log('data error');
  45. });
  46. //date analysis
  47. $scope.last24hour= {
  48. data:[],
  49. labels: []
  50. };
  51. $http.get(urlapi + 'last24hour')
  52. .then(function(data, status, headers, config) {
  53. console.log(data);
  54. $scope.last24hour.data = data.data.data;
  55. $scope.last24hour.labels = data.data.labels;
  56. }, function(data, status, headers, config) {
  57. console.log('data error');
  58. });
  59. $scope.last7dayhour= {
  60. data:[],
  61. labels: []
  62. };
  63. $http.get(urlapi + 'last7dayhour')
  64. .then(function(data, status, headers, config) {
  65. console.log(data);
  66. $scope.last7dayhour.data = data.data.data;
  67. $scope.last7dayhour.labels = data.data.labels;
  68. $scope.last7dayhour.series = data.data.series;
  69. }, function(data, status, headers, config) {
  70. console.log('data error');
  71. });
  72. $scope.last7day={
  73. data: [],
  74. labels: []
  75. };
  76. $http.get(urlapi + 'last7day')
  77. .then(function(data, status, headers, config) {
  78. console.log('data success');
  79. console.log(data);
  80. $scope.last7day.data = data.data.data;
  81. $scope.last7day.labels=data.data.labels;
  82. }, function(data, status, headers, config) {
  83. console.log('data error');
  84. });
  85. });