Unverified Commit 65137b54 authored by ZackYoung's avatar ZackYoung Committed by GitHub

[Bug]fix_web_some_bug (#2524)

* fix_web_some_bug * fix_web_some_bug
parent 6f689ac7
......@@ -46,7 +46,6 @@ export type CodeEditFormProps = {
code: string;
readOnly?: boolean;
lineNumbers?: string;
theme?: string;
autoWrap?: string;
showFloatButton?: boolean;
editorDidMount?: (editor: editor.IStandaloneCodeEditor, monaco: Monaco) => void;
......
......@@ -22,7 +22,6 @@ import CodeShow from '@/components/CustomEditor/CodeShow';
import useThemeValue from '@/hooks/useThemeValue';
import { jsonToSql } from '@/pages/DataStudio/BottomContainer/Tools/JsonToSql/service';
import { StateType } from '@/pages/DataStudio/model';
import { convertCodeEditTheme } from '@/utils/function';
import { connect } from '@@/exports';
import { Button, Space } from 'antd';
import React, { useState } from 'react';
......@@ -53,8 +52,7 @@ const JsonToSql: React.FC = (props: connect) => {
height={maxHeight + 'px'}
code={jsonData}
language={'json'}
theme={convertCodeEditTheme()}
onChange={(x) => {
onChange={(x:string) => {
setJsonData(x ?? '');
}}
/>
......
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
......@@ -56,7 +56,6 @@ const FooterContainer: React.FC<FooterContainerProps & StateType> = (props) => {
const themeValue = useThemeValue();
const [viewJobRunning, setViewJobRunning] = useState(false);
const [memDetailInfo, setMemDetailInfo] = useState(memDetails);
const currentTab = getCurrentTab(tabs.panes ?? [], tabs.activeKey);
useEffect(() => {
......
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import { CircleBtn, CircleDataStudioButtonProps } from '@/components/CallBackButton/CircleBtn';
import MovableSidebar, { MovableSidebarProps } from '@/components/Sidebar/MovableSidebar';
import {CircleBtn, CircleDataStudioButtonProps} from '@/components/CallBackButton/CircleBtn';
import MovableSidebar, {MovableSidebarProps} from '@/components/Sidebar/MovableSidebar';
import useThemeValue from '@/hooks/useThemeValue';
import ProjectTitle from '@/pages/DataStudio/LeftContainer/Project/ProjectTitle';
import { StateType, STUDIO_MODEL, VIEW } from '@/pages/DataStudio/model';
import { BtnRoute, LeftSide } from '@/pages/DataStudio/route';
import { connect } from '@@/exports';
import { Tabs } from 'antd';
import {StateType, STUDIO_MODEL, VIEW} from '@/pages/DataStudio/model';
import {BtnRoute, LeftSide} from '@/pages/DataStudio/route';
import {connect} from '@@/exports';
import {Tabs} from 'antd';
import React from 'react';
export type LeftContainerProps = {
size: number;
size: number;
leftContainer: StateType['leftContainer'];
rightContainer: StateType['rightContainer'];
};
const LeftContainer: React.FC<LeftContainerProps> = (props: any) => {
const {
dispatch,
size,
toolContentHeight,
leftContainer,
rightContainer,
tabs: { panes, activeKey }
} = props;
const themeValue = useThemeValue();
const {
dispatch,
size,
toolContentHeight,
leftContainer,
rightContainer,
tabs: {panes, activeKey}
} = props;
const themeValue = useThemeValue();
const MAX_WIDTH = size.width - 2 * VIEW.leftToolWidth - rightContainer.width - 700;
/**
* 侧边栏大小变化
* @param width
*/
const handleReSizeChange = (width: any) => {
dispatch({
type: STUDIO_MODEL.updateLeftWidth,
payload: width
});
};
const MAX_WIDTH = size.width - 2 * VIEW.leftToolWidth - rightContainer.width - 700;
/**
* 侧边栏大小变化
* @param width
*/
const handleReSizeChange = (width: any) => {
dispatch({
type: STUDIO_MODEL.updateLeftWidth,
payload: width
});
};
/**
* 侧边栏最小化
*/
const handleMinimize = () => {
dispatch({
type: STUDIO_MODEL.updateSelectLeftKey,
payload: ''
});
};
/**
* 侧边栏最小化
*/
const handleMinimize = () => {
dispatch({
type: STUDIO_MODEL.updateSelectLeftKey,
payload: ''
});
};
/**
* 侧边栏最大化
*/
const handleMaxsize = () => {
handleReSizeChange(MAX_WIDTH);
};
/**
* 侧边栏最大化
*/
const handleMaxsize = () => {
handleReSizeChange(MAX_WIDTH);
};
/**
* 侧边栏属性
* @type {{onResize: (event: any, direction: any, elementRef: {offsetWidth: any}) => void, visible: boolean, defaultSize: {width: any, height: any}, enable: {right: boolean}, minWidth: number, title: string, handlerMinimize: () => void, contentHeight: any, maxWidth: number}}
*/
const restMovableSidebarProps: MovableSidebarProps = {
contentHeight: toolContentHeight,
onResize: (event: any, direction: any, elementRef: { offsetWidth: any }) =>
handleReSizeChange(elementRef.offsetWidth),
title: <ProjectTitle/>,
handlerMinimize: () => handleMinimize(),
handlerMaxsize: handleMaxsize,
visible: leftContainer.selectKey !== '',
defaultSize: {width: leftContainer.width, height: leftContainer.height},
minWidth: 160,
maxWidth: MAX_WIDTH,
enable: {right: true},
btnGroup: BtnRoute[leftContainer.selectKey]
? BtnRoute[leftContainer.selectKey].map((item: CircleDataStudioButtonProps) => (
<CircleBtn
title={item.title}
icon={item.icon}
onClick={() => item.onClick?.(panes, activeKey)}
key={item.title}
/>
))
: [],
style: {borderInlineEnd: `1px solid ${themeValue.borderColor}`}
};
/**
* 侧边栏属性
* @type {{onResize: (event: any, direction: any, elementRef: {offsetWidth: any}) => void, visible: boolean, defaultSize: {width: any, height: any}, enable: {right: boolean}, minWidth: number, title: string, handlerMinimize: () => void, contentHeight: any, maxWidth: number}}
*/
const restMovableSidebarProps: MovableSidebarProps = {
contentHeight: toolContentHeight,
onResize: (event: any, direction: any, elementRef: { offsetWidth: any }) =>
handleReSizeChange(elementRef.offsetWidth),
title: <ProjectTitle />,
handlerMinimize: () => handleMinimize(),
handlerMaxsize: handleMaxsize,
visible: leftContainer.selectKey !== '',
defaultSize: { width: leftContainer.width, height: leftContainer.height },
minWidth: 160,
maxWidth: MAX_WIDTH,
enable: { right: true },
btnGroup: BtnRoute[leftContainer.selectKey]
? BtnRoute[leftContainer.selectKey].map((item: CircleDataStudioButtonProps) => (
<CircleBtn
title={item.title}
icon={item.icon}
onClick={() => item.onClick?.(panes, activeKey)}
key={item.title}
/>
))
: [],
style: { borderInlineEnd: `1px solid ${themeValue.borderColor}` }
};
const content = (
<Tabs activeKey={leftContainer.selectKey} items={LeftSide} tabBarStyle={{display: 'none'}}/>
);
const content = (
<Tabs activeKey={leftContainer.selectKey} items={LeftSide} tabBarStyle={{ display: 'none' }} />
);
return (
<MovableSidebar {...restMovableSidebarProps}>
{/*<Tabs activeKey={leftContainer.selectKey} items={LeftSide} tabBarStyle={{display: "none"}}/>*/}
{content}
</MovableSidebar>
);
return (
<MovableSidebar {...restMovableSidebarProps}>
{/*<Tabs activeKey={leftContainer.selectKey} items={LeftSide} tabBarStyle={{display: "none"}}/>*/}
{content}
</MovableSidebar>
);
};
export default connect(({ Studio }: { Studio: StateType }) => ({
leftContainer: Studio.leftContainer,
rightContainer: Studio.rightContainer,
toolContentHeight: Studio.toolContentHeight,
tabs: Studio.tabs
export default connect(({Studio}: { Studio: StateType }) => ({
// leftContainer: Studio.leftContainer,
// rightContainer: Studio.rightContainer,
toolContentHeight: Studio.toolContentHeight,
tabs: Studio.tabs
}))(LeftContainer);
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
......@@ -26,6 +26,7 @@ import { DiffEditor } from '@monaco-editor/react';
import { Col, Modal, Row, Space, Table, Tabs, Typography } from 'antd';
import React from 'react';
import styles from './index.less';
import {convertCodeEditTheme} from "@/utils/function";
const { Text, Link } = Typography;
......@@ -61,6 +62,7 @@ const DiffModal: React.FC<DiffModalProps> = (props) => {
{...DIFF_EDITOR_PARAMS}
original={statementDiff?.server}
modified={statementDiff?.cache}
theme={convertCodeEditTheme()}
/>
</div>
) : (
......
......@@ -31,6 +31,7 @@ import { Button, Card, Modal, Tag } from 'antd';
import moment from 'moment';
import React, { useState } from 'react';
import { connect } from 'umi';
import {convertCodeEditTheme} from "@/utils/function";
const HistoryVersion = (props: any) => {
const {
......@@ -93,9 +94,9 @@ const HistoryVersion = (props: any) => {
automaticLayout: true
}}
language={'sql'}
theme={'vs-dark'}
original={originalValue}
modified={currentValue}
theme={convertCodeEditTheme()}
/>
</React.StrictMode>
</Modal>
......
......@@ -225,7 +225,7 @@ const DataStudio = (props: any) => {
<Content style={{ display: 'flex', flexDirection: 'column', minWidth: 0 }}>
<div style={{ display: 'flex' }}>
<LeftContainer size={size} />
<LeftContainer size={size} leftContainer={leftContainer} rightContainer={rightContainer} />
<Content
style={{
width:
......@@ -236,7 +236,7 @@ const DataStudio = (props: any) => {
</Content>
<RightContainer size={size} bottomHeight={bottomHeight} />
</div>
{<BottomContainer size={size} />}
{<BottomContainer size={size} height={bottomHeight} />}
</Content>
<Sider collapsed collapsedWidth={40}>
......
......@@ -425,19 +425,25 @@ const Model: ModelType = {
* 更新工具栏高度
*/
updateToolContentHeight(state, { payload }) {
return {
...state,
toolContentHeight: payload
};
if (payload != state.toolContentHeight) {
return {
...state,
toolContentHeight: payload
};
}
return state;
},
/**
* 更新中间内容高度
*/
updateCenterContentHeight(state, { payload }) {
return {
...state,
centerContentHeight: payload
};
if (payload != state.centerContentHeight) {
return {
...state,
centerContentHeight: payload
};
}
return state;
},
/**
* 更新左侧选中key
......@@ -536,13 +542,16 @@ const Model: ModelType = {
* 更新底部高度
*/
updateBottomHeight(state, { payload }) {
return {
...state,
bottomContainer: {
...state.bottomContainer,
height: payload
}
};
if (payload!=state.bottomContainer.height) {
return {
...state,
bottomContainer: {
...state.bottomContainer,
height: payload
}
};
}
return state;
},
/**
* 更新数据库列表
......
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