mirror of
https://github.com/Elysola/WebHooker.git
synced 2026-11-21 01:23:40 +00:00
fix(console): lock route edits and show failures
Lock the route editor while saving and show fragment load failures with a retry action rather than presenting a false empty list.
This commit is contained in:
1 parent
0878a7768c
commit
6968880054
2 files changed
+30
-2
No files matched your search
@@ -77,6 +77,8 @@ const eventSuggestions = computed(() => eventOptions(locale.value));
|
||||
|
||||
const {
|
||||
fragments,
|
||||
loading: fragmentsLoading,
|
||||
error: fragmentsLoadError,
|
||||
readyFor: fragmentsReadyFor,
|
||||
load: loadFragments,
|
||||
save: saveFragments,
|
||||
@@ -459,6 +461,9 @@ watch(
|
||||
</template>
|
||||
|
||||
<form ref="bodyEl" class="editor-body" @submit.prevent="save">
|
||||
<!-- Locked while saving: an edit made meanwhile would be lost when the
|
||||
save closes the editor. -->
|
||||
<fieldset :disabled="saving" class="contents">
|
||||
<section class="editor-section">
|
||||
<h3 class="editor-section-title">{{ t("routeEditor.sectionBasic") }}</h3>
|
||||
<div v-if="!isEdit" class="templates">
|
||||
@@ -477,7 +482,11 @@ watch(
|
||||
<div class="row2">
|
||||
<div class="field">
|
||||
<label>{{ t("routeEditor.name") }}</label>
|
||||
<RcInput v-model="form.name" :placeholder="t('routeEditor.namePlaceholder')" required />
|
||||
<RcInput
|
||||
v-model="form.name"
|
||||
:placeholder="t('routeEditor.namePlaceholder')"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>{{ t("routeEditor.id") }}</label>
|
||||
@@ -575,7 +584,21 @@ watch(
|
||||
</div>
|
||||
</div>
|
||||
<div class="fragments-list">
|
||||
<div v-if="!fragments.length" class="hint">{{ t("routeEditor.fragmentsEmpty") }}</div>
|
||||
<!-- A failed load is said so (never shown as "no fragments"). -->
|
||||
<div v-if="fragmentsLoadError" class="err">
|
||||
{{ t("routeEditor.fragmentsLoadFailed", { error: fragmentsLoadError }) }}
|
||||
<RcButton
|
||||
type="button"
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
@click="groupId && loadFragments(groupId)"
|
||||
>
|
||||
{{ t("routeEditor.fragmentsRetry") }}
|
||||
</RcButton>
|
||||
</div>
|
||||
<div v-else-if="!fragments.length && !fragmentsLoading" class="hint">
|
||||
{{ t("routeEditor.fragmentsEmpty") }}
|
||||
</div>
|
||||
<div v-for="frag in fragments" :key="frag.id" class="fragment-row">
|
||||
<span class="fragment-name">{{ frag.name }}</span>
|
||||
<RcButton
|
||||
@@ -703,6 +726,7 @@ watch(
|
||||
</section>
|
||||
|
||||
<div v-if="formError" class="err" data-save-error>{{ formError }}</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<template #footer>
|
||||
|
||||
@@ -295,6 +295,8 @@ const en: Dict = {
|
||||
"routeEditor.fragments": "Fragments",
|
||||
"routeEditor.fragmentsPresets": "Presets",
|
||||
"routeEditor.fragmentsEmpty": "No fragments yet",
|
||||
"routeEditor.fragmentsLoadFailed": "Fragments could not be loaded: {error}",
|
||||
"routeEditor.fragmentsRetry": "Retry",
|
||||
"routeEditor.fragmentsInsert": "Insert",
|
||||
"routeEditor.fragmentsDelete": "Delete",
|
||||
"routeEditor.fragmentsSave": "Save as fragment",
|
||||
@@ -745,6 +747,8 @@ const zh: Dict = {
|
||||
"routeEditor.fragments": "过滤器片段",
|
||||
"routeEditor.fragmentsPresets": "预设",
|
||||
"routeEditor.fragmentsEmpty": "暂无片段",
|
||||
"routeEditor.fragmentsLoadFailed": "片段加载失败:{error}",
|
||||
"routeEditor.fragmentsRetry": "重试",
|
||||
"routeEditor.fragmentsInsert": "插入",
|
||||
"routeEditor.fragmentsDelete": "删除",
|
||||
"routeEditor.fragmentsSave": "存为片段",
|
||||
|
||||
Reference in new issue
Block a user