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

Fix gitbuild cannot close (#2525)

* Spotless Apply * fix git build model can not close * Spotless Apply * fix git & resource --------- Co-authored-by: 's avatarzhu-mingye <zhu-mingye@users.noreply.github.com>
parent 65137b54
...@@ -66,7 +66,7 @@ public class GetJarsStepSse extends StepSse { ...@@ -66,7 +66,7 @@ public class GetJarsStepSse extends StepSse {
GitProject gitProject = (GitProject) params.get("gitProject"); GitProject gitProject = (GitProject) params.get("gitProject");
ResourcesService resourcesService = SpringUtil.getBean(ResourcesService.class); ResourcesService resourcesService = SpringUtil.getBean(ResourcesService.class);
TreeNodeDTO gitFolder = resourcesService.createFolderOrGet(0, "git", ""); TreeNodeDTO gitFolder = resourcesService.createFolderOrGet(1, "git", "");
TreeNodeDTO treeNodeDTO = TreeNodeDTO treeNodeDTO =
resourcesService.createFolderOrGet(Convert.toInt(gitFolder.getId()), gitProject.getName(), ""); resourcesService.createFolderOrGet(Convert.toInt(gitFolder.getId()), gitProject.getName(), "");
return jars.stream() return jars.stream()
......
...@@ -64,7 +64,7 @@ public class PythonZipStepSse extends StepSse { ...@@ -64,7 +64,7 @@ public class PythonZipStepSse extends StepSse {
private String uploadResources(File zipFile, GitProject gitProject) { private String uploadResources(File zipFile, GitProject gitProject) {
ResourcesService resourcesService = SpringUtil.getBean(ResourcesService.class); ResourcesService resourcesService = SpringUtil.getBean(ResourcesService.class);
TreeNodeDTO gitFolder = resourcesService.createFolderOrGet(0, "git", ""); TreeNodeDTO gitFolder = resourcesService.createFolderOrGet(1, "git", "");
TreeNodeDTO treeNodeDTO = TreeNodeDTO treeNodeDTO =
resourcesService.createFolderOrGet(Convert.toInt(gitFolder.getId()), gitProject.getName(), ""); resourcesService.createFolderOrGet(Convert.toInt(gitFolder.getId()), gitProject.getName(), "");
resourcesService.uploadFile(Convert.toInt(treeNodeDTO.getId()), "", zipFile); resourcesService.uploadFile(Convert.toInt(treeNodeDTO.getId()), "", zipFile);
......
...@@ -190,8 +190,8 @@ export const buildAllSuggestionsToEditor = ( ...@@ -190,8 +190,8 @@ export const buildAllSuggestionsToEditor = (
range: range, range: range,
kind: mappingKind(item.kind), kind: mappingKind(item.kind),
insertText: item.insertText, insertText: item.insertText,
insertTextRules: monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet insertTextRules: monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,
// detail: item?.detail, detail: item?.label?.description || ''
}; };
}); });
//todo: 补充补全建议 关键词建议 //todo: 补充补全建议 关键词建议
......
...@@ -127,16 +127,21 @@ const CodeEdit = (props: CodeEditFormProps & connect) => { ...@@ -127,16 +127,21 @@ const CodeEdit = (props: CodeEditFormProps & connect) => {
resolveCompletionItem: (item: CompletionItem) => { resolveCompletionItem: (item: CompletionItem) => {
return { return {
...item, ...item,
detail: item.detail ?? `-- ${item.detail}` detail: item.detail
}; };
} }
}); });
} }
// editorInstance?.current?.onDidChangeModelContent?.(() => {
// console.log(editorInstance?.current, 'editorInstance')
// editorInstance?.current?.trigger('action', 'editor.action.triggerSuggest');
// });
/** /**
* editorDidMount * editorDidMount
* @param {editor.IStandaloneCodeEditor} editor * @param {editor.IStandaloneCodeEditor} editor
* @param monaco * @param monacoIns
*/ */
const editorDidMountChange = (editor: editor.IStandaloneCodeEditor, monacoIns: Monaco) => { const editorDidMountChange = (editor: editor.IStandaloneCodeEditor, monacoIns: Monaco) => {
if (editorRef?.current && monacoRef?.current && editorDidMount) { if (editorRef?.current && monacoRef?.current && editorDidMount) {
...@@ -214,6 +219,8 @@ const CodeEdit = (props: CodeEditFormProps & connect) => { ...@@ -214,6 +219,8 @@ const CodeEdit = (props: CodeEditFormProps & connect) => {
showFoldingControls: 'always', // 代码折叠控件 'always' | 'mouseover' | 'never' showFoldingControls: 'always', // 代码折叠控件 'always' | 'mouseover' | 'never'
automaticLayout: true, // 自动布局 automaticLayout: true, // 自动布局
readOnly, // 是否只读 readOnly, // 是否只读
glyphMargin: true, // 字形边缘
formatOnType: true, // 代码格式化
wrappingIndent: wrappingIndent:
language === 'yaml' || language === 'yml' || language === 'json' ? 'indent' : 'none', language === 'yaml' || language === 'yml' || language === 'json' ? 'indent' : 'none',
inlineSuggest: { inlineSuggest: {
...@@ -223,8 +230,8 @@ const CodeEdit = (props: CodeEditFormProps & connect) => { ...@@ -223,8 +230,8 @@ const CodeEdit = (props: CodeEditFormProps & connect) => {
allowQuickSuggestions: true, allowQuickSuggestions: true,
showOnAllSymbols: true showOnAllSymbols: true
}, },
inlineSuggestionVisible: true, // inlineSuggestionVisible: true,
quickSuggestions: true, quickSuggestions: enableSuggestions,
guides: { guides: {
bracketPairs: true bracketPairs: true
}, },
...@@ -234,12 +241,15 @@ const CodeEdit = (props: CodeEditFormProps & connect) => { ...@@ -234,12 +241,15 @@ const CodeEdit = (props: CodeEditFormProps & connect) => {
}, },
foldingRanges: true, foldingRanges: true,
inlineCompletionsAccessibilityVerbose: true, inlineCompletionsAccessibilityVerbose: true,
smartSelect: {
selectLeadingAndTrailingWhitespace: true,
selectSubwords: true
},
suggest: { suggest: {
shareSuggestSelections: true, quickSuggestions: enableSuggestions,
quickSuggestions: true,
showStatusBar: true, showStatusBar: true,
preview: true, preview: true,
previewMode: 'preview', previewMode: 'subword',
showInlineDetails: true, showInlineDetails: true,
showMethods: true, showMethods: true,
showFunctions: true, showFunctions: true,
...@@ -280,6 +290,11 @@ const CodeEdit = (props: CodeEditFormProps & connect) => { ...@@ -280,6 +290,11 @@ const CodeEdit = (props: CodeEditFormProps & connect) => {
<> <>
<div className={'monaco-float'}> <div className={'monaco-float'}>
<Editor <Editor
beforeMount={(monaco: Monaco) => {
if (!monacoInstance?.current) {
monacoInstance.current = monaco;
}
}}
width={width} width={width}
height={height} height={height}
value={code} value={code}
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
export default { export default {
'button.create': 'Create', 'button.create': 'Create',
'button.close': 'Close', 'button.close': 'Close',
'button.daemon': 'Daemon Mode',
'button.confirm': 'Confirm', 'button.confirm': 'Confirm',
'button.recovery': 'Recovery', 'button.recovery': 'Recovery',
'button.cancel': 'Cancel', 'button.cancel': 'Cancel',
......
...@@ -23,6 +23,7 @@ export default { ...@@ -23,6 +23,7 @@ export default {
'button.create': '新建', 'button.create': '新建',
'button.recovery': '恢复', 'button.recovery': '恢复',
'button.close': '关闭', 'button.close': '关闭',
'button.daemon': '后台运行',
'button.confirm': '确定', 'button.confirm': '确定',
'button.cancel': '取消', 'button.cancel': '取消',
'button.finish': '完成', 'button.finish': '完成',
......
...@@ -52,7 +52,7 @@ const JsonToSql: React.FC = (props: connect) => { ...@@ -52,7 +52,7 @@ const JsonToSql: React.FC = (props: connect) => {
height={maxHeight + 'px'} height={maxHeight + 'px'}
code={jsonData} code={jsonData}
language={'json'} language={'json'}
onChange={(x:string) => { onChange={(x: string) => {
setJsonData(x ?? ''); setJsonData(x ?? '');
}} }}
/> />
......
...@@ -17,16 +17,16 @@ ...@@ -17,16 +17,16 @@
* *
*/ */
import {CircleBtn} from '@/components/CallBackButton/CircleBtn'; import { CircleBtn } from '@/components/CallBackButton/CircleBtn';
import Title from '@/components/Front/Title'; import Title from '@/components/Front/Title';
import ContentScroll from '@/components/Scroll/ContentScroll'; import ContentScroll from '@/components/Scroll/ContentScroll';
import MovableSidebar from '@/components/Sidebar/MovableSidebar'; import MovableSidebar from '@/components/Sidebar/MovableSidebar';
import {StateType, STUDIO_MODEL, VIEW} from '@/pages/DataStudio/model'; import { StateType, STUDIO_MODEL, VIEW } from '@/pages/DataStudio/model';
import {LeftBottomMoreTabs, LeftBottomSide} from '@/pages/DataStudio/route'; import { LeftBottomMoreTabs, LeftBottomSide } from '@/pages/DataStudio/route';
import {l} from '@/utils/intl'; import { l } from '@/utils/intl';
import {connect} from '@@/exports'; import { connect } from '@@/exports';
import {PlusOutlined} from '@ant-design/icons'; import { PlusOutlined } from '@ant-design/icons';
import {ConfigProvider, Space, Tabs} from 'antd'; import { ConfigProvider, Space, Tabs } from 'antd';
import React from 'react'; import React from 'react';
export type BottomContainerProps = { export type BottomContainerProps = {
...@@ -34,7 +34,7 @@ export type BottomContainerProps = { ...@@ -34,7 +34,7 @@ export type BottomContainerProps = {
height: number | string; height: number | string;
}; };
const BottomContainer: React.FC<BottomContainerProps> = (props: any) => { const BottomContainer: React.FC<BottomContainerProps> = (props: any) => {
const {dispatch, size, bottomContainer, height} = props; const { dispatch, size, bottomContainer, height } = props;
const width = document.documentElement.clientWidth - VIEW.sideWidth * 2; const width = document.documentElement.clientWidth - VIEW.sideWidth * 2;
/** /**
...@@ -91,7 +91,7 @@ const BottomContainer: React.FC<BottomContainerProps> = (props: any) => { ...@@ -91,7 +91,7 @@ const BottomContainer: React.FC<BottomContainerProps> = (props: any) => {
return Object.values( return Object.values(
Object.keys(LeftBottomMoreTabs).map((x) => Object.keys(LeftBottomMoreTabs).map((x) =>
LeftBottomMoreTabs[x].map((y) => { LeftBottomMoreTabs[x].map((y) => {
return {...y, key: x + '/' + y.key}; return { ...y, key: x + '/' + y.key };
}) })
) )
).flatMap((x) => x); ).flatMap((x) => x);
...@@ -139,7 +139,7 @@ const BottomContainer: React.FC<BottomContainerProps> = (props: any) => { ...@@ -139,7 +139,7 @@ const BottomContainer: React.FC<BottomContainerProps> = (props: any) => {
}); });
return ( return (
<Tabs <Tabs
style={{height: '32px', display: '-webkit-box'}} style={{ height: '32px', display: '-webkit-box' }}
items={items} items={items}
type='card' type='card'
onChange={(key: string) => { onChange={(key: string) => {
...@@ -160,16 +160,14 @@ const BottomContainer: React.FC<BottomContainerProps> = (props: any) => { ...@@ -160,16 +160,14 @@ const BottomContainer: React.FC<BottomContainerProps> = (props: any) => {
const renderItems = () => { const renderItems = () => {
return [ return [
...LeftBottomSide.map((x) => { ...LeftBottomSide.map((x) => {
return {...x, key: x.key + '/'}; return { ...x, key: x.key + '/' };
}), }),
...getSubTabs() ...getSubTabs()
].map((item) => { ].map((item) => {
return { return {
...item, ...item,
children: ( children: (
<ContentScroll height={props.height - VIEW.leftMargin}> <ContentScroll height={props.height - VIEW.leftMargin}>{item.children}</ContentScroll>
{item.children}
</ContentScroll>
) )
}; };
}); });
...@@ -204,7 +202,7 @@ const BottomContainer: React.FC<BottomContainerProps> = (props: any) => { ...@@ -204,7 +202,7 @@ const BottomContainer: React.FC<BottomContainerProps> = (props: any) => {
position: 'fixed', position: 'fixed',
bottom: VIEW.footerHeight bottom: VIEW.footerHeight
}} }}
defaultSize={{width: '100%', height: height}} defaultSize={{ width: '100%', height: height }}
minHeight={VIEW.midMargin} minHeight={VIEW.midMargin}
maxHeight={size.contentHeight - 40} maxHeight={size.contentHeight - 40}
onResize={( onResize={(
...@@ -214,8 +212,8 @@ const BottomContainer: React.FC<BottomContainerProps> = (props: any) => { ...@@ -214,8 +212,8 @@ const BottomContainer: React.FC<BottomContainerProps> = (props: any) => {
offsetHeight: any; offsetHeight: any;
} }
) => resizeCallback(event, direction, elementRef)} ) => resizeCallback(event, direction, elementRef)}
btnGroup={[<CircleBtn key={'max'} icon={<PlusOutlined/>}/>]} btnGroup={[<CircleBtn key={'max'} icon={<PlusOutlined />} />]}
enable={{top: true}} enable={{ top: true }}
handlerMinimize={handleMinimize} handlerMinimize={handleMinimize}
maxWidth={width} maxWidth={width}
> >
...@@ -228,12 +226,12 @@ const BottomContainer: React.FC<BottomContainerProps> = (props: any) => { ...@@ -228,12 +226,12 @@ const BottomContainer: React.FC<BottomContainerProps> = (props: any) => {
: '') : '')
} }
items={renderItems()} items={renderItems()}
tabBarStyle={{display: 'none'}} tabBarStyle={{ display: 'none' }}
/> />
</MovableSidebar> </MovableSidebar>
); );
}; };
export default connect(({Studio}: { Studio: StateType }) => ({ export default connect(({ Studio }: { Studio: StateType }) => ({
bottomContainer: Studio.bottomContainer, bottomContainer: Studio.bottomContainer
}))(BottomContainer); }))(BottomContainer);
...@@ -17,14 +17,14 @@ ...@@ -17,14 +17,14 @@
* *
*/ */
import {CircleBtn, CircleDataStudioButtonProps} from '@/components/CallBackButton/CircleBtn'; import { CircleBtn, CircleDataStudioButtonProps } from '@/components/CallBackButton/CircleBtn';
import MovableSidebar, {MovableSidebarProps} from '@/components/Sidebar/MovableSidebar'; import MovableSidebar, { MovableSidebarProps } from '@/components/Sidebar/MovableSidebar';
import useThemeValue from '@/hooks/useThemeValue'; import useThemeValue from '@/hooks/useThemeValue';
import ProjectTitle from '@/pages/DataStudio/LeftContainer/Project/ProjectTitle'; import ProjectTitle from '@/pages/DataStudio/LeftContainer/Project/ProjectTitle';
import {StateType, STUDIO_MODEL, VIEW} from '@/pages/DataStudio/model'; import { StateType, STUDIO_MODEL, VIEW } from '@/pages/DataStudio/model';
import {BtnRoute, LeftSide} from '@/pages/DataStudio/route'; import { BtnRoute, LeftSide } from '@/pages/DataStudio/route';
import {connect} from '@@/exports'; import { connect } from '@@/exports';
import {Tabs} from 'antd'; import { Tabs } from 'antd';
import React from 'react'; import React from 'react';
export type LeftContainerProps = { export type LeftContainerProps = {
...@@ -39,7 +39,7 @@ const LeftContainer: React.FC<LeftContainerProps> = (props: any) => { ...@@ -39,7 +39,7 @@ const LeftContainer: React.FC<LeftContainerProps> = (props: any) => {
toolContentHeight, toolContentHeight,
leftContainer, leftContainer,
rightContainer, rightContainer,
tabs: {panes, activeKey} tabs: { panes, activeKey }
} = props; } = props;
const themeValue = useThemeValue(); const themeValue = useThemeValue();
const MAX_WIDTH = size.width - 2 * VIEW.leftToolWidth - rightContainer.width - 700; const MAX_WIDTH = size.width - 2 * VIEW.leftToolWidth - rightContainer.width - 700;
...@@ -79,14 +79,14 @@ const LeftContainer: React.FC<LeftContainerProps> = (props: any) => { ...@@ -79,14 +79,14 @@ const LeftContainer: React.FC<LeftContainerProps> = (props: any) => {
contentHeight: toolContentHeight, contentHeight: toolContentHeight,
onResize: (event: any, direction: any, elementRef: { offsetWidth: any }) => onResize: (event: any, direction: any, elementRef: { offsetWidth: any }) =>
handleReSizeChange(elementRef.offsetWidth), handleReSizeChange(elementRef.offsetWidth),
title: <ProjectTitle/>, title: <ProjectTitle />,
handlerMinimize: () => handleMinimize(), handlerMinimize: () => handleMinimize(),
handlerMaxsize: handleMaxsize, handlerMaxsize: handleMaxsize,
visible: leftContainer.selectKey !== '', visible: leftContainer.selectKey !== '',
defaultSize: {width: leftContainer.width, height: leftContainer.height}, defaultSize: { width: leftContainer.width, height: leftContainer.height },
minWidth: 160, minWidth: 160,
maxWidth: MAX_WIDTH, maxWidth: MAX_WIDTH,
enable: {right: true}, enable: { right: true },
btnGroup: BtnRoute[leftContainer.selectKey] btnGroup: BtnRoute[leftContainer.selectKey]
? BtnRoute[leftContainer.selectKey].map((item: CircleDataStudioButtonProps) => ( ? BtnRoute[leftContainer.selectKey].map((item: CircleDataStudioButtonProps) => (
<CircleBtn <CircleBtn
...@@ -97,11 +97,11 @@ const LeftContainer: React.FC<LeftContainerProps> = (props: any) => { ...@@ -97,11 +97,11 @@ const LeftContainer: React.FC<LeftContainerProps> = (props: any) => {
/> />
)) ))
: [], : [],
style: {borderInlineEnd: `1px solid ${themeValue.borderColor}`} style: { borderInlineEnd: `1px solid ${themeValue.borderColor}` }
}; };
const content = ( const content = (
<Tabs activeKey={leftContainer.selectKey} items={LeftSide} tabBarStyle={{display: 'none'}}/> <Tabs activeKey={leftContainer.selectKey} items={LeftSide} tabBarStyle={{ display: 'none' }} />
); );
return ( return (
...@@ -112,7 +112,7 @@ const LeftContainer: React.FC<LeftContainerProps> = (props: any) => { ...@@ -112,7 +112,7 @@ const LeftContainer: React.FC<LeftContainerProps> = (props: any) => {
); );
}; };
export default connect(({Studio}: { Studio: StateType }) => ({ export default connect(({ Studio }: { Studio: StateType }) => ({
// leftContainer: Studio.leftContainer, // leftContainer: Studio.leftContainer,
// rightContainer: Studio.rightContainer, // rightContainer: Studio.rightContainer,
toolContentHeight: Studio.toolContentHeight, toolContentHeight: Studio.toolContentHeight,
......
...@@ -21,12 +21,12 @@ import { ...@@ -21,12 +21,12 @@ import {
DIFF_EDITOR_PARAMS, DIFF_EDITOR_PARAMS,
PARAM_DIFF_TABLE_COL PARAM_DIFF_TABLE_COL
} from '@/pages/DataStudio/MiddleContainer/Editor/constants'; } from '@/pages/DataStudio/MiddleContainer/Editor/constants';
import { convertCodeEditTheme } from '@/utils/function';
import { l } from '@/utils/intl'; import { l } from '@/utils/intl';
import { DiffEditor } from '@monaco-editor/react'; import { DiffEditor } from '@monaco-editor/react';
import { Col, Modal, Row, Space, Table, Tabs, Typography } from 'antd'; import { Col, Modal, Row, Space, Table, Tabs, Typography } from 'antd';
import React from 'react'; import React from 'react';
import styles from './index.less'; import styles from './index.less';
import {convertCodeEditTheme} from "@/utils/function";
const { Text, Link } = Typography; const { Text, Link } = Typography;
......
...@@ -23,6 +23,7 @@ import { StateType } from '@/pages/DataStudio/model'; ...@@ -23,6 +23,7 @@ import { StateType } from '@/pages/DataStudio/model';
import { handleOption, handleRemoveById } from '@/services/BusinessCrud'; import { handleOption, handleRemoveById } from '@/services/BusinessCrud';
import { API_CONSTANTS } from '@/services/endpoints'; import { API_CONSTANTS } from '@/services/endpoints';
import { TaskVersionListItem } from '@/types/Studio/data'; import { TaskVersionListItem } from '@/types/Studio/data';
import { convertCodeEditTheme } from '@/utils/function';
import { l } from '@/utils/intl'; import { l } from '@/utils/intl';
import { useRequest } from '@@/exports'; import { useRequest } from '@@/exports';
import { RocketOutlined, SyncOutlined } from '@ant-design/icons'; import { RocketOutlined, SyncOutlined } from '@ant-design/icons';
...@@ -31,7 +32,6 @@ import { Button, Card, Modal, Tag } from 'antd'; ...@@ -31,7 +32,6 @@ import { Button, Card, Modal, Tag } from 'antd';
import moment from 'moment'; import moment from 'moment';
import React, { useState } from 'react'; import React, { useState } from 'react';
import { connect } from 'umi'; import { connect } from 'umi';
import {convertCodeEditTheme} from "@/utils/function";
const HistoryVersion = (props: any) => { const HistoryVersion = (props: any) => {
const { const {
......
...@@ -225,7 +225,11 @@ const DataStudio = (props: any) => { ...@@ -225,7 +225,11 @@ const DataStudio = (props: any) => {
<Content style={{ display: 'flex', flexDirection: 'column', minWidth: 0 }}> <Content style={{ display: 'flex', flexDirection: 'column', minWidth: 0 }}>
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
<LeftContainer size={size} leftContainer={leftContainer} rightContainer={rightContainer} /> <LeftContainer
size={size}
leftContainer={leftContainer}
rightContainer={rightContainer}
/>
<Content <Content
style={{ style={{
width: width:
......
...@@ -542,7 +542,7 @@ const Model: ModelType = { ...@@ -542,7 +542,7 @@ const Model: ModelType = {
* 更新底部高度 * 更新底部高度
*/ */
updateBottomHeight(state, { payload }) { updateBottomHeight(state, { payload }) {
if (payload!=state.bottomContainer.height) { if (payload != state.bottomContainer.height) {
return { return {
...state, ...state,
bottomContainer: { bottomContainer: {
......
...@@ -202,14 +202,32 @@ export const BuildSteps: React.FC<BuildStepsProps> = (props) => { ...@@ -202,14 +202,32 @@ export const BuildSteps: React.FC<BuildStepsProps> = (props) => {
{l('button.rebuild')} {l('button.rebuild')}
</Button>, </Button>,
<Button <Button
key={'finish'} key={'close'}
type={showLog ? 'default' : 'primary'} type={'primary'}
hidden={!showLog}
danger={showLog} danger={showLog}
onClick={() => handleCancel()}
>
{l('button.close')}
</Button>,
<Button
key={'finish'}
type={'primary'}
hidden={showLog}
disabled={steps[currentStep - 1]?.status === 'error' && percent !== 99} disabled={steps[currentStep - 1]?.status === 'error' && percent !== 99}
loading={currentStep !== steps.length && percent !== 99} loading={currentStep !== steps.length && percent !== 99}
onClick={() => handleCancel()} onClick={() => handleCancel()}
> >
{showLog ? l('button.close') : l('button.finish')} {l('button.finish')}
</Button>,
<Button
key={'daemon'}
hidden={!(currentStep !== steps.length && percent !== 99) || showLog}
onClick={() => handleCancel()}
>
{steps[currentStep - 1]?.status === 'error' && percent !== 99
? l('button.close')
: l('button.daemon')}
</Button> </Button>
]; ];
......
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