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 = () => {
});
}
return <>
return(
<Typography style={{padding: '2px', textAlign: 'center', border: 'salmon'}}>
<br/>
<Title level={4}>{l('shortcut.title')}</Title>
<Paragraph style={{padding: 0, margin: 0, textAlign: 'center', border: 'salmon'}} >
{buildKeyBoard()}
</Paragraph>
</Typography>
</>;
</Typography>);
};
export default KeyBoard;
......@@ -43,14 +43,13 @@ const QuickGuide = () => {
});
}
return <>
return (
<Typography style={{padding: '2px', textAlign: 'center', border: 'salmon'}}>
<Title level={4}>{l('datastudio.middle.qg')}</Title>
<Paragraph style={{padding: 0, margin: 0, textAlign: 'center', border: 'salmon'}} >
{buildQuickGuide()}
</Paragraph>
</Typography>
</>
</Typography>);
};
......
......@@ -14,12 +14,12 @@ import {
} from "@/components/Icons/CodeLanguageIcon";
import {ClickHouseIcons, DorisIcons, HiveIcons, MysqlIcons, OracleIcons, PhoenixIcons,
PostgresqlIcons, PrestoIcons, SqlServerIcons, StarRocksIcons} from "@/components/Icons/DBIcons";
import {FolderOutlined} from "@ant-design/icons";
export const getTabIcon = (type: string, size?: number) => {
if (!type){
return <FileIcon/>;
}
switch (type.toLowerCase()) {
case DIALECT.JAVA:
return <JavaSvg/>;
......
......@@ -273,9 +273,45 @@ export type ModelType = {
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: {
isFullScreen: false,
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