Unverified Commit 5eb34dc1 authored by ZackYoung's avatar ZackYoung Committed by GitHub

[Fix][Web] Fix DataStudio page bug (#2338)

* optimize_docker_action * optimize_docker_action * optimize_docker_action * fix datastudio develop page bug * fix sse * optimize_action
parent bb8b272d
......@@ -77,7 +77,7 @@ jobs:
${{ runner.os }}-node-
- name: Install Dependencies
if: steps.filter.outputs.frontend == 'true'
run: cd dinky-web && npm install --prefer-offline --no-audit --progress=false --legacy-peer-deps
run: cd dinky-web && npm install --no-audit --progress=false --legacy-peer-deps
- name: Npm Web Build
if: steps.filter.outputs.frontend == 'true'
run: cd dinky-web && npm run build
......
......@@ -46,9 +46,9 @@ jobs:
key: ${{ runner.os }}-maven-${{ hashFiles('pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Check Style
run: |
./mvnw -T 4C -B --no-snapshot-updates clean spotless:check
# - name: Check Style
# run: |
# ./mvnw -T 4C -B --no-snapshot-updates clean spotless:check
- name: Build and Package
run: |
./mvnw -B clean install \
......@@ -75,9 +75,6 @@ jobs:
namespace: dinkydocker
steps:
- uses: actions/checkout@v3
- name: Move Dockerfile
run: |
cp ./docker/Dockerfile* ./
- name: Log in to the Container registry,url -> ${{ matrix.url }}
if: ${{ matrix.url == 'registry.cn-hangzhou.aliyuncs.com'}}
uses: docker/login-action@v2
......@@ -95,7 +92,7 @@ jobs:
- name: push docker dinky mysql image
uses: docker/build-push-action@v2
with:
file: DockerfileMysql
file: docker/DockerfileMysql
context: .
push: true
tags: ${{ matrix.url }}/${{ matrix.namespace }}/dinky-mysql-server:${{ inputs.version }}
......@@ -167,11 +164,11 @@ jobs:
FLINK_BIG_VERSION: 1.13
- FLINK_VERSION: 1.14.6
FLINK_BIG_VERSION: 1.14
- FLINK_VERSION: 1.15.2
- FLINK_VERSION: 1.15.4
FLINK_BIG_VERSION: 1.15
- FLINK_VERSION: 1.16.0
- FLINK_VERSION: 1.16.2
FLINK_BIG_VERSION: 1.16
- FLINK_VERSION : 1.17.0
- FLINK_VERSION : 1.17.1
FLINK_BIG_VERSION: 1.17
steps:
- uses: actions/checkout@v3
......@@ -208,7 +205,7 @@ jobs:
FLINK_VERSION=${{ matrix.FLINK_VERSION }}
DINKY_IMAGE=${{ matrix.url }}/${{ matrix.namespace }}/dinky-standalone-server:${{ inputs.version }}
FLINK_BIG_VERSION=${{ matrix.FLINK_BIG_VERSION }}
file: DockerfileDinkyFlink
file: ./docker/DockerfileDinkyFlink
context: .
push: true
tags: ${{ matrix.url }}/${{ matrix.namespace }}/dinky-standalone-server:${{ inputs.version }}-flink-${{matrix.FLINK_BIG_VERSION }}
......@@ -34,7 +34,6 @@ import org.apache.paimon.data.Timestamp;
import org.apache.paimon.predicate.Predicate;
import org.apache.paimon.predicate.PredicateBuilder;
import java.io.IOException;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Date;
......@@ -106,8 +105,6 @@ public class MonitorServiceImpl extends ServiceImpl<MetricsMapper, Metrics> impl
sseEmitter.send(JSONUtil.toJsonStr(Jvm.of()));
ThreadUtil.sleep(10000);
}
} catch (IOException e) {
sseEmitter.complete();
} catch (Exception e) {
e.printStackTrace();
sseEmitter.complete();
......
......@@ -19,6 +19,7 @@
package org.dinky.sse;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import org.springframework.http.HttpHeaders;
......@@ -26,6 +27,10 @@ import org.springframework.http.MediaType;
import org.springframework.http.server.ServerHttpResponse;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
import cn.hutool.core.util.ReflectUtil;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class SseEmitterUTF8 extends SseEmitter {
public SseEmitterUTF8(Long timeout) {
super(timeout);
......@@ -38,4 +43,14 @@ public class SseEmitterUTF8 extends SseEmitter {
HttpHeaders headers = outputMessage.getHeaders();
headers.setContentType(new MediaType(MediaType.TEXT_EVENT_STREAM, StandardCharsets.UTF_8));
}
@Override
public void send(Object object, MediaType mediaType) throws IOException {
Boolean complete = (Boolean) ReflectUtil.getFieldValue(this, "complete");
if (complete) {
log.warn("SseEmitter is complete, cannot send message: {}", object);
return;
}
super.send(object, mediaType);
}
}
......@@ -59,7 +59,7 @@
"omit.js": "^2.0.2",
"rc-menu": "^9.8.4",
"rc-util": "^5.33.0",
"re-resizable": "6.9.9",
"re-resizable": "6.9.11",
"react": "^18.2.0",
"react-countup": "^6.4.2",
"react-dom": "^18.0.0",
......
......@@ -20,6 +20,7 @@ export type MovableSidebarProps = {
handlerMaxsize?: () => void;
btnGroup?: React.ReactNode[];
onResize?: ResizeCallback;
onResizeStop?: ResizeCallback;
style?: React.CSSProperties;
tagList?: TabPaneProps[];
};
......@@ -32,6 +33,7 @@ const MovableSidebar: React.FC<MovableSidebarProps> = (props) => {
style,
visible,
onResize,
onResizeStop,
defaultSize,
minWidth,
maxWidth,
......@@ -57,6 +59,7 @@ const MovableSidebar: React.FC<MovableSidebarProps> = (props) => {
borderRadius: 5
}}
onResize={onResize}
onResizeStop={onResizeStop}
defaultSize={defaultSize}
minWidth={minWidth}
maxWidth={maxWidth}
......@@ -64,27 +67,6 @@ const MovableSidebar: React.FC<MovableSidebarProps> = (props) => {
maxHeight={maxHeight}
enable={enable}
>
{/*<PageContainer*/}
{/* title={title}*/}
{/* tabProps={{*/}
{/* type: "editable-card",*/}
{/* hideAdd: true,*/}
{/* size: "small",*/}
{/* animated: true,*/}
{/* tabBarStyle: {margin: 0, padding: 0},*/}
{/* }}*/}
{/* tabList={tagList}*/}
{/* extra={[*/}
{/* <Button title={l('global.mini')} key={"minimize"} icon={<MinusOutlined/>} block type={"text"} shape={"circle"}*/}
{/* onClick={props.handlerMinimize}/>*/}
{/* // <MinusSquareOutlined size={15} title={l('global.mini')} key={"minimize"} onClick={handlerMinimize}/>,*/}
{/* // <MinusOutlined size={35} title={l('global.mini')} key={"minimize"} onClick={handlerMinimize}/>,*/}
{/* // <PlusSquareOutlined size={15} title={l('global.max')} key={"maximize"} onClick={handlerMaxsize}/>*/}
{/* ]}*/}
{/* fixedHeader*/}
{/*>*/}
{/* <div style={{height: contentHeight,marginBlock:-5,marginInline:-10}}>{children}</div>*/}
{/*</PageContainer>*/}
<>
<div
style={{
......@@ -95,7 +77,7 @@ const MovableSidebar: React.FC<MovableSidebarProps> = (props) => {
>
<div>{title}</div>
<div className={showBtn ? 'show' : 'hide'}>
<Space size={5}>
<Space size={1}>
{props.btnGroup}
<CircleBtn onClick={props.handlerMinimize} icon={<MinusOutlined />} />
</Space>
......
......@@ -369,6 +369,9 @@ h5 {
font-weight: 500;
font-size: 15px;
font-family: 'SimHei', serif;
overflow: visible;
white-space: nowrap;
text-overflow: ellipsis;
}
.container-header {
display: flex;
......
import { CircleBtn } from '@/components/CallBackButton/CircleBtn';
import {CircleBtn} from '@/components/CallBackButton/CircleBtn';
import Title from '@/components/Front/Title';
import ContentScroll from '@/components/Scroll/ContentScroll';
import MovableSidebar from '@/components/Sidebar/MovableSidebar';
import { StateType, STUDIO_MODEL, VIEW } from '@/pages/DataStudio/model';
import { LeftBottomMoreTabs, LeftBottomSide } from '@/pages/DataStudio/route';
import { l } from '@/utils/intl';
import { connect } from '@@/exports';
import { PlusOutlined } from '@ant-design/icons';
import { ConfigProvider, Space, Tabs } from 'antd';
import {StateType, STUDIO_MODEL, VIEW} from '@/pages/DataStudio/model';
import {LeftBottomMoreTabs, LeftBottomSide} from '@/pages/DataStudio/route';
import {l} from '@/utils/intl';
import {connect} from '@@/exports';
import {PlusOutlined} from '@ant-design/icons';
import {ConfigProvider, Space, Tabs} from 'antd';
import React from 'react';
export type BottomContainerProps = {
size: number;
};
const BottomContainer: React.FC<BottomContainerProps> = (props: any) => {
const { dispatch, size, bottomContainer } = props;
const {dispatch, size, bottomContainer} = props;
const width = document.documentElement.clientWidth - VIEW.sideWidth * 2;
/**
* 侧边栏最小化
......@@ -70,7 +71,7 @@ const BottomContainer: React.FC<BottomContainerProps> = (props: any) => {
return Object.values(
Object.keys(LeftBottomMoreTabs).map((x) =>
LeftBottomMoreTabs[x].map((y) => {
return { ...y, key: x + '/' + y.key };
return {...y, key: x + '/' + y.key};
})
)
).flatMap((x) => x);
......@@ -82,7 +83,9 @@ const BottomContainer: React.FC<BottomContainerProps> = (props: any) => {
* @param direction
* @param {{offsetHeight: any}} elementRef
*/
const resizeCallback = (event: any, direction: any, elementRef: { offsetHeight: any }) => {
const resizeCallback = (event: any, direction: any, elementRef: {
offsetHeight: any
}) => {
updateBottomHeight(elementRef.offsetHeight);
const centerContentHeight =
document.documentElement.clientHeight -
......@@ -92,7 +95,7 @@ const BottomContainer: React.FC<BottomContainerProps> = (props: any) => {
VIEW.otherHeight -
bottomContainer.height;
updateCenterContentHeight(centerContentHeight);
updateToolContentHeight(centerContentHeight - VIEW.midMargin);
updateToolContentHeight(centerContentHeight - VIEW.leftMargin);
};
const renderTabPane = () => {
......@@ -112,7 +115,7 @@ const BottomContainer: React.FC<BottomContainerProps> = (props: any) => {
});
return (
<Tabs
style={{ height: '32px', display: '-webkit-box' }}
style={{height: '32px', display: '-webkit-box'}}
items={items}
type='card'
onChange={(key: string) => {
......@@ -133,14 +136,14 @@ const BottomContainer: React.FC<BottomContainerProps> = (props: any) => {
const renderItems = () => {
return [
...LeftBottomSide.map((x) => {
return { ...x, key: x.key + '/' };
return {...x, key: x.key + '/'};
}),
...getSubTabs()
].map((item) => {
return {
...item,
children: (
<ContentScroll height={props.bottomContainer.height - VIEW.midMargin}>
<ContentScroll height={props.bottomContainer.height - VIEW.leftMargin}>
{item.children}
</ContentScroll>
)
......@@ -148,7 +151,6 @@ const BottomContainer: React.FC<BottomContainerProps> = (props: any) => {
});
};
// @ts-ignore
return (
<MovableSidebar
title={
......@@ -169,14 +171,16 @@ const BottomContainer: React.FC<BottomContainerProps> = (props: any) => {
</Space>
</ConfigProvider>
}
visible={bottomContainer.selectKey !== ''}
visible={bottomContainer.selectKey}
style={{
zIndex: 999,
height: bottomContainer.height,
marginTop: 0,
backgroundColor: '#fff'
backgroundColor: '#fff',
position: "fixed",
bottom: VIEW.footerHeight
}}
defaultSize={{ width: '100%', height: bottomContainer.height }}
defaultSize={{width: '100%', height: bottomContainer.height}}
minHeight={VIEW.midMargin}
maxHeight={size.contentHeight - 40}
onResize={(
......@@ -186,9 +190,10 @@ const BottomContainer: React.FC<BottomContainerProps> = (props: any) => {
offsetHeight: any;
}
) => resizeCallback(event, direction, elementRef)}
btnGroup={[<CircleBtn key={'max'} icon={<PlusOutlined />} />]}
enable={{ top: true }}
btnGroup={[<CircleBtn key={'max'} icon={<PlusOutlined/>}/>]}
enable={{top: true}}
handlerMinimize={handleMinimize}
maxWidth={width}
>
<Tabs
activeKey={
......@@ -199,13 +204,15 @@ const BottomContainer: React.FC<BottomContainerProps> = (props: any) => {
: '')
}
items={renderItems()}
tabBarStyle={{ display: 'none' }}
tabBarStyle={{display: 'none'}}
/>
</MovableSidebar>
);
};
export default connect(({ Studio }: { Studio: StateType }) => ({
export default connect(({Studio}: {
Studio: StateType
}) => ({
leftContainer: Studio.leftContainer,
bottomContainer: Studio.bottomContainer,
centerContentHeight: Studio.centerContentHeight
......
......@@ -144,7 +144,11 @@ const FooterContainer: React.FC<FooterContainerProps & StateType> = (props) => {
height: VIEW.footerHeight,
width: '100%',
display: 'flex',
paddingInline: 10
paddingInline: 10,
position: 'fixed',
bottom: 0,
right: 0,
left: 0,
}}
>
<Space style={{ direction: 'ltr', width: '30%%' }}>
......
......@@ -4,11 +4,11 @@ import { connect } from '@@/exports';
import { Editor } from '@monaco-editor/react';
import { editor } from 'monaco-editor';
import React from 'react';
import {never} from "@umijs/utils/compiled/zod";
export type EditorProps = {
statement: string;
};
const { ScrollType } = editor;
const CodeEditor: React.FC<EditorProps & any> = (props) => {
const {
......@@ -64,12 +64,12 @@ const CodeEditor: React.FC<EditorProps & any> = (props) => {
});
});
}}
onChange={(v, d) => {
onChange={(v) => {
if (!current) {
return;
}
current.statement = v;
typeof v === "string" ? current.statement = v :never;
dispatch({
type: STUDIO_MODEL.saveTabs,
payload: { ...props.tabs }
......
......@@ -20,6 +20,7 @@
import { KEY_BOARD_MIDDLE } from '@/pages/DataStudio/MiddleContainer/KeyBoard/constant';
import { l } from '@/utils/intl';
import { Divider, Typography } from 'antd';
import {Fragment} from "react";
const { Title, Paragraph, Text } = Typography;
......@@ -27,7 +28,7 @@ const KeyBoard = () => {
const buildKeyBoard = () => {
return KEY_BOARD_MIDDLE.map((item, index) => {
return (
<>
<Fragment key={index}>
{index % 5 === 0 ? (
<>
<Divider plain orientationMargin={0} />
......@@ -42,7 +43,7 @@ const KeyBoard = () => {
<Divider type='vertical' />
</>
)}
</>
</Fragment>
);
});
};
......
......@@ -21,6 +21,7 @@ import { QUICK_GUIDE } from '@/pages/DataStudio/MiddleContainer/QuickGuide/const
import { l } from '@/utils/intl';
import { Link } from '@umijs/max';
import { Divider, Typography } from 'antd';
import {Fragment} from "react";
const { Title, Paragraph } = Typography;
......@@ -28,7 +29,7 @@ const QuickGuide = () => {
const buildQuickGuide = () => {
return QUICK_GUIDE.map((item, index) => {
return (
<>
<Fragment key={index}>
{index % 5 === 0 ? (
<>
<Divider plain orientationMargin={0} />
......@@ -44,7 +45,7 @@ const QuickGuide = () => {
</Link>
</>
)}
</>
</Fragment>
);
});
};
......
......@@ -267,14 +267,15 @@ const MiddleContainer = (props: any) => {
const renderMiddleContent = () => {
if (tabItems?.length === 0) {
return (
<>
// 这里必需设置高度,否则会导致下册内容无法正常拉动
<div style={{height:0}}>
<KeyBoard />
<Divider />
<br />
<br />
<br />
<QuickGuide />
</>
</div>
);
}
......
......@@ -20,12 +20,12 @@
import Title from '@/components/Front/Title';
import MovableSidebar from '@/components/Sidebar/MovableSidebar';
import useThemeValue from '@/hooks/useThemeValue';
import { mapDispatchToProps } from '@/pages/DataStudio/function';
import { StateType, VIEW } from '@/pages/DataStudio/model';
import { RightSide } from '@/pages/DataStudio/route';
import { l } from '@/utils/intl';
import { connect } from '@@/exports';
import { Tabs } from 'antd';
import {mapDispatchToProps} from '@/pages/DataStudio/function';
import {StateType, VIEW} from '@/pages/DataStudio/model';
import {RightSide} from '@/pages/DataStudio/route';
import {l} from '@/utils/intl';
import {connect} from '@@/exports';
import {Tabs} from 'antd';
import React from 'react';
export type RightContainerProps = {
......@@ -38,7 +38,7 @@ const RightContainer: React.FC<RightContainerProps> = (prop: any) => {
size,
leftContainer,
rightContainer,
bottomHeight,
toolContentHeight,
updateRightWidth,
updateSelectRightKey,
tabs
......@@ -46,7 +46,7 @@ const RightContainer: React.FC<RightContainerProps> = (prop: any) => {
const maxWidth = size.width - 2 * VIEW.leftToolWidth - leftContainer.width - 600;
return (
<MovableSidebar
contentHeight={size.contentHeight - VIEW.midMargin - bottomHeight}
contentHeight={toolContentHeight}
onResize={(
event: any,
direction: any,
......@@ -64,14 +64,14 @@ const RightContainer: React.FC<RightContainerProps> = (prop: any) => {
}}
minWidth={200}
maxWidth={maxWidth}
enable={{ left: true }}
style={{ borderInlineStart: `1px solid ${themeValue.borderColor}` }}
enable={{left: true}}
style={{borderInlineStart: `1px solid ${themeValue.borderColor}`}}
>
{tabs.panes.length > 0 ? (
<Tabs
activeKey={rightContainer.selectKey}
items={RightSide}
tabBarStyle={{ display: 'none' }}
tabBarStyle={{display: 'none'}}
/>
) : (
<> </>
......@@ -81,12 +81,13 @@ const RightContainer: React.FC<RightContainerProps> = (prop: any) => {
};
export default connect(
({ Studio }: { Studio: StateType }) => ({
({Studio}: { Studio: StateType }) => ({
leftContainer: Studio.leftContainer,
rightContainer: Studio.rightContainer,
bottomContainer: Studio.bottomContainer,
activeBreadcrumbTitle: Studio.tabs.activeBreadcrumbTitle,
tabs: Studio.tabs
tabs: Studio.tabs,
toolContentHeight: Studio.toolContentHeight
}),
mapDispatchToProps
)(RightContainer);
......@@ -91,8 +91,8 @@ const DataStudio = (props: any) => {
height: document.documentElement.clientHeight,
contentHeight:
document.documentElement.clientHeight -
VIEW.headerHeight -
VIEW.headerNavHeight -
VIEW.headerHeight -
VIEW.footerHeight -
VIEW.otherHeight
});
......@@ -103,7 +103,7 @@ const DataStudio = (props: any) => {
setSize(getClientSize());
const centerContentHeight = getClientSize().contentHeight - bottomHeight;
updateCenterContentHeight(centerContentHeight);
updateToolContentHeight(centerContentHeight - VIEW.midMargin);
updateToolContentHeight(centerContentHeight - VIEW.leftMargin);
};
useEffect(() => {
......
......@@ -16,7 +16,7 @@ import ICodeEditor = editor.ICodeEditor;
*/
export const VIEW = {
headerHeight: 32,
headerNavHeight: 55,
headerNavHeight: 56,
footerHeight: 25,
sideWidth: 40,
leftToolWidth: 180,
......@@ -26,7 +26,7 @@ export const VIEW = {
rightMargin: 32,
leftMargin: 36,
midMargin: 44,
otherHeight: 1,
otherHeight: 0,
paddingInline: 50
};
......
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