Work on the Launder and Websockets. It needs work.
This commit is contained in:
@@ -308,12 +308,18 @@ let ae_promises: key_val = {
|
||||
slct_event_presentation_li: null
|
||||
};
|
||||
|
||||
let trigger_handle_ws_conn = $state(false);
|
||||
let trigger_handle_ws_recv = $state(false);
|
||||
let trigger_handle_ws_sent = $state(false);
|
||||
|
||||
/* *** BEGIN *** Handle WebSocket events */
|
||||
function handle_ws_conn(event) {
|
||||
console.log('*** handle_ws_conn() ***');
|
||||
console.log(event);
|
||||
if (event.detail.status == 'connected') {
|
||||
function handle_ws_conn(ws_conn_status: any) {
|
||||
log_lvl = 1;
|
||||
if (log_lvl) {
|
||||
console.log('*** handle_ws_conn() ***', ws_conn_status);
|
||||
}
|
||||
|
||||
if (ws_conn_status.status == 'connected') {
|
||||
$events_sess.launcher.ws = {}; // Reset WS related values on a new connection.
|
||||
$events_sess.launcher.ws.status = 'connected';
|
||||
} else {
|
||||
@@ -326,13 +332,14 @@ function handle_ws_conn(event) {
|
||||
|
||||
// This client received a WebSocket message.
|
||||
// When this is called something seems to go wrong. It creates a loop when connected.
|
||||
function handle_ws_recv(event) {
|
||||
function handle_ws_recv(ws_recv_status: any) {
|
||||
log_lvl = 1;
|
||||
if (log_lvl) {
|
||||
console.log('*** handle_ws_recv() ***', event);
|
||||
console.log('*** handle_ws_recv() ***', ws_recv_status);
|
||||
}
|
||||
|
||||
if (event.detail.type == 'cmd' && event.detail.cmd) {
|
||||
let cmd = event.detail.cmd;
|
||||
if (ws_recv_status.type == 'cmd' && ws_recv_status.cmd) {
|
||||
let cmd = ws_recv_status.cmd;
|
||||
// console.log(cmd);
|
||||
|
||||
if ($events_loc.launcher.controller != 'remote') {
|
||||
@@ -500,11 +507,10 @@ function handle_ws_recv(event) {
|
||||
|
||||
|
||||
// This client sent a WebSocket message.
|
||||
function handle_ws_sent(event) {
|
||||
console.log('*** handle_ws_sent() ***');
|
||||
console.log(event);
|
||||
let command = event.detail.cmd;
|
||||
console.log(command);
|
||||
function handle_ws_sent(ws_sent_status: any) {
|
||||
console.log('*** handle_ws_sent() ***', ws_sent_status);
|
||||
let command = ws_sent_status.cmd;
|
||||
console.log(`CMD: ${command}`);
|
||||
|
||||
$events_sess.launcher.controller_cmd = null;
|
||||
$events_sess.launcher.controller_trigger_send = null;
|
||||
@@ -527,6 +533,30 @@ $effect(() => {
|
||||
}
|
||||
});
|
||||
|
||||
$effect(() => {
|
||||
if (trigger_handle_ws_conn) {
|
||||
let ws_conn_status = trigger_handle_ws_conn; // This a string status
|
||||
trigger_handle_ws_conn = false;
|
||||
handle_ws_conn(ws_conn_status);
|
||||
}
|
||||
});
|
||||
|
||||
$effect(() => {
|
||||
if (trigger_handle_ws_recv) {
|
||||
let ws_recv_status = trigger_handle_ws_recv; // This should be a key value object.
|
||||
trigger_handle_ws_recv = false;
|
||||
handle_ws_recv(ws_recv_status);
|
||||
}
|
||||
});
|
||||
|
||||
$effect(() => {
|
||||
if (trigger_handle_ws_sent) {
|
||||
let ws_sent_status = trigger_handle_ws_sent; // This should be a key value object.
|
||||
trigger_handle_ws_sent = false;
|
||||
handle_ws_sent(ws_sent_status);
|
||||
}
|
||||
});
|
||||
|
||||
async function handle_event_file_open () {
|
||||
let event_file_obj;
|
||||
if ($events_slct.event_file_obj && $events_slct.event_file_obj.event_file_id_random) {
|
||||
@@ -1064,7 +1094,7 @@ $effect(() => {
|
||||
<!-- Main modal -->
|
||||
<!-- NOTE: The modal size is intentionally set to "". This makes it undefined and allows the modal to be as large as the content. -->
|
||||
<Modal
|
||||
title="{$events_sess.launcher?.modal__title}"
|
||||
title={$events_sess.launcher?.modal__title}
|
||||
bind:open={$events_sess.launcher.modal__open}
|
||||
autoclose={false}
|
||||
size=""
|
||||
@@ -1110,13 +1140,22 @@ $effect(() => {
|
||||
<span class="fas fa-times m-1"></span>
|
||||
Close Remote Poster Display Only
|
||||
</button>
|
||||
|
||||
Open: {$ae_api.base_url} {$events_sess.launcher.modal__open}
|
||||
<!-- /event/file/{$events_slct.event_file_obj.event_file_id_random}/download?filename={$events_slct.event_file_obj.filename}&x_no_account_id_token=direct-download -->
|
||||
<!-- <span class="aspect-9/16 max-h-96"> -->
|
||||
{#if $events_sess.launcher.modal__open}
|
||||
<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"
|
||||
alt="Placeholder: /event/file/{$events_sess.launcher.modal__open}/download?filename={$events_slct.event_file_obj.filename}&x_no_account_id_token=direct-download"
|
||||
class="margin-auto max-h-full max-w-full"
|
||||
/>
|
||||
{:else}
|
||||
<div class="flex flex-row items-center justify-center p-4">
|
||||
<span class="fas fa-info-circle mx-1"></span>
|
||||
<span>No image selected</span>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- </span> -->
|
||||
|
||||
<button
|
||||
@@ -1183,9 +1222,9 @@ $effect(() => {
|
||||
bind:hide__ws_messages={$events_loc.launcher.hide__ws_messages}
|
||||
bind:hide__ws_commands={$events_loc.launcher.hide__ws_commands}
|
||||
|
||||
on:ws_conn={handle_ws_conn}
|
||||
on:ws_recv={handle_ws_recv}
|
||||
on:ws_sent={handle_ws_sent}
|
||||
bind:ws_conn_status={trigger_handle_ws_conn}
|
||||
bind:ws_recv_status={trigger_handle_ws_recv}
|
||||
bind:ws_sent_status={trigger_handle_ws_sent}
|
||||
|
||||
/>
|
||||
<!-- on:ws_recv={handle_ws_recv} -->
|
||||
|
||||
@@ -8,7 +8,6 @@ let { log_lvl = 0 }: Props = $props();
|
||||
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>
|
||||
|
||||
|
||||
|
||||
@@ -365,7 +365,7 @@ async function handle_open_file() {
|
||||
>
|
||||
{#if (screen_saver_exts.includes(event_file_obj.extension))}
|
||||
<span class="fas fa-chart-bar m-1" class:hidden="{hide_launch_icon}"></span>
|
||||
Open Poster
|
||||
Open Poster {event_file_obj.event_file_id}
|
||||
{:else}
|
||||
<span class="fas fa-paper-plane m-1" class:hidden="{hide_launch_icon}"></span>
|
||||
{ae_util.shorten_filename({filename: event_file_obj.filename, max_length: max_filename_length})}
|
||||
|
||||
Reference in New Issue
Block a user