diff --git a/app/index.html b/app/index.html index 482e03e..60afa73 100644 --- a/app/index.html +++ b/app/index.html @@ -70,13 +70,14 @@ +
- + @@ -110,28 +111,29 @@ - - - + - diff --git a/app/js/app_api.js b/app/js/app_api.js index 6cccb5b..ffb6261 100644 --- a/app/js/app_api.js +++ b/app/js/app_api.js @@ -1,4 +1,5 @@ async function api_token_request_async(axios, secret_key) { + console.log('****************** API Token Request ******************'); console.log('Requesting API temporary token...'); if (waiting_on_api_token) { diff --git a/app/js/app_idb.js b/app/js/app_idb.js new file mode 100644 index 0000000..fecbc37 --- /dev/null +++ b/app/js/app_idb.js @@ -0,0 +1,57 @@ +async function load_idb_tables() { + console.log('****************** Load IDB Tables ******************'); + console.log('Loading IDB tables...'); + + localforage.config({ + driver: localforage.INDEXEDDB, + version: 1, + name: idb_name + }); + + tbl_event = await localforage.createInstance({ + name: idb_name, + storeName: 'event', + }); + console.log('tbl_event count: '+ await tbl_event.length()); + tbl_event_key_count = await tbl_event.length(); + + tbl_event_location = await localforage.createInstance({ + name: idb_name, + storeName: 'event_location', + }); + console.log('tbl_event_location count: '+ await tbl_event_location.length()); + tbl_event_location_key_count = await tbl_event_location.length(); + + tbl_event_session = await localforage.createInstance({ + name: idb_name, + storeName: 'event_session', + }); + console.log('tbl_event_session count: '+ await tbl_event_session.length()); + tbl_event_session_key_count = await tbl_event_session.length(); + + tbl_event_presentation = await localforage.createInstance({ + name: idb_name, + storeName: 'event_presentation', + }); + console.log('tbl_event_presentation count: '+ await tbl_event_presentation.length()); + tbl_event_presentation_key_count = await tbl_event_presentation.length(); + + tbl_event_presenter = await localforage.createInstance({ + name: idb_name, + storeName: 'event_presenter', + }); + console.log('tbl_event_presenter count: '+ await tbl_event_presenter.length()); + tbl_event_presenter_key_count = await tbl_event_presenter.length(); + + + tbl_event_file = await localforage.createInstance({ + name: idb_name, + storeName: 'event_file', + }); + console.log('tbl_event_file count: '+ await tbl_event_file.length()); + tbl_event_file_key_count = await tbl_event_file.length(); + + console.log('IDB tables have now been opened.'); + + return true; +} diff --git a/app/js/app_ui_files.js b/app/js/app_ui_files.js index 8b602aa..2d81c37 100644 --- a/app/js/app_ui_files.js +++ b/app/js/app_ui_files.js @@ -1,8 +1,8 @@ // This function is used to render all event, location, session, presentation, and presenter file records to the UI. //exports.render_event_file_records = async function () { async function render_event_file_records() { - console.log('Rendering all event, location, session, presentation, and presenter file records...'); console.log('****************** Files ******************'); + console.log('Rendering all event, location, session, presentation, and presenter file records...'); if (looping_tbl_event_file) { console.log('Already looping through the tbl_event_file table. Not starting until finished.'); diff --git a/app/js/app_ui_misc.js b/app/js/app_ui_misc.js index 26b6591..811fff1 100644 --- a/app/js/app_ui_misc.js +++ b/app/js/app_ui_misc.js @@ -3,6 +3,7 @@ const { ipcRenderer } = require('electron'); //exports.render_event_records = function () { async function render_event_records() { + console.log('****************** Events ******************'); console.log('Rendering event records...'); //console.log(tbl_event); //console.log(event_id); @@ -35,6 +36,7 @@ async function render_event_records() { //exports.render_event_location_records = async function () { async function render_event_location_records() { + console.log('****************** Locations ******************'); console.log('Rendering event location records...'); if (looping_tbl_event_location) { @@ -109,8 +111,8 @@ function view_session(session_id) { /* Updated 2020-02-13 */ function index_open_file_buttons(class_name) { - console.log('Indexing open file buttons...'); console.log('****************** Indexing ******************'); + console.log('Indexing open file buttons...'); var class_elements = document.getElementsByClassName(class_name); //console.log(class_elements); diff --git a/app/js/app_ui_presentations.js b/app/js/app_ui_presentations.js index e87451d..f9c3f03 100644 --- a/app/js/app_ui_presentations.js +++ b/app/js/app_ui_presentations.js @@ -1,7 +1,7 @@ //exports.render_event_presentation_records = async function (events) { async function render_event_presentation_records(events) { - console.log('Rendering event presentation records...'); console.log('****************** Presentations ******************'); + console.log('Rendering event presentation records...'); if (looping_tbl_event_presentation) { console.log('Already looping through the tbl_event_presentation table. Not starting until finished.'); diff --git a/app/js/app_ui_presenters.js b/app/js/app_ui_presenters.js index 2f97486..7e7cb23 100644 --- a/app/js/app_ui_presenters.js +++ b/app/js/app_ui_presenters.js @@ -1,7 +1,7 @@ //exports.render_event_presenter_records = async function (events) { async function render_event_presenter_records(events) { - console.log('Rendering event presenter records...'); console.log('****************** Presenters ******************'); + console.log('Rendering event presenter records...'); if (looping_tbl_event_presenter) { console.log('Already looping through the tbl_event_presenter table. Not starting until finished.'); diff --git a/app/js/app_ui_sessions.js b/app/js/app_ui_sessions.js index 3279619..3968977 100644 --- a/app/js/app_ui_sessions.js +++ b/app/js/app_ui_sessions.js @@ -1,5 +1,6 @@ //exports.render_event_session_records = async function () { async function render_event_session_records() { + console.log('****************** Sessions ******************'); console.log('Rendering event session records...'); if (looping_tbl_event_session) { diff --git a/app/js/module_app_idb.js b/app/js/module_app_idb.js deleted file mode 100644 index bcf0bc1..0000000 --- a/app/js/module_app_idb.js +++ /dev/null @@ -1,40 +0,0 @@ -const os = require('os'); -const path = require('path'); -const fs = require('fs'); - -const { ipcRenderer } = require('electron'); - -exports.check_file_cache = async function () { - console.log('**** *** ** * FUNCTION: check_file_cache * ** *** ****'); - console.log('Checking the local file cache against the remote server.'); - console.log(api_base_url); - console.log(api_temporary_token); - - //console.log(save_path); - if (api_base_url && api_temporary_token) { - tbl_event_file.iterate(function(file_value, key, iteration) { - //if (file_value.event_location_id == event_location_id) { - //console.log('f: ('+file_value.event_file_id+') '+file_value.event_file_filename+' ***') - - file_id = file_value.id; // NOTE: This is the event_file.id or event_file_id. - let filename = file_value.hosted_file_hash_sha256+'.file'; - - save_path = path.join(host_file_cache_path, filename); - - if (fs.existsSync(save_path)) { - //console.log('Local file already exists: '+save_path); - } else { - console.log('File not found locally. Downloading file: '+save_path); - let api_endpoint = '/event/file/'+file_id+'/download'; - ipcRenderer.send('download_file', api_base_url, api_endpoint, api_temporary_token, save_path); // Must download file using main node.js thread. - } - }); - } else { - console.log('The api_base_url or api_temporary_token has not been set.'); - console.log(api_base_url); - console.log(api_temporary_token); - return false; - } - - return true; -} diff --git a/config.json.default b/config.json.default index be8fa8f..1a4880a 100644 --- a/config.json.default +++ b/config.json.default @@ -4,6 +4,8 @@ "event_id": 14, "event_location_id": 13, "main_loop_interval": 2000, + "api_token_loop_interval": 1000, + "api_update_period": 90000, "api_secret_key": "YWAAk39H2qH0edK6lPH0yg", "use_local_api": true, "use_local_db": false, @@ -20,6 +22,7 @@ "local_db_name": "onesky_ams_test", "local_db_username": "username_here", "local_db_password": "password_here", + "update_idb_loop_interval": 1000, "idb_name": "osit", "idb_check_period": 30000, "idb_event_check_period": 120000, @@ -28,11 +31,17 @@ "idb_event_presentation_check_period": 60000, "idb_event_presenter_check_period": 60000, "idb_event_file_check_period": 60000, + "check_file_cache_loop_interval": 250, "host_file_cache_path": "file_cache", "host_file_cache_check_period": 30000, + "update_render_loop_interval": 1000, + "display_menu_session_times": true, "display_session_codes": true, + "display_session_badges": true, "display_presentation_codes": true, + "display_presentation_badges": true, "display_presenter_codes": true, + "display_presenter_badges": true, "display_arrangement": "mirror_and_extend", "display_builtin_resolution": "", "display_builtin_refresh": "",