More clean up of the JS code.
This commit is contained in:
BIN
app/.index.html.kate-swp
Normal file
BIN
app/.index.html.kate-swp
Normal file
Binary file not shown.
@@ -55,13 +55,20 @@
|
|||||||
<ul class="list-group list-group-flush" role=""></ul>
|
<ul class="list-group list-group-flush" role=""></ul>
|
||||||
</div>
|
</div>
|
||||||
<!--<div id="location_name" class="location_name"></div>-->
|
<!--<div id="location_name" class="location_name"></div>-->
|
||||||
<div id="launcher_location_name" class="launcher_location_name"><span id="location_name"></span><span id="event_name"></span></div>
|
<div id="launcher_location_name" class="launcher_location_name">
|
||||||
|
<span id="location_name"></span><span id="event_name"></span>
|
||||||
|
</div>
|
||||||
|
<div id="reset1" class="btn btn-warning reset" data-spy="affix" data-offset-top="200">
|
||||||
|
<span class="fas fa-sync"></span> Reset Launcher
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="launcher_sessions" class="launcher_sessions col"></div> <!-- end location details div -->
|
<div id="launcher_sessions" class="launcher_sessions col"></div> <!-- end location details div -->
|
||||||
</div> <!-- end row div -->
|
</div> <!-- end row div -->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<!--</main>--> <!-- /.container -->
|
<!--</main>--> <!-- /.container -->
|
||||||
|
|
||||||
|
|
||||||
@@ -97,9 +104,10 @@
|
|||||||
|
|
||||||
<!-- 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 api = require('./js/module_api');</script>-->
|
||||||
<script>const idb = require('./js/module_app_idb');</script>
|
<script>const idb = require('./js/module_app_idb');</script>
|
||||||
<!--<script src="js/api.js"></script>-->
|
<!--<script src="js/api.js"></script>-->
|
||||||
|
<script src="js/app_api.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>
|
||||||
@@ -127,7 +135,7 @@
|
|||||||
axios.defaults.baseURL = api_base_url;
|
axios.defaults.baseURL = api_base_url;
|
||||||
axios.defaults.headers.post['Access-Control-Allow-Origin'] = app_config.access_control_allow_origin; // '*';
|
axios.defaults.headers.post['Access-Control-Allow-Origin'] = app_config.access_control_allow_origin; // '*';
|
||||||
|
|
||||||
api.api_token_request_async(axios, secret_key).then( function(result) {
|
api_token_request_async(axios, secret_key).then( function(result) {
|
||||||
console.log('Setting temporary API token to axios Authorization header: '+result);
|
console.log('Setting temporary API token to axios Authorization header: '+result);
|
||||||
axios.defaults.headers.common['Authorization'] = `Token ${result}`;
|
axios.defaults.headers.common['Authorization'] = `Token ${result}`;
|
||||||
api_temporary_token = result;
|
api_temporary_token = result;
|
||||||
@@ -256,22 +264,20 @@
|
|||||||
let idb_tables_opened = false;
|
let idb_tables_opened = false;
|
||||||
|
|
||||||
// check periods and datetimes for update_idb_loop
|
// check periods and datetimes for update_idb_loop
|
||||||
idb_event_check_period = app_config.idb_event_check_period;
|
let idb_event_check_period = app_config.idb_event_check_period;
|
||||||
idb_event_check_datetime = Date.now();
|
let idb_event_check_datetime = Date.now();
|
||||||
idb_event_location_check_period = app_config.idb_event_location_check_period;
|
let idb_event_location_check_period = app_config.idb_event_location_check_period;
|
||||||
idb_event_location_check_datetime = Date.now();
|
let idb_event_location_check_datetime = Date.now();
|
||||||
idb_event_session_check_period = app_config.idb_event_session_check_period;
|
let idb_event_session_check_period = app_config.idb_event_session_check_period;
|
||||||
idb_event_session_check_datetime = Date.now();
|
let idb_event_session_check_datetime = Date.now();
|
||||||
idb_event_presentation_check_period = app_config.idb_event_presentation_check_period;
|
let idb_event_presentation_check_period = app_config.idb_event_presentation_check_period;
|
||||||
idb_event_presentation_check_datetime = Date.now();
|
let idb_event_presentation_check_datetime = Date.now();
|
||||||
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;
|
||||||
idb_event_presenter_check_datetime = Date.now();
|
let idb_event_presenter_check_datetime = Date.now();
|
||||||
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;
|
||||||
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_idb_to_launcher = false;
|
|
||||||
//let idb_to_launcher_in_progress = false;
|
|
||||||
let run_check_file_cache = false;
|
let run_check_file_cache = false;
|
||||||
|
|
||||||
let looping_tbl_event = false;
|
let looping_tbl_event = false;
|
||||||
@@ -329,7 +335,7 @@
|
|||||||
|
|
||||||
|
|
||||||
var api_token_update_loop = setInterval(function() {
|
var api_token_update_loop = setInterval(function() {
|
||||||
api.api_token_request_async(axios, secret_key).then( function(result) {
|
api_token_request_async(axios, secret_key).then( function(result) {
|
||||||
console.log('Setting temporary API token to axios Authorization header: '+result);
|
console.log('Setting temporary API token to axios Authorization header: '+result);
|
||||||
axios.defaults.headers.common['Authorization'] = `Token ${result}`;
|
axios.defaults.headers.common['Authorization'] = `Token ${result}`;
|
||||||
api_temporary_token = result;
|
api_temporary_token = result;
|
||||||
@@ -344,7 +350,7 @@
|
|||||||
if (axios_headers_set && idb_tables_opened) {
|
if (axios_headers_set && idb_tables_opened) {
|
||||||
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, account_id)
|
let v2_account_events = await v2_get_account_events(axios, account_id)
|
||||||
.then(function (response) {
|
.then(function (response) {
|
||||||
for (var i in response) {
|
for (var i in response) {
|
||||||
tbl_event.setItem(response[i].id.toString(), response[i]);
|
tbl_event.setItem(response[i].id.toString(), response[i]);
|
||||||
@@ -361,7 +367,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, event_id);
|
let v2_event_locations = await 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]);
|
||||||
}
|
}
|
||||||
@@ -371,7 +377,7 @@
|
|||||||
|
|
||||||
if (idb_event_session_check_datetime < Date.now()) {
|
if (idb_event_session_check_datetime < Date.now()) {
|
||||||
console.log('**** *** ** * Time to check event sessions'); // All event sessions, not just location specific.
|
console.log('**** *** ** * Time to check event sessions'); // All event sessions, not just location specific.
|
||||||
let v2_event_sessions = await api.v2_get_event_sessions(axios, event_id); // Was v2_get_event_location_sessions
|
let v2_event_sessions = await v2_get_event_sessions(axios, event_id); // Was v2_get_event_location_sessions
|
||||||
//tbl_event_session.clear();
|
//tbl_event_session.clear();
|
||||||
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]);
|
||||||
@@ -382,7 +388,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, event_location_id);
|
let v2_event_presentations = await 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]);
|
||||||
}
|
}
|
||||||
@@ -392,7 +398,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, event_location_id);
|
let v2_event_presenters = await 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]);
|
||||||
}
|
}
|
||||||
@@ -404,27 +410,27 @@
|
|||||||
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_files(axios, event_id);
|
let v2_event_files = await v2_get_event_files(axios, event_id);
|
||||||
for (var i in v2_event_files) {
|
for (var i in v2_event_files) {
|
||||||
tbl_event_file.setItem(v2_event_files[i].id.toString(), v2_event_files[i]);
|
tbl_event_file.setItem(v2_event_files[i].id.toString(), v2_event_files[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
let v2_event_location_files = await api.v2_get_event_location_files(axios, event_location_id);
|
let v2_event_location_files = await v2_get_event_location_files(axios, event_location_id);
|
||||||
for (var i in v2_event_location_files) {
|
for (var i in v2_event_location_files) {
|
||||||
tbl_event_file.setItem(v2_event_location_files[i].id.toString(), v2_event_location_files[i]);
|
tbl_event_file.setItem(v2_event_location_files[i].id.toString(), v2_event_location_files[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
let v2_event_location_files_sessions = await api.v2_get_event_location_files_sessions(axios, event_location_id);
|
let v2_event_location_files_sessions = await v2_get_event_location_files_sessions(axios, event_location_id);
|
||||||
for (var i in v2_event_location_files_sessions) {
|
for (var i in v2_event_location_files_sessions) {
|
||||||
tbl_event_file.setItem(v2_event_location_files_sessions[i].id.toString(), v2_event_location_files_sessions[i]);
|
tbl_event_file.setItem(v2_event_location_files_sessions[i].id.toString(), v2_event_location_files_sessions[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
let v2_event_location_files_presentations = await api.v2_get_event_location_files_presentations(axios, event_location_id);
|
let v2_event_location_files_presentations = await v2_get_event_location_files_presentations(axios, event_location_id);
|
||||||
for (var i in v2_event_location_files_presentations) {
|
for (var i in v2_event_location_files_presentations) {
|
||||||
tbl_event_file.setItem(v2_event_location_files_presentations[i].id.toString(), v2_event_location_files_presentations[i]);
|
tbl_event_file.setItem(v2_event_location_files_presentations[i].id.toString(), v2_event_location_files_presentations[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
let v2_event_location_files_presenters = await api.v2_get_event_location_files_presenters(axios, event_location_id);
|
let v2_event_location_files_presenters = await v2_get_event_location_files_presenters(axios, event_location_id);
|
||||||
for (var i in v2_event_location_files_presenters) {
|
for (var i in v2_event_location_files_presenters) {
|
||||||
tbl_event_file.setItem(v2_event_location_files_presenters[i].id.toString(), v2_event_location_files_presenters[i]);
|
tbl_event_file.setItem(v2_event_location_files_presenters[i].id.toString(), v2_event_location_files_presenters[i]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,4 @@
|
|||||||
/*
|
async function api_token_request_async(axios, secret_key) {
|
||||||
const os = require('os');
|
|
||||||
const path = require('path');
|
|
||||||
const fs = require('fs');
|
|
||||||
|
|
||||||
const { ipcRenderer } = require('electron');
|
|
||||||
*/
|
|
||||||
|
|
||||||
exports.api_token_request_async = async function (axios, secret_key) {
|
|
||||||
console.log('Requesting API temporary token...');
|
console.log('Requesting API temporary token...');
|
||||||
const url = '/api_token_request';
|
const url = '/api_token_request';
|
||||||
|
|
||||||
@@ -27,7 +19,7 @@ exports.api_token_request_async = async function (axios, secret_key) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
exports.get_event_details = async function (axios, event_id) {
|
async function get_event_details(axios, event_id) {
|
||||||
console.log('Requesting event details...');
|
console.log('Requesting event details...');
|
||||||
const url = '/event/'+event_id;
|
const url = '/event/'+event_id;
|
||||||
|
|
||||||
@@ -46,7 +38,7 @@ exports.get_event_details = async function (axios, event_id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
exports.get_event_location_details = async function (axios, event_id, event_location_id) {
|
async function get_event_location_details(axios, event_id, event_location_id) {
|
||||||
console.log('Requesting event location details...');
|
console.log('Requesting event location details...');
|
||||||
const url = '/event/'+event_id+'/location/'+event_location_id;
|
const url = '/event/'+event_id+'/location/'+event_location_id;
|
||||||
|
|
||||||
@@ -65,7 +57,7 @@ exports.get_event_location_details = async function (axios, event_id, event_loca
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
exports.get_event_location_sessions = async function (axios, event_id, event_location_id) {
|
async function get_event_location_sessions(axios, event_id, event_location_id) {
|
||||||
console.log('Requesting location sessions...');
|
console.log('Requesting location sessions...');
|
||||||
const url = '/event/'+event_id+'/location/'+event_location_id+'/session';
|
const url = '/event/'+event_id+'/location/'+event_location_id+'/session';
|
||||||
|
|
||||||
@@ -84,7 +76,7 @@ exports.get_event_location_sessions = async function (axios, event_id, event_loc
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
exports.get_session_presentations = async function (axios, event_id, event_session_id) {
|
async function get_session_presentations(axios, event_id, event_session_id) {
|
||||||
console.log('Requesting session presentations...');
|
console.log('Requesting session presentations...');
|
||||||
const url = '/event/'+event_id+'/session/'+event_session_id+'/presentation';
|
const url = '/event/'+event_id+'/session/'+event_session_id+'/presentation';
|
||||||
|
|
||||||
@@ -103,7 +95,7 @@ exports.get_session_presentations = async function (axios, event_id, event_sessi
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
exports.get_presentation_presenters = async function (axios, event_id, event_session_id, event_presentation_id) {
|
async function get_presentation_presenters(axios, event_id, event_session_id, event_presentation_id) {
|
||||||
console.log('Requesting presentation presenters...');
|
console.log('Requesting presentation presenters...');
|
||||||
const url = '/event/'+event_id+'/session/'+event_session_id+'/presentation/'+event_presentation_id+'/presenter';
|
const url = '/event/'+event_id+'/session/'+event_session_id+'/presentation/'+event_presentation_id+'/presenter';
|
||||||
|
|
||||||
@@ -122,7 +114,7 @@ exports.get_presentation_presenters = async function (axios, event_id, event_ses
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
exports.get_files_for_type_for_id = async function (axios, for_type, for_id) {
|
async function get_files_for_type_for_id(axios, for_type, for_id) {
|
||||||
console.log('Requesting files for '+for_type+' '+for_id);
|
console.log('Requesting files for '+for_type+' '+for_id);
|
||||||
const url = '/event/file/'+for_type+'/'+for_id;
|
const url = '/event/file/'+for_type+'/'+for_id;
|
||||||
|
|
||||||
@@ -141,7 +133,7 @@ exports.get_files_for_type_for_id = async function (axios, for_type, for_id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
exports.download_file_id = async function (axios, file_id, filename) {
|
async function download_file_id(axios, file_id, filename) {
|
||||||
|
|
||||||
ipcRenderer.send('download_file', api_base_url, api_endpoint, api_temporary_token, save_path); // in render thread
|
ipcRenderer.send('download_file', api_base_url, api_endpoint, api_temporary_token, save_path); // in render thread
|
||||||
|
|
||||||
@@ -210,7 +202,7 @@ exports.download_file_id = async function (axios, file_id, filename) {
|
|||||||
|
|
||||||
/* v2 Section */
|
/* v2 Section */
|
||||||
|
|
||||||
exports.v2_get_account_events = async function (axios, account_id) {
|
async function v2_get_account_events(axios, account_id) {
|
||||||
console.log('Requesting account events...');
|
console.log('Requesting account events...');
|
||||||
const url = '/v2/account/'+account_id+'/events';
|
const url = '/v2/account/'+account_id+'/events';
|
||||||
|
|
||||||
@@ -230,7 +222,7 @@ exports.v2_get_account_events = async function (axios, account_id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
exports.v2_get_event_locations = async function (axios, event_id) {
|
async function v2_get_event_locations(axios, event_id) {
|
||||||
console.log('Requesting event locations...');
|
console.log('Requesting event locations...');
|
||||||
const url = '/v2/event/'+event_id+'/event_locations';
|
const url = '/v2/event/'+event_id+'/event_locations';
|
||||||
|
|
||||||
@@ -250,7 +242,7 @@ exports.v2_get_event_locations = async function (axios, event_id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
exports.v2_get_event_sessions = async function (axios, event_id) {
|
async function v2_get_event_sessions(axios, event_id) {
|
||||||
console.log('Requesting event sessions...');
|
console.log('Requesting event sessions...');
|
||||||
const url = '/v2/event/'+event_id+'/event_sessions';
|
const url = '/v2/event/'+event_id+'/event_sessions';
|
||||||
|
|
||||||
@@ -271,7 +263,7 @@ exports.v2_get_event_sessions = async function (axios, event_id) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
exports.v2_get_event_location_sessions = async function (axios, event_location_id) {
|
async function v2_get_event_location_sessions(axios, event_location_id) {
|
||||||
console.log('Requesting location sessions...');
|
console.log('Requesting location sessions...');
|
||||||
const url = '/v2/event_location/'+event_location_id+'/event_sessions';
|
const url = '/v2/event_location/'+event_location_id+'/event_sessions';
|
||||||
|
|
||||||
@@ -291,7 +283,7 @@ exports.v2_get_event_location_sessions = async function (axios, event_location_i
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
exports.v2_get_event_location_presentations = async function (axios, event_location_id) {
|
async function v2_get_event_location_presentations(axios, event_location_id) {
|
||||||
console.log('Requesting location presentations...');
|
console.log('Requesting location presentations...');
|
||||||
const url = '/v2/event_location/'+event_location_id+'/event_presentations';
|
const url = '/v2/event_location/'+event_location_id+'/event_presentations';
|
||||||
|
|
||||||
@@ -311,7 +303,7 @@ exports.v2_get_event_location_presentations = async function (axios, event_locat
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
exports.v2_get_event_location_presenters = async function (axios, event_location_id) {
|
async function v2_get_event_location_presenters(axios, event_location_id) {
|
||||||
console.log('Requesting location presenters...');
|
console.log('Requesting location presenters...');
|
||||||
const url = '/v2/event_location/'+event_location_id+'/event_presenters';
|
const url = '/v2/event_location/'+event_location_id+'/event_presenters';
|
||||||
|
|
||||||
@@ -331,7 +323,7 @@ exports.v2_get_event_location_presenters = async function (axios, event_location
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
exports.v2_get_event_files = async function (axios, event_id) {
|
async function v2_get_event_files(axios, event_id) {
|
||||||
console.log('Requesting event files...');
|
console.log('Requesting event files...');
|
||||||
const url = '/v2/event/'+event_id+'/event_files';
|
const url = '/v2/event/'+event_id+'/event_files';
|
||||||
|
|
||||||
@@ -352,7 +344,7 @@ exports.v2_get_event_files = async function (axios, event_id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
exports.v2_get_event_location_files = async function (axios, event_location_id) {
|
async function v2_get_event_location_files(axios, event_location_id) {
|
||||||
console.log('Requesting location files...');
|
console.log('Requesting location files...');
|
||||||
const url = '/v2/event_location/'+event_location_id+'/event_files';
|
const url = '/v2/event_location/'+event_location_id+'/event_files';
|
||||||
|
|
||||||
@@ -373,7 +365,7 @@ exports.v2_get_event_location_files = async function (axios, event_location_id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
exports.v2_get_event_location_files_sessions = async function (axios, event_location_id) {
|
async function v2_get_event_location_files_sessions(axios, event_location_id) {
|
||||||
console.log('Requesting all session files for a location...');
|
console.log('Requesting all session files for a location...');
|
||||||
const url = '/v2/event_location/'+event_location_id+'/event_files/sessions';
|
const url = '/v2/event_location/'+event_location_id+'/event_files/sessions';
|
||||||
|
|
||||||
@@ -394,7 +386,7 @@ exports.v2_get_event_location_files_sessions = async function (axios, event_loca
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
exports.v2_get_event_location_files_presentations = async function (axios, event_location_id) {
|
async function v2_get_event_location_files_presentations(axios, event_location_id) {
|
||||||
console.log('Requesting all presentation files for a location...');
|
console.log('Requesting all presentation files for a location...');
|
||||||
const url = '/v2/event_location/'+event_location_id+'/event_files/presentations';
|
const url = '/v2/event_location/'+event_location_id+'/event_files/presentations';
|
||||||
|
|
||||||
@@ -415,7 +407,7 @@ exports.v2_get_event_location_files_presentations = async function (axios, event
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
exports.v2_get_event_location_files_presenters = async function (axios, event_location_id) {
|
async function v2_get_event_location_files_presenters(axios, event_location_id) {
|
||||||
console.log('Requesting all presenter files for a location...');
|
console.log('Requesting all presenter files for a location...');
|
||||||
const url = '/v2/event_location/'+event_location_id+'/event_files/presenters';
|
const url = '/v2/event_location/'+event_location_id+'/event_files/presenters';
|
||||||
|
|
||||||
@@ -58,8 +58,7 @@ async function render_event_file_records() {
|
|||||||
file_li_node.getElementsByClassName('filename')[0].innerHTML = tbl_filename;
|
file_li_node.getElementsByClassName('filename')[0].innerHTML = tbl_filename;
|
||||||
try {
|
try {
|
||||||
file_li_node.getElementsByClassName('file_meta')[0].innerHTML = format_bytes(tbl_size, 2)+'; '+dateFns.format(tbl_created_on, 'MMM M h:mm A')+'; '+tbl_internal_os;
|
file_li_node.getElementsByClassName('file_meta')[0].innerHTML = format_bytes(tbl_size, 2)+'; '+dateFns.format(tbl_created_on, 'MMM M h:mm A')+'; '+tbl_internal_os;
|
||||||
}
|
} catch(err) {
|
||||||
catch(err) {
|
|
||||||
console.log('file_meta span not found. This is ok for event and location specific files.');
|
console.log('file_meta span not found. This is ok for event and location specific files.');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,8 +88,7 @@ async function render_event_file_records() {
|
|||||||
console.log('Trying to remove an old file LI node if it exists...');
|
console.log('Trying to remove an old file LI node if it exists...');
|
||||||
try {
|
try {
|
||||||
document.getElementById('event_file_'+tbl_file_id).remove();
|
document.getElementById('event_file_'+tbl_file_id).remove();
|
||||||
}
|
} catch(err) {
|
||||||
catch(err) {
|
|
||||||
//console.log('A node with the ID of event_file_'+tbl_file_id+' was not found.');
|
//console.log('A node with the ID of event_file_'+tbl_file_id+' was not found.');
|
||||||
console.log('This event file list item node was not found. In most cases this is expected.');
|
console.log('This event file list item node was not found. In most cases this is expected.');
|
||||||
console.log(err.message);
|
console.log(err.message);
|
||||||
@@ -98,7 +96,11 @@ async function render_event_file_records() {
|
|||||||
|
|
||||||
let file_li_node = document.createElement('LI');
|
let file_li_node = document.createElement('LI');
|
||||||
file_li_node.id = 'event_file_'+tbl_file_id;
|
file_li_node.id = 'event_file_'+tbl_file_id;
|
||||||
file_li_node.className = 'list-group-item btn btn-primary d-flex justify-content-between align-items-center open_local_file event_file';
|
if (tbl_for_type != 'event' && tbl_for_type != 'location') {
|
||||||
|
file_li_node.className = 'list-group-item btn btn-primary d-flex justify-content-between align-items-center open_local_file event_file';
|
||||||
|
} else {
|
||||||
|
file_li_node.className = 'list-group-item btn btn-sm btn-secondary d-flex justify-content-between align-items-center open_local_file event_file';
|
||||||
|
}
|
||||||
file_li_node.setAttribute('data-file_id', tbl_file_id);
|
file_li_node.setAttribute('data-file_id', tbl_file_id);
|
||||||
|
|
||||||
|
|
||||||
@@ -161,8 +163,7 @@ async function render_event_file_records() {
|
|||||||
console.log('Trying to remove an old file LI node if it exists...');
|
console.log('Trying to remove an old file LI node if it exists...');
|
||||||
try {
|
try {
|
||||||
document.getElementById('event_file_'+tbl_file_id).remove();
|
document.getElementById('event_file_'+tbl_file_id).remove();
|
||||||
}
|
} catch(err) {
|
||||||
catch(err) {
|
|
||||||
//console.log('A node with the ID of event_file_'+tbl_file_id+' was not found.');
|
//console.log('A node with the ID of event_file_'+tbl_file_id+' was not found.');
|
||||||
console.log('This event file list item node was not found. In most cases this is expected.');
|
console.log('This event file list item node was not found. In most cases this is expected.');
|
||||||
console.log(err.message);
|
console.log(err.message);
|
||||||
@@ -171,25 +172,28 @@ async function render_event_file_records() {
|
|||||||
|
|
||||||
console.log('XXXXX ******** STARTING SORT ******** XXXXX');
|
console.log('XXXXX ******** STARTING SORT ******** XXXXX');
|
||||||
let node_id = tbl_for_type+'_files_list_'+tbl_for_id;
|
let node_id = tbl_for_type+'_files_list_'+tbl_for_id;
|
||||||
console.log(node_id);
|
console.log(node_id);
|
||||||
|
try {
|
||||||
|
var categoryItems = document.getElementById(node_id).childNodes;
|
||||||
|
console.log(categoryItems);
|
||||||
|
|
||||||
var categoryItems = document.getElementById(node_id).childNodes;
|
var categoryItemsArray = Array.from(categoryItems);
|
||||||
console.log(categoryItems);
|
|
||||||
|
function sorter(a, b) {
|
||||||
var categoryItemsArray = Array.from(categoryItems);
|
if (a.dataset.updated_on > b.dataset.updated_on) return -1;
|
||||||
|
if (a.dataset.updated_on < b.dataset.updated_on) return 1;
|
||||||
function sorter(a, b) {
|
}
|
||||||
if (a.dataset.updated_on > b.dataset.updated_on) return -1;
|
|
||||||
if (a.dataset.updated_on < b.dataset.updated_on) return 1;
|
let sorted = categoryItemsArray.sort(sorter);
|
||||||
|
|
||||||
|
function update_li_order(item, index) {
|
||||||
|
document.getElementById(node_id).appendChild(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
sorted.forEach(update_li_order);
|
||||||
|
} catch(err) {
|
||||||
|
console.log(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
let sorted = categoryItemsArray.sort(sorter);
|
|
||||||
|
|
||||||
function update_li_order(item, index) {
|
|
||||||
document.getElementById(node_id).appendChild(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
sorted.forEach(update_li_order);
|
|
||||||
console.log('******** FINISHED SORT ********');
|
console.log('******** FINISHED SORT ********');
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,15 @@ function render_event_records() {
|
|||||||
//console.log(tbl_event);
|
//console.log(tbl_event);
|
||||||
//console.log(event_id);
|
//console.log(event_id);
|
||||||
|
|
||||||
|
if (looping_tbl_event) {
|
||||||
|
console.log('Already looping through the tbl_event table. Not starting until finished.');
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
looping_tbl_event = true;
|
||||||
|
|
||||||
tbl_event.iterate(function(value, key, iteration) {
|
tbl_event.iterate(function(value, key, iteration) {
|
||||||
if (value.id == event_id) {
|
if (value.id == event_id) {
|
||||||
console.log('*** Event id ('+event_id+') found in table.');
|
console.log('*** Event id ('+event_id+') found in table.');
|
||||||
@@ -17,7 +26,8 @@ function render_event_records() {
|
|||||||
}
|
}
|
||||||
}).then(function() {
|
}).then(function() {
|
||||||
console.log('idb_to_ui: Iterate tbl_event_file complete')
|
console.log('idb_to_ui: Iterate tbl_event_file complete')
|
||||||
tbl_event_complete = true;
|
//tbl_event_complete = true;
|
||||||
|
looping_tbl_event = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -27,6 +37,15 @@ function render_event_records() {
|
|||||||
async function render_event_location_records() {
|
async function render_event_location_records() {
|
||||||
console.log('Rendering event location records...');
|
console.log('Rendering event location records...');
|
||||||
|
|
||||||
|
if (looping_tbl_event_location) {
|
||||||
|
console.log('Already looping through the tbl_event_location table. Not starting until finished.');
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
looping_tbl_event_location = true;
|
||||||
|
|
||||||
await tbl_event_location.iterate(function(value, key, iteration) {
|
await tbl_event_location.iterate(function(value, key, iteration) {
|
||||||
if (value.id == event_location_id) {
|
if (value.id == event_location_id) {
|
||||||
console.log('*** Event location id ('+event_location_id+') found in table.');
|
console.log('*** Event location id ('+event_location_id+') found in table.');
|
||||||
@@ -45,7 +64,8 @@ async function render_event_location_records() {
|
|||||||
}
|
}
|
||||||
}).then(function() {
|
}).then(function() {
|
||||||
console.log('idb_to_ui: Iterate tbl_event_file complete')
|
console.log('idb_to_ui: Iterate tbl_event_file complete')
|
||||||
tbl_event_location_complete = true;
|
//tbl_event_location_complete = true;
|
||||||
|
looping_tbl_event_location = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -89,23 +109,34 @@ 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 ******************');
|
||||||
var class_elements = document.getElementsByClassName(class_name);
|
var class_elements = document.getElementsByClassName(class_name);
|
||||||
|
console.log(class_elements);
|
||||||
|
|
||||||
for (var i = 0; i < class_elements.length; i++) {
|
for (var i = 0; i < class_elements.length; i++) {
|
||||||
// Do not use an anonymous function. If you do then it will keep adding event listeners.
|
// Do not use an anonymous function. If you do then it will keep adding event listeners.
|
||||||
// Adding the exact same event listeners over and over doesn't hurt anything.
|
// Adding the exact same event listeners over and over doesn't hurt anything.
|
||||||
// No need to use removeEventListener()
|
// No need to use removeEventListener()
|
||||||
class_elements[i].addEventListener( 'click', open_local_file );
|
class_elements[i].addEventListener( 'click', open_local_file );
|
||||||
|
|
||||||
|
/*
|
||||||
|
let hash = class_elements[i].getAttribute('data-hash_sha256');
|
||||||
|
let file_path = path.join(host_file_cache_path, hash);
|
||||||
|
let filename = class_elements[i].getAttribute('data-filename');
|
||||||
|
class_elements[i].addEventListener( 'click', function() { ipcRenderer.send('open_local_file', file_path, filename) } );
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Updated 2020-02-13 */
|
/* Updated 2020-02-13 */
|
||||||
function open_local_file(element) {
|
function open_local_file() {
|
||||||
console.log(element);
|
//console.log(this);
|
||||||
let file_path = path.join(host_file_cache_path, element.getAttribute('data-hash_sha256'));
|
let hash = this.getAttribute('data-hash_sha256');
|
||||||
let filename = element.getAttribute('data-filename');
|
let file_path = path.join(host_file_cache_path, hash);
|
||||||
|
let filename = this.getAttribute('data-filename');
|
||||||
console.log(file_path);
|
console.log(file_path);
|
||||||
console.log(filename);
|
console.log(filename);
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,13 @@ async function render_event_presentation_records(events) {
|
|||||||
console.log('Rendering event presentation records...');
|
console.log('Rendering event presentation records...');
|
||||||
console.log('****************** Presentations ******************');
|
console.log('****************** Presentations ******************');
|
||||||
|
|
||||||
|
if (looping_tbl_event_presentation) {
|
||||||
|
console.log('Already looping through the tbl_event_presentation table. Not starting until finished.');
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
let launcher_sessions = document.getElementById('launcher_sessions').childNodes; //_list_items
|
let launcher_sessions = document.getElementById('launcher_sessions').childNodes; //_list_items
|
||||||
//console.log(launcher_sessions);
|
//console.log(launcher_sessions);
|
||||||
|
|
||||||
@@ -45,6 +52,7 @@ async function render_event_presentation_records(events) {
|
|||||||
|
|
||||||
}).then(function() {
|
}).then(function() {
|
||||||
console.log('idb_to_ui: Iterate tbl_event_presentation looking for presentations to update or remove is complete');
|
console.log('idb_to_ui: Iterate tbl_event_presentation looking for presentations to update or remove is complete');
|
||||||
|
|
||||||
looping_tbl_event_presentation = false;
|
looping_tbl_event_presentation = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -151,8 +159,7 @@ async function render_event_presentation_records(events) {
|
|||||||
// Trying to remove old ID in case there is one already rendered
|
// Trying to remove old ID in case there is one already rendered
|
||||||
try {
|
try {
|
||||||
document.getElementById('event_presentation_'+value.id).remove();
|
document.getElementById('event_presentation_'+value.id).remove();
|
||||||
}
|
} catch(err) {
|
||||||
catch(err) {
|
|
||||||
console.log('A node with the ID of event_presentation_'+value.id+' was not found. In most cases this is expected.');
|
console.log('A node with the ID of event_presentation_'+value.id+' was not found. In most cases this is expected.');
|
||||||
console.log(err.message);
|
console.log(err.message);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,8 +112,7 @@ async function render_event_presenter_records(events) {
|
|||||||
console.log('Trying to remove an old presenter LI node if it exists...');
|
console.log('Trying to remove an old presenter LI node if it exists...');
|
||||||
try {
|
try {
|
||||||
document.getElementById('event_presenter_'+tbl_presenter_id).remove();
|
document.getElementById('event_presenter_'+tbl_presenter_id).remove();
|
||||||
}
|
} catch(err) {
|
||||||
catch(err) {
|
|
||||||
//console.log('A node with the ID of event_presenter_'+tbl_presenter_id+' was not found.');
|
//console.log('A node with the ID of event_presenter_'+tbl_presenter_id+' was not found.');
|
||||||
console.log('This presenter list item node was not found. In most cases this is expected.');
|
console.log('This presenter list item node was not found. In most cases this is expected.');
|
||||||
console.log(err.message);
|
console.log(err.message);
|
||||||
@@ -152,23 +151,28 @@ async function render_event_presenter_records(events) {
|
|||||||
remove_presenter_id = false;
|
remove_presenter_id = false;
|
||||||
|
|
||||||
console.log('XXXXX ******** STARTING SORT ******** XXXXX');
|
console.log('XXXXX ******** STARTING SORT ******** XXXXX');
|
||||||
var categoryItems = document.getElementById('event_presentation_presenters_'+tbl_presentation_id).childNodes;
|
try {
|
||||||
console.log(categoryItems);
|
var categoryItems = document.getElementById('event_presentation_presenters_'+tbl_presentation_id).childNodes;
|
||||||
|
console.log(categoryItems);
|
||||||
var categoryItemsArray = Array.from(categoryItems);
|
|
||||||
|
var categoryItemsArray = Array.from(categoryItems);
|
||||||
function sorter(a, b) {
|
|
||||||
if (a.dataset.family_name < b.dataset.family_name) return -1;
|
function sorter(a, b) {
|
||||||
if (a.dataset.family_name > b.dataset.family_name) return 1;
|
if (a.dataset.family_name < b.dataset.family_name) return -1;
|
||||||
|
if (a.dataset.family_name > b.dataset.family_name) return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
let sorted = categoryItemsArray.sort(sorter);
|
||||||
|
|
||||||
|
function update_li_order(item, index) {
|
||||||
|
document.getElementById('event_presentation_presenters_'+tbl_presentation_id).appendChild(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
sorted.forEach(update_li_order);
|
||||||
|
} catch(err) {
|
||||||
|
console.log(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
let sorted = categoryItemsArray.sort(sorter);
|
|
||||||
|
|
||||||
function update_li_order(item, index) {
|
|
||||||
document.getElementById('event_presentation_presenters_'+tbl_presentation_id).appendChild(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
sorted.forEach(update_li_order);
|
|
||||||
console.log('******** FINISHED SORT ********');
|
console.log('******** FINISHED SORT ********');
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -185,8 +189,7 @@ async function render_event_presenter_records(events) {
|
|||||||
console.log('Trying to remove a presenter LI node...');
|
console.log('Trying to remove a presenter LI node...');
|
||||||
try {
|
try {
|
||||||
document.getElementById('event_presenter_'+tbl_presenter_id).remove();
|
document.getElementById('event_presenter_'+tbl_presenter_id).remove();
|
||||||
}
|
} catch(err) {
|
||||||
catch(err) {
|
|
||||||
//console.log('A node with the ID of event_presenter_'+tbl_presenter_id+' was not found.');
|
//console.log('A node with the ID of event_presenter_'+tbl_presenter_id+' was not found.');
|
||||||
console.log('This presenter list item node was not found. In some cases this is expected.');
|
console.log('This presenter list item node was not found. In some cases this is expected.');
|
||||||
console.log(err.message);
|
console.log(err.message);
|
||||||
|
|||||||
@@ -2,6 +2,15 @@
|
|||||||
async function render_event_session_records() {
|
async function render_event_session_records() {
|
||||||
console.log('Rendering event session records...');
|
console.log('Rendering event session records...');
|
||||||
|
|
||||||
|
if (looping_tbl_event_session) {
|
||||||
|
console.log('Already looping through the tbl_event_session table. Not starting until finished.');
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
looping_tbl_event_session = true;
|
||||||
|
|
||||||
// First: update or add sessions
|
// First: update or add sessions
|
||||||
tbl_event_session.iterate(function(value, key, iteration) {
|
tbl_event_session.iterate(function(value, key, iteration) {
|
||||||
if (value.event_id == event_id && value.event_location_id == event_location_id) {
|
if (value.event_id == event_id && value.event_location_id == event_location_id) {
|
||||||
@@ -21,7 +30,7 @@ async function render_event_session_records() {
|
|||||||
// Add the new session to the session menu
|
// Add the new session to the session menu
|
||||||
let node = document.createElement('LI');
|
let node = document.createElement('LI');
|
||||||
node.id = 'menu_event_session_'+value.id;
|
node.id = 'menu_event_session_'+value.id;
|
||||||
node.className = 'list-group-item btn btn-info d-flex justify-content-between align-items-center btn_view_session';
|
node.className = 'list-group-item btn btn-success d-flex justify-content-between align-items-center btn_view_session';
|
||||||
node.setAttribute('data-session_id', value.id);
|
node.setAttribute('data-session_id', value.id);
|
||||||
|
|
||||||
node.title = 'id='+value.id+' session_id='+value.id;
|
node.title = 'id='+value.id+' session_id='+value.id;
|
||||||
@@ -128,7 +137,7 @@ async function render_event_session_records() {
|
|||||||
}
|
}
|
||||||
}).then(function() {
|
}).then(function() {
|
||||||
console.log('idb_to_ui: Iterate tbl_event_session complete');
|
console.log('idb_to_ui: Iterate tbl_event_session complete');
|
||||||
tbl_event_session_complete = true;
|
//tbl_event_session_complete = true;
|
||||||
}).then(function() {
|
}).then(function() {
|
||||||
// Second: remove sessions from the launcher sessions menu and sessions list
|
// Second: remove sessions from the launcher sessions menu and sessions list
|
||||||
// This is basing the removal of sessions only on the menu list of sessions.
|
// This is basing the removal of sessions only on the menu list of sessions.
|
||||||
@@ -143,6 +152,9 @@ async function render_event_session_records() {
|
|||||||
if (session_list_items.length) {
|
if (session_list_items.length) {
|
||||||
for (let i=0, len=session_list_items.length; i < len; i++) {
|
for (let i=0, len=session_list_items.length; i < len; i++) {
|
||||||
console.log('Checking session_id='+session_list_items[i].getAttribute('data-session_id'));
|
console.log('Checking session_id='+session_list_items[i].getAttribute('data-session_id'));
|
||||||
|
|
||||||
|
looping_tbl_event_session = true;
|
||||||
|
|
||||||
let session_id = session_list_items[i].getAttribute('data-session_id');
|
let session_id = session_list_items[i].getAttribute('data-session_id');
|
||||||
let session_valid = false;
|
let session_valid = false;
|
||||||
|
|
||||||
@@ -164,9 +176,13 @@ async function render_event_session_records() {
|
|||||||
document.getElementById('menu_event_session_'+session_id).remove(); // Remove the node from the launcher sessions menu list
|
document.getElementById('menu_event_session_'+session_id).remove(); // Remove the node from the launcher sessions menu list
|
||||||
document.getElementById('detail_session_'+session_id).remove(); // Remove the node from the launcher sessions list
|
document.getElementById('detail_session_'+session_id).remove(); // Remove the node from the launcher sessions list
|
||||||
}
|
}
|
||||||
|
|
||||||
|
looping_tbl_event_session = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
looping_tbl_event_session = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Third: re-index view session buttons
|
// Third: re-index view session buttons
|
||||||
|
|||||||
@@ -30,7 +30,6 @@
|
|||||||
"local_db_username": "username_here",
|
"local_db_username": "username_here",
|
||||||
"local_db_password": "password_here",
|
"local_db_password": "password_here",
|
||||||
"idb_name": "osit",
|
"idb_name": "osit",
|
||||||
"idb_check_period": 30000,
|
|
||||||
"idb_event_check_period": 120000,
|
"idb_event_check_period": 120000,
|
||||||
"idb_event_location_check_period": 90000,
|
"idb_event_location_check_period": 90000,
|
||||||
"idb_event_session_check_period": 90000,
|
"idb_event_session_check_period": 90000,
|
||||||
|
|||||||
Reference in New Issue
Block a user