Working on making the rendering more efficient...
This commit is contained in:
187
app/index.html
187
app/index.html
@@ -4,7 +4,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
|
|
||||||
<title>One Sky IT: macOS App</title>
|
<title>One Sky IT</title>
|
||||||
|
|
||||||
<link rel="shortcut icon" type="image/png" href="img/favicon.ico">
|
<link rel="shortcut icon" type="image/png" href="img/favicon.ico">
|
||||||
|
|
||||||
@@ -34,27 +34,21 @@
|
|||||||
<!--<main id="main_content" role="main" class="container">-->
|
<!--<main id="main_content" role="main" class="container">-->
|
||||||
<div id="main_content" class="container w-100">
|
<div id="main_content" class="container w-100">
|
||||||
|
|
||||||
|
<!--
|
||||||
<div class="row no-gutters">
|
<div class="row no-gutters">
|
||||||
<div id="location_title" class="location_title border-bottom">Please wait while the data is checked and files are cached.</div>
|
<div id="launcher_title" class="launcher_title border-bottom">Please wait while the data is checked and files are cached.</div>
|
||||||
</div>
|
</div>
|
||||||
|
-->
|
||||||
|
|
||||||
<div class="row no-gutters">
|
<div class="row no-gutters">
|
||||||
<div id="location_menu" class="location_menu col-3 border-right">
|
<div id="launcher_menu" class="launcher_menu col-3 border-right">
|
||||||
|
<div id="event_files_menu" class="event_files_menu"></div>
|
||||||
<div id="event_files_menu" class="event_files_menu">
|
<div id="location_files_menu" class="location_files_menu"></div>
|
||||||
|
<div id="sessions_menu" class="sessions_menu"></div>
|
||||||
</div>
|
<div id="location_name" class="location_name"></div>
|
||||||
<div id="location_files_menu" class="location_files_menu">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div id="sessions_menu" class="sessions_menu">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="location_detail" class="location_detail col">
|
<div id="launcher_sessions" class="launcher_sessions col"></div> <!-- end location details div -->
|
||||||
|
|
||||||
</div>
|
|
||||||
</div> <!-- end row div -->
|
</div> <!-- end row div -->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -132,11 +126,6 @@
|
|||||||
|
|
||||||
if (window.indexedDB) {
|
if (window.indexedDB) {
|
||||||
console.log('IndexedDB is supported');
|
console.log('IndexedDB is supported');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
console.log('IndexedDB is NOT supported');
|
console.log('IndexedDB is NOT supported');
|
||||||
close();
|
close();
|
||||||
@@ -180,6 +169,7 @@
|
|||||||
storeName: 'event_location',
|
storeName: 'event_location',
|
||||||
});
|
});
|
||||||
tbl_event_location.length().then(function(key_count) {
|
tbl_event_location.length().then(function(key_count) {
|
||||||
|
console.log('tbl_event_location count: '+key_count);
|
||||||
tbl_event_location_key_count = key_count;
|
tbl_event_location_key_count = key_count;
|
||||||
}).catch(function(err) {
|
}).catch(function(err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
@@ -189,6 +179,7 @@
|
|||||||
storeName: 'event_session',
|
storeName: 'event_session',
|
||||||
});
|
});
|
||||||
tbl_event_session.length().then(function(key_count) {
|
tbl_event_session.length().then(function(key_count) {
|
||||||
|
console.log('tbl_event_session count: '+key_count);
|
||||||
tbl_event_session_key_count = key_count;
|
tbl_event_session_key_count = key_count;
|
||||||
}).catch(function(err) {
|
}).catch(function(err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
@@ -198,6 +189,7 @@
|
|||||||
storeName: 'event_presentation',
|
storeName: 'event_presentation',
|
||||||
});
|
});
|
||||||
tbl_event_presentation.length().then(function(key_count) {
|
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;
|
tbl_event_presentation_key_count = key_count;
|
||||||
}).catch(function(err) {
|
}).catch(function(err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
@@ -207,6 +199,7 @@
|
|||||||
storeName: 'event_presenter',
|
storeName: 'event_presenter',
|
||||||
});
|
});
|
||||||
tbl_event_presenter.length().then(function(key_count) {
|
tbl_event_presenter.length().then(function(key_count) {
|
||||||
|
console.log('tbl_event_presenter count: '+key_count);
|
||||||
tbl_event_presenter_key_count = key_count;
|
tbl_event_presenter_key_count = key_count;
|
||||||
}).catch(function(err) {
|
}).catch(function(err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
@@ -252,9 +245,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
//const loading_loop_interval = app_config.loading_loop_interval; // in milliseconds
|
||||||
const loading_loop_interval = 500;
|
const loading_loop_interval = 500;
|
||||||
//const main_loop_interval = app_config.main_loop_interval; //2000; // 2 seconds
|
//const main_loop_interval = app_config.main_loop_interval; // in milliseconds
|
||||||
const main_loop_interval = 1500; //10000; // 10 seconds
|
const main_loop_interval = 1500; //10000; // 10 seconds
|
||||||
|
|
||||||
idb_event_check_period = app_config.idb_event_check_period;
|
idb_event_check_period = app_config.idb_event_check_period;
|
||||||
@@ -282,10 +275,7 @@
|
|||||||
const host_file_cache_check_period = app_config.host_file_cache_check_period; //30000; // 30 seconds
|
const host_file_cache_check_period = app_config.host_file_cache_check_period; //30000; // 30 seconds
|
||||||
|
|
||||||
let launcher = new Object(); // This will create the something like location > sessions and location files > presenters and session files > presenter files
|
let launcher = new Object(); // This will create the something like location > sessions and location files > presenters and session files > presenter files
|
||||||
//let v2_launcher = new Object();
|
|
||||||
launcher.account_id = account_id;
|
|
||||||
launcher.event_id = event_id;
|
|
||||||
launcher.event_location_id = event_location_id;
|
|
||||||
|
|
||||||
let idb_to_launcher_result = false;
|
let idb_to_launcher_result = false;
|
||||||
//let launcher_cache_check_results = false;
|
//let launcher_cache_check_results = false;
|
||||||
@@ -347,33 +337,124 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
var load_cached_data_loop = setInterval(function() {
|
||||||
|
if (tbl_event && tbl_event_location && tbl_event_session
|
||||||
|
&& tbl_event_presentation && tbl_event_presenter
|
||||||
|
&& tbl_event_file) {
|
||||||
|
idb_tables_opened = true;
|
||||||
|
console.log('IDB tables have been opened');
|
||||||
|
|
||||||
|
|
||||||
|
if (tbl_event_key_count != null && tbl_event_location_key_count != null && tbl_event_session_key_count != null
|
||||||
|
&& tbl_event_presentation_key_count != null && tbl_event_presenter_key_count != null
|
||||||
|
&& tbl_event_file_key_count != null) {
|
||||||
|
idb_tables_have_records = true;
|
||||||
|
console.log('All IDB tables have been checked for records.');
|
||||||
|
|
||||||
|
console.log('Running idb_to_launcher with cached data.');
|
||||||
|
|
||||||
|
idb.idb_to_launcher().then(function(response) {
|
||||||
|
console.log('Launcher object has now been created with cached data.');
|
||||||
|
console.log(response);
|
||||||
|
clearInterval(load_cached_data_loop);
|
||||||
|
|
||||||
|
launcher = response;
|
||||||
|
//let launcher_tmp = launcher;
|
||||||
|
|
||||||
|
//render_launcher_result = ui.render_launcher(response);
|
||||||
|
console.log('The launcher has now been rendered with cached data. ***');
|
||||||
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
idb_to_launcer_result.then(function (response) {
|
||||||
|
console.log('Launcher object has now been created with cached data.');
|
||||||
|
console.log(response);
|
||||||
|
clearInterval(load_cached_data_loop);
|
||||||
|
|
||||||
|
launcher = response;
|
||||||
|
//let launcher_tmp = launcher;
|
||||||
|
|
||||||
|
render_launcher_result = ui.render_launcher(response);
|
||||||
|
console.log('The launcher has now been rendered with cached data. ***');
|
||||||
|
|
||||||
|
|
||||||
|
//render_launcher_result.then(function (response) {
|
||||||
|
// console.log('The launcher has now been rendered with cached data. ***');
|
||||||
|
// clearInterval(load_cached_data_loop);
|
||||||
|
//});
|
||||||
|
|
||||||
|
});
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
let launcher_new = idb.idb_to_launcher();
|
||||||
|
launcher_new_result.then
|
||||||
|
render_launcher_result = ui.render_launcher(launcher_new);
|
||||||
|
if (render_launcher_result) {
|
||||||
|
clearInterval(load_cached_data_loop);
|
||||||
|
} else {
|
||||||
|
console.log('Launcher object not really ready yet...');
|
||||||
|
}
|
||||||
|
//render_launcher_result.then(function (response) {
|
||||||
|
// console.log('The launcher has now been rendered with cached data. ***');
|
||||||
|
|
||||||
|
//});
|
||||||
|
*/
|
||||||
|
|
||||||
|
} else {
|
||||||
|
//console.log('One or more tables did not have any records. Moving on...');
|
||||||
|
console.log('Still waiting for the table record counts.');
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
idb_tables_opened = false;
|
||||||
|
console.log('Waiting for IDB tables to be opened');
|
||||||
|
}
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
|
/*
|
||||||
|
function load_cached_data () {
|
||||||
|
idb_tables_opened = true;
|
||||||
|
console.log('IDB tables have been opened');
|
||||||
|
|
||||||
|
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) {
|
||||||
|
idb_tables_have_records = true;
|
||||||
|
console.log('All IDB tables have records.');
|
||||||
|
|
||||||
|
console.log('Running idb_to_launcher with cached data.');
|
||||||
|
idb_to_launcher_result = idb.idb_to_launcher(launcher);
|
||||||
|
|
||||||
|
idb_to_launcher_result.then(function (response) {
|
||||||
|
console.log('Launcher object has now been created with cached data.');
|
||||||
|
console.log(launcher);
|
||||||
|
|
||||||
|
let launcher_tmp = launcher;
|
||||||
|
|
||||||
|
render_launcher_result = ui.render_launcher(launcher_tmp);
|
||||||
|
render_launcher_result.then(function (response) {
|
||||||
|
console.log('The launcher has now been rendered with cached data. ***');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var load_cached_data_results = load_cached_data();
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
// NOTE This loop needs to end at some point...
|
// NOTE This loop needs to end at some point...
|
||||||
setInterval(function() {
|
var load_auth_loop = setInterval(function() {
|
||||||
if (typeof axios.defaults.headers.common['Authorization'] !== 'undefined'
|
if (typeof axios.defaults.headers.common['Authorization'] !== 'undefined'
|
||||||
&& axios.defaults.headers.common['Authorization'] != null) {
|
&& axios.defaults.headers.common['Authorization'] != null) {
|
||||||
axios_headers_set = true;
|
axios_headers_set = true;
|
||||||
console.log('Axios headers have been set.');
|
console.log('Axios headers have been set.');
|
||||||
|
clearInterval(load_auth_loop);
|
||||||
} else {
|
} else {
|
||||||
axios_headers_set = false;
|
axios_headers_set = false;
|
||||||
console.log('Waiting for Axios headers to be set.');
|
console.log('Waiting for Axios headers to be set.');
|
||||||
}
|
}
|
||||||
if (tbl_event && tbl_event_location && tbl_event_session
|
|
||||||
&& tbl_event_presentation && tbl_event_presenter
|
|
||||||
&& tbl_event_file) {
|
|
||||||
idb_tables_opened = true;
|
|
||||||
console.log('IDB tables have been opened');
|
|
||||||
} else {
|
|
||||||
idb_tables_opened = false;
|
|
||||||
console.log('Waiting for IDB tables to be opened');
|
|
||||||
}
|
|
||||||
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) {
|
|
||||||
idb_tables_have_records = true;
|
|
||||||
console.log('All IDB tables have records.');
|
|
||||||
} else {
|
|
||||||
console.log('No IDB records for one of the tables.');
|
|
||||||
}
|
|
||||||
}, loading_loop_interval);
|
}, loading_loop_interval);
|
||||||
|
|
||||||
|
|
||||||
@@ -383,7 +464,7 @@
|
|||||||
|
|
||||||
if (idb_event_check_datetime < Date.now()) {
|
if (idb_event_check_datetime < Date.now()) {
|
||||||
console.log('Time to check events');
|
console.log('Time to check events');
|
||||||
let v2_account_events = await api.v2_get_account_events(axios, launcher.account_id);
|
let v2_account_events = await api.v2_get_account_events(axios, account_id);
|
||||||
for (var i in v2_account_events) {
|
for (var i in v2_account_events) {
|
||||||
tbl_event.setItem(v2_account_events[i].id.toString(), v2_account_events[i]);
|
tbl_event.setItem(v2_account_events[i].id.toString(), v2_account_events[i]);
|
||||||
}
|
}
|
||||||
@@ -393,7 +474,7 @@
|
|||||||
|
|
||||||
if (idb_event_location_check_datetime < Date.now()) {
|
if (idb_event_location_check_datetime < Date.now()) {
|
||||||
console.log('Time to check event locations');
|
console.log('Time to check event locations');
|
||||||
let v2_event_locations = await api.v2_get_event_locations(axios, launcher.event_id);
|
let v2_event_locations = await api.v2_get_event_locations(axios, event_id);
|
||||||
for (var i in v2_event_locations) {
|
for (var i in v2_event_locations) {
|
||||||
tbl_event_location.setItem(v2_event_locations[i].id.toString(), v2_event_locations[i]);
|
tbl_event_location.setItem(v2_event_locations[i].id.toString(), v2_event_locations[i]);
|
||||||
}
|
}
|
||||||
@@ -403,7 +484,7 @@
|
|||||||
|
|
||||||
if (idb_event_session_check_datetime < Date.now()) {
|
if (idb_event_session_check_datetime < Date.now()) {
|
||||||
console.log('Time to check event location sessions');
|
console.log('Time to check event location sessions');
|
||||||
let v2_event_sessions = await api.v2_get_event_location_sessions(axios, launcher.event_location_id);
|
let v2_event_sessions = await api.v2_get_event_location_sessions(axios, event_location_id);
|
||||||
for (var i in v2_event_sessions) {
|
for (var i in v2_event_sessions) {
|
||||||
tbl_event_session.setItem(v2_event_sessions[i].id.toString(), v2_event_sessions[i]);
|
tbl_event_session.setItem(v2_event_sessions[i].id.toString(), v2_event_sessions[i]);
|
||||||
}
|
}
|
||||||
@@ -413,7 +494,7 @@
|
|||||||
|
|
||||||
if (idb_event_presentation_check_datetime < Date.now()) {
|
if (idb_event_presentation_check_datetime < Date.now()) {
|
||||||
console.log('Time to check event location presentations');
|
console.log('Time to check event location presentations');
|
||||||
let v2_event_presentations = await api.v2_get_event_location_presentations(axios, launcher.event_location_id);
|
let v2_event_presentations = await api.v2_get_event_location_presentations(axios, event_location_id);
|
||||||
for (var i in v2_event_presentations) {
|
for (var i in v2_event_presentations) {
|
||||||
tbl_event_presentation.setItem(v2_event_presentations[i].id.toString(), v2_event_presentations[i]);
|
tbl_event_presentation.setItem(v2_event_presentations[i].id.toString(), v2_event_presentations[i]);
|
||||||
}
|
}
|
||||||
@@ -423,7 +504,7 @@
|
|||||||
|
|
||||||
if (idb_event_presenter_check_datetime < Date.now()) {
|
if (idb_event_presenter_check_datetime < Date.now()) {
|
||||||
console.log('Time to check event location presenters');
|
console.log('Time to check event location presenters');
|
||||||
let v2_event_presenters = await api.v2_get_event_location_presenters(axios, launcher.event_location_id);
|
let v2_event_presenters = await api.v2_get_event_location_presenters(axios, event_location_id);
|
||||||
for (var i in v2_event_presenters) {
|
for (var i in v2_event_presenters) {
|
||||||
tbl_event_presenter.setItem(v2_event_presenters[i].id.toString(), v2_event_presenters[i]);
|
tbl_event_presenter.setItem(v2_event_presenters[i].id.toString(), v2_event_presenters[i]);
|
||||||
}
|
}
|
||||||
@@ -433,7 +514,7 @@
|
|||||||
|
|
||||||
if (idb_event_file_check_datetime < Date.now()) {
|
if (idb_event_file_check_datetime < Date.now()) {
|
||||||
console.log('Time to check event location files');
|
console.log('Time to check event location files');
|
||||||
let v2_event_files = await api.v2_get_event_location_files(axios, launcher.event_location_id);
|
let v2_event_files = await api.v2_get_event_location_files(axios, event_location_id);
|
||||||
for (var i in v2_event_files) {
|
for (var i in v2_event_files) {
|
||||||
tbl_event_file.setItem(v2_event_files[i].event_file_id.toString(), v2_event_files[i]);
|
tbl_event_file.setItem(v2_event_files[i].event_file_id.toString(), v2_event_files[i]);
|
||||||
}
|
}
|
||||||
@@ -524,9 +605,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
console.log('Waiting '+main_loop_interval+'ms to see if Authorization header is set.');
|
console.log('Waiting '+main_loop_interval+'ms to see if Authorization header is set, tables are opened, and record counts have been done.');
|
||||||
console.log('Waiting '+main_loop_interval+'ms to see if tbl_event_session_key_count is set.'+tbl_event_session_key_count);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}, main_loop_interval);
|
}, main_loop_interval);
|
||||||
|
|
||||||
|
|||||||
@@ -13,43 +13,64 @@ exports.create_load_idb = async function create_load_idb() {
|
|||||||
|
|
||||||
exports.idb_to_launcher = async function idb_to_launcher() {
|
exports.idb_to_launcher = async function idb_to_launcher() {
|
||||||
//tbl_example.iterate(tbl_check, tbl_check_success, tbl_check_error); //tbl_check(value, key, iteration)
|
//tbl_example.iterate(tbl_check, tbl_check_success, tbl_check_error); //tbl_check(value, key, iteration)
|
||||||
//let launcher = new Object();
|
let launcher_new = new Object();
|
||||||
|
|
||||||
|
let tbl_event_complete = false;
|
||||||
|
let tbl_event_file_complete = false;
|
||||||
|
let tbl_event_location_complete = false;
|
||||||
|
let tbl_event_location_file_complete = false;
|
||||||
|
let tbl_event_session_complete = false;
|
||||||
|
let tbl_event_session_file_complete = false;
|
||||||
|
let tbl_event_presentation_complete = false;
|
||||||
|
let tbl_event_presentation_file_complete = false;
|
||||||
|
let tbl_event_presenter_complete = false;
|
||||||
|
let tbl_event_presenter_file_complete = false;
|
||||||
|
|
||||||
// Look for *events*
|
// Look for *events*
|
||||||
let tmp_event = [];
|
let tmp_event = [];
|
||||||
tbl_event.iterate(function(event_value, key, iteration) {
|
tbl_event.iterate(function(event_value, key, iteration) {
|
||||||
tmp_event.push(event_value);
|
tmp_event.push(event_value);
|
||||||
|
}).then(function() {
|
||||||
|
console.log('idb_to_launcher: Iterate tbl_event complete')
|
||||||
|
tbl_event_complete = true;
|
||||||
});
|
});
|
||||||
launcher.event = tmp_event;
|
launcher_new.event = tmp_event;
|
||||||
|
|
||||||
// Look for *event files*
|
// Look for *event files*
|
||||||
let tmp_event_file = []
|
let tmp_event_file = []
|
||||||
tbl_event_file.iterate(function(file_value, key, iteration) {
|
tbl_event_file.iterate(function(file_value, key, iteration) {
|
||||||
//console.log('event id: '+launcher.event[0].id+' -> file_id: '+file_value.id+'for type: '+file_value.for_type+' for id: '+file_value.id);
|
//console.log('event id: '+launcher_new.event[0].id+' -> file_id: '+file_value.id+'for type: '+file_value.for_type+' for id: '+file_value.id);
|
||||||
if (file_value.for_type == 'event' && launcher.event[0].id == file_value.for_id) {
|
if (file_value.for_type == 'event' && launcher_new.event[0].id == file_value.for_id) {
|
||||||
tmp_event_file.push(file_value);
|
tmp_event_file.push(file_value);
|
||||||
}
|
}
|
||||||
}).then(function() {
|
}).then(function() {
|
||||||
console.log('idb_to_launcher: Iterate tbl_event_file complete')
|
console.log('idb_to_launcher: Iterate tbl_event_file complete')
|
||||||
|
tbl_event_file_complete = true;
|
||||||
});
|
});
|
||||||
launcher.event_file = tmp_event_file;
|
launcher_new.event_file = tmp_event_file;
|
||||||
|
|
||||||
|
|
||||||
// Look for *locations*
|
// Look for *locations*
|
||||||
let tmp_event_location = []
|
let tmp_event_location = []
|
||||||
tbl_event_location.iterate(function(location_value, key, iteration) {
|
tbl_event_location.iterate(function(location_value, key, iteration) {
|
||||||
tmp_event_location.push(location_value);
|
tmp_event_location.push(location_value);
|
||||||
|
}).then(function() {
|
||||||
|
console.log('idb_to_launcher: Iterate tbl_event_location complete')
|
||||||
|
tbl_event_location_complete = true;
|
||||||
});
|
});
|
||||||
launcher.location = tmp_event_location;
|
launcher_new.location = tmp_event_location;
|
||||||
|
|
||||||
// Look for *event location files*
|
// Look for *event location files*
|
||||||
let tmp_event_location_file = []
|
let tmp_event_location_file = []
|
||||||
tbl_event_file.iterate(function(file_value, key, iteration) {
|
tbl_event_file.iterate(function(file_value, key, iteration) {
|
||||||
if (file_value.for_type == 'location' && launcher.location[0].id == file_value.for_id) {
|
if (file_value.for_type == 'location' && launcher_new.location[0].id == file_value.for_id) {
|
||||||
tmp_event_location_file.push(file_value);
|
tmp_event_location_file.push(file_value);
|
||||||
}
|
}
|
||||||
|
}).then(function() {
|
||||||
|
console.log('idb_to_launcher: Iterate tbl_event_file complete')
|
||||||
|
tbl_event_location_file_complete = true;
|
||||||
});
|
});
|
||||||
launcher.location_file = tmp_event_location_file;
|
launcher_new.location_file = tmp_event_location_file;
|
||||||
|
|
||||||
|
|
||||||
// Look for *sessions*
|
// Look for *sessions*
|
||||||
@@ -66,6 +87,9 @@ exports.idb_to_launcher = async function idb_to_launcher() {
|
|||||||
session_value.file.push(session_file_value)
|
session_value.file.push(session_file_value)
|
||||||
//tmp_event_session_file.push(session_file_value);
|
//tmp_event_session_file.push(session_file_value);
|
||||||
}
|
}
|
||||||
|
}).then(function() {
|
||||||
|
console.log('idb_to_launcher: Iterate tbl_event_file complete')
|
||||||
|
tbl_event_session_file_complete = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -82,6 +106,9 @@ exports.idb_to_launcher = async function idb_to_launcher() {
|
|||||||
if (presentation_file_value.for_type == 'presentation' && presentation_value.id == presentation_file_value.for_id) {
|
if (presentation_file_value.for_type == 'presentation' && presentation_value.id == presentation_file_value.for_id) {
|
||||||
presentation_value.file.push(presentation_file_value);
|
presentation_value.file.push(presentation_file_value);
|
||||||
}
|
}
|
||||||
|
}).then(function() {
|
||||||
|
console.log('idb_to_launcher: Iterate tbl_event_file complete')
|
||||||
|
tbl_event_presentation_file_complete = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -97,26 +124,23 @@ exports.idb_to_launcher = async function idb_to_launcher() {
|
|||||||
if (presenter_file_value.for_type == 'presenter' && presenter_value.id == presenter_file_value.for_id) {
|
if (presenter_file_value.for_type == 'presenter' && presenter_value.id == presenter_file_value.for_id) {
|
||||||
presenter_value.file.push(presenter_file_value);
|
presenter_value.file.push(presenter_file_value);
|
||||||
}
|
}
|
||||||
|
}).then(function() {
|
||||||
|
console.log('idb_to_launcher: Iterate tbl_event_file complete')
|
||||||
|
tbl_event_presenter_file_complete = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
//NOTE for some reason this is adding duplicate presenters to a session
|
|
||||||
//NOTE is this iterating twice or something???
|
|
||||||
/*
|
|
||||||
tbl_event_file.iterate(function(presenter_file_value, key, iteration) {
|
|
||||||
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
presentation_value.presenter.push(presenter_value);
|
presentation_value.presenter.push(presenter_value);
|
||||||
}
|
}
|
||||||
|
}).then(function() {
|
||||||
|
console.log('idb_to_launcher: Iterate tbl_event_presenter complete')
|
||||||
|
tbl_event_presenter_complete = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
//NOTE add in presenters and then presenter's files
|
|
||||||
|
|
||||||
|
|
||||||
session_value.presentation.push(presentation_value);
|
session_value.presentation.push(presentation_value);
|
||||||
}//);
|
}//);
|
||||||
|
|
||||||
|
}).then(function() {
|
||||||
|
console.log('idb_to_launcher: Iterate tbl_event_presentation complete')
|
||||||
|
tbl_event_presentation_complete = true;
|
||||||
});
|
});
|
||||||
//});
|
//});
|
||||||
|
|
||||||
@@ -124,8 +148,9 @@ exports.idb_to_launcher = async function idb_to_launcher() {
|
|||||||
|
|
||||||
}).then(function() {
|
}).then(function() {
|
||||||
console.log('idb_to_launcher: Iterate tbl_event_session complete')
|
console.log('idb_to_launcher: Iterate tbl_event_session complete')
|
||||||
|
tbl_event_session_complete = true;
|
||||||
});
|
});
|
||||||
launcher.session = tmp_event_session;
|
launcher_new.session = tmp_event_session;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
console.log('v2 idb to launcher object: ***');
|
console.log('v2 idb to launcher object: ***');
|
||||||
@@ -133,7 +158,20 @@ exports.idb_to_launcher = async function idb_to_launcher() {
|
|||||||
console.log('v2 idb to launcher object: ^^^');
|
console.log('v2 idb to launcher object: ^^^');
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return true;
|
var creating_launcher_object_loop = setInterval(function() {
|
||||||
|
if (tbl_event_complete && tbl_event_file_complete && tbl_event_location_complete && tbl_event_location_file_complete && tbl_event_session_complete && tbl_event_session_file_complete && tbl_event_presentation_complete && tbl_event_presentation_file_complete && tbl_event_presenter_complete && tbl_event_presenter_file_complete) {
|
||||||
|
console.log('And DONE!!!');
|
||||||
|
console.log('v2 idb to launcher object: ***');
|
||||||
|
console.log(launcher_new);
|
||||||
|
console.log('v2 idb to launcher object: ^^^');
|
||||||
|
ui.render_launcher(launcher_new);
|
||||||
|
clearInterval(creating_launcher_object_loop);
|
||||||
|
return launcher_new;
|
||||||
|
} else {
|
||||||
|
console.log('Still building...');
|
||||||
|
}
|
||||||
|
}, 5);
|
||||||
|
//return launcher_new;
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.check_file_cache = async function () {
|
exports.check_file_cache = async function () {
|
||||||
|
|||||||
@@ -5,31 +5,41 @@ const fs = require('fs');
|
|||||||
const { ipcRenderer } = require('electron');
|
const { ipcRenderer } = require('electron');
|
||||||
|
|
||||||
|
|
||||||
exports.render_launcher = async function (launcher_tmp) {
|
exports.render_launcher = function (launcher_tmp) {
|
||||||
console.log('Rendering launcher_tmp...');
|
console.log('Rendering launcher_tmp...');
|
||||||
|
|
||||||
console.log('In module_app_ui.js v2 idb to launcher object: ***');
|
console.log('In module_app_ui.js v2 idb to launcher object: ***');
|
||||||
console.log(launcher_tmp);
|
console.log(launcher_tmp);
|
||||||
console.log('In module_app_ui.js v2 idb to launcher object: ^^^');
|
console.log('In module_app_ui.js v2 idb to launcher object: ^^^');
|
||||||
|
|
||||||
for (var i in launcher_tmp.event) {
|
if (launcher_tmp.event) {
|
||||||
if (launcher_tmp.event[i].id == event_id) {
|
for (var i in launcher_tmp.event) {
|
||||||
console.log('*** Event id ('+event_id+') found in launcher object.');
|
if (launcher_tmp.event[i].id == event_id) {
|
||||||
for (var j in launcher_tmp.location) {
|
console.log('*** Event id ('+event_id+') found in launcher object.');
|
||||||
if (launcher_tmp.location[j].id == event_location_id) {
|
for (var j in launcher_tmp.location) {
|
||||||
console.log('*** Location id ('+event_location_id+') found in launcher object.');
|
if (launcher_tmp.location[j].id == event_location_id) {
|
||||||
document.getElementById('location_title').innerHTML = '<h1>Launcher '+launcher_tmp.location[j].name+'@'+launcher_tmp.event[i].name+'</h1>';
|
console.log('*** Location id ('+event_location_id+') found in launcher object.');
|
||||||
} else {
|
document.title = launcher_tmp.location[j].name+'@'+launcher_tmp.event[i].name;
|
||||||
|
//document.getElementById('launcher_title').innerHTML = '<h1>Launcher '+launcher_tmp.location[j].name+'@'+launcher_tmp.event[i].name+'</h1>';
|
||||||
|
document.getElementById('location_name').innerHTML = '<span class="fas fa-map-marker"></span> '+launcher_tmp.location[j].name+'@'+launcher_tmp.event[i].name;
|
||||||
|
} else {
|
||||||
|
console.log('Event location not it.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
console.log('Event not it.');
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
}
|
}
|
||||||
|
console.log('Data in launcher object');
|
||||||
|
console.log(launcher_tmp);
|
||||||
|
} else {
|
||||||
|
console.log('Missing data in launcher object');
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
document.getElementById('event_files_menu').innerHTML = '<h2>Event Files</h2>';
|
document.getElementById('event_files_menu').innerHTML = '<h2>Event Files</h2>';
|
||||||
document.getElementById('event_files_menu').innerHTML += '<ul class="list-group list-group-flush">';
|
document.getElementById('event_files_menu').innerHTML += '<ul class="list-group list-group-flush">';
|
||||||
for (var i in launcher_tmp.event_file) {
|
for (var i in launcher_tmp.event_file) {
|
||||||
document.getElementById('event_files_menu').innerHTML += '<li id="menu_event_file_id_'+launcher_tmp.event_file[i].id+'" class="list-group-item btn btn-secondary d-flex justify-content-between align-items-center open_local_file" data-hash_sha256="'+launcher_tmp.event_file[i].hash_sha256+'.file" data-filename="'+launcher_tmp.event_file[i].event_file_filename+'">'+launcher_tmp.event_file[i].event_file_filename+'</li>';
|
document.getElementById('event_files_menu').innerHTML += '<li id="menu_event_file_'+launcher_tmp.event_file[i].event_file_id+'" class="list-group-item btn btn-secondary d-flex justify-content-between align-items-center open_local_file" data-hash_sha256="'+launcher_tmp.event_file[i].hash_sha256+'.file" data-filename="'+launcher_tmp.event_file[i].event_file_filename+'">'+launcher_tmp.event_file[i].event_file_filename+'</li>';
|
||||||
}
|
}
|
||||||
document.getElementById('event_files_menu').innerHTML += '</ul>';
|
document.getElementById('event_files_menu').innerHTML += '</ul>';
|
||||||
|
|
||||||
@@ -37,22 +47,23 @@ exports.render_launcher = async function (launcher_tmp) {
|
|||||||
document.getElementById('location_files_menu').innerHTML = '<h2>Location Files</h2>';
|
document.getElementById('location_files_menu').innerHTML = '<h2>Location Files</h2>';
|
||||||
document.getElementById('location_files_menu').innerHTML += '<ul class="list-group list-group-flush" role="">';
|
document.getElementById('location_files_menu').innerHTML += '<ul class="list-group list-group-flush" role="">';
|
||||||
for (var i in launcher_tmp.location_file) {
|
for (var i in launcher_tmp.location_file) {
|
||||||
document.getElementById('location_files_menu').innerHTML += '<li id="menu_event_file_id_'+launcher_tmp.location_file[i].id+'" class="list-group-item btn btn-secondary d-flex justify-content-between align-items-center open_local_file" data-hash_sha256="'+launcher_tmp.location_file[i].hash_sha256+'.file" data-filename="'+launcher_tmp.location_file[i].event_file_filename+'">'+launcher_tmp.location_file[i].event_file_filename+'</li>';
|
document.getElementById('location_files_menu').innerHTML += '<li id="menu_event_location_file_'+launcher_tmp.location_file[i].event_file_id+'" class="list-group-item btn btn-secondary d-flex justify-content-between align-items-center open_local_file" data-hash_sha256="'+launcher_tmp.location_file[i].hash_sha256+'.file" data-filename="'+launcher_tmp.location_file[i].event_file_filename+'"><span class="fas fa-external-link-alt"></span> '+launcher_tmp.location_file[i].event_file_filename+'</li>';
|
||||||
}
|
}
|
||||||
document.getElementById('location_files_menu').innerHTML += '</ul>';
|
document.getElementById('location_files_menu').innerHTML += '</ul>';
|
||||||
|
|
||||||
document.getElementById('sessions_menu').innerHTML = '<h2>Sessions</h2>';
|
document.getElementById('sessions_menu').innerHTML = '<h2>Sessions</h2>';
|
||||||
document.getElementById('sessions_menu').innerHTML += '<ul class="list-group list-group-flush" role="">';
|
document.getElementById('sessions_menu').innerHTML += '<ul class="list-group list-group-flush" role="">';
|
||||||
//let location_detail = '';
|
//let launcher_sessions = '';
|
||||||
if (document.getElementById('location_detail').innerHTML.length) {
|
if (document.getElementById('launcher_sessions').innerHTML.length) {
|
||||||
console.log('detail_session_id_xx already exists');
|
console.log('launcher_sessions already exists');
|
||||||
|
document.getElementById('launcher_sessions').innerHTML = ''; // This needs to be reviewed.
|
||||||
} else {
|
} else {
|
||||||
console.log('location_detail already populated');
|
console.log('launcher_sessions is empty');
|
||||||
document.getElementById('location_detail').innerHTML = ''; // This needs to be reviewed.
|
//document.getElementById('launcher_sessions').innerHTML = ''; // This needs to be reviewed.
|
||||||
}
|
}
|
||||||
for (var i in launcher_tmp.session) {
|
for (var i in launcher_tmp.session) {
|
||||||
// List sessions in menu
|
// List sessions in menu
|
||||||
document.getElementById('sessions_menu').innerHTML += '<li id="menu_session_id_'+launcher_tmp.session[i].id+'" class="list-group-item btn btn-info d-flex justify-content-between align-items-center btn_view_session" data-session_id="'+launcher_tmp.session[i].id+'">'+launcher_tmp.session[i].name+'</li>';
|
document.getElementById('sessions_menu').innerHTML += '<li id="menu_event_session_'+launcher_tmp.session[i].id+'" class="list-group-item btn btn-info d-flex justify-content-between align-items-center btn_view_session" data-session_id="'+launcher_tmp.session[i].id+'">'+launcher_tmp.session[i].name+'</li>';
|
||||||
|
|
||||||
// Create containers for each session
|
// Create containers for each session
|
||||||
let session_detail = '';
|
let session_detail = '';
|
||||||
@@ -84,7 +95,7 @@ exports.render_launcher = async function (launcher_tmp) {
|
|||||||
let file = launcher_tmp.session[i].file[j];
|
let file = launcher_tmp.session[i].file[j];
|
||||||
//console.log(file.event_file_filename);
|
//console.log(file.event_file_filename);
|
||||||
|
|
||||||
files_list += '<li class="list-group-item btn btn-primary d-flex justify-content-between align-items-center open_local_file" data-hash_sha256="'+file.hash_sha256+'.file" data-filename="'+file.event_file_filename+'">';
|
files_list += '<li id="event_session_file_'+file.event_file_id+'" class="list-group-item btn btn-primary d-flex justify-content-between align-items-center open_local_file" data-hash_sha256="'+file.hash_sha256+'.file" data-filename="'+file.event_file_filename+'">';
|
||||||
files_list += file.event_file_filename;
|
files_list += file.event_file_filename;
|
||||||
files_list += '<span class="badge badge-pill badge-light">'+format_bytes(file.size, 2)+'; '+dateFns.format(file.created_on, 'MMM M h:mm A')+'; '+file.internal_os+'</span>';
|
files_list += '<span class="badge badge-pill badge-light">'+format_bytes(file.size, 2)+'; '+dateFns.format(file.created_on, 'MMM M h:mm A')+'; '+file.internal_os+'</span>';
|
||||||
files_list += '</li>';
|
files_list += '</li>';
|
||||||
@@ -118,7 +129,7 @@ exports.render_launcher = async function (launcher_tmp) {
|
|||||||
|
|
||||||
//var session_presentation_startdatetime = new Date(launcher_tmp.session[i].presentation[j].start_datetime);
|
//var session_presentation_startdatetime = new Date(launcher_tmp.session[i].presentation[j].start_datetime);
|
||||||
|
|
||||||
presentations_list += '<li class="list-group-item">';
|
presentations_list += '<li id="event_presentation_'+presentation.id+'" class="list-group-item">';
|
||||||
presentations_list += '<div class="list-group-item-heading d-flex justify-content-between align-items-center">';
|
presentations_list += '<div class="list-group-item-heading d-flex justify-content-between align-items-center">';
|
||||||
presentations_list += '<strong class="">'+presentation.name+'</strong>';
|
presentations_list += '<strong class="">'+presentation.name+'</strong>';
|
||||||
presentations_list += '<span class="badge badge-pill badge-info">'+dateFns.format(presentation.start_datetime, 'h:mm a')+'</span>';
|
presentations_list += '<span class="badge badge-pill badge-info">'+dateFns.format(presentation.start_datetime, 'h:mm a')+'</span>';
|
||||||
@@ -133,7 +144,7 @@ exports.render_launcher = async function (launcher_tmp) {
|
|||||||
let file = presentation.file[k];
|
let file = presentation.file[k];
|
||||||
//console.log(file.event_file_filename);
|
//console.log(file.event_file_filename);
|
||||||
|
|
||||||
files_list += '<li class="list-group-item btn btn-primary d-flex justify-content-between align-items-center open_local_file" data-hash_sha256="'+file.hash_sha256+'.file" data-filename="'+file.event_file_filename+'">';
|
files_list += '<li id="event_presentation_file_'+file.event_file_id+'" class="list-group-item btn btn-primary d-flex justify-content-between align-items-center open_local_file" data-hash_sha256="'+file.hash_sha256+'.file" data-filename="'+file.event_file_filename+'"><span class="fas fa-external-link-alt"></span> ';
|
||||||
files_list += file.event_file_filename;
|
files_list += file.event_file_filename;
|
||||||
files_list += '<span class="badge badge-pill badge-light float-right">'+format_bytes(file.size, 2)+'; '+dateFns.format(file.created_on, 'MMM M h:mm A')+'; '+file.internal_os+'</span>';
|
files_list += '<span class="badge badge-pill badge-light float-right">'+format_bytes(file.size, 2)+'; '+dateFns.format(file.created_on, 'MMM M h:mm A')+'; '+file.internal_os+'</span>';
|
||||||
files_list += '</li>';
|
files_list += '</li>';
|
||||||
@@ -150,7 +161,7 @@ exports.render_launcher = async function (launcher_tmp) {
|
|||||||
let presenter = presentation.presenter[k];
|
let presenter = presentation.presenter[k];
|
||||||
//console.log(presenter.given_name);
|
//console.log(presenter.given_name);
|
||||||
|
|
||||||
presenters_list += '<li class="list-group-item">';
|
presenters_list += '<li id="event_presenter_'+presenter.id+'" class="list-group-item">';
|
||||||
presenters_list += '<strong class="list-group-item-heading">'+presenter.given_name+' '+presenter.family_name+'</strong>';
|
presenters_list += '<strong class="list-group-item-heading">'+presenter.given_name+' '+presenter.family_name+'</strong>';
|
||||||
|
|
||||||
if (typeof presenter.file !== 'undefined') {
|
if (typeof presenter.file !== 'undefined') {
|
||||||
@@ -158,20 +169,7 @@ exports.render_launcher = async function (launcher_tmp) {
|
|||||||
files_list += '<ul class="list-group list-group-flush list-group-item-text">';
|
files_list += '<ul class="list-group list-group-flush list-group-item-text">';
|
||||||
for (var l in presenter.file) {
|
for (var l in presenter.file) {
|
||||||
let file = presenter.file[l];
|
let file = presenter.file[l];
|
||||||
|
files_list += '<li id="event_presenter_file_'+file.event_file_id+'" class="list-group-item btn btn-primary d-flex justify-content-between align-items-center open_local_file" data-hash_sha256="'+file.hash_sha256+'.file" data-filename="'+file.event_file_filename+'"><span class="fas fa-external-link-alt"></span> ';
|
||||||
/*
|
|
||||||
files_list += '<li class="list-group-item list-group-item-action open_local_file" data-hash_sha256="'+launcher_tmp.session[i].presentation[j].presenter[k].file[l].hash_sha256+'.file" data-filename="'+launcher_tmp.session[i].presentation[j].presenter[k].file[l].event_file_filename+'">';
|
|
||||||
files_list += '<button class="btn btn-info open_local_file" data-hash_sha256="'+launcher_tmp.session[i].presentation[j].presenter[k].file[l].hash_sha256+'.file" data-filename="'+launcher_tmp.session[i].presentation[j].presenter[k].file[l].event_file_filename+'">'+launcher_tmp.session[i].presentation[j].presenter[k].file[l].event_file_filename+'</button>';
|
|
||||||
|
|
||||||
var event_file_size = launcher_tmp.session[i].presentation[j].presenter[k].file[l].size;
|
|
||||||
var event_file_created_on = new Date(launcher_tmp.session[i].presentation[j].presenter[k].file[l].created_on);
|
|
||||||
|
|
||||||
session_detail += '<span class="badge badge-pill badge-light float-right">'+format_bytes(event_file_size, 2)+'; '+dateFns.format(event_file_created_on, 'MMM M h:mm A')+'; '+launcher_tmp.session[i].presentation[j].presenter[k].file[l].internal_os+'</span>';
|
|
||||||
|
|
||||||
|
|
||||||
session_detail += '</li>';
|
|
||||||
*/
|
|
||||||
files_list += '<li class="list-group-item btn btn-primary d-flex justify-content-between align-items-center open_local_file" data-hash_sha256="'+file.hash_sha256+'.file" data-filename="'+file.event_file_filename+'">';
|
|
||||||
files_list += file.event_file_filename;
|
files_list += file.event_file_filename;
|
||||||
files_list += '<span class="badge badge-pill badge-light float-right">'+format_bytes(file.size, 2)+'; '+dateFns.format(file.created_on, 'MMM M h:mm A')+'; '+file.internal_os+'</span>';
|
files_list += '<span class="badge badge-pill badge-light float-right">'+format_bytes(file.size, 2)+'; '+dateFns.format(file.created_on, 'MMM M h:mm A')+'; '+file.internal_os+'</span>';
|
||||||
files_list += '</li>';
|
files_list += '</li>';
|
||||||
@@ -206,19 +204,19 @@ exports.render_launcher = async function (launcher_tmp) {
|
|||||||
session_detail += '</div> <!-- End session detail for '+launcher_tmp.session[i].id+' -->';
|
session_detail += '</div> <!-- End session detail for '+launcher_tmp.session[i].id+' -->';
|
||||||
// *** Session presentations card section start
|
// *** Session presentations card section start
|
||||||
|
|
||||||
//document.getElementById('location_detail').innerHTML += session_detail;
|
//document.getElementById('launcher_sessions').innerHTML += session_detail;
|
||||||
|
|
||||||
if (typeof(document.getElementById('detail_session_id_'+launcher_tmp.session[i].id)) != 'undefined' && document.getElementById('detail_session_id_'+launcher_tmp.session[i].id) != null) {
|
if (typeof(document.getElementById('detail_session_id_'+launcher_tmp.session[i].id)) != 'undefined' && document.getElementById('detail_session_id_'+launcher_tmp.session[i].id) != null) {
|
||||||
document.getElementById('detail_session_id_'+launcher_tmp.session[i].id).innerHTML = session_detail;
|
document.getElementById('detail_session_id_'+launcher_tmp.session[i].id).innerHTML = session_detail;
|
||||||
} else {
|
} else {
|
||||||
document.getElementById('location_detail').innerHTML += session_detail;
|
document.getElementById('launcher_sessions').innerHTML += session_detail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
document.getElementById('sessions_menu').innerHTML += '</ul>';
|
document.getElementById('sessions_menu').innerHTML += '</ul>';
|
||||||
|
|
||||||
index_location_detail('btn_view_session');
|
index_launcher_sessions('btn_view_session');
|
||||||
|
|
||||||
index_open_file_buttons('open_local_file');
|
index_open_file_buttons('open_local_file');
|
||||||
|
|
||||||
@@ -232,7 +230,7 @@ exports.render_launcher = async function (launcher_tmp) {
|
|||||||
|
|
||||||
|
|
||||||
/* Updated 2019-12-19 */
|
/* Updated 2019-12-19 */
|
||||||
function index_location_detail(class_name) {
|
function index_launcher_sessions(class_name) {
|
||||||
var class_elements = document.getElementsByClassName(class_name);
|
var class_elements = document.getElementsByClassName(class_name);
|
||||||
|
|
||||||
for (var i = 0; i < class_elements.length; i++) {
|
for (var i = 0; i < class_elements.length; i++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user