Unverified Commit 442ce3b0 authored by Zzm0809's avatar Zzm0809 Committed by GitHub

[Optimization-2885][web] Automatically switch console and result tags (#2886)

* Spotless Apply * Spotless Apply * auto-check-tags * Spotless Apply --------- Co-authored-by: 's avatarZzm0809 <Zzm0809@users.noreply.github.com>
parent 0edde40a
...@@ -43,10 +43,10 @@ const DagDataNode = (props: any) => { ...@@ -43,10 +43,10 @@ const DagDataNode = (props: any) => {
ratio > 0.75 ratio > 0.75
? '#cf1322' ? '#cf1322'
: ratio > 0.5 : ratio > 0.5
? '#d46b08' ? '#d46b08'
: ratio > 0.25 : ratio > 0.25
? '#d4b106' ? '#d4b106'
: '#3f8600', : '#3f8600',
fontSize: 10 fontSize: 10
}} }}
/> />
...@@ -65,10 +65,10 @@ const DagDataNode = (props: any) => { ...@@ -65,10 +65,10 @@ const DagDataNode = (props: any) => {
ratio > 0.75 ratio > 0.75
? '#3f8600' ? '#3f8600'
: ratio > 0.5 : ratio > 0.5
? '#d4b106' ? '#d4b106'
: ratio > 0.25 : ratio > 0.25
? '#d46b08' ? '#d46b08'
: '#cf1322', : '#cf1322',
fontSize: 10 fontSize: 10
}} }}
/> />
......
...@@ -92,57 +92,54 @@ export default class LineageDagExt extends LineageDag { ...@@ -92,57 +92,54 @@ export default class LineageDagExt extends LineageDag {
edges: result.edges edges: result.edges
}; };
setTimeout( setTimeout(() => {
() => { let tmpEdges = result.edges;
let tmpEdges = result.edges; result.edges = [];
result.edges = []; // this.canvas.wrapper.style.visibility = 'hidden';
// this.canvas.wrapper.style.visibility = 'hidden'; this.canvas.draw(result, () => {
this.canvas.draw(result, () => { this.canvas.relayout(
this.canvas.relayout( {
{ edges: tmpEdges.map((item) => {
edges: tmpEdges.map((item) => { return {
return { source: item.sourceNode,
source: item.sourceNode, target: item.targetNode
target: item.targetNode };
}; })
}) },
}, true
true );
); // this.canvas.wrapper.style.visibility = 'visible';
// this.canvas.wrapper.style.visibility = 'visible'; this.canvas.addEdges(tmpEdges, true);
this.canvas.addEdges(tmpEdges, true);
let minimap = _.get(this, 'props.config.minimap', {});
let minimap = _.get(this, 'props.config.minimap', {});
const minimapCfg = _.assign({}, minimap.config, {
const minimapCfg = _.assign({}, minimap.config, { events: ['system.node.click', 'system.canvas.click']
events: ['system.node.click', 'system.canvas.click'] });
});
if (minimap && minimap.enable) {
this.canvas.setMinimap(true, minimapCfg);
}
if (_.get(this, 'props.config.gridMode')) { if (minimap && minimap.enable) {
this.canvas.setGridMode(true, _.assign({}, _.get(this, 'props.config.gridMode', {}))); this.canvas.setMinimap(true, minimapCfg);
} }
if (result.nodes.length !== 0) { if (_.get(this, 'props.config.gridMode')) {
this.canvas.focusCenterWithAnimate(); this.canvas.setGridMode(true, _.assign({}, _.get(this, 'props.config.gridMode', {})));
this._isFirstFocus = true; }
}
this.forceUpdate(); if (result.nodes.length !== 0) {
this.props.onLoaded && this.props.onLoaded(this.canvas); this.canvas.focusCenterWithAnimate();
}); this._isFirstFocus = true;
this.canvas.on('system.node.click', (data) => { }
let node = data.node;
this.canvas.focus(node.id); this.forceUpdate();
}); this.props.onLoaded && this.props.onLoaded(this.canvas);
this.canvas.on('system.canvas.click', () => { });
this.canvas.unfocus(); this.canvas.on('system.node.click', (data) => {
}); let node = data.node;
}, this.canvas.focus(node.id);
_.get(this.props, 'config.delayDraw', 0) });
); this.canvas.on('system.canvas.click', () => {
this.canvas.unfocus();
});
}, _.get(this.props, 'config.delayDraw', 0));
} }
} }
...@@ -316,10 +316,10 @@ const MenuList: React.FC = () => { ...@@ -316,10 +316,10 @@ const MenuList: React.FC = () => {
{sysMenuValue?.id && editOpen {sysMenuValue?.id && editOpen
? l('menu.edit') ? l('menu.edit')
: !sysMenuValue?.id && addedOpen && !isRootMenu : !sysMenuValue?.id && addedOpen && !isRootMenu
? l('right.menu.addSub') ? l('right.menu.addSub')
: !sysMenuValue?.id && addedOpen && isRootMenu : !sysMenuValue?.id && addedOpen && isRootMenu
? l('right.menu.createRoot') ? l('right.menu.createRoot')
: ''} : ''}
</> </>
); );
}; };
......
...@@ -87,11 +87,11 @@ const TokenModalForm: React.FC<TokenModalFormProps & connect> = (props) => { ...@@ -87,11 +87,11 @@ const TokenModalForm: React.FC<TokenModalFormProps & connect> = (props) => {
value.expireType === 2 value.expireType === 2
? parseDateStringToDate(value.expireEndTime) ? parseDateStringToDate(value.expireEndTime)
: value.expireType === 3 : value.expireType === 3
? [ ? [
parseDateStringToDate(value.expireStartTime), parseDateStringToDate(value.expireStartTime),
parseDateStringToDate(value.expireEndTime) parseDateStringToDate(value.expireEndTime)
] ]
: undefined : undefined
}); });
}, [visible, value, form, selectUserId]); }, [visible, value, form, selectUserId]);
......
...@@ -61,8 +61,8 @@ export const JobConfigInfo: React.FC<JobDetailInfoModelProps> = (props) => { ...@@ -61,8 +61,8 @@ export const JobConfigInfo: React.FC<JobDetailInfoModelProps> = (props) => {
{row?.clusterId {row?.clusterId
? l('pages.datastudio.label.history.clusterInstance') ? l('pages.datastudio.label.history.clusterInstance')
: row?.clusterConfigurationId : row?.clusterConfigurationId
? l('pages.datastudio.label.history.clusterConfig') ? l('pages.datastudio.label.history.clusterConfig')
: l('pages.datastudio.label.history.local')} : l('pages.datastudio.label.history.local')}
</ProDescriptions.Item> </ProDescriptions.Item>
<ProDescriptions.Item <ProDescriptions.Item
......
...@@ -52,8 +52,8 @@ const JobRunningModal: React.FC<JobRunningModalProps> = (props) => { ...@@ -52,8 +52,8 @@ const JobRunningModal: React.FC<JobRunningModalProps> = (props) => {
? value?.jobState === 'RUNNING' ? value?.jobState === 'RUNNING'
? 50 ? 50
: value?.jobState === 'FINISHED' : value?.jobState === 'FINISHED'
? 100 ? 100
: 0 : 0
: 0 : 0
} }
status='active' status='active'
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
import { LoadingBtn } from '@/components/CallBackButton/LoadingBtn'; import { LoadingBtn } from '@/components/CallBackButton/LoadingBtn';
import { PushpinIcon } from '@/components/Icons/CustomIcons'; import { PushpinIcon } from '@/components/Icons/CustomIcons';
import { FlexCenterDiv } from '@/components/StyledComponents'; import { FlexCenterDiv } from '@/components/StyledComponents';
import { LeftBottomKey } from '@/pages/DataStudio/data.d';
import { getCurrentData, getCurrentTab, mapDispatchToProps } from '@/pages/DataStudio/function'; import { getCurrentData, getCurrentTab, mapDispatchToProps } from '@/pages/DataStudio/function';
import Explain from '@/pages/DataStudio/HeaderContainer/Explain'; import Explain from '@/pages/DataStudio/HeaderContainer/Explain';
import FlinkGraph from '@/pages/DataStudio/HeaderContainer/FlinkGraph'; import FlinkGraph from '@/pages/DataStudio/HeaderContainer/FlinkGraph';
...@@ -100,6 +101,7 @@ const HeaderContainer = (props: connect) => { ...@@ -100,6 +101,7 @@ const HeaderContainer = (props: connect) => {
tabs: { panes, activeKey }, tabs: { panes, activeKey },
saveTabs, saveTabs,
updateJobRunningMsg, updateJobRunningMsg,
updateSelectBottomKey,
queryDsConfig, queryDsConfig,
queryTaskData, queryTaskData,
enabledDs enabledDs
...@@ -189,6 +191,7 @@ const HeaderContainer = (props: connect) => { ...@@ -189,6 +191,7 @@ const HeaderContainer = (props: connect) => {
}; };
const handlerDebug = async () => { const handlerDebug = async () => {
updateSelectBottomKey(LeftBottomKey.CONSOLE_KEY);
if (!currentData) return; if (!currentData) return;
// @ts-ignore // @ts-ignore
const editor = currentTab.monacoInstance.editor const editor = currentTab.monacoInstance.editor
...@@ -208,7 +211,12 @@ const HeaderContainer = (props: connect) => { ...@@ -208,7 +211,12 @@ const HeaderContainer = (props: connect) => {
{ ...currentData, statement: selectSql } { ...currentData, statement: selectSql }
); );
if (!res) return; if (!res) {
return;
} else {
updateSelectBottomKey(LeftBottomKey.RESULT_KEY);
}
updateJobRunningMsg({ updateJobRunningMsg({
taskId: currentData.id, taskId: currentData.id,
jobName: currentData.name, jobName: currentData.name,
...@@ -232,6 +240,8 @@ const HeaderContainer = (props: connect) => { ...@@ -232,6 +240,8 @@ const HeaderContainer = (props: connect) => {
}; };
const handlerSubmit = async () => { const handlerSubmit = async () => {
updateSelectBottomKey(LeftBottomKey.CONSOLE_KEY);
if (!currentData) return; if (!currentData) return;
const saved = currentData.step == JOB_LIFE_CYCLE.PUBLISH ? true : await handleSave(); const saved = currentData.step == JOB_LIFE_CYCLE.PUBLISH ? true : await handleSave();
if (!saved) return; if (!saved) return;
......
...@@ -202,14 +202,14 @@ export function getRightSelectKeyFromNodeClickJobType(jobType: string): string { ...@@ -202,14 +202,14 @@ export function getRightSelectKeyFromNodeClickJobType(jobType: string): string {
return isFlinkJob(jobType) return isFlinkJob(jobType)
? RightMenuKey.JOB_CONFIG_KEY ? RightMenuKey.JOB_CONFIG_KEY
: isSql(jobType) : isSql(jobType)
? RightMenuKey.PREVIEW_CONFIG_KEY ? RightMenuKey.PREVIEW_CONFIG_KEY
: RightMenuKey.JOB_INFO_KEY; : RightMenuKey.JOB_INFO_KEY;
} }
export function getBottomSelectKeyFromNodeClickJobType(jobType: string): string { export function getBottomSelectKeyFromNodeClickJobType(jobType: string): string {
return isFlinkJob(jobType) || isSql(jobType) return isFlinkJob(jobType) || isSql(jobType)
? LeftBottomKey.CONSOLE_KEY ? LeftBottomKey.CONSOLE_KEY
: isUDF(jobType) || jobType.toLowerCase() === DIALECT.FLINKSQLENV : isUDF(jobType) || jobType.toLowerCase() === DIALECT.FLINKSQLENV
? LeftBottomKey.TOOLS_KEY ? LeftBottomKey.TOOLS_KEY
: LeftBottomKey.TOOLS_KEY; : LeftBottomKey.TOOLS_KEY;
} }
...@@ -204,8 +204,8 @@ const Project: React.FC = (props: connect) => { ...@@ -204,8 +204,8 @@ const Project: React.FC = (props: connect) => {
options.parentId = projectState.isCreateTask options.parentId = projectState.isCreateTask
? projectState.value.id ? projectState.value.id
: projectState.isEdit : projectState.isEdit
? projectState.value.parentId ? projectState.value.parentId
: options.parentId; : options.parentId;
} else { } else {
options.url = API_CONSTANTS.SAVE_OR_UPDATE_CATALOGUE_URL; options.url = API_CONSTANTS.SAVE_OR_UPDATE_CATALOGUE_URL;
} }
......
...@@ -93,8 +93,8 @@ const DataStudio: React.FC<connect> = (props: any) => { ...@@ -93,8 +93,8 @@ const DataStudio: React.FC<connect> = (props: any) => {
const newBottomHeight = !isProject const newBottomHeight = !isProject
? 0 ? 0
: bottomContainer.selectKey === '' : bottomContainer.selectKey === ''
? 0 ? 0
: bottomContainer.height; : bottomContainer.height;
const centerContentHeight = getClientSize().contentHeight - newBottomHeight; const centerContentHeight = getClientSize().contentHeight - newBottomHeight;
updateCenterContentHeight(centerContentHeight); updateCenterContentHeight(centerContentHeight);
updateToolContentHeight(centerContentHeight - VIEW.leftMargin); updateToolContentHeight(centerContentHeight - VIEW.leftMargin);
...@@ -118,8 +118,8 @@ const DataStudio: React.FC<connect> = (props: any) => { ...@@ -118,8 +118,8 @@ const DataStudio: React.FC<connect> = (props: any) => {
const newBottomHeight = !isProject const newBottomHeight = !isProject
? 0 ? 0
: bottomContainer.selectKey === '' : bottomContainer.selectKey === ''
? 0 ? 0
: bottomContainer.height; : bottomContainer.height;
const centerContentHeight = size.contentHeight - newBottomHeight; const centerContentHeight = size.contentHeight - newBottomHeight;
updateCenterContentHeight(centerContentHeight); updateCenterContentHeight(centerContentHeight);
updateToolContentHeight(centerContentHeight - VIEW.leftMargin); updateToolContentHeight(centerContentHeight - VIEW.leftMargin);
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
* *
*/ */
import { LeftBottomKey, LeftMenuKey } from '@/pages/DataStudio/data.d';
import { getFooterValue, isDataStudioTabsItemType } from '@/pages/DataStudio/function'; import { getFooterValue, isDataStudioTabsItemType } from '@/pages/DataStudio/function';
import { getDataSourceList } from '@/pages/DataStudio/LeftContainer/DataSource/service'; import { getDataSourceList } from '@/pages/DataStudio/LeftContainer/DataSource/service';
import { getTaskData } from '@/pages/DataStudio/LeftContainer/Project/service'; import { getTaskData } from '@/pages/DataStudio/LeftContainer/Project/service';
...@@ -356,7 +357,7 @@ const Model: ModelType = { ...@@ -356,7 +357,7 @@ const Model: ModelType = {
toolContentHeight: 0, toolContentHeight: 0,
centerContentHeight: 0, centerContentHeight: 0,
leftContainer: { leftContainer: {
selectKey: 'menu.datastudio.project', selectKey: LeftMenuKey.PROJECT_KEY,
selectSubKey: {}, selectSubKey: {},
height: '100%', height: '100%',
width: 260 width: 260
...@@ -368,7 +369,7 @@ const Model: ModelType = { ...@@ -368,7 +369,7 @@ const Model: ModelType = {
width: 260 width: 260
}, },
bottomContainer: { bottomContainer: {
selectKey: 'menu.datastudio.console', selectKey: LeftBottomKey.CONSOLE_KEY,
selectSubKey: {}, selectSubKey: {},
height: 180, height: 180,
width: '100%' width: '100%'
......
...@@ -134,14 +134,14 @@ export const renderBranchesTagColor = (item: string) => { ...@@ -134,14 +134,14 @@ export const renderBranchesTagColor = (item: string) => {
return item.includes('dev') return item.includes('dev')
? 'processing' ? 'processing'
: item.includes('test') : item.includes('test')
? 'warning' ? 'warning'
: item.includes('release') : item.includes('release')
? 'success' ? 'success'
: item.includes('master') : item.includes('master')
? 'success' ? 'success'
: item.includes('main') : item.includes('main')
? 'success' ? 'success'
: 'default'; : 'default';
}; };
/** /**
......
...@@ -296,8 +296,8 @@ const ResourceOverView: React.FC = () => { ...@@ -296,8 +296,8 @@ const ResourceOverView: React.FC = () => {
editModal === 'createFolder' editModal === 'createFolder'
? l('right.menu.createFolder') ? l('right.menu.createFolder')
: editModal === 'rename' : editModal === 'rename'
? l('right.menu.rename') ? l('right.menu.rename')
: '' : ''
} }
formValues={resourceState.value} formValues={resourceState.value}
onOk={handleModalSubmit} onOk={handleModalSubmit}
......
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