Now with ability to clear IDB event_file list

This commit is contained in:
Scott Idem
2024-07-25 12:36:39 -04:00
parent 6b9284951e
commit d756059ad4
3 changed files with 42 additions and 28 deletions

View File

@@ -64,10 +64,20 @@ onMount(() => {
type="button" type="button"
on:click={() => { on:click={() => {
console.log('*** Refresh button clicked ***'); console.log('*** Refresh button clicked ***');
ae_tmp.show__file_li = false;
console.log(`$lq__event_file_obj_li:`, $lq__event_file_obj_li); db_events.files.clear();
$slct_trigger = 'load__event_file_obj_li';
ae_tmp.show__file_li = true; events_func.handle_load_ae_obj_li__event_file({
api_cfg: $ae_api,
for_obj_type: link_to_type,
for_obj_id: link_to_id,
try_cache: false
});
// ae_tmp.show__file_li = false;
// console.log(`$lq__event_file_obj_li:`, $lq__event_file_obj_li);
// $slct_trigger = 'load__event_file_obj_li';
// ae_tmp.show__file_li = true;
}} }}
class="btn btn-sm p-1 m-1 variant-soft-tertiary hover:variant-ghost-warning transition hover:transition-all *:hover:inline" class="btn btn-sm p-1 m-1 variant-soft-tertiary hover:variant-ghost-warning transition hover:transition-all *:hover:inline"
class:hidden={display_mode != 'default' && !$ae_loc.administrator_access} class:hidden={display_mode != 'default' && !$ae_loc.administrator_access}
@@ -192,7 +202,7 @@ onMount(() => {
</button> </button>
<a <a
href="{$ae_api.base_url}/event/file/{event_file_obj.event_file_id_random}/download?filename={event_file_obj.filename}&x_no_account_id_token=direct-download" href="{$ae_api.base_url}/event/file/{event_file_obj.event_file_id_random}/download?filename={event_file_obj.filename}&x_no_account_id_token=direct-download"
class="btn btn-sm variant-soft-secondary *:hover:inline" class="btn btn-sm variant-soft-secondary m-0.5 *:hover:inline"
class:hidden={!ae_tmp.show__direct_download} class:hidden={!ae_tmp.show__direct_download}
title={`Download this file:\n${event_file_obj.filename}\n[API] SHA256: ${event_file_obj.hash_sha256.slice(0, 10)}... Hosted ID: ${event_file_obj.hosted_file_id_random} Event File ID: ${event_file_obj.event_file_id_random}`} title={`Download this file:\n${event_file_obj.filename}\n[API] SHA256: ${event_file_obj.hash_sha256.slice(0, 10)}... Hosted ID: ${event_file_obj.hosted_file_id_random} Event File ID: ${event_file_obj.event_file_id_random}`}
> >
@@ -204,7 +214,7 @@ onMount(() => {
<button <button
type="button" type="button"
use:clipboard={encodeURI(`${$ae_api.base_url}/event/file/${event_file_obj.event_file_id_random}/download?filename=${event_file_obj.filename}&x_no_account_id_token=direct-download`)} use:clipboard={encodeURI(`${$ae_api.base_url}/event/file/${event_file_obj.event_file_id_random}/download?filename=${event_file_obj.filename}&x_no_account_id_token=direct-download`)}
class="btn btn-sm variant-soft-secondary *:hover:inline" class="btn btn-sm variant-soft-secondary m-0.5 *:hover:inline"
class:hidden={!ae_tmp.show__direct_download} class:hidden={!ae_tmp.show__direct_download}
title="Copy the direct download file link to the clipboard." title="Copy the direct download file link to the clipboard."
> >

View File

@@ -44,7 +44,7 @@ let lq_kv__event_file_obj_li = liveQuery(
{#if event_file_id_random_li && $lq_kv__event_file_obj_li && $lq_kv__event_file_obj_li?.length > 0 && $lq_kv__event_file_obj_li?.length == event_file_id_random_li?.length} {#if event_file_id_random_li && $lq_kv__event_file_obj_li && $lq_kv__event_file_obj_li?.length > 0 && $lq_kv__event_file_obj_li?.length == event_file_id_random_li?.length}
<div class="overflow-auto"> <div class="overflow-auto">
<h2 class="h3"> <h2 class="h3">
<span class="text-md"> <span class="text-base">
Results: Results:
</span> </span>
@@ -58,16 +58,18 @@ let lq_kv__event_file_obj_li = liveQuery(
{/if} {/if}
</h2> </h2>
<table <table
class="table-auto w-full table-striped table-hover" class="table-auto w-full table-striped table-hover text-xs lg:text-sm"
> >
<thead> <thead
class=""
>
<tr> <tr>
<th class="px-4 py-2"> <th class="px-4 py-2">
Filename Filename
<!-- ({$lq_kv__event_file_obj_li?.length}x) --> <!-- ({$lq_kv__event_file_obj_li?.length}x) -->
</th> </th>
<th class="px-4 py-2"> <th class="px-4 py-2">
Download Link Link
</th> </th>
<th class="px-4 py-2">Size</th> <th class="px-4 py-2">Size</th>
<th class="px-4 py-2">Uploaded</th> <th class="px-4 py-2">Uploaded</th>
@@ -90,7 +92,8 @@ let lq_kv__event_file_obj_li = liveQuery(
</tr> </tr>
</thead> </thead>
<tbody> <tbody
class="">
{#each $lq_kv__event_file_obj_li as event_file_obj} {#each $lq_kv__event_file_obj_li as event_file_obj}
<tr <tr
class:dim={event_file_obj?.hide}> class:dim={event_file_obj?.hide}>
@@ -112,7 +115,7 @@ let lq_kv__event_file_obj_li = liveQuery(
// window.postMessage({ type: 'download_event_file', event_file_id: event_file_obj?.event_file_id_random, filename: event_file_obj?.filename, auto_download: true }, '*'); // window.postMessage({ type: 'download_event_file', event_file_id: event_file_obj?.event_file_id_random, filename: event_file_obj?.filename, auto_download: true }, '*');
}} }}
class="btn btn-sm lg:btn-md variant-soft-primary hover:variant-filled-primary min-w-72 lg:min-w-96" class="btn btn-sm variant-soft-primary hover:variant-filled-primary min-w-72"
title={`Download this file: ${event_file_obj?.filename} [API] -- SHA256 hash: ${event_file_obj?.hash_sha256.slice(0, 10)}...`} title={`Download this file: ${event_file_obj?.filename} [API] -- SHA256 hash: ${event_file_obj?.hash_sha256.slice(0, 10)}...`}
> >
{#await ae_promises[event_file_obj?.event_file_id_random]} {#await ae_promises[event_file_obj?.event_file_id_random]}
@@ -149,10 +152,10 @@ let lq_kv__event_file_obj_li = liveQuery(
<td class="px-4 py-2"> <td class="px-4 py-2">
<a <a
href="{$ae_api.base_url}/event/file/{event_file_obj?.event_file_id_random}/download?filename={event_file_obj?.filename}&x_no_account_id_token=direct-download" href="{$ae_api.base_url}/event/file/{event_file_obj?.event_file_id_random}/download?filename={event_file_obj?.filename}&x_no_account_id_token=direct-download"
class="btn btn-sm variant-soft-secondary *:hover:inline" class="btn btn-sm variant-soft-secondary m-0.5 *:hover:inline lg:text-xs"
title={`Download this file:\n${event_file_obj?.filename}\n[API] SHA256: ${event_file_obj?.hash_sha256.slice(0, 10)}... Hosted ID: ${event_file_obj?.hosted_file_id_random} Event File ID: ${event_file_obj?.event_file_id_random}`} title={`Download this file:\n${event_file_obj?.filename}\n[API] SHA256: ${event_file_obj?.hash_sha256.slice(0, 10)}... Hosted ID: ${event_file_obj?.hosted_file_id_random} Event File ID: ${event_file_obj?.event_file_id_random}`}
> >
<span class="fas fa-download m-1"></span> <span class="fas fa-download mx-1"></span>
<div class="hidden"> <div class="hidden">
Download Download
</div> </div>
@@ -160,17 +163,17 @@ let lq_kv__event_file_obj_li = liveQuery(
<button <button
type="button" type="button"
use:clipboard={encodeURI(`${$ae_api.base_url}/event/file/${event_file_obj?.event_file_id_random}/download?filename=${event_file_obj?.filename}&x_no_account_id_token=direct-download`)} use:clipboard={encodeURI(`${$ae_api.base_url}/event/file/${event_file_obj?.event_file_id_random}/download?filename=${event_file_obj?.filename}&x_no_account_id_token=direct-download`)}
class="btn btn-sm variant-soft-secondary *:hover:inline" class="btn btn-sm variant-soft-secondary m-0.5 *:hover:inline lg:text-xs"
title="Copy the direct download file link to the clipboard." title="Copy the direct download file link to the clipboard."
> >
<span class="fas fa-copy m-1"></span> <span class="fas fa-copy mx-1"></span>
<div class="hidden"> <div class="hidden">
Copy Link Copy Link
</div> </div>
</button> </button>
</td> </td>
<td class="px-4 py-2">{ae_util.format_bytes(event_file_obj?.file_size)}</td> <td class="px-4 py-2">{ae_util.format_bytes(event_file_obj?.file_size)}</td>
<td class="px-4 py-2 text-sm"> <td class="px-4 py-2">
<div> <div>
<span> <span>
{ae_util.iso_datetime_formatter(event_file_obj?.created_on, 'dddd')} {ae_util.iso_datetime_formatter(event_file_obj?.created_on, 'dddd')}
@@ -184,7 +187,7 @@ let lq_kv__event_file_obj_li = liveQuery(
</span> </span>
</td> </td>
{#if show_location_fields} {#if show_location_fields}
<td class="px-4 py-2"> <td class="px-4 py-2 lg:text-xs">
{#if event_file_obj?.event_location_id_random} {#if event_file_obj?.event_location_id_random}
<!-- <span class="fas fa-map-marker-alt"></span> --> <!-- <span class="fas fa-map-marker-alt"></span> -->
{event_file_obj?.event_location_name} {event_file_obj?.event_location_name}
@@ -195,26 +198,26 @@ let lq_kv__event_file_obj_li = liveQuery(
{/if} {/if}
{#if show_session_fields} {#if show_session_fields}
<td class="px-4 py-2"> <td class="px-4 py-2 lg:text-xs">
<span class="fas fa-chalkboard-teacher"></span> <span class="fas fa-chalkboard-teacher"></span>
<a <a
href="/events_pres_mgmt/session/{event_file_obj?.event_session_id_random}" href="/events_pres_mgmt/session/{event_file_obj?.event_session_id_random}"
class="text-blue-500 underline hover:text-blue-800" class="text-blue-500 underline hover:text-blue-800"
> >
{event_file_obj?.event_session_name} {event_file_obj?.event_session_name}
</a> </a>
</td> </td>
<td class="px-4 py-2 text-sm">{ae_util.iso_datetime_formatter(event_file_obj?.event_session_start_datetime, 'datetime_us_no_seconds')}</td> <td class="px-4 py-2">{ae_util.iso_datetime_formatter(event_file_obj?.event_session_start_datetime, 'datetime_us_no_seconds')}</td>
{/if} {/if}
{#if show_presentation_fields} {#if show_presentation_fields}
<td class="px-4 py-2"> <td class="px-4 py-2 lg:text-xs">
{#if event_file_obj?.event_presentation_id_random} {#if event_file_obj?.event_presentation_id_random}
{event_file_obj?.event_presentation_name} {event_file_obj?.event_presentation_name}
{:else} {:else}
{@html ae_snip.html__not_set} {@html ae_snip.html__not_set}
{/if} {/if}
</td> </td>
<td class="px-4 py-2 text-sm"> <td class="px-4 py-2">
{#if event_file_obj?.event_presentation_id_random} {#if event_file_obj?.event_presentation_id_random}
{ae_util.iso_datetime_formatter(event_file_obj?.event_presentation_start_datetime, 'time_us_short')} {ae_util.iso_datetime_formatter(event_file_obj?.event_presentation_start_datetime, 'time_us_short')}
{:else} {:else}

View File

@@ -53,7 +53,7 @@ let lq_kv__event_presenter_obj_li = liveQuery(
{/if} {/if}
</h2> </h2>
<table <table
class="table-auto w-full table-striped table-hover" class="table-auto w-full table-striped table-hover text-xs lg:text-sm"
> >
<thead> <thead>
<tr> <tr>
@@ -75,7 +75,8 @@ let lq_kv__event_presenter_obj_li = liveQuery(
{/if} {/if}
</tr> </tr>
</thead> </thead>
<tbody> <tbody
class="">
{#each $lq_kv__event_presenter_obj_li as event_presenter_obj} {#each $lq_kv__event_presenter_obj_li as event_presenter_obj}
<tr <tr
class:dim={event_presenter_obj?.hide}> class:dim={event_presenter_obj?.hide}>
@@ -101,7 +102,7 @@ let lq_kv__event_presenter_obj_li = liveQuery(
<td class="px-4 py-2">{event_presenter_obj?.file_count ?? '0'}</td> <td class="px-4 py-2">{event_presenter_obj?.file_count ?? '0'}</td>
{#if show_session_fields} {#if show_session_fields}
<td class="px-4 py-2"> <td class="px-4 py-2 lg:text-xs">
<span class="fas fa-chalkboard-teacher"></span> <span class="fas fa-chalkboard-teacher"></span>
<a <a
href="/events_pres_mgmt/session/{event_presenter_obj?.event_session_id_random}" href="/events_pres_mgmt/session/{event_presenter_obj?.event_session_id_random}"
@@ -114,8 +115,8 @@ let lq_kv__event_presenter_obj_li = liveQuery(
{/if} {/if}
{#if show_presentation_fields} {#if show_presentation_fields}
<td class="px-4 py-2">{event_presenter_obj?.event_presentation_name}</td> <td class="px-4 py-2 lg:text-xs">{event_presenter_obj?.event_presentation_name}</td>
<td class="px-4 py-2 text-sm">{ae_util.iso_datetime_formatter(event_presenter_obj?.event_presentation_start_datetime, 'time_us_short')}</td> <td class="px-4 py-2 lg:text-xs">{ae_util.iso_datetime_formatter(event_presenter_obj?.event_presentation_start_datetime, 'time_us_short')}</td>
{/if} {/if}
</tr> </tr>