From 021a6240302c22ebc9e8bb8d1200eb9fc316b8e8 Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Thu, 17 Mar 2022 17:42:01 -0400 Subject: [PATCH] Work on checking data and cache. --- app/index.html | 70 ++++++++++++++++++++++++++++++++++++++++++++++- app/js/app_idb.js | 2 ++ app/js/app_v3.js | 20 +++++++------- index.js | 3 +- 4 files changed, 83 insertions(+), 12 deletions(-) diff --git a/app/index.html b/app/index.html index f2ad356..435f2d9 100644 --- a/app/index.html +++ b/app/index.html @@ -50,11 +50,12 @@ - + + @@ -152,6 +153,73 @@ let app_online = false; //let app_use_cached_data = true; window.addEventListener('online', app.currently_online); window.addEventListener('offline', app.currently_offline); + + +/* ***** **** *** ** * ### * ** *** **** ***** */ + +// BEGIN: Load IDB section +let idb_name = app_config.idb_name; + +// let tbl_event = null; +// let tbl_event_location = null; +// let tbl_event_session = null; +// let tbl_event_presentation = null; +// let tbl_event_presenter = null; +// let tbl_event_file = null; +// let tbl_hosted_file = null; + +// let tbl_event_key_count = null; +// let tbl_event_location_key_count = null; +// let tbl_event_session_key_count = null; +// let tbl_event_presentation_key_count = null; +// let tbl_event_presenter_key_count = null; +// let tbl_event_file_key_count = null; +// let tbl_hosted_file_key_count = null; + +// if (window.indexedDB && idb_name) { +// console.log('IndexedDB is supported'); + +// let load_idb_tables_result = load_idb_tables() +// .then(async function (result) { +// console.log('IDB tables have been opened'); +// idb_tables_opened = load_idb_tables_result; + +// console.log('Attempting to use cached IDB data...'); + +// if (tbl_event_key_count +// && tbl_event_location_key_count +// && tbl_event_session_key_count +// && tbl_event_presentation_key_count +// && tbl_event_presenter_key_count +// && tbl_event_file_key_count) { +// console.log('********* Not yet sure how this works... '); +// } else { +// console.log('One or more of the IDB tables has 0 records. The IDB probably needs to be updated.'); +// return true; +// } + +// console.log(tbl_event); +// console.log(tbl_event_location); +// console.log(tbl_event_session); +// console.log(tbl_event_presentation); +// console.log(tbl_event_presenter); +// console.log(tbl_event_file); +// console.log(tbl_hosted_file); +// }) +// .catch(function (error) { +// console.log('Something went wrong opening the IDB tables.'); +// console.log(error); +// return false; +// }); + +// } else { +// console.log('IndexedDB is NOT supported or the IDB name was not set.'); +// close(); +// } + + + + diff --git a/app/js/app_idb.js b/app/js/app_idb.js index ffa8bc1..b4a262a 100644 --- a/app/js/app_idb.js +++ b/app/js/app_idb.js @@ -1,3 +1,5 @@ +console.log('Using app_idb.js'); + async function load_idb_tables() { console.log('****************** Load IDB Tables ******************'); console.log('Loading IDB tables...'); diff --git a/app/js/app_v3.js b/app/js/app_v3.js index c2f2f5e..7d11db4 100644 --- a/app/js/app_v3.js +++ b/app/js/app_v3.js @@ -75,7 +75,7 @@ exports.load_config = function () { // Updated 2022-03-10 exports.check_local_file = async function ({local_file_path, filename}) { console.log('*** Electron framework export: check_local_file() ***'); - console.log('Check for local file'); + // console.log('Check for local file'); console.log(`Local File Path: ${local_file_path}; Filename: ${filename}`); let full_local_file_path = path.join(local_file_path, filename); @@ -94,7 +94,7 @@ exports.check_local_file = async function ({local_file_path, filename}) { // Updated 2022-03-09 exports.check_hash_file_cache = async function ({host_file_cache_path, hash}) { console.log('*** Electron framework export: check_hash_file_cache() ***'); - console.log('Check local hash file cache'); + // console.log('Check local hash file cache'); console.log(`Host File Cache Path: ${host_file_cache_path}; Hash: ${hash}`); let hash_filename = `${hash}.file`; @@ -116,7 +116,7 @@ exports.check_hash_file_cache = async function ({host_file_cache_path, hash}) { // Updated 2022-03-09 exports.download_hash_file_to_cache = async function ({host_file_cache_path, event_file_id=null, hash=null}) { console.log('*** Electron framework export: download_hash_file_to_cache() ***'); - console.log('Download hash file to cache'); + // console.log('Download hash file to cache'); console.log(`Host File Cache Path: ${host_file_cache_path}; Event File ID: ${event_file_id}; Hash: ${hash}`); let endpoint = `/event/file/${event_file_id}/download`; @@ -131,8 +131,8 @@ exports.download_hash_file_to_cache = async function ({host_file_cache_path, eve return true; }); - console.log(download_file_result); - console.log('End: download_hash_file_to_cache()'); + // console.log(download_file_result); + // console.log('End: download_hash_file_to_cache()'); if (download_file_result) { console.log('File downloaded successfully'); return true; @@ -147,7 +147,7 @@ exports.download_hash_file_to_cache = async function ({host_file_cache_path, eve // Updated 2022-03-09 exports.open_hash_file_to_temp = async function ({host_file_cache_path, hash, host_file_temp_path, filename}) { console.log('*** Electron framework export: open_hash_file_to_temp() ***'); - console.log('Open cached hash file after copying to temp directory'); + // console.log('Open cached hash file after copying to temp directory'); console.log(`Host File Cache Path: ${host_file_cache_path}; Hash: ${hash}; Host File Temp Path: ${host_file_temp_path}; Filename: ${filename}`); let open_hash_file_to_temp_result = await ipcRenderer.invoke('open_hash_file_to_temp', host_file_cache_path, hash, host_file_temp_path, filename).then((result) => { @@ -175,7 +175,7 @@ exports.open_hash_file_to_temp = async function ({host_file_cache_path, hash, ho // Updated 2022-03-10 exports.open_local_file = async function ({local_file_path, filename}) { console.log('*** Electron framework export: open_local_file() ***'); - console.log('Open local file'); + // console.log('Open local file'); console.log(`Local File Path: ${local_file_path}; Filename: ${filename}`); // let full_local_file_path = path.join(local_file_path, filename); @@ -213,7 +213,7 @@ exports.open_local_file = async function ({local_file_path, filename}) { // exports.check_file_cache = async function ({host_file_cache_path, event_file_id, hash}) { exports.check_file_cache = async function ({host_file_cache_path, event_file_id, hash}) { console.log('*** Electron framework export: check_file_cache() ***'); - console.log('Check local file cache and download from server if needed.'); + // console.log('Check local file cache and download from server if needed.'); console.log(`Host File Cache Path: ${host_file_cache_path}; Event File ID: ${event_file_id}; Hash: ${hash}`); // NOTE: event_file_id is the event_file.id_random or event_file.event_file_id_random @@ -269,7 +269,7 @@ exports.check_file_cache = async function ({host_file_cache_path, event_file_id, // Updated 2022-03-09 async function check_file_cache({host_file_cache_path, event_file_id, hash}) { console.log('*** Electron framework: check_file_cache() ***'); - console.log('Check local file cache and download from server if needed.'); + // console.log('Check local file cache and download from server if needed.'); console.log(`Host File Cache Path: ${host_file_cache_path}; Event File ID: ${event_file_id}; Hash: ${hash}`); // NOTE: event_file_id is the event_file.id_random or event_file.event_file_id_random @@ -323,7 +323,7 @@ async function check_file_cache({host_file_cache_path, event_file_id, hash}) { // Updated 2022-03-09 async function open_local_file({host_file_cache_path, hash, host_file_temp_path, filename}) { console.log('*** Electron framework: open_local_file() ***'); - console.log('Open local file cache if available. Copy to temp directory with given filename first.'); + // console.log('Open local file cache if available. Copy to temp directory with given filename first.'); console.log(`Host File Cache Path: ${host_file_cache_path}; Hash: ${hash}; Host File Temp Path: ${host_file_temp_path}; Filename: ${filename}`); console.log(host_file_cache_path); diff --git a/index.js b/index.js index 091bbeb..3cfbc4d 100644 --- a/index.js +++ b/index.js @@ -44,7 +44,8 @@ function createWindow () { } }) - win.setMinimumSize(1024, 768); + // win.setMinimumSize(1024, 768); + win.setMinimumSize(1280, 768); //win.setFullScreenable(false) win.FullScreenable = false;