feat(ext/vault): wire vault-status into sidebar footer (Plan C Phase 6)
Renders the status indicator into #vault-status-slot on sidebar mount and on a manual ↻ button. No timer polling — get_vault_status returns cached state and sync is user-initiated. Closes the relicario status CLI/extension parity gap. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -2,12 +2,14 @@
|
||||
// nav-button wiring, and the (now debounced) search input. Each function
|
||||
// receives the VaultController (`ctx`) and reaches sibling concerns through it;
|
||||
// pure helpers come from vault-context. Imports only from shared/ and
|
||||
// vault-context — never from vault-shell or vault.ts.
|
||||
// vault-context, plus the leaf renderer vault-status — never from vault-shell
|
||||
// or vault.ts.
|
||||
|
||||
import type { ItemType } from '../shared/types';
|
||||
import {
|
||||
GLYPH_TRASH, GLYPH_DEVICES, GLYPH_SETTINGS, GLYPH_HISTORY, GLYPH_LOCK,
|
||||
GLYPH_TRASH, GLYPH_DEVICES, GLYPH_SETTINGS, GLYPH_HISTORY, GLYPH_LOCK, GLYPH_REFRESH,
|
||||
} from '../shared/glyphs';
|
||||
import { renderStatusIndicator, type VaultStatus } from './vault-status';
|
||||
import {
|
||||
type VaultController, typeIcon, typeLabel, getFilteredEntries,
|
||||
} from './vault-context';
|
||||
@@ -38,8 +40,8 @@ export function renderSidebarShell(): string {
|
||||
<button class="vault-sidebar__nav-item" data-nav="lock" title="Lock">${GLYPH_LOCK} <span class="vault-sidebar__nav-label">lock</span></button>
|
||||
</div>
|
||||
<div class="vault-sidebar__footer">
|
||||
<!-- Phase 6 (Dev-C Task 6.3) wires the sync-status indicator into this slot. -->
|
||||
<div id="vault-status-slot"></div>
|
||||
<button class="vault-status-refresh" id="status-refresh-btn" type="button" title="Refresh status" aria-label="Refresh status">${GLYPH_REFRESH}</button>
|
||||
</div>
|
||||
</div>`;
|
||||
}
|
||||
@@ -109,6 +111,20 @@ export function wireSidebar(ctx: VaultController): void {
|
||||
ctx.renderListPane();
|
||||
}
|
||||
});
|
||||
|
||||
// Vault status indicator — refresh on mount + on the manual button only.
|
||||
// No timer polling: get_vault_status returns cached state and sync is
|
||||
// user-initiated (spec 2026-05-04, Phase 6).
|
||||
const refreshStatus = async (): Promise<void> => {
|
||||
const resp = await ctx.sendMessage({ type: 'get_vault_status' });
|
||||
if (!resp.ok) return;
|
||||
const slot = document.getElementById('vault-status-slot');
|
||||
if (slot) renderStatusIndicator(slot, resp.data as VaultStatus);
|
||||
};
|
||||
void refreshStatus();
|
||||
document.getElementById('status-refresh-btn')?.addEventListener('click', () => {
|
||||
void refreshStatus();
|
||||
});
|
||||
}
|
||||
|
||||
function isEditableTarget(target: EventTarget | null): boolean {
|
||||
|
||||
Reference in New Issue
Block a user