-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support refresh dashboard version (#122)
- Loading branch information
Showing
6 changed files
with
86 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
.footer { | ||
font-size: 0.8rem; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 100px; | ||
flex-direction: column; | ||
} | ||
|
||
.footer div { | ||
margin-bottom: 4px; | ||
color: var(--text-color-primary); | ||
} | ||
|
||
.refresh { | ||
cursor: pointer; | ||
margin-left: 6px; | ||
transition: color 0.2s ease-in-out; | ||
} | ||
|
||
.refresh:hover { | ||
@apply text-blue-500; | ||
} | ||
|
||
.refresh:hover svg { | ||
animation: spin 1s linear infinite; | ||
} | ||
|
||
@keyframes spin { | ||
0% { | ||
transform: rotate(0deg); | ||
} | ||
|
||
100% { | ||
transform: rotate(360deg); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { Refresh } from "@icon-park/react"; | ||
import styles from "./index.module.css"; | ||
import useSWR from "swr"; | ||
import { apiClient } from "@utils/request"; | ||
import { toast } from "sonner"; | ||
export const Footer = () => { | ||
|
||
const { data: coreVersion } = useSWR("/info"); | ||
|
||
const handleRefresh = () => { | ||
if (window.PATTERN != "CORE") { | ||
toast.error("独立部署模式|无法自动刷新面板版本") | ||
return; | ||
} | ||
const handler = apiClient("/console/refresh") | ||
toast.promise(handler, { | ||
loading: "正在刷新面板版本...", | ||
success: "面板版本刷新成功", | ||
error: "面板版本刷新失败" | ||
}) | ||
setTimeout(() => { | ||
window.location.reload() | ||
}, 1000) | ||
} | ||
|
||
return ( | ||
<div className={styles.footer}> | ||
<div> | ||
面板版本: {window?.version} | ||
<span className={styles.refresh} onClick={handleRefresh}> | ||
<Refresh /> | ||
</span> | ||
</div> | ||
<div>后端版本: {coreVersion?.version}</div> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters