mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
117 lines
3.7 KiB
HTML
117 lines
3.7 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Wabbajack Metrics</title>
|
|
<script
|
|
crossorigin="anonymous"
|
|
integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0="
|
|
src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/chart.js@2.8.0"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-colorschemes"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.9.1/underscore-min.js"></script>
|
|
</head>
|
|
<body>
|
|
|
|
<h2>Finished Install Counts</h2>
|
|
<canvas height="600" id="finished_install_count" width="800"></canvas>
|
|
<hr/>
|
|
|
|
<h2>Begin Download</h2>
|
|
<canvas height="600" id="begin_download_chart" width="800"></canvas>
|
|
<hr/>
|
|
|
|
<h2>Begin Install</h2>
|
|
<canvas height="600" id="begin_install_chart" width="800"></canvas>
|
|
<hr/>
|
|
|
|
<h2>Finished Install</h2>
|
|
<canvas height="600" id="finished_install_chart" width="800"></canvas>
|
|
<hr/>
|
|
|
|
<h2>Started Wabbajack</h2>
|
|
<canvas height="600" id="started_wabbajack_chart" width="800"></canvas>
|
|
<hr/>
|
|
|
|
<h2>Exceptions</h2>
|
|
<canvas height="600" id="exceptions_chart" width="800"></canvas>
|
|
<hr/>
|
|
|
|
|
|
<script>
|
|
|
|
var getReport = function (subject, from, callback) {
|
|
$.getJSON("/metrics/report/?action=" + subject + "&from=" + from + "&to=now", callback)
|
|
}
|
|
|
|
var makeChart = function (ele, group) {
|
|
|
|
var result_fn = function (data) {
|
|
var labels = _.map(data, f => f._Timestamp);
|
|
var datasets = _.map(_.filter(Object.keys(data[0]), key => key !== "_Timestamp"), key => {
|
|
return {
|
|
label: key,
|
|
fill: false,
|
|
data: _.map(data, row => row[key])
|
|
}
|
|
});
|
|
var ctx = document.getElementById(ele).getContext('2d');
|
|
var chart = new Chart(ctx, {
|
|
// The type of chart we want to create
|
|
type: 'bar',
|
|
|
|
// The data for our dataset
|
|
data: {
|
|
labels: _.last(labels, 90),
|
|
datasets: datasets
|
|
},
|
|
|
|
// Configuration options go here
|
|
options: {scales: {xAxes: [{stacked: true}], yAxes: [{stacked: true}]}}
|
|
});
|
|
};
|
|
getReport(group, "30 days ago", result_fn);
|
|
};
|
|
|
|
|
|
var makePieChart = function (ele, group) {
|
|
|
|
var result_fn = function (data) {
|
|
const counts = {};
|
|
for (var row of data) {
|
|
for (var key of Object.keys(row)) {
|
|
if (key === "_Timestamp") continue;
|
|
counts[key] = (counts[key] || 0) + row[key]
|
|
}
|
|
}
|
|
|
|
var ctx = document.getElementById(ele).getContext('2d');
|
|
var chart = new Chart(ctx, {
|
|
// The type of chart we want to create
|
|
type: 'pie',
|
|
|
|
// The data for our dataset
|
|
data: {
|
|
labels: Object.keys(counts),
|
|
datasets: [{
|
|
label: "Data",
|
|
data: Object.values(counts)
|
|
}]
|
|
},
|
|
|
|
// Configuration options go here
|
|
options: {}
|
|
});
|
|
};
|
|
getReport(group, "10 years ago", result_fn)
|
|
};
|
|
|
|
makeChart("begin_download_chart", "downloading");
|
|
makeChart("begin_install_chart", "begin_install");
|
|
makeChart("finished_install_chart", "finish_install");
|
|
makeChart("started_wabbajack_chart", "started_wabbajack");
|
|
makeChart("exceptions_chart", "Exception");
|
|
makePieChart("finished_install_count", "finish_install");
|
|
</script>
|
|
</body>
|
|
</html> |