@git-stunts/git-cas 6.0.0 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ADVANCED_GUIDE.md +111 -90
- package/ARCHITECTURE.md +12 -3
- package/CHANGELOG.md +78 -3
- package/GUIDE.md +242 -188
- package/README.md +67 -212
- package/UPGRADING.md +28 -1
- package/bin/ui/dashboard.js +442 -183
- package/bin/ui/store-wizard.js +90 -19
- package/build-info.json +2 -2
- package/docs/API.md +273 -51
- package/docs/WALKTHROUGH.md +46 -0
- package/docs/releases/v6.1.0.md +75 -0
- package/index.d.ts +185 -39
- package/index.js +95 -15
- package/package.json +6 -5
- package/src/domain/errors/Codes.js +13 -0
- package/src/domain/services/CasService.d.ts +42 -26
- package/src/domain/services/CasService.js +53 -32
- package/src/domain/services/ChunkRepository.js +50 -12
- package/src/domain/services/RootSet.js +277 -0
- package/src/domain/services/RootSetMetadataCodec.js +253 -0
- package/src/domain/services/RootSetPersistence.js +334 -0
- package/src/domain/services/RootSetRegistry.js +44 -0
- package/src/domain/services/RootSetRetryPolicy.js +87 -0
- package/src/domain/services/RootSetTreeCodec.js +95 -0
- package/src/domain/value-objects/RootSetRef.js +88 -0
- package/src/infrastructure/adapters/FileIOHelper.js +33 -31
- package/src/infrastructure/adapters/GitPersistenceAdapter.js +29 -0
- package/src/infrastructure/adapters/GitRefAdapter.js +20 -0
- package/src/infrastructure/chunkers/resolveChunker.js +7 -5
- package/src/package-version.js +1 -1
- package/src/ports/GitPersistencePort.js +9 -0
- package/src/ports/GitRefPort.js +9 -0
package/bin/ui/dashboard.js
CHANGED
|
@@ -137,10 +137,18 @@ const FULL_COLUMNS = [
|
|
|
137
137
|
];
|
|
138
138
|
|
|
139
139
|
function formatSize(bytes) {
|
|
140
|
-
if (!Number.isFinite(bytes)) {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
if (bytes < 1024
|
|
140
|
+
if (!Number.isFinite(bytes)) {
|
|
141
|
+
return '-';
|
|
142
|
+
}
|
|
143
|
+
if (bytes < 1024) {
|
|
144
|
+
return `${bytes}B`;
|
|
145
|
+
}
|
|
146
|
+
if (bytes < 1024 * 1024) {
|
|
147
|
+
return `${(bytes / 1024).toFixed(1)}K`;
|
|
148
|
+
}
|
|
149
|
+
if (bytes < 1024 * 1024 * 1024) {
|
|
150
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)}M`;
|
|
151
|
+
}
|
|
144
152
|
return `${(bytes / (1024 * 1024 * 1024)).toFixed(1)}G`;
|
|
145
153
|
}
|
|
146
154
|
|
|
@@ -153,20 +161,30 @@ function manifestFor(entry, manifestCache) {
|
|
|
153
161
|
}
|
|
154
162
|
|
|
155
163
|
function cryptoLabel(manifest) {
|
|
156
|
-
if (!manifest) {
|
|
157
|
-
|
|
164
|
+
if (!manifest) {
|
|
165
|
+
return '-';
|
|
166
|
+
}
|
|
167
|
+
if (
|
|
168
|
+
manifest.encryption?.encrypted ||
|
|
169
|
+
manifest.encryption?.recipients?.length ||
|
|
170
|
+
manifest.encryption
|
|
171
|
+
) {
|
|
158
172
|
return 'encrypted';
|
|
159
173
|
}
|
|
160
174
|
return 'plain';
|
|
161
175
|
}
|
|
162
176
|
|
|
163
177
|
function formatLabel(manifest) {
|
|
164
|
-
if (!manifest) {
|
|
178
|
+
if (!manifest) {
|
|
179
|
+
return '-';
|
|
180
|
+
}
|
|
165
181
|
return manifest.formatVersion ?? (manifest.version ? `v${manifest.version}` : 'manifest');
|
|
166
182
|
}
|
|
167
183
|
|
|
168
184
|
function chunkLabel(manifest) {
|
|
169
|
-
if (!manifest) {
|
|
185
|
+
if (!manifest) {
|
|
186
|
+
return '-';
|
|
187
|
+
}
|
|
170
188
|
const chunks = manifest.chunks?.length ?? 0;
|
|
171
189
|
const subManifests = manifest.subManifests?.length ?? 0;
|
|
172
190
|
return subManifests > 0 ? `${chunks}+${subManifests}` : String(chunks);
|
|
@@ -199,7 +217,9 @@ function sourceEquals(left, right) {
|
|
|
199
217
|
|
|
200
218
|
function filterEntries(entries, filterText, manifestCache) {
|
|
201
219
|
const query = filterText.trim().toLowerCase();
|
|
202
|
-
if (!query) {
|
|
220
|
+
if (!query) {
|
|
221
|
+
return entries;
|
|
222
|
+
}
|
|
203
223
|
return entries.filter((entry) => {
|
|
204
224
|
const manifest = manifestFor(entry, manifestCache);
|
|
205
225
|
const haystack = [
|
|
@@ -208,7 +228,10 @@ function filterEntries(entries, filterText, manifestCache) {
|
|
|
208
228
|
manifest?.integrity,
|
|
209
229
|
manifest?.hash,
|
|
210
230
|
...(manifest?.chunks ?? []).flatMap((chunk) => [chunk.digest, chunk.blob]),
|
|
211
|
-
]
|
|
231
|
+
]
|
|
232
|
+
.filter(Boolean)
|
|
233
|
+
.join(' ')
|
|
234
|
+
.toLowerCase();
|
|
212
235
|
return haystack.includes(query);
|
|
213
236
|
});
|
|
214
237
|
}
|
|
@@ -227,7 +250,9 @@ function syncExplorer(model, patch = {}) {
|
|
|
227
250
|
}
|
|
228
251
|
|
|
229
252
|
function selectedEntry(model) {
|
|
230
|
-
return
|
|
253
|
+
return (
|
|
254
|
+
model.filtered[Math.min(model.table.focusRow, Math.max(0, model.filtered.length - 1))] ?? null
|
|
255
|
+
);
|
|
231
256
|
}
|
|
232
257
|
|
|
233
258
|
function selectedManifest(model) {
|
|
@@ -239,7 +264,11 @@ function maybeLoadSelectedManifest(model, deps) {
|
|
|
239
264
|
if (!entry || model.manifestCache.has(entry.slug) || model.loadingSlug === entry.slug) {
|
|
240
265
|
return null;
|
|
241
266
|
}
|
|
242
|
-
return loadManifestCmd(deps.cas, {
|
|
267
|
+
return loadManifestCmd(deps.cas, {
|
|
268
|
+
slug: entry.slug,
|
|
269
|
+
treeOid: entry.treeOid,
|
|
270
|
+
source: model.source,
|
|
271
|
+
});
|
|
243
272
|
}
|
|
244
273
|
|
|
245
274
|
function createShellState(columns, rows, source) {
|
|
@@ -279,7 +308,11 @@ function createExplorerState(rows) {
|
|
|
279
308
|
manifestCache: new Map(),
|
|
280
309
|
loadingSlug: null,
|
|
281
310
|
error: null,
|
|
282
|
-
table: createNavigableTableState({
|
|
311
|
+
table: createNavigableTableState({
|
|
312
|
+
columns: FULL_COLUMNS,
|
|
313
|
+
rows: [],
|
|
314
|
+
height: tableHeight(rows),
|
|
315
|
+
}),
|
|
283
316
|
palette: null,
|
|
284
317
|
showHelp: false,
|
|
285
318
|
};
|
|
@@ -332,7 +365,12 @@ function checkVaultAuthCmd(cas) {
|
|
|
332
365
|
}
|
|
333
366
|
try {
|
|
334
367
|
const all = await cas.listVault();
|
|
335
|
-
return {
|
|
368
|
+
return {
|
|
369
|
+
type: 'vault-auth-check',
|
|
370
|
+
encrypted: Boolean(metadata?.encryption),
|
|
371
|
+
entryCount: all.length,
|
|
372
|
+
metadata,
|
|
373
|
+
};
|
|
336
374
|
} catch {
|
|
337
375
|
return { type: 'vault-auth-check', encrypted: false, entryCount: 0, metadata: null };
|
|
338
376
|
}
|
|
@@ -341,7 +379,9 @@ function checkVaultAuthCmd(cas) {
|
|
|
341
379
|
|
|
342
380
|
async function deriveVaultKey(cas, metadata, passphrase) {
|
|
343
381
|
const kdf = metadata?.encryption?.kdf;
|
|
344
|
-
if (!kdf) {
|
|
382
|
+
if (!kdf) {
|
|
383
|
+
throw new Error('Missing vault encryption KDF metadata');
|
|
384
|
+
}
|
|
345
385
|
const { key } = await cas.deriveKey({
|
|
346
386
|
passphrase,
|
|
347
387
|
salt: Buffer.from(kdf.salt, 'base64'),
|
|
@@ -377,22 +417,33 @@ function verifyPassphraseCmd(cas, passphrase) {
|
|
|
377
417
|
? { type: 'vault-auth-ok', encryptionKey }
|
|
378
418
|
: { type: 'vault-auth-fail', error: 'Wrong passphrase' };
|
|
379
419
|
} catch (err) {
|
|
380
|
-
const authErrorCodes = [
|
|
381
|
-
|
|
420
|
+
const authErrorCodes = [
|
|
421
|
+
'INTEGRITY_ERROR',
|
|
422
|
+
'DEK_UNWRAP_FAILED',
|
|
423
|
+
'MISSING_KEY',
|
|
424
|
+
'NO_MATCHING_RECIPIENT',
|
|
425
|
+
];
|
|
426
|
+
const msg = authErrorCodes.includes(err.code)
|
|
427
|
+
? 'Wrong passphrase'
|
|
428
|
+
: (err.message ?? String(err));
|
|
382
429
|
return { type: 'vault-auth-fail', error: msg };
|
|
383
430
|
}
|
|
384
431
|
};
|
|
385
432
|
}
|
|
386
433
|
|
|
387
434
|
function casForModel(cas, model) {
|
|
388
|
-
if (!model.vaultEncryptionKey) {
|
|
435
|
+
if (!model.vaultEncryptionKey) {
|
|
436
|
+
return cas;
|
|
437
|
+
}
|
|
389
438
|
return new Proxy(cas, {
|
|
390
439
|
get(target, prop, receiver) {
|
|
391
440
|
if (prop === 'listVault') {
|
|
392
|
-
return (options = {}) =>
|
|
441
|
+
return (options = {}) =>
|
|
442
|
+
target.listVault({ ...options, encryptionKey: model.vaultEncryptionKey });
|
|
393
443
|
}
|
|
394
444
|
if (prop === 'addToVault') {
|
|
395
|
-
return (options = {}) =>
|
|
445
|
+
return (options = {}) =>
|
|
446
|
+
target.addToVault({ ...options, encryptionKey: model.vaultEncryptionKey });
|
|
396
447
|
}
|
|
397
448
|
const value = Reflect.get(target, prop, receiver);
|
|
398
449
|
return typeof value === 'function' ? value.bind(target) : value;
|
|
@@ -400,20 +451,48 @@ function casForModel(cas, model) {
|
|
|
400
451
|
});
|
|
401
452
|
}
|
|
402
453
|
|
|
454
|
+
const WIZARD_GZIP_COMPRESSION = Object.freeze({ algorithm: 'gzip' });
|
|
455
|
+
const WIZARD_CHUNKING_CONFIG = Object.freeze({
|
|
456
|
+
fixed: Object.freeze({ strategy: 'fixed' }),
|
|
457
|
+
cdc: Object.freeze({ strategy: 'cdc' }),
|
|
458
|
+
});
|
|
459
|
+
const WIZARD_MISSING_PASSPHRASE_MESSAGE = 'Encryption passphrase is required';
|
|
460
|
+
|
|
461
|
+
function validateStoreWizardPlan(wizard) {
|
|
462
|
+
if (!wizard.passphrase) {
|
|
463
|
+
return wizard.encryption === 'none' ? null : WIZARD_MISSING_PASSPHRASE_MESSAGE;
|
|
464
|
+
}
|
|
465
|
+
return null;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
function storeWizardEncryptionOptions(wizard) {
|
|
469
|
+
if (wizard.encryption === 'none') {
|
|
470
|
+
return {};
|
|
471
|
+
}
|
|
472
|
+
if (wizard.encryption === 'convergent') {
|
|
473
|
+
return { passphrase: wizard.passphrase, encryption: { scheme: 'convergent' } };
|
|
474
|
+
}
|
|
475
|
+
return { passphrase: wizard.passphrase };
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
function buildStoreWizardOptions(wizard) {
|
|
479
|
+
return {
|
|
480
|
+
filePath: wizard.filePath,
|
|
481
|
+
slug: wizard.slug,
|
|
482
|
+
...storeWizardEncryptionOptions(wizard),
|
|
483
|
+
...(wizard.compression ? { compression: WIZARD_GZIP_COMPRESSION } : {}),
|
|
484
|
+
chunking: WIZARD_CHUNKING_CONFIG[wizard.chunking],
|
|
485
|
+
};
|
|
486
|
+
}
|
|
487
|
+
|
|
403
488
|
function runStoreWizardCmd(cas, wizard) {
|
|
404
489
|
return async () => {
|
|
405
490
|
try {
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
error: 'The TUI store path currently supports plaintext store plans only. Use the CLI for passphrase or convergent encryption.',
|
|
410
|
-
};
|
|
491
|
+
const validationError = validateStoreWizardPlan(wizard);
|
|
492
|
+
if (validationError) {
|
|
493
|
+
return { type: 'store-error', error: validationError };
|
|
411
494
|
}
|
|
412
|
-
const manifest = await cas.storeFile(
|
|
413
|
-
filePath: wizard.filePath,
|
|
414
|
-
slug: wizard.slug,
|
|
415
|
-
...(wizard.compression ? { compression: { algorithm: 'gzip' } } : {}),
|
|
416
|
-
});
|
|
495
|
+
const manifest = await cas.storeFile(buildStoreWizardOptions(wizard));
|
|
417
496
|
const treeOid = await cas.createTree({ manifest });
|
|
418
497
|
await cas.addToVault({ slug: wizard.slug, treeOid, force: true });
|
|
419
498
|
return { type: 'store-complete', slug: wizard.slug, treeOid, manifest };
|
|
@@ -425,28 +504,31 @@ function runStoreWizardCmd(cas, wizard) {
|
|
|
425
504
|
|
|
426
505
|
function enterDashboard(model, deps) {
|
|
427
506
|
const cas = casForModel(deps.cas, model);
|
|
428
|
-
return [
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
loadBranchCmd(cas),
|
|
437
|
-
|
|
438
|
-
]];
|
|
507
|
+
return [
|
|
508
|
+
{
|
|
509
|
+
...model,
|
|
510
|
+
phase: 'dashboard',
|
|
511
|
+
promptEnter: false,
|
|
512
|
+
authError: null,
|
|
513
|
+
status: 'loading entries',
|
|
514
|
+
},
|
|
515
|
+
[loadEntriesCmd(cas, model.source), loadBranchCmd(cas), loadRefsCmd(cas)],
|
|
516
|
+
];
|
|
439
517
|
}
|
|
440
518
|
|
|
441
519
|
function pushToast(model, spec) {
|
|
442
520
|
return {
|
|
443
521
|
...model,
|
|
444
|
-
notifications: pushNotification(
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
522
|
+
notifications: pushNotification(
|
|
523
|
+
model.notifications,
|
|
524
|
+
{
|
|
525
|
+
variant: 'TOAST',
|
|
526
|
+
placement: 'LOWER_RIGHT',
|
|
527
|
+
width: 42,
|
|
528
|
+
...spec,
|
|
529
|
+
},
|
|
530
|
+
Date.now()
|
|
531
|
+
),
|
|
450
532
|
};
|
|
451
533
|
}
|
|
452
534
|
|
|
@@ -467,35 +549,46 @@ function handleTickMsg(msg, model, deps) {
|
|
|
467
549
|
const now = Date.now();
|
|
468
550
|
const elapsed = now - (model.lastTickTime || now);
|
|
469
551
|
const fps = elapsed > 0 ? Math.round(1000 / elapsed) : 0;
|
|
470
|
-
return [
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
552
|
+
return [
|
|
553
|
+
{
|
|
554
|
+
...model,
|
|
555
|
+
titleTimeMs: (model.titleTimeMs || 0) + TITLE_TICK_MS,
|
|
556
|
+
lastTickTime: now,
|
|
557
|
+
fps: model.lastTickTime ? fps : 0,
|
|
558
|
+
},
|
|
559
|
+
[deps.tick(TITLE_TICK_MS, { type: 'title-tick' })],
|
|
560
|
+
];
|
|
476
561
|
}
|
|
477
562
|
|
|
478
563
|
function handleVaultAuthCheck(msg, model) {
|
|
479
564
|
if (msg.encrypted) {
|
|
480
|
-
return [
|
|
565
|
+
return [
|
|
566
|
+
{
|
|
567
|
+
...model,
|
|
568
|
+
phase: 'password',
|
|
569
|
+
metadata: msg.metadata,
|
|
570
|
+
vaultEntryCount: msg.entryCount,
|
|
571
|
+
status: 'vault locked',
|
|
572
|
+
},
|
|
573
|
+
[],
|
|
574
|
+
];
|
|
575
|
+
}
|
|
576
|
+
return [
|
|
577
|
+
{
|
|
481
578
|
...model,
|
|
482
|
-
phase: 'password',
|
|
483
579
|
metadata: msg.metadata,
|
|
580
|
+
promptEnter: true,
|
|
484
581
|
vaultEntryCount: msg.entryCount,
|
|
485
|
-
status: 'vault
|
|
486
|
-
},
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
...model,
|
|
490
|
-
metadata: msg.metadata,
|
|
491
|
-
promptEnter: true,
|
|
492
|
-
vaultEntryCount: msg.entryCount,
|
|
493
|
-
status: 'vault ready',
|
|
494
|
-
}, []];
|
|
582
|
+
status: 'vault ready',
|
|
583
|
+
},
|
|
584
|
+
[],
|
|
585
|
+
];
|
|
495
586
|
}
|
|
496
587
|
|
|
497
588
|
function handleLoadedEntries(msg, model, deps) {
|
|
498
|
-
if (!sourceEquals(msg.source, model.source)) {
|
|
589
|
+
if (!sourceEquals(msg.source, model.source)) {
|
|
590
|
+
return [model, []];
|
|
591
|
+
}
|
|
499
592
|
const next = syncExplorer(model, {
|
|
500
593
|
entries: msg.entries,
|
|
501
594
|
metadata: msg.metadata,
|
|
@@ -503,14 +596,16 @@ function handleLoadedEntries(msg, model, deps) {
|
|
|
503
596
|
error: null,
|
|
504
597
|
});
|
|
505
598
|
const manifestCmd = maybeLoadSelectedManifest(next, deps);
|
|
506
|
-
return [
|
|
507
|
-
|
|
508
|
-
...(manifestCmd ? [manifestCmd] : []),
|
|
509
|
-
]
|
|
599
|
+
return [
|
|
600
|
+
next,
|
|
601
|
+
[loadStatsCmd(deps.cas, msg.entries, model.source), ...(manifestCmd ? [manifestCmd] : [])],
|
|
602
|
+
];
|
|
510
603
|
}
|
|
511
604
|
|
|
512
605
|
function handleLoadedManifest(msg, model) {
|
|
513
|
-
if (!sourceEquals(msg.source, model.source)) {
|
|
606
|
+
if (!sourceEquals(msg.source, model.source)) {
|
|
607
|
+
return [model, []];
|
|
608
|
+
}
|
|
514
609
|
const manifestCache = new Map(model.manifestCache);
|
|
515
610
|
manifestCache.set(msg.slug, msg.manifest);
|
|
516
611
|
return [syncExplorer(model, { manifestCache, loadingSlug: null }), []];
|
|
@@ -548,17 +643,30 @@ function handleLoadedRefsMsg(msg, model) {
|
|
|
548
643
|
}
|
|
549
644
|
|
|
550
645
|
function handleLoadedStatsMsg(msg, model) {
|
|
551
|
-
if (!sourceEquals(msg.source, model.source)) {
|
|
646
|
+
if (!sourceEquals(msg.source, model.source)) {
|
|
647
|
+
return [model, []];
|
|
648
|
+
}
|
|
552
649
|
return [{ ...model, statsStatus: 'ready', statsReport: msg.stats, statsError: null }, []];
|
|
553
650
|
}
|
|
554
651
|
|
|
555
652
|
function handleLoadedDoctorMsg(msg, model) {
|
|
556
|
-
if (!sourceEquals(msg.source, model.source)) {
|
|
653
|
+
if (!sourceEquals(msg.source, model.source)) {
|
|
654
|
+
return [model, []];
|
|
655
|
+
}
|
|
557
656
|
return [{ ...model, doctorStatus: 'ready', doctorReport: msg.report, doctorError: null }, []];
|
|
558
657
|
}
|
|
559
658
|
|
|
560
659
|
function handleLoadedTreemapMsg(msg, model) {
|
|
561
|
-
return [
|
|
660
|
+
return [
|
|
661
|
+
{
|
|
662
|
+
...model,
|
|
663
|
+
treemapStatus: 'ready',
|
|
664
|
+
treemapReport: msg.report,
|
|
665
|
+
treemapFocus: 0,
|
|
666
|
+
treemapError: null,
|
|
667
|
+
},
|
|
668
|
+
[],
|
|
669
|
+
];
|
|
562
670
|
}
|
|
563
671
|
|
|
564
672
|
function handleLoadedBranchMsg(msg, model) {
|
|
@@ -568,19 +676,34 @@ function handleLoadedBranchMsg(msg, model) {
|
|
|
568
676
|
function handleStoreCompleteMsg(msg, model, deps) {
|
|
569
677
|
const manifestCache = new Map(model.manifestCache);
|
|
570
678
|
manifestCache.set(msg.slug, msg.manifest);
|
|
571
|
-
const next = pushToast(
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
679
|
+
const next = pushToast(
|
|
680
|
+
{
|
|
681
|
+
...syncExplorer(model, { manifestCache, storeWizard: null }),
|
|
682
|
+
operationFeed: completeLatestOperation(model.operationFeed, msg.slug, null),
|
|
683
|
+
},
|
|
684
|
+
{ title: 'Stored asset', message: `${msg.slug} -> ${shortenSha(msg.treeOid)}`, tone: 'SUCCESS' }
|
|
685
|
+
);
|
|
686
|
+
return [
|
|
687
|
+
next,
|
|
688
|
+
[loadEntriesCmd(casForModel(deps.cas, model), model.source), ...notificationTick(next, deps)],
|
|
689
|
+
];
|
|
576
690
|
}
|
|
577
691
|
|
|
578
692
|
function handleStoreErrorMsg(msg, model, deps) {
|
|
579
|
-
const next = pushToast(
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
693
|
+
const next = pushToast(
|
|
694
|
+
{
|
|
695
|
+
...model,
|
|
696
|
+
storeWizard: model.storeWizard
|
|
697
|
+
? { ...model.storeWizard, step: 'error', error: msg.error }
|
|
698
|
+
: null,
|
|
699
|
+
operationFeed: completeLatestOperation(
|
|
700
|
+
model.operationFeed,
|
|
701
|
+
model.storeWizard?.slug ?? 'store',
|
|
702
|
+
msg.error
|
|
703
|
+
),
|
|
704
|
+
},
|
|
705
|
+
{ title: 'Store failed', message: msg.error, tone: 'ERROR' }
|
|
706
|
+
);
|
|
584
707
|
return [next, notificationTick(next, deps)];
|
|
585
708
|
}
|
|
586
709
|
|
|
@@ -608,15 +731,25 @@ function handleAppMsg(msg, model, deps) {
|
|
|
608
731
|
}
|
|
609
732
|
|
|
610
733
|
function handleTitleKey(msg, model, deps) {
|
|
611
|
-
if (msg.key === '`') {
|
|
612
|
-
|
|
613
|
-
|
|
734
|
+
if (msg.key === '`') {
|
|
735
|
+
return [{ ...model, showPerfHud: !model.showPerfHud }, []];
|
|
736
|
+
}
|
|
737
|
+
if (msg.key === 'q' || msg.key === 'escape') {
|
|
738
|
+
return [model, [quit()]];
|
|
739
|
+
}
|
|
740
|
+
if (msg.key === 'enter' && model.promptEnter) {
|
|
741
|
+
return enterDashboard(model, deps);
|
|
742
|
+
}
|
|
614
743
|
return [model, []];
|
|
615
744
|
}
|
|
616
745
|
|
|
617
746
|
function handlePasswordKey(msg, model, deps) {
|
|
618
|
-
if (msg.key === '`') {
|
|
619
|
-
|
|
747
|
+
if (msg.key === '`') {
|
|
748
|
+
return [{ ...model, showPerfHud: !model.showPerfHud }, []];
|
|
749
|
+
}
|
|
750
|
+
if (msg.key === 'escape') {
|
|
751
|
+
return [model, [quit()]];
|
|
752
|
+
}
|
|
620
753
|
if (msg.key === 'enter') {
|
|
621
754
|
return [{ ...model, authError: null }, [verifyPassphraseCmd(deps.cas, model.passphrase)]];
|
|
622
755
|
}
|
|
@@ -657,7 +790,9 @@ function openPalette(model) {
|
|
|
657
790
|
|
|
658
791
|
function selectPaletteItem(model, deps) {
|
|
659
792
|
const item = cpSelectedItem(model.palette);
|
|
660
|
-
if (!item) {
|
|
793
|
+
if (!item) {
|
|
794
|
+
return [{ ...model, palette: null }, []];
|
|
795
|
+
}
|
|
661
796
|
const selected = model.entries.find((entry) => entry.slug === item.id);
|
|
662
797
|
const next = syncExplorer(model, {
|
|
663
798
|
workspace: 'explorer',
|
|
@@ -689,32 +824,50 @@ const PALETTE_KEY_ACTIONS = {
|
|
|
689
824
|
};
|
|
690
825
|
|
|
691
826
|
function paletteAction(msg) {
|
|
692
|
-
if (msg.ctrl && msg.key === 'n') {
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
if (msg.ctrl && msg.key === '
|
|
827
|
+
if (msg.ctrl && msg.key === 'n') {
|
|
828
|
+
return 'next';
|
|
829
|
+
}
|
|
830
|
+
if (msg.ctrl && msg.key === 'p') {
|
|
831
|
+
return 'previous';
|
|
832
|
+
}
|
|
833
|
+
if (msg.ctrl && msg.key === 'd') {
|
|
834
|
+
return 'pageDown';
|
|
835
|
+
}
|
|
836
|
+
if (msg.ctrl && msg.key === 'u') {
|
|
837
|
+
return 'pageUp';
|
|
838
|
+
}
|
|
696
839
|
return PALETTE_KEY_ACTIONS[msg.key] ?? null;
|
|
697
840
|
}
|
|
698
841
|
|
|
699
842
|
function paletteQueryForKey(msg, palette) {
|
|
700
|
-
if (msg.key === 'backspace') {
|
|
701
|
-
|
|
843
|
+
if (msg.key === 'backspace') {
|
|
844
|
+
return palette.query.slice(0, -1);
|
|
845
|
+
}
|
|
846
|
+
if (msg.key.length === 1 && !msg.ctrl && !msg.alt) {
|
|
847
|
+
return `${palette.query}${msg.key}`;
|
|
848
|
+
}
|
|
702
849
|
return null;
|
|
703
850
|
}
|
|
704
851
|
|
|
705
852
|
function handlePaletteKey(msg, model, deps) {
|
|
706
|
-
if (!model.palette) {
|
|
853
|
+
if (!model.palette) {
|
|
854
|
+
return [model, []];
|
|
855
|
+
}
|
|
707
856
|
const action = paletteAction(msg);
|
|
708
|
-
if (action) {
|
|
857
|
+
if (action) {
|
|
858
|
+
return PALETTE_ACTIONS[action](msg, model, deps);
|
|
859
|
+
}
|
|
709
860
|
const query = paletteQueryForKey(msg, model.palette);
|
|
710
|
-
return query === null
|
|
711
|
-
? [model, []]
|
|
712
|
-
: [{ ...model, palette: cpFilter(model.palette, query) }, []];
|
|
861
|
+
return query === null ? [model, []] : [{ ...model, palette: cpFilter(model.palette, query) }, []];
|
|
713
862
|
}
|
|
714
863
|
|
|
715
864
|
function handleFilterKey(msg, model) {
|
|
716
|
-
if (msg.key === 'escape') {
|
|
717
|
-
|
|
865
|
+
if (msg.key === 'escape') {
|
|
866
|
+
return [syncExplorer(model, { filtering: false }), []];
|
|
867
|
+
}
|
|
868
|
+
if (msg.key === 'enter') {
|
|
869
|
+
return [syncExplorer(model, { filtering: false }), []];
|
|
870
|
+
}
|
|
718
871
|
if (msg.key === 'backspace') {
|
|
719
872
|
return [syncExplorer(model, { filterText: model.filterText.slice(0, -1) }), []];
|
|
720
873
|
}
|
|
@@ -736,9 +889,13 @@ const LEDGER_NAVIGATORS = {
|
|
|
736
889
|
};
|
|
737
890
|
|
|
738
891
|
function handleExplorerNavigation(msg, model, deps) {
|
|
739
|
-
if (model.focusPane !== 'ledger') {
|
|
892
|
+
if (model.focusPane !== 'ledger') {
|
|
893
|
+
return null;
|
|
894
|
+
}
|
|
740
895
|
const navigate = LEDGER_NAVIGATORS[msg.key];
|
|
741
|
-
if (!navigate) {
|
|
896
|
+
if (!navigate) {
|
|
897
|
+
return null;
|
|
898
|
+
}
|
|
742
899
|
const next = { ...model, table: navigate(model.table), chunkFocus: 0 };
|
|
743
900
|
const manifestCmd = maybeLoadSelectedManifest(next, deps);
|
|
744
901
|
return [next, manifestCmd ? [manifestCmd] : []];
|
|
@@ -762,19 +919,35 @@ function moveChunkFocus(model, delta) {
|
|
|
762
919
|
}
|
|
763
920
|
|
|
764
921
|
function detailDeltaForKey(key, model) {
|
|
765
|
-
if (key === 'j' || key === 'down') {
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
if (key === '
|
|
922
|
+
if (key === 'j' || key === 'down') {
|
|
923
|
+
return 1;
|
|
924
|
+
}
|
|
925
|
+
if (key === 'k' || key === 'up') {
|
|
926
|
+
return -1;
|
|
927
|
+
}
|
|
928
|
+
if (key === 'd' || key === 'pagedown') {
|
|
929
|
+
return chunkPageStep(model);
|
|
930
|
+
}
|
|
931
|
+
if (key === 'u' || key === 'pageup') {
|
|
932
|
+
return -chunkPageStep(model);
|
|
933
|
+
}
|
|
769
934
|
return null;
|
|
770
935
|
}
|
|
771
936
|
|
|
772
937
|
function handleDetailNavigation(msg, model) {
|
|
773
|
-
if (model.focusPane !== 'detail' || model.explorerMode === 'ledger') {
|
|
774
|
-
|
|
938
|
+
if (model.focusPane !== 'detail' || model.explorerMode === 'ledger') {
|
|
939
|
+
return null;
|
|
940
|
+
}
|
|
941
|
+
if (selectedChunks(model).length === 0) {
|
|
942
|
+
return null;
|
|
943
|
+
}
|
|
775
944
|
const delta = detailDeltaForKey(msg.key, model);
|
|
776
|
-
if (delta !== null) {
|
|
777
|
-
|
|
945
|
+
if (delta !== null) {
|
|
946
|
+
return moveChunkFocus(model, delta);
|
|
947
|
+
}
|
|
948
|
+
if (msg.key === 'g') {
|
|
949
|
+
return [{ ...model, chunkFocus: 0 }, []];
|
|
950
|
+
}
|
|
778
951
|
return null;
|
|
779
952
|
}
|
|
780
953
|
|
|
@@ -782,23 +955,37 @@ function switchWorkspace(model, workspace, deps) {
|
|
|
782
955
|
const next = { ...model, workspace, showHelp: false };
|
|
783
956
|
if (workspace === 'atlas' && next.treemapStatus === 'idle') {
|
|
784
957
|
const cas = casForModel(deps.cas, next);
|
|
785
|
-
return [
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
958
|
+
return [
|
|
959
|
+
{ ...next, treemapStatus: 'loading' },
|
|
960
|
+
[
|
|
961
|
+
loadTreemapCmd(cas, {
|
|
962
|
+
source: next.source,
|
|
963
|
+
scope: next.treemapScope,
|
|
964
|
+
worktreeMode: next.treemapWorktreeMode,
|
|
965
|
+
drillPath: next.treemapPath,
|
|
966
|
+
}),
|
|
967
|
+
],
|
|
968
|
+
];
|
|
791
969
|
}
|
|
792
970
|
if (workspace === 'operations' && next.statsStatus === 'idle') {
|
|
793
|
-
return [
|
|
971
|
+
return [
|
|
972
|
+
{ ...next, statsStatus: 'loading' },
|
|
973
|
+
[loadStatsCmd(deps.cas, next.entries, next.source)],
|
|
974
|
+
];
|
|
794
975
|
}
|
|
795
976
|
return [next, []];
|
|
796
977
|
}
|
|
797
978
|
|
|
798
979
|
function handleWorkspaceKey(msg, model, deps) {
|
|
799
|
-
if (msg.key === '1' || msg.key === 'e') {
|
|
800
|
-
|
|
801
|
-
|
|
980
|
+
if (msg.key === '1' || msg.key === 'e') {
|
|
981
|
+
return switchWorkspace(model, 'explorer', deps);
|
|
982
|
+
}
|
|
983
|
+
if (msg.key === '2' || msg.key === 'a') {
|
|
984
|
+
return switchWorkspace(model, 'atlas', deps);
|
|
985
|
+
}
|
|
986
|
+
if (msg.key === '3' || msg.key === 'o') {
|
|
987
|
+
return switchWorkspace(model, 'operations', deps);
|
|
988
|
+
}
|
|
802
989
|
return null;
|
|
803
990
|
}
|
|
804
991
|
|
|
@@ -830,9 +1017,15 @@ function toggleInspectorMode(model, deps) {
|
|
|
830
1017
|
}
|
|
831
1018
|
|
|
832
1019
|
function handleExplorerModeKey(msg, model, deps) {
|
|
833
|
-
if (msg.key === 'enter') {
|
|
834
|
-
|
|
835
|
-
|
|
1020
|
+
if (msg.key === 'enter') {
|
|
1021
|
+
return toggleExplorerDetail(model, deps);
|
|
1022
|
+
}
|
|
1023
|
+
if (msg.key === 'm') {
|
|
1024
|
+
return cycleMerkleMode(model);
|
|
1025
|
+
}
|
|
1026
|
+
if (msg.key === 'i') {
|
|
1027
|
+
return toggleInspectorMode(model, deps);
|
|
1028
|
+
}
|
|
836
1029
|
return null;
|
|
837
1030
|
}
|
|
838
1031
|
|
|
@@ -841,26 +1034,38 @@ function handleExplorerKey(msg, model, deps) {
|
|
|
841
1034
|
return [{ ...model, focusPane: model.focusPane === 'ledger' ? 'detail' : 'ledger' }, []];
|
|
842
1035
|
}
|
|
843
1036
|
const detailNav = handleDetailNavigation(msg, model);
|
|
844
|
-
if (detailNav) {
|
|
1037
|
+
if (detailNav) {
|
|
1038
|
+
return detailNav;
|
|
1039
|
+
}
|
|
845
1040
|
const nav = handleExplorerNavigation(msg, model, deps);
|
|
846
|
-
if (nav) {
|
|
1041
|
+
if (nav) {
|
|
1042
|
+
return nav;
|
|
1043
|
+
}
|
|
847
1044
|
return handleExplorerModeKey(msg, model, deps);
|
|
848
1045
|
}
|
|
849
1046
|
|
|
850
1047
|
function reloadTreemap(model, deps, patch = {}) {
|
|
851
1048
|
const next = { ...model, ...patch, treemapStatus: 'loading', treemapError: null };
|
|
852
|
-
return [
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
1049
|
+
return [
|
|
1050
|
+
next,
|
|
1051
|
+
[
|
|
1052
|
+
loadTreemapCmd(casForModel(deps.cas, next), {
|
|
1053
|
+
source: next.source,
|
|
1054
|
+
scope: next.treemapScope,
|
|
1055
|
+
worktreeMode: next.treemapWorktreeMode,
|
|
1056
|
+
drillPath: next.treemapPath,
|
|
1057
|
+
}),
|
|
1058
|
+
],
|
|
1059
|
+
];
|
|
858
1060
|
}
|
|
859
1061
|
|
|
860
1062
|
function focusAtlasTile(model, delta) {
|
|
861
1063
|
const tiles = model.treemapReport?.tiles ?? [];
|
|
862
1064
|
const maxFocus = Math.max(0, tiles.length - 1);
|
|
863
|
-
return [
|
|
1065
|
+
return [
|
|
1066
|
+
{ ...model, treemapFocus: Math.max(0, Math.min(model.treemapFocus + delta, maxFocus)) },
|
|
1067
|
+
[],
|
|
1068
|
+
];
|
|
864
1069
|
}
|
|
865
1070
|
|
|
866
1071
|
function drillIntoAtlasTile(model, deps) {
|
|
@@ -893,8 +1098,16 @@ const ATLAS_KEY_ACTIONS = {
|
|
|
893
1098
|
const ATLAS_ACTIONS = {
|
|
894
1099
|
next: (_msg, model) => focusAtlasTile(model, 1),
|
|
895
1100
|
previous: (_msg, model) => focusAtlasTile(model, -1),
|
|
896
|
-
scope: (_msg, model, deps) =>
|
|
897
|
-
|
|
1101
|
+
scope: (_msg, model, deps) =>
|
|
1102
|
+
reloadTreemap(model, deps, {
|
|
1103
|
+
treemapScope: model.treemapScope === 'repository' ? 'source' : 'repository',
|
|
1104
|
+
treemapPath: [],
|
|
1105
|
+
}),
|
|
1106
|
+
worktreeMode: (_msg, model, deps) =>
|
|
1107
|
+
reloadTreemap(model, deps, {
|
|
1108
|
+
treemapWorktreeMode: model.treemapWorktreeMode === 'tracked' ? 'ignored' : 'tracked',
|
|
1109
|
+
treemapPath: [],
|
|
1110
|
+
}),
|
|
898
1111
|
reload: (_msg, model, deps) => reloadTreemap(model, deps),
|
|
899
1112
|
drillIn: (_msg, model, deps) => drillIntoAtlasTile(model, deps),
|
|
900
1113
|
drillOut: (_msg, model, deps) => drillOutAtlasTile(model, deps),
|
|
@@ -908,17 +1121,20 @@ function handleAtlasKey(msg, model, deps) {
|
|
|
908
1121
|
function startOperation(operationFeed, slug) {
|
|
909
1122
|
return {
|
|
910
1123
|
...operationFeed,
|
|
911
|
-
entries: [
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
1124
|
+
entries: [
|
|
1125
|
+
{
|
|
1126
|
+
id: `store-${slug}-${Date.now()}`,
|
|
1127
|
+
type: 'store',
|
|
1128
|
+
slug,
|
|
1129
|
+
status: 'running',
|
|
1130
|
+
startTime: Date.now(),
|
|
1131
|
+
endTime: null,
|
|
1132
|
+
chunksTotal: 0,
|
|
1133
|
+
chunksProcessed: 0,
|
|
1134
|
+
error: null,
|
|
1135
|
+
},
|
|
1136
|
+
...operationFeed.entries,
|
|
1137
|
+
].slice(0, operationFeed.maxEntries),
|
|
922
1138
|
};
|
|
923
1139
|
}
|
|
924
1140
|
|
|
@@ -926,7 +1142,9 @@ function completeLatestOperation(operationFeed, slug, error) {
|
|
|
926
1142
|
return {
|
|
927
1143
|
...operationFeed,
|
|
928
1144
|
entries: operationFeed.entries.map((entry, index) => {
|
|
929
|
-
if (index !== 0 || entry.slug !== slug) {
|
|
1145
|
+
if (index !== 0 || entry.slug !== slug) {
|
|
1146
|
+
return entry;
|
|
1147
|
+
}
|
|
930
1148
|
return {
|
|
931
1149
|
...entry,
|
|
932
1150
|
status: error ? 'error' : 'done',
|
|
@@ -938,42 +1156,59 @@ function completeLatestOperation(operationFeed, slug, error) {
|
|
|
938
1156
|
}
|
|
939
1157
|
|
|
940
1158
|
function handleWizardKey(msg, model, deps) {
|
|
941
|
-
if (!model.storeWizard) {
|
|
1159
|
+
if (!model.storeWizard) {
|
|
1160
|
+
return null;
|
|
1161
|
+
}
|
|
942
1162
|
if (msg.key === 'escape') {
|
|
943
1163
|
return [{ ...model, storeWizard: null }, []];
|
|
944
1164
|
}
|
|
945
1165
|
const nextWizard = wizardHandleKey(model.storeWizard, msg.key);
|
|
946
1166
|
if (nextWizard.step === 'storing') {
|
|
947
|
-
return [
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
1167
|
+
return [
|
|
1168
|
+
{
|
|
1169
|
+
...model,
|
|
1170
|
+
storeWizard: nextWizard,
|
|
1171
|
+
operationFeed: startOperation(model.operationFeed, nextWizard.slug),
|
|
1172
|
+
},
|
|
1173
|
+
[runStoreWizardCmd(casForModel(deps.cas, model), nextWizard)],
|
|
1174
|
+
];
|
|
952
1175
|
}
|
|
953
1176
|
return [{ ...model, storeWizard: nextWizard }, []];
|
|
954
1177
|
}
|
|
955
1178
|
|
|
956
1179
|
function handleOperationsKey(msg, model, deps) {
|
|
957
|
-
if (msg.key === 'n') {
|
|
1180
|
+
if (msg.key === 'n') {
|
|
1181
|
+
return [{ ...model, storeWizard: createWizardState() }, []];
|
|
1182
|
+
}
|
|
958
1183
|
if (msg.key === 's') {
|
|
959
|
-
return [
|
|
1184
|
+
return [
|
|
1185
|
+
{ ...model, statsStatus: 'loading', statsError: null },
|
|
1186
|
+
[loadStatsCmd(deps.cas, model.entries, model.source)],
|
|
1187
|
+
];
|
|
960
1188
|
}
|
|
961
1189
|
if (msg.key === 'x') {
|
|
962
|
-
return [
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
1190
|
+
return [
|
|
1191
|
+
{
|
|
1192
|
+
...model,
|
|
1193
|
+
doctorStatus: 'loading',
|
|
1194
|
+
doctorError: null,
|
|
1195
|
+
},
|
|
1196
|
+
[
|
|
1197
|
+
loadDoctorCmd(deps.cas, {
|
|
1198
|
+
source: model.source,
|
|
1199
|
+
entries: model.entries,
|
|
1200
|
+
encryptionKey: model.vaultEncryptionKey,
|
|
1201
|
+
}),
|
|
1202
|
+
],
|
|
1203
|
+
];
|
|
971
1204
|
}
|
|
972
1205
|
return null;
|
|
973
1206
|
}
|
|
974
1207
|
|
|
975
1208
|
function handleQuitConfirmKey(msg, model) {
|
|
976
|
-
if (msg.key === 'y' || msg.key === 'enter') {
|
|
1209
|
+
if (msg.key === 'y' || msg.key === 'enter') {
|
|
1210
|
+
return [model, [quit()]];
|
|
1211
|
+
}
|
|
977
1212
|
if (msg.key === 'n' || msg.key === 'escape' || msg.key === 'q') {
|
|
978
1213
|
return [{ ...model, quitConfirm: false }, []];
|
|
979
1214
|
}
|
|
@@ -993,12 +1228,18 @@ function clearDashboardOverlays(model) {
|
|
|
993
1228
|
}
|
|
994
1229
|
|
|
995
1230
|
function handleOverlayShortcut(msg, model) {
|
|
996
|
-
if (msg.key === 'escape') {
|
|
997
|
-
|
|
1231
|
+
if (msg.key === 'escape') {
|
|
1232
|
+
return [clearDashboardOverlays(model), []];
|
|
1233
|
+
}
|
|
1234
|
+
if (msg.key === 'f2') {
|
|
1235
|
+
return [{ ...model, settingsOpen: !model.settingsOpen, showHelp: false, palette: null }, []];
|
|
1236
|
+
}
|
|
998
1237
|
if (msg.key === '?' || (msg.shift && msg.key === '/')) {
|
|
999
1238
|
return [{ ...model, showHelp: !model.showHelp, palette: null }, []];
|
|
1000
1239
|
}
|
|
1001
|
-
if (msg.key === 'q') {
|
|
1240
|
+
if (msg.key === 'q') {
|
|
1241
|
+
return [{ ...model, quitConfirm: true }, []];
|
|
1242
|
+
}
|
|
1002
1243
|
return null;
|
|
1003
1244
|
}
|
|
1004
1245
|
|
|
@@ -1006,15 +1247,21 @@ function handleSearchShortcut(msg, model) {
|
|
|
1006
1247
|
if (msg.key === '/' && !msg.ctrl) {
|
|
1007
1248
|
return [syncExplorer(model, { workspace: 'explorer', filtering: true, palette: null }), []];
|
|
1008
1249
|
}
|
|
1009
|
-
if ((msg.ctrl && msg.key === 'p') || msg.key === ':') {
|
|
1250
|
+
if ((msg.ctrl && msg.key === 'p') || msg.key === ':') {
|
|
1251
|
+
return [openPalette(model), []];
|
|
1252
|
+
}
|
|
1010
1253
|
return null;
|
|
1011
1254
|
}
|
|
1012
1255
|
|
|
1013
1256
|
function handleGlobalDashboardKey(msg, model, deps) {
|
|
1014
1257
|
const overlay = handleOverlayShortcut(msg, model);
|
|
1015
|
-
if (overlay) {
|
|
1258
|
+
if (overlay) {
|
|
1259
|
+
return overlay;
|
|
1260
|
+
}
|
|
1016
1261
|
const search = handleSearchShortcut(msg, model);
|
|
1017
|
-
if (search) {
|
|
1262
|
+
if (search) {
|
|
1263
|
+
return search;
|
|
1264
|
+
}
|
|
1018
1265
|
return handleWorkspaceKey(msg, model, deps);
|
|
1019
1266
|
}
|
|
1020
1267
|
|
|
@@ -1030,19 +1277,31 @@ function handleWorkspaceSpecificKey(msg, model, deps) {
|
|
|
1030
1277
|
}
|
|
1031
1278
|
|
|
1032
1279
|
function handleDashboardKey(msg, model, deps) {
|
|
1033
|
-
if (model.quitConfirm) {
|
|
1034
|
-
|
|
1280
|
+
if (model.quitConfirm) {
|
|
1281
|
+
return handleQuitConfirmKey(msg, model);
|
|
1282
|
+
}
|
|
1283
|
+
if (model.palette) {
|
|
1284
|
+
return handlePaletteKey(msg, model, deps);
|
|
1285
|
+
}
|
|
1035
1286
|
const wizard = handleWizardKey(msg, model, deps);
|
|
1036
|
-
if (wizard) {
|
|
1037
|
-
|
|
1287
|
+
if (wizard) {
|
|
1288
|
+
return wizard;
|
|
1289
|
+
}
|
|
1290
|
+
if (model.filtering) {
|
|
1291
|
+
return handleFilterKey(msg, model);
|
|
1292
|
+
}
|
|
1038
1293
|
const global = handleGlobalDashboardKey(msg, model, deps);
|
|
1039
1294
|
return global ?? handleWorkspaceSpecificKey(msg, model, deps) ?? [model, []];
|
|
1040
1295
|
}
|
|
1041
1296
|
|
|
1042
1297
|
function handleUpdate(msg, model, deps) {
|
|
1043
1298
|
if (msg.type === 'key') {
|
|
1044
|
-
if (model.phase === 'title') {
|
|
1045
|
-
|
|
1299
|
+
if (model.phase === 'title') {
|
|
1300
|
+
return handleTitleKey(msg, model, deps);
|
|
1301
|
+
}
|
|
1302
|
+
if (model.phase === 'password') {
|
|
1303
|
+
return handlePasswordKey(msg, model, deps);
|
|
1304
|
+
}
|
|
1046
1305
|
return handleDashboardKey(msg, model, deps);
|
|
1047
1306
|
}
|
|
1048
1307
|
if (msg.type === 'resize') {
|
|
@@ -1053,10 +1312,10 @@ function handleUpdate(msg, model, deps) {
|
|
|
1053
1312
|
|
|
1054
1313
|
export function createDashboardApp(deps) {
|
|
1055
1314
|
return {
|
|
1056
|
-
init: () => [
|
|
1057
|
-
|
|
1058
|
-
deps.tick(TITLE_TICK_MS, { type: 'title-tick' }),
|
|
1059
|
-
]
|
|
1315
|
+
init: () => [
|
|
1316
|
+
createInitModel(deps.ctx, deps.source),
|
|
1317
|
+
[checkVaultAuthCmd(deps.cas), deps.tick(TITLE_TICK_MS, { type: 'title-tick' })],
|
|
1318
|
+
],
|
|
1060
1319
|
update: (msg, model) => handleUpdate(msg, model, deps),
|
|
1061
1320
|
view: (model) => renderDashboard(model, deps),
|
|
1062
1321
|
};
|