feat: add settings snapshot rollback workbench
这个提交存在于:
父节点
024248ad19
当前提交
f1f4cf6e18
共有 10 个文件被更改,包括 93 次插入 和 26 次删除
|
|
@ -40,6 +40,8 @@ export const endpoints = {
|
|||
settingsReload: "settings/reload",
|
||||
settingsExport: "settings/export",
|
||||
settingsImport: "settings/import",
|
||||
settingsSnapshots: "settings/snapshots",
|
||||
settingsRollback: "settings/rollback",
|
||||
storageStatus: "storage/status",
|
||||
mediaSign: "media/sign",
|
||||
materialCategories: "material-categories",
|
||||
|
|
|
|||
|
|
@ -48,3 +48,17 @@ export interface ImportSettingsResult {
|
|||
saved: boolean
|
||||
config: Record<string, unknown>
|
||||
}
|
||||
|
||||
export interface SettingsSnapshot {
|
||||
snapshot_id: string
|
||||
reason: string
|
||||
actor_id?: string | null
|
||||
config: Record<string, unknown>
|
||||
created_at: string
|
||||
}
|
||||
|
||||
export interface RollbackSettingsResult {
|
||||
rolled_back: boolean
|
||||
snapshot_id: string
|
||||
config: Record<string, unknown>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,8 +18,10 @@ import type {
|
|||
ExportSettingsResult,
|
||||
ImportSettingsResult,
|
||||
ReloadSettingsResult,
|
||||
RollbackSettingsResult,
|
||||
SaveSettingsResult,
|
||||
SettingsSchema,
|
||||
SettingsSnapshot,
|
||||
ValidateSettingsResult,
|
||||
} from "../../shared/types/settings"
|
||||
import type { MediaSignResult, StorageStatus } from "../../shared/types/storage"
|
||||
|
|
@ -201,6 +203,10 @@ const text = {
|
|||
importSettings: "\u5bfc\u5165\u8bbe\u7f6e",
|
||||
importDone: "\u8bbe\u7f6e\u5df2\u5bfc\u5165",
|
||||
importDraftInvalid: "\u5bfc\u5165 JSON \u683c\u5f0f\u65e0\u6548",
|
||||
snapshots: "\u914d\u7f6e\u5feb\u7167",
|
||||
loadSnapshots: "\u52a0\u8f7d\u5feb\u7167",
|
||||
rollback: "\u56de\u6eda",
|
||||
rollbackDone: "\u914d\u7f6e\u5df2\u56de\u6eda",
|
||||
settingsEditor: "\u914d\u7f6e\u7f16\u8f91",
|
||||
settingsDraftInvalid: "\u914d\u7f6e JSON \u683c\u5f0f\u65e0\u6548",
|
||||
settingsSaved: "\u8bbe\u7f6e\u5df2\u4fdd\u5b58",
|
||||
|
|
@ -249,6 +255,7 @@ const logs = ref<LogBundle>({ generation: [], workflows: [], errors: [], integra
|
|||
const signedMedia = ref<MediaSignResult | null>(null)
|
||||
const settingsDraft = ref("")
|
||||
const settingsImportDraft = ref("")
|
||||
const settingsSnapshots = ref<SettingsSnapshot[]>([])
|
||||
const settingsValidation = ref<ValidateSettingsResult | null>(null)
|
||||
const settingsDiff = ref<DiffSettingsResult | null>(null)
|
||||
const profileDraft = ref({
|
||||
|
|
@ -1172,6 +1179,32 @@ function importSettingsDraft() {
|
|||
)
|
||||
}
|
||||
|
||||
function loadSettingsSnapshots() {
|
||||
return runOperation(
|
||||
text.loadSnapshots,
|
||||
async () => {
|
||||
settingsSnapshots.value = await getJson<SettingsSnapshot[]>(endpoints.settingsSnapshots, { limit: 20 })
|
||||
return settingsSnapshots.value
|
||||
},
|
||||
false,
|
||||
)
|
||||
}
|
||||
|
||||
function rollbackSettingsSnapshot(snapshotId: string) {
|
||||
return runOperation(
|
||||
text.rollback,
|
||||
async () => {
|
||||
const result = await postJson<RollbackSettingsResult>(endpoints.settingsRollback, { snapshot_id: snapshotId })
|
||||
currentSettings.value = { config_path: currentSettings.value?.config_path ?? "***PATH***", config: result.config }
|
||||
resetSettingsDraft(result.config)
|
||||
await loadSettingsSnapshots()
|
||||
lastOperation.value = text.rollbackDone
|
||||
return result
|
||||
},
|
||||
false,
|
||||
)
|
||||
}
|
||||
|
||||
function signFirstMaterial() {
|
||||
const uri = materials.value?.items.find((item) => item.image_uri?.startsWith("storage://"))?.image_uri
|
||||
if (!uri) {
|
||||
|
|
@ -2218,6 +2251,7 @@ function storageRootBytes(uriPrefix: string) {
|
|||
<button type="button" :disabled="Boolean(busy)" @click="diffSettingsDraft">{{ text.diff }}</button>
|
||||
<button type="button" :disabled="Boolean(busy)" @click="saveSettingsDraft">{{ text.save }}</button>
|
||||
<button type="button" :disabled="Boolean(busy)" @click="exportSettings">{{ text.exportRedacted }}</button>
|
||||
<button type="button" :disabled="Boolean(busy)" @click="loadSettingsSnapshots">{{ text.loadSnapshots }}</button>
|
||||
</div>
|
||||
<div class="settings-sections">
|
||||
<article v-for="section in settingsSchema?.sections ?? []" :key="section.key">
|
||||
|
|
@ -2241,6 +2275,23 @@ function storageRootBytes(uriPrefix: string) {
|
|||
</header>
|
||||
<textarea v-model="settingsImportDraft" spellcheck="false" />
|
||||
</section>
|
||||
<section class="editor-panel">
|
||||
<header>
|
||||
<h2>{{ text.snapshots }}</h2>
|
||||
<span>{{ settingsSnapshots.length }}</span>
|
||||
</header>
|
||||
<ul>
|
||||
<li v-for="snapshot in settingsSnapshots" :key="snapshot.snapshot_id">
|
||||
<div>
|
||||
<strong>{{ snapshot.reason }}</strong>
|
||||
<small>{{ snapshot.snapshot_id }} / {{ snapshot.created_at }}</small>
|
||||
</div>
|
||||
<button type="button" :disabled="Boolean(busy)" @click="rollbackSettingsSnapshot(snapshot.snapshot_id)">
|
||||
{{ text.rollback }}
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
<div class="split-view">
|
||||
<div class="list-view">
|
||||
<header>
|
||||
|
|
|
|||
文件差异因一行或多行过长而隐藏
|
|
@ -1,3 +1,3 @@
|
|||
<script type="module" crossorigin src="/assets/index-qwpM8MfX.js"></script>
|
||||
<script type="module" crossorigin src="/assets/index-BTVLk-aV.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-KxvCyOGk.css">
|
||||
<div id="app"></div>
|
||||
|
|
|
|||
文件差异因一行或多行过长而隐藏
文件差异因一行或多行过长而隐藏
文件差异因一行或多行过长而隐藏
17
web/assets/index-D8LANsZc.js
普通文件
17
web/assets/index-D8LANsZc.js
普通文件
文件差异因一行或多行过长而隐藏
|
|
@ -1,3 +1,3 @@
|
|||
<script type="module" crossorigin src="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-D3ylcAeI.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-BULwMWcy.css">
|
||||
<script type="module" crossorigin src="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-D8LANsZc.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-B4u_EVSo.css">
|
||||
<div id="app"></div>
|
||||
|
|
|
|||
正在加载…
添加表格
在新工单中引用