Skip to content

Commit

Permalink
[Optimize][Web]Click the Tasks tab to switch to Service Synchronizati…
Browse files Browse the repository at this point in the history
…on (#3965)

Co-authored-by: gaoyan1998 <[email protected]>
  • Loading branch information
gaoyan1998 and gaoyan1998 authored Nov 27, 2024
1 parent fa16032 commit 6f9bb41
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
10 changes: 10 additions & 0 deletions dinky-web/src/pages/DataStudio/CenterTabContent/SqlTask/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,16 @@ export const SqlTask = memo((props: FlinkSqlProps & any) => {
}
});
observer.observe(element);

const key = Number(id.replace('project_', ''));
updateAction({
actionType: DataStudioActionType.TASK_TAB_CHANGE,
params: {
taskId: params.taskId,
key: key
}
});

return () => {
observer.unobserve(element);
};
Expand Down
3 changes: 2 additions & 1 deletion dinky-web/src/pages/DataStudio/data.d.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,6 @@ export enum DataStudioActionType {
TASK_RUN_SUBMIT = 'task-run-submit',
TASK_PREVIEW_RESULT = 'task-preview-result',
TASK_RUN_DEBUG = 'task-run-debug',
TASK_RUN_LOCATION = 'task-run-location'
TASK_RUN_LOCATION = 'task-run-location',
TASK_TAB_CHANGE = 'task-tab-change'
}
15 changes: 15 additions & 0 deletions dinky-web/src/pages/DataStudio/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,21 @@ const DataStudio: React.FC = (props: any) => {
dropMode={'edge'}
style={{ position: 'absolute', left: 0, top: 0, right: 0, bottom: 0 }}
onLayoutChange={async (newLayout, currentTabId, direction) => {
if (currentTabId && direction == 'active') {
const tableData = (dataStudioState.centerContent.tabs as CenterTab[]).find(
(x) => x.id === currentTabId
);
if (tableData) {
const key = Number(currentTabId.replace('project_', ''));
updateAction({
actionType: DataStudioActionType.TASK_TAB_CHANGE,
params: {
taskId: tableData.params.taskId,
key: key
}
});
}
}
// todo 这里移到方向会导致布局和算法异常,先暂时规避掉
if (
direction === 'left' ||
Expand Down

0 comments on commit 6f9bb41

Please sign in to comment.