Bug fixes and general code clean up related to the IDAA Archives.

This commit is contained in:
Scott Idem
2025-09-03 14:35:44 -04:00
parent acb96729d1
commit 711e24a7d0
6 changed files with 52 additions and 100 deletions

View File

@@ -15,6 +15,10 @@ export async function load_ae_obj_id__archive(
api_cfg,
archive_id,
inc_content_li = false,
enabled = 'enabled',
hidden = 'not_hidden',
limit = 99,
offset = 0,
params = {},
try_cache = true,
log_lvl = 0
@@ -22,6 +26,10 @@ export async function load_ae_obj_id__archive(
api_cfg: any,
archive_id: string,
inc_content_li?: boolean,
enabled?: string,
hidden?: string,
limit?: number,
offset?: number,
params?: key_val,
try_cache?: boolean,
log_lvl?: number
@@ -95,8 +103,10 @@ export async function load_ae_obj_id__archive(
api_cfg: api_cfg,
for_obj_type: 'archive',
for_obj_id: archive_id,
enabled: 'all',
limit: 99,
enabled: enabled, // all, disabled, enabled
hidden: hidden, // all, hidden, not_hidden
limit: limit, // Limit for the comments
offset: offset,
params: params,
try_cache: try_cache,
log_lvl: log_lvl
@@ -156,39 +166,6 @@ export async function load_ae_obj_li__archive(
// console.log('params_json:', params_json);
// ae_promises.load__archive_obj_li = await api.get_ae_obj_li_for_obj_id_crud({
// api_cfg: api_cfg,
// obj_type: 'archive',
// for_obj_type: for_obj_type,
// for_obj_id: for_obj_id,
// use_alt_table: true, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config.
// use_alt_base: false, // NOTE: This will use the base_name_alt value instead of the base_name value
// enabled: enabled,
// hidden: hidden,
// order_by_li: order_by_li,
// limit: limit,
// offset: offset,
// params_json: params_json,
// params: params,
// log_lvl: log_lvl
// })
// .then(function (archive_obj_li_get_result) {
// if (archive_obj_li_get_result) {
// if (try_cache) {
// db_save_ae_obj_li__archive({
// obj_type: 'archive',
// obj_li: archive_obj_li_get_result
// });
// }
// return archive_obj_li_get_result;
// } else {
// return [];
// }
// })
// .catch(function (error) {
// console.log('No results returned or failed.', error);
// });
ae_promises.load__archive_obj_li = await api.get_ae_obj_li_for_obj_id_crud_v2({
api_cfg: api_cfg,
obj_type: 'archive',
@@ -260,6 +237,10 @@ export async function load_ae_obj_li__archive(
api_cfg: api_cfg,
for_obj_type: 'archive',
for_obj_id: archive_id,
enabled: enabled, // all, disabled, enabled
hidden: hidden, // all, hidden, not_hidden
limit: limit, // Limit for the comments
offset: offset,
params: params,
try_cache: try_cache,
log_lvl: log_lvl

View File

@@ -15,11 +15,21 @@ export async function load_ae_obj_id__archive_content(
{
api_cfg,
archive_content_id,
// enabled = 'enabled',
// hidden = 'not_hidden',
// limit = 99,
// offset = 0,
params = {},
try_cache = true,
log_lvl = 0
}: {
api_cfg: any,
archive_content_id: string,
// enabled?: string,
// hidden?: string,
// limit?: number,
// offset?: number,
params?: key_val,
try_cache?: boolean,
log_lvl?: number
}
@@ -28,14 +38,12 @@ export async function load_ae_obj_id__archive_content(
console.log(`*** load_ae_obj_id__archive_content() *** archive_content_id=${archive_content_id}`);
}
let params = {};
ae_promises.load__archive_content_obj = await api.get_ae_obj_id_crud({
api_cfg: api_cfg,
obj_type: 'archive_content',
obj_id: archive_content_id, // NOTE: This is the FQDN, not normally the ID.
use_alt_table: false, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config.
use_alt_base: false, // NOTE: This will use the base_name_alt value instead of the base_name value
obj_id: archive_content_id,
use_alt_table: false,
use_alt_base: false,
params: params,
log_lvl: log_lvl
})
@@ -118,11 +126,6 @@ export async function load_ae_obj_li__archive_content(
console.log(`*** load_ae_obj_li__archive_content() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`);
}
// let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled
// let hidden: string = (params.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden
// let limit: number = (params.qry__limit ?? 99); // 99
// let offset: number = (params.qry__offset ?? 0); // 0
let params_json: key_val = {};
// console('params_json:', params_json);

View File

@@ -28,6 +28,9 @@ export const load = (async ({ params, parent }) => { // route
api_cfg: ae_acct.api,
archive_id: archive_id,
inc_content_li: true,
enabled: 'enabled',
hidden: 'all', // 'not_hidden' to load only visible entries
limit: 99,
log_lvl: log_lvl
})
.then((results) => {

View File

@@ -895,10 +895,18 @@ $effect(() => {
onclick={() => {
if (!confirm('Are you sure you want to delete this archive content?')) {return false;}
let method = 'disable';
if ($ae_loc.administrator_access && $ae_loc.edit_mode) {
// if (confirm('You have trusted access. Do you want to permanently delete this archive content? (OK = Permanent Delete, Cancel = Disable)')) {
method = 'delete';
// }
}
prom_api__archive_content_obj = archives_func.delete_ae_obj_id__archive_content({
api_cfg: $ae_api,
archive_content_id: $idaa_slct.archive_content_id,
method: 'disable',
method: method,
log_lvl: log_lvl
});
@@ -918,7 +926,11 @@ $effect(() => {
<span class="fas fa-minus m-1"></span>
Delete
{#if $ae_loc.administrator_access}
(Disable)
{#if $ae_loc.edit_mode}
(Permanent Delete)
{:else}
(Disable)
{/if}
{/if}
</button>
{:else if $idaa_slct.archive_content_obj.hosted_file_id}

View File

@@ -100,13 +100,18 @@ file_icons['zip'] = 'file-archive';
<div
class="container archive archive_content_obj border p-2 mb-2 space-y-2 w-full max-w-(--breakpoint-lg) flex flex-col items-center justify-center bg-white rounded-lg"
class:dim={idaa_archive_content_obj.hide}
class:hidden={(idaa_archive_content_obj.hide || !idaa_archive_content_obj?.enable) && !$ae_loc.edit_mode}
class:dim={idaa_archive_content_obj.hide && $ae_loc.edit_mode}
class:dim_warning={!idaa_archive_content_obj?.enable && $ae_loc.edit_mode}
class:bg-warning-100={!idaa_archive_content_obj?.enable}
class:text-warning-900={!idaa_archive_content_obj?.enable}
>
<header class="ae_header flex flex-row gap-2 items-center">
<h3 class="archive__name h4">
<span class="archive__name">{@html idaa_archive_content_obj.name}</span>
{idaa_archive_content_obj.hide}
</h3>
{#if idaa_archive_content_obj.original_location}

View File

@@ -102,20 +102,6 @@ let { log_lvl = 0, lq__archive_obj, lq__archive_content_obj_li }: Props = $props
$idaa_loc.archives.qry__limit = 250;
// ae_trigger = 'load__event_obj_li';
$idaa_trig.archive_content_li = true;
// let load_archive_content_obj_li = archives_func.load_ae_obj_li__archive_content({
// api_cfg: $ae_api,
// for_obj_type: 'archive',
// for_obj_id: $ae_loc.archive_id,
// enabled: $idaa_loc.archives.qry__enabled,
// hidden: $idaa_loc.archives.qry__hidden,
// limit: $idaa_loc.archives.qry__limit,
// order_by_li: $idaa_loc.archives.qry__order_by_li,
// try_cache: true,
// log_lvl: log_lvl
// });
// console.log(`load_archive_content_obj_li = `, load_archive_content_obj_li);
// $idaa_slct.archive_content_obj_li = load_archive_content_obj_li;
}}
class="novi_btn btn_show_archives_archive_content ae_btn btn btn-info btn-sm preset-tonal-secondary border border-secondary-500"
>
@@ -130,20 +116,6 @@ let { log_lvl = 0, lq__archive_obj, lq__archive_content_obj_li }: Props = $props
$idaa_loc.archives.qry__limit = 250;
// ae_trigger = 'load__event_obj_li';
$idaa_trig.archive_content_li = true;
// let load_archive_content_obj_li = archives_func.load_ae_obj_li__archive_content({
// api_cfg: $ae_api,
// for_obj_type: 'archive',
// for_obj_id: $ae_loc.archive_id,
// enabled: $idaa_loc.archives.qry__enabled,
// hidden: $idaa_loc.archives.qry__hidden,
// limit: $idaa_loc.archives.qry__limit,
// order_by_li: $idaa_loc.archives.qry__order_by_li,
// try_cache: true,
// log_lvl: log_lvl
// });
// console.log(`load_archive_content_obj_li = `, load_archive_content_obj_li);
// $idaa_slct.archive_content_obj_li = load_archive_content_obj_li;
}}
class="novi_btn btn_hide_archives_archive_content ae_btn btn btn-info btn-sm preset-tonal-secondary border border-secondary-500"
>
@@ -160,18 +132,6 @@ let { log_lvl = 0, lq__archive_obj, lq__archive_content_obj_li }: Props = $props
$idaa_loc.archives.qry__limit = 500;
// ae_trigger = 'load__event_obj_li';
$idaa_trig.archive_content_li = true;
// let load_archive_content_obj_li = archives_func.load_ae_obj_li__archive_content({
// api_cfg: $ae_api,
// for_obj_type: 'archive',
// for_obj_id: $ae_loc.archive_id,
// enabled: $idaa_loc.archives.qry__enabled,
// hidden: $idaa_loc.archives.qry__hidden,
// limit: $idaa_loc.archives.qry__limit,
// order_by_li: $idaa_loc.archives.qry__order_by_li,
// try_cache: true,
// log_lvl: log_lvl
// });
}}
class="novi_btn btn_show_archive_content ae_btn btn btn-warning btn-sm preset-tonal-secondary border border-secondary-500"
>
@@ -186,18 +146,6 @@ let { log_lvl = 0, lq__archive_obj, lq__archive_content_obj_li }: Props = $props
$idaa_loc.archives.qry__limit = 500;
$idaa_trig.archive_content_li = true;
// ae_trigger = 'load__event_obj_li';
// let load_archive_content_obj_li = archives_func.load_ae_obj_li__archive_content({
// api_cfg: $ae_api,
// for_obj_type: 'archive',
// for_obj_id: $ae_loc.archive_id,
// enabled: $idaa_loc.archives.qry__enabled,
// hidden: $idaa_loc.archives.qry__hidden,
// limit: $idaa_loc.archives.qry__limit,
// order_by_li: $idaa_loc.archives.qry__order_by_li,
// try_cache: true,
// log_lvl: log_lvl
// });
}}
class="novi_btn btn_hide_bb_post ae_btn btn btn-warning btn-sm preset-tonal-secondary border border-secondary-500"
>