| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300 | 
							- <template>
 
- 	<div class='container'>
 
- 		<div class="columns">
 
- 			<div class='card column is-10-desktop is-offset-1-desktop is-12-mobile'>
 
- 				<header class='card-header'>
 
- 					<p class='card-header-title'>
 
- 						Average Logs
 
- 					</p>
 
- 				</header>
 
- 				<div class='card-content'>
 
- 					<div class='content'>
 
- 						<table class="table">
 
- 							<thead>
 
- 								<tr>
 
- 									<th> </th>
 
- 									<th>Success</th>
 
- 									<th>Error</th>
 
- 									<th>Info</th>
 
- 								</tr>
 
- 							</thead>
 
- 							<tbody>
 
- 								<tr>
 
- 									<th><strong>Average per second</strong></th>
 
- 									<th v-bind:title="logs.second.success">{{round(logs.second.success)}}</th>
 
- 									<th v-bind:title="logs.second.error">{{round(logs.second.error)}}</th>
 
- 									<th v-bind:title="logs.second.info">{{round(logs.second.info)}}</th>
 
- 								</tr>
 
- 								<tr>
 
- 									<th><strong>Average per minute</strong></th>
 
- 									<th v-bind:title="logs.minute.success">{{round(logs.minute.success)}}</th>
 
- 									<th v-bind:title="logs.minute.error">{{round(logs.minute.error)}}</th>
 
- 									<th v-bind:title="logs.minute.info">{{round(logs.minute.info)}}</th>
 
- 								</tr>
 
- 								<tr>
 
- 									<th><strong>Average per hour</strong></th>
 
- 									<th v-bind:title="logs.hour.success">{{round(logs.hour.success)}}</th>
 
- 									<th v-bind:title="logs.hour.error">{{round(logs.hour.error)}}</th>
 
- 									<th v-bind:title="logs.hour.info">{{round(logs.hour.info)}}</th>
 
- 								</tr>
 
- 								<tr>
 
- 									<th><strong>Average per day</strong></th>
 
- 									<th v-bind:title="logs.day.success">{{round(logs.day.success)}}</th>
 
- 									<th v-bind:title="logs.day.error">{{round(logs.day.error)}}</th>
 
- 									<th v-bind:title="logs.day.info">{{round(logs.day.info)}}</th>
 
- 								</tr>
 
- 							</tbody>
 
- 						</table>
 
- 					</div>
 
- 				</div>
 
- 			</div>
 
- 		</div>
 
- 		<br>
 
- 		<div class="columns">
 
- 			<div class='card column is-10-desktop is-offset-1-desktop is-12-mobile'>
 
- 				<div class='card-content'>
 
- 					<div class='content'>
 
- 						<canvas id="minuteChart" height="400"></canvas>
 
- 					</div>
 
- 				</div>
 
- 			</div>
 
- 		</div>
 
- 		<br>
 
- 		<div class="columns">
 
- 			<div class='card column is-10-desktop is-offset-1-desktop is-12-mobile'>
 
- 				<div class='card-content'>
 
- 					<div class='content'>
 
- 						<canvas id="hourChart" height="400"></canvas>
 
- 					</div>
 
- 				</div>
 
- 			</div>
 
- 		</div>
 
- 	</div>
 
- </template>
 
- <script>
 
- 	import EditUser from '../Modals/EditUser.vue';
 
- 	import io from '../../io';
 
- 	import Chart from 'chart.js'
 
- 	export default {
 
- 		components: {},
 
- 		data() {
 
- 			return {
 
- 				successUnitsPerMinute: [0,0,0,0,0,0,0,0,0,0],
 
- 				errorUnitsPerMinute: [0,0,0,0,0,0,0,0,0,0],
 
- 				infoUnitsPerMinute: [0,0,0,0,0,0,0,0,0,0],
 
- 				successUnitsPerHour: [0,0,0,0,0,0,0,0,0,0],
 
- 				errorUnitsPerHour: [0,0,0,0,0,0,0,0,0,0],
 
- 				infoUnitsPerHour: [0,0,0,0,0,0,0,0,0,0],
 
- 				minuteChart: null,
 
- 				hourChart: null,
 
- 				logs: {
 
- 					second: {
 
- 						success: 0,
 
- 						error: 0,
 
- 						info: 0
 
- 					},
 
- 					minute: {
 
- 						success: 0,
 
- 						error: 0,
 
- 						info: 0
 
- 					},
 
- 					hour: {
 
- 						success: 0,
 
- 						error: 0,
 
- 						info: 0
 
- 					},
 
- 					day: {
 
- 						success: 0,
 
- 						error: 0,
 
- 						info: 0
 
- 					}
 
- 				}
 
- 			}
 
- 		},
 
- 		methods: {
 
- 			init: function () {
 
- 				this.socket.emit('apis.joinAdminRoom', 'statistics', () => {});
 
- 				this.socket.on('event:admin.statistics.success.units.minute', units => {
 
- 					this.successUnitsPerMinute = units;
 
- 					this.minuteChart.data.datasets[0].data = units;
 
- 					this.minuteChart.update();
 
- 				});
 
- 				this.socket.on('event:admin.statistics.error.units.minute', units => {
 
- 					this.errorUnitsPerMinute = units;
 
- 					this.minuteChart.data.datasets[1].data = units;
 
- 					this.minuteChart.update();
 
- 				});
 
- 				this.socket.on('event:admin.statistics.info.units.minute', units => {
 
- 					this.infoUnitsPerMinute = units;
 
- 					this.minuteChart.data.datasets[2].data = units;
 
- 					this.minuteChart.update();
 
- 				});
 
- 				this.socket.on('event:admin.statistics.success.units.hour', units => {
 
- 					this.successUnitsPerHour = units;
 
- 					this.hourChart.data.datasets[0].data = units;
 
- 					this.hourChart.update();
 
- 				});
 
- 				this.socket.on('event:admin.statistics.error.units.hour', units => {
 
- 					this.errorUnitsPerHour = units;
 
- 					this.hourChart.data.datasets[1].data = units;
 
- 					this.hourChart.update();
 
- 				});
 
- 				this.socket.on('event:admin.statistics.info.units.hour', units => {
 
- 					this.infoUnitsPerHour = units;
 
- 					this.hourChart.data.datasets[2].data = units;
 
- 					this.hourChart.update();
 
- 				});
 
- 				this.socket.on('event:admin.statistics.logs', logs => {
 
- 					this.logs = logs;
 
- 				});
 
- 			},
 
- 			round: function(number) {
 
- 				return Math.round(number);
 
- 			}
 
- 		},
 
- 		ready: function () {
 
- 			let _this = this;
 
- 			var minuteCtx = document.getElementById("minuteChart");
 
- 			var hourCtx = document.getElementById("hourChart");
 
- 			_this.minuteChart = new Chart(minuteCtx, {
 
- 				type: 'line',
 
- 				data: {
 
- 					labels: ["-10", "-9", "-8", "-7", "-6", "-5", "-4", "-3", "-2", "-1"],
 
- 					datasets: [
 
- 						{
 
- 							label: 'Success',
 
- 							data: [0,0,0,0,0,0,0,0,0,0],
 
- 							backgroundColor: [
 
- 								'rgba(75, 192, 192, 0.2)'
 
- 							],
 
- 							borderColor: [
 
- 								'rgba(75, 192, 192, 1)'
 
- 							],
 
- 							borderWidth: 1
 
- 						},
 
- 						{
 
- 							label: 'Error',
 
- 							data: [0,0,0,0,0,0,0,0,0,0],
 
- 							backgroundColor: [
 
- 								'rgba(255, 99, 132, 0.2)'
 
- 							],
 
- 							borderColor: [
 
- 								'rgba(255,99,132,1)'
 
- 							],
 
- 							borderWidth: 1
 
- 						},
 
- 						{
 
- 							label: 'Info',
 
- 							data: [0,0,0,0,0,0,0,0,0,0],
 
- 							backgroundColor: [
 
- 								'rgba(54, 162, 235, 0.2)'
 
- 							],
 
- 							borderColor: [
 
- 								'rgba(54, 162, 235, 1)'
 
- 							],
 
- 							borderWidth: 1
 
- 						}
 
- 					]
 
- 				},
 
- 				options: {
 
- 					title: {
 
- 						display: true,
 
- 						text: 'Logs per minute'
 
- 					},
 
- 					scales: {
 
- 						yAxes: [{
 
- 							ticks: {
 
- 								beginAtZero: true,
 
- 								stepSize: 1
 
- 							}
 
- 						}]
 
- 					},
 
- 					responsive: true,
 
- 					maintainAspectRatio: false
 
- 				}
 
- 			});
 
- 			_this.hourChart = new Chart(hourCtx, {
 
- 				type: 'line',
 
- 				data: {
 
- 					labels: ["-10", "-9", "-8", "-7", "-6", "-5", "-4", "-3", "-2", "-1"],
 
- 					datasets: [
 
- 						{
 
- 							label: 'Success',
 
- 							data: [0,0,0,0,0,0,0,0,0,0],
 
- 							backgroundColor: [
 
- 								'rgba(75, 192, 192, 0.2)'
 
- 							],
 
- 							borderColor: [
 
- 								'rgba(75, 192, 192, 1)'
 
- 							],
 
- 							borderWidth: 1
 
- 						},
 
- 						{
 
- 							label: 'Error',
 
- 							data: [0,0,0,0,0,0,0,0,0,0],
 
- 							backgroundColor: [
 
- 								'rgba(255, 99, 132, 0.2)'
 
- 							],
 
- 							borderColor: [
 
- 								'rgba(255,99,132,1)'
 
- 							],
 
- 							borderWidth: 1
 
- 						},
 
- 						{
 
- 							label: 'Info',
 
- 							data: [0,0,0,0,0,0,0,0,0,0],
 
- 							backgroundColor: [
 
- 								'rgba(54, 162, 235, 0.2)'
 
- 							],
 
- 							borderColor: [
 
- 								'rgba(54, 162, 235, 1)'
 
- 							],
 
- 							borderWidth: 1
 
- 						}
 
- 					]
 
- 				},
 
- 				options: {
 
- 					title: {
 
- 						display: true,
 
- 						text: 'Logs per hour'
 
- 					},
 
- 					scales: {
 
- 						yAxes: [{
 
- 							ticks: {
 
- 								beginAtZero: true,
 
- 								stepSize: 1
 
- 							}
 
- 						}]
 
- 					},
 
- 					responsive: true,
 
- 					maintainAspectRatio: false
 
- 				}
 
- 			});
 
- 			io.getSocket(socket => {
 
- 				_this.socket = socket;
 
- 				if (_this.socket.connected) _this.init();
 
- 				io.onConnect(() => _this.init());
 
- 			});
 
- 		}
 
- 	}
 
- </script>
 
- <style lang='scss' scoped>
 
- 	body { font-family: 'Roboto', sans-serif; }
 
- 	.user-avatar {
 
- 		display: block;
 
- 		max-width: 50px;
 
- 		margin: 0 auto;
 
- 	}
 
- 	td { vertical-align: middle; }
 
- 	.is-primary:focus { background-color: #029ce3 !important; }
 
- </style>
 
 
  |