Wrapping up for the day. Lots of tedious work on the Launcher.

This commit is contained in:
Scott Idem
2024-10-04 18:23:47 -04:00
parent b6cd3f59e5
commit aef469ad9d
11 changed files with 795 additions and 271 deletions

View File

@@ -2,6 +2,7 @@
@tailwind components;
@tailwind utilities;
@tailwind variants;
/* There are no more Tailwind layers. */
html,
body {

View File

@@ -399,6 +399,7 @@ export async function search__event_file(
// This function will loop through the event_file_obj_li and save each one to the DB.
// Updated 2024-10-04
export function db_save_ae_obj_li__event_file(
{
obj_type,
@@ -468,11 +469,15 @@ export function db_save_ae_obj_li__event_file(
event_location_code: obj.event_location_code,
event_location_name: obj.event_location_name,
event_session_code: obj.event_session_code,
event_session_type_code: obj.event_session_type_code,
event_session_name: obj.event_session_name,
event_session_start_datetime: obj.event_session_start_datetime,
event_session_end_datetime: obj.event_session_end_datetime,
event_presentation_code: obj.event_presentation_code,
event_presentation_type_code: obj.event_presentation_type_code,
event_presentation_name: obj.event_presentation_name,
event_presentation_start_datetime: obj.event_presentation_start_datetime,
event_presentation_end_datetime: obj.event_presentation_end_datetime,
event_presenter_given_name: obj.event_presenter_given_name,
event_presenter_family_name: obj.event_presenter_family_name,
event_presenter_full_name: obj.event_presenter_full_name,

View File

@@ -99,7 +99,9 @@ let events_local_data_struct: key_val = {
// Event Presentation Launcher (and native Electron app)
'launcher': {
controller_group_code: 'ae_launcher',
// default - browser, onsite - browser onsite, native - Electron app onsite
app_mode: 'default', // 'default', 'native', 'onsite'
ws_connect: false,
qry_limit__sessions: 50,
qry_limit__presentations: 25,
@@ -137,6 +139,17 @@ let events_local_data_struct: key_val = {
// 'host_file_temp_path': aether_cfg_data.app.host_file_temp_path,
'host_file_config_path': 'device_configs/ae_native_app_config.default.json',
},
screen_saver_img_list: [],
modal__title: '-- Not Set --',
modal__open: null,
modal__open_filename: null,
modal_img_src: null,
controller: 'local',
controller_group_code: 'launcher-00',
// controller_cmd: null,
// controller_trigger_send: null,
},
// Lead Retrievals (Exhibit)
@@ -324,6 +337,11 @@ let events_session_data_struct: key_val = {
// Event Presentation Launcher (and native Electron app)
'launcher': {
ws_connect_status: null,
av_recording_status: null,
controller_cmd: null,
controller_trigger_send: null,
event_file_open: {}, // This is from the older Launcher.
native: {
},
},

View File

@@ -262,11 +262,15 @@ export interface File {
event_location_code?: null|string;
event_location_name?: null|string;
event_session_code?: null|string;
event_session_type_code?: null|string;
event_session_name?: string;
event_session_start_datetime?: null|Date;
event_session_end_datetime?: null|Date;
event_presentation_code?: null|string;
event_presentation_type_code?: null|string;
event_presentation_name?: string;
event_presentation_start_datetime?: null|Date;
event_presentation_end_datetime?: null|Date;
event_presenter_given_name?: null|string;
event_presenter_family_name?: null|string;
event_presenter_full_name?: null|string;

View File

@@ -1,18 +1,18 @@
<script lang="ts">
import { createEventDispatcher, onMount } from 'svelte';
export let ws_connect: boolean = false;
export let ws_connect_status: null|string = null;
export let ws_server = 'dev-api.oneskyit.com';
export let base_url = `wss://${ws_server}/ws`;
export let group_id = 'default';
export let group_id = 'ae-grp-99';
export let client_id = Date.now();
export let cmd: null|string = null;
export let msg: null|string = null;
export let type: null|string = null;
export let type: null|string = null; // msg, cmd, json, hello, bye
export let trigger_send: any = null;
export let ws_conn_status = null;
// *** Set initial variables
const dispatch = createEventDispatcher();
@@ -32,7 +32,7 @@ let ws_data = {
}
let ws_received_list_cmd: string[] = [];
let ws_received_list_other: string[] = [];
let ws_received_list_other: any[] = [];
let ws_received_list_msg: string[] = [];
@@ -48,7 +48,7 @@ function ws_connect_group_id({group_id, client_id}) {
ws_connection.onopen = function() {
console.log('WS: connected');
ws_conn_status = 'connected';
ws_connect_status = 'connected';
dispatch('ws_conn', {
'status': 'connected'
@@ -67,7 +67,7 @@ function ws_connect_group_id({group_id, client_id}) {
target: 'all',
type: 'hello',
group_id: group_id,
msg: `Client ${client_id} connected!`
msg: `Client ${client_id.toString().slice(-5)} connected!`
}));
};
@@ -80,12 +80,14 @@ function ws_connect_group_id({group_id, client_id}) {
if (ws_recv_data.type == 'cmd') {
console.log(`WS: Type CMD: ${ws_recv_data.cmd}`);
ws_received_list_cmd.push(ws_recv_data);
ws_received_list_cmd = ws_received_list_cmd; // trigger Svelte update
ws_received_list_cmd.unshift(ws_recv_data); // Add to the beginning of the list
// ws_received_list_cmd.push(ws_recv_data); // Add to the end of the list
ws_received_list_cmd = ws_received_list_cmd; // trigger Svelte update -2024-10-04
} else {
console.log('WS: Type other');
ws_received_list_other.push(ws_recv_data);
ws_received_list_other = ws_received_list_other; // trigger Svelte update
ws_received_list_other.unshift(ws_recv_data); // Add to the beginning of the list
// ws_received_list_other.push(ws_recv_data); // Add to the end of the list
ws_received_list_other = ws_received_list_other; // trigger Svelte update -2024-10-04
}
dispatch('ws_recv', {
@@ -113,17 +115,30 @@ function ws_connect_group_id({group_id, client_id}) {
msg: `Client ${client_id} is disconnecting!`
}));
ws_conn_status = 'disconnected';
ws_connect_status = 'disconnected';
let fake_ws_recv_data = {
'client_id': client_id,
'target': 'local',
'type': 'bye',
'group_id': group_id,
'msg': `LOCAL Client ${client_id} has disconnected!`
};
ws_received_list_other.unshift(fake_ws_recv_data);
ws_received_list_other = ws_received_list_other; // trigger Svelte update -2024-10-04
dispatch('ws_conn', {
'status': 'disconnected'
});
setTimeout(function() {
console.log('WS: Disconnected... Try again!');
ws_connect_group_id({group_id: group_id, client_id: client_id});
console.log('WS: Again done?');
}, 1000);
if (ws_connect) {
setTimeout(function() {
console.log('WS: Disconnected... Try again!');
ws_connect_group_id({group_id: group_id, client_id: client_id});
console.log('WS: Again done?');
}, 1000);
}
};
ws_connection.onerror = function(event) {
@@ -149,21 +164,22 @@ function ws_connect_group_id({group_id, client_id}) {
}
// Start the WS function
// let ws_group = ws_connect_group_id({group_id: group_id, client_id: client_id});
let ws_group: any = null;
if (group_id) {
$: if (ws_connect && group_id) {
ws_group = ws_connect_group_id({group_id: group_id, client_id: client_id});
} else {
ws_group?.close();
}
$: if (trigger_send && cmd) {
console.log('WS: Send triggered!');
console.log(trigger_send);
console.log(cmd);
trigger_send = null;
console.log('WS: Send triggered!');
console.log(cmd);
ws_data.target = 'group';
ws_data.type = 'cmd';
ws_data.cmd = cmd;
handle_send_ws_data();
cmd = '';
}
function handle_send_ws_data() {
@@ -171,6 +187,10 @@ function handle_send_ws_data() {
if (!ws_data) {
return false;
}
if (!ws_group) {
console.log('WS: No connection!');
return false;
}
let ws_data_json_str = JSON.stringify(ws_data);
let resp = ws_group.send(ws_data_json_str);
console.log(resp);
@@ -188,17 +208,17 @@ function handle_send_ws_data() {
'cmd': ws_data.cmd, // Command string
});
// cmd = '';
cmd = '';
msg = '';
}
</script>
<section class="ae_element__websocket container p-1 bg-pink-100 text-xs">
<section class="ae_element__websocket container p-1 bg-pink-100 text-xs mx-auto pb-16 mb-10">
<header>
<h1>Websockets</h1>
<h1 class="font-bold text-center">Websocket Messages &amp; Commands</h1>
</header>
<!-- <form on:submit|preventDefault={handle_send_message}>
@@ -223,7 +243,7 @@ function handle_send_ws_data() {
<button>Send</button>
</form> -->
{#if 1==2}
{#if 1==1}
<form on:submit|preventDefault={handle_send_ws_data}>
<!-- <select bind:value={type}>
<option value="">None</option>
@@ -243,10 +263,13 @@ function handle_send_ws_data() {
<!-- <input type="text" bind:value={dm_client_id} placeholder="Direct message client ID"/> -->
<input type="text" bind:value={ws_data.cmd} placeholder="Your command"/>
<input type="text" bind:value={ws_data.msg} placeholder="Your message"/>
<input type="text" bind:value={ws_data.cmd} placeholder="Your command" class="input text-sm w-36" />
<input type="text" bind:value={ws_data.msg} placeholder="Your message" class="input text-xs w-96" />
<button>Send Example Group</button>
<button
type="submit"
class="btn btn-sm variant-soft-warning"
>Send Example Group</button>
</form>
{/if}
@@ -258,38 +281,62 @@ ae_open:event_file=Kljq0uiTlXt (video)
<!-- <hr> -->
<h2>Messages</h2>
<h2 class="text-center underline">Messages [grp, client, target, type]</h2>
<ul class='messages'>
{#each ws_received_list_other as msg_entry}
<li>
[{(msg_entry.group_id||'No Group ID')}]
{(msg_entry.client_id||'No Client ID')}
&mdash;
{(msg_entry.target||'No Target')}
&mdash;
{(msg_entry.type||'No Type')}: {msg_entry.msg}
<!-- <br>{JSON.stringify(msg_entry)} -->
<ol class="list-decimal list-outside max-h-24 overflow-y-auto messages">
{#each ws_received_list_other as msg_entry, index}
<li
class="ml-4"
>
<div
class="flex flex-row justify-between gap-1 w-full"
>
<span>
[{(msg_entry.group_id||'No Group ID')}]
{(msg_entry.client_id.toString().slice(-5)||'No Client ID')}
&ndash;
{(msg_entry.target||'No Target')}
|
<!-- &ndash; -->
{(msg_entry.type||'No Type')}:
</span>
<span class="justify-self-end">
"{msg_entry.msg}"
</span>
<!-- <br>{JSON.stringify(msg_entry)} -->
</div>
</li>
{/each}
</ul>
</ol>
<hr>
<h2>Commands</h2>
<h2 class="text-center underline">Commands</h2>
<ul class='commands'>
<ol class="list-decimal list-outside max-h-24 overflow-y-auto commands">
{#each ws_received_list_cmd as cmd_entry}
<li>
[{(cmd_entry.group_id||'No Group ID')}]
{(cmd_entry.client_id||'No Client ID')}
&mdash;
{(cmd_entry.target||'No Target')}
&mdash;
{(cmd_entry.type||'No Type')}: {cmd_entry.cmd}
<li
class="ml-4"
>
<div
class="flex flex-row justify-between gap-1 w-full"
>
<span>
[{(cmd_entry.group_id||'No Group ID')}]
{(cmd_entry.client_id.toString().slice(-5)||'No Client ID')}
&mdash;
{(cmd_entry.target||'No Target')}
|
<!-- &mdash; -->
{(cmd_entry.type||'No Type')}:
</span>
<span class="justify-self-end">
"{cmd_entry.cmd}"
</span>
</div>
</li>
{/each}
</ul>
</ol>
</section>

View File

@@ -3,25 +3,19 @@
export let data: any;
let log_lvl = 0;
import { onMount } from 'svelte';
import { onMount, tick } from 'svelte';
import { sineIn } from 'svelte/easing';
import { liveQuery } from "dexie";
import { Drawer, Footer } from 'flowbite-svelte';
import { Drawer, Footer, Modal } from 'flowbite-svelte';
import { ae_util } from '$lib/ae_utils/ae_utils';
import { db_events } from '$lib/db_events';
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger, time } from '$lib/ae_stores';
import { events_loc, events_sess, events_slct, events_trigger, events_trig } from '$lib/ae_events_stores';
import Launcher_cfg from './launcher_cfg.svelte';
import Launcher_menu from './launcher_menu.svelte';
import Launcher_session_view from './launcher_session_view.svelte';
import Element_websocket_v2 from '$lib/element_websocket_v2.svelte';
import Event_launcher_menu from './launcher_menu.svelte';
import Event_launcher_session_view from './launcher_session_view.svelte';
// import { AppShell, AppBar, initializeStores } from '@skeletonlabs/skeleton';
// import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/ae_stores';
// import { events_loc, events_slct } from '$lib/ae_events_stores';
// Variables
// Quickly save the data passed from the parent(s) to the Svelte stores, localStorage, and other.
@@ -30,6 +24,21 @@ $slct.account_id = data.account_id;
let ae_acct = data[$slct.account_id];
// console.log(`ae_acct = `, ae_acct);
// This is a just in case check...
if (!$events_loc?.launcher) {
$events_loc.launcher = {
app_mode: 'default',
controller: 'local',
controller_group_code: 'launcher-00',
ws_connect: false,
hide_drawer__cfg: true,
hide_drawer__debug: true,
}
}
console.log(`event_id: ${data.params.event_id}`);
$events_slct.event_id = data.params.event_id;
@@ -99,6 +108,14 @@ $: lq__event_session_obj_li = liveQuery(async () => {
return results;
});
// $: if (!$events_sess.launcher.modal__open) {
// if ($events_loc.launcher.controller == 'local_push' && $events_sess.launcher.ws_connect_status == 'connected') {
// console.log(`Local Push Controller Command: ae_close:event_file_modal`);
// $events_sess.launcher.controller_cmd = `ae_close:event_file_modal`;
// $events_sess.launcher.controller_trigger_send = true;
// }
// }
onMount(() => {
console.log('Events - Launcher: +layout.svelte');
// Hide the AppShell shell header (id="shell-header") and footer
@@ -106,6 +123,199 @@ onMount(() => {
document.getElementById('shell-footer').classList.add('hidden');
});
console.log(`BROWSER Events - [event_id] launcher +layout.svelte start`);
/* *** BEGIN *** Handle WebSocket events */
function handle_ws_conn(event) {
console.log('*** handle_ws_conn() ***');
console.log(event);
if (event.detail.status == 'connected') {
$events_sess.launcher.ws = {}; // Reset WS related values on a new connection.
$events_sess.launcher.ws.status = 'connected';
} else {
$events_sess.launcher.ws = {}; // Reset WS related values when disconnected connection.
$events_sess.launcher.ws.status = 'disconnected';
}
$events_sess.launcher = $events_sess.launcher;
}
// When this is called something seems to go wrong. It creates a loop when connected.
function handle_ws_recv(event) {
console.log('*** handle_ws_recv() ***');
console.log(event);
if (event.detail.type == 'cmd' && event.detail.cmd) {
let cmd = event.detail.cmd;
console.log(cmd);
if (cmd.startsWith('ae_load:')) {
console.log();
let cmd_parts = cmd.split(':');
let obj_parts = cmd_parts[1].split('=');
let obj_type = obj_parts[0];
let obj_id = obj_parts[1];
if (obj_type == 'event_session') {
$slct.event_session_id = obj_id;
$slct_trigger = 'event_session';
$events_sess.launcher.show_launcher_message = false;
}
} else if (cmd.startsWith('ae_open:')) {
console.log();
let cmd_parts = cmd.split(':');
let obj_parts = cmd_parts[1].split('=');
let obj_type = obj_parts[0];
let obj_id = obj_parts[1];
// NOTE: This is not finished yet.
if (obj_type == 'event_file') {
$slct.event_file_id = obj_id;
$slct_trigger = 'event_file';
$events_sess.launcher.event_file_open.open_status = 'open';
// $events_sess.launcher.show_launcher_message = false;
// NOTE: This is not finished yet.
// This should now trigger the Svelte component for the event launcher file container. Currently this does nothing. Need to bind to something or use the "events_sess.launcher" object?
// let as_modal_result = open_event_file_as_modal({event_file_id: event_file_obj.event_file_id_random, method: 'modal', filename: event_file_obj.filename, extension: event_file_obj.extension, modal_title: poster_title});
// if (as_modal_result) {
// console.log($events_sess.launcher);
// console.log(event_file_obj);
// events_sess.launcher.set({...$events_sess.launcher, ...as_modal_result});
// }
}
// NOTE: This is not finished yet.
} else if (cmd.startsWith('ae_close:')) {
console.log();
let cmd_parts = cmd.split(':');
let what = cmd_parts[1];
// let obj_type = obj_parts[0];
// let obj_id = obj_parts[1];
if (what == 'event_file_modal') {
$slct.event_file_id = null;
$slct_trigger = 'event_file';
$events_sess.launcher.event_file_open.open_status = 'close';
}
} else if (cmd.startsWith('ae_refresh:')) {
console.log();
let cmd_parts = cmd.split(':');
let what = cmd_parts[1];
// let obj_type = obj_parts[0];
// let obj_id = obj_parts[1];
if (what == 'now') {
// window.localStorage.clear();
location.reload();
} else {
console.log('OOPS? What went wrong?');
}
}
} else {
console.log('Unrecognized command');
}
}
function handle_ws_sent(event) {
console.log('*** handle_ws_sent() ***');
console.log(event);
let command = event.detail.cmd;
console.log(command);
$events_sess.launcher.controller_cmd = null;
$events_sess.launcher.controller_trigger_send = null;
}
/* *** END *** Handle WebSocket events */
$: if ($slct_trigger == 'event_file' && $slct.event_file_id && $events_sess.launcher?.event_file_open.open_status == 'open') {
$slct_trigger = null;
// handle_event_file_open();
}
$: if ($slct_trigger == 'event_file' && $events_sess.launcher?.event_file_open.open_status == 'close') {
$slct_trigger = null;
// Assuming just event file modal for now
// handle_event_file_close();
}
async function handle_event_file_open () {
let event_file_obj;
if ($slct.event_file_obj && $slct.event_file_obj.event_file_id_random) {
console.log($slct.event_file_obj);
event_file_obj = $slct.event_file_obj;
} else {
console.log('Need to look up the event file details first.');
// let get_event_file_obj_result = await get_event_file_obj({event_file_id: $slct.event_file_id});
// event_file_obj = get_event_file_obj_result;
// console.log(event_file_obj);
}
// let as_modal_result = open_event_file_as_modal({
// event_file_id: event_file_obj.event_file_id_random,
// filename: event_file_obj.filename,
// extension: event_file_obj.extension,
// modal_title: ae_util.shorten_filename(event_file_obj.filename, 75)
// });
// if (as_modal_result) {
// console.log($events_sess.launcher);
// events_sess.launcher.set({...$events_sess.launcher, ...as_modal_result});
// // $events_sess.launcher.event_file_open = as_modal_result;
// }
}
async function handle_event_file_close () {
let as_modal_result = close_event_file_as_modal({
});
if (as_modal_result) {
events_sess.launcher.set({...$events_sess.launcher, ...as_modal_result});
}
}
// Updated 2023-3-31
// export let open_event_file_as_modal = function open_event_file_as_modal({event_file_id, filename=null, extension=null, modal_title='Poster'}) {
// console.log('*** open_event_file_as_modal() ***');
// // NOTE: I can not set the ae_event_launcher values directly. Passing them back to the component and setting them there. Not ideal. This might be improved/fixed in the future?
// let launcher_modal_values = {'show_modal_file': true, 'event_file_open': {}};
// // launcher_modal_values.show_modal_file = true;
// if (extension == 'png' || extension == 'jpg') {
// launcher_modal_values.event_file_open.file_type = 'image';
// } else if (extension == 'mp4' || extension == 'mov') {
// launcher_modal_values.event_file_open.file_type = 'video';
// } else {
// return false;
// }
// launcher_modal_values.event_file_open.file_src = `/event/file/${event_file_id}/download`;
// launcher_modal_values.event_file_open.modal_title = modal_title;
// // NOTE: Be sure to set these values in the actual ae_event_launcher object!
// return launcher_modal_values;
// }
// Updated 2023-3-31
export let close_event_file_as_modal = function close_event_file_as_modal({}) {
console.log('*** close_event_file_as_modal() ***');
// NOTE: I can not set the ae_event_launcher values directly. Passing them back to the component and setting them there. Not ideal. This might be improved/fixed in the future?
let launcher_modal_values = {'show_modal_file': false, 'event_file_open': {}};
// NOTE: Be sure to set these values in the actual ae_event_launcher object!
return launcher_modal_values;
}
</script>
@@ -167,6 +377,7 @@ console.log(`BROWSER Events - [event_id] launcher +layout.svelte start`);
max-w-xs
border-r border-gray-200
"
class:hidden={$events_loc.launcher.hide__launcher_menu}
>
<!-- {#await $events_slct.id_li__event_location}
@@ -174,7 +385,7 @@ console.log(`BROWSER Events - [event_id] launcher +layout.svelte start`);
{:then event_location_obj_li} -->
<!-- {#if $lq__event_obj && $lq__event_location_obj_li && $lq__event_session_obj_li && event_location_obj_li && event_location_obj_li.length > 0} -->
<!-- {#if $lq__event_obj && $lq__event_location_obj_li} -->
<Event_launcher_menu
<Launcher_menu
bind:data_url={data.url}
lq__event_obj={lq__event_obj}
@@ -187,7 +398,7 @@ console.log(`BROWSER Events - [event_id] launcher +layout.svelte start`);
lq__event_session_obj={lq__event_session_obj}
lq__event_session_obj_li={lq__event_session_obj_li}
>
</Event_launcher_menu>
</Launcher_menu>
<!-- {:else}
<div class="flex flex-row items-center justify-center">
<span class="fas fa-spinner fa-spin mx-1"></span>
@@ -197,16 +408,6 @@ console.log(`BROWSER Events - [event_id] launcher +layout.svelte start`);
<!-- {/await} -->
<!-- Root: slct Location ID: {$events_slct.event_location_id ?? '-- not set --'} -->
<div class="absolute top-0 left-0 z-20 text-center">
<button
type="button"
on:click={() => ($events_loc.launcher.hide_drawer__cfg = false)}
class="btn btn-sm p-0.5 variant-soft-error hover:variant-filled-error"
>
<span class="fas fa-biohazard"></span>
</button>
</div>
</section>
<section
@@ -220,7 +421,7 @@ console.log(`BROWSER Events - [event_id] launcher +layout.svelte start`);
>
<!-- {#if $events_trigger == 'load__event_session_obj' && $events_slct.event_session_id}
<Event_launcher_session_view
<Launcher_session_view
slct_event_session_id={$events_slct.event_session_id}
lq__event_location_obj={lq__event_location_obj}
@@ -228,7 +429,7 @@ console.log(`BROWSER Events - [event_id] launcher +layout.svelte start`);
lq__event_session_obj={lq__event_session_obj}
lq__event_session_obj_li={lq__event_session_obj_li}
>
</Event_launcher_session_view>
</Launcher_session_view>
{/if} -->
<!-- {$lq__event_session_obj?.name} -->
@@ -241,14 +442,14 @@ console.log(`BROWSER Events - [event_id] launcher +layout.svelte start`);
{/if}
{#if $events_slct.event_session_id && $lq__event_session_obj}
<Event_launcher_session_view
<Launcher_session_view
slct_event_session_id={$events_slct.event_session_id}
lq__event_location_obj={lq__event_location_obj}
lq__event_session_obj={lq__event_session_obj}
>
</Event_launcher_session_view>
</Launcher_session_view>
{/if}
</section>
@@ -287,7 +488,7 @@ console.log(`BROWSER Events - [event_id] launcher +layout.svelte start`);
</div>
<div>
{#if $events_loc.launcher?.av_recording}
{#if $events_sess.launcher?.av_recording_status}
<span class="fas fa-video"></span> AV Recording Active
{:else}
<span class="fas fa-video-slash"></span> AV Recording Inactive
@@ -305,6 +506,18 @@ console.log(`BROWSER Events - [event_id] launcher +layout.svelte start`);
</Footer>
<div class="absolute top-0 left-0 z-20 text-center">
<button
type="button"
on:click={() => ($events_loc.launcher.hide_drawer__cfg = false)}
class="btn btn-sm p-0.5 variant-soft-error hover:variant-filled-error"
>
<span class="fas fa-biohazard"></span>
</button>
</div>
<Drawer
bgColor="bg-blue"
class="bg-orange-100 opacity-90 hover:opacity-95 transition-all duration-1000"
@@ -322,123 +535,12 @@ console.log(`BROWSER Events - [event_id] launcher +layout.svelte start`);
id="sidebar1"
>
<div class="flex flex-row items-center justify-between">
<h2
class="text-center mb-4 text-base font-semibold text-gray-500 dark:text-gray-400"
>
Launcher Configuration
</h2>
<button
on:click={() => ($events_loc.launcher.hide_drawer__cfg = true)}
class="pb-4 pl-4 dark:text-white"
>
<span class="fas fa-times"></span>
</button>
</div>
<hr>
<section class="controller">
<h3>
<button
on:click={() => {
$events_loc.launcher.show_section__controller = !$events_loc.launcher.show_section__controller;
}}
class="ae_btn btn_sm btn_seamless"
>
Controller:
{#if $events_loc.launcher.show_section__controller}
<span class="fas fa-chevron-down"></span>
{:else}
<span class="fas fa-chevron-right"></span>
{/if}
</button>
</h3>
<div
class:hidden={!$events_loc.launcher.show_section__controller}
>
<select
bind:value={$events_loc.launcher.controller}
class="select"
>
<option value="local">Locally Controlled</option>
<option value="remote">Remotely Controlled</option>
<option value="local_push">Controller</option>
</select>
<input
bind:value={$events_loc.launcher.controller_group_code}
placeholder="Controller group code"
class="input"
>
</div>
{#if $events_loc.launcher.controller_group_code}
<!-- {$ae_api.base_url} -->
<Element_websocket_v2
ws_server={$ae_api.fqdn}
group_id={$events_loc.launcher.controller_group_code}
cmd={$events_loc.launcher.controller_cmd}
type={'cmd'}
trigger_send={$events_loc.launcher.controller_trigger_send}
/>
<!-- on:ws_conn={handle_ws_conn} -->
<!-- on:ws_recv={handle_ws_recv} -->
<!-- on:ws_sent={handle_ws_sent} -->
{/if}
</section>
<hr>
<!-- <h3
class="text-center mb-4 text-sm font-semibold"
>
Controller
</h3> -->
<h3
class="text-center mb-4 text-sm font-semibold"
>
Screen Saver
</h3>
<h3
class="text-center mb-4 text-sm font-semibold"
>
App Modes
</h3>
<h3
class="text-center mb-4 text-sm font-semibold"
>
Local Config Refresh
</h3>
<Launcher_cfg></Launcher_cfg>
<hr />
<div class="text-center">
<button
type="button"
on:click={() => ($events_loc.launcher.hide_drawer__debug = false)}
class="btn btn-sm p-1 variant-soft-error hover:variant-filled-error"
>
<span class="fas fa-bug"></span>
<!-- Debug -->
</button>
</div>
<hr />
<div class="grid grid-cols-2 gap-4">
<div class="grid grid-cols-2 gap-2">
<a href="/events/{$events_slct.event_id}" class="btn btn-sm variant-soft-primary hover:variant-filled-primary">
<span class="fas fa-arrow-left m-1"></span>
Session Search
@@ -508,4 +610,99 @@ console.log(`BROWSER Events - [event_id] launcher +layout.svelte start`);
</pre>
</div>
</Drawer>
</Drawer>
<!-- Main modal -->
<Modal
title="{$events_sess.launcher?.modal__title}"
bind:open={$events_sess.launcher.modal__open}
autoclose={true}
size="xl"
class="bg-white dark:bg-gray-800 text-gray-800 dark:text-gray-200 rounded-lg border-gray-200 dark:border-gray-700 divide-gray-200 dark:divide-gray-700 shadow-md relative flex flex-col mx-auto w-full divide-y"
classHeader="px-1 py-0 md:px-1 md:py-0"
classBody="flex flex-col items-center p-0 md:px-0 py-0"
on:close={async () => {
if ($events_loc.launcher.controller == 'local_push' && $events_sess.launcher.ws_connect_status == 'connected') {
// This should work....????
console.log(`TEST - FAIL??? Local Push Controller Command: ae_close:event_file_modal`);
console.log(`Before: ${$events_sess.launcher.controller_trigger_send}`);
$events_sess.launcher.controller_cmd = `ae_close:event_file_modal`;
$events_sess.launcher.controller_trigger_send = true;
$events_sess = $events_sess;
events_sess.set($events_sess);
tick();
events_sess.set($events_sess);
console.log(`After: ${$events_sess.launcher.controller_trigger_send}`);
}
}}
>
<!-- <svelte:fragment slot="header">
<div class="flex flex-row items-center justify-between">
<h3 class="text-lg font-semibold">
{$events_sess.launcher?.modal__title}
</h3>
</div>
</svelte:fragment> -->
<button
on:click={() => {
console.log(`TEST - THIS WORKS... Local Push Controller Command: ae_close:event_file_modal`);
// This is not terrible if we set autoclose to true.
$events_sess.launcher.controller_cmd = `ae_close:event_file_modal`;
$events_sess.launcher.controller_trigger_send = true;
// $events_sess.launcher.modal__open = false;
}}
class="absolute top-0 right-12 p-1"
>
<span class="fas fa-times"></span>
Close Remote
</button>
<!-- <span class="aspect-[9/16] max-h-96"> -->
<img
src="{$ae_api.base_url}/event/file/{$events_sess.launcher.modal__open}/download?filename={$events_slct.event_file_obj.filename}&x_no_account_id_token=direct-download"
alt="Placeholder"
class="margin-auto max-h-full"
/>
<!-- </span> -->
<!-- <svelte:fragment slot="footer">
<div class="text-center w-full">
<button
on:click={() => {
$events_sess.pres_mgmt.show_modal__session_poc_agree = false;
}}
class="btn btn-sm variant-soft-warning hover:variant-ghost-warning"
>
<span class="fas fa-times m-1"></span>
Close
</button>
</div>
</svelte:fragment> -->
</Modal>
{#if $events_loc.launcher.controller_group_code && $events_loc.launcher.ws_connect}
<!-- {$ae_api.base_url} -->
<Element_websocket_v2
bind:ws_connect={$events_loc.launcher.ws_connect}
bind:ws_connect_status={$events_sess.launcher.ws_connect_status}
ws_server={$ae_api.fqdn}
bind:group_id={$events_loc.launcher.controller_group_code}
bind:client_id={$events_loc.launcher.controller_client_id}
bind:cmd={$events_sess.launcher.controller_cmd}
type={'cmd'}
bind:trigger_send={$events_sess.launcher.controller_trigger_send}
on:ws_conn={handle_ws_conn}
on:ws_recv={handle_ws_recv}
on:ws_sent={handle_ws_sent}
/>
<!-- on:ws_recv={handle_ws_recv} -->
{/if}

View File

@@ -0,0 +1,220 @@
<script lang="ts">
export let log_lvl = 0;
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger, time } from '$lib/ae_stores';
import { events_loc, events_sess, events_slct, events_trigger, events_trig } from '$lib/ae_events_stores';
// import Element_websocket_v2 from '$lib/element_websocket_v2.svelte';
</script>
<div class="flex flex-row items-center justify-between">
<h2
class="text-center mb-4 text-base font-semibold text-gray-500 dark:text-gray-400"
>
Launcher Configuration
</h2>
<button
on:click={() => ($events_loc.launcher.hide_drawer__cfg = true)}
class="pb-4 pl-4 dark:text-white"
>
<span class="fas fa-times"></span>
</button>
</div>
<hr>
<section class="controller">
<h3
class="text-center mb-4 text-sm font-semibold"
>
<button
on:click={() => {
$events_loc.launcher.show_section__controller = !$events_loc.launcher.show_section__controller;
}}
class="ae_btn btn_sm btn_seamless"
>
Controller:
{$events_loc.launcher?.controller ?? '-- not set --'}
({$events_loc.launcher.controller_group_code ?? '-- not set --'})
{#if $events_sess.launcher.ws_connect_status == 'connected'}
<span class="fas fa-sitemap m-1"></span>
<!-- <span class="fas fa-signal m-1"></span> -->
{:else}
<span class="fas fa-times m-1"></span>
{/if}
{#if $events_loc.launcher.show_section__controller}
<span class="fas fa-chevron-down"></span>
{:else}
<span class="fas fa-chevron-right"></span>
{/if}
</button>
</h3>
<div
class:hidden={!$events_loc.launcher.show_section__controller}
>
<select
bind:value={$events_loc.launcher.controller}
class="select"
>
<option value="local">Local Only</option>
<option value="remote">Remotely Controlled</option>
<option value="local_push">Local and Controller</option>
</select>
<div class="flex flex-row">
<input
bind:value={$events_loc.launcher.controller_group_code}
placeholder="Controller group code"
class="input"
on:dblclick={() => {
$events_sess.launcher.controller_unlock_group_code = !$events_sess.launcher.controller_unlock_group_code;
$events_loc.launcher.ws_connect = false;
}}
readonly={!$events_sess.launcher.controller_unlock_group_code}
>
<button
on:click={() => {
$events_loc.launcher.ws_connect = !$events_loc.launcher.ws_connect;
$events_sess.launcher.controller_unlock_group_code = false;
$events_sess.launcher.controller_cmd = null,
$events_sess.launcher.controller_trigger_send = null;
}}
class="btn btn-sm hover:variant-filled-primary"
class:variant-ghost-warning={!$events_loc.launcher.ws_connect}
class:variant-ghost-success={$events_loc.launcher.ws_connect}
>
{#if $events_loc.launcher.ws_connect}
<!-- <span class="fas fa-signal m-1"></span> -->
Disconnect?
{:else}
<!-- <span class="fas fa-plug m-1"></span> -->
Connect?
{/if}
</button>
</div>
</div>
</section>
<hr>
<h3
class="text-center mb-4 text-sm font-semibold"
>
Screen Saver
</h3>
<hr>
<!-- App Modes: default (browser), onsite (browser onsite), native (Electron app onsite) -->
<!-- Related Open Methods: modal, file default/onsite/native, URL -->
<!--
* modal: same for all modes; audio, images, video only
* file:
* default download with regular filename and extension
* onsite download with modified extension
* native Electron caching and open method (download to cache, copy and then open)
* URL: new browser window
-->
<section class="app_modes">
<h3
class="text-center mb-4 text-sm font-semibold"
>
<button
on:click={() => {
$events_loc.launcher.show_section__app_modes = !$events_loc.launcher.show_section__app_modes;
}}
class="ae_btn btn_sm btn_seamless"
>
App Modes:
{$events_loc.launcher.app_mode ?? '-- not set --'}
{#if $events_loc.launcher.show_section__app_modes}
<span class="fas fa-chevron-down"></span>
{:else}
<span class="fas fa-chevron-right"></span>
{/if}
</button>
</h3>
<div
class="grid grid-cols-2 gap-2"
class:hidden={!$events_loc.launcher.show_section__app_modes}
>
{#if !$events_loc.launcher.app_mode || $events_loc.launcher.app_mode != 'default'}
<button
class="btn btn-sm variant-soft-primary hover:variant-filled-primary"
on:click={() => {
$events_loc.launcher.app_mode='default';
// ae_event_launcher.set($events_loc.launcher);
console.log($events_loc.launcher);
}}
title="Switch to default mode"
>
Change to Default Mode
</button>
{/if}
{#if $events_loc.launcher.app_mode != 'native'}
<button
class="btn btn-sm variant-soft-primary hover:variant-filled-primary"
on:click={() => {
$events_loc.launcher.app_mode='native';
// ae_event_launcher.set($ae_event_launcher);
console.log($events_loc.launcher);
}}
title="Switch to native mode"
>
Change to App Mode
</button>
{/if}
{#if $events_loc.launcher.app_mode != 'onsite'}
<button
class="btn btn-sm variant-soft-primary hover:variant-filled-primary"
on:click={() => {
$events_loc.launcher.app_mode='onsite';
// ae_event_launcher.set($ae_event_launcher);
console.log($events_loc.launcher);
}}
title="Switch to onsite mode"
>
Change to Onsite Mode
</button>
{/if}
</div>
</section>
<h3
class="text-center mb-4 text-sm font-semibold"
>
Local Config Refresh
</h3>
<hr />
<div class="text-center">
<button
type="button"
on:click={() => ($events_loc.launcher.hide_drawer__debug = false)}
class="btn btn-sm p-1 variant-soft-error hover:variant-filled-error"
>
<span class="fas fa-bug"></span>
<!-- Debug -->
</button>
</div>

View File

@@ -3,26 +3,25 @@
import { onMount, tick } from 'svelte';
import { fade, scale, fly } from 'svelte/transition';
type key_val = {
[key: string]: any;
};
import type { key_val } from '$lib/ae_stores';
import { ae_util } from '$lib/ae_utils/ae_utils';
import { events_loc, events_sess, events_slct, events_trigger } from '$lib/ae_events_stores';
// *** Import Aether core variables and functions
// import { ae } from 'aether_npm_lib';
// import { } from '../../mods/electron.js';
// import { ae_event_launcher, event_file_obj_def, open_event_file_as_modal, ae_screen_saver_img_list } from '../../stores_mod_events';
// import { ae_event_launcher, event_file_obj_def, open_event_file_as_modal, screen_saver_img_list } from '../../stores_mod_events';
// *** Import Aether core components
// *** Import Aether module variables and functions
// import { ae_event_launcher } from '../stores_event.js';
// import { download_event_file } from '../stores_event_api.js';
// *** Import Aether module components
// *** Export/Exposed variables and functions for component
export let event_file_obj = $event_file_obj_def;
export let event_file_obj: any;
// export let use_os: boolean = false;
// export let os: string = null;
export let max_filename_length: number = 50;
@@ -36,43 +35,49 @@ export let show_bak_download: boolean = false;
export let btn_size: string = 'btn_md';
export let open_file_as: string = '';
export let poster_title: string = '';
export let session_type: string = 'oral'; // oral, poster, workshop, symposium, roundtable, other
export let open_method: null|string = 'download'; // modal, download, native open (download, cache, copy, open), URL
export let modal_title: string = '';
// *** Set initial variables
let ae_promises: key_val = {};
let ae_downloads: key_val = {};
let open_file_clicked = null;
let open_file_status = null; // null, 'checking_cache', 'checking_cache_failed', 'downloading_file', 'downloading_file_failed', 'opening_file', 'opening_file_failed', 'opening_file_success'
let open_file_status_message = null;
let open_file_clicked: null|boolean = null;
let open_file_status: null|string = null; // null, 'checking_cache', 'checking_cache_failed', 'downloading_file', 'downloading_file_failed', 'opening_file', 'opening_file_failed', 'opening_file_success'
let open_file_status_message: null|string = null;
if (!$events_loc.launcher.screen_saver_img_list) {
$events_loc.launcher.screen_saver_img_list = {};
}
let screen_saver_exts = ['jpg', 'png', 'PNG', 'webp'];
if (screen_saver_exts.includes(event_file_obj.extension)) {
// $ae_event_launcher.screen_saver_img_list.push(event_file_obj);
// $ae_event_launcher.screen_saver_img_list[event_file_obj.event_file_id_random] = event_file_obj;
// $events_loc.launcher.screen_saver_img_list.push(event_file_obj);
// $events_loc.launcher.screen_saver_img_list[event_file_obj.event_file_id_random] = event_file_obj;
$ae_screen_saver_img_list[event_file_obj.event_file_id_random] = Object.create(event_file_obj);
$events_loc.launcher.screen_saver_img_list[event_file_obj.event_file_id_random] = Object.create(event_file_obj);
// let temp_obj = Object.create(event_file_obj)
// $ae_event_launcher.screen_saver_img_list[temp_obj.event_file_id_random] = Object.create(temp_obj);
// $events_loc.launcher.screen_saver_img_list[temp_obj.event_file_id_random] = Object.create(temp_obj);
// $ae_event_launcher = $ae_event_launcher;
}
onMount(() => {
console.log('** Component Mounted: ** Event Launcher File Container (Hash Open)');
console.log(`Session Type: ${session_type}; Open Method: ${open_method}`);
if (screen_saver_exts.includes(event_file_obj.extension)) {
// $ae_event_launcher.screen_saver_img_list[event_file_obj.event_file_id_random] = event_file_obj;
// $events_loc.launcher.screen_saver_img_list[event_file_obj.event_file_id_random] = event_file_obj;
let temp_obj = Object.create(event_file_obj)
$ae_event_launcher.screen_saver_img_list[temp_obj.event_file_id_random] = Object.create(temp_obj);
$events_loc.launcher.screen_saver_img_list[temp_obj.event_file_id_random] = Object.create(temp_obj);
$ae_event_launcher = $ae_event_launcher;
// $ae_event_launcher = $ae_event_launcher;
}
window.addEventListener('message', function(event) {
@@ -107,13 +112,13 @@ onMount(() => {
async function handle_open_file() {
console.log('*** handle_open_file() ***');
console.log(`App Mode: ${$ae_event_launcher.app_mode}; Cache Path: ${$ae_event_launcher.local_file_cache_path}; Temp Path: ${$ae_event_launcher.host_file_temp_path}`);
console.log(`App Mode: ${$events_loc.launcher.app_mode}; Cache Path: ${$events_loc.launcher.local_file_cache_path}; Temp Path: ${$events_loc.launcher.host_file_temp_path}`);
// null or "default" is for regular use in their preferred browser.
// "app" mode is for Electron and node.js.
// "onsite" mode is for Chrome or Firefox and downloading files with modified extensions and other slight changes.
if ($ae_event_launcher.app_mode == 'native' && native_app) {
if ($events_loc.launcher.app_mode == 'native' && native_app) {
console.log('* ** *** **** BEGIN TESTING **** *** ** *');
console.log('Process: Check local hash file cache, Download hash file to cache, and Open cached hash file after copying to temp directory');
@@ -123,14 +128,14 @@ async function handle_open_file() {
open_file_status = 'checking_cache';
open_file_status_message = 'Checking local cache...';
let check_hash_file_cache_result = await native_app.check_hash_file_cache_v2({local_file_cache_path: $ae_event_launcher.local_file_cache_path, hash: event_file_obj.hash_sha256, check_hash: true});
let check_hash_file_cache_result = await native_app.check_hash_file_cache_v2({local_file_cache_path: $events_loc.launcher.local_file_cache_path, hash: event_file_obj.hash_sha256, check_hash: true});
if (check_hash_file_cache_result) {
console.log('Cached hash file found.');
} else if (check_hash_file_cache_result == null) {
console.log(`Cached hash file not found. Need to download from API server. Base URL ${$ae_event_launcher.api.base_url}`);
console.log(`Cached hash file not found. Need to download from API server. Base URL ${$events_loc.launcher.api.base_url}`);
open_file_status = 'downloading_file';
open_file_status_message = 'Downloading file...';
let download_hash_file_to_cache_result = await native_app.download_hash_file_to_cache_v2({api_base_url: $ae_event_launcher.api.base_url, api_base_url_backup: $ae_event_launcher.api.base_url_backup, local_file_cache_path: $ae_event_launcher.local_file_cache_path, event_file_id: event_file_obj.event_file_id_random, hash: event_file_obj.hash_sha256, verify_hash: true, overwrite_existing: false});
let download_hash_file_to_cache_result = await native_app.download_hash_file_to_cache_v2({api_base_url: $events_loc.launcher.api.base_url, api_base_url_backup: $events_loc.launcher.api.base_url_backup, local_file_cache_path: $events_loc.launcher.local_file_cache_path, event_file_id: event_file_obj.event_file_id_random, hash: event_file_obj.hash_sha256, verify_hash: true, overwrite_existing: false});
// console.log(download_hash_file_to_cache_result);
if (download_hash_file_to_cache_result) {
console.log('Hash file downloaded to cache.');
@@ -148,7 +153,7 @@ async function handle_open_file() {
return false;
}
} else {
console.log(`Cached hash file found, but hash did not match. May still be downloading from the API server. Base URL ${$ae_event_launcher.api.base_url}`);
console.log(`Cached hash file found, but hash did not match. May still be downloading from the API server. Base URL ${$events_loc.launcher.api.base_url}`);
open_file_status = 'try_again';
open_file_status_message = 'Please try again...';
return null;
@@ -172,7 +177,7 @@ async function handle_open_file() {
}
console.log(`Opening ${filename}`);
let electron_open_hash_file_to_temp_result = await native_app.open_hash_file_to_temp_v2({local_file_cache_path: $ae_event_launcher.local_file_cache_path, hash: event_file_obj.hash_sha256, host_file_temp_path: $ae_event_launcher.host_file_temp_path, filename: filename, verify_hash: true});
let electron_open_hash_file_to_temp_result = await native_app.open_hash_file_to_temp_v2({local_file_cache_path: $events_loc.launcher.local_file_cache_path, hash: event_file_obj.hash_sha256, host_file_temp_path: $events_loc.launcher.host_file_temp_path, filename: filename, verify_hash: true});
if (electron_open_hash_file_to_temp_result) {
console.log('Local hash file was opened to temp.');
open_file_status = 'opening_file_success';
@@ -189,16 +194,16 @@ async function handle_open_file() {
}
console.log('Done with test of cache check, download file, and open cached file from temp directory.');
} else if ($ae_event_launcher.app_mode == 'onsite') {
} else if ($events_loc.launcher.app_mode == 'onsite') {
open_file_clicked = true;
await tick();
setTimeout(() => {console.log('Finished waiting to hide the message.'); open_file_clicked = false;}, 15000);
} else {
// NOTE: Add first test controller command here.
// $ae_event_launcher.controller_cmd = `ae:open:event_file_id=${$slct.event_file_id}`;
// $ae_event_launcher.controller_trigger_send = true; // Trigger the controller to send.
// $ae_event_launcher.controller_cmd = null; // Reset command to null
// $events_sess.launcher.controller_cmd = `ae:open:event_file_id=${$slct.event_file_id}`;
// $events_sess.launcher.controller_trigger_send = true; // Trigger the controller to send.
// $events_sess.launcher.controller_cmd = null; // Reset command to null
open_file_clicked = true;
@@ -207,18 +212,18 @@ async function handle_open_file() {
}
}
// function handle_open_file_as_poster() {
// console.log('*** handle_open_file_as_poster() ***');
// function handle_open_method_poster() {
// console.log('*** handle_open_method_poster() ***');
// $ae_event_launcher.show_modal_event_poster = true;
// $events_loc.launcher.show_modal_event_poster = true;
// if (event_file_obj.extension == 'png' || event_file_obj.extension == 'jpg') {
// $ae_event_launcher.event_poster_file_type = 'image';
// $events_loc.launcher.event_poster_file_type = 'image';
// } else if (event_file_obj.extension == 'mp4' || event_file_obj.extension == 'mov') {
// $ae_event_launcher.event_poster_file_type = 'video';
// $events_loc.launcher.event_poster_file_type = 'video';
// }
// $ae_event_launcher.event_poster_src = `/event/file/${event_file_obj.event_file_id_random}/download`;
// $ae_event_launcher.event_poster_title = poster_title;
// $events_loc.launcher.poster_src = `/event/file/${event_file_obj.event_file_id_random}/download`;
// $events_loc.launcher.modal_title = modal_title;
// }
</script>
@@ -228,7 +233,7 @@ async function handle_open_file() {
{#if open_file_clicked}
<div class="open_file_clicked alert" in:fade="{{ duration: 250 }}" out:fade="{{ duration: 2000 }}">
{#if ($ae_event_launcher.app_mode == 'native')}
{#if ($events_loc.launcher.app_mode == 'native')}
{#if (open_file_status)}
<div class="alert_msg_pulse"><strong>*** {open_file_status_message} ***</strong></div>
{/if}
@@ -238,7 +243,7 @@ async function handle_open_file() {
<p>PowerPoint or KeyNote will attempt to display in presenter view.</p>
<p>PDFs, videos, and images will attempt to be displayed mirrored.</p>
<p>Please close the file when finished.</p>
{:else if ($ae_event_launcher.app_mode == 'onsite')}
{:else if ($events_loc.launcher.app_mode == 'onsite')}
<strong>*** Please wait while this file loads... ***</strong>
<p>Most files will automatically be opened full screen.</p>
<p>PowerPoint or KeyNote will attempt to display in presenter view.</p>
@@ -257,50 +262,66 @@ async function handle_open_file() {
</div>
{/if}
{#if (open_file_as == 'poster')}
<!-- First - Handle opening using a modal. This applies to all Launcher app modes (default, onsite, native) -->
{#if (session_type == 'poster' || open_method == 'modal')}
<!-- <a
href="/event/file/{event_file_obj.event_file_id_random}/download"
download
class="ae_btn btn_info {btn_size}"
on:click|preventDefault={() => {handle_open_file_as_poster();}}
on:click|preventDefault={() => {handle_open_method_poster();}}
data-hash_sha256={event_file_obj.hash_sha256}
data-filename={event_file_obj.filename}
title={event_file_obj.filename}
>
<span class="fas fa-paper-plane" class:d_none="{hide_launch_icon}"></span> {ae.util.shorten_filename(event_file_obj.filename, max_filename_length)}
<span class="fas fa-paper-plane" class:d_none="{hide_launch_icon}"></span> {ae_util.shorten_filename({filename: event_file_obj.filename, max_length: max_filename_length})}
</a> -->
<button
class="ae_btn btn_info {btn_size}"
class="btn btn-lg variant-ghost-primary"
on:click={() => {
let as_modal_result = open_event_file_as_modal({
event_file_id: event_file_obj.event_file_id_random,
filename: event_file_obj.filename,
extension: event_file_obj.extension,
modal_title: poster_title
});
if (as_modal_result) {
console.log($ae_event_launcher);
console.log(event_file_obj);
ae_event_launcher.set({...$ae_event_launcher, ...as_modal_result});
$events_sess.launcher.modal__open = event_file_obj.event_file_id_random;
if (!modal_title) {
modal_title = event_file_obj.filename;
}
$events_sess.launcher.modal__title = modal_title;
// $events_sess.launcher.modal__img_src = `/event/file/${event_file_obj.event_file_id_random}/download`;
if ($ae_event_launcher.controller == 'local_push') {
$ae_event_launcher.controller_cmd = `ae_open:event_file=${event_file_obj.event_file_id_random}`;
$ae_event_launcher.controller_trigger_send = true;
$events_slct.event_file_id = event_file_obj.event_file_id_random;
$events_slct.event_file_obj = event_file_obj;
// let as_modal_result = open_event_file_as_modal({
// event_file_id: event_file_obj.event_file_id_random,
// filename: event_file_obj.filename,
// extension: event_file_obj.extension,
// modal_title: modal_title
// });
// if (as_modal_result) {
// console.log($events_loc.launcher);
// console.log(event_file_obj);
// events_loc.launcher.set({...$events_loc.launcher, ...as_modal_result});
// }
if ($events_loc.launcher.controller == 'local_push') {
console.log(`Local Push Controller Command: ae_open:event_file=${event_file_obj.event_file_id_random}`);
$events_sess.launcher.controller_cmd = `ae_open:event_file=${event_file_obj.event_file_id_random}`;
$events_sess.launcher.controller_trigger_send = true;
// tick();
}
}}
title={`${event_file_obj.filename} [BTN] -- SHA256 hash: ${event_file_obj.hash_sha256.slice(0, 10)}...`}
>
{#if (screen_saver_exts.includes(event_file_obj.extension))}
<span class="fas fa-chart-bar" class:d_none="{hide_launch_icon}"></span>
Open Poster
<span class="fas fa-chart-bar m-1" class:d_none="{hide_launch_icon}"></span>
Open Poster
{:else}
<span class="fas fa-paper-plane" class:d_none="{hide_launch_icon}"></span> {ae.util.shorten_filename(event_file_obj.filename, max_filename_length)}
<span class="fas fa-paper-plane" class:d_none="{hide_launch_icon}"></span>
{ae_util.shorten_filename({filename: event_file_obj.filename, max_length: max_filename_length})}
{/if}
</button>
<!-- {#if ($ae_event_launcher.app_mode == 'native')} -->
{:else if ($ae_event_launcher.app_mode == 'native')}
<!-- {#if ($events_loc.launcher.app_mode == 'native')} -->
<!-- Second - Handle opening a file. This applies to all Launcher app modes (default, onsite, native) -->
{:else if ($events_loc.launcher.app_mode == 'native')}
<a
href="/event/file/{event_file_obj.event_file_id_random}/download?use_os=true"
download
@@ -310,9 +331,9 @@ async function handle_open_file() {
data-filename={event_file_obj.filename}
title={`${event_file_obj.filename} [A] -- SHA256 hash: ${event_file_obj.hash_sha256.slice(0, 10)}...`}
>
<span class="fas fa-paper-plane" class:d_none="{hide_launch_icon}"></span> {ae.util.shorten_filename(event_file_obj.filename, max_filename_length)}
<span class="fas fa-paper-plane" class:d_none="{hide_launch_icon}"></span> {ae_util.shorten_filename({filename: event_file_obj.filename, max_length: max_filename_length})}
</a>
{:else if ($ae_event_launcher.app_mode == 'onsite' && (event_file_obj.extension == 'ppt' || event_file_obj.extension == 'pptx') && event_file_obj.open_in_os == 'win')}
{:else if ($events_loc.launcher.app_mode == 'onsite' && (event_file_obj.extension == 'ppt' || event_file_obj.extension == 'pptx') && event_file_obj.open_in_os == 'win')}
<a
href="/event/file/{event_file_obj.event_file_id_random}/download?use_os=true" download
class="ae_btn btn_info {btn_size}"
@@ -321,7 +342,7 @@ async function handle_open_file() {
data-filename={event_file_obj.filename}
title={`${event_file_obj.filename} [A] -- SHA256 hash: ${event_file_obj.hash_sha256.slice(0, 10)}...`}
>
<span class="fas fa-paper-plane" class:d_none="{hide_launch_icon}"></span> {ae.util.shorten_filename(event_file_obj.filename, max_filename_length)}
<span class="fas fa-paper-plane" class:d_none="{hide_launch_icon}"></span> {ae_util.shorten_filename({filename: event_file_obj.filename, max_length: max_filename_length})}
</a>
{:else}
<button
@@ -350,7 +371,7 @@ async function handle_open_file() {
{/if}
</span>
{:then}
<span class="fas fa-paper-plane" class:d_none="{hide_launch_icon}"></span> {ae.util.shorten_filename(event_file_obj.filename, max_filename_length)}
<span class="fas fa-paper-plane" class:d_none="{hide_launch_icon}"></span> {ae_util.shorten_filename({filename: event_file_obj.filename, max_length: max_filename_length})}
{#if ae_promises[event_file_obj.event_file_id_random] === null}
<span class="fas fa-exclamation-triangle"></span>
Download failed!
@@ -370,7 +391,7 @@ async function handle_open_file() {
data-filename={event_file_obj.filename}
title={event_file_obj.filename}
>
<span class="fas fa-paper-plane" class:d_none="{hide_launch_icon}"></span> {ae.util.shorten_filename(event_file_obj.filename, max_filename_length)}
<span class="fas fa-paper-plane" class:d_none="{hide_launch_icon}"></span> {ae_util.shorten_filename({filename: event_file_obj.filename, max_length: max_filename_length})}
</a> -->
{/if}
@@ -379,10 +400,10 @@ async function handle_open_file() {
<span class="event_file_meta" class:d_none="{hide_meta}">
<span class="event_file_created_on" class:d_none="{hide_created_on}">
{ae.util.iso_datetime_formatter(event_file_obj.created_on, 'datetime_short')}
{ae_util.iso_datetime_formatter(event_file_obj.created_on, 'datetime_short')}
</span>
<span class="event_file_size" class:d_none="{hide_size}">
{#if event_file_obj.file_size}{ae.util.format_bytes(event_file_obj.file_size)}{/if}
{#if event_file_obj.file_size}{ae_util.format_bytes(event_file_obj.file_size)}{/if}
</span>
<span class="event_file_os" class:d_none="{hide_os}">
{#if event_file_obj.open_in_os == 'win'}
@@ -394,7 +415,7 @@ async function handle_open_file() {
{/if}
</span>
<!-- {#if ($ae_event_launcher.app_mode == 'native' || $ae_event_launcher.app_mode == 'onsite')} -->
<!-- {#if ($events_loc.launcher.app_mode == 'native' || $events_loc.launcher.app_mode == 'onsite')} -->
<!-- {#if (show_bak_download)} -->
<a href="/event/file/{event_file_obj.event_file_id_random}/download" class="event_file_download" class:d_none="{!show_bak_download}" title="Download with original filename and extension"><span class="fas fa-download"></span></a>
<!-- {/if} -->

View File

@@ -11,6 +11,8 @@ import { db_events } from "$lib/db_events";
import { events_loc, events_sess, events_slct, events_trigger } from '$lib/ae_events_stores';
import { events_func } from '$lib/ae_events_functions';
import Event_launcher_file_cont from './launcher_file_cont.svelte';
// export let slct_event_presentation_id: string;
// export let slct_event_presenter_id: string;
export let lq__event_presenter_obj: any; // This is not actually the LiveQuery object. This was pulled from the list of presenters for a presentation. With Svelte 5 this should not matter.
@@ -114,6 +116,15 @@ let lq__event_file_obj_li = liveQuery(
{event_file_obj.file_purpose}
</span>
</button>
<Event_launcher_file_cont
event_file_obj={event_file_obj}
hide_created_on={false}
show_bak_download={$ae_loc.trusted_access}
session_type={event_file_obj?.event_session_type_code ?? 'oral'}
open_method={event_file_obj?.event_session_type_code == 'poster' ? 'modal' : null}
modal_title={lq__event_presenter_obj?.event_presentation_name}
/>
</li>
{/each}
</ul>

View File

@@ -296,7 +296,7 @@ $: if ($lq__event_location_obj) {
{#if show__launcher_link}
<a
data-sveltekit-preload-data="false"
href="/events/${$lq__event_location_obj?.event_id_random}/launcher/{$lq__event_location_obj?.event_location_id_random}"
href="/events/{$lq__event_location_obj?.event_id_random}/launcher/{$lq__event_location_obj?.event_location_id_random}"
class="btn btn-sm variant-glass-secondary hover:variant-filled-secondary"
title="Launcher: {$lq__event_location_obj?.name} {$lq__event_location_obj?.event_location_id_random}"
>

View File

@@ -22,13 +22,13 @@ export default {
// flowbite-svelte
primary: { 50: '#FFF5F2', 100: '#FFF1EE', 200: '#FFE4DE', 300: '#FFD5CC', 400: '#FFBCAD', 500: '#FE795D', 600: '#EF562F', 700: '#EB4F27', 800: '#CC4522', 900: '#A5371B'},
},
listStyleType: {
// none: 'none',
// disc: 'disc',
// decimal: 'decimal',
// square: 'square',
// roman: 'upper-roman',
},
// listStyleType: {
// none: 'none',
// disc: 'disc',
// decimal: 'decimal',
// square: 'square',
// roman: 'upper-roman',
// },
},
// listStyleType: {
// none: 'none',