Unverified Commit 582c2263 authored by Licho's avatar Licho Committed by GitHub

Refactor middle container, make model type constant, and in ide could jump to reduce (#2227)

* refactor: add STUDIO_MODEL * refactor:
parent 70555c74
...@@ -41,15 +41,14 @@ const KeyBoard = () => { ...@@ -41,15 +41,14 @@ const KeyBoard = () => {
}); });
} }
return <> return(
<Typography style={{padding: '2px', textAlign: 'center', border: 'salmon'}}> <Typography style={{padding: '2px', textAlign: 'center', border: 'salmon'}}>
<br/> <br/>
<Title level={4}>{l('shortcut.title')}</Title> <Title level={4}>{l('shortcut.title')}</Title>
<Paragraph style={{padding: 0, margin: 0, textAlign: 'center', border: 'salmon'}} > <Paragraph style={{padding: 0, margin: 0, textAlign: 'center', border: 'salmon'}} >
{buildKeyBoard()} {buildKeyBoard()}
</Paragraph> </Paragraph>
</Typography> </Typography>);
</>;
}; };
export default KeyBoard; export default KeyBoard;
...@@ -43,14 +43,13 @@ const QuickGuide = () => { ...@@ -43,14 +43,13 @@ const QuickGuide = () => {
}); });
} }
return <> return (
<Typography style={{padding: '2px', textAlign: 'center', border: 'salmon'}}> <Typography style={{padding: '2px', textAlign: 'center', border: 'salmon'}}>
<Title level={4}>{l('datastudio.middle.qg')}</Title> <Title level={4}>{l('datastudio.middle.qg')}</Title>
<Paragraph style={{padding: 0, margin: 0, textAlign: 'center', border: 'salmon'}} > <Paragraph style={{padding: 0, margin: 0, textAlign: 'center', border: 'salmon'}} >
{buildQuickGuide()} {buildQuickGuide()}
</Paragraph> </Paragraph>
</Typography> </Typography>);
</>
}; };
......
...@@ -14,12 +14,12 @@ import { ...@@ -14,12 +14,12 @@ import {
} from "@/components/Icons/CodeLanguageIcon"; } from "@/components/Icons/CodeLanguageIcon";
import {ClickHouseIcons, DorisIcons, HiveIcons, MysqlIcons, OracleIcons, PhoenixIcons, import {ClickHouseIcons, DorisIcons, HiveIcons, MysqlIcons, OracleIcons, PhoenixIcons,
PostgresqlIcons, PrestoIcons, SqlServerIcons, StarRocksIcons} from "@/components/Icons/DBIcons"; PostgresqlIcons, PrestoIcons, SqlServerIcons, StarRocksIcons} from "@/components/Icons/DBIcons";
import {FolderOutlined} from "@ant-design/icons";
export const getTabIcon = (type: string, size?: number) => { export const getTabIcon = (type: string, size?: number) => {
if (!type){ if (!type){
return <FileIcon/>; return <FileIcon/>;
} }
switch (type.toLowerCase()) { switch (type.toLowerCase()) {
case DIALECT.JAVA: case DIALECT.JAVA:
return <JavaSvg/>; return <JavaSvg/>;
......
...@@ -273,9 +273,45 @@ export type ModelType = { ...@@ -273,9 +273,45 @@ export type ModelType = {
updateJobRunningMsg: Reducer<StateType>; updateJobRunningMsg: Reducer<StateType>;
}; };
}; };
const Model: ModelType = {
namespace: 'Studio', const ModelTypeName = 'Studio';
const getModelType = (name: string) => {
return `${ModelTypeName}/${name}`;
}
export const STUDIO_MODEL: {[K in keyof ModelType['reducers']]: string} = {
updateToolContentHeight: getModelType('updateToolContentHeight'),
updateCenterContentHeight: getModelType('updateCenterContentHeight'),
updateSelectLeftKey: getModelType('updateSelectLeftKey'),
updateLeftWidth: getModelType('updateLeftWidth'),
updateSelectRightKey: getModelType('updateSelectRightKey'),
updateRightWidth: getModelType('updateRightWidth'),
updateSelectBottomKey: getModelType('updateSelectBottomKey'),
updateSelectBottomSubKey: getModelType('updateSelectBottomSubKey'),
updateBottomHeight: getModelType('updateBottomHeight'),
saveDataBase: getModelType('saveDataBase'),
saveProject: getModelType('saveProject'),
updateTabsActiveKey: getModelType('updateTabsActiveKey'),
closeTab: getModelType('closeTab'),
removeTag: getModelType('removeTag'),
addTab: getModelType('addTab'),
saveTabs: getModelType('saveTabs'),
closeAllTabs: getModelType('closeAllTabs'),
closeOtherTabs: getModelType('closeOtherTabs'),
updateSelectDatabaseId: getModelType('updateSelectDatabaseId'),
updateDatabaseExpandKey: getModelType('updateDatabaseExpandKey'),
updateDatabaseSelectKey: getModelType('updateDatabaseSelectKey'),
updateBottomConsole: getModelType('updateBottomConsole'),
saveSession: getModelType('saveSession'),
saveClusterConfiguration: getModelType('saveClusterConfiguration'),
saveEnv: getModelType('saveEnv'),
saveFooterValue: getModelType('saveFooterValue'),
updateJobRunningMsg: getModelType('updateJobRunningMsg'),
};
const Model: ModelType = {
namespace: ModelTypeName,
state: { state: {
isFullScreen: false, isFullScreen: false,
toolContentHeight: 0, toolContentHeight: 0,
......
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