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