Still working on network online offline detection...

This commit is contained in:
Scott Idem
2020-03-06 10:19:50 -05:00
parent bb492e8f71
commit 988eceb13e
9 changed files with 119 additions and 85 deletions

Binary file not shown.

View File

@@ -7,20 +7,13 @@ async function api_token_request_async(axios, secret_key) {
} else {
}
if (navigator.onLine) {
} else {
app_online = false;
return false;
}
waiting_on_api_token = true;
const url = '/api_token_request';
let data = { secret_key: secret_key };
const response = await axios.post(url, data)
const result = await axios.post(url, data)
.then(function (response) {
//console.log(response);
const api_temporary_token = response.data.temporary_token;
@@ -33,7 +26,7 @@ async function api_token_request_async(axios, secret_key) {
});
waiting_on_api_token = false;
return response;
return result;
}

View File

@@ -14,7 +14,7 @@ async function render_event_file_records() {
looping_tbl_event_file = true;
console.log('Iterating through the tbl_event_file table...');
await tbl_event_file.iterate(function(value, key, iteration) {
let tbl_event_file_result = await tbl_event_file.iterate(function(value, key, iteration) {
let tbl_file_id = value.id;
let tbl_hosted_file_id = value.hosted_file_id;
let tbl_event_id = value.event_id;
@@ -213,8 +213,15 @@ async function render_event_file_records() {
}).then(function() {
console.log('idb_to_ui: Iterate tbl_event_file looking for files to add is complete');
looping_tbl_event_file = false;
return true;
})
.catch(function (error) {
console.log('Something went wrong in function render_event_file_records.');
console.log(error);
return false;
});
index_open_file_buttons('open_local_file');
return true;

View File

@@ -2,7 +2,7 @@ const path = require('path');
const { ipcRenderer } = require('electron');
//exports.render_event_records = function () {
function render_event_records() {
async function render_event_records() {
console.log('Rendering event records...');
//console.log(tbl_event);
//console.log(event_id);

View File

@@ -10,6 +10,7 @@ async function render_event_presentation_records(events) {
}
let launcher_sessions = document.getElementById('launcher_sessions').childNodes; //_list_items
//console.log(launcher_sessions);
@@ -30,7 +31,7 @@ async function render_event_presentation_records(events) {
console.log('Current launcher presentation_id='+presentations_list[j].getAttribute('data-presentation_id'));
let presentation_id = presentations_list[j].getAttribute('data-presentation_id');
await tbl_event_presentation.iterate(function(value, key, iteration) {
let tbl_event_presentation_result = await tbl_event_presentation.iterate(function(value, key, iteration) {
//console.log('*** 1: session_id='+session_id+' | presentation.event_session_id='+value.event_session_id+' | presentation_id='+presentation_id+' | presentation.id='+value.id+' (launcher sessions loop i='+i+')');
looping_tbl_event_presentation = true;
if (session_id == value.event_session_id && presentation_id == value.id) {
@@ -67,7 +68,7 @@ async function render_event_presentation_records(events) {
// Now that the updates and removals have been done we need to add presentations.
await tbl_event_presentation.iterate(function(value, key, iteration) {
let tbl_event_presentation_result = await tbl_event_presentation.iterate(function(value, key, iteration) {
//console.log('*** 2: session_id='+session_id+' | presentation.event_session_id='+value.event_session_id+' | presentation.id='+value.id+' (launcher sessions loop i='+i+')');
looping_tbl_event_presentation = true;
@@ -200,10 +201,15 @@ async function render_event_presentation_records(events) {
}).then(function() {
console.log('idb_to_ui: Iterate tbl_event_presentation looking for presentations to add is complete');
looping_tbl_event_presentation = false;
return true;
})
.catch(function (error) {
console.log('Something went wrong in function render_event_presentation_records.');
console.log(error);
return false;
});
}
return true;
return result;
}

View File

@@ -16,7 +16,7 @@ async function render_event_presenter_records(events) {
//console.log(presentations_presenters_lists);
// First: Loop through the presenters table looking for presenters for each presentation list
await tbl_event_presenter.iterate(function(value, key, iteration) {
let tbl_event_presenter_result = await tbl_event_presenter.iterate(function(value, key, iteration) {
let tbl_session_id = value.event_session_id;
let tbl_presentation_id = value.event_presentation_id;
let tbl_presenter_id = value.id;
@@ -207,6 +207,12 @@ async function render_event_presenter_records(events) {
}).then(function() {
console.log('idb_to_ui: Iterate tbl_event_presenter looking for presenters to update, add, or remove is complete');
looping_tbl_event_presenter = false;
return true;
})
.catch(function (error) {
console.log('Something went wrong in function render_event_presenter_records.');
console.log(error);
return false;
});
return true;

View File

@@ -9,10 +9,11 @@ async function render_event_session_records() {
}
looping_tbl_event_session = true;
// First: update or add sessions
tbl_event_session.iterate(function(value, key, iteration) {
result = tbl_event_session.iterate(await function(value, key, iteration) {
if (value.event_id == event_id && value.event_location_id == event_location_id) {
console.log('*** Event session id ('+value.id+') is part of this event location.');
@@ -238,12 +239,11 @@ async function render_event_session_records() {
}
looping_tbl_event_session = false;
// Third: re-index view session buttons
index_launcher_sessions('btn_view_session');
return true
});
// Third: re-index view session buttons
// NOTE: Should this go in a .then() section?
// NOTE: It might make even more sense to only have this done individually per add. Should also do a remove to keep things clean.
//index_launcher_sessions('btn_view_session');
index_launcher_sessions('btn_view_session');
return result;
}