mirror of
https://github.com/SECTL/SecScore.git
synced 2026-07-19 19:04:23 +08:00
看板改为自动运行并统一顶部操作按钮
This commit is contained in:
@@ -15,7 +15,7 @@ import {
|
|||||||
Typography,
|
Typography,
|
||||||
message,
|
message,
|
||||||
} from "antd"
|
} from "antd"
|
||||||
import { DeleteOutlined, EditOutlined, PlayCircleOutlined, PlusOutlined, ReloadOutlined } from "@ant-design/icons"
|
import { DeleteOutlined, EditOutlined, PlusOutlined, ReloadOutlined } from "@ant-design/icons"
|
||||||
import { useTranslation } from "react-i18next"
|
import { useTranslation } from "react-i18next"
|
||||||
|
|
||||||
type BoardStudentViewMode = "list" | "card" | "grid"
|
type BoardStudentViewMode = "list" | "card" | "grid"
|
||||||
@@ -511,6 +511,18 @@ ORDER BY reward_points DESC, score DESC`,
|
|||||||
[runListQuery]
|
[runListQuery]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const listConfigSignature = useMemo(() => {
|
||||||
|
if (!activeBoard) return ""
|
||||||
|
return JSON.stringify(
|
||||||
|
activeBoard.lists.map((item) => ({
|
||||||
|
id: item.id,
|
||||||
|
name: item.name,
|
||||||
|
sql: item.sql,
|
||||||
|
viewMode: item.viewMode,
|
||||||
|
}))
|
||||||
|
)
|
||||||
|
}, [activeBoard])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetchBoards()
|
fetchBoards()
|
||||||
}, [fetchBoards])
|
}, [fetchBoards])
|
||||||
@@ -530,8 +542,11 @@ ORDER BY reward_points DESC, score DESC`,
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!activeBoard) return
|
if (!activeBoard) return
|
||||||
runAllInBoard(activeBoard).catch(() => void 0)
|
const timer = window.setTimeout(() => {
|
||||||
}, [activeBoardId])
|
runAllInBoard(activeBoard).catch(() => void 0)
|
||||||
|
}, 260)
|
||||||
|
return () => window.clearTimeout(timer)
|
||||||
|
}, [activeBoard?.id, listConfigSignature, runAllInBoard])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const onDataUpdated = (e: Event) => {
|
const onDataUpdated = (e: Event) => {
|
||||||
@@ -924,9 +939,6 @@ ORDER BY reward_points DESC, score DESC`,
|
|||||||
title={<span style={{ fontWeight: 600 }}>{list.name}</span>}
|
title={<span style={{ fontWeight: 600 }}>{list.name}</span>}
|
||||||
extra={
|
extra={
|
||||||
<Space size={6}>
|
<Space size={6}>
|
||||||
<Button size="small" onClick={() => runListQuery(list)} loading={Boolean(runningIds[list.id])} icon={<PlayCircleOutlined />}>
|
|
||||||
{t("board.run")}
|
|
||||||
</Button>
|
|
||||||
<Button size="small" onClick={() => setEditingListId(list.id)} icon={<EditOutlined />}>
|
<Button size="small" onClick={() => setEditingListId(list.id)} icon={<EditOutlined />}>
|
||||||
{t("board.editList")}
|
{t("board.editList")}
|
||||||
</Button>
|
</Button>
|
||||||
@@ -1049,6 +1061,15 @@ ORDER BY reward_points DESC, score DESC`,
|
|||||||
<Button icon={<EditOutlined />} onClick={openRenameModal} disabled={!canManage || !activeBoard}>
|
<Button icon={<EditOutlined />} onClick={openRenameModal} disabled={!canManage || !activeBoard}>
|
||||||
{t("board.renameBoard")}
|
{t("board.renameBoard")}
|
||||||
</Button>
|
</Button>
|
||||||
|
<Popconfirm
|
||||||
|
title={t("board.removeBoardConfirm")}
|
||||||
|
onConfirm={() => activeBoard && removeBoard(activeBoard.id)}
|
||||||
|
disabled={!canManage || !activeBoard}
|
||||||
|
>
|
||||||
|
<Button danger icon={<DeleteOutlined />} disabled={!canManage || !activeBoard}>
|
||||||
|
{t("board.removeBoard")}
|
||||||
|
</Button>
|
||||||
|
</Popconfirm>
|
||||||
<Button icon={<ReloadOutlined />} loading={loading} onClick={fetchBoards}>
|
<Button icon={<ReloadOutlined />} loading={loading} onClick={fetchBoards}>
|
||||||
{t("common.refresh")}
|
{t("common.refresh")}
|
||||||
</Button>
|
</Button>
|
||||||
@@ -1058,8 +1079,6 @@ ORDER BY reward_points DESC, score DESC`,
|
|||||||
</Space>
|
</Space>
|
||||||
</Space>
|
</Space>
|
||||||
|
|
||||||
<Alert type="info" showIcon message={t("board.templateHint")} description={t("board.templateDescription")} />
|
|
||||||
|
|
||||||
<Tabs
|
<Tabs
|
||||||
type="card"
|
type="card"
|
||||||
activeKey={activeBoardId}
|
activeKey={activeBoardId}
|
||||||
@@ -1069,17 +1088,7 @@ ORDER BY reward_points DESC, score DESC`,
|
|||||||
|
|
||||||
{activeBoard ? (
|
{activeBoard ? (
|
||||||
<Space direction="vertical" size={16} style={{ width: "100%" }}>
|
<Space direction="vertical" size={16} style={{ width: "100%" }}>
|
||||||
<Space>
|
{saving && <Typography.Text type="secondary">{t("board.saving")}</Typography.Text>}
|
||||||
<Button onClick={() => runAllInBoard(activeBoard)} icon={<PlayCircleOutlined />}>
|
|
||||||
{t("board.runAll")}
|
|
||||||
</Button>
|
|
||||||
<Popconfirm title={t("board.removeBoardConfirm")} onConfirm={() => removeBoard(activeBoard.id)} disabled={!canManage}>
|
|
||||||
<Button danger icon={<DeleteOutlined />} disabled={!canManage}>
|
|
||||||
{t("board.removeBoard")}
|
|
||||||
</Button>
|
|
||||||
</Popconfirm>
|
|
||||||
{saving && <Typography.Text type="secondary">{t("board.saving")}</Typography.Text>}
|
|
||||||
</Space>
|
|
||||||
|
|
||||||
{renderBoardWorkspace()}
|
{renderBoardWorkspace()}
|
||||||
</Space>
|
</Space>
|
||||||
|
|||||||
Reference in New Issue
Block a user