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