From 7bb0aaefba9a3afde6e8ef7b835a04ad915dbcf9 Mon Sep 17 00:00:00 2001 From: yqwoe Date: Thu, 26 Oct 2023 15:25:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=95=B0=E6=8D=AE=E5=BC=80=E5=8F=91?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8=E5=B1=8F=E5=B9=95=E9=80=82=E9=85=8D?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20(#2440)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: use-service hooks * fix: 快捷键问题;编辑器主题切换问题;编辑 器全屏;数据库字段长度; * fix:提交 .mvn * fix:提交 .idea * fix:提交 .gitignore * fix:提交 maven-wrapper.jar * fix:提交 .gitignore * fix:编辑器屏幕适配问题 * fix:编辑器屏幕适配问题 * fix:控制台树形折叠/展开逻辑 --- .../Console/ConsoleContent.tsx | 29 +++++++++++++++++-- .../MiddleContainer/Editor/index.tsx | 10 ++++--- .../DataStudio/MiddleContainer/index.tsx | 26 ++++++++++++++--- 3 files changed, 54 insertions(+), 11 deletions(-) diff --git a/dinky-web/src/pages/DataStudio/BottomContainer/Console/ConsoleContent.tsx b/dinky-web/src/pages/DataStudio/BottomContainer/Console/ConsoleContent.tsx index 0ef4acf6f6..67a5678f4f 100644 --- a/dinky-web/src/pages/DataStudio/BottomContainer/Console/ConsoleContent.tsx +++ b/dinky-web/src/pages/DataStudio/BottomContainer/Console/ConsoleContent.tsx @@ -44,12 +44,26 @@ export interface ProcessStep extends DataNode { time: number; log: string; lastUpdateStep: ProcessStep; + children: ProcessStep[]; } + +const buildExpandKeys = (node: ProcessStep) => { + const keys: Key[] = []; + keys.push(node.key); + if (node.children.length > 0) { + node.children.forEach((item: ProcessStep) => { + keys.push(...buildExpandKeys(item)); + }); + } + return keys; +}; + const ConsoleContent = (props: ConsoleProps) => { const { tab } = props; const [selectNode, setSelectNode] = useState(); const [processNode, setProcessNode] = useState(); + const [expandedKeys, setExpandedKeys] = useState([]); const process = `FlinkSubmit/${tab.params.taskId}`; const topic = `${SSE_TOPIC.PROCESS_CONSOLE}/${process}`; @@ -105,6 +119,16 @@ const ConsoleContent = (props: ConsoleProps) => { ); }; + useEffect(() => { + if (processNode) { + setExpandedKeys(buildExpandKeys(processNode)); + } + }, [processNode]); + + const handleExpand = (expandedKeys: Key[]) => { + setExpandedKeys(expandedKeys); + }; + return (
{ titleRender={renderTitle} onSelect={onSelect} treeData={[processNode]} - expandAction={'doubleClick'} - defaultExpandParent - defaultExpandAll + expandedKeys={expandedKeys} + onExpand={handleExpand} /> ) : ( diff --git a/dinky-web/src/pages/DataStudio/MiddleContainer/Editor/index.tsx b/dinky-web/src/pages/DataStudio/MiddleContainer/Editor/index.tsx index 12664ae814..6bbb0af488 100644 --- a/dinky-web/src/pages/DataStudio/MiddleContainer/Editor/index.tsx +++ b/dinky-web/src/pages/DataStudio/MiddleContainer/Editor/index.tsx @@ -41,13 +41,15 @@ import { useEditor } from '@/hooks/useEditor'; export type EditorProps = { taskId: number; + height?: number; }; const CodeEditor: React.FC = (props) => { const { taskId, tabs: { panes, activeKey }, - dispatch + dispatch, + height, } = props; const [isModalOpen, setIsModalOpen] = useState(false); @@ -96,7 +98,7 @@ const CodeEditor: React.FC = (props) => { return ( -
+
= (props) => {
{fullscreen ? ( diff --git a/dinky-web/src/pages/DataStudio/MiddleContainer/index.tsx b/dinky-web/src/pages/DataStudio/MiddleContainer/index.tsx index 438cbb15fc..10529f9472 100644 --- a/dinky-web/src/pages/DataStudio/MiddleContainer/index.tsx +++ b/dinky-web/src/pages/DataStudio/MiddleContainer/index.tsx @@ -51,8 +51,7 @@ const MiddleContainer = (props: any) => { } = props; const themeValue = useThemeValue(); - - const {fullscreen} = useEditor(); + const { fullscreen } = useEditor(); const [contextMenuPosition, setContextMenuPosition] = useState({}); const [contextMenuVisible, setContextMenuVisible] = useState(false); @@ -224,7 +223,18 @@ const MiddleContainer = (props: any) => { } const v = item.params; - return ; + return ( + + ); } if (isMetadataTabsItemType(item)) { @@ -252,7 +262,15 @@ const MiddleContainer = (props: any) => { ), children: ( - + {renderContent()} )