|
552 | 552 | title: 'Memory Usage (MB)', |
553 | 553 | data: [{ |
554 | 554 | 'date': new Date(), |
555 | | - 'memory': -1 |
| 555 | + 'memory': 0 |
556 | 556 | }], |
557 | 557 | full_width: true, |
558 | 558 | full_height: true, |
|
567 | 567 | title: 'CPU Usage (%)', |
568 | 568 | data: [{ |
569 | 569 | 'date': new Date(), |
570 | | - 'cpu': -1 |
| 570 | + 'cpu': 0 |
571 | 571 | }], |
572 | 572 | full_width: true, |
573 | 573 | full_height: true, |
|
582 | 582 | title: 'Players Online', |
583 | 583 | data: [{ |
584 | 584 | 'date': new Date(), |
585 | | - 'players': -1 |
| 585 | + 'players': 0 |
586 | 586 | }], |
587 | 587 | full_width: true, |
588 | 588 | full_height: true, |
|
628 | 628 |
|
629 | 629 | socket.on('live-stats', function (data) { |
630 | 630 |
|
631 | | - // if (typeof memoryGraphSettings.data[0][100] !== 'undefined' || memoryGraphSettings.data[0][0].memory === -1) { |
632 | | - // memoryGraphSettings.data[0].shift(); |
633 | | - // } |
634 | | - // if (typeof cpuGraphSettings.data[0][100] !== 'undefined' || cpuGraphSettings.data[0][0].cpu === -1) { |
635 | | - // cpuGraphSettings.data[0].shift(); |
636 | | - // } |
637 | | - // if (typeof playersGraphSettings.data[0][100] !== 'undefined' || playersGraphSettings.data[0][0].players === -1) { |
638 | | - // playersGraphSettings.data[0].shift(); |
639 | | - // } |
| 631 | + if (typeof memoryGraphSettings.data[0][100] !== 'undefined' || memoryGraphSettings.data[0][0].memory === -1) { |
| 632 | + memoryGraphSettings.data[0].shift(); |
| 633 | + } |
| 634 | + if (typeof cpuGraphSettings.data[0][100] !== 'undefined' || cpuGraphSettings.data[0][0].cpu === -1) { |
| 635 | + cpuGraphSettings.data[0].shift(); |
| 636 | + } |
| 637 | + if (typeof playersGraphSettings.data[0][100] !== 'undefined' || playersGraphSettings.data[0][0].players === -1) { |
| 638 | + playersGraphSettings.data[0].shift(); |
| 639 | + } |
| 640 | +
|
| 641 | + memoryGraphSettings.data[0].push({ |
| 642 | + 'date': new Date(), |
| 643 | + 'memory': parseInt(data.stats.memory / (1024 * 1024)) |
| 644 | + }); |
| 645 | +
|
| 646 | + cpuGraphSettings.data[0].push({ |
| 647 | + 'date': new Date(), |
| 648 | + 'cpu': data.stats.cpu |
| 649 | + }); |
| 650 | +
|
| 651 | + playersGraphSettings.data[0].push({ |
| 652 | + 'date': new Date(), |
| 653 | + 'players': data.stats.players |
| 654 | + }); |
640 | 655 |
|
641 | | - // memoryGraphSettings.data[0].push({ |
642 | | - // 'date': new Date(), |
643 | | - // 'memory': parseInt(data.stats.memory / (1024 * 1024)) |
644 | | - // }); |
645 | | - // |
646 | | - // cpuGraphSettings.data[0].push({ |
647 | | - // 'date': new Date(), |
648 | | - // 'cpu': data.stats.cpu |
649 | | - // }); |
650 | | - // |
651 | | - // playersGraphSettings.data[0].push({ |
652 | | - // 'date': new Date(), |
653 | | - // 'players': data.stats.players |
654 | | - // }); |
| 656 | + MG.data_graphic(memoryGraphSettings); |
| 657 | + MG.data_graphic(cpuGraphSettings); |
| 658 | + MG.data_graphic(playersGraphSettings); |
655 | 659 |
|
656 | | - // MG.data_graphic(memoryGraphSettings); |
657 | | - // MG.data_graphic(cpuGraphSettings); |
658 | | - // MG.data_graphic(playersGraphSettings); |
659 | | - // |
660 | 660 | $.each(data.servers, function (uuid, info) { |
661 | 661 | var element = $('tr[data-server="' + uuid + '"]'); |
662 | 662 | element.find('[data-action="status"]').html(Status[info.status]); |
|
0 commit comments