fix(core): some storage setting enhancements (#9877)

fix AF-2157, AF-2155, AF-2156
1. add shift selection for grid blob card
2. various style issues
3. unused blobs list will also wait for workspace syncing
This commit is contained in:
pengx17
2025-01-24 04:35:54 +00:00
parent c0eb735890
commit 6a74107010
13 changed files with 189 additions and 101 deletions

View File

@@ -8,7 +8,17 @@ import {
onStart,
} from '@toeverything/infra';
import { fileTypeFromBuffer } from 'file-type';
import { EMPTY, mergeMap, switchMap } from 'rxjs';
import {
combineLatest,
EMPTY,
filter,
firstValueFrom,
fromEvent,
map,
mergeMap,
switchMap,
takeUntil,
} from 'rxjs';
import type { DocsSearchService } from '../../docs-search';
import type { WorkspaceService } from '../../workspace';
@@ -91,10 +101,22 @@ export class UnusedBlobs extends Entity {
}
async getUnusedBlobs(abortSignal?: AbortSignal) {
// wait for the indexer to finish
await this.docsSearchService.indexer.status$.waitFor(
status => status.remaining === undefined || status.remaining === 0,
// Wait for both sync and indexing to complete
const ready$ = combineLatest([
this.workspaceService.workspace.engine.doc.state$.pipe(
filter(state => state.syncing === 0 && !state.syncRetrying)
),
this.docsSearchService.indexer.status$.pipe(
filter(
status => status.remaining === undefined || status.remaining === 0
)
),
]).pipe(map(() => true));
await firstValueFrom(
abortSignal
? ready$.pipe(takeUntil(fromEvent(abortSignal, 'abort')))
: ready$
);
const [blobs, usedBlobs] = await Promise.all([