feat: expose storage migration dry run in frontend
这个提交存在于:
父节点
1198b9ae34
当前提交
aa314b71f2
共有 10 个文件被更改,包括 102 次插入 和 23 次删除
|
|
@ -49,6 +49,7 @@ export const endpoints = {
|
||||||
settingsSnapshot: (snapshotId: string) => `settings/snapshots/${snapshotId}`,
|
settingsSnapshot: (snapshotId: string) => `settings/snapshots/${snapshotId}`,
|
||||||
settingsRollback: "settings/rollback",
|
settingsRollback: "settings/rollback",
|
||||||
storageStatus: "storage/status",
|
storageStatus: "storage/status",
|
||||||
|
storageMigrate: "storage/migrate",
|
||||||
mediaSign: "media/sign",
|
mediaSign: "media/sign",
|
||||||
materialCategories: "material-categories",
|
materialCategories: "material-categories",
|
||||||
materialCategory: (categoryId: string) => `material-categories/${categoryId}`,
|
materialCategory: (categoryId: string) => `material-categories/${categoryId}`,
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,17 @@ export interface StorageStatus {
|
||||||
total_bytes: number
|
total_bytes: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface StorageMigrationPlan {
|
||||||
|
dry_run: boolean
|
||||||
|
status: string
|
||||||
|
source_uri: string
|
||||||
|
target_uri: string
|
||||||
|
files: number
|
||||||
|
bytes: number
|
||||||
|
will_overwrite: boolean
|
||||||
|
execution_enabled: boolean
|
||||||
|
}
|
||||||
|
|
||||||
export interface MediaSignResult {
|
export interface MediaSignResult {
|
||||||
uri: string
|
uri: string
|
||||||
token: string
|
token: string
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ import type {
|
||||||
SettingsSnapshot,
|
SettingsSnapshot,
|
||||||
ValidateSettingsResult,
|
ValidateSettingsResult,
|
||||||
} from "../../shared/types/settings"
|
} from "../../shared/types/settings"
|
||||||
import type { MediaSignResult, StorageStatus } from "../../shared/types/storage"
|
import type { MediaSignResult, StorageMigrationPlan, StorageStatus } from "../../shared/types/storage"
|
||||||
import type { WardrobeItem, WardrobeMatchResult } from "../../shared/types/wardrobe"
|
import type { WardrobeItem, WardrobeMatchResult } from "../../shared/types/wardrobe"
|
||||||
import type {
|
import type {
|
||||||
ProfileWorkflow,
|
ProfileWorkflow,
|
||||||
|
|
@ -230,6 +230,11 @@ const text = {
|
||||||
validationResult: "\u6821\u9a8c\u7ed3\u679c",
|
validationResult: "\u6821\u9a8c\u7ed3\u679c",
|
||||||
diffResult: "\u53d8\u66f4\u5bf9\u6bd4",
|
diffResult: "\u53d8\u66f4\u5bf9\u6bd4",
|
||||||
storage: "\u5b58\u50a8",
|
storage: "\u5b58\u50a8",
|
||||||
|
storageMigrate: "\u8fc1\u79fb\u9884\u68c0",
|
||||||
|
sourceUri: "\u6e90 URI",
|
||||||
|
targetUri: "\u76ee\u6807 URI",
|
||||||
|
fileCount: "\u6587\u4ef6\u6570",
|
||||||
|
dryRun: "DryRun",
|
||||||
running: "\u8fd0\u884c",
|
running: "\u8fd0\u884c",
|
||||||
} as const
|
} as const
|
||||||
|
|
||||||
|
|
@ -273,6 +278,7 @@ const logs = ref<LogBundle>({ generation: [], workflows: [], errors: [], integra
|
||||||
const integrationEventLogs = ref<LogBundle["integrations"]>([])
|
const integrationEventLogs = ref<LogBundle["integrations"]>([])
|
||||||
const eventStream = ref<EventStreamResult | null>(null)
|
const eventStream = ref<EventStreamResult | null>(null)
|
||||||
const signedMedia = ref<MediaSignResult | null>(null)
|
const signedMedia = ref<MediaSignResult | null>(null)
|
||||||
|
const storageMigrationPlan = ref<StorageMigrationPlan | null>(null)
|
||||||
const settingsDraft = ref("")
|
const settingsDraft = ref("")
|
||||||
const settingsImportDraft = ref("")
|
const settingsImportDraft = ref("")
|
||||||
const settingsSnapshots = ref<SettingsSnapshot[]>([])
|
const settingsSnapshots = ref<SettingsSnapshot[]>([])
|
||||||
|
|
@ -381,6 +387,10 @@ const materialUploadDraft = ref({
|
||||||
image_uri: "",
|
image_uri: "",
|
||||||
category_id: "",
|
category_id: "",
|
||||||
})
|
})
|
||||||
|
const storageMigrationDraft = ref({
|
||||||
|
source_uri: "storage://images/sample.bin",
|
||||||
|
target_uri: "storage://archives/sample.bin",
|
||||||
|
})
|
||||||
const categoryDraft = ref({
|
const categoryDraft = ref({
|
||||||
category_id: "",
|
category_id: "",
|
||||||
name: "",
|
name: "",
|
||||||
|
|
@ -1607,6 +1617,21 @@ function formatBytes(value = 0) {
|
||||||
function storageRootBytes(uriPrefix: string) {
|
function storageRootBytes(uriPrefix: string) {
|
||||||
return storage.value?.roots.find((root) => root.uri_prefix === uriPrefix)?.bytes ?? 0
|
return storage.value?.roots.find((root) => root.uri_prefix === uriPrefix)?.bytes ?? 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function planStorageMigration() {
|
||||||
|
return runOperation(
|
||||||
|
text.storageMigrate,
|
||||||
|
async () => {
|
||||||
|
storageMigrationPlan.value = await postJson<StorageMigrationPlan>(endpoints.storageMigrate, {
|
||||||
|
source_uri: storageMigrationDraft.value.source_uri,
|
||||||
|
target_uri: storageMigrationDraft.value.target_uri,
|
||||||
|
dry_run: true,
|
||||||
|
})
|
||||||
|
return storageMigrationPlan.value
|
||||||
|
},
|
||||||
|
false,
|
||||||
|
)
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -2768,6 +2793,38 @@ function storageRootBytes(uriPrefix: string) {
|
||||||
<dd>{{ formatBytes(storageRootBytes("storage://materials/")) }}</dd>
|
<dd>{{ formatBytes(storageRootBytes("storage://materials/")) }}</dd>
|
||||||
</div>
|
</div>
|
||||||
</dl>
|
</dl>
|
||||||
|
<h2>{{ text.storageMigrate }}</h2>
|
||||||
|
<div class="inspector-form">
|
||||||
|
<label>
|
||||||
|
<span>{{ text.sourceUri }}</span>
|
||||||
|
<input v-model="storageMigrationDraft.source_uri" type="text" />
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
<span>{{ text.targetUri }}</span>
|
||||||
|
<input v-model="storageMigrationDraft.target_uri" type="text" />
|
||||||
|
</label>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
:disabled="Boolean(busy) || !storageMigrationDraft.source_uri || !storageMigrationDraft.target_uri"
|
||||||
|
@click="planStorageMigration"
|
||||||
|
>
|
||||||
|
{{ text.storageMigrate }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<dl v-if="storageMigrationPlan">
|
||||||
|
<div>
|
||||||
|
<dt>{{ text.fileCount }}</dt>
|
||||||
|
<dd>{{ storageMigrationPlan.files }}</dd>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<dt>{{ text.storage }}</dt>
|
||||||
|
<dd>{{ formatBytes(storageMigrationPlan.bytes) }}</dd>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<dt>{{ text.dryRun }}</dt>
|
||||||
|
<dd>{{ storageMigrationPlan.dry_run }}</dd>
|
||||||
|
</div>
|
||||||
|
</dl>
|
||||||
</aside>
|
</aside>
|
||||||
</main>
|
</main>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -2973,6 +3030,16 @@ article strong {
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.inspector-form {
|
||||||
|
display: grid;
|
||||||
|
gap: 10px;
|
||||||
|
margin: 12px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.inspector-form button {
|
||||||
|
padding: 0 12px;
|
||||||
|
}
|
||||||
|
|
||||||
.editor-panel header {
|
.editor-panel header {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|
|
||||||
文件差异因一行或多行过长而隐藏
|
|
@ -1,3 +1,3 @@
|
||||||
<script type="module" crossorigin src="/assets/index-DjwdLJJW.js"></script>
|
<script type="module" crossorigin src="/assets/index-mEivAbcm.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-DJ52Rx93.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-DJ52Rx93.css">
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
|
|
||||||
17
web/assets/index-1P8ns5-A.js
普通文件
17
web/assets/index-1P8ns5-A.js
普通文件
文件差异因一行或多行过长而隐藏
文件差异因一行或多行过长而隐藏
文件差异因一行或多行过长而隐藏
文件差异因一行或多行过长而隐藏
|
|
@ -1,3 +1,3 @@
|
||||||
<script type="module" crossorigin src="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-9Cck2_2L.js"></script>
|
<script type="module" crossorigin src="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-1P8ns5-A.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-DMu8Cdtx.css">
|
<link rel="stylesheet" crossorigin href="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-BA90ZIGa.css">
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
|
|
||||||
正在加载…
添加表格
在新工单中引用