mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2024-11-16 11:42:21 +08:00
feat: add refresh button
This commit is contained in:
parent
176620e3bb
commit
b4df1b6e42
|
@ -21,6 +21,7 @@ import { saveWebdavConfig, createWebdavBackup } from "@/services/cmds";
|
||||||
export interface BackupConfigViewerProps {
|
export interface BackupConfigViewerProps {
|
||||||
onBackupSuccess: () => Promise<void>;
|
onBackupSuccess: () => Promise<void>;
|
||||||
onSaveSuccess: () => Promise<void>;
|
onSaveSuccess: () => Promise<void>;
|
||||||
|
onRefresh: () => Promise<void>;
|
||||||
onInit: () => Promise<void>;
|
onInit: () => Promise<void>;
|
||||||
setLoading: (loading: boolean) => void;
|
setLoading: (loading: boolean) => void;
|
||||||
}
|
}
|
||||||
|
@ -29,6 +30,7 @@ export const BackupConfigViewer = memo(
|
||||||
({
|
({
|
||||||
onBackupSuccess,
|
onBackupSuccess,
|
||||||
onSaveSuccess,
|
onSaveSuccess,
|
||||||
|
onRefresh,
|
||||||
onInit,
|
onInit,
|
||||||
setLoading,
|
setLoading,
|
||||||
}: BackupConfigViewerProps) => {
|
}: BackupConfigViewerProps) => {
|
||||||
|
@ -186,14 +188,14 @@ export const BackupConfigViewer = memo(
|
||||||
<Grid2 size={{ xs: 12, sm: 3 }}>
|
<Grid2 size={{ xs: 12, sm: 3 }}>
|
||||||
<Stack
|
<Stack
|
||||||
direction="column"
|
direction="column"
|
||||||
justifyContent="center"
|
justifyContent="space-between"
|
||||||
alignItems="stretch"
|
alignItems="stretch"
|
||||||
sx={{ height: "100%" }}
|
sx={{ height: "100%" }}
|
||||||
>
|
>
|
||||||
{webdavChanged ||
|
{webdavChanged ||
|
||||||
webdav_url === null ||
|
webdav_url === null ||
|
||||||
webdav_username == null ||
|
webdav_username === null ||
|
||||||
webdav_password == null ? (
|
webdav_password === null ? (
|
||||||
<Button
|
<Button
|
||||||
variant="contained"
|
variant="contained"
|
||||||
color={"primary"}
|
color={"primary"}
|
||||||
|
@ -204,15 +206,25 @@ export const BackupConfigViewer = memo(
|
||||||
{t("Save")}
|
{t("Save")}
|
||||||
</Button>
|
</Button>
|
||||||
) : (
|
) : (
|
||||||
<Button
|
<>
|
||||||
variant="contained"
|
<Button
|
||||||
color="success"
|
variant="contained"
|
||||||
sx={{ height: "100%" }}
|
color="success"
|
||||||
onClick={handleBackup}
|
onClick={handleBackup}
|
||||||
type="button"
|
type="button"
|
||||||
>
|
size="large"
|
||||||
{t("Backup")}
|
>
|
||||||
</Button>
|
{t("Backup")}
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
variant="outlined"
|
||||||
|
onClick={onRefresh}
|
||||||
|
type="button"
|
||||||
|
size="large"
|
||||||
|
>
|
||||||
|
{t("Refresh")}
|
||||||
|
</Button>
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
</Stack>
|
</Stack>
|
||||||
</Grid2>
|
</Grid2>
|
||||||
|
|
|
@ -120,6 +120,9 @@ export const BackupViewer = forwardRef<DialogRef>((props, ref) => {
|
||||||
onSaveSuccess={async () => {
|
onSaveSuccess={async () => {
|
||||||
fetchAndSetBackupFiles();
|
fetchAndSetBackupFiles();
|
||||||
}}
|
}}
|
||||||
|
onRefresh={async () => {
|
||||||
|
fetchAndSetBackupFiles();
|
||||||
|
}}
|
||||||
onInit={async () => {
|
onInit={async () => {
|
||||||
fetchAndSetBackupFiles();
|
fetchAndSetBackupFiles();
|
||||||
}}
|
}}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user