Unverified Commit eb0b5714 authored by ZackYoung's avatar ZackYoung Committed by GitHub

[Web]Fix datastudio layout (#2650)

* fix_datastudio_layout
parent d64e6eb7
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
import CodeShow from '@/components/CustomEditor/CodeShow'; import CodeShow from '@/components/CustomEditor/CodeShow';
import { SseData } from '@/models/Sse'; import { SseData } from '@/models/Sse';
import { DataStudioTabsItemType, StateType } from '@/pages/DataStudio/model'; import {DataStudioTabsItemType, StateType, VIEW} from '@/pages/DataStudio/model';
import { SSE_TOPIC } from '@/pages/DevOps/constants'; import { SSE_TOPIC } from '@/pages/DevOps/constants';
import { API_CONSTANTS } from '@/services/endpoints'; import { API_CONSTANTS } from '@/services/endpoints';
import { parseMilliSecondStr } from '@/utils/function'; import { parseMilliSecondStr } from '@/utils/function';
...@@ -139,7 +139,7 @@ const ConsoleContent = (props: ConsoleProps) => { ...@@ -139,7 +139,7 @@ const ConsoleContent = (props: ConsoleProps) => {
}; };
return ( return (
<div style={{ height: props.height - 53 }}> <div style={{ height: props.height - VIEW.leftMargin }}>
<SplitPane <SplitPane
split={'vertical'} split={'vertical'}
defaultSizes={[100, 500]} defaultSizes={[100, 500]}
...@@ -178,7 +178,7 @@ const ConsoleContent = (props: ConsoleProps) => { ...@@ -178,7 +178,7 @@ const ConsoleContent = (props: ConsoleProps) => {
> >
<CodeShow <CodeShow
code={selectNode?.log ? selectNode.log : ''} code={selectNode?.log ? selectNode.log : ''}
height={props.height - 53} height={props.height - VIEW.leftMargin}
language={'javalog'} language={'javalog'}
lineNumbers={'off'} lineNumbers={'off'}
enableMiniMap enableMiniMap
......
...@@ -17,21 +17,21 @@ ...@@ -17,21 +17,21 @@
* *
*/ */
import { getFooterValue, isDataStudioTabsItemType } from '@/pages/DataStudio/function'; import {getFooterValue, isDataStudioTabsItemType} from '@/pages/DataStudio/function';
import { getTaskData } from '@/pages/DataStudio/LeftContainer/Project/service'; import {getTaskData} from '@/pages/DataStudio/LeftContainer/Project/service';
import { import {
getFlinkConfigs, getFlinkConfigs,
querySuggessionData querySuggessionData
} from '@/pages/DataStudio/RightContainer/JobConfig/service'; } from '@/pages/DataStudio/RightContainer/JobConfig/service';
import { QueryParams } from '@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/data'; import {QueryParams} from '@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/data';
import { SuggestionInfo } from '@/types/Public/data'; import {SuggestionInfo} from '@/types/Public/data';
import { Cluster, DataSources } from '@/types/RegCenter/data'; import {Cluster, DataSources} from '@/types/RegCenter/data';
import { l } from '@/utils/intl'; import {l} from '@/utils/intl';
import { createModelTypes } from '@/utils/modelUtils'; import {createModelTypes} from '@/utils/modelUtils';
import { Effect, Reducer } from '@@/plugin-dva/types'; import {Effect, Reducer} from '@@/plugin-dva/types';
import { Monaco } from '@monaco-editor/react'; import {Monaco} from '@monaco-editor/react';
import { DefaultOptionType } from 'antd/es/select'; import {DefaultOptionType} from 'antd/es/select';
import { editor } from 'monaco-editor'; import {editor} from 'monaco-editor';
import React from 'react'; import React from 'react';
import ICodeEditor = editor.ICodeEditor; import ICodeEditor = editor.ICodeEditor;
...@@ -401,21 +401,21 @@ const Model: ModelType = { ...@@ -401,21 +401,21 @@ const Model: ModelType = {
suggestions: [] suggestions: []
}, },
effects: { effects: {
*queryProject({ payload }, { call, put }) { * queryProject({payload}, {call, put}) {
const response: [] = yield call(getTaskData, payload); const response: [] = yield call(getTaskData, payload);
yield put({ yield put({
type: 'saveProject', type: 'saveProject',
payload: response payload: response
}); });
}, },
*queryFlinkConfigOptions({ payload }, { call, put }) { * queryFlinkConfigOptions({payload}, {call, put}) {
const response: [] = yield call(getFlinkConfigs, payload); const response: [] = yield call(getFlinkConfigs, payload);
yield put({ yield put({
type: 'saveFlinkConfigOptions', type: 'saveFlinkConfigOptions',
payload: response payload: response
}); });
}, },
*querySuggestions({ payload }, { call, put }) { * querySuggestions({payload}, {call, put}) {
const response: SuggestionInfo[] = yield call(querySuggessionData, payload); const response: SuggestionInfo[] = yield call(querySuggessionData, payload);
yield put({ yield put({
type: 'updateSuggestions', type: 'updateSuggestions',
...@@ -427,7 +427,7 @@ const Model: ModelType = { ...@@ -427,7 +427,7 @@ const Model: ModelType = {
/** /**
* 更新工具栏高度 * 更新工具栏高度
*/ */
updateToolContentHeight(state, { payload }) { updateToolContentHeight(state, {payload}) {
if (payload != state.toolContentHeight) { if (payload != state.toolContentHeight) {
return { return {
...state, ...state,
...@@ -439,7 +439,7 @@ const Model: ModelType = { ...@@ -439,7 +439,7 @@ const Model: ModelType = {
/** /**
* 更新中间内容高度 * 更新中间内容高度
*/ */
updateCenterContentHeight(state, { payload }) { updateCenterContentHeight(state, {payload}) {
if (payload != state.centerContentHeight) { if (payload != state.centerContentHeight) {
return { return {
...state, ...state,
...@@ -451,7 +451,7 @@ const Model: ModelType = { ...@@ -451,7 +451,7 @@ const Model: ModelType = {
/** /**
* 更新左侧选中key * 更新左侧选中key
*/ */
updateSelectLeftKey(state, { payload }) { updateSelectLeftKey(state, {payload}) {
return { return {
...state, ...state,
leftContainer: { leftContainer: {
...@@ -464,7 +464,7 @@ const Model: ModelType = { ...@@ -464,7 +464,7 @@ const Model: ModelType = {
/** /**
* 更新左侧宽度 * 更新左侧宽度
*/ */
updateLeftWidth(state, { payload }) { updateLeftWidth(state, {payload}) {
return { return {
...state, ...state,
leftContainer: { leftContainer: {
...@@ -476,7 +476,7 @@ const Model: ModelType = { ...@@ -476,7 +476,7 @@ const Model: ModelType = {
/** /**
* 更新右侧选中key * 更新右侧选中key
*/ */
updateSelectRightKey(state, { payload }) { updateSelectRightKey(state, {payload}) {
return { return {
...state, ...state,
rightContainer: { rightContainer: {
...@@ -488,7 +488,7 @@ const Model: ModelType = { ...@@ -488,7 +488,7 @@ const Model: ModelType = {
/** /**
* 更新右侧选中key * 更新右侧选中key
*/ */
updateRightWidth(state, { payload }) { updateRightWidth(state, {payload}) {
return { return {
...state, ...state,
rightContainer: { rightContainer: {
...@@ -500,27 +500,18 @@ const Model: ModelType = { ...@@ -500,27 +500,18 @@ const Model: ModelType = {
/** /**
* 更新底部选中key * 更新底部选中key
*/ */
updateSelectBottomKey(state, { payload }) { updateSelectBottomKey(state, {payload}) {
let centerContentHeight = 0; let centerContentHeight = 0;
let toolContentHeight = 0; let toolContentHeight = 0;
if (payload === '') { if (payload === '') {
centerContentHeight = state.centerContentHeight + (state.bottomContainer.height as number); centerContentHeight = state.centerContentHeight + (state.bottomContainer.height as number);
toolContentHeight = state.toolContentHeight + (state.bottomContainer.height as number); toolContentHeight = state.toolContentHeight + (state.bottomContainer.height as number);
} else if ( } else if (state.bottomContainer.selectKey !== '') {
state.bottomContainer.selectKey !== '' &&
payload !== state.bottomContainer.selectKey
) {
centerContentHeight = state.centerContentHeight; centerContentHeight = state.centerContentHeight;
toolContentHeight = state.toolContentHeight; toolContentHeight = state.toolContentHeight;
} else { } else {
if (state.centerContentHeight > state.bottomContainer.height) { centerContentHeight = state.centerContentHeight - (state.bottomContainer.height as number);
centerContentHeight =
state.centerContentHeight - (state.bottomContainer.height as number);
toolContentHeight = state.toolContentHeight - (state.bottomContainer.height as number); toolContentHeight = state.toolContentHeight - (state.bottomContainer.height as number);
} else {
centerContentHeight = state.centerContentHeight;
toolContentHeight = state.toolContentHeight;
}
} }
return { return {
...@@ -533,7 +524,7 @@ const Model: ModelType = { ...@@ -533,7 +524,7 @@ const Model: ModelType = {
} }
}; };
}, },
updateSelectBottomSubKey(state, { payload }) { updateSelectBottomSubKey(state, {payload}) {
return { return {
...state, ...state,
bottomContainer: { bottomContainer: {
...@@ -548,7 +539,7 @@ const Model: ModelType = { ...@@ -548,7 +539,7 @@ const Model: ModelType = {
/** /**
* 更新底部高度 * 更新底部高度
*/ */
updateBottomHeight(state, { payload }) { updateBottomHeight(state, {payload}) {
if (payload != state.bottomContainer.height) { if (payload != state.bottomContainer.height) {
return { return {
...state, ...state,
...@@ -563,36 +554,36 @@ const Model: ModelType = { ...@@ -563,36 +554,36 @@ const Model: ModelType = {
/** /**
* 更新数据库列表 * 更新数据库列表
*/ */
saveDataBase(state, { payload }) { saveDataBase(state, {payload}) {
return { return {
...state, ...state,
database: { ...state.database, dbData: payload } database: {...state.database, dbData: payload}
}; };
}, },
saveProject(state, { payload }) { saveProject(state, {payload}) {
return { return {
...state, ...state,
project: { ...state.project, data: payload } project: {...state.project, data: payload}
}; };
}, },
updateProjectExpandKey(state, { payload }) { updateProjectExpandKey(state, {payload}) {
return { return {
...state, ...state,
project: { ...state.project, expandKeys: payload } project: {...state.project, expandKeys: payload}
}; };
}, },
updateProjectSelectKey(state, { payload }) { updateProjectSelectKey(state, {payload}) {
return { return {
...state, ...state,
project: { ...state.project, selectKey: payload } project: {...state.project, selectKey: payload}
}; };
}, },
/** /**
* flink config options * flink config options
*/ */
saveFlinkConfigOptions(state, { payload }) { saveFlinkConfigOptions(state, {payload}) {
return { return {
...state, ...state,
flinkConfigOptions: payload flinkConfigOptions: payload
...@@ -601,7 +592,7 @@ const Model: ModelType = { ...@@ -601,7 +592,7 @@ const Model: ModelType = {
/** /**
* 更新tabs activeKey * 更新tabs activeKey
*/ */
updateTabsActiveKey(state, { payload }) { updateTabsActiveKey(state, {payload}) {
const itemTypes = state.tabs.panes.filter((x) => x.key === payload); const itemTypes = state.tabs.panes.filter((x) => x.key === payload);
if (itemTypes.length === 1) { if (itemTypes.length === 1) {
let footerValue: object = getFooterValue(state.tabs.panes, payload); let footerValue: object = getFooterValue(state.tabs.panes, payload);
...@@ -636,10 +627,10 @@ const Model: ModelType = { ...@@ -636,10 +627,10 @@ const Model: ModelType = {
/** /**
* 移除标签 * 移除标签
*/ */
removeTag(state, { payload }) { removeTag(state, {payload}) {
const needRemoveKey = payload; const needRemoveKey = payload;
const { const {
tabs: { panes, activeKey } tabs: {panes, activeKey}
} = state; } = state;
const index = panes.findIndex((item, index) => { const index = panes.findIndex((item, index) => {
...@@ -667,22 +658,17 @@ const Model: ModelType = { ...@@ -667,22 +658,17 @@ const Model: ModelType = {
/** /**
* 关闭tab * 关闭tab
*/ */
closeTab(state, { payload }) { closeTab(state, {payload}) {
const needCloseKey = (payload as TargetKey).toString(); const needCloseKey = (payload as TargetKey).toString();
const { const {
tabs: { panes, activeKey } tabs: {panes, activeKey}
} = state; } = state;
// close self // close self
if (needCloseKey === activeKey) { if (needCloseKey === activeKey) {
for (const [index, pane] of panes.entries()) { for (const [index, pane] of panes.entries()) {
if (pane.key === needCloseKey) { if (pane.key === needCloseKey) {
const nextPane = panes[(index + 1) % panes.length]; const nextPane = panes[(index + 1) % panes.length];
const height = const height = document.documentElement.clientHeight - VIEW.headerHeight - VIEW.headerNavHeight - VIEW.footerHeight - VIEW.otherHeight;
document.documentElement.clientHeight -
VIEW.headerHeight -
VIEW.headerNavHeight -
VIEW.footerHeight -
VIEW.otherHeight;
return { return {
...state, ...state,
tabs: { tabs: {
...@@ -697,9 +683,8 @@ const Model: ModelType = { ...@@ -697,9 +683,8 @@ const Model: ModelType = {
...state.footContainer, ...state.footContainer,
...getFooterValue(panes, nextPane.key) ...getFooterValue(panes, nextPane.key)
}, },
toolContentHeight: toolContentHeight: panes.length < 2 ? height - VIEW.leftMargin : state.toolContentHeight,
panes.length < 2 ? height - VIEW.leftMargin : state.toolContentHeight, centerContentHeight: panes.length < 2 ? height : state.toolContentHeight,
centerContentHeight: panes.length < 2 ? height : state.toolContentHeight
}; };
} }
} }
...@@ -723,7 +708,7 @@ const Model: ModelType = { ...@@ -723,7 +708,7 @@ const Model: ModelType = {
/** /**
* 添加tab 如果存在则不添加 * 添加tab 如果存在则不添加
*/ */
addTab(state, { payload }) { addTab(state, {payload}) {
const node = payload as TabsItemType; const node = payload as TabsItemType;
for (const item of state.tabs.panes) { for (const item of state.tabs.panes) {
if (item.id === node.id) { if (item.id === node.id) {
...@@ -778,7 +763,7 @@ const Model: ModelType = { ...@@ -778,7 +763,7 @@ const Model: ModelType = {
/** /**
* 关闭其他tab * 关闭其他tab
*/ */
closeOtherTabs(state, { payload }) { closeOtherTabs(state, {payload}) {
// 从 pans 中找到需要关闭的 tab // 从 pans 中找到需要关闭的 tab
const tabsItem = state.tabs.panes.find((pane) => pane.key === payload.key); const tabsItem = state.tabs.panes.find((pane) => pane.key === payload.key);
return { return {
...@@ -794,10 +779,10 @@ const Model: ModelType = { ...@@ -794,10 +779,10 @@ const Model: ModelType = {
/** /**
* 更新选中数据库id * 更新选中数据库id
*/ */
updateSelectDatabaseId(state, { payload }) { updateSelectDatabaseId(state, {payload}) {
return { return {
...state, ...state,
database: { ...state.database, selectDatabaseId: payload } database: {...state.database, selectDatabaseId: payload}
}; };
}, },
...@@ -807,22 +792,22 @@ const Model: ModelType = { ...@@ -807,22 +792,22 @@ const Model: ModelType = {
* @param payload * @param payload
* @returns {any} * @returns {any}
*/ */
updateDatabaseExpandKey(state, { payload }) { updateDatabaseExpandKey(state, {payload}) {
return { return {
...state, ...state,
database: { ...state.database, expandKeys: payload } database: {...state.database, expandKeys: payload}
}; };
}, },
/** /**
* 更新数据库选中key * 更新数据库选中key
*/ */
updateDatabaseSelectKey(state, { payload }) { updateDatabaseSelectKey(state, {payload}) {
return { return {
...state, ...state,
database: { ...state.database, selectKeys: payload } database: {...state.database, selectKeys: payload}
}; };
}, },
updateBottomConsole(state, { payload }) { updateBottomConsole(state, {payload}) {
return { return {
...state, ...state,
bottomContainerContent: { bottomContainerContent: {
...@@ -831,37 +816,37 @@ const Model: ModelType = { ...@@ -831,37 +816,37 @@ const Model: ModelType = {
} }
}; };
}, },
saveSession(state, { payload }) { saveSession(state, {payload}) {
return { return {
...state, ...state,
sessionCluster: payload sessionCluster: payload
}; };
}, },
saveEnv(state, { payload }) { saveEnv(state, {payload}) {
return { return {
...state, ...state,
env: payload env: payload
}; };
}, },
saveTabs(state, { payload }) { saveTabs(state, {payload}) {
return { return {
...state, ...state,
tabs: payload tabs: payload
}; };
}, },
saveClusterConfiguration(state, { payload }) { saveClusterConfiguration(state, {payload}) {
return { return {
...state, ...state,
clusterConfiguration: payload clusterConfiguration: payload
}; };
}, },
saveFooterValue(state, { payload }) { saveFooterValue(state, {payload}) {
return { return {
...state, ...state,
footContainer: payload footContainer: payload
}; };
}, },
updateJobRunningMsg(state, { payload }) { updateJobRunningMsg(state, {payload}) {
return { return {
...state, ...state,
footContainer: { footContainer: {
...@@ -870,7 +855,7 @@ const Model: ModelType = { ...@@ -870,7 +855,7 @@ const Model: ModelType = {
} }
}; };
}, },
updateSuggestions(state, { payload }) { updateSuggestions(state, {payload}) {
return { return {
...state, ...state,
suggestions: payload suggestions: payload
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment