feat: IconGridSelect, CrossLink, SearchPalette components + entity crosslinks
New components: - IconGridSelect: Visual grid selector replacing <select> dropdowns, with icon + label cells, fixed-position popup, smart placement - CrossLink: Inline clickable badge for cross-entity navigation, hover highlights primary, used on entity cards - SearchPalette: Ctrl+K global command palette, searches all entity types via cached data, grouped results, keyboard navigation Integration: - Targets: type selector uses IconGridSelect (4-column grid with icons) - Targets: bot crosslink on telegram/email/matrix target cards - Command Trackers: provider and config badges → CrossLinks - Command Trackers: listener bot name → CrossLink - Command Configs: template config shown as CrossLink on card - Notification Trackers: provider CrossLink added to card - Layout: SearchPalette mounted globally Infrastructure: - Added CommandConfig, CommandTemplateConfig, CommandTracker types - Added notificationTrackersCache, commandTrackersCache to caches - Added allCaches map and fetchAllCaches() for search palette - Added searchPalette i18n keys (EN/RU)
This commit is contained in:
@@ -9,11 +9,15 @@ import { createEntityCache } from './entity-cache.svelte';
|
||||
import type {
|
||||
ServiceProvider,
|
||||
NotificationTarget,
|
||||
Tracker,
|
||||
TrackingConfig,
|
||||
TemplateConfig,
|
||||
TelegramBot,
|
||||
EmailBot,
|
||||
MatrixBot,
|
||||
CommandConfig,
|
||||
CommandTemplateConfig,
|
||||
CommandTracker,
|
||||
} from '$lib/types';
|
||||
|
||||
/** Service providers — used by Dashboard, Trackers, Command Trackers, Providers page. */
|
||||
@@ -22,6 +26,9 @@ export const providersCache = createEntityCache<ServiceProvider>('/providers');
|
||||
/** Notification targets — used by Trackers, Targets page. */
|
||||
export const targetsCache = createEntityCache<NotificationTarget>('/targets');
|
||||
|
||||
/** Notification trackers — used by Dashboard, Trackers page. */
|
||||
export const notificationTrackersCache = createEntityCache<Tracker>('/notification-trackers');
|
||||
|
||||
/** Tracking configs — used by Trackers, Tracking Configs page. */
|
||||
export const trackingConfigsCache = createEntityCache<TrackingConfig>('/tracking-configs');
|
||||
|
||||
@@ -37,23 +44,42 @@ export const emailBotsCache = createEntityCache<EmailBot>('/email-bots');
|
||||
/** Matrix bots — used by Targets, Bots page. */
|
||||
export const matrixBotsCache = createEntityCache<MatrixBot>('/matrix-bots');
|
||||
|
||||
// Command-specific caches (less shared but still benefit from caching)
|
||||
/** Command configs — used by Command Trackers, Command Configs page. */
|
||||
export const commandConfigsCache = createEntityCache<CommandConfig>('/command-configs');
|
||||
|
||||
export const commandConfigsCache = createEntityCache<any>('/command-configs');
|
||||
/** Command template configs — used by Command Configs, Command Template Configs page. */
|
||||
export const commandTemplateConfigsCache = createEntityCache<CommandTemplateConfig>('/command-template-configs');
|
||||
|
||||
export const commandTemplateConfigsCache = createEntityCache<any>('/command-template-configs');
|
||||
/** Command trackers — used by Command Trackers page. */
|
||||
export const commandTrackersCache = createEntityCache<CommandTracker>('/command-trackers');
|
||||
|
||||
/**
|
||||
* All caches keyed by entity type — for search palette and crosslink resolution.
|
||||
*/
|
||||
export const allCaches = {
|
||||
providers: providersCache,
|
||||
targets: targetsCache,
|
||||
notification_trackers: notificationTrackersCache,
|
||||
tracking_configs: trackingConfigsCache,
|
||||
template_configs: templateConfigsCache,
|
||||
telegram_bots: telegramBotsCache,
|
||||
email_bots: emailBotsCache,
|
||||
matrix_bots: matrixBotsCache,
|
||||
command_configs: commandConfigsCache,
|
||||
command_template_configs: commandTemplateConfigsCache,
|
||||
command_trackers: commandTrackersCache,
|
||||
} as const;
|
||||
|
||||
/**
|
||||
* Fetch all caches in parallel. Used by search palette.
|
||||
*/
|
||||
export async function fetchAllCaches(): Promise<void> {
|
||||
await Promise.all(Object.values(allCaches).map(c => c.fetch()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Invalidate all entity caches. Useful on logout.
|
||||
*/
|
||||
export function clearAllCaches(): void {
|
||||
providersCache.clear();
|
||||
targetsCache.clear();
|
||||
trackingConfigsCache.clear();
|
||||
templateConfigsCache.clear();
|
||||
telegramBotsCache.clear();
|
||||
emailBotsCache.clear();
|
||||
matrixBotsCache.clear();
|
||||
commandConfigsCache.clear();
|
||||
commandTemplateConfigsCache.clear();
|
||||
Object.values(allCaches).forEach(c => c.clear());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user