Skip to content

Commit

Permalink
Click the Tasks tab to switch to Service Synchronization
Browse files Browse the repository at this point in the history
  • Loading branch information
gaoyan1998 committed Nov 27, 2024
1 parent 117e1a6 commit ba758fd
Show file tree
Hide file tree
Showing 3 changed files with 25 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'
}
13 changes: 13 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,19 @@ 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 ba758fd

Please sign in to comment.