Adding activity logging to IDAA related section.

This commit is contained in:
Scott Idem
2025-06-02 19:08:37 -04:00
parent b97e4002bc
commit 8279fab244
5 changed files with 316 additions and 14 deletions

View File

@@ -25,23 +25,41 @@ const modalRegistry: Record<string, ModalComponent> = {
// modalComponentTwo: { ref: ModalComponentTwo },
// ...
};
let { data, children }: Props = $props();
if (browser) {
add_activity_log(
{
action: 'idaa_root_layout',
action_with: 'browser',
}
);
}
function add_activity_log(
{
action = 'idaa_root_layout',
action_with = 'none',
}: {
action?: string,
action_with?: string,
}
) {
let last_cache_refresh_iso = new Date($ae_loc?.last_cache_refresh);
let activity_description = `
${$idaa_loc.novi_full_name ?? 'none'} ${$idaa_loc.novi_email ?? 'no-email'}
allow=${$ae_loc?.allow_access}
last_cache_refresh=${last_cache_refresh_iso.toLocaleString()}
data_route=${data?.route.toString() ?? 'unknown'}
`;
let data_kv = {
external_client_id: data?.route.id,
name: `IDAA: ${$idaa_loc.novi_full_name ?? 'no-name'} ${$idaa_loc.novi_email ?? 'no-email'} allow=${$ae_loc?.allow_access}`,
name: `IDAA: ${$idaa_loc.novi_full_name ?? 'none'} ${$idaa_loc.novi_email ?? ''}`,
description: activity_description ?? null,
object_type: 'idaa', // archive, post, event
// object_id_random: data?.route,
url_root: data?.url.origin,
@@ -49,6 +67,7 @@ function add_activity_log(
url_full_path: data?.url.pathname,
url_params: data?.url.searchParams.toString(),
action: action,
action_with: action_with ?? 'none',
meta_json: {
allow_access: $ae_loc?.allow_access,
last_cache_refresh: $ae_loc?.last_cache_refresh,
@@ -72,13 +91,6 @@ function add_activity_log(
});
}
if (browser) {
add_activity_log(
{
action: 'idaa_root_layout - browser',
}
);
}
</script>