v0.1.20 - Fixed auth white and black lists
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Blossom Admin 2</title>
|
||||
<title>Blossom Admin</title>
|
||||
<link rel="stylesheet" href="/api/index.css">
|
||||
</head>
|
||||
|
||||
|
||||
55
api/index.js
55
api/index.js
@@ -3889,40 +3889,69 @@ function handleViewQueryResponse(viewName, responseData) {
|
||||
// Route to appropriate handler based on view name
|
||||
switch (viewName) {
|
||||
case 'blob_overview':
|
||||
if (responseData.data && Array.isArray(responseData.data) && responseData.data.length > 0) {
|
||||
const overviewData = responseData.data[0];
|
||||
if (responseData.rows && Array.isArray(responseData.rows) && responseData.rows.length > 0) {
|
||||
// Convert row array to object using column names
|
||||
const overviewData = {};
|
||||
responseData.columns.forEach((col, idx) => {
|
||||
overviewData[col] = responseData.rows[0][idx];
|
||||
});
|
||||
populateStatsOverview(overviewData);
|
||||
|
||||
// Update chart with total blobs count
|
||||
const currentTotal = overviewData.total_blobs;
|
||||
if (currentTotal !== undefined) {
|
||||
// Calculate new blobs since last update for chart
|
||||
if (previousTotalBlobs > 0) {
|
||||
// Initialize previousTotalBlobs on first load
|
||||
if (previousTotalBlobs === 0) {
|
||||
previousTotalBlobs = currentTotal;
|
||||
console.log(`Initialized previousTotalBlobs to ${currentTotal}`);
|
||||
} else {
|
||||
// Calculate new blobs since last update for chart
|
||||
const newBlobs = currentTotal - previousTotalBlobs;
|
||||
if (newBlobs > 0 && eventRateChart) {
|
||||
console.log(`Adding ${newBlobs} new blobs to rate chart (${currentTotal} - ${previousTotalBlobs})`);
|
||||
eventRateChart.addValue(newBlobs);
|
||||
}
|
||||
|
||||
// Update previous total for next calculation
|
||||
previousTotalBlobs = currentTotal;
|
||||
}
|
||||
|
||||
// Update previous total for next calculation
|
||||
previousTotalBlobs = currentTotal;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'blob_type_distribution':
|
||||
if (responseData.data && Array.isArray(responseData.data)) {
|
||||
populateStatsKinds(responseData.data);
|
||||
if (responseData.rows && Array.isArray(responseData.rows)) {
|
||||
// Convert rows to array of objects
|
||||
const typeData = responseData.rows.map(row => {
|
||||
const obj = {};
|
||||
responseData.columns.forEach((col, idx) => {
|
||||
obj[col] = row[idx];
|
||||
});
|
||||
return obj;
|
||||
});
|
||||
populateStatsKinds(typeData);
|
||||
}
|
||||
break;
|
||||
case 'blob_time_stats':
|
||||
if (responseData.data && Array.isArray(responseData.data) && responseData.data.length > 0) {
|
||||
populateStatsTime(responseData.data[0]);
|
||||
if (responseData.rows && Array.isArray(responseData.rows) && responseData.rows.length > 0) {
|
||||
// Convert row array to object using column names
|
||||
const timeData = {};
|
||||
responseData.columns.forEach((col, idx) => {
|
||||
timeData[col] = responseData.rows[0][idx];
|
||||
});
|
||||
populateStatsTime(timeData);
|
||||
}
|
||||
break;
|
||||
case 'top_uploaders':
|
||||
if (responseData.data && Array.isArray(responseData.data)) {
|
||||
populateStatsPubkeys(responseData.data);
|
||||
if (responseData.rows && Array.isArray(responseData.rows)) {
|
||||
// Convert rows to array of objects
|
||||
const uploadersData = responseData.rows.map(row => {
|
||||
const obj = {};
|
||||
responseData.columns.forEach((col, idx) => {
|
||||
obj[col] = row[idx];
|
||||
});
|
||||
return obj;
|
||||
});
|
||||
populateStatsPubkeys(uploadersData);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user