mirror of
https://github.com/drawdb-io/drawdb.git
synced 2025-08-29 10:35:25 +00:00
add restore warning modal
This commit is contained in:
@@ -20,6 +20,7 @@ import {
|
|||||||
} from "../hooks";
|
} from "../hooks";
|
||||||
import FloatingControls from "./FloatingControls";
|
import FloatingControls from "./FloatingControls";
|
||||||
import { Button, Modal, Tag } from "@douyinfe/semi-ui";
|
import { Button, Modal, Tag } from "@douyinfe/semi-ui";
|
||||||
|
import { IconAlertTriangle } from "@douyinfe/semi-icons";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { databases } from "../data/databases";
|
import { databases } from "../data/databases";
|
||||||
import { isRtl } from "../i18n/utils/rtl";
|
import { isRtl } from "../i18n/utils/rtl";
|
||||||
@@ -47,7 +48,7 @@ export default function WorkSpace() {
|
|||||||
const [showSelectDbModal, setShowSelectDbModal] = useState(false);
|
const [showSelectDbModal, setShowSelectDbModal] = useState(false);
|
||||||
const [showRestoreModal, setShowRestoreModal] = useState(false);
|
const [showRestoreModal, setShowRestoreModal] = useState(false);
|
||||||
const [selectedDb, setSelectedDb] = useState("");
|
const [selectedDb, setSelectedDb] = useState("");
|
||||||
const { layout } = useLayout();
|
const { layout, setLayout } = useLayout();
|
||||||
const { settings } = useSettings();
|
const { settings } = useSettings();
|
||||||
const { types, setTypes } = useTypes();
|
const { types, setTypes } = useTypes();
|
||||||
const { areas, setAreas } = useAreas();
|
const { areas, setAreas } = useAreas();
|
||||||
@@ -453,7 +454,7 @@ export default function WorkSpace() {
|
|||||||
<Button
|
<Button
|
||||||
icon={<i className="fa-solid fa-rotate-right mt-0.5"></i>}
|
icon={<i className="fa-solid fa-rotate-right mt-0.5"></i>}
|
||||||
>
|
>
|
||||||
Restore version
|
{t("restore_version")}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@@ -518,7 +519,21 @@ export default function WorkSpace() {
|
|||||||
centered
|
centered
|
||||||
closable
|
closable
|
||||||
onCancel={() => setShowRestoreModal(false)}
|
onCancel={() => setShowRestoreModal(false)}
|
||||||
></Modal>
|
title={
|
||||||
|
<span className="flex items-center gap-2">
|
||||||
|
<IconAlertTriangle className="text-amber-400" size="extra-large" /> {t("restore_version")}
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
okText={t("continue")}
|
||||||
|
cancelText={t("cancel")}
|
||||||
|
onOk={() => {
|
||||||
|
setLayout((prev) => ({ ...prev, readOnly: false }));
|
||||||
|
setShowRestoreModal(false);
|
||||||
|
setVersion(null);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{t("restore_warning")}
|
||||||
|
</Modal>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -264,6 +264,10 @@ const en = {
|
|||||||
version: "Version",
|
version: "Version",
|
||||||
record_version: "Record version",
|
record_version: "Record version",
|
||||||
commited_at: "Commited at",
|
commited_at: "Commited at",
|
||||||
|
read_only: "Read only",
|
||||||
|
continue: "Continue",
|
||||||
|
restore_version: "Restore version",
|
||||||
|
restore_warning: "Loading another version will overwrite the current changes."
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user