diff --git a/dinky-web/src/locales/en-US/pages.ts b/dinky-web/src/locales/en-US/pages.ts index dd4ea89dd7..f42b025cae 100644 --- a/dinky-web/src/locales/en-US/pages.ts +++ b/dinky-web/src/locales/en-US/pages.ts @@ -227,7 +227,8 @@ export default { 'devops.jobinfo.remap.cluster.title.help': '(Note: This operation will modify the configuration of the cluster instance simultaneously.)', 'devops.jobinfo.remap.job.title': 'Job mapping information', - + 'devops.joblist.clear.filter': 'Cancel Selected', + 'devops.joblist.clear.filtertips': 'Clear selected tasks, but not clear other filter conditions', 'devops.joblist.detail': 'Job Detail', 'devops.joblist.history': 'History', 'devops.joblist.joblist': 'Job List', diff --git a/dinky-web/src/locales/zh-CN/pages.ts b/dinky-web/src/locales/zh-CN/pages.ts index 2f13cd35c4..f8d552ebd9 100644 --- a/dinky-web/src/locales/zh-CN/pages.ts +++ b/dinky-web/src/locales/zh-CN/pages.ts @@ -214,6 +214,8 @@ export default { 'devops.jobinfo.remap.cluster.title': '集群实例映射信息', 'devops.jobinfo.remap.cluster.title.help': ' (注意:此操作会同步修改集群实例配置)', 'devops.jobinfo.remap.job.title': 'Job映射信息', + 'devops.joblist.clear.filter': '取消选择', + 'devops.joblist.clear.filtertips': '清除选择的任务,并不是清除其他得筛选条件', 'devops.joblist.detail': '详情', 'devops.joblist.history': '历史', diff --git a/dinky-web/src/pages/DataStudio/LeftContainer/Project/function.tsx b/dinky-web/src/pages/DataStudio/LeftContainer/Project/function.tsx index ebf638b844..d999e1130d 100644 --- a/dinky-web/src/pages/DataStudio/LeftContainer/Project/function.tsx +++ b/dinky-web/src/pages/DataStudio/LeftContainer/Project/function.tsx @@ -129,7 +129,7 @@ export const showBadge = (type: string) => { */ export const buildProjectTree = ( - data: Catalogue[], + data: Catalogue[] = [], searchValue: string = '', path: string[] = [] ): any => diff --git a/dinky-web/src/pages/DevOps/JobList/index.tsx b/dinky-web/src/pages/DevOps/JobList/index.tsx index ddc2729a07..78ca784655 100644 --- a/dinky-web/src/pages/DevOps/JobList/index.tsx +++ b/dinky-web/src/pages/DevOps/JobList/index.tsx @@ -19,6 +19,12 @@ import JobLifeCycleTag from '@/components/JobTags/JobLifeCycleTag'; import StatusTag from '@/components/JobTags/StatusTag'; +import { + buildProjectTree, + generateList, + getParentKey +} from '@/pages/DataStudio/LeftContainer/Project/function'; +import { getTaskData } from '@/pages/DataStudio/LeftContainer/Project/service'; import { DevopContext } from '@/pages/DevOps'; import { JOB_LIFE_CYCLE } from '@/pages/DevOps/constants'; import { getJobDuration } from '@/pages/DevOps/function'; @@ -28,19 +34,32 @@ import { PROTABLE_OPTIONS_PUBLIC } from '@/services/constants'; import { API_CONSTANTS } from '@/services/endpoints'; import { Jobs } from '@/types/DevOps/data'; import { l } from '@/utils/intl'; -import { ClockCircleTwoTone, EyeTwoTone, RedoOutlined } from '@ant-design/icons'; +import { SplitPane } from '@andrewray/react-multi-split-pane'; +import { Pane } from '@andrewray/react-multi-split-pane/dist/lib/Pane'; +import { ClearOutlined, ClockCircleTwoTone, EyeTwoTone, RedoOutlined } from '@ant-design/icons'; import type { ActionType, ProColumns } from '@ant-design/pro-components'; import { ProCard, ProTable } from '@ant-design/pro-components'; -import { Button, Radio, Table } from 'antd'; -import { useContext, useEffect, useRef, useState } from 'react'; +import { Button, Empty, Radio, Table, Tree } from 'antd'; +import Search from 'antd/es/input/Search'; +import { Key, useContext, useEffect, useRef, useState } from 'react'; import { history } from 'umi'; +const { DirectoryTree } = Tree; + const JobList = () => { + const refObject = useRef(null); const tableRef = useRef(); const { statusFilter, setStatusFilter } = useContext(DevopContext); const [stepFilter, setStepFilter] = useState(); const [taskFilter, setTaskFilter] = useState(); + const [taskId, setTaskId] = useState(); + const [searchValue, setSearchValueValue] = useState(''); + const [data, setData] = useState([]); + const [autoExpandParent, setAutoExpandParent] = useState(true); + const [expandedKeys, setExpandedKeys] = useState([]); + const [selectedKey, setSelectedKey] = useState([]); + console.log(statusFilter); const jobListColumns: ProColumns[] = [ { title: l('global.table.jobname'), @@ -95,60 +114,203 @@ const JobList = () => { } ]; + // 重置选中的 key 和 taskId | reset the selected key and taskId + const resetValue = () => { + setSelectedKey([]); + setTaskId(undefined); + tableRef.current?.reload(); + }; + + // 监听 statusFilter 的变化,如果为 undefined 则重置选中的 key 和 taskId | listen for changes in statusFilter, if it is undefined, reset the selected key and taskId + useEffect(() => { + if (statusFilter === undefined) { + resetValue(); + } + }, [statusFilter]); + + /** + * 获取任务数据 | query task data + */ + useEffect(() => { + getTaskData().then((res) => { + if (res) { + setData(buildProjectTree(res, searchValue, [])); + } + }); + }, [searchValue]); + useEffect(() => { setInterval(() => tableRef.current?.reload(false), 5 * 1000); }, []); - return ( - - - {...PROTABLE_OPTIONS_PUBLIC} - search={false} - loading={{ delay: 1000 }} - rowKey={(record) => record.jid} - columns={jobListColumns} - params={{ isHistory: false, status: statusFilter, step: stepFilter, name: taskFilter }} - actionRef={tableRef} - toolbar={{ - settings: false, - search: { onSearch: (value: string) => setTaskFilter(value) }, - filter: ( - <> - setStepFilter(e.target.value)}> - - {l('global.table.lifecycle.all')} - - - {l('global.table.lifecycle.publish')} - - - {l('global.table.lifecycle.dev')} - - - - ), - actions: [ + ) + } + /> + + {data.length ? ( + onNodeClick(info)} + // onRightClick={onRightClick} + expandedKeys={expandedKeys} + // expandAction={'doubleClick'} + selectedKeys={selectedKey} + onExpand={(expandedKeys: Key[]) => setExpandedKeys(expandedKeys)} + treeData={data} + autoExpandParent={autoExpandParent} /> - ) - }} - /> + ) : ( + + )} + + + + + {...PROTABLE_OPTIONS_PUBLIC} + search={false} + tableStyle={{ height: parent.innerHeight - 210 }} + loading={{ delay: 1000 }} + rowKey={(record) => record.jid} + columns={jobListColumns} + params={{ + isHistory: false, + status: statusFilter, + step: stepFilter, + name: taskFilter, + taskId: taskId + }} + actionRef={tableRef} + toolbar={{ + settings: false, + search: { onSearch: (value: string) => setTaskFilter(value) }, + filter: ( + <> + setStepFilter(e.target.value)} + > + + {l('global.table.lifecycle.all')} + + + {l('global.table.lifecycle.publish')} + + + {l('global.table.lifecycle.dev')} + + + + ), + actions: [ +