diff --git a/src/features/config/ConfigPage.tsx b/src/features/config/ConfigPage.tsx
index 7becca16..e272128a 100644
--- a/src/features/config/ConfigPage.tsx
+++ b/src/features/config/ConfigPage.tsx
@@ -277,11 +277,7 @@ export function ConfigPage() {
) : (
)}
-
+
{mode === 'visual' ? (
@@ -322,7 +318,7 @@ export function ConfigPage() {
saveDisabled={saveDisabled}
discardDisabled={doc.loading || doc.saving}
onSave={doc.handleSave}
- onDiscard={doc.handleReload}
+ onDiscard={doc.handleDiscard}
/>
{
+ if (!isDirty) return;
+
+ showConfirmation({
+ title: t('common.unsaved_changes_title'),
+ message: t('config_management.discard_confirm_message'),
+ confirmText: t('config_management.actions.discard'),
+ cancelText: t('common.cancel'),
+ variant: 'danger',
+ onConfirm: () => {
+ setContent(previewServerYaml);
+ setDirty(false);
+ setDiffModalOpen(false);
+ setServerYaml(previewServerYaml);
+ setMergedYaml(previewServerYaml);
+ loadVisualValuesFromYaml(previewServerYaml);
+ },
+ });
+ }, [isDirty, loadVisualValuesFromYaml, previewServerYaml, showConfirmation, t]);
+
const closeDiff = useCallback(() => setDiffModalOpen(false), []);
return {
@@ -297,6 +318,7 @@ export function useConfigDocument({
handleConfirmSave,
handleChange,
handleReload,
+ handleDiscard,
closeDiff,
};
}
diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json
index 85a8c0b2..6bc645ae 100644
--- a/src/i18n/locales/en.json
+++ b/src/i18n/locales/en.json
@@ -840,6 +840,7 @@
"discard": "Discard changes",
"save": "Save changes"
},
+ "discard_confirm_message": "Discard all unsaved changes and restore the last server version?",
"mode": {
"label": "Editor mode",
"visual": "Visual",
diff --git a/src/i18n/locales/ru.json b/src/i18n/locales/ru.json
index 159dba99..2c465541 100644
--- a/src/i18n/locales/ru.json
+++ b/src/i18n/locales/ru.json
@@ -827,6 +827,7 @@
"discard": "Отменить изменения",
"save": "Сохранить изменения"
},
+ "discard_confirm_message": "Отменить все несохранённые изменения и восстановить последнюю версию с сервера?",
"mode": {
"label": "Режим редактора",
"visual": "Визуальный",
diff --git a/src/i18n/locales/zh-CN.json b/src/i18n/locales/zh-CN.json
index f279ab8b..2d3cfc09 100644
--- a/src/i18n/locales/zh-CN.json
+++ b/src/i18n/locales/zh-CN.json
@@ -840,6 +840,7 @@
"discard": "放弃更改",
"save": "保存更改"
},
+ "discard_confirm_message": "确定放弃所有未保存的更改并恢复到最近的服务器版本吗?",
"mode": {
"label": "编辑模式",
"visual": "可视化",
diff --git a/src/i18n/locales/zh-TW.json b/src/i18n/locales/zh-TW.json
index 7b4d4ced..ac174003 100644
--- a/src/i18n/locales/zh-TW.json
+++ b/src/i18n/locales/zh-TW.json
@@ -866,6 +866,7 @@
"discard": "放棄變更",
"save": "儲存變更"
},
+ "discard_confirm_message": "確定放棄所有未儲存的變更並還原到最近的伺服器版本嗎?",
"mode": {
"label": "編輯模式",
"visual": "視覺化",