mirror of
https://github.com/AstrBotDevs/AstrBot.git
synced 2026-08-31 01:40:25 +08:00
fix: show progress when saving plugin config (#9327)
* fix: show progress when saving plugin config * fix: normalize error message shown when saving plugin config fails * feat: animate plugin config save progress dialog
This commit is contained in:
@@ -498,7 +498,12 @@ const updateDialogPluginLogo = computed(() => {
|
||||
</v-dialog>
|
||||
|
||||
<!-- 加载对话框 -->
|
||||
<v-dialog v-model="loadingDialog.show" width="700" persistent>
|
||||
<v-dialog
|
||||
v-model="loadingDialog.show"
|
||||
width="700"
|
||||
persistent
|
||||
transition="dialog-transition"
|
||||
>
|
||||
<v-card>
|
||||
<v-card-title class="text-h3 pa-4 pb-0 pl-6">{{ loadingDialog.title }}</v-card-title>
|
||||
<v-card-text style="max-height: calc(100vh - 200px); overflow-y: auto">
|
||||
@@ -509,19 +514,24 @@ const updateDialogPluginLogo = computed(() => {
|
||||
class="mb-4"
|
||||
></v-progress-linear>
|
||||
|
||||
<div v-if="loadingDialog.statusCode !== 0" class="py-8 text-center">
|
||||
<v-icon
|
||||
class="mb-6"
|
||||
:color="loadingDialog.statusCode === 1 ? 'success' : 'error'"
|
||||
:icon="
|
||||
loadingDialog.statusCode === 1
|
||||
? 'mdi-check-circle-outline'
|
||||
: 'mdi-alert-circle-outline'
|
||||
"
|
||||
size="128"
|
||||
></v-icon>
|
||||
<div class="text-h4 font-weight-bold">{{ loadingDialog.result }}</div>
|
||||
</div>
|
||||
<v-fade-transition>
|
||||
<div
|
||||
v-if="loadingDialog.statusCode !== 0"
|
||||
class="py-8 text-center"
|
||||
>
|
||||
<v-icon
|
||||
class="mb-6"
|
||||
:color="loadingDialog.statusCode === 1 ? 'success' : 'error'"
|
||||
:icon="
|
||||
loadingDialog.statusCode === 1
|
||||
? 'mdi-check-circle-outline'
|
||||
: 'mdi-alert-circle-outline'
|
||||
"
|
||||
size="128"
|
||||
></v-icon>
|
||||
<div class="text-h4 font-weight-bold">{{ loadingDialog.result }}</div>
|
||||
</div>
|
||||
</v-fade-transition>
|
||||
|
||||
<div style="margin-top: 32px">
|
||||
<h3>{{ tm("dialogs.loading.logs") }}</h3>
|
||||
|
||||
@@ -1139,16 +1139,23 @@ export const useExtensionPage = () => {
|
||||
};
|
||||
|
||||
const updateConfig = async () => {
|
||||
loadingDialog.title = tm("status.loading");
|
||||
loadingDialog.statusCode = 0;
|
||||
loadingDialog.result = "";
|
||||
loadingDialog.show = true;
|
||||
try {
|
||||
const res = await pluginApi.updateConfig(
|
||||
curr_namespace.value,
|
||||
extension_config.config,
|
||||
);
|
||||
if (res.data.status === "ok") {
|
||||
toast(res.data.message, "success");
|
||||
} else {
|
||||
if (res.data.status !== "ok") {
|
||||
toast(res.data.message, "error");
|
||||
onLoadingDialogResult(2, res.data.message, -1);
|
||||
return;
|
||||
}
|
||||
|
||||
toast(res.data.message, "success");
|
||||
onLoadingDialogResult(1, res.data.message);
|
||||
configDialog.value = false;
|
||||
currentConfigPlugin.value = "";
|
||||
extension_config.metadata = {};
|
||||
@@ -1157,7 +1164,9 @@ export const useExtensionPage = () => {
|
||||
extension_config.log_level = null;
|
||||
getExtensions();
|
||||
} catch (err) {
|
||||
toast(err, "error");
|
||||
const errMsg = resolveErrorMessage(err, tm("messages.operationFailed"));
|
||||
toast(errMsg, "error");
|
||||
onLoadingDialogResult(2, errMsg, -1);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user