Unverified Commit 4f6c1c14 authored by zhu-mingye's avatar zhu-mingye Committed by GitHub

fix float btn bug and improve some code (#2542)

* Spotless Apply * fix float btn bug and improve some code * Spotless Apply * fix float btn bug and improve some code * fix float btn bug and improve some code * Spotless Apply --------- Co-authored-by: 's avatarzhu-mingye <zhu-mingye@users.noreply.github.com>
parent 767bca8d
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
"not ie <= 10" "not ie <= 10"
], ],
"dependencies": { "dependencies": {
"@andrewray/react-multi-split-pane": "^0.3.5",
"@ant-design/charts": "^1.4.2", "@ant-design/charts": "^1.4.2",
"@ant-design/icons": "^5.2.6", "@ant-design/icons": "^5.2.6",
"@ant-design/pro-components": "^2.6.41", "@ant-design/pro-components": "^2.6.41",
......
...@@ -23,6 +23,7 @@ import { Loading } from '@/pages/Other/Loading'; ...@@ -23,6 +23,7 @@ import { Loading } from '@/pages/Other/Loading';
import { MonacoEditorOptions } from '@/types/Public/data'; import { MonacoEditorOptions } from '@/types/Public/data';
import { convertCodeEditTheme } from '@/utils/function'; import { convertCodeEditTheme } from '@/utils/function';
import { Editor, useMonaco } from '@monaco-editor/react'; import { Editor, useMonaco } from '@monaco-editor/react';
import { Col, Row } from 'antd';
import { editor } from 'monaco-editor'; import { editor } from 'monaco-editor';
import { EditorLanguage } from 'monaco-editor/esm/metadata'; import { EditorLanguage } from 'monaco-editor/esm/metadata';
import { CSSProperties, useEffect, useRef, useState } from 'react'; import { CSSProperties, useEffect, useRef, useState } from 'react';
...@@ -204,72 +205,68 @@ const CodeShow = (props: CodeShowFormProps) => { ...@@ -204,72 +205,68 @@ const CodeShow = (props: CodeShowFormProps) => {
* render * render
*/ */
return ( return (
<div className={'monaco-float'} style={props.style}> <>
{/* fullScreen button */} <Row wrap={false}>
{fullScreenBtn && ( <Col flex='auto'>
<FullscreenBtn {/* fullScreen button */}
isFullscreen={fullScreen} {fullScreenBtn && (
fullScreenCallBack={() => setFullScreen(!fullScreen)} <FullscreenBtn
/> isFullscreen={fullScreen}
)} fullScreenCallBack={() => setFullScreen(!fullScreen)}
/>
)}
{/* editor */} {/* editor */}
<Editor <Editor
width={width} width={width}
height={height} height={height}
loading={<Loading loading={loading} />} loading={<Loading loading={loading} />}
value={code ?? ''} value={code ?? ''}
language={language} language={language}
options={{ options={{
scrollBeyondLastLine: false, scrollBeyondLastLine: false,
readOnly: true, readOnly: true,
wordWrap: autoWrap, wordWrap: autoWrap,
autoDetectHighContrast: true, autoDetectHighContrast: true,
selectOnLineNumbers: true, selectOnLineNumbers: true,
fixedOverflowWidgets: true, fixedOverflowWidgets: true,
autoClosingDelete: 'always', autoClosingDelete: 'always',
lineNumbers, lineNumbers,
minimap: { enabled: false }, minimap: { enabled: false },
scrollbar: { scrollbar: {
// Subtle shadows to the left & top. Defaults to true. // Subtle shadows to the left & top. Defaults to true.
useShadows: false, useShadows: false,
// Render vertical arrows. Defaults to false. // Render vertical arrows. Defaults to false.
// verticalHasArrows: true, // verticalHasArrows: true,
// Render horizontal arrows. Defaults to false. // Render horizontal arrows. Defaults to false.
// horizontalHasArrows: true, // horizontalHasArrows: true,
// Render vertical scrollbar. // Render vertical scrollbar.
// Accepted values: 'auto', 'visible', 'hidden'. // Accepted values: 'auto', 'visible', 'hidden'.
// Defaults to 'auto' // Defaults to 'auto'
vertical: 'visible', vertical: 'visible',
// Render horizontal scrollbar. // Render horizontal scrollbar.
// Accepted values: 'auto', 'visible', 'hidden'. // Accepted values: 'auto', 'visible', 'hidden'.
// Defaults to 'auto' // Defaults to 'auto'
horizontal: 'visible', horizontal: 'visible',
verticalScrollbarSize: 8, verticalScrollbarSize: 8,
horizontalScrollbarSize: 8, horizontalScrollbarSize: 8,
arrowSize: 30 arrowSize: 30
}, },
...options ...options
}} }}
onMount={editorDidMount} onMount={editorDidMount}
theme={convertCodeEditTheme()} theme={convertCodeEditTheme()}
/> />
</Col>
{/* float button */} {showFloatButton && (
{showFloatButton && ( <Col flex='none'>
<div <EditorFloatBtn {...restEditBtnProps} />
style={{ </Col>
width: 35, )}
height: height, </Row>
paddingBlock: 10 </>
}}
>
<EditorFloatBtn {...restEditBtnProps} />
</div>
)}
</div>
); );
}; };
......
...@@ -458,6 +458,29 @@ export const FlinkSQLEnvSvg = () => ( ...@@ -458,6 +458,29 @@ export const FlinkSQLEnvSvg = () => (
/> />
); );
export const FlinkJarSvg = () => (
<Icon
style={{ ...IconStyle }}
component={() => (
<svg
className='icon'
viewBox='0 0 1084 1024'
version='1.1'
xmlns='http://www.w3.org/2000/svg'
>
<path
d='M705.636962 230.301473l-1.686542 17.166584-1.98771 11.143221 0.783038-0.903504c4.758457-5.421027 9.637381-10.78182 14.636771-15.961912l23.491116-23.189947 1.867242-6.987101a525.83958 525.83958 0 0 1 8.79411-28.008637l4.81869-13.371866c9.45668-24.153685 20.961303-46.199193 36.260645-68.124234 18.612191-27.707469 56.017275-34.393402 85.230585-14.576538 6.204064 4.81869 11.444389 10.842053 15.359575 17.166584l3.373083 6.625699 35.296907 78.00255 6.14383 3.614017 7.228035 4.577756c13.733267 9.396446 23.972984 17.58822 32.465926 26.984666 37.103915 37.766485 58.42662 86.134089 59.631293 132.152582 2.228644 63.606712-34.272935 109.866139-86.375024 123.478939l-2.168411 0.421635 5.601728 10.540885c4.81869 9.938549 9.035044 20.238499 12.588828 30.899852l5.180092 18.070088c10.842053 44.994521-5.601727 78.303717-45.65709 88.904836-15.058407 4.397055-31.261253 3.49355-45.777558-2.529812l-8.011073-3.192382 0.66257 7.047334c0.602336 11.926259-0.481869 24.093452-3.252616 36.441346l-3.192382 12.528595-9.516914 31.441954c12.106959 16.92565 18.672425 38.067653 18.190556 58.486853l-0.84327 10.11925c-4.999391 34.754804-30.478216 58.968723-68.365169 62.281572l-8.974811 0.361402h-79.146988a30.056581 30.056581 0 0 1-30.056581-27.346067c-1.385373-15.480043-432.658156-265.449602-448.559834-265.931472a30.116814 30.116814 0 0 1-29.21331-29.092842 356.583083 356.583083 0 0 1 21.382938-110.829878l6.746167-17.467752 7.107568-17.347285 12.649062-32.164758c21.202237-55.77634 31.622655-95.169134 31.622655-128.659031 0-22.286443-5.421027-30.719151-25.298124-31.923823l-6.444998-0.240935c-65.052319 0.481869-87.760397-86.555725-33.971767-111.492447 137.814543-94.265629 367.48537-99.987824 451.14988 29.514478 23.491115 36.260645 33.730832 80.411894 30.237282 131.309311z'
fill='#FFCEE8'
></path>
<path
d='M675.39968 98.811461c23.491115 36.381112 33.730832 80.532362 30.237282 131.490012l-1.686542 17.166584-1.98771 11.143221 0.783038-0.903504c4.758457-5.421027 9.637381-10.78182 14.636771-15.961912l23.491116-23.189947 1.867242-6.987101a525.83958 525.83958 0 0 1 8.79411-28.008637l4.81869-13.371866c9.45668-24.153685 20.961303-46.199193 36.260645-68.124234 18.612191-27.707469 56.017275-34.393402 85.230585-14.576538 6.204064 4.81869 11.444389 10.842053 15.359575 17.166584l3.373083 6.625699 35.296907 78.00255 6.14383 3.614017 7.228035 4.577756c13.733267 9.396446 23.972984 17.58822 32.465926 26.984666 37.103915 37.766485 58.42662 86.134089 59.631293 132.152582 2.228644 63.606712-34.272935 109.866139-86.375024 123.478939l-2.168411 0.421635 5.601728 10.540885c4.81869 9.938549 9.035044 20.238499 12.588828 30.899852l5.180092 18.070088c10.842053 44.994521-5.601727 78.303717-45.65709 88.904836-15.058407 4.397055-31.261253 3.49355-45.777558-2.529812l-8.011073-3.192382 0.66257 7.047334c0.602336 11.926259-0.481869 24.093452-3.252616 36.441346l-3.192382 12.528595-9.516914 31.441954c12.106959 16.92565 18.672425 38.067653 18.190556 58.486853l-0.84327 10.11925c-4.999391 34.754804-30.478216 58.968723-68.365169 62.281572l-8.974811 0.301168h-79.146988a30.056581 30.056581 0 0 1-5.421027-59.510825l5.421027-0.602336h79.146988c12.829763 0 16.684715-3.192382 17.768921-11.022754a37.284616 37.284616 0 0 0-7.228036-25.840227l-3.373083-3.674251a30.116814 30.116814 0 0 1-9.878315-28.430273l3.614018-14.034436 11.082987-37.103915c8.372474-27.2256 2.830981-52.523724-13.191164-76.85811a30.116814 30.116814 0 0 1 31.923823-45.777558c12.046726 2.65028 23.792283 7.348503 38.790457 14.576538l24.936722 12.347894c10.842053 4.999391 15.540276 5.902896 19.033827 4.939157l3.674251-1.204672c1.686542-0.963738 1.927476-2.590046 1.084206-7.107569l-2.409346-10.29995a190.518968 190.518968 0 0 0-17.467752-43.609147l-8.553175-14.27537-8.372475-10.902287-10.420417-12.649062a30.116814 30.116814 0 0 1 29.39401-49.030174c47.042464 10.842053 81.014231-15.239108 79.50839-63.24531-0.903504-30.779384-15.901678-64.690917-43.247745-92.759789a123.298238 123.298238 0 0 0-22.768312-18.491724 129.984171 129.984171 0 0 0-15.841444-9.095278 30.116814 30.116814 0 0 1-11.564857-10.119249l-2.529812-4.457289-39.513261-87.097827-8.613409 13.130931a265.931471 265.931471 0 0 0-14.697005 27.707469l-6.023363 14.456071a486.928656 486.928656 0 0 0-15.660744 50.29508 30.116814 30.116814 0 0 1-8.31224 14.094669l-10.540885 10.179484c-10.239717 9.637381-20.057798 19.75663-29.394011 30.357748l-5.421027 6.444999-11.805791 8.914577c-22.165975 9.45668-45.777558 20.901069-71.557551 34.513869-27.105133 14.395837-55.836574-16.142613-39.814429-42.16354 13.432099-21.804574 21.382938-42.645409 24.274153-64.57045 5.601727-44.572885-1.385373-80.472128-19.455462-108.420532C563.606065 36.650356 371.64149 41.469046 254.185914 121.399072l1.204672-0.481869 2.710514-0.120467c60.655264 0 92.097218 36.381112 92.097218 92.277919 0 39.392793-9.757848 79.990259-30.177048 135.585899l-12.167193 31.923823-13.913968 34.212701a300.746509 300.746509 0 0 0-23.370648 106.493056 30.116814 30.116814 0 0 1-60.052928-1.807009 356.583083 356.583083 0 0 1 21.382938-110.70941l6.746166-17.527986 7.107569-17.347285 12.649062-32.164758c21.202237-55.77634 31.622655-95.169134 31.622655-128.659031 0-22.286443-5.421027-30.719151-25.298124-31.923823l-6.444999-0.240935c-65.052319 0.481869-87.760397-86.555725-33.971766-111.492447 137.814543-94.265629 367.48537-99.987824 451.14988 29.514478V98.811461zM106.011187 637.42057v291.831932c0 50.475781-27.285834 76.19554-80.773297 76.19554H0v-44.81382h20.599901c20.599901 0 30.839618-11.323922 30.839618-33.429664v-289.723754h54.571668z m193.530649-7.228035c39.151859 0 67.943533 9.818082 86.495491 29.394011 15.901678 16.985883 24.153685 41.681671 24.153685 74.087363V903.532742h-50.415547v-37.585784a110.829877 110.829877 0 0 1-38.609756 31.923823c-17.467752 8.252007-38.067653 12.889997-61.73947 12.889997-27.827937 0-49.391576-7.228035-64.871618-21.08177a66.377459 66.377459 0 0 1-25.23789-54.089799c0-29.815646 11.866025-53.005593 35.537841-68.967505 21.623873-15.419809 52.463491-23.129713 91.555115-24.153685l59.75176-1.566075v-10.842053c0-37.043682-20.057798-55.535406-60.233629-55.535406-16.985883 0-30.839618 3.011681-41.139568 9.215746a47.223165 47.223165 0 0 0-23.189947 32.947795l-54.029565-4.63799c5.661961-28.791675 20.057798-50.415547 42.765876-63.847646 19.515696-12.28766 46.259427-17.949621 79.207222-17.949622z m296.469921 0c13.371866 0 25.177657 2.108177 34.453636 6.746166v54.571668a129.923937 129.923937 0 0 0-38.549522-5.661961c-16.504014 0-31.441954 6.625699-44.271718 20.057798-13.913968 14.456071-20.599901 33.429664-20.599901 56.619611V903.532742h-54.571667v-266.112172h54.571667v40.175831c6.625699-14.456071 15.419809-25.23789 25.71976-32.405693a65.052319 65.052319 0 0 1 43.247745-14.93794z m-239.85031 150.343137l-56.077508 1.505841c-49.993912 1.084205-74.6897 18.551958-74.6897 51.499753a30.116814 30.116814 0 0 0 12.889997 25.23789c8.252007 6.625699 19.575929 10.239717 33.489897 10.239717 23.129713 0 42.705643-7.228035 59.149424-21.08177 16.504014-13.853735 25.23789-31.381721 25.23789-51.981622v-15.419809zM78.725353 530.927514c10.842053 0 20.118032 3.011681 27.285834 10.239717 7.228035 6.746166 10.842053 15.480043 10.842053 26.261862 0 10.842053-3.614018 19.575929-10.842053 26.803965a40.898634 40.898634 0 0 1-27.285834 10.239717 37.34485 37.34485 0 0 1-26.201629-10.239717 35.417374 35.417374 0 0 1-11.323922-26.803965c0-10.842053 3.614018-19.515696 11.323922-26.201628 7.228035-7.228035 15.901678-10.299951 26.201629-10.299951z m815.3224-244.066664a33.730832 33.730832 0 1 1 0 67.461665 33.730832 33.730832 0 0 1 0-67.461665z'
fill='#E04D9D'
></path>
</svg>
)}
/>
);
export const LogSvg = () => { export const LogSvg = () => {
return ( return (
<> <>
......
...@@ -237,8 +237,6 @@ ol { ...@@ -237,8 +237,6 @@ ol {
.siderTree { .siderTree {
height: 100%; height: 100%;
min-height: 82vh;
max-height: 82vh;
overflow-x: auto; overflow-x: auto;
overflow-y: auto; overflow-y: auto;
...@@ -613,3 +611,71 @@ h5 { ...@@ -613,3 +611,71 @@ h5 {
span .mtkb { span .mtkb {
font-weight: inherit; font-weight: inherit;
} }
// ============================= layout split pane style start =============================
.split-pane {
position: relative;
display: flex;
flex-direction: column;
width: 100%;
overflow: hidden;
}
.Resizer {
z-index: 1;
box-sizing: border-box;
background: #000;
background-clip: padding-box;
opacity: 0.2;
}
.Resizer:hover {
transition: all 2s ease;
}
.Resizer.horizontal {
height: 11px;
margin: -5px 0;
border-top: 5px solid rgba(255, 255, 255, 0);
border-bottom: 5px solid rgba(255, 255, 255, 0);
cursor: row-resize;
}
.Resizer.horizontal:hover,
.Resizer.horizontal.resizing {
border-top: 5px solid rgba(0, 0, 0, 0.5);
border-bottom: 5px solid rgba(0, 0, 0, 0.5);
}
.Resizer.vertical {
width: 11px;
height: 98%;
margin: 0 -5px;
border-right: 5px solid rgba(255, 255, 255, 0);
border-left: 5px solid rgba(255, 255, 255, 0);
cursor: col-resize;
}
.Resizer.vertical:hover,
.Resizer.vertical.resizing {
border-right: 5px solid rgba(0, 0, 0, 0.5);
border-left: 5px solid rgba(0, 0, 0, 0.5);
}
.DragLayer {
z-index: 1;
pointer-events: none;
}
.DragLayer.resizing {
pointer-events: auto;
}
.DragLayer.horizontal {
cursor: row-resize;
}
.DragLayer.vertical {
cursor: col-resize;
}
// ============================= layout split pane style end =============================
...@@ -18,19 +18,19 @@ ...@@ -18,19 +18,19 @@
*/ */
import CodeShow from '@/components/CustomEditor/CodeShow'; import CodeShow from '@/components/CustomEditor/CodeShow';
import MovableSidebar from '@/components/Sidebar/MovableSidebar';
import useThemeValue from '@/hooks/useThemeValue';
import { SseData } from '@/models/Sse'; import { SseData } from '@/models/Sse';
import { DataStudioTabsItemType, StateType } from '@/pages/DataStudio/model'; import { DataStudioTabsItemType, StateType } from '@/pages/DataStudio/model';
import { SSE_TOPIC } from '@/pages/DevOps/constants'; import { SSE_TOPIC } from '@/pages/DevOps/constants';
import { API_CONSTANTS } from '@/services/endpoints'; import { API_CONSTANTS } from '@/services/endpoints';
import { parseMilliSecondStr } from '@/utils/function'; import { parseMilliSecondStr } from '@/utils/function';
import { connect, useModel, useRequest } from '@@/exports'; import { SplitPane } from '@andrewray/react-multi-split-pane';
import { Pane } from '@andrewray/react-multi-split-pane/dist/lib/Pane';
import { CheckOutlined, CloseCircleFilled, LoadingOutlined } from '@ant-design/icons'; import { CheckOutlined, CloseCircleFilled, LoadingOutlined } from '@ant-design/icons';
import { connect, useModel, useRequest } from '@umijs/max';
import { Empty, Space, Typography } from 'antd'; import { Empty, Space, Typography } from 'antd';
import { DataNode } from 'antd/es/tree'; import { DataNode } from 'antd/es/tree';
import DirectoryTree from 'antd/es/tree/DirectoryTree'; import DirectoryTree from 'antd/es/tree/DirectoryTree';
import { Key, useEffect, useState } from 'react'; import { Key, useEffect, useRef, useState } from 'react';
const { Text } = Typography; const { Text } = Typography;
...@@ -63,6 +63,7 @@ const buildExpandKeys = (node: ProcessStep) => { ...@@ -63,6 +63,7 @@ const buildExpandKeys = (node: ProcessStep) => {
const ConsoleContent = (props: ConsoleProps) => { const ConsoleContent = (props: ConsoleProps) => {
const { tab } = props; const { tab } = props;
const refObject = useRef<HTMLDivElement>(null);
const [selectNode, setSelectNode] = useState<ProcessStep>(); const [selectNode, setSelectNode] = useState<ProcessStep>();
const [processNode, setProcessNode] = useState<ProcessStep>(); const [processNode, setProcessNode] = useState<ProcessStep>();
...@@ -73,7 +74,6 @@ const ConsoleContent = (props: ConsoleProps) => { ...@@ -73,7 +74,6 @@ const ConsoleContent = (props: ConsoleProps) => {
const { subscribeTopic } = useModel('Sse', (model: any) => ({ const { subscribeTopic } = useModel('Sse', (model: any) => ({
subscribeTopic: model.subscribeTopic subscribeTopic: model.subscribeTopic
})); }));
const themeValue = useThemeValue();
const onUpdate = (data: ProcessStep) => { const onUpdate = (data: ProcessStep) => {
setProcessNode((prevState: any) => { setProcessNode((prevState: any) => {
...@@ -139,48 +139,51 @@ const ConsoleContent = (props: ConsoleProps) => { ...@@ -139,48 +139,51 @@ const ConsoleContent = (props: ConsoleProps) => {
}; };
return ( return (
<div style={{ overflow: 'hidden' }}> <div style={{ height: props.height - 53 }}>
<MovableSidebar <SplitPane
defaultSize={{ split={'vertical'}
width: 300, defaultSizes={[100, 500]}
height: props.height - 53 minSize={100}
}} className={'split-pane'}
minWidth={20}
visible={true}
enable={{ right: true }}
headerVisible={false}
style={{
float: 'left',
borderInlineEnd: `1px solid ${themeValue.borderColor}`,
paddingInline: 10
}}
> >
{processNode ? ( <Pane
<DirectoryTree className={'split-pane'}
className={'treeList'} forwardRef={refObject}
showIcon={false} minSize={100}
titleRender={renderTitle} size={100}
onSelect={onSelect} split={'horizontal'}
treeData={[processNode]} >
expandedKeys={expandedKeys} {processNode ? (
expandAction={'doubleClick'} <DirectoryTree
onExpand={handleExpand} className={'treeList'}
showIcon={false}
titleRender={renderTitle}
onSelect={onSelect}
treeData={[processNode]}
expandedKeys={expandedKeys}
expandAction={'doubleClick'}
onExpand={handleExpand}
/>
) : (
<Empty />
)}
</Pane>
<Pane
className={'split-pane'}
forwardRef={refObject}
minSize={100}
size={100}
split={'horizontal'}
>
<CodeShow
code={selectNode?.log ? selectNode.log : ''}
height={props.height - 53}
language={'javalog'}
showFloatButton
/> />
) : ( </Pane>
<Empty /> </SplitPane>
)}
</MovableSidebar>
<div style={{ display: 'inline', width: 1500 }}>
<CodeShow
code={selectNode?.log ? selectNode.log : ''}
height={props.height - 53}
language={'javalog'}
lineNumbers={'off'}
autoWrap={'off'}
//TODO 按钮显示有问题,先注释
// showFloatButton
/>
</div>
</div> </div>
); );
}; };
......
...@@ -70,6 +70,55 @@ export const getLeafKeyList = (tree: any[]): Key[] => { ...@@ -70,6 +70,55 @@ export const getLeafKeyList = (tree: any[]): Key[] => {
} }
return leafKeyList; return leafKeyList;
}; };
export const buildStepValue = (step: number) => {
// "success", "processing", "error", "default", "warning"
switch (step) {
case 1:
return {
title: l('global.table.lifecycle.dev'),
status: 'processing',
color: '#1890ff'
};
case 2:
return {
title: l('global.table.lifecycle.online'),
status: 'success',
color: '#52c41a'
};
default:
return {
title: l('global.table.lifecycle.dev'),
status: 'default',
color: '#1890ff'
};
}
};
export const showBadge = (type: string) => {
if (!type) {
return false;
}
switch (type.toLowerCase()) {
case DIALECT.SQL:
case DIALECT.MYSQL:
case DIALECT.ORACLE:
case DIALECT.SQLSERVER:
case DIALECT.POSTGRESQL:
case DIALECT.CLICKHOUSE:
case DIALECT.PHOENIX:
case DIALECT.DORIS:
case DIALECT.HIVE:
case DIALECT.STARROCKS:
case DIALECT.PRESTO:
case DIALECT.FLINK_SQL:
case DIALECT.FLINKJAR:
return true;
default:
return false;
}
};
/** /**
* build Catalogue tree * build Catalogue tree
* @param {Catalogue[]} data * @param {Catalogue[]} data
...@@ -138,70 +187,3 @@ export const buildProjectTree = ( ...@@ -138,70 +187,3 @@ export const buildProjectTree = (
export const isUDF = (jobType: string): boolean => { export const isUDF = (jobType: string): boolean => {
return jobType === 'Scala' || jobType === 'Python' || jobType === 'Java'; return jobType === 'Scala' || jobType === 'Python' || jobType === 'Java';
}; };
export const buildStepValue = (step: number) => {
// "success", "processing", "error", "default", "warning"
// todo: 生命周期正在重构 后续在优化
switch (step) {
case 0:
return {
title: l('global.table.lifecycle.unknown'),
status: 'default',
color: '#b0aeae'
};
case 1:
return {
title: l('global.table.lifecycle.dev'),
status: 'processing',
color: '#1890ff'
};
case 2:
return {
title: l('global.table.lifecycle.online'),
status: 'success',
color: '#52c41a'
};
case 3:
return {
title: l('global.table.lifecycle.stopped'),
status: 'error',
color: '#f5222d'
};
case 4:
return {
title: l('global.table.lifecycle.offline'),
status: 'warning',
color: '#faad14'
};
default:
return {
title: l('global.table.lifecycle.dev'),
status: 'default',
color: '#1890ff'
};
}
};
export const showBadge = (type: string) => {
if (!type) {
return false;
}
switch (type.toLowerCase()) {
case DIALECT.SQL:
case DIALECT.MYSQL:
case DIALECT.ORACLE:
case DIALECT.SQLSERVER:
case DIALECT.POSTGRESQL:
case DIALECT.CLICKHOUSE:
case DIALECT.PHOENIX:
case DIALECT.DORIS:
case DIALECT.HIVE:
case DIALECT.STARROCKS:
case DIALECT.PRESTO:
case DIALECT.FLINK_SQL:
case DIALECT.FLINKJAR:
return true;
default:
return false;
}
};
...@@ -41,16 +41,12 @@ import React, { useEffect, useRef, useState } from 'react'; ...@@ -41,16 +41,12 @@ import React, { useEffect, useRef, useState } from 'react';
import { format } from 'sql-formatter'; import { format } from 'sql-formatter';
export type EditorProps = { export type EditorProps = {
tabsItem: DataStudioTabsItemType tabsItem: DataStudioTabsItemType;
height?: number; height?: number;
}; };
const CodeEditor: React.FC<EditorProps & any> = (props) => { const CodeEditor: React.FC<EditorProps & any> = (props) => {
const { const { tabsItem, dispatch, height } = props;
tabsItem,
dispatch,
height
} = props;
useEffect(() => { useEffect(() => {
dispatch({ dispatch({
......
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one or more * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. * this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0 * 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 not use this file except in compliance with
* the License. You may obtain a copy of the License at * 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 * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
* *
*/ */
import { import {
FileIcon, FileIcon,
FlinkJarSvg,
FlinkSQLEnvSvg, FlinkSQLEnvSvg,
FlinkSQLSvg, FlinkSQLSvg,
JavaSvg, JavaSvg,
...@@ -71,6 +72,8 @@ export const getTabIcon = (type: string, size?: number) => { ...@@ -71,6 +72,8 @@ export const getTabIcon = (type: string, size?: number) => {
return <ShellSvg />; return <ShellSvg />;
case DIALECT.LOG: case DIALECT.LOG:
return <LogSvg />; return <LogSvg />;
case DIALECT.FLINKJAR:
return <FlinkJarSvg />;
case DIALECT.FLINK_SQL: case DIALECT.FLINK_SQL:
return <FlinkSQLSvg />; return <FlinkSQLSvg />;
case DIALECT.FLINKSQLENV: case DIALECT.FLINKSQLENV:
......
...@@ -21,39 +21,45 @@ import { JobProps } from '@/pages/DevOps/JobDetail/data'; ...@@ -21,39 +21,45 @@ import { JobProps } from '@/pages/DevOps/JobDetail/data';
import ExceptionTab from '@/pages/DevOps/JobDetail/JobLogs/components/ExceptionTab'; import ExceptionTab from '@/pages/DevOps/JobDetail/JobLogs/components/ExceptionTab';
import JobManagerLogsTab from '@/pages/DevOps/JobDetail/JobLogs/components/JobManagerLogsTab'; import JobManagerLogsTab from '@/pages/DevOps/JobDetail/JobLogs/components/JobManagerLogsTab';
import TaskManagerLogsTab from '@/pages/DevOps/JobDetail/JobLogs/components/TaskManagerLogsTab'; import TaskManagerLogsTab from '@/pages/DevOps/JobDetail/JobLogs/components/TaskManagerLogsTab';
import { Tabs, Typography } from 'antd'; import { ProCard } from '@ant-design/pro-components';
import { useState } from 'react';
const { Text, Paragraph } = Typography;
const JobLogsTab = (props: JobProps) => { const JobLogsTab = (props: JobProps) => {
const { jobDetail } = props; const { jobDetail } = props;
const [activeKey, setActiveKey] = useState('Exception');
const tabsItems = [
{
label: 'Exception',
key: 'Exception',
children: <ExceptionTab jobDetail={jobDetail} />
},
{
label: 'JobManager',
key: 'JobManager',
children: <JobManagerLogsTab jobDetail={jobDetail} />
},
{
label: 'TaskManager',
key: 'TaskManager',
children: <TaskManagerLogsTab jobDetail={jobDetail} />
}
];
return ( return (
<> <>
{/*<ProCard>*/} <ProCard
<Tabs tabs={{
tabPosition={'left'} size: 'small',
size={'small'} tabPosition: 'left',
items={[ type: 'card',
{ activeKey: activeKey,
label: 'Exception', onChange: setActiveKey,
key: 'Exception', items: tabsItems
children: <ExceptionTab jobDetail={jobDetail} /> }}
},
{
label: 'JobManager',
key: 'JobManager',
children: <JobManagerLogsTab jobDetail={jobDetail} />
},
{
label: 'TaskManager',
key: 'TaskManager',
children: <TaskManagerLogsTab jobDetail={jobDetail} />
}
]}
/> />
{/*</ProCard>*/}
</> </>
); );
}; };
......
...@@ -84,7 +84,8 @@ const ExceptionTab = (props: JobProps) => { ...@@ -84,7 +84,8 @@ const ExceptionTab = (props: JobProps) => {
</Paragraph> </Paragraph>
<CodeShow <CodeShow
code={currentLog.stacktrace ? currentLog.stacktrace : 'No Exception'} code={currentLog.stacktrace ? currentLog.stacktrace : 'No Exception'}
height={500} height={parent.innerHeight - 300}
showFloatButton
/> />
</Card> </Card>
</Col> </Col>
...@@ -92,7 +93,11 @@ const ExceptionTab = (props: JobProps) => { ...@@ -92,7 +93,11 @@ const ExceptionTab = (props: JobProps) => {
); );
}; };
return <ProCard>{renderLogTab()}</ProCard>; return (
<ProCard bodyStyle={{ height: parent.innerHeight - 200, overflow: 'auto' }}>
{renderLogTab()}
</ProCard>
);
}; };
export default ExceptionTab; export default ExceptionTab;
...@@ -22,15 +22,15 @@ import { JobProps } from '@/pages/DevOps/JobDetail/data'; ...@@ -22,15 +22,15 @@ import { JobProps } from '@/pages/DevOps/JobDetail/data';
import { API_CONSTANTS } from '@/services/endpoints'; import { API_CONSTANTS } from '@/services/endpoints';
import { useRequest } from '@@/exports'; import { useRequest } from '@@/exports';
import { ProCard } from '@ant-design/pro-components'; import { ProCard } from '@ant-design/pro-components';
import { Spin, Tabs, Typography } from 'antd'; import { Spin } from 'antd';
import { EditorLanguage } from 'monaco-editor/esm/metadata'; import { useState } from 'react';
const { Text, Paragraph } = Typography;
const JobManagerLogsTab = (props: JobProps) => { const JobManagerLogsTab = (props: JobProps) => {
const { jobDetail } = props; const { jobDetail } = props;
const jmaddr = jobDetail?.history?.jobManagerAddress; const jmaddr = jobDetail?.history?.jobManagerAddress;
const [activeKey, setActiveKey] = useState('LOG');
const log = useRequest({ const log = useRequest({
url: API_CONSTANTS.GET_JOBMANAGER_LOG, url: API_CONSTANTS.GET_JOBMANAGER_LOG,
params: { address: jmaddr } params: { address: jmaddr }
...@@ -46,42 +46,59 @@ const JobManagerLogsTab = (props: JobProps) => { ...@@ -46,42 +46,59 @@ const JobManagerLogsTab = (props: JobProps) => {
params: { address: jmaddr } params: { address: jmaddr }
}); });
const getLog = (ur: any, language?: EditorLanguage) => { const getLog = (ur: any, language?: string) => {
return ( return (
<Spin spinning={ur.loading}> <Spin spinning={ur.loading}>
<CodeShow language={language} code={ur.data ? ur.data : 'No Log'} height={600} /> <CodeShow
showFloatButton
language={language}
code={ur.data ? ur.data : 'No Log'}
height={parent.innerHeight - 300}
/>
</Spin> </Spin>
); );
}; };
const getDump = (ur: any) => {
const buildDumpLog = (ur: any) => {
if (!ur.data) {
return;
} else {
return (JSON.parse(ur.data)['threadInfos'] as any[])
.map((x) => x['stringifiedThreadInfo'])
.join('');
}
};
const getDump = (ur: any, language?: string) => {
return ( return (
<Spin spinning={ur.loading}> <Spin spinning={ur.loading}>
<CodeShow <CodeShow
language={'kotlin'} showFloatButton
code={ language={language}
ur.data code={buildDumpLog(ur) ?? 'No Log'}
? (JSON.parse(ur.data)['threadInfos'] as any[]) height={parent.innerHeight - 300}
.map((x) => x['stringifiedThreadInfo'])
.join('')
: 'No Log'
}
height={600}
/> />
</Spin> </Spin>
); );
}; };
return ( return (
<ProCard> <ProCard
<Tabs headerBordered
size={'small'} bordered
items={[ bodyStyle={{ height: parent.innerHeight, overflow: 'auto' }}
{ label: 'Log', key: 'LOG', children: getLog(log, 'java') }, tabs={{
{ label: 'Std Out', key: 'STDOUT', children: getLog(stdout) }, size: 'small',
{ label: 'Thread Dump', key: 'DUMP', children: getDump(dump) } tabPosition: 'top',
]} activeKey: activeKey,
/> onChange: setActiveKey,
</ProCard> items: [
{ label: 'Log', key: 'LOG', children: getLog(log, 'javalog') },
{ label: 'Std Out', key: 'STDOUT', children: getLog(stdout, 'javalog') },
{ label: 'Thread Dump', key: 'DUMP', children: getDump(dump, 'java') }
]
}}
/>
); );
}; };
......
...@@ -91,7 +91,12 @@ const TaskManagerLogsTab = (props: JobProps) => { ...@@ -91,7 +91,12 @@ const TaskManagerLogsTab = (props: JobProps) => {
extra={<Paragraph>{currentTM.containerPath}</Paragraph>} extra={<Paragraph>{currentTM.containerPath}</Paragraph>}
> >
<Spin spinning={tmLog.loading}> <Spin spinning={tmLog.loading}>
<CodeShow code={tmLog.data} height={500} /> <CodeShow
showFloatButton
code={tmLog.data}
language={'javalog'}
height={parent.innerHeight - 300}
/>
</Spin> </Spin>
</Card> </Card>
</Col> </Col>
...@@ -99,7 +104,11 @@ const TaskManagerLogsTab = (props: JobProps) => { ...@@ -99,7 +104,11 @@ const TaskManagerLogsTab = (props: JobProps) => {
); );
}; };
return <ProCard>{renderLogTab()}</ProCard>; return (
<ProCard bodyStyle={{ height: parent.innerHeight - 200, overflow: 'auto' }}>
{renderLogTab()}
</ProCard>
);
}; };
export default TaskManagerLogsTab; export default TaskManagerLogsTab;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one or more * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. * this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0 * 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 not use this file except in compliance with
* the License. You may obtain a copy of the License at * 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 * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
* *
*/ */
import StatusTag from '@/components/JobTags/StatusTag'; import StatusTag from '@/components/JobTags/StatusTag';
import { JobProps } from '@/pages/DevOps/JobDetail/data'; import { JobProps } from '@/pages/DevOps/JobDetail/data';
import { parseByteStr, parseMilliSecondStr, parseNumStr } from '@/utils/function'; import { parseByteStr, parseMilliSecondStr, parseNumStr } from '@/utils/function';
...@@ -23,7 +24,7 @@ import { l } from '@/utils/intl'; ...@@ -23,7 +24,7 @@ import { l } from '@/utils/intl';
import { ProCard, ProColumns, ProTable } from '@ant-design/pro-components'; import { ProCard, ProColumns, ProTable } from '@ant-design/pro-components';
import { Typography } from 'antd'; import { Typography } from 'antd';
const { Text, Link } = Typography; const { Link } = Typography;
export type VerticesTableListItem = { export type VerticesTableListItem = {
name: string; name: string;
......
...@@ -26,8 +26,11 @@ import { API_CONSTANTS } from '@/services/endpoints'; ...@@ -26,8 +26,11 @@ import { API_CONSTANTS } from '@/services/endpoints';
import { TaskVersionListItem } from '@/types/Studio/data'; import { TaskVersionListItem } from '@/types/Studio/data';
import { l } from '@/utils/intl'; import { l } from '@/utils/intl';
import { useRequest } from '@@/exports'; import { useRequest } from '@@/exports';
import { Card, Col, Row, Tag } from 'antd'; import { SplitPane } from '@andrewray/react-multi-split-pane';
import { useState } from 'react'; import { Pane } from '@andrewray/react-multi-split-pane/dist/lib/Pane';
import { ProCard } from '@ant-design/pro-components';
import { Tag } from 'antd';
import { useRef, useState } from 'react';
const JobVersionTab = (props: JobProps) => { const JobVersionTab = (props: JobProps) => {
const { jobDetail } = props; const { jobDetail } = props;
...@@ -39,6 +42,7 @@ const JobVersionTab = (props: JobProps) => { ...@@ -39,6 +42,7 @@ const JobVersionTab = (props: JobProps) => {
versionId: 'Current', versionId: 'Current',
isLatest: true isLatest: true
}; };
const refObject = useRef<HTMLDivElement>(null);
const [currentVersion, setCurrentVersion] = useState<TaskVersionListItem>(latestVersion); const [currentVersion, setCurrentVersion] = useState<TaskVersionListItem>(latestVersion);
...@@ -61,47 +65,74 @@ const JobVersionTab = (props: JobProps) => { ...@@ -61,47 +65,74 @@ const JobVersionTab = (props: JobProps) => {
const renderVersionList = () => { const renderVersionList = () => {
return ( return (
<Row> <>
<Col span={3}> <SplitPane
<VersionList split={'vertical'}
loading={versionList.loading} defaultSizes={[100, 500]}
data={versionList.data} minSize={150}
onDeleteListen={deleteVersion} className={'split-pane'}
onSelectListen={(item) => setCurrentVersion(item)} >
header={l('devops.jobinfo.version.versionList')} <Pane
/> className={'split-pane'}
</Col> forwardRef={refObject}
<Col span={21}> minSize={100}
<Card size={100}
title={'V-' + currentVersion?.versionId} split={'horizontal'}
bordered={false}
extra={
<>
<Tag key={'v-type'} color='blue'>
{currentVersion?.type}
</Tag>
<Tag key={'v-dialect'} color='yellow'>
{currentVersion?.dialect}
</Tag>
</>
}
> >
<CodeShow <VersionList
code={currentVersion?.statement ?? ''} loading={versionList.loading}
height={500} data={versionList.data}
language={ onDeleteListen={deleteVersion}
currentVersion?.dialect?.toLowerCase() === DIALECT.FLINK_SQL ? 'flinksql' : 'sql' onSelectListen={(item) => setCurrentVersion(item)}
} header={l('devops.jobinfo.version.versionList')}
/> />
</Card> </Pane>
</Col>
</Row> <Pane
className={'split-pane'}
forwardRef={refObject}
minSize={100}
size={100}
split={'horizontal'}
>
<ProCard
ghost
hoverable
bordered
size={'small'}
bodyStyle={{ height: parent.innerHeight }}
title={'V-' + currentVersion?.versionId}
extra={
<>
<Tag key={'v-type'} color='blue'>
{currentVersion?.type}
</Tag>
<Tag key={'v-dialect'} color='success'>
{currentVersion?.dialect}
</Tag>
</>
}
>
<CodeShow
showFloatButton
code={currentVersion?.statement ?? ''}
height={parent.innerHeight - 250}
language={
currentVersion?.dialect?.toLowerCase() === DIALECT.FLINK_SQL ? 'flinksql' : 'sql'
}
/>
</ProCard>
</Pane>
</SplitPane>
</>
); );
}; };
return ( return (
<> <>
<Card>{renderVersionList()}</Card> <ProCard size={'small'} bodyStyle={{ height: parent.innerHeight - 180, overflow: 'auto' }}>
{renderVersionList()}
</ProCard>
</> </>
); );
}; };
......
/* /*
* 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 * 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
*
* 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 CodeShow from '@/components/CustomEditor/CodeShow'; import CodeShow from '@/components/CustomEditor/CodeShow';
...@@ -35,7 +37,6 @@ type CodeContentProps = { ...@@ -35,7 +37,6 @@ type CodeContentProps = {
* code edit props * code edit props
*/ */
const CodeEditProps = { const CodeEditProps = {
height: '70vh',
width: '100%', width: '100%',
lineNumbers: 'on' lineNumbers: 'on'
}; };
...@@ -66,7 +67,14 @@ export const CodeContent: React.FC<CodeContentProps> = (props) => { ...@@ -66,7 +67,14 @@ export const CodeContent: React.FC<CodeContentProps> = (props) => {
} else if (code === '' || code === null) { } else if (code === '' || code === null) {
return <Empty className={'code-content-empty'} description={l('rc.gp.codeTree.clickShow')} />; return <Empty className={'code-content-empty'} description={l('rc.gp.codeTree.clickShow')} />;
} else { } else {
return <CodeShow {...CodeEditProps} language={getLanguage()} showFloatButton code={code} />; return (
<CodeShow
{...{ ...CodeEditProps, height: parent.innerHeight - 320 }}
language={getLanguage()}
showFloatButton
code={code}
/>
);
} }
}; };
......
/* /*
* 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 * 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
*
* 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 { buildTreeData } from '@/pages/RegCenter/GitProject/components/CodeTree/function'; import { buildTreeData } from '@/pages/RegCenter/GitProject/components/CodeTree/function';
...@@ -47,6 +49,7 @@ export const SiderTree: React.FC<SiderTreeProps> = (props) => { ...@@ -47,6 +49,7 @@ export const SiderTree: React.FC<SiderTreeProps> = (props) => {
<PageLoading /> <PageLoading />
) : treeData.length > 0 ? ( ) : treeData.length > 0 ? (
<DirectoryTree <DirectoryTree
className={'siderTree'}
onSelect={(_, info) => onNodeClick(info)} onSelect={(_, info) => onNodeClick(info)}
treeData={buildTreeData(treeData)} treeData={buildTreeData(treeData)}
/> />
......
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one or more * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. * this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0 * 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 not use this file except in compliance with
* the License. You may obtain a copy of the License at * 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 * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
* *
*/ */
...@@ -22,8 +22,10 @@ import { SiderTree } from '@/pages/RegCenter/GitProject/components/CodeTree/Code ...@@ -22,8 +22,10 @@ import { SiderTree } from '@/pages/RegCenter/GitProject/components/CodeTree/Code
import { handleData } from '@/services/BusinessCrud'; import { handleData } from '@/services/BusinessCrud';
import { API_CONSTANTS } from '@/services/endpoints'; import { API_CONSTANTS } from '@/services/endpoints';
import { GitProject, GitProjectTreeNode } from '@/types/RegCenter/data'; import { GitProject, GitProjectTreeNode } from '@/types/RegCenter/data';
import { Col, Row } from 'antd'; import { SplitPane } from '@andrewray/react-multi-split-pane';
import React, { useEffect, useState } from 'react'; import { Pane } from '@andrewray/react-multi-split-pane/dist/lib/Pane';
import { ProCard } from '@ant-design/pro-components';
import React, { useEffect, useRef, useState } from 'react';
/** /**
* CodeTreeShowProps * CodeTreeShowProps
...@@ -37,6 +39,8 @@ export const CodeTreeShow: React.FC<CodeTreeShowProps> = (props) => { ...@@ -37,6 +39,8 @@ export const CodeTreeShow: React.FC<CodeTreeShowProps> = (props) => {
* some state * some state
*/ */
const { values } = props; const { values } = props;
const refObject = useRef<HTMLDivElement>(null);
const [treeData, setTreeData] = useState<Partial<GitProjectTreeNode>[]>([]); const [treeData, setTreeData] = useState<Partial<GitProjectTreeNode>[]>([]);
const [loading, setLoading] = useState<boolean>(false); const [loading, setLoading] = useState<boolean>(false);
const [codeValue, setCodeValue] = useState<string>(''); const [codeValue, setCodeValue] = useState<string>('');
...@@ -83,20 +87,56 @@ export const CodeTreeShow: React.FC<CodeTreeShowProps> = (props) => { ...@@ -83,20 +87,56 @@ export const CodeTreeShow: React.FC<CodeTreeShowProps> = (props) => {
*/ */
return ( return (
<> <>
<Row> <ProCard size={'small'} bodyStyle={{ height: parent.innerHeight - 320, overflow: 'auto' }}>
<Col span={6} className={'siderTree gitCodeTree'}> <SplitPane
{/* tree */} split={'vertical'}
<SiderTree defaultSizes={[100, 500]}
treeData={treeData} minSize={150}
onNodeClick={(info: any) => handleNodeClick(info)} className={'split-pane'}
loading={loading} >
/> <Pane
</Col> className={'split-pane'}
<Col span={18}> forwardRef={refObject}
{/* code */} minSize={100}
<CodeContent code={codeValue} current={currentGitProjectTreeNode} /> size={100}
</Col> split={'horizontal'}
</Row> >
<ProCard
ghost
hoverable
bordered
size={'small'}
bodyStyle={{ height: parent.innerHeight, overflow: 'auto' }}
colSpan={'20%'}
>
{/* tree */}
<SiderTree
treeData={treeData}
onNodeClick={(info: any) => handleNodeClick(info)}
loading={loading}
/>
</ProCard>
</Pane>
<Pane
className={'split-pane'}
forwardRef={refObject}
minSize={100}
size={100}
split={'horizontal'}
>
<ProCard
ghost
hoverable
bordered
size={'small'}
bodyStyle={{ height: parent.innerHeight }}
>
<CodeContent code={codeValue} current={currentGitProjectTreeNode} />
</ProCard>
</Pane>
</SplitPane>
</ProCard>
</> </>
); );
}; };
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one or more * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. * this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0 * 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 not use this file except in compliance with
* the License. You may obtain a copy of the License at * 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 * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
* *
*/ */
...@@ -35,6 +35,12 @@ export const CodeTree: React.FC<CodeTreeProps> = (props) => { ...@@ -35,6 +35,12 @@ export const CodeTree: React.FC<CodeTreeProps> = (props) => {
<Modal <Modal
title={l('rc.gp.codeTree')} title={l('rc.gp.codeTree')}
width={'95%'} width={'95%'}
styles={{
body: {
height: 'calc(100vh - 300px)',
overflow: 'auto'
}
}}
open={modalVisible} open={modalVisible}
maskClosable={false} maskClosable={false}
onCancel={() => onCancel()} onCancel={() => onCancel()}
......
...@@ -34,16 +34,18 @@ import { InitResourceState } from '@/types/RegCenter/init.d'; ...@@ -34,16 +34,18 @@ import { InitResourceState } from '@/types/RegCenter/init.d';
import { ResourceState } from '@/types/RegCenter/state.d'; import { ResourceState } from '@/types/RegCenter/state.d';
import { unSupportView } from '@/utils/function'; import { unSupportView } from '@/utils/function';
import { l } from '@/utils/intl'; import { l } from '@/utils/intl';
import { SplitPane } from '@andrewray/react-multi-split-pane';
import { Pane } from '@andrewray/react-multi-split-pane/dist/lib/Pane';
import { ProCard } from '@ant-design/pro-components'; import { ProCard } from '@ant-design/pro-components';
import { useAsyncEffect } from 'ahooks'; import { useAsyncEffect } from 'ahooks';
import { MenuInfo } from 'rc-menu/es/interface'; import { MenuInfo } from 'rc-menu/es/interface';
import { Resizable } from 're-resizable'; import React, { useCallback, useRef, useState } from 'react';
import React, { useCallback, useState } from 'react';
const ResourceOverView: React.FC = () => { const ResourceOverView: React.FC = () => {
const [resourceState, setResourceState] = useState<ResourceState>(InitResourceState); const [resourceState, setResourceState] = useState<ResourceState>(InitResourceState);
const [editModal, setEditModal] = useState<string>(''); const [editModal, setEditModal] = useState<string>('');
const refObject = useRef<HTMLDivElement>(null);
const [uploadValue] = useState({ const [uploadValue] = useState({
url: API_CONSTANTS.RESOURCE_UPLOAD, url: API_CONSTANTS.RESOURCE_UPLOAD,
...@@ -234,41 +236,55 @@ const ResourceOverView: React.FC = () => { ...@@ -234,41 +236,55 @@ const ResourceOverView: React.FC = () => {
*/ */
return ( return (
<> <>
<ProCard size={'small'}> <ProCard size={'small'} bodyStyle={{ height: parent.innerHeight - 80 }}>
<Resizable <SplitPane
defaultSize={{ split={'vertical'}
width: 500, defaultSizes={[100, 500]}
height: '100%' minSize={150}
}} className={'split-pane'}
minWidth={200}
maxWidth={1200}
> >
<ProCard ghost hoverable colSpan={'18%'} className={'siderTree schemaTree'}> <Pane
<FileTree className={'split-pane'}
selectedKeys={resourceState.selectedKeys} forwardRef={refObject}
treeData={resourceState.treeData} minSize={100}
onRightClick={handleRightClick} size={100}
onNodeClick={(info: any) => handleNodeClick(info)} split={'horizontal'}
/> >
<RightContextMenu <ProCard ghost hoverable bodyStyle={{ height: parent.innerHeight }} colSpan={'18%'}>
contextMenuPosition={resourceState.contextMenuPosition} <FileTree
open={resourceState.contextMenuOpen} selectedKeys={resourceState.selectedKeys}
openChange={() => treeData={resourceState.treeData}
setResourceState((prevState) => ({ ...prevState, contextMenuOpen: false })) onRightClick={handleRightClick}
} onNodeClick={(info: any) => handleNodeClick(info)}
items={renderRightMenu()} />
onClick={handleMenuClick} <RightContextMenu
/> contextMenuPosition={resourceState.contextMenuPosition}
</ProCard> open={resourceState.contextMenuOpen}
</Resizable> openChange={() =>
<ProCard.Divider type={'vertical'} /> setResourceState((prevState) => ({ ...prevState, contextMenuOpen: false }))
<ProCard ghost hoverable className={'schemaTree'} bodyStyle={{ height: '100%' }}> }
<FileShow items={renderRightMenu()}
onChange={handleContentChange} onClick={handleMenuClick}
code={resourceState.content} />
item={resourceState.clickedNode} </ProCard>
/> </Pane>
</ProCard>
<Pane
className={'split-pane'}
forwardRef={refObject}
minSize={100}
size={100}
split={'horizontal'}
>
<ProCard ghost hoverable bodyStyle={{ height: parent.innerHeight }}>
<FileShow
onChange={handleContentChange}
code={resourceState.content}
item={resourceState.clickedNode}
/>
</ProCard>
</Pane>
</SplitPane>
</ProCard> </ProCard>
{resourceState.editOpen && ( {resourceState.editOpen && (
<ResourceModal <ResourceModal
......
...@@ -23,7 +23,6 @@ import { Empty } from 'antd'; ...@@ -23,7 +23,6 @@ import { Empty } from 'antd';
import React from 'react'; import React from 'react';
const CodeEditProps: any = { const CodeEditProps: any = {
height: '100%',
width: '100%', width: '100%',
lineNumbers: 'on', lineNumbers: 'on',
language: 'java' language: 'java'
...@@ -46,7 +45,10 @@ const LogsShow: React.FC<LogsShowProps> = (props) => { ...@@ -46,7 +45,10 @@ const LogsShow: React.FC<LogsShowProps> = (props) => {
return ( return (
<> <>
{code ? ( {code ? (
<CodeShow {...restLogsShowProps} {...CodeEditProps} /> <CodeShow
{...{ ...restLogsShowProps, height: parent.innerHeight - 210 }}
{...CodeEditProps}
/>
) : ( ) : (
<Empty className={'code-content-empty'} description={l('sys.info.logList.tips')} /> <Empty className={'code-content-empty'} description={l('sys.info.logList.tips')} />
)} )}
......
...@@ -67,7 +67,7 @@ const LogList = () => { ...@@ -67,7 +67,7 @@ const LogList = () => {
<ProCard bodyStyle={{ height: parent.innerHeight - 160 }} ghost bordered> <ProCard bodyStyle={{ height: parent.innerHeight - 160 }} ghost bordered>
<ProCard <ProCard
ghost ghost
bodyStyle={{ height: parent.innerHeight - 160 }} bodyStyle={{ height: parent.innerHeight }}
hoverable hoverable
bordered bordered
colSpan={'18%'} colSpan={'18%'}
...@@ -76,7 +76,14 @@ const LogList = () => { ...@@ -76,7 +76,14 @@ const LogList = () => {
<LogsTree treeData={treeData} onNodeClick={(info: any) => handleNodeClick(info)} /> <LogsTree treeData={treeData} onNodeClick={(info: any) => handleNodeClick(info)} />
</ProCard> </ProCard>
<ProCard.Divider type={'vertical'} /> <ProCard.Divider type={'vertical'} />
<ProCard ghost bodyStyle={{ height: parent.innerHeight - 175 }} hoverable bordered> <ProCard
ghost
bodyStyle={{ height: parent.innerHeight }}
hoverable
bordered
colSpan={'auto'}
className={'siderTree'}
>
<LogsShow code={log} refreshLogCallback={() => refreshLogByClickNode()} /> <LogsShow code={log} refreshLogCallback={() => refreshLogByClickNode()} />
</ProCard> </ProCard>
</ProCard> </ProCard>
......
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