mirror of
https://github.com/EFForg/rayhunter.git
synced 2026-05-03 18:49:08 -07:00
Fix rendering of last_message_time in UI
* last_message_time is shown inconsistently for current entry vs other entries -- deduplicate code * last_message_time is N/A for undefined -- but the API response was null instead of undefined.
This commit is contained in:
committed by
Will Greenberg
parent
9144259202
commit
4e792b1402
@@ -170,26 +170,27 @@ async function getSystemStats() {
|
|||||||
async function getQmdlManifest() {
|
async function getQmdlManifest() {
|
||||||
const manifest = JSON.parse(await req('GET', '/api/qmdl-manifest'));
|
const manifest = JSON.parse(await req('GET', '/api/qmdl-manifest'));
|
||||||
if (manifest.current_entry) {
|
if (manifest.current_entry) {
|
||||||
manifest.current_entry.status = STATUS_NEEDS_UPDATE;
|
parseQmdlEntry(manifest.current_entry);
|
||||||
manifest.current_entry.analysis_result = 'Waiting...';
|
|
||||||
manifest.current_entry.start_time = new Date(manifest.current_entry.start_time);
|
|
||||||
if (manifest.current_entry.last_message_time === undefined) {
|
|
||||||
manifest.current_entry.last_message_time = "N/A";
|
|
||||||
} else {
|
|
||||||
manifest.current_entry.last_message_time = new Date(manifest.current_entry.last_message_time);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
for (entry of manifest.entries) {
|
for (entry of manifest.entries) {
|
||||||
entry.status = STATUS_NEEDS_UPDATE;
|
parseQmdlEntry(entry);
|
||||||
entry.analysis_result = 'Waiting...';
|
|
||||||
entry.start_time = new Date(entry.start_time);
|
|
||||||
entry.last_message_time = new Date(entry.last_message_time);
|
|
||||||
}
|
}
|
||||||
// sort them in reverse chronological order
|
// sort them in reverse chronological order
|
||||||
manifest.entries.reverse();
|
manifest.entries.reverse();
|
||||||
return manifest;
|
return manifest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function parseQmdlEntry(entry) {
|
||||||
|
entry.status = STATUS_NEEDS_UPDATE;
|
||||||
|
entry.analysis_result = 'Waiting...';
|
||||||
|
entry.start_time = new Date(entry.start_time);
|
||||||
|
if (entry.last_message_time === null) {
|
||||||
|
entry.last_message_time = "N/A";
|
||||||
|
} else {
|
||||||
|
entry.last_message_time = new Date(entry.last_message_time);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function startRecording() {
|
async function startRecording() {
|
||||||
await req('POST', '/api/start-recording');
|
await req('POST', '/api/start-recording');
|
||||||
populateDivs();
|
populateDivs();
|
||||||
|
|||||||
Reference in New Issue
Block a user