Work on bug fix or something for IDAA and the page not fully loading properly. Unsure if this is related to Novi permissions check?

This commit is contained in:
Scott Idem
2025-06-02 13:31:22 -04:00
parent eb32ae1eaa
commit a2e4c710a0
7 changed files with 122 additions and 89 deletions

View File

@@ -47,8 +47,8 @@ export let ae_snip = string_snippets;
// }; // };
// Set the version for the app data. Changing this should force a notification and ask the user to clear and reload the page. // Set the version for the app data. Changing this should force a notification and ask the user to clear and reload the page.
let ver = '2025-05-01_1445'; // KEEP: 2025-04-18_1335 and 2025-04-29_1545 let ver = '2025-05-01_1445'; // KEEP: 2025-05-01_1445
let ver_idb = '2025-04-18_1100'; // Not currently used let ver_idb = '2025-05-01_1445'; // Not currently used
// *** BEGIN *** Longer-term app data. This should be stored to local storage. // *** BEGIN *** Longer-term app data. This should be stored to local storage.
const ae_app_local_data_defaults: key_val = { const ae_app_local_data_defaults: key_val = {

View File

@@ -2,7 +2,7 @@
/** @type {import('./$types').LayoutData} */ /** @type {import('./$types').LayoutData} */
// /** @type {import('./$types').LayoutProps} */ // /** @type {import('./$types').LayoutProps} */
let log_lvl: number = 0; let log_lvl: number = 2;
// *** Import Svelte specific // *** Import Svelte specific
// import { tick } from 'svelte'; // import { tick } from 'svelte';
@@ -15,16 +15,16 @@ import { AppShell, AppBar, initializeStores } from '@skeletonlabs/skeleton';
// Initialize the stores for Drawer, Modal, and Toast so they work throughout the app. // Initialize the stores for Drawer, Modal, and Toast so they work throughout the app.
initializeStores(); initializeStores();
// import { Modal } from '@skeletonlabs/skeleton'; // import { Modal } from '@skeletonlabs/skeleton';
import type { // import type {
ModalComponent // ModalComponent
} from '@skeletonlabs/skeleton'; // } from '@skeletonlabs/skeleton';
const modalRegistry: Record<string, ModalComponent> = { // const modalRegistry: Record<string, ModalComponent> = {
// Set a unique modal ID, then pass the component reference // // Set a unique modal ID, then pass the component reference
// modalComponentEditSponsorshipObj: { ref: ModalComponentEditSponsorshipObj }, // // modalComponentEditSponsorshipObj: { ref: ModalComponentEditSponsorshipObj },
// modalComponentTwo: { ref: ModalComponentTwo }, // // modalComponentTwo: { ref: ModalComponentTwo },
// ... // // ...
}; // };
import { import {
ArrowBigRight, ArrowBigRight,
// CircleX, // CircleX,
@@ -152,7 +152,7 @@ if (!$ae_loc?.site_cfg_json) {
// BEGIN: New Version Check: // BEGIN: New Version Check:
if ($ae_loc && $ae_sess && ($ae_loc.ver != $ae_sess.ver)) { if ($ae_loc && $ae_sess && ($ae_loc?.ver != $ae_sess?.ver)) {
if (log_lvl) { if (log_lvl) {
console.log('ROOT: New version of the ae_loc (core local storage) available!!!'); console.log('ROOT: New version of the ae_loc (core local storage) available!!!');
console.log(`$ae_loc.ver: ${$ae_loc.ver} != $ae_sess.ver: ${$ae_sess.ver}`); console.log(`$ae_loc.ver: ${$ae_loc.ver} != $ae_sess.ver: ${$ae_sess.ver}`);
@@ -309,6 +309,9 @@ if (!$ae_loc?.last_cache_refresh) { // Default is null, currently...
if (log_lvl > 1) { if (log_lvl > 1) {
console.log(`ROOT: Last IDB reload is recent: ${$ae_loc.last_cache_refresh}`); console.log(`ROOT: Last IDB reload is recent: ${$ae_loc.last_cache_refresh}`);
} }
flag_expired = false;
$ae_loc.cache_expired = false;
} }
} }
// END: Expired Cache Check: // END: Expired Cache Check:
@@ -316,7 +319,7 @@ if (!$ae_loc?.last_cache_refresh) { // Default is null, currently...
// BEGIN: Access Checks: // BEGIN: Access Checks:
// Updated 2024-11-21 // Updated 2024-11-21
if ($ae_loc.site_access_key || $ae_loc.site_domain_access_key) { if ($ae_loc?.site_access_key || $ae_loc?.site_domain_access_key) {
// log_lvl = 2; // log_lvl = 2;
if (log_lvl > 1) { if (log_lvl > 1) {
console.log(`We need to do a current check against the allow_access value. site key: ${$ae_loc.site_access_key}, domain key: ${$ae_loc.site_domain_access_key}`); console.log(`We need to do a current check against the allow_access value. site key: ${$ae_loc.site_access_key}, domain key: ${$ae_loc.site_domain_access_key}`);
@@ -366,28 +369,28 @@ if ($ae_loc.site_access_key || $ae_loc.site_domain_access_key) {
// } // }
// } // }
// This is mainly for Precon CHOW // // This is mainly for Precon CHOW
if ($ae_loc?.site_cfg_json?.slct__sponsorship_cfg_id) { // if ($ae_loc?.site_cfg_json?.slct__sponsorship_cfg_id) {
$slct.sponsorship_cfg_id = $ae_loc.site_cfg_json.slct__sponsorship_cfg_id; // $slct.sponsorship_cfg_id = $ae_loc.site_cfg_json.slct__sponsorship_cfg_id;
if ($ae_loc?.mod?.sponsorships) { // if ($ae_loc?.mod?.sponsorships) {
$ae_loc.mod.sponsorships.cfg_id = $ae_loc.site_cfg_json.slct__sponsorship_cfg_id; // $ae_loc.mod.sponsorships.cfg_id = $ae_loc.site_cfg_json.slct__sponsorship_cfg_id;
} else { // } else {
$ae_loc.mod = { // $ae_loc.mod = {
...$ae_loc.mod, // ...$ae_loc.mod,
sponsorships: { // sponsorships: {
cfg_id: $ae_loc.site_cfg_json.slct__sponsorship_cfg_id // cfg_id: $ae_loc.site_cfg_json.slct__sponsorship_cfg_id
} // }
}; // };
} // }
} else if ($ae_loc?.sponsorship_cfg_id) { // } else if ($ae_loc?.sponsorship_cfg_id) {
$slct.sponsorship_cfg_id = $ae_loc.sponsorship_cfg_id; // $slct.sponsorship_cfg_id = $ae_loc.sponsorship_cfg_id;
$ae_loc.mod.sponsorships.cfg_id = $ae_loc.sponsorship_cfg_id; // $ae_loc.mod.sponsorships.cfg_id = $ae_loc.sponsorship_cfg_id;
} else { // } else {
if (log_lvl > 1) { // if (log_lvl > 1) {
console.log(`No Sponsorship Config ID set.`); // console.log(`No Sponsorship Config ID set.`);
} // }
} // }
// END: Special Checks // // END: Special Checks
// Root Svelte Layout Specific: // Root Svelte Layout Specific:
let trigger_clear_access: null|boolean = $state(null); let trigger_clear_access: null|boolean = $state(null);
@@ -448,28 +451,11 @@ if (browser && flag_reload) {
function clear_idb() { function clear_idb() {
indexedDB.deleteDatabase('ae_archives_db'); // Archives module indexedDB.deleteDatabase('ae_archives_db'); // Archives module
// indexedDB.deleteDatabase('content'); // Archives module <-- WARNING
indexedDB.deleteDatabase('ae_core_db'); indexedDB.deleteDatabase('ae_core_db');
indexedDB.deleteDatabase('ae_events_db'); // Events module indexedDB.deleteDatabase('ae_events_db'); // Events module
// indexedDB.deleteDatabase('badges'); // Events module <-- WARNING
// indexedDB.deleteDatabase('devices'); // Events module <-- WARNING
// indexedDB.deleteDatabase('exhibits'); // Events module <-- WARNING
// indexedDB.deleteDatabase('exhibit_tracking'); // Events module
// indexedDB.deleteDatabase('files'); // Events module <-- WARNING
// indexedDB.deleteDatabase('locations'); // Events module <-- WARNING
// indexedDB.deleteDatabase('presentations'); // Events module <-- WARNING
// indexedDB.deleteDatabase('presenters'); // Events module <-- WARNING
// indexedDB.deleteDatabase('sessions'); // Events module <-- WARNING
// indexedDB.deleteDatabase('file'); // Core - Hosted Files module
indexedDB.deleteDatabase('ae_journals_db'); // Journals module indexedDB.deleteDatabase('ae_journals_db'); // Journals module
// indexedDB.deleteDatabase('journal_entry');
// indexedDB.deleteDatabase('notes');
indexedDB.deleteDatabase('ae_posts_db'); // Posts module indexedDB.deleteDatabase('ae_posts_db'); // Posts module
// indexedDB.deleteDatabase('comment'); // Posts module <-- WARNING
indexedDB.deleteDatabase('ae_sponsorships_db'); // Sponsorships module indexedDB.deleteDatabase('ae_sponsorships_db'); // Sponsorships module
// indexedDB.deleteDatabase('cfg'); // Sponsorships module <-- WARNING
// indexedDB.deleteDatabase('person'); // Core - People module
// indexedDB.deleteDatabase('user'); // Core - Not currently used
} }
function clear_local() { function clear_local() {
@@ -477,6 +463,7 @@ function clear_local() {
// localStorage.removeItem('ae_idaa_loc'); // localStorage.removeItem('ae_idaa_loc');
// localStorage.removeItem('ae_journals_loc'); // localStorage.removeItem('ae_journals_loc');
// localStorage.removeItem('ae_events_loc'); // localStorage.removeItem('ae_events_loc');
$ae_loc.allow_access = false; $ae_loc.allow_access = false;
$ae_loc.authenticated_access = false; $ae_loc.authenticated_access = false;
$ae_loc.edit_mode = false; $ae_loc.edit_mode = false;
@@ -862,6 +849,21 @@ $effect(() => {
</div> </div>
</div> </div>
<button
type="button"
onclick={() => {
window.location.reload();
}}
class="btn btn-sm m-1 variant-ghost-secondary hover:variant-ghost-warning hover:variant-outline-warning text-warning-800 hover:text-warning-900 transition-all"
title="Reload page to clear some caches and check for updates"
>
<!-- <span class="fas fa-sync mx-1"></span> -->
<RefreshCw class="mx-1" />
<span>
Reload
</span>
</button>
<button <button
type="button" type="button"
onclick={() => { onclick={() => {
@@ -890,26 +892,13 @@ $effect(() => {
<!-- This is mainly for IDAA using iframes in the Novi site. --> <!-- This is mainly for IDAA using iframes in the Novi site. -->
<div <div
class="text-center text-sm text-gray-500" class="text-center text-sm text-gray-500"
class:hidden={!$ae_loc.iframe} class:hidden={!$ae_loc?.iframe}
> >
<p>If you have tried the "Clear Cache and Reload" button, you may need to manually reload the page using your browser's reload button or by pressing <kbd>Ctrl</kbd> + <kbd>R</kbd> or <kbd>Cmd</kbd> + <kbd>R</kbd>.</p> <p>If you have tried the "Clear Cache and Reload" button, you may need to manually reload the page using your browser's reload button or by pressing <kbd>Ctrl</kbd> + <kbd>R</kbd> or <kbd>Cmd</kbd> + <kbd>R</kbd>.</p>
<p>This sometimes happens with new versions of the app or when in an iframe.</p> <p>This sometimes happens with new versions of the app or when in an iframe.</p>
</div> </div>
<button
type="button"
onclick={() => {
window.location.reload();
}}
class="btn btn-sm m-1 variant-ghost-secondary hover:variant-ghost-warning hover:variant-outline-warning text-warning-800 hover:text-warning-900 transition-all"
title="Reload page to clear some caches and check for updates"
>
<!-- <span class="fas fa-sync mx-1"></span> -->
<RefreshCw class="mx-1" />
<span>
Reload
</span>
</button>
</div> </div>
{:else if (browser && $ae_loc?.allow_access)} {:else if (browser && $ae_loc?.allow_access)}
@@ -920,10 +909,12 @@ $effect(() => {
{@render children?.()} {@render children?.()}
{:else if (browser || flag_reload)} {:else if (browser || flag_reload)}
<div class="flex flex-col items-center justify-center max-w-lg mx-auto space-y-6 border border-red-500 rounded-lg p-4 bg-green-50 dark:bg-green-900 m-8">
<span class="fas fa-spinner fa-spin"></span> <div>
Loading... <span class="fas fa-spinner fa-spin mx-1"></span>
Page data is loading...
</div>
</div>
{/if} {/if}
{#if (browser) } {#if (browser) }
@@ -936,6 +927,54 @@ $effect(() => {
{:else} {:else}
<!-- Nothing to show --> <!-- Nothing to show -->
{/if} {/if}
{:else}
<div class="flex flex-col items-center justify-center max-w-lg mx-auto space-y-6 border border-red-500 rounded-lg p-4 bg-green-50 dark:bg-green-900 m-8">
<div>
<span class="fas fa-spinner fa-spin mx-1"></span>
Loading...
</div>
<button
type="button"
onclick={() => {
window.location.reload();
}}
class="btn btn-sm m-1 variant-ghost-secondary hover:variant-ghost-warning hover:variant-outline-warning text-warning-800 hover:text-warning-900 transition-all"
title="Reload page to clear some caches and check for updates"
>
<!-- <span class="fas fa-sync mx-1"></span> -->
<RefreshCw class="mx-1" />
<span>
Reload
</span>
</button>
<button
type="button"
onclick={() => {
console.log('Reloading page...');
// Clear the IndexedDB
clear_idb();
// Clear localStorage and sessionStorage
clear_local();
// clear_sess();
alert('IDB, Local, and Session Storage cleared. The page should now refresh on its own.');
window.location.reload();
}}
class="btn btn-sm m-1 variant-ghost-secondary hover:variant-ghost-warning hover:variant-outline-warning text-error-700 hover:text-error-900 transition-all text-wrap"
title="Reload and clear the page cache"
>
<!-- <span class="fas fa-sync mx-1"></span> -->
<RefreshCcwDot class="mx-1" />
<span>
Clear Cache and Reload
</span>
</button>
</div>
{/if} {/if}

View File

@@ -305,9 +305,7 @@ export async function load({ fetch, params, parent, route, url }) { // params, r
} }
// console.log(`ae_acct = `, ae_acct); // console.log(`ae_acct = `, ae_acct);
// WARNING: Precaution against shared data between sites and sessions. // WARNING: Using the Account ID is a precaution against shared data between other accounts (sites and sessions).
// data_struct.ae_acct[ae_loc_init.account_id] = ae_acct;
data_struct[ae_loc_init.account_id] = ae_acct; data_struct[ae_loc_init.account_id] = ae_acct;
return data_struct; return data_struct;

View File

@@ -1,7 +1,7 @@
/** @type {import('./$types').PageLoad} */ /** @type {import('./$types').PageLoad} */
export function load() { export function load() {
return { // return {
ae_root_page_ts: true, // ae_root_page_ts: true,
}; // };
} }

View File

@@ -1,8 +1,6 @@
<script lang="ts"> <script lang="ts">
import { run } from 'svelte/legacy'; import { run } from 'svelte/legacy';
import { browser } from '$app/environment'; import { browser } from '$app/environment';
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores'; import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
import { idaa_loc, idaa_sess, idaa_slct } from '$lib/ae_idaa_stores'; import { idaa_loc, idaa_sess, idaa_slct } from '$lib/ae_idaa_stores';
@@ -45,7 +43,7 @@ if (browser) {
// Reminder: super > manager > administrator > trusted > public > authenticated > anonymous // Reminder: super > manager > administrator > trusted > public > authenticated > anonymous
// NOTE: This is checking if they are in an iframe *and* have a Novi UUID. We ignore the iframe mode for trusted and above (administrators, managers, etc). // NOTE: This is checking if they are in an iframe *and* have a Novi UUID. We ignore the iframe mode for trusted and above (administrators, managers, etc).
if ($ae_loc.iframe && $idaa_loc?.novi_uuid?.length == 36 && $idaa_loc?.novi_email?.length > 3 && $idaa_loc?.novi_full_name?.length > 0) { if ($ae_loc?.iframe && $idaa_loc?.novi_uuid?.length == 36 && $idaa_loc?.novi_email?.length > 3 && $idaa_loc?.novi_full_name?.length > 0) {
$ae_loc.access_type = 'authenticated'; $ae_loc.access_type = 'authenticated';
$ae_loc.super_access = false; $ae_loc.super_access = false;
$ae_loc.manager_access = false; $ae_loc.manager_access = false;
@@ -146,8 +144,6 @@ if (browser && iframe == 'true') {
} }
run(() => { run(() => {
if ($ae_loc.iframe && $ae_loc.iframe_height && $ae_loc.iframe_height_modal_body) { if ($ae_loc.iframe && $ae_loc.iframe_height && $ae_loc.iframe_height_modal_body) {
if (log_lvl > 1) { if (log_lvl > 1) {
@@ -197,7 +193,7 @@ run(() => {
</svelte:head> </svelte:head>
{#if ($ae_loc.trusted_access || ($ae_loc.authenticated_access && $idaa_loc.novi_uuid))} {#if (browser && ($ae_loc.trusted_access || ($ae_loc.authenticated_access && $idaa_loc.novi_uuid)))}
<div <div
bind:clientHeight={$ae_loc.iframe_height} bind:clientHeight={$ae_loc.iframe_height}

View File

@@ -29,7 +29,7 @@ let { data, children }: Props = $props();
</script> </script>
<svelte:head> <svelte:head>
<title>IDAA - {$idaa_loc.title ?? 'Æ loading...'}</title> <title>IDAA - {$idaa_loc?.title ?? 'Æ loading...'}</title>
</svelte:head> </svelte:head>
<Modal components={modalRegistry} <Modal components={modalRegistry}
@@ -41,9 +41,9 @@ let { data, children }: Props = $props();
<!-- App Shell --> <!-- App Shell -->
<AppShell <AppShell
regionPage={($ae_loc.iframe ? 'iframe' : '')} regionPage={($ae_loc?.iframe ? 'iframe' : '')}
slotHeader={($ae_loc.iframe ? 'iframe' : '')} slotHeader={($ae_loc?.iframe ? 'iframe' : '')}
slotFooter={($ae_loc.iframe ? 'iframe' : '')} slotFooter={($ae_loc?.iframe ? 'iframe' : '')}
> >
{#snippet header()} {#snippet header()}
@@ -102,7 +102,7 @@ let { data, children }: Props = $props();
<div <div
class="flex text-sm sm:text-sm md:text-md lg:text-md xl:text-md 2xl:text-lg text-slate-400 hover:text-slate-800 transition px-1" class="flex text-sm sm:text-sm md:text-md lg:text-md xl:text-md 2xl:text-lg text-slate-400 hover:text-slate-800 transition px-1"
class:ae_debug={$ae_loc.debug} class:ae_debug={$ae_loc?.debug}
> >
<Element_data_store <Element_data_store