A lot of clean up of code.
This commit is contained in:
193
app/index.html
193
app/index.html
@@ -70,13 +70,14 @@
|
|||||||
</div>
|
</div>
|
||||||
<!--</main>--> <!-- /.container -->
|
<!--</main>--> <!-- /.container -->
|
||||||
|
|
||||||
|
<!-- BEGIN: App status bar -->
|
||||||
<div id="app_status_bar" class="app_status_bar">
|
<div id="app_status_bar" class="app_status_bar">
|
||||||
<span id="app_network_status" class="app_network_status">
|
<span id="app_network_status" class="app_network_status">
|
||||||
<span class="fas fa-globe"></span> Network Status
|
<span class="fas fa-globe"></span> Network Status
|
||||||
</span>
|
</span>
|
||||||
<span id="app_datetime" class="app_datetime">datetime</span>
|
<span id="app_datetime" class="app_datetime">datetime</span>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- END: App status bar -->
|
||||||
|
|
||||||
|
|
||||||
<!-- JavaScript (JS) start -->
|
<!-- JavaScript (JS) start -->
|
||||||
@@ -110,28 +111,29 @@
|
|||||||
|
|
||||||
<!-- One Sky IT site custom JavaScript (JS) -->
|
<!-- One Sky IT site custom JavaScript (JS) -->
|
||||||
<script>const app = require('./js/module_app');</script>
|
<script>const app = require('./js/module_app');</script>
|
||||||
<!--<script>const api = require('./js/module_api');</script>-->
|
|
||||||
<!--<script>const idb = require('./js/module_app_idb');</script>-->
|
|
||||||
<!--<script src="js/api.js"></script>-->
|
|
||||||
<script src="js/app_api.js"></script>
|
<script src="js/app_api.js"></script>
|
||||||
|
<script src="js/app_idb.js"></script>
|
||||||
<script src="js/app_ui_misc.js"></script>
|
<script src="js/app_ui_misc.js"></script>
|
||||||
<script src="js/app_ui_sessions.js"></script>
|
<script src="js/app_ui_sessions.js"></script>
|
||||||
<script src="js/app_ui_presentations.js"></script>
|
<script src="js/app_ui_presentations.js"></script>
|
||||||
<script src="js/app_ui_presenters.js"></script>
|
<script src="js/app_ui_presenters.js"></script>
|
||||||
<script src="js/app_ui_files.js"></script>
|
<script src="js/app_ui_files.js"></script>
|
||||||
<!--<script src="js/testing.js"></script>-->
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
/* ***** **** *** ** * ### * ** *** **** ***** */
|
||||||
|
|
||||||
|
|
||||||
let app_config = app.load_config();
|
let app_config = app.load_config();
|
||||||
let account_id = app_config.account_id;
|
let account_id = app_config.account_id;
|
||||||
let event_id = app_config.event_id;
|
let event_id = app_config.event_id;
|
||||||
let event_location_id = app_config.event_location_id;
|
let event_location_id = app_config.event_location_id;
|
||||||
|
|
||||||
|
|
||||||
/* ***** **** *** ** * ### * ** *** **** ***** */
|
/* ***** **** *** ** * ### * ** *** **** ***** */
|
||||||
|
|
||||||
// Start of set display options
|
// BEGIN: Set display options
|
||||||
|
|
||||||
|
|
||||||
|
const display_menu_session_times = app_config.display_menu_session_times;
|
||||||
const display_session_codes = app_config.display_session_codes;
|
const display_session_codes = app_config.display_session_codes;
|
||||||
const display_session_badges = app_config.display_session_badges;
|
const display_session_badges = app_config.display_session_badges;
|
||||||
const display_presentation_codes = app_config.display_presentation_codes; // NOTE: not currently used
|
const display_presentation_codes = app_config.display_presentation_codes; // NOTE: not currently used
|
||||||
@@ -140,11 +142,11 @@
|
|||||||
const display_presenter_badges = app_config.display_presenter_badges; // NOTE: not currently used
|
const display_presenter_badges = app_config.display_presenter_badges; // NOTE: not currently used
|
||||||
|
|
||||||
|
|
||||||
// End of set display options
|
// END: Set display options
|
||||||
|
|
||||||
/* ***** **** *** ** * ### * ** *** **** ***** */
|
/* ***** **** *** ** * ### * ** *** **** ***** */
|
||||||
|
|
||||||
// Start of API section
|
// BEGIN: API section
|
||||||
|
|
||||||
|
|
||||||
const api_token_loop_interval = app_config.api_token_loop_interval;
|
const api_token_loop_interval = app_config.api_token_loop_interval;
|
||||||
@@ -170,22 +172,23 @@
|
|||||||
let axios_headers_set = false;
|
let axios_headers_set = false;
|
||||||
|
|
||||||
let app_online = false;
|
let app_online = false;
|
||||||
let app_use_cached_data = true;
|
//let app_use_cached_data = true;
|
||||||
window.addEventListener('online', app.currently_online);
|
window.addEventListener('online', app.currently_online);
|
||||||
window.addEventListener('offline', app.currently_offline);
|
window.addEventListener('offline', app.currently_offline);
|
||||||
|
|
||||||
|
/*
|
||||||
let update_event_ui = false;
|
let update_event_ui = false;
|
||||||
let update_event_location_ui = false;
|
let update_event_location_ui = false;
|
||||||
let update_event_session_ui = false;
|
let update_event_session_ui = false;
|
||||||
let update_event_presentation_ui = false;
|
let update_event_presentation_ui = false;
|
||||||
let update_event_presenter_ui = false;
|
let update_event_presenter_ui = false;
|
||||||
let update_event_file_ui = false;
|
let update_event_file_ui = false;
|
||||||
|
*/
|
||||||
if (navigator.onLine) {
|
if (navigator.onLine) {
|
||||||
app.currently_online();
|
app.currently_online();
|
||||||
} else {
|
} else {
|
||||||
app.currently_offline();
|
app.currently_offline();
|
||||||
|
/*
|
||||||
console.log('Using cached IDB data.');
|
console.log('Using cached IDB data.');
|
||||||
update_event_ui = true;
|
update_event_ui = true;
|
||||||
update_event_location_ui = true;
|
update_event_location_ui = true;
|
||||||
@@ -193,9 +196,12 @@
|
|||||||
update_event_presentation_ui = true;
|
update_event_presentation_ui = true;
|
||||||
update_event_presenter_ui = true;
|
update_event_presenter_ui = true;
|
||||||
update_event_file_ui = true;
|
update_event_file_ui = true;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
var api_token_loop = setInterval(async function() {
|
var api_token_loop = setInterval(async function() {
|
||||||
|
//console.log('****************** LOOP: API Token Loop ******************');
|
||||||
|
|
||||||
if (app_online && api_update_datetime < Date.now()) {
|
if (app_online && api_update_datetime < Date.now()) {
|
||||||
//let api_temporary_token_result = api_token_request_async(axios, secret_key)
|
//let api_temporary_token_result = api_token_request_async(axios, secret_key)
|
||||||
api_temporary_token = await api_token_request_async(axios, secret_key)
|
api_temporary_token = await api_token_request_async(axios, secret_key)
|
||||||
@@ -229,22 +235,15 @@
|
|||||||
}, api_token_loop_interval);
|
}, api_token_loop_interval);
|
||||||
|
|
||||||
|
|
||||||
// End of API section
|
// END: API section
|
||||||
|
|
||||||
/* ***** **** *** ** * ### * ** *** **** ***** */
|
/* ***** **** *** ** * ### * ** *** **** ***** */
|
||||||
|
|
||||||
// Start of IDB section
|
// BEGIN: Load IDB section
|
||||||
|
|
||||||
|
|
||||||
let idb_name = app_config.idb_name;
|
let idb_name = app_config.idb_name;
|
||||||
|
|
||||||
if (window.indexedDB) {
|
|
||||||
console.log('IndexedDB is supported');
|
|
||||||
} else {
|
|
||||||
console.log('IndexedDB is NOT supported');
|
|
||||||
close();
|
|
||||||
}
|
|
||||||
|
|
||||||
var tbl_event = null;
|
var tbl_event = null;
|
||||||
var tbl_event_location = null;
|
var tbl_event_location = null;
|
||||||
var tbl_event_session = null;
|
var tbl_event_session = null;
|
||||||
@@ -261,74 +260,7 @@
|
|||||||
var tbl_event_file_key_count = null;
|
var tbl_event_file_key_count = null;
|
||||||
var tbl_hosted_file_key_count = null;
|
var tbl_hosted_file_key_count = null;
|
||||||
|
|
||||||
localforage.config({
|
//const open_tables_loop_interval = 10; // only runs briefly on start up
|
||||||
driver: localforage.INDEXEDDB,
|
|
||||||
version: 1,
|
|
||||||
name: idb_name
|
|
||||||
});
|
|
||||||
|
|
||||||
var tbl_event = localforage.createInstance({
|
|
||||||
name: idb_name,
|
|
||||||
storeName: 'event',
|
|
||||||
});
|
|
||||||
tbl_event.length().then(function(key_count) {
|
|
||||||
console.log('tbl_event count: '+key_count);
|
|
||||||
tbl_event_key_count = key_count;
|
|
||||||
}).catch(function(err) {
|
|
||||||
console.log(err);
|
|
||||||
});
|
|
||||||
var tbl_event_location = localforage.createInstance({
|
|
||||||
name: idb_name,
|
|
||||||
storeName: 'event_location',
|
|
||||||
});
|
|
||||||
tbl_event_location.length().then(function(key_count) {
|
|
||||||
console.log('tbl_event_location count: '+key_count);
|
|
||||||
tbl_event_location_key_count = key_count;
|
|
||||||
}).catch(function(err) {
|
|
||||||
console.log(err);
|
|
||||||
});
|
|
||||||
var tbl_event_session = localforage.createInstance({
|
|
||||||
name: idb_name,
|
|
||||||
storeName: 'event_session',
|
|
||||||
});
|
|
||||||
tbl_event_session.length().then(function(key_count) {
|
|
||||||
console.log('tbl_event_session count: '+key_count);
|
|
||||||
tbl_event_session_key_count = key_count;
|
|
||||||
}).catch(function(err) {
|
|
||||||
console.log(err);
|
|
||||||
});
|
|
||||||
var tbl_event_presentation = localforage.createInstance({
|
|
||||||
name: idb_name,
|
|
||||||
storeName: 'event_presentation',
|
|
||||||
});
|
|
||||||
tbl_event_presentation.length().then(function(key_count) {
|
|
||||||
console.log('tbl_event_presentation_key_count count: '+key_count);
|
|
||||||
tbl_event_presentation_key_count = key_count;
|
|
||||||
}).catch(function(err) {
|
|
||||||
console.log(err);
|
|
||||||
});
|
|
||||||
var tbl_event_presenter = localforage.createInstance({
|
|
||||||
name: idb_name,
|
|
||||||
storeName: 'event_presenter',
|
|
||||||
});
|
|
||||||
tbl_event_presenter.length().then(function(key_count) {
|
|
||||||
console.log('tbl_event_presenter count: '+key_count);
|
|
||||||
tbl_event_presenter_key_count = key_count;
|
|
||||||
}).catch(function(err) {
|
|
||||||
console.log(err);
|
|
||||||
});
|
|
||||||
var tbl_event_file = localforage.createInstance({
|
|
||||||
name: idb_name,
|
|
||||||
storeName: 'event_file',
|
|
||||||
});
|
|
||||||
tbl_event_file.length().then(function(key_count) {
|
|
||||||
console.log('tbl_event_file count: '+key_count);
|
|
||||||
tbl_event_file_key_count = key_count;
|
|
||||||
}).catch(function(err) {
|
|
||||||
console.log(err);
|
|
||||||
});
|
|
||||||
|
|
||||||
const open_tables_loop_interval = 10; // only runs briefly on start up
|
|
||||||
|
|
||||||
const update_idb_loop_interval = app_config.update_idb_loop_interval; // loop forever
|
const update_idb_loop_interval = app_config.update_idb_loop_interval; // loop forever
|
||||||
//const update_render_loop_interval = 10000; // loop forever; only run when the launcher object is safe
|
//const update_render_loop_interval = 10000; // loop forever; only run when the launcher object is safe
|
||||||
@@ -347,12 +279,11 @@
|
|||||||
let idb_event_presentation_check_datetime = Date.now();
|
let idb_event_presentation_check_datetime = Date.now();
|
||||||
let idb_event_presenter_check_period = app_config.idb_event_presenter_check_period;
|
let idb_event_presenter_check_period = app_config.idb_event_presenter_check_period;
|
||||||
let idb_event_presenter_check_datetime = Date.now();
|
let idb_event_presenter_check_datetime = Date.now();
|
||||||
|
|
||||||
let idb_event_file_check_period = app_config.idb_event_file_check_period;
|
let idb_event_file_check_period = app_config.idb_event_file_check_period;
|
||||||
let idb_event_file_check_datetime = Date.now();
|
let idb_event_file_check_datetime = Date.now();
|
||||||
|
|
||||||
|
|
||||||
let run_update_idb = false;
|
//let run_update_idb = false;
|
||||||
let run_check_file_cache = false;
|
let run_check_file_cache = false;
|
||||||
|
|
||||||
let looping_tbl_event = false;
|
let looping_tbl_event = false;
|
||||||
@@ -362,36 +293,26 @@
|
|||||||
let looping_tbl_event_presenter = false;
|
let looping_tbl_event_presenter = false;
|
||||||
let looping_tbl_event_file = false;
|
let looping_tbl_event_file = false;
|
||||||
|
|
||||||
let idb_tables_have_records = false;
|
//let idb_tables_have_records = false;
|
||||||
|
|
||||||
var open_tables_loop = setInterval(async function() {
|
if (window.indexedDB) {
|
||||||
if (tbl_event && tbl_event_location && tbl_event_session
|
console.log('IndexedDB is supported');
|
||||||
&& tbl_event_presentation && tbl_event_presenter
|
|
||||||
&& tbl_event_file) {
|
let load_idb_tables_result = load_idb_tables()
|
||||||
console.log('IDB tables have now been opened.');
|
.then(async function (result) {
|
||||||
idb_tables_opened = true;
|
console.log('IDB tables have been opened');
|
||||||
|
idb_tables_opened = load_idb_tables_result;
|
||||||
clearInterval(open_tables_loop);
|
|
||||||
|
|
||||||
console.log('Attempting to use cached IDB data...');
|
console.log('Attempting to use cached IDB data...');
|
||||||
|
|
||||||
console.log('table record counts: '+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);
|
|
||||||
|
|
||||||
if (tbl_event_key_count
|
if (tbl_event_key_count
|
||||||
&& tbl_event_location_key_count
|
&& tbl_event_location_key_count
|
||||||
&& tbl_event_session_key_count
|
&& tbl_event_session_key_count
|
||||||
&& tbl_event_presentation_key_count
|
&& tbl_event_presentation_key_count
|
||||||
&& tbl_event_presenter_key_count
|
&& tbl_event_presenter_key_count
|
||||||
&& tbl_event_file_key_count) {
|
&& tbl_event_file_key_count) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let render_event_records_result = render_event_records();
|
let render_event_records_result = render_event_records();
|
||||||
//setTimeout(async function(){ let render_event_records_result = await render_event_records(); }, 500);
|
|
||||||
let render_event_location_records_result = render_event_location_records();
|
let render_event_location_records_result = render_event_location_records();
|
||||||
//setTimeout(async function(){ let render_event_location_records_result = await render_event_location_records(); }, 1000);
|
|
||||||
let render_event_session_records_result = render_event_session_records()
|
let render_event_session_records_result = render_event_session_records()
|
||||||
.then(async function (result) {
|
.then(async function (result) {
|
||||||
console.log('Rendering session records has finished. Moving to other records.');
|
console.log('Rendering session records has finished. Moving to other records.');
|
||||||
@@ -399,24 +320,40 @@
|
|||||||
let render_event_presentation_records_result = await render_event_presentation_records();
|
let render_event_presentation_records_result = await render_event_presentation_records();
|
||||||
let render_event_presenter_records_result = await render_event_presenter_records();
|
let render_event_presenter_records_result = await render_event_presenter_records();
|
||||||
let render_event_file_records_result = await render_event_file_records();
|
let render_event_file_records_result = await render_event_file_records();
|
||||||
|
|
||||||
|
return true;
|
||||||
})
|
})
|
||||||
.catch(function (error) {
|
.catch(function (error) {
|
||||||
console.log('Something went wrong rendering session records.');
|
console.log('Something went wrong rendering session records.');
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
return false;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.log('One or more of the IDB tables has 0 records.');
|
console.log('One or more of the IDB tables has 0 records. The IDB probably needs to be updated.');
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
})
|
||||||
console.log('IDB tables have not yet been created or opened.');
|
.catch(function (error) {
|
||||||
|
console.log('Something went wrong opening the IDB tables.');
|
||||||
idb_tables_opened = false;
|
console.log(error);
|
||||||
}
|
return false;
|
||||||
}, open_tables_loop_interval);
|
});
|
||||||
|
|
||||||
|
} else {
|
||||||
|
console.log('IndexedDB is NOT supported');
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// END: Load IDB section
|
||||||
|
|
||||||
|
/* ***** **** *** ** * ### * ** *** **** ***** */
|
||||||
|
|
||||||
|
// BEGIN: Update IDB section
|
||||||
|
|
||||||
|
|
||||||
var update_idb_loop = setInterval(async function() {
|
var update_idb_loop = setInterval(async function() {
|
||||||
//console.log('FLAG: axios_headers_set='+axios_headers_set);
|
//console.log('****************** LOOP: Update IDB ******************');
|
||||||
//console.log('FLAG: idb_tables_opened='+idb_tables_opened);
|
|
||||||
|
|
||||||
if (app_online && axios_headers_set && idb_tables_opened) {
|
if (app_online && axios_headers_set && idb_tables_opened) {
|
||||||
if (idb_event_check_datetime < Date.now()) {
|
if (idb_event_check_datetime < Date.now()) {
|
||||||
@@ -542,11 +479,11 @@
|
|||||||
}, update_idb_loop_interval);
|
}, update_idb_loop_interval);
|
||||||
|
|
||||||
|
|
||||||
// End of IDB section
|
// END: IDB section
|
||||||
|
|
||||||
/* ***** **** *** ** * ### * ** *** **** ***** */
|
/* ***** **** *** ** * ### * ** *** **** ***** */
|
||||||
|
|
||||||
// Start of cached file section
|
// BEGIN: Cached file section
|
||||||
|
|
||||||
|
|
||||||
const check_file_cache_loop_interval = app_config.check_file_cache_loop_interval; // loop forever; only run after the event_file table has updated
|
const check_file_cache_loop_interval = app_config.check_file_cache_loop_interval; // loop forever; only run after the event_file table has updated
|
||||||
@@ -554,6 +491,8 @@
|
|||||||
const host_file_cache_path = app_config.host_file_cache_path; // 'file_cache/'
|
const host_file_cache_path = app_config.host_file_cache_path; // 'file_cache/'
|
||||||
|
|
||||||
var check_file_cache_loop = setInterval(async function() {
|
var check_file_cache_loop = setInterval(async function() {
|
||||||
|
//console.log('****************** LOOP: Check File Cache ******************');
|
||||||
|
|
||||||
if (run_check_file_cache) {
|
if (run_check_file_cache) {
|
||||||
console.log('FLAG: check_file_cache='+run_check_file_cache);
|
console.log('FLAG: check_file_cache='+run_check_file_cache);
|
||||||
check_file_cache_result = app.check_file_cache();
|
check_file_cache_result = app.check_file_cache();
|
||||||
@@ -568,12 +507,15 @@
|
|||||||
}, check_file_cache_loop_interval);
|
}, check_file_cache_loop_interval);
|
||||||
|
|
||||||
|
|
||||||
// End of cached file section
|
// END: Cached file section
|
||||||
|
|
||||||
/* ***** **** *** ** * ### * ** *** **** ***** */
|
/* ***** **** *** ** * ### * ** *** **** ***** */
|
||||||
|
|
||||||
|
// BEGIN: Check online status section
|
||||||
|
|
||||||
|
|
||||||
var check_initial_online_status = setInterval(async function() {
|
var check_initial_online_status = setInterval(async function() {
|
||||||
|
//console.log('****************** LOOP: Check Online Status ******************');
|
||||||
console.log('check_initial_online_status online check?');
|
console.log('check_initial_online_status online check?');
|
||||||
console.log(navigator.onLine);
|
console.log(navigator.onLine);
|
||||||
if (navigator.onLine) {
|
if (navigator.onLine) {
|
||||||
@@ -596,14 +538,23 @@
|
|||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
|
|
||||||
|
// END: Check online status section
|
||||||
|
|
||||||
|
/* ***** **** *** ** * ### * ** *** **** ***** */
|
||||||
|
|
||||||
|
// BEGIN: Status clock section
|
||||||
|
|
||||||
|
|
||||||
let status_clock = setInterval(function() {
|
let status_clock = setInterval(function() {
|
||||||
|
//console.log('****************** LOOP: Status Clock ******************');
|
||||||
//https://date-fns.org/v1.30.1/docs/format
|
//https://date-fns.org/v1.30.1/docs/format
|
||||||
let datetime_string = dateFns.format(new Date(), 'dddd, Do h:mm:ss A'); //dddd, Do hh:mm:ss A
|
let datetime_string = dateFns.format(new Date(), 'dddd, Do h:mm:ss A'); //dddd, Do hh:mm:ss A
|
||||||
document.getElementById('app_datetime').innerHTML = datetime_string;
|
document.getElementById('app_datetime').innerHTML = datetime_string;
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
|
|
||||||
|
// END: Status clock section
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- <script src="js/launcher.js"></script>-->
|
<!-- <script src="js/launcher.js"></script>-->
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
async function api_token_request_async(axios, secret_key) {
|
async function api_token_request_async(axios, secret_key) {
|
||||||
|
console.log('****************** API Token Request ******************');
|
||||||
console.log('Requesting API temporary token...');
|
console.log('Requesting API temporary token...');
|
||||||
|
|
||||||
if (waiting_on_api_token) {
|
if (waiting_on_api_token) {
|
||||||
|
|||||||
57
app/js/app_idb.js
Normal file
57
app/js/app_idb.js
Normal file
@@ -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;
|
||||||
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
// This function is used to render all event, location, session, presentation, and presenter file records to the UI.
|
// 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 () {
|
//exports.render_event_file_records = async function () {
|
||||||
async function render_event_file_records() {
|
async function render_event_file_records() {
|
||||||
console.log('Rendering all event, location, session, presentation, and presenter file records...');
|
|
||||||
console.log('****************** Files ******************');
|
console.log('****************** Files ******************');
|
||||||
|
console.log('Rendering all event, location, session, presentation, and presenter file records...');
|
||||||
|
|
||||||
if (looping_tbl_event_file) {
|
if (looping_tbl_event_file) {
|
||||||
console.log('Already looping through the tbl_event_file table. Not starting until finished.');
|
console.log('Already looping through the tbl_event_file table. Not starting until finished.');
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ const { ipcRenderer } = require('electron');
|
|||||||
|
|
||||||
//exports.render_event_records = function () {
|
//exports.render_event_records = function () {
|
||||||
async function render_event_records() {
|
async function render_event_records() {
|
||||||
|
console.log('****************** Events ******************');
|
||||||
console.log('Rendering event records...');
|
console.log('Rendering event records...');
|
||||||
//console.log(tbl_event);
|
//console.log(tbl_event);
|
||||||
//console.log(event_id);
|
//console.log(event_id);
|
||||||
@@ -35,6 +36,7 @@ async function render_event_records() {
|
|||||||
|
|
||||||
//exports.render_event_location_records = async function () {
|
//exports.render_event_location_records = async function () {
|
||||||
async function render_event_location_records() {
|
async function render_event_location_records() {
|
||||||
|
console.log('****************** Locations ******************');
|
||||||
console.log('Rendering event location records...');
|
console.log('Rendering event location records...');
|
||||||
|
|
||||||
if (looping_tbl_event_location) {
|
if (looping_tbl_event_location) {
|
||||||
@@ -109,8 +111,8 @@ function view_session(session_id) {
|
|||||||
|
|
||||||
/* Updated 2020-02-13 */
|
/* Updated 2020-02-13 */
|
||||||
function index_open_file_buttons(class_name) {
|
function index_open_file_buttons(class_name) {
|
||||||
console.log('Indexing open file buttons...');
|
|
||||||
console.log('****************** Indexing ******************');
|
console.log('****************** Indexing ******************');
|
||||||
|
console.log('Indexing open file buttons...');
|
||||||
var class_elements = document.getElementsByClassName(class_name);
|
var class_elements = document.getElementsByClassName(class_name);
|
||||||
//console.log(class_elements);
|
//console.log(class_elements);
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//exports.render_event_presentation_records = async function (events) {
|
//exports.render_event_presentation_records = async function (events) {
|
||||||
async function render_event_presentation_records(events) {
|
async function render_event_presentation_records(events) {
|
||||||
console.log('Rendering event presentation records...');
|
|
||||||
console.log('****************** Presentations ******************');
|
console.log('****************** Presentations ******************');
|
||||||
|
console.log('Rendering event presentation records...');
|
||||||
|
|
||||||
if (looping_tbl_event_presentation) {
|
if (looping_tbl_event_presentation) {
|
||||||
console.log('Already looping through the tbl_event_presentation table. Not starting until finished.');
|
console.log('Already looping through the tbl_event_presentation table. Not starting until finished.');
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//exports.render_event_presenter_records = async function (events) {
|
//exports.render_event_presenter_records = async function (events) {
|
||||||
async function render_event_presenter_records(events) {
|
async function render_event_presenter_records(events) {
|
||||||
console.log('Rendering event presenter records...');
|
|
||||||
console.log('****************** Presenters ******************');
|
console.log('****************** Presenters ******************');
|
||||||
|
console.log('Rendering event presenter records...');
|
||||||
|
|
||||||
if (looping_tbl_event_presenter) {
|
if (looping_tbl_event_presenter) {
|
||||||
console.log('Already looping through the tbl_event_presenter table. Not starting until finished.');
|
console.log('Already looping through the tbl_event_presenter table. Not starting until finished.');
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
//exports.render_event_session_records = async function () {
|
//exports.render_event_session_records = async function () {
|
||||||
async function render_event_session_records() {
|
async function render_event_session_records() {
|
||||||
|
console.log('****************** Sessions ******************');
|
||||||
console.log('Rendering event session records...');
|
console.log('Rendering event session records...');
|
||||||
|
|
||||||
if (looping_tbl_event_session) {
|
if (looping_tbl_event_session) {
|
||||||
|
|||||||
@@ -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;
|
|
||||||
}
|
|
||||||
@@ -4,6 +4,8 @@
|
|||||||
"event_id": 14,
|
"event_id": 14,
|
||||||
"event_location_id": 13,
|
"event_location_id": 13,
|
||||||
"main_loop_interval": 2000,
|
"main_loop_interval": 2000,
|
||||||
|
"api_token_loop_interval": 1000,
|
||||||
|
"api_update_period": 90000,
|
||||||
"api_secret_key": "YWAAk39H2qH0edK6lPH0yg",
|
"api_secret_key": "YWAAk39H2qH0edK6lPH0yg",
|
||||||
"use_local_api": true,
|
"use_local_api": true,
|
||||||
"use_local_db": false,
|
"use_local_db": false,
|
||||||
@@ -20,6 +22,7 @@
|
|||||||
"local_db_name": "onesky_ams_test",
|
"local_db_name": "onesky_ams_test",
|
||||||
"local_db_username": "username_here",
|
"local_db_username": "username_here",
|
||||||
"local_db_password": "password_here",
|
"local_db_password": "password_here",
|
||||||
|
"update_idb_loop_interval": 1000,
|
||||||
"idb_name": "osit",
|
"idb_name": "osit",
|
||||||
"idb_check_period": 30000,
|
"idb_check_period": 30000,
|
||||||
"idb_event_check_period": 120000,
|
"idb_event_check_period": 120000,
|
||||||
@@ -28,11 +31,17 @@
|
|||||||
"idb_event_presentation_check_period": 60000,
|
"idb_event_presentation_check_period": 60000,
|
||||||
"idb_event_presenter_check_period": 60000,
|
"idb_event_presenter_check_period": 60000,
|
||||||
"idb_event_file_check_period": 60000,
|
"idb_event_file_check_period": 60000,
|
||||||
|
"check_file_cache_loop_interval": 250,
|
||||||
"host_file_cache_path": "file_cache",
|
"host_file_cache_path": "file_cache",
|
||||||
"host_file_cache_check_period": 30000,
|
"host_file_cache_check_period": 30000,
|
||||||
|
"update_render_loop_interval": 1000,
|
||||||
|
"display_menu_session_times": true,
|
||||||
"display_session_codes": true,
|
"display_session_codes": true,
|
||||||
|
"display_session_badges": true,
|
||||||
"display_presentation_codes": true,
|
"display_presentation_codes": true,
|
||||||
|
"display_presentation_badges": true,
|
||||||
"display_presenter_codes": true,
|
"display_presenter_codes": true,
|
||||||
|
"display_presenter_badges": true,
|
||||||
"display_arrangement": "mirror_and_extend",
|
"display_arrangement": "mirror_and_extend",
|
||||||
"display_builtin_resolution": "",
|
"display_builtin_resolution": "",
|
||||||
"display_builtin_refresh": "",
|
"display_builtin_refresh": "",
|
||||||
|
|||||||
Reference in New Issue
Block a user