mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-12 23:31:02 +00:00
feat(storage): show running checks, confirmations and the nightly result in Admin > Storage
The panels follow the reworked reclaim state: Check now starts a check in the background and the panel polls until it is done, a category with an unusually large share of unused files offers Confirm, Freed comes from the last run that deleted, a stopped check says why and no longer reads as nothing found, the switch waits for its answer and a poll that was in flight cannot flip it back, and refusals name their reason in the operator's language. Strings updated in all 28 languages.
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
import type { StorageReclaimReport, StorageReclaimState } from '@trek/shared';
|
||||
import type { StorageReclaimConfirmRequest, StorageReclaimState } from '@trek/shared';
|
||||
import { apiClient } from './client';
|
||||
|
||||
/** Admin > Storage, unreferenced files: the nightly deletion switch and a check on demand. */
|
||||
/** Admin > Storage, unreferenced files: the nightly deletion switch, a check on demand, and the large-share confirmation. */
|
||||
export const storageReclaimApi = {
|
||||
setDelete: (deleteEnabled: boolean): Promise<StorageReclaimState> =>
|
||||
apiClient.put('/admin/storage/reclaim', { deleteEnabled }).then((r) => r.data),
|
||||
// A check lists every reclaimable category and asks each domain about it; a
|
||||
// large bucket outlasts the 8s instance timeout. It only reports, whatever the switch says.
|
||||
check: (): Promise<StorageReclaimReport> =>
|
||||
apiClient.post('/admin/storage/reclaim/run', { reportOnly: true }, { timeout: 300_000 }).then((r) => r.data),
|
||||
/** Starts a report-only check in the background (202); its report arrives through the admin state. */
|
||||
check: (): Promise<{ started: true }> => apiClient.post('/admin/storage/reclaim/run').then((r) => r.data),
|
||||
confirm: (category: StorageReclaimConfirmRequest['category']): Promise<StorageReclaimState> =>
|
||||
apiClient
|
||||
.post('/admin/storage/reclaim/confirm', { category } satisfies StorageReclaimConfirmRequest)
|
||||
.then((r) => r.data),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user