Clarify provisioning source labels and filters
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
import RelativeTime from '$ui/components/RelativeTime.svelte';
|
||||
|
||||
import LifecycleDialog from '$ui/components/LifecycleDialog.svelte';
|
||||
import { provisioningListStatuses, provisioningListSources, provisioningPageSize, provisioningPageOffset, type ProvisioningListRow as Deployment, type ProvisioningListPage } from '$lib/provisioning-list.js';
|
||||
import { provisioningListStatuses, provisioningListSources, provisioningSourceLabels, provisioningSourceLabel, provisioningMatchesSource, provisioningPageSize, provisioningPageOffset, type ProvisioningListSource, type ProvisioningListRow as Deployment, type ProvisioningListPage } from '$lib/provisioning-list.js';
|
||||
import { provisioningActions, actionLabels } from '$lib/provisioning.js';
|
||||
|
||||
import { contextHref } from '$lib/navigation-context.js';
|
||||
@@ -40,7 +40,7 @@
|
||||
let limit = $state(25);
|
||||
let offset = $state(0);
|
||||
let historyState = $state('all');
|
||||
let source = $state('all');
|
||||
let source = $state<ProvisioningListSource | 'all'>('all');
|
||||
let expanded = $state<Record<string, boolean>>({});
|
||||
let fleetActionsOpen = $state(false);
|
||||
let now = $state(Date.now());
|
||||
@@ -55,7 +55,7 @@
|
||||
tab = ['active', 'history'].includes(params.get('view') ?? '') ? params.get('view')! : 'active';
|
||||
action = provisioningActions.some(value => value === params.get('action')) ? params.get('action')! : 'all';
|
||||
historyState = provisioningListStatuses.some(value => value === params.get('status')) ? params.get('status')! : 'all';
|
||||
source = provisioningListSources.some(value => value === params.get('source')) ? params.get('source')! : 'all';
|
||||
source = provisioningListSources.find(value => value === params.get('source')) ?? 'all';
|
||||
search = params.get('server') ?? '';
|
||||
limit = provisioningPageSize(Number(params.get('limit') ?? 25));
|
||||
offset = provisioningPageOffset(Number(params.get('offset') ?? 0));
|
||||
@@ -141,12 +141,7 @@
|
||||
if (action !== 'all' && row.action !== action) return false;
|
||||
if (historyState !== 'all' && (historyState === 'pending' ? !['queued','waiting'].includes(row.state) : row.state !== historyState)) return false;
|
||||
if (search && !`${row.server} ${serverTitle(row.server)}`.toLowerCase().includes(search.toLowerCase())) return false;
|
||||
if (source !== 'all') {
|
||||
const sources = row.sources ?? [];
|
||||
if (source === 'manual' && (sources.length || row.triggered_by !== 'ui')) return false;
|
||||
if (source === 'system' && (sources.length || row.triggered_by === 'ui')) return false;
|
||||
if (['campaign','beta','maintenance','rebalance'].includes(source) && !sources.some(item => source === 'maintenance' ? ['maintenance','watchdog'].includes(item.kind) : item.kind === source)) return false;
|
||||
}
|
||||
if (source !== 'all' && !provisioningMatchesSource(row, source)) return false;
|
||||
return true;
|
||||
}));
|
||||
const queueSummary = $derived.by(() => {
|
||||
@@ -175,7 +170,7 @@
|
||||
<label class="search">Server<input type="search" bind:value={search} oninput={() => saveContext(true)} placeholder="Search server or lobby" maxlength="100" /></label>
|
||||
<label>Operation<select bind:value={action} onchange={() => saveContext(true)}><option value="all">All operations</option>{#each provisioningActions as value}<option value={value}>{actionLabels[value]}</option>{/each}</select></label>
|
||||
<label>Status<select bind:value={historyState} onchange={() => saveContext(true)}><option value="all">All statuses</option><option value="pending">Waiting / queued</option><option value="running">In progress</option><option value="awaiting-health">Verifying health</option><option value="done">Complete</option><option value="attention">Needs attention</option><option value="failed">Failed</option><option value="interrupted">Interrupted</option><option value="warning">Warnings</option><option value="cancelled">Cancelled</option></select></label>
|
||||
<label>Source<select bind:value={source} onchange={() => saveContext(true)}><option value="all">All sources</option><option value="manual">Manual</option><option value="campaign">Campaign</option><option value="beta">Beta</option><option value="maintenance">Maintenance</option><option value="rebalance">Rebalance</option><option value="system">System</option></select></label>
|
||||
<label>Source<select bind:value={source} onchange={() => saveContext(true)}><option value="all">All sources</option>{#each provisioningListSources as value}<option value={value}>{provisioningSourceLabels[value]}</option>{/each}</select></label>
|
||||
{#if filtered}<Button variant="ghost" onclick={clearFilters}>Clear filters</Button>{/if}
|
||||
</div>
|
||||
<LifecycleDialog bind:open={lifecycleOpen} />
|
||||
@@ -225,7 +220,7 @@
|
||||
<td class="server-cell"><HistoricalServerIdentity name={row.server} deletedAt={row.server_deleted_at} href={row.server_exists ? contextHref(`/servers/${encodeURIComponent(row.server)}`, $page.url) : undefined} /></td>
|
||||
<td><a href={operationHref}>{actionLabels[row.action]}</a></td>
|
||||
<td><Badge variant={status.tone} size="md">{status.label}</Badge>{#if ['queued','waiting'].includes(status.group) && row.phaseStartedAt && now - Date.parse(row.phaseStartedAt) >= 600000}<small>In this stage {elapsedTime(row.phaseStartedAt, now)}</small>{/if}</td>
|
||||
<td class="source-cell">{#if primarySource?.href}<a href={contextHref(primarySource.href, $page.url)}>{primarySource.label}</a>{:else}<span>{primarySource?.label ?? (row.triggered_by === 'ui' ? 'Manual' : 'System')}</span>{/if}{#if (row.sources?.length ?? 0) > 1}<small>+{row.sources!.length - 1} more</small>{/if}</td>
|
||||
<td class="source-cell">{#if primarySource?.href}<a href={contextHref(primarySource.href, $page.url)}>{provisioningSourceLabel(row)}</a>{:else}<span>{provisioningSourceLabel(row)}</span>{/if}{#if (row.sources?.length ?? 0) > 1}<small>+{row.sources!.length - 1} more</small>{/if}</td>
|
||||
<td><RelativeTime value={row.started_at} /></td>
|
||||
<td class="align-right"><button class="text-button" aria-expanded={isExpanded} aria-controls={`operation-${row.id}`} aria-label={`${isExpanded ? 'Hide' : 'Show'} ${actionLabels[row.action].toLowerCase()} details for ${serverTitle(row.server)}`} onclick={() => expanded = { ...expanded, [row.id]: !isExpanded }}>{isExpanded ? 'Hide' : 'Details'} <span aria-hidden="true">{isExpanded ? '−' : '+'}</span></button></td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user