mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-07-27 16:49:51 -07:00
feat(sync-ui): main-process runtime, window, tray entry, CLI wiring for sync window
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
import type { SyncProgressEvent } from '../shared/sync/sync-events';
|
||||
import type { SyncDirection, SyncHostsState } from '../shared/sync/sync-hosts-store';
|
||||
|
||||
export type { SyncProgressEvent } from '../shared/sync/sync-events';
|
||||
export type { SyncDirection, SyncHostEntry, SyncHostsState } from '../shared/sync/sync-hosts-store';
|
||||
|
||||
export interface SyncUiSnapshotFile {
|
||||
path: string;
|
||||
name: string;
|
||||
sizeBytes: number;
|
||||
modifiedAtMs: number;
|
||||
}
|
||||
|
||||
export type SyncUiRunKind = 'host-sync' | 'merge' | 'check' | 'snapshot';
|
||||
|
||||
export interface SyncUiRunState {
|
||||
running: boolean;
|
||||
runId: number | null;
|
||||
kind: SyncUiRunKind | null;
|
||||
host: string | null;
|
||||
}
|
||||
|
||||
export interface SyncUiSnapshot {
|
||||
dbPath: string;
|
||||
hosts: SyncHostsState;
|
||||
snapshotsDir: string;
|
||||
snapshots: SyncUiSnapshotFile[];
|
||||
run: SyncUiRunState;
|
||||
launcherPath: string | null;
|
||||
}
|
||||
|
||||
export interface SyncUiRunRequest {
|
||||
host: string;
|
||||
direction?: SyncDirection;
|
||||
force?: boolean;
|
||||
}
|
||||
|
||||
export interface SyncUiStartResult {
|
||||
started: boolean;
|
||||
runId: number | null;
|
||||
reason: string | null;
|
||||
}
|
||||
|
||||
export interface SyncUiCheckResult {
|
||||
host: string;
|
||||
sshOk: boolean;
|
||||
remoteCommand: string | null;
|
||||
remoteVersion: string | null;
|
||||
ok: boolean;
|
||||
error: string | null;
|
||||
}
|
||||
|
||||
export interface SyncUiProgressPayload {
|
||||
runId: number;
|
||||
kind: SyncUiRunKind;
|
||||
host: string | null;
|
||||
event: SyncProgressEvent;
|
||||
}
|
||||
|
||||
export interface SyncUiHostUpdateRequest {
|
||||
host: string;
|
||||
label?: string | null;
|
||||
direction?: SyncDirection;
|
||||
autoSync?: boolean;
|
||||
}
|
||||
|
||||
export interface SyncUiAPI {
|
||||
getSnapshot: () => Promise<SyncUiSnapshot>;
|
||||
saveHost: (update: SyncUiHostUpdateRequest) => Promise<SyncHostsState>;
|
||||
removeHost: (host: string) => Promise<SyncHostsState>;
|
||||
setAutoSyncInterval: (minutes: number) => Promise<SyncHostsState>;
|
||||
runSync: (request: SyncUiRunRequest) => Promise<SyncUiStartResult>;
|
||||
cancelRun: () => Promise<boolean>;
|
||||
checkHost: (host: string) => Promise<SyncUiCheckResult>;
|
||||
createSnapshot: () => Promise<SyncUiStartResult>;
|
||||
mergeSnapshotFile: (path: string) => Promise<SyncUiStartResult>;
|
||||
deleteSnapshot: (path: string) => Promise<SyncUiSnapshotFile[]>;
|
||||
revealSnapshot: (path: string) => Promise<boolean>;
|
||||
pickSnapshotFile: () => Promise<string | null>;
|
||||
onProgress: (listener: (payload: SyncUiProgressPayload) => void) => () => void;
|
||||
onStateChanged: (listener: () => void) => () => void;
|
||||
}
|
||||
Reference in New Issue
Block a user