Creating IDB direct to UI render. Version 2 of rendering the UI.
This commit is contained in:
@@ -12,6 +12,13 @@ exports.create_load_idb = async function create_load_idb() {
|
||||
|
||||
|
||||
exports.idb_to_launcher = async function idb_to_launcher() {
|
||||
if (idb_to_launcher_in_progress) {
|
||||
console.log('*** Exit idb_to_launcher. It is already in progress. ***');
|
||||
return false; // return false... false being that another idb_to_launcher is in progress
|
||||
} else {
|
||||
console.log('idb_to_launcher is not in progress. It appears to be safe to start... starting.');
|
||||
}
|
||||
|
||||
//tbl_example.iterate(tbl_check, tbl_check_success, tbl_check_error); //tbl_check(value, key, iteration)
|
||||
let launcher_new = new Object();
|
||||
|
||||
@@ -31,7 +38,7 @@ exports.idb_to_launcher = async function idb_to_launcher() {
|
||||
tbl_event.iterate(function(event_value, key, iteration) {
|
||||
tmp_event.push(event_value);
|
||||
}).then(function() {
|
||||
console.log('idb_to_launcher: Iterate tbl_event complete')
|
||||
//console.log('idb_to_launcher: Iterate tbl_event complete')
|
||||
tbl_event_complete = true;
|
||||
});
|
||||
launcher_new.event = tmp_event;
|
||||
@@ -44,7 +51,7 @@ exports.idb_to_launcher = async function idb_to_launcher() {
|
||||
tmp_event_file.push(file_value);
|
||||
}
|
||||
}).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_new.event_file = tmp_event_file;
|
||||
@@ -55,7 +62,7 @@ exports.idb_to_launcher = async function idb_to_launcher() {
|
||||
tbl_event_location.iterate(function(location_value, key, iteration) {
|
||||
tmp_event_location.push(location_value);
|
||||
}).then(function() {
|
||||
console.log('idb_to_launcher: Iterate tbl_event_location complete')
|
||||
//console.log('idb_to_launcher: Iterate tbl_event_location complete')
|
||||
tbl_event_location_complete = true;
|
||||
});
|
||||
launcher_new.location = tmp_event_location;
|
||||
@@ -67,7 +74,7 @@ exports.idb_to_launcher = async function idb_to_launcher() {
|
||||
tmp_event_location_file.push(file_value);
|
||||
}
|
||||
}).then(function() {
|
||||
console.log('idb_to_launcher: Iterate tbl_event_file complete')
|
||||
//console.log('idb_to_launcher: Iterate tbl_event_file complete')
|
||||
tbl_event_location_file_complete = true;
|
||||
});
|
||||
launcher_new.location_file = tmp_event_location_file;
|
||||
@@ -85,10 +92,9 @@ exports.idb_to_launcher = async function idb_to_launcher() {
|
||||
if (session_file_value.for_type == 'session' && session_value.id == session_file_value.for_id) {
|
||||
//console.log('session id: '+session_value.id+' -> file id: '+session_file_value.id);
|
||||
session_value.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')
|
||||
//console.log('idb_to_launcher: Iterate tbl_event_file complete')
|
||||
tbl_event_session_file_complete = true;
|
||||
});
|
||||
|
||||
@@ -98,8 +104,6 @@ exports.idb_to_launcher = async function idb_to_launcher() {
|
||||
tbl_event_presentation.iterate(function(presentation_value, presentation_key, presentation_iteration) {
|
||||
if (session_value.id == presentation_value.event_session_id) {
|
||||
//console.log('session id: '+session_value.id+' -> presentation id: '+presentation_value.id);
|
||||
|
||||
|
||||
// Look for *presentation files*
|
||||
presentation_value.file = [];
|
||||
tbl_event_file.iterate(function(presentation_file_value, presentation_file_key, presentation_file_iteration) {
|
||||
@@ -107,7 +111,7 @@ exports.idb_to_launcher = async function idb_to_launcher() {
|
||||
presentation_value.file.push(presentation_file_value);
|
||||
}
|
||||
}).then(function() {
|
||||
console.log('idb_to_launcher: Iterate tbl_event_file complete')
|
||||
//console.log('idb_to_launcher: Iterate tbl_event_file complete')
|
||||
tbl_event_presentation_file_complete = true;
|
||||
});
|
||||
|
||||
@@ -117,7 +121,6 @@ exports.idb_to_launcher = async function idb_to_launcher() {
|
||||
tbl_event_presenter.iterate(function(presenter_value, presenter_key, presenter_iteration) {
|
||||
if (presentation_value.id == presenter_value.event_presentation_id) {
|
||||
//console.log('presentation id: '+presentation_value.id+' -> presenter id: '+presenter_value.id);
|
||||
|
||||
// Look for *presenter files*
|
||||
presenter_value.file = [];
|
||||
tbl_event_file.iterate(function(presenter_file_value, presenter_file_key, presenter_file_iteration) {
|
||||
@@ -125,13 +128,13 @@ exports.idb_to_launcher = async function idb_to_launcher() {
|
||||
presenter_value.file.push(presenter_file_value);
|
||||
}
|
||||
}).then(function() {
|
||||
console.log('idb_to_launcher: Iterate tbl_event_file complete')
|
||||
//console.log('idb_to_launcher: Iterate tbl_event_file complete')
|
||||
tbl_event_presenter_file_complete = true;
|
||||
});
|
||||
presentation_value.presenter.push(presenter_value);
|
||||
}
|
||||
}).then(function() {
|
||||
console.log('idb_to_launcher: Iterate tbl_event_presenter complete')
|
||||
//console.log('idb_to_launcher: Iterate tbl_event_presenter complete')
|
||||
tbl_event_presenter_complete = true;
|
||||
});
|
||||
|
||||
@@ -139,7 +142,7 @@ exports.idb_to_launcher = async function idb_to_launcher() {
|
||||
}//);
|
||||
|
||||
}).then(function() {
|
||||
console.log('idb_to_launcher: Iterate tbl_event_presentation complete')
|
||||
//console.log('idb_to_launcher: Iterate tbl_event_presentation complete')
|
||||
tbl_event_presentation_complete = true;
|
||||
});
|
||||
//});
|
||||
@@ -147,7 +150,7 @@ exports.idb_to_launcher = async function idb_to_launcher() {
|
||||
tmp_event_session.push(session_value);
|
||||
|
||||
}).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_new.session = tmp_event_session;
|
||||
@@ -160,15 +163,20 @@ exports.idb_to_launcher = async function idb_to_launcher() {
|
||||
|
||||
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('*** New launcher object built!!! ***');
|
||||
console.log('idb to launcher object: ***');
|
||||
console.log(launcher_new);
|
||||
console.log('v2 idb to launcher object: ^^^');
|
||||
ui.render_launcher(launcher_new);
|
||||
console.log('idb to launcher object: ^^^');
|
||||
launcher = launcher_new;
|
||||
safe_to_render_launcher = true;
|
||||
idb_to_launcher_in_progress = false;
|
||||
//ui.render_launcher(launcher_new);
|
||||
clearInterval(creating_launcher_object_loop);
|
||||
return launcher_new;
|
||||
} else {
|
||||
console.log('Still building...');
|
||||
console.log('Still building launcher object...');
|
||||
safe_to_render_launcher = false;
|
||||
idb_to_launcher_in_progress = true;
|
||||
}
|
||||
}, 5);
|
||||
//return launcher_new;
|
||||
@@ -178,7 +186,7 @@ exports.check_file_cache = async function () {
|
||||
console.log('Checking the local file cache against the remote server.');
|
||||
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+' ***')
|
||||
//console.log('f: ('+file_value.event_file_id+') '+file_value.event_file_filename+' ***')
|
||||
|
||||
file_id = file_value.event_file_id; // NOTE: the .id is the hosted_file.id!
|
||||
let filename = file_value.hash_sha256+'.file';
|
||||
@@ -186,7 +194,7 @@ exports.check_file_cache = async function () {
|
||||
save_path = path.join(host_file_cache_path, filename);
|
||||
|
||||
if (fs.existsSync(save_path)) {
|
||||
console.log('Local file already exists: '+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';
|
||||
|
||||
Reference in New Issue
Block a user