fix: Launcher dead-code cleanup — dead else-if branch and unused handle_get_device_info
- launcher/+layout.svelte: dead {:else if $events_slct.event_session_id} branch
(condition identical to preceding {#if}) replaced with correct
{:else if $events_slct.event_location_id} — shows "Select a session"
prompt when a room is chosen but no session is yet selected.
- launcher/[event_location_id]/+page.svelte: removed unreachable
handle_get_device_info() function (never called; pre-relay pattern
superseded by launcher_background_sync.svelte's run_device_heartbeat()).
Cleaned up now-unused imports.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -625,12 +625,13 @@
|
||||
<Launcher_session_view
|
||||
bind:slct__event_session_id={$events_slct.event_session_id}
|
||||
></Launcher_session_view>
|
||||
{:else if $events_slct.event_session_id}
|
||||
{:else if $events_slct.event_location_id}
|
||||
<!-- Location selected but no session chosen yet — prompt operator -->
|
||||
<div
|
||||
class="flex flex-col items-center justify-center p-8 opacity-50"
|
||||
>
|
||||
<LoaderCircle class="animate-spin mb-2" />
|
||||
<span>Loading session details...</span>
|
||||
<span>Select a session from the menu</span>
|
||||
</div>
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
@@ -10,34 +10,16 @@
|
||||
// Imports
|
||||
import { untrack } from 'svelte';
|
||||
import {
|
||||
ae_snip,
|
||||
ae_loc,
|
||||
ae_sess,
|
||||
ae_api,
|
||||
ae_trig,
|
||||
slct,
|
||||
slct_trigger
|
||||
} from '$lib/stores/ae_stores';
|
||||
import {
|
||||
events_loc,
|
||||
events_sess,
|
||||
events_slct,
|
||||
events_trigger,
|
||||
events_trig
|
||||
} from '$lib/stores/ae_events_stores';
|
||||
import { events_func } from '$lib/ae_events_functions';
|
||||
|
||||
import {
|
||||
kill_processes,
|
||||
open_local_file_v2,
|
||||
run_cmd,
|
||||
run_cmd_sync,
|
||||
run_osascript,
|
||||
get_device_info
|
||||
} from '$lib/electron/electron_relay';
|
||||
|
||||
// Variables
|
||||
// Quickly save the data passed from the parent(s) to the Svelte stores, localStorage, and other.
|
||||
// NOTE: Derived from data.account_id (prop) instead of $slct.account_id (store)
|
||||
// to prevent circular dependency loops during hydration.
|
||||
let ae_acct = $derived(data[data.account_id]);
|
||||
@@ -45,8 +27,6 @@
|
||||
let url_event_id = $derived(data.params.event_id);
|
||||
let url_event_location_id = $derived(data.params.event_location_id);
|
||||
|
||||
// $ae_loc.url_origin = data.url.origin;
|
||||
|
||||
$effect(() => {
|
||||
if (log_lvl > 1) {
|
||||
console.log(`event_id: ${url_event_id}`);
|
||||
@@ -61,31 +41,17 @@
|
||||
$effect(() => {
|
||||
if (ae_acct) {
|
||||
untrack(() => {
|
||||
$events_slct.event_location_obj_li = ae_acct.slct.event_location_obj_li ?? [
|
||||
''
|
||||
];
|
||||
$events_slct.id_li__event_location = ae_acct.slct.id_li__event_location ?? [
|
||||
''
|
||||
];
|
||||
if (log_lvl > 1) {
|
||||
console.log(
|
||||
`$events_slct.event_location_obj_li:`,
|
||||
$events_slct.event_location_obj_li
|
||||
);
|
||||
}
|
||||
$events_slct.event_session_obj_li = ae_acct.slct.event_session_obj_li ?? [
|
||||
''
|
||||
];
|
||||
$events_slct.event_location_obj_li = ae_acct.slct.event_location_obj_li ?? [''];
|
||||
$events_slct.id_li__event_location = ae_acct.slct.id_li__event_location ?? [''];
|
||||
$events_slct.event_session_obj_li = ae_acct.slct.event_session_obj_li ?? [''];
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Set the local storage values
|
||||
// Set localStorage defaults for launcher state
|
||||
if (!$events_loc.launcher) {
|
||||
$events_loc.launcher = {};
|
||||
$events_loc.launcher.slct = {
|
||||
event_id: null
|
||||
};
|
||||
$events_loc.launcher.slct = { event_id: null };
|
||||
$events_loc.launcher.show_content__session_code = true;
|
||||
$events_loc.launcher.show_content__presentation_code = true;
|
||||
$events_loc.launcher.show_content__presenter_code = true;
|
||||
@@ -100,108 +66,11 @@
|
||||
};
|
||||
}
|
||||
|
||||
// Set the session storage values
|
||||
if (!$events_sess.launcher) {
|
||||
$events_sess.launcher = {};
|
||||
}
|
||||
|
||||
// Set session storage defaults
|
||||
if (!$events_sess.launcher) $events_sess.launcher = {};
|
||||
$events_sess.launcher.show_content__session_code = true;
|
||||
$events_sess.launcher.show_content__presentation_code = true;
|
||||
$events_sess.launcher.show_content__presenter_code = true;
|
||||
|
||||
// Variables that will be used with Svelte bind are prefixed with 'bi_'.
|
||||
|
||||
let bi_trig__event_location: any = null;
|
||||
// let bi_id_li__event_location: string[] = [];
|
||||
|
||||
let bi_trig__event_session: any = null;
|
||||
// let bi_id_li__event_session: string[] = [];
|
||||
|
||||
// *** Functions and Logic
|
||||
|
||||
// if (browser) {
|
||||
// console.log(`Browser: ${browser}`);
|
||||
// }
|
||||
|
||||
// onMount(() => {
|
||||
// console.log('Pres Mgmt Launcher [slug]: +page@(launcher).svelte');
|
||||
// });
|
||||
|
||||
async function handle_get_device_info(event_device_id: string) {
|
||||
console.log('*** handle_get_device_info() ***');
|
||||
// console.log(event_device_id);
|
||||
|
||||
// console.log('GET DEVICE INFO!!! GET DEVICE INFO!!! GET DEVICE INFO!!!');
|
||||
|
||||
// Using standardized relay method
|
||||
let get_device_info_promise = get_device_info();
|
||||
get_device_info_promise.then(function (result) {
|
||||
// console.log('GOT DEVICE INFO!!! GOT DEVICE INFO!!! GOT DEVICE INFO!!!');
|
||||
console.log(get_device_info_promise);
|
||||
let event_device_data: any = {};
|
||||
event_device_data['other_json'] = JSON.stringify(result);
|
||||
|
||||
event_device_data['info_hostname'] = result.hostname;
|
||||
|
||||
// console.log(event_device_data['other_json']);
|
||||
|
||||
// console.log(result.networkInterfaces);
|
||||
|
||||
let ni_data_li = [];
|
||||
let ip_address_li = [];
|
||||
|
||||
for (let network_interface in result.networkInterfaces) {
|
||||
// console.log(network_interface);
|
||||
let ni_data: any = {};
|
||||
|
||||
if (network_interface.startsWith('en')) {
|
||||
console.log('Wired or wireless network interface found');
|
||||
|
||||
ni_data['name'] = network_interface;
|
||||
|
||||
let ni_details =
|
||||
result.networkInterfaces[network_interface];
|
||||
// console.log(ni_details);
|
||||
|
||||
for (let i = 0; i < ni_details.length; i++) {
|
||||
ni_data['address'] = ni_details[i].address;
|
||||
ni_data['mac'] = ni_details[i].mac;
|
||||
|
||||
ip_address_li.push(ni_details[i].address);
|
||||
}
|
||||
|
||||
ni_data_li.push(ni_data);
|
||||
}
|
||||
}
|
||||
|
||||
event_device_data['meta_json'] = JSON.stringify(ni_data_li);
|
||||
console.log(event_device_data['meta_json']);
|
||||
|
||||
event_device_data['info_ip_list'] = ip_address_li.join('; ');
|
||||
console.log(event_device_data['info_ip_list']);
|
||||
|
||||
let event_device_obj_up_promise = events_func
|
||||
.update_ae_obj__event_device({
|
||||
api_cfg: $ae_api,
|
||||
event_id: url_event_id,
|
||||
event_device_id: event_device_id,
|
||||
data_kv: event_device_data,
|
||||
log_lvl: 0
|
||||
})
|
||||
.then(function (up_event_device_result) {
|
||||
// console.log('UPDATED DEVICE INFO!!! UPDATED DEVICE INFO!!! UPDATED DEVICE INFO!!!');
|
||||
if (up_event_device_result) {
|
||||
console.log(up_event_device_result);
|
||||
}
|
||||
})
|
||||
.catch(function (error: any) {
|
||||
console.log('No results returned or failed.');
|
||||
console.log(error);
|
||||
});
|
||||
});
|
||||
|
||||
return get_device_info_promise;
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="hidden">This is for forcing data loading.</div>
|
||||
|
||||
Reference in New Issue
Block a user