Skip to content

Class: PersistenceUiController ​

Defined in: application/services/persistence/persistence-ui-controller.ts:83

Framework-independent controller for a storage settings UI. It registers all built-in providers (Google Drive, local files, Tauri local, S3) from env, tracks the active provider, connection status and snapshot list, and exposes the state through PersistenceUiController.getViewModel. Action methods do not throw; failures are reported in the view model status.

Constructors ​

Constructor ​

ts
new PersistenceUiController(config): PersistenceUiController;

Defined in: application/services/persistence/persistence-ui-controller.ts:99

Creates the controller and registers the built-in providers. Call PersistenceUiController.initialize afterwards to restore a previous session.

Parameters ​

ParameterType
configPersistenceUiControllerConfig

Returns ​

PersistenceUiController

Methods ​

connectProvider() ​

ts
connectProvider(): Promise<void>;

Defined in: application/services/persistence/persistence-ui-controller.ts:265

Connects the active provider with the entered S3 fields (local files always opens the folder picker), then refreshes the snapshot list.

Returns ​

Promise<void>


copyBackupsFrom() ​

ts
copyBackupsFrom(fromProviderId): Promise<boolean>;

Defined in: application/services/persistence/persistence-ui-controller.ts:370

Parameters ​

ParameterType
fromProviderIdstring

Returns ​

Promise<boolean>


disconnectProvider() ​

ts
disconnectProvider(): void;

Defined in: application/services/persistence/persistence-ui-controller.ts:473

Disconnects the active provider and clears the snapshot list and selection.

Returns ​

void


getViewModel() ​

ts
getViewModel(): PersistenceUiControllerViewModel;

Defined in: application/services/persistence/persistence-ui-controller.ts:204

Returns a fresh view model for the current state.

Returns ​

PersistenceUiControllerViewModel


initialize() ​

ts
initialize(): Promise<void>;

Defined in: application/services/persistence/persistence-ui-controller.ts:225

Activates the configured provider and tries to restore its previous session.

Returns ​

Promise<void>


loadWorkspaceSnapshot() ​

ts
loadWorkspaceSnapshot(): Promise<void>;

Defined in: application/services/persistence/persistence-ui-controller.ts:430

Loads the selected snapshot (or the latest one), passes its workspace to hydrateWorkspaceSnapshot, then calls beforeWorkspaceHydrate and loadPersistedData.

Returns ​

Promise<void>


refreshSnapshots() ​

ts
refreshSnapshots(): Promise<void>;

Defined in: application/services/persistence/persistence-ui-controller.ts:456

Reloads the snapshot list from the active provider and clears the selection if the selected snapshot no longer exists.

Returns ​

Promise<void>


runLocalFsDiagnostics() ​

ts
runLocalFsDiagnostics(): void;

Defined in: application/services/persistence/persistence-ui-controller.ts:299

Writes File System Access API diagnostics (secure context, picker availability, embedding, user agent) to the status message.

Returns ​

void


saveWorkspaceSnapshot() ​

ts
saveWorkspaceSnapshot(kind?): Promise<boolean>;

Defined in: application/services/persistence/persistence-ui-controller.ts:340

Parameters ​

ParameterTypeDefault value
kind?SnapshotKind'manual'

Returns ​

Promise<boolean>


selectStorageDirectory() ​

ts
selectStorageDirectory(): Promise<void>;

Defined in: application/services/persistence/persistence-ui-controller.ts:286

Opens the folder picker for the active provider and refreshes the snapshot list. Intended for the local files provider.

Returns ​

Promise<void>


setActiveProviderId() ​

ts
setActiveProviderId(providerId): void;

Defined in: application/services/persistence/persistence-ui-controller.ts:236

Switches the active provider, clears the snapshot list and selection, and tries to restore a session in the background. Ignores an empty id.

Parameters ​

ParameterType
providerIdstring

Returns ​

void

Throws ​

Error when the provider id is not registered.


setS3Credentials() ​

ts
setS3Credentials(partial): void;

Defined in: application/services/persistence/persistence-ui-controller.ts:257

Merges S3 connection fields used by the next PersistenceUiController.connectProvider call.

Parameters ​

ParameterType
partialPartial<S3ConnectOptions>

Returns ​

void


setSelectedSnapshotId() ​

ts
setSelectedSnapshotId(snapshotId): void;

Defined in: application/services/persistence/persistence-ui-controller.ts:252

Sets the snapshot to load with PersistenceUiController.loadWorkspaceSnapshot. An empty value means the latest one.

Parameters ​

ParameterType
snapshotIdstring

Returns ​

void