Skip to content

Commit

Permalink
Merge branch 'dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Zzm0809 authored Oct 26, 2023
2 parents 4139e98 + 7bb0aae commit b5b4f64
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<ProcessStep>();
const [processNode, setProcessNode] = useState<ProcessStep>();
const [expandedKeys, setExpandedKeys] = useState<Key[]>([]);

const process = `FlinkSubmit/${tab.params.taskId}`;
const topic = `${SSE_TOPIC.PROCESS_CONSOLE}/${process}`;
Expand Down Expand Up @@ -105,6 +119,16 @@ const ConsoleContent = (props: ConsoleProps) => {
);
};

useEffect(() => {
if (processNode) {
setExpandedKeys(buildExpandKeys(processNode));
}
}, [processNode]);

const handleExpand = (expandedKeys: Key[]) => {
setExpandedKeys(expandedKeys);
};

return (
<div style={{ overflow: 'hidden' }}>
<MovableSidebar
Expand All @@ -125,9 +149,8 @@ const ConsoleContent = (props: ConsoleProps) => {
titleRender={renderTitle}
onSelect={onSelect}
treeData={[processNode]}
expandAction={'doubleClick'}
defaultExpandParent
defaultExpandAll
expandedKeys={expandedKeys}
onExpand={handleExpand}
/>
) : (
<Empty />
Expand Down
10 changes: 6 additions & 4 deletions dinky-web/src/pages/DataStudio/MiddleContainer/Editor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,15 @@ import { format } from 'sql-formatter';

export type EditorProps = {
taskId: number;
height?: number;
};

const CodeEditor: React.FC<EditorProps & any> = (props) => {
const {
taskId,
tabs: { panes, activeKey },
dispatch
dispatch,
height,
} = props;

const [isModalOpen, setIsModalOpen] = useState(false);
Expand Down Expand Up @@ -96,7 +98,7 @@ const CodeEditor: React.FC<EditorProps & any> = (props) => {

return (
<Spin spinning={loading} delay={600}>
<div style={{ width: '100%', height: fullscreen ? 'calc(100vh - 50px)' : '33vh' }}>
<div style={{ width: '100%', height: fullscreen ? 'calc(100vh - 50px)' : height }}>
<DiffModal
diffs={diff}
open={isModalOpen}
Expand Down Expand Up @@ -162,8 +164,8 @@ const CodeEditor: React.FC<EditorProps & any> = (props) => {
<div
style={{
position: 'absolute',
top: 0,
right: 150
top: 20,
right: '7%'
}}
>
{fullscreen ? (
Expand Down
15 changes: 13 additions & 2 deletions dinky-web/src/pages/DataStudio/MiddleContainer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,18 @@ const MiddleContainer = (props: any) => {
}

const v = item.params;
return <Editor taskId={v.taskId} />;
return (
<Editor
taskId={v.taskId}
height={
activeKey === item.key
? fullscreen
? document.body.clientHeight
: props.centerContentHeight - 40
: 0
}
/>
);
}

if (isMetadataTabsItemType(item)) {
Expand Down Expand Up @@ -256,7 +267,7 @@ const MiddleContainer = (props: any) => {
activeKey === item.key
? fullscreen
? document.body.clientHeight
: props.centerContentHeight - 35
: props.centerContentHeight - 40
: 0
}
>
Expand Down

0 comments on commit b5b4f64

Please sign in to comment.