fix(idaa): gate jitsi report load and restore data store fallback
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
<script lang="ts">
|
||||
import { untrack } from 'svelte';
|
||||
import { ae_util } from '$lib/ae_utils/ae_utils';
|
||||
import { ae_loc } from '$lib/stores/ae_stores';
|
||||
import { load_jitsi_report } from '$lib/ae_reports/reports_functions';
|
||||
import { ae_api, ae_loc } from '$lib/stores/ae_stores';
|
||||
import { idaa_loc } from '$lib/stores/ae_idaa_stores';
|
||||
import JitsiUrlBuilder from './ae_idaa_comp__jitsi_url_builder.svelte';
|
||||
|
||||
interface MeetingEvent {
|
||||
@@ -24,29 +27,42 @@ interface MeetingReport {
|
||||
events: MeetingEvent[];
|
||||
}
|
||||
|
||||
interface Props {
|
||||
data: { streamed: { meetings: Promise<MeetingReport[]> } };
|
||||
}
|
||||
let { data }: Props = $props();
|
||||
|
||||
// --- Data state ---
|
||||
// Resolve the streamed promise into reactive state so we can filter and export it.
|
||||
let meetings_all = $state<MeetingReport[]>([]);
|
||||
let meetings_loading = $state(true);
|
||||
let meetings_error = $state<string | null>(null);
|
||||
|
||||
let meetings_load_started = $state(false);
|
||||
|
||||
$effect(() => {
|
||||
if (meetings_load_started) return;
|
||||
if (!$idaa_loc.novi_verified && !$ae_loc.trusted_access) return;
|
||||
|
||||
const api_cfg = $ae_api;
|
||||
const account_id = $ae_loc.account_id;
|
||||
if (!api_cfg || !account_id) return;
|
||||
|
||||
meetings_load_started = true;
|
||||
meetings_loading = true;
|
||||
meetings_error = null;
|
||||
data.streamed.meetings
|
||||
.then((m: MeetingReport[]) => {
|
||||
meetings_all = m ?? [];
|
||||
meetings_loading = false;
|
||||
|
||||
untrack(() => {
|
||||
void load_jitsi_report({
|
||||
api_cfg,
|
||||
account_id,
|
||||
log_lvl: 1
|
||||
})
|
||||
.catch((err: Error) => {
|
||||
meetings_error = err.message;
|
||||
meetings_loading = false;
|
||||
});
|
||||
.then((m: MeetingReport[]) => {
|
||||
meetings_all = m ?? [];
|
||||
meetings_loading = false;
|
||||
})
|
||||
.catch((err: unknown) => {
|
||||
meetings_error =
|
||||
err instanceof Error ? err.message : String(err);
|
||||
meetings_loading = false;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// --- Filter state ---
|
||||
@@ -357,7 +373,7 @@ function export_json() {
|
||||
</div>
|
||||
<div
|
||||
class="bg-surface-100-900 border-surface-200-800 rounded-xl border p-3 text-center">
|
||||
<div class="font-mono text-2xl text-lg font-bold">
|
||||
<div class="font-mono text-2xl font-bold">
|
||||
{summary.avg_duration}
|
||||
</div>
|
||||
<div class="text-xs tracking-wide uppercase opacity-40">
|
||||
@@ -366,7 +382,7 @@ function export_json() {
|
||||
</div>
|
||||
<div
|
||||
class="bg-surface-100-900 border-surface-200-800 rounded-xl border p-3 text-center">
|
||||
<div class="font-mono text-2xl text-lg font-bold">
|
||||
<div class="font-mono text-2xl font-bold">
|
||||
{summary.total_duration}
|
||||
</div>
|
||||
<div class="text-xs tracking-wide uppercase opacity-40">
|
||||
|
||||
Reference in New Issue
Block a user