Unverified Commit 2343bd8a authored by Zzm0809's avatar Zzm0809 Committed by GitHub

improve datastudio's menu tag logical & modify some layout (#2619)

* improve some web code * improve some web code * improve some web code * Spotless Apply * improve some web code * Spotless Apply * improve some layout * Spotless Apply * modify some layout * Spotless Apply * delete unuse classname * improve some layout * Spotless Apply * fix i18n --------- Co-authored-by: 's avatarZzm0809 <Zzm0809@users.noreply.github.com>
parent 7ea8cab6
...@@ -164,6 +164,7 @@ const CodeEdit = (props: CodeEditFormProps & connect) => { ...@@ -164,6 +164,7 @@ const CodeEdit = (props: CodeEditFormProps & connect) => {
readOnly, // 是否只读 readOnly, // 是否只读
glyphMargin: true, // 字形边缘 glyphMargin: true, // 字形边缘
formatOnType: true, // 代码格式化 formatOnType: true, // 代码格式化
// columnSelection: true, // 列选择
wrappingIndent: wrappingIndent:
language === 'yaml' || language === 'yml' || language === 'json' ? 'indent' : 'none', language === 'yaml' || language === 'yml' || language === 'json' ? 'indent' : 'none',
inlineSuggest: { inlineSuggest: {
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
import { Badge, Tooltip, Typography } from 'antd'; import { Badge, Tooltip, Typography } from 'antd';
import LineageDagExt from '@/components/LineageGraph/lineage-dag-ext';
import { import {
LineageDetailInfo, LineageDetailInfo,
LineageRelations, LineageRelations,
...@@ -28,19 +29,15 @@ import { ...@@ -28,19 +29,15 @@ import {
import { l } from '@/utils/intl'; import { l } from '@/utils/intl';
import { SuccessNotification, WarningNotification } from '@/utils/messages'; import { SuccessNotification, WarningNotification } from '@/utils/messages';
import { import {
ArrowsAltOutlined,
ColumnHeightOutlined,
CompassOutlined, CompassOutlined,
ExpandAltOutlined,
FullscreenExitOutlined,
InsertRowAboveOutlined, InsertRowAboveOutlined,
PlusCircleOutlined, ReloadOutlined,
ReloadOutlined ShrinkOutlined
} from '@ant-design/icons'; } from '@ant-design/icons';
import _ from 'lodash';
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';
import 'react-lineage-dag/dist/index.css'; import 'react-lineage-dag/dist/index.css';
// import LineageDag from "react-lineage-dag";
import LineageDagExt from '@/components/LineageGraph/lineage-dag-ext';
// import LineageDagExt from "@/components/LineageGraph/lineage-dag-ext";
interface LineageState { interface LineageState {
lineageData: LineageDetailInfo; lineageData: LineageDetailInfo;
...@@ -50,7 +47,7 @@ interface LineageState { ...@@ -50,7 +47,7 @@ interface LineageState {
relations: LineageRelations[]; relations: LineageRelations[];
columns: any[]; columns: any[];
operator: any[]; operator: any[];
centerId: string; centerId?: string;
showMinimap: boolean; showMinimap: boolean;
refresh: boolean; refresh: boolean;
expandField: boolean; expandField: boolean;
...@@ -69,7 +66,7 @@ type JobLineageProps = { ...@@ -69,7 +66,7 @@ type JobLineageProps = {
type ITable = { type ITable = {
id: string; id: string;
name: string; name: string;
isCollapse: boolean; isCollapse?: boolean;
fields: LineageTableColumn[]; fields: LineageTableColumn[];
}; };
...@@ -188,10 +185,10 @@ const LineageGraph: React.FC<JobLineageProps> = (props) => { ...@@ -188,10 +185,10 @@ const LineageGraph: React.FC<JobLineageProps> = (props) => {
<Tooltip <Tooltip
title={lineageState.expandField ? l('lineage.expandField') : l('lineage.expandField')} title={lineageState.expandField ? l('lineage.expandField') : l('lineage.expandField')}
> >
<FullscreenExitOutlined width={300} /> <ColumnHeightOutlined />
</Tooltip> </Tooltip>
), ),
onClick: (nodeData: any) => handleExpandField(nodeData, _.clone(data)) onClick: (nodeData: any) => handleExpandField(nodeData, data)
}, },
{ {
id: 'expandDownstream', id: 'expandDownstream',
...@@ -206,7 +203,7 @@ const LineageGraph: React.FC<JobLineageProps> = (props) => { ...@@ -206,7 +203,7 @@ const LineageGraph: React.FC<JobLineageProps> = (props) => {
: l('lineage.collapseDownstream') : l('lineage.collapseDownstream')
} }
> >
<PlusCircleOutlined /> <ShrinkOutlined />
</Tooltip> </Tooltip>
), ),
onClick: (nodeData: { id: string }) => { onClick: (nodeData: { id: string }) => {
...@@ -235,7 +232,7 @@ const LineageGraph: React.FC<JobLineageProps> = (props) => { ...@@ -235,7 +232,7 @@ const LineageGraph: React.FC<JobLineageProps> = (props) => {
: l('lineage.collapseUpstream') : l('lineage.collapseUpstream')
} }
> >
<ExpandAltOutlined /> <ArrowsAltOutlined />
</Tooltip> </Tooltip>
), ),
onClick: (nodeData: { id: string }) => { onClick: (nodeData: { id: string }) => {
...@@ -327,11 +324,9 @@ const LineageGraph: React.FC<JobLineageProps> = (props) => { ...@@ -327,11 +324,9 @@ const LineageGraph: React.FC<JobLineageProps> = (props) => {
isAdsorb: true, isAdsorb: true,
theme: { theme: {
shapeType: 'line', shapeType: 'line',
gap: 20, gap: 30,
lineWidth: 1, lineWidth: 0.2,
lineColor: '#e8e8e8', circleRadiu: 5
circleRadiu: 5,
circleColor: '#e8e8e8'
} }
} }
}} }}
......
...@@ -48,7 +48,7 @@ export default { ...@@ -48,7 +48,7 @@ export default {
* *
* */ * */
'button.push': 'submit', 'button.push': 'Push',
/** /**
* *
* catalog * catalog
...@@ -1123,12 +1123,12 @@ export default { ...@@ -1123,12 +1123,12 @@ export default {
'user.usernamePlaceholder': 'Please enter user name', 'user.usernamePlaceholder': 'Please enter user name',
'lineage.getError': 'Cannot Get Lineage', 'lineage.getError': 'Cannot Get Lineage',
'lineage.expandField': 'Expand Field', 'lineage.expandField': 'Expand Field(UnSupported)',
'lineage.collapseField': 'Collapse Field', 'lineage.collapseField': 'Collapse Field(UnSupported)',
'lineage.expandDownstream': 'Expand Downstream', 'lineage.expandDownstream': 'Expand Downstream(UnSupported)',
'lineage.collapseDownstream': 'Collapse Downstream', 'lineage.collapseDownstream': 'Collapse Downstream(UnSupported)',
'lineage.expandUpstream': 'Expand Upstream', 'lineage.expandUpstream': 'Expand Upstream(UnSupported)',
'lineage.collapseUpstream': 'Collapse Upstream', 'lineage.collapseUpstream': 'Collapse Upstream(UnSupported)',
'lineage.showMap': 'Show Map', 'lineage.showMap': 'Show Map',
'lineage.hideMap': 'Hide Map', 'lineage.hideMap': 'Hide Map',
'lineage.refresh': 'Refresh' 'lineage.refresh': 'Refresh'
......
...@@ -45,7 +45,7 @@ export default { ...@@ -45,7 +45,7 @@ export default {
* *
* */ * */
'button.push': '提交', 'button.push': '推送',
/** /**
* *
* catalog * catalog
...@@ -1083,12 +1083,12 @@ export default { ...@@ -1083,12 +1083,12 @@ export default {
'user.usernamePlaceholder': '请输入用户名', 'user.usernamePlaceholder': '请输入用户名',
'lineage.getError': '无法获取血缘', 'lineage.getError': '无法获取血缘',
'lineage.expandField': '展开字段', 'lineage.expandField': '展开字段(暂未实现)',
'lineage.collapseField': '收缩字段', 'lineage.collapseField': '收起字段(暂未实现)',
'lineage.expandDownstream': '展开下游', 'lineage.expandDownstream': '展开下游(暂未实现)',
'lineage.collapseDownstream': '收起下游', 'lineage.collapseDownstream': '收起下游(暂未实现)',
'lineage.expandUpstream': '展开上游', 'lineage.expandUpstream': '展开上游(暂未实现)',
'lineage.collapseUpstream': '收起上游', 'lineage.collapseUpstream': '收起上游(暂未实现)',
'lineage.showMap': '显示小地图', 'lineage.showMap': '显示小地图',
'lineage.hideMap': '隐藏小地图', 'lineage.hideMap': '隐藏小地图',
'lineage.refresh': '刷新血缘' 'lineage.refresh': '刷新血缘'
......
...@@ -33,8 +33,6 @@ type StatementInfoProps = { ...@@ -33,8 +33,6 @@ type StatementInfoProps = {
export const StatementInfo: React.FC<StatementInfoProps> = (props) => { export const StatementInfo: React.FC<StatementInfoProps> = (props) => {
const { row } = props; const { row } = props;
console.log(row?.statement);
return ( return (
<> <>
<ProDescriptions <ProDescriptions
......
...@@ -250,8 +250,6 @@ const JobExecHistory: React.FC<connect> = (props) => { ...@@ -250,8 +250,6 @@ const JobExecHistory: React.FC<connect> = (props) => {
}; };
}; };
console.log(currentTab);
return ( return (
<> <>
{tabs.panes.length === 0 ? ( {tabs.panes.length === 0 ? (
......
...@@ -132,7 +132,7 @@ const Result = (props: any) => { ...@@ -132,7 +132,7 @@ const Result = (props: any) => {
} else { } else {
if (isSql(current.dialect)) { if (isSql(current.dialect)) {
// common sql // common sql
const res = await handleGetOption('api/studio/getCommonSqlData', 'Get Data', { const res = await handleGetOption('api/studio/getCommonSqlData', l('global.getdata.tips'), {
taskId: params.taskId taskId: params.taskId
}); });
if (res.data) { if (res.data) {
...@@ -149,9 +149,13 @@ const Result = (props: any) => { ...@@ -149,9 +149,13 @@ const Result = (props: any) => {
const historyData = res.data; const historyData = res.data;
if (historyData && '2' == historyData.status) { if (historyData && '2' == historyData.status) {
const historyId = historyData.id; const historyId = historyData.id;
const tableData = await handleGetOption('api/studio/getJobData', 'Get Data', { const tableData = await handleGetOption(
jobId: historyId 'api/studio/getJobData',
}); l('global.getdata.tips'),
{
jobId: historyId
}
);
const data = tableData.data; const data = tableData.data;
if (data.success) { if (data.success) {
consoleData.result = data; consoleData.result = data;
......
...@@ -21,7 +21,13 @@ import { CircleBtn } from '@/components/CallBackButton/CircleBtn'; ...@@ -21,7 +21,13 @@ 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,
TabsItemType,
TabsPageType,
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';
...@@ -34,7 +40,13 @@ export type BottomContainerProps = { ...@@ -34,7 +40,13 @@ 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,
tabs: { activeKey, panes }
} = props;
const width = document.documentElement.clientWidth - VIEW.sideWidth * 2; const width = document.documentElement.clientWidth - VIEW.sideWidth * 2;
/** /**
...@@ -76,6 +88,13 @@ const BottomContainer: React.FC<BottomContainerProps> = (props: any) => { ...@@ -76,6 +88,13 @@ const BottomContainer: React.FC<BottomContainerProps> = (props: any) => {
}); });
}; };
const updateSelectBottomKey = (key: string) => {
dispatch({
type: STUDIO_MODEL.updateSelectBottomKey,
payload: key
});
};
/** /**
* 更新工具栏内容高度 * 更新工具栏内容高度
* @param {number} height * @param {number} height
...@@ -159,7 +178,32 @@ const BottomContainer: React.FC<BottomContainerProps> = (props: any) => { ...@@ -159,7 +178,32 @@ const BottomContainer: React.FC<BottomContainerProps> = (props: any) => {
}; };
const renderItems = () => { const renderItems = () => {
return [ return [
...LeftBottomSide.map((x) => { ...LeftBottomSide.filter((tab) => {
if (!tab.isShow) {
return true;
}
if (parseInt(activeKey) < 0) {
return TabsPageType.None;
}
const currentTab = (panes as TabsItemType[]).find((item) => item.key === activeKey);
const show = tab.isShow(currentTab?.type ?? TabsPageType.None, currentTab?.subType);
// 如果当前打开的菜单等于 状态存的菜单 且 菜单不显示状态下,先切换到项目key(因为项目key 不可能不显示) 在关闭这个
// if current open menu equal status menu and menu is not show status, first switch to project key(because project key is not show) and close this
// if (tab.key === bottomContainer.selectKey && !show) {
// updateSelectBottomKey(
// currentTab?.subType?.toLowerCase() === DIALECT.FLINKSQLENV
// || currentTab?.subType?.toLowerCase() === DIALECT.SCALA
// || currentTab?.subType?.toLowerCase() === DIALECT.JAVA
// || currentTab?.subType?.toLowerCase() === DIALECT.PYTHON_LONG
// ? LeftBottomKey.TOOLS_KEY // 如果当前打开的是flinksql环境,scala,java,python,切换到工具栏
// : currentTab?.subType?.toLowerCase() === DIALECT.FLINK_SQL
// || currentTab?.subType?.toLowerCase() === DIALECT.FLINKJAR
// || isSql(currentTab?.subType ?? '')
// ? LeftBottomKey.CONSOLE_KEY : LeftBottomKey.TOOLS_KEY // 如果当前打开的是flinksql,flinkjar,切换到控制台
// );
// }
return show;
}).map((x) => {
return { ...x, key: x.key + '/' }; return { ...x, key: x.key + '/' };
}), }),
...getSubTabs() ...getSubTabs()
...@@ -233,5 +277,6 @@ const BottomContainer: React.FC<BottomContainerProps> = (props: any) => { ...@@ -233,5 +277,6 @@ const BottomContainer: React.FC<BottomContainerProps> = (props: any) => {
}; };
export default connect(({ Studio }: { Studio: StateType }) => ({ export default connect(({ Studio }: { Studio: StateType }) => ({
bottomContainer: Studio.bottomContainer bottomContainer: Studio.bottomContainer,
tabs: Studio.tabs
}))(BottomContainer); }))(BottomContainer);
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
* *
*/ */
import { LeftBottomKey, RightMenuKey } from '@/pages/DataStudio/data.d';
import { isSql } from '@/pages/DataStudio/HeaderContainer/service';
import { getTabIcon } from '@/pages/DataStudio/MiddleContainer/function'; import { getTabIcon } from '@/pages/DataStudio/MiddleContainer/function';
import { DIALECT } from '@/services/constants'; import { DIALECT } from '@/services/constants';
import { Catalogue } from '@/types/Studio/data.d'; import { Catalogue } from '@/types/Studio/data.d';
...@@ -185,5 +187,29 @@ export const buildProjectTree = ( ...@@ -185,5 +187,29 @@ export const buildProjectTree = (
: []; : [];
export const isUDF = (jobType: string): boolean => { export const isUDF = (jobType: string): boolean => {
return jobType === 'Scala' || jobType === 'Python' || jobType === 'Java'; return (
jobType.toLowerCase() === DIALECT.SCALA ||
jobType.toLowerCase() === DIALECT.PYTHON_LONG ||
jobType.toLowerCase() === DIALECT.JAVA
);
}; };
export const isFlinkJob = (jobType: string): boolean => {
return jobType.toLowerCase() === DIALECT.FLINK_SQL || jobType.toLowerCase() === DIALECT.FLINKJAR;
};
export function getRightSelectKeyFromNodeClickJobType(jobType: string): string {
return isFlinkJob(jobType)
? RightMenuKey.JOB_CONFIG_KEY
: isSql(jobType)
? 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;
}
...@@ -18,12 +18,17 @@ ...@@ -18,12 +18,17 @@
*/ */
import RightContextMenu from '@/components/RightContextMenu'; import RightContextMenu from '@/components/RightContextMenu';
import { LeftBottomKey } from '@/pages/DataStudio/data.d';
import { getTabByTaskId } from '@/pages/DataStudio/function'; import { getTabByTaskId } from '@/pages/DataStudio/function';
import { import {
FOLDER_RIGHT_MENU, FOLDER_RIGHT_MENU,
JOB_RIGHT_MENU JOB_RIGHT_MENU
} from '@/pages/DataStudio/LeftContainer/Project/constants'; } from '@/pages/DataStudio/LeftContainer/Project/constants';
import FolderModal from '@/pages/DataStudio/LeftContainer/Project/FolderModal'; import FolderModal from '@/pages/DataStudio/LeftContainer/Project/FolderModal';
import {
getBottomSelectKeyFromNodeClickJobType,
getRightSelectKeyFromNodeClickJobType
} from '@/pages/DataStudio/LeftContainer/Project/function';
import JobModal from '@/pages/DataStudio/LeftContainer/Project/JobModal'; import JobModal from '@/pages/DataStudio/LeftContainer/Project/JobModal';
import JobTree from '@/pages/DataStudio/LeftContainer/Project/JobTree'; import JobTree from '@/pages/DataStudio/LeftContainer/Project/JobTree';
import { import {
...@@ -32,6 +37,7 @@ import { ...@@ -32,6 +37,7 @@ import {
STUDIO_MODEL, STUDIO_MODEL,
STUDIO_MODEL_ASYNC STUDIO_MODEL_ASYNC
} from '@/pages/DataStudio/model'; } from '@/pages/DataStudio/model';
import { LeftBottomMoreTabs } from '@/pages/DataStudio/route';
import { import {
handleAddOrUpdate, handleAddOrUpdate,
handleOption, handleOption,
...@@ -126,6 +132,22 @@ const Project: React.FC = (props: connect) => { ...@@ -126,6 +132,22 @@ const Project: React.FC = (props: connect) => {
if (!isLeaf) { if (!isLeaf) {
dispatch({ type: STUDIO_MODEL.updateProjectExpandKey, payload: [...expandKeys, key] }); dispatch({ type: STUDIO_MODEL.updateProjectExpandKey, payload: [...expandKeys, key] });
return; return;
} else {
dispatch({
type: STUDIO_MODEL.updateSelectRightKey,
payload: getRightSelectKeyFromNodeClickJobType(type)
});
const bottomKey = getBottomSelectKeyFromNodeClickJobType(type);
dispatch({
type: STUDIO_MODEL.updateSelectBottomKey,
payload: bottomKey
});
if (bottomKey === LeftBottomKey.TOOLS_KEY) {
dispatch({
type: STUDIO_MODEL.updateSelectBottomSubKey,
payload: LeftBottomMoreTabs[bottomKey][0].key
});
}
} }
path.pop(); path.pop();
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
* *
*/ */
import RightContextMenu from '@/components/RightContextMenu';
import ContentScroll from '@/components/Scroll/ContentScroll'; import ContentScroll from '@/components/Scroll/ContentScroll';
import { useEditor } from '@/hooks/useEditor'; import { useEditor } from '@/hooks/useEditor';
import useThemeValue from '@/hooks/useThemeValue'; import useThemeValue from '@/hooks/useThemeValue';
...@@ -26,6 +27,10 @@ import { ...@@ -26,6 +27,10 @@ import {
isDataStudioTabsItemType, isDataStudioTabsItemType,
isMetadataTabsItemType isMetadataTabsItemType
} from '@/pages/DataStudio/function'; } from '@/pages/DataStudio/function';
import {
getBottomSelectKeyFromNodeClickJobType,
getRightSelectKeyFromNodeClickJobType
} from '@/pages/DataStudio/LeftContainer/Project/function';
import { getTabIcon } from '@/pages/DataStudio/MiddleContainer/function'; import { getTabIcon } from '@/pages/DataStudio/MiddleContainer/function';
import KeyBoard from '@/pages/DataStudio/MiddleContainer/KeyBoard'; import KeyBoard from '@/pages/DataStudio/MiddleContainer/KeyBoard';
import QuickGuide from '@/pages/DataStudio/MiddleContainer/QuickGuide'; import QuickGuide from '@/pages/DataStudio/MiddleContainer/QuickGuide';
...@@ -33,10 +38,11 @@ import StudioEditor from '@/pages/DataStudio/MiddleContainer/StudioEditor'; ...@@ -33,10 +38,11 @@ import StudioEditor from '@/pages/DataStudio/MiddleContainer/StudioEditor';
import { StateType, STUDIO_MODEL, TabsItemType, TabsPageType } from '@/pages/DataStudio/model'; import { StateType, STUDIO_MODEL, TabsItemType, TabsPageType } from '@/pages/DataStudio/model';
import { RightSide } from '@/pages/DataStudio/route'; import { RightSide } from '@/pages/DataStudio/route';
import RightTagsRouter from '@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter'; import RightTagsRouter from '@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter';
import { ContextMenuPosition, InitContextMenuPosition } from '@/types/Public/state.d';
import { l } from '@/utils/intl'; import { l } from '@/utils/intl';
import { connect } from '@@/exports'; import { connect } from '@@/exports';
import { ExclamationCircleFilled } from '@ant-design/icons'; import { ExclamationCircleFilled } from '@ant-design/icons';
import { ConfigProvider, Divider, Dropdown, Modal, Space, Tabs, Typography } from 'antd'; import { ConfigProvider, Divider, Modal, Space, Tabs, Typography } from 'antd';
import { MenuInfo } from 'rc-menu/es/interface'; import { MenuInfo } from 'rc-menu/es/interface';
import React, { memo, useState } from 'react'; import React, { memo, useState } from 'react';
...@@ -55,7 +61,8 @@ const MiddleContainer = (props: any) => { ...@@ -55,7 +61,8 @@ const MiddleContainer = (props: any) => {
const { fullscreen } = useEditor(); const { fullscreen } = useEditor();
const [contextMenuPosition, setContextMenuPosition] = useState({}); const [contextMenuPosition, setContextMenuPosition] =
useState<ContextMenuPosition>(InitContextMenuPosition);
const [contextMenuVisible, setContextMenuVisible] = useState(false); const [contextMenuVisible, setContextMenuVisible] = useState(false);
const [includeTab, setIncludeTab] = useState({}); const [includeTab, setIncludeTab] = useState({});
...@@ -109,7 +116,7 @@ const MiddleContainer = (props: any) => { ...@@ -109,7 +116,7 @@ const MiddleContainer = (props: any) => {
}; };
const updateActiveKey = (item: TabsItemType) => { const updateActiveKey = (item: TabsItemType) => {
const { key, label } = item; const { key, label, subType } = item;
if (key === activeKey) { if (key === activeKey) {
return; return;
} }
...@@ -117,11 +124,24 @@ const MiddleContainer = (props: any) => { ...@@ -117,11 +124,24 @@ const MiddleContainer = (props: any) => {
setContextMenuVisible(false); setContextMenuVisible(false);
updateRightKey(key); updateRightKey(key);
// 更新当前选中的 tab key
dispatch({ dispatch({
type: STUDIO_MODEL.updateTabsActiveKey, type: STUDIO_MODEL.updateTabsActiveKey,
payload: key payload: key
}); });
// 根据 作业类型渲染 右侧选中菜单 key
dispatch({
type: STUDIO_MODEL.updateSelectRightKey,
payload: getRightSelectKeyFromNodeClickJobType(subType ?? '')
});
// 根据 作业类型渲染 左下角选中菜单 key
dispatch({
type: STUDIO_MODEL.updateSelectBottomKey,
payload: getBottomSelectKeyFromNodeClickJobType(subType ?? '')
});
// 这里如果加此项功能和定位功能重复 , 暂时注释 // 这里如果加此项功能和定位功能重复 , 暂时注释
// if (item.type === TabsPageType.project) { // if (item.type === TabsPageType.project) {
// 更新左侧树选中的 key // 更新左侧树选中的 key
...@@ -177,14 +197,12 @@ const MiddleContainer = (props: any) => { ...@@ -177,14 +197,12 @@ const MiddleContainer = (props: any) => {
// 设置选中的值 // 设置选中的值
setIncludeTab(item); setIncludeTab(item);
setContextMenuVisible(true); setContextMenuVisible(true);
setContextMenuPosition({ setContextMenuPosition((prevState) => ({
position: 'fixed', ...prevState,
cursor: 'context-menu',
width: '10vw', width: '10vw',
zIndex: 999, left: info.clientX + 10,
left: info.clientX + 10, // + 10 是为了让鼠标不至于在选中的节点上 && 不遮住当前鼠标位置 top: info.clientY + 10
top: info.clientY + 10 // + 10 是为了让鼠标不至于在选中的节点上 && 不遮住当前鼠标位置 }));
});
}; };
/** /**
...@@ -204,28 +222,6 @@ const MiddleContainer = (props: any) => { ...@@ -204,28 +222,6 @@ const MiddleContainer = (props: any) => {
} }
}; };
/**
* 右键菜单
*/
const renderRightClickMenu = () => {
return (
<Dropdown
arrow
trigger={['contextMenu']}
overlayStyle={{ ...contextMenuPosition }}
menu={{
items: STUDIO_TAG_RIGHT_CONTEXT_MENU,
onClick: handleMenuClick
}}
open={contextMenuVisible}
onOpenChange={setContextMenuVisible}
>
{/*占位*/}
<div style={{ ...contextMenuPosition }} />
</Dropdown>
);
};
/** /**
* render tabs * render tabs
*/ */
...@@ -365,7 +361,13 @@ const MiddleContainer = (props: any) => { ...@@ -365,7 +361,13 @@ const MiddleContainer = (props: any) => {
onEdit={closeTab} onEdit={closeTab}
items={tabItems} items={tabItems}
/> />
{renderRightClickMenu()} <RightContextMenu
onClick={handleMenuClick}
items={STUDIO_TAG_RIGHT_CONTEXT_MENU}
contextMenuPosition={contextMenuPosition}
open={contextMenuVisible}
openChange={() => setContextMenuVisible(false)}
/>
</ConfigProvider> </ConfigProvider>
); );
}; };
......
...@@ -118,7 +118,7 @@ export const buildClusterConfigOptions = (current: any, clusterConfiguration: Cl ...@@ -118,7 +118,7 @@ export const buildClusterConfigOptions = (current: any, clusterConfiguration: Cl
/** /**
* build env options * build env options
*/ */
export const buildEnvOptions = (env: any[], isDisabled: boolean) => { export const buildEnvOptions = (env: any[]) => {
const envList: DefaultOptionType[] = [ const envList: DefaultOptionType[] = [
{ {
label: l('button.disable'), label: l('button.disable'),
...@@ -140,7 +140,7 @@ export const buildEnvOptions = (env: any[], isDisabled: boolean) => { ...@@ -140,7 +140,7 @@ export const buildEnvOptions = (env: any[], isDisabled: boolean) => {
label: tag, label: tag,
value: item.id, value: item.id,
key: item.id, key: item.id,
disabled: !item.enabled || !isDisabled disabled: !item.enabled
}); });
} }
return envList; return envList;
...@@ -179,7 +179,7 @@ export const buildAlertGroupOptions = (alertGroups: Alert.AlertGroup[]) => { ...@@ -179,7 +179,7 @@ export const buildAlertGroupOptions = (alertGroups: Alert.AlertGroup[]) => {
/** /**
* 计算右侧 proform list 组件宽度 * 计算右侧 proform list 组件宽度
* @returns {number} * @param width
*/ */
export const calculatorWidth = (width: number) => { export const calculatorWidth = (width: number) => {
const resultWidth = width - 50; // 50 为右侧 proform list 组件的 删除按钮宽度 const resultWidth = width - 50; // 50 为右侧 proform list 组件的 删除按钮宽度
......
...@@ -210,17 +210,19 @@ const JobConfig = (props: any) => { ...@@ -210,17 +210,19 @@ const JobConfig = (props: any) => {
/> />
)} )}
<ProFormSelect {current?.dialect?.toLowerCase() === DIALECT.FLINK_SQL && (
name='envId' <ProFormSelect
label={l('pages.datastudio.label.jobConfig.flinksql.env')} name='envId'
tooltip={l('pages.datastudio.label.jobConfig.flinksql.env.tip1')} label={l('pages.datastudio.label.jobConfig.flinksql.env')}
options={buildEnvOptions(env, current?.dialect?.toLowerCase() === DIALECT.FLINK_SQL)} tooltip={l('pages.datastudio.label.jobConfig.flinksql.env.tip1')}
rules={[ options={buildEnvOptions(env)}
{ required: true, message: l('pages.datastudio.label.jobConfig.flinksql.env.tip1') } rules={[
]} { required: true, message: l('pages.datastudio.label.jobConfig.flinksql.env.tip1') }
showSearch ]}
allowClear={false} showSearch
/> allowClear={false}
/>
)}
<ProFormGroup> <ProFormGroup>
<ProFormDigit <ProFormDigit
......
...@@ -18,24 +18,18 @@ ...@@ -18,24 +18,18 @@
*/ */
import { getCurrentData } from '@/pages/DataStudio/function'; import { getCurrentData } from '@/pages/DataStudio/function';
import { StateType, TaskDataType } from '@/pages/DataStudio/model'; import { StateType } from '@/pages/DataStudio/model';
import { l } from '@/utils/intl'; import { l } from '@/utils/intl';
import { connect } from '@umijs/max';
import { Descriptions } from 'antd'; import { Descriptions } from 'antd';
import Paragraph from 'antd/es/typography/Paragraph'; import Paragraph from 'antd/es/typography/Paragraph';
import { useEffect, useState } from 'react';
import { connect } from 'umi';
const JobInfo = (props: any) => { const JobInfo = (props: any) => {
const { const {
tabs: { panes, activeKey, activeBreadcrumbTitle } tabs: { panes, activeKey }
} = props; } = props;
const [currentInfo, setCurrentInfo] = useState<Partial<TaskDataType>>(
getCurrentData(panes, activeKey) ?? {}
);
useEffect(() => { const currentInfo = getCurrentData(panes, activeKey);
setCurrentInfo({ ...getCurrentData(panes, activeKey) });
}, [activeKey, activeBreadcrumbTitle]);
return ( return (
<div style={{ paddingInline: 8 }}> <div style={{ paddingInline: 8 }}>
...@@ -52,13 +46,6 @@ const JobInfo = (props: any) => { ...@@ -52,13 +46,6 @@ const JobInfo = (props: any) => {
<Descriptions.Item label={l('pages.datastudio.label.jobInfo.versionId')}> <Descriptions.Item label={l('pages.datastudio.label.jobInfo.versionId')}>
{currentInfo?.versionId} {currentInfo?.versionId}
</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item label={l('global.table.createTime')}>
{currentInfo?.createTime}
</Descriptions.Item>
<Descriptions.Item label={l('global.table.updateTime')}>
{currentInfo?.updateTime}
</Descriptions.Item>
<Descriptions.Item label={l('global.table.note')}>{currentInfo?.note}</Descriptions.Item> <Descriptions.Item label={l('global.table.note')}>{currentInfo?.note}</Descriptions.Item>
</Descriptions> </Descriptions>
</div> </div>
......
...@@ -31,3 +31,26 @@ export type StudioParam = { ...@@ -31,3 +31,26 @@ export type StudioParam = {
checkPoint?: number; checkPoint?: number;
savePointPath?: string; savePointPath?: string;
}; };
export enum LeftMenuKey {
PROJECT_KEY = 'menu.datastudio.project',
CATALOG_KEY = 'menu.datastudio.catalog',
DATASOURCE_KEY = 'menu.datastudio.datasource',
FRAGMENT_KEY = 'menu.registration.fragment'
}
export enum RightMenuKey {
JOB_CONFIG_KEY = 'menu.datastudio.jobConfig',
PREVIEW_CONFIG_KEY = 'menu.datastudio.previewConfig',
SAVEPOINT_KEY = 'menu.datastudio.savePoint',
HISTORY_VISION_KEY = 'menu.datastudio.historyVision',
JOB_INFO_KEY = 'menu.datastudio.jobInfo'
}
export enum LeftBottomKey {
CONSOLE_KEY = 'menu.datastudio.console',
RESULT_KEY = 'menu.datastudio.result',
LINEAGE_KEY = 'menu.datastudio.lineage',
HISTORY_KEY = 'menu.datastudio.history',
TABLE_DATA_KEY = 'menu.datastudio.table-data',
TOOLS_KEY = 'menu.datastudio.tool'
}
...@@ -29,6 +29,7 @@ import { ...@@ -29,6 +29,7 @@ import {
TaskDataType TaskDataType
} from '@/pages/DataStudio/model'; } from '@/pages/DataStudio/model';
import { CONFIG_MODEL_ASYNC } from '@/pages/SettingCenter/GlobalSetting/model'; import { CONFIG_MODEL_ASYNC } from '@/pages/SettingCenter/GlobalSetting/model';
import { DIALECT } from '@/services/constants';
import { Cluster, DataSources } from '@/types/RegCenter/data'; import { Cluster, DataSources } from '@/types/RegCenter/data';
import { Dispatch } from '@@/plugin-dva/types'; import { Dispatch } from '@@/plugin-dva/types';
...@@ -162,6 +163,15 @@ export function isProjectTabs(panes: TabsItemType[], activeKey: string): boolean ...@@ -162,6 +163,15 @@ export function isProjectTabs(panes: TabsItemType[], activeKey: string): boolean
} }
} }
export function isShowRightTabsJobConfig(dialect: string): boolean {
return (
dialect.toLowerCase() === DIALECT.JAVA ||
dialect.toLowerCase() === DIALECT.PYTHON_LONG ||
dialect.toLowerCase() === DIALECT.SCALA ||
dialect.toLowerCase() === DIALECT.FLINKSQLENV
);
}
export function getTabByTaskId( export function getTabByTaskId(
panes: TabsItemType[], panes: TabsItemType[],
id: number id: number
......
...@@ -21,6 +21,7 @@ import { AuthorizedObject, useAccess } from '@/hooks/useAccess'; ...@@ -21,6 +21,7 @@ import { AuthorizedObject, useAccess } from '@/hooks/useAccess';
import { useEditor } from '@/hooks/useEditor'; import { useEditor } from '@/hooks/useEditor';
import useThemeValue from '@/hooks/useThemeValue'; import useThemeValue from '@/hooks/useThemeValue';
import BottomContainer from '@/pages/DataStudio/BottomContainer'; import BottomContainer from '@/pages/DataStudio/BottomContainer';
import { LeftMenuKey } from '@/pages/DataStudio/data.d';
import FooterContainer from '@/pages/DataStudio/FooterContainer'; import FooterContainer from '@/pages/DataStudio/FooterContainer';
import { isProjectTabs, mapDispatchToProps } from '@/pages/DataStudio/function'; import { isProjectTabs, mapDispatchToProps } from '@/pages/DataStudio/function';
import SecondHeaderContainer from '@/pages/DataStudio/HeaderContainer'; import SecondHeaderContainer from '@/pages/DataStudio/HeaderContainer';
...@@ -28,7 +29,13 @@ import LeftContainer from '@/pages/DataStudio/LeftContainer'; ...@@ -28,7 +29,13 @@ import LeftContainer from '@/pages/DataStudio/LeftContainer';
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';
import MiddleContainer from '@/pages/DataStudio/MiddleContainer'; import MiddleContainer from '@/pages/DataStudio/MiddleContainer';
import { StateType, TabsItemType, TabsPageType, VIEW } from '@/pages/DataStudio/model'; import {
StateType,
TabsItemType,
TabsPageSubType,
TabsPageType,
VIEW
} from '@/pages/DataStudio/model';
import RightContainer from '@/pages/DataStudio/RightContainer'; import RightContainer from '@/pages/DataStudio/RightContainer';
import { import {
getClusterConfigurationData, getClusterConfigurationData,
...@@ -140,14 +147,33 @@ const DataStudio = (props: any) => { ...@@ -140,14 +147,33 @@ const DataStudio = (props: any) => {
const LeftTopMenu = ( const LeftTopMenu = (
<Menu <Menu
mode='inline' mode='inline'
activeKey={leftContainer.selectKey}
selectedKeys={[leftContainer.selectKey]} selectedKeys={[leftContainer.selectKey]}
items={LeftSide.filter((x) => AuthorizedObject({ path: x.auth, children: x, access })).map( items={LeftSide.filter((tab) => AuthorizedObject({ path: tab.auth, children: tab, access }))
(x) => ({ .filter((tab) => {
if (!tab.isShow) {
return true;
}
if (parseInt(activeKey) < 0) {
return TabsPageType.None;
}
const currentTab = (panes as TabsItemType[]).find((item) => item.key === activeKey);
const show = tab.isShow(
currentTab?.type ?? TabsPageType.None,
currentTab?.subType ?? TabsPageSubType.None
);
// 如果当前打开的菜单等于 状态存的菜单 且 菜单不显示状态下,先切换到项目key(因为项目key 不可能不显示) 在关闭这个
// if current open menu equal status menu and menu is not show status, first switch to project key(because project key is not show) and close this
if (tab.key === leftContainer.selectKey && !show && panes.length > 0) {
updateSelectLeftKey(LeftMenuKey.PROJECT_KEY);
}
return show;
})
.map((x) => ({
key: x.key, key: x.key,
label: x.label, label: x.label,
icon: x.icon icon: x.icon
}) }))}
)}
style={{ style={{
flexGrow: 1, flexGrow: 1,
borderBlockStart: `1px solid ${themeValue.borderColor}`, borderBlockStart: `1px solid ${themeValue.borderColor}`,
...@@ -161,13 +187,23 @@ const DataStudio = (props: any) => { ...@@ -161,13 +187,23 @@ const DataStudio = (props: any) => {
<Menu <Menu
mode='inline' mode='inline'
selectedKeys={[bottomContainer.selectKey]} selectedKeys={[bottomContainer.selectKey]}
items={LeftBottomSide.filter((x) => activeKey={bottomContainer.selectKey}
AuthorizedObject({ path: x.auth, children: x, access }) items={LeftBottomSide.filter((x) => AuthorizedObject({ path: x.auth, children: x, access }))
).map((x) => ({ .filter((tab) => {
key: x.key, if (!tab.isShow) {
label: x.label, return true;
icon: x.icon }
}))} if (parseInt(activeKey) < 0) {
return TabsPageType.None;
}
const currentTab = (panes as TabsItemType[]).find((item) => item.key === activeKey);
return tab.isShow(currentTab?.type ?? TabsPageType.None, currentTab?.subType);
})
.map((x) => ({
key: x.key,
label: x.label,
icon: x.icon
}))}
style={{ style={{
display: 'flex', display: 'flex',
flexDirection: 'column', flexDirection: 'column',
...@@ -196,16 +232,17 @@ const DataStudio = (props: any) => { ...@@ -196,16 +232,17 @@ const DataStudio = (props: any) => {
borderInlineStart: `1px solid ${themeValue.borderColor}`, borderInlineStart: `1px solid ${themeValue.borderColor}`,
borderBlockStart: `1px solid ${themeValue.borderColor}` borderBlockStart: `1px solid ${themeValue.borderColor}`
}} }}
items={RightSide.filter((x) => AuthorizedObject({ path: x.auth, children: x, access })) activeKey={rightContainer.selectKey}
.filter((x) => { items={RightSide.filter((tab) => AuthorizedObject({ path: tab.auth, children: tab, access }))
if (!x.isShow) { .filter((tab) => {
if (!tab.isShow) {
return true; return true;
} }
if (parseInt(activeKey) < 0) { if (parseInt(activeKey) < 0) {
return TabsPageType.None; return TabsPageType.None;
} }
const v = (panes as TabsItemType[]).find((item) => item.key === activeKey); const currentTab = (panes as TabsItemType[]).find((item) => item.key === activeKey);
return x.isShow(v?.type ?? TabsPageType.None, v?.subType); return tab.isShow(currentTab?.type ?? TabsPageType.None, currentTab?.subType);
}) })
.map((x) => { .map((x) => {
return { key: x.key, label: x.label, icon: x.icon }; return { key: x.key, label: x.label, icon: x.icon };
......
...@@ -147,7 +147,8 @@ export enum TabsPageType { ...@@ -147,7 +147,8 @@ export enum TabsPageType {
export enum TabsPageSubType { export enum TabsPageSubType {
flinkSql = 'FlinkSql', flinkSql = 'FlinkSql',
flinkJar = 'FlinkJar' flinkJar = 'FlinkJar',
None = ''
} }
export interface TabsItemType { export interface TabsItemType {
......
...@@ -25,6 +25,7 @@ import Result from '@/pages/DataStudio/BottomContainer/Result'; ...@@ -25,6 +25,7 @@ import Result from '@/pages/DataStudio/BottomContainer/Result';
import TableData from '@/pages/DataStudio/BottomContainer/TableData'; import TableData from '@/pages/DataStudio/BottomContainer/TableData';
import JsonToSql from '@/pages/DataStudio/BottomContainer/Tools/JsonToSql'; import JsonToSql from '@/pages/DataStudio/BottomContainer/Tools/JsonToSql';
import TextComparison from '@/pages/DataStudio/BottomContainer/Tools/TextComparison'; import TextComparison from '@/pages/DataStudio/BottomContainer/Tools/TextComparison';
import { LeftBottomKey, LeftMenuKey, RightMenuKey } from '@/pages/DataStudio/data.d';
import { isSql } from '@/pages/DataStudio/HeaderContainer/service'; import { isSql } from '@/pages/DataStudio/HeaderContainer/service';
import Catalog from '@/pages/DataStudio/LeftContainer/Catalog'; import Catalog from '@/pages/DataStudio/LeftContainer/Catalog';
import DataSource from '@/pages/DataStudio/LeftContainer/DataSource'; import DataSource from '@/pages/DataStudio/LeftContainer/DataSource';
...@@ -36,6 +37,7 @@ import JobConfig from '@/pages/DataStudio/RightContainer/JobConfig'; ...@@ -36,6 +37,7 @@ import JobConfig from '@/pages/DataStudio/RightContainer/JobConfig';
import JobInfo from '@/pages/DataStudio/RightContainer/JobInfo'; import JobInfo from '@/pages/DataStudio/RightContainer/JobInfo';
import PreViewConfig from '@/pages/DataStudio/RightContainer/PreViewConfig'; import PreViewConfig from '@/pages/DataStudio/RightContainer/PreViewConfig';
import SavePoints from '@/pages/DataStudio/RightContainer/SavePoints'; import SavePoints from '@/pages/DataStudio/RightContainer/SavePoints';
import { DIALECT } from '@/services/constants';
import { l } from '@/utils/intl'; import { l } from '@/utils/intl';
import { import {
ApartmentOutlined, ApartmentOutlined,
...@@ -61,43 +63,57 @@ import { ...@@ -61,43 +63,57 @@ import {
} from '@ant-design/icons'; } from '@ant-design/icons';
import { ReactNode } from 'react'; import { ReactNode } from 'react';
export const LeftSide = [ export const LeftSide: TabProp[] = [
{ {
auth: '/datastudio/left/project', auth: '/datastudio/left/project',
key: 'menu.datastudio.project', key: LeftMenuKey.PROJECT_KEY,
icon: <ConsoleSqlOutlined />, icon: <ConsoleSqlOutlined />,
label: l('menu.datastudio.project'), label: l(LeftMenuKey.PROJECT_KEY),
children: <Project /> children: <Project />
}, },
{ {
auth: '/datastudio/left/catalog', auth: '/datastudio/left/catalog',
key: 'menu.datastudio.catalog', key: LeftMenuKey.CATALOG_KEY,
icon: <TableOutlined />, icon: <TableOutlined />,
label: l('menu.datastudio.catalog'), label: l(LeftMenuKey.CATALOG_KEY),
children: <Catalog /> children: <Catalog />,
isShow: (type, subType) =>
(type === TabsPageType.project || type === TabsPageType.metadata) &&
subType?.toLowerCase() !== DIALECT.FLINKJAR &&
subType?.toLowerCase() !== DIALECT.FLINKSQLENV &&
subType?.toLowerCase() !== DIALECT.SCALA &&
subType?.toLowerCase() !== DIALECT.PYTHON_LONG &&
subType?.toLowerCase() !== DIALECT.JAVA &&
subType?.toLowerCase() !== DIALECT.FLINKSQLENV
}, },
{ {
auth: '/datastudio/left/datasource', auth: '/datastudio/left/datasource',
key: 'menu.datastudio.datasource', key: LeftMenuKey.DATASOURCE_KEY,
icon: <DatabaseOutlined />, icon: <DatabaseOutlined />,
label: l('menu.datastudio.datasource'), label: l(LeftMenuKey.DATASOURCE_KEY),
children: <DataSource /> children: <DataSource />
}, },
{ {
auth: '/datastudio/left/globalVariable', auth: '/datastudio/left/globalVariable',
key: 'menu.registration.fragment', key: LeftMenuKey.FRAGMENT_KEY,
icon: <FunctionOutlined />, icon: <FunctionOutlined />,
label: l('menu.registration.fragment'), label: l(LeftMenuKey.FRAGMENT_KEY),
children: <GlobalVariable /> children: <GlobalVariable />,
isShow: (type, subType) =>
type === TabsPageType.project &&
!isSql(subType ?? '') &&
subType?.toLowerCase() !== DIALECT.SCALA &&
subType?.toLowerCase() !== DIALECT.PYTHON_LONG &&
subType?.toLowerCase() !== DIALECT.JAVA
} }
]; ];
export const RightSide: TabProp[] = [ export const RightSide: TabProp[] = [
{ {
auth: '/datastudio/right/jobConfig', auth: '/datastudio/right/jobConfig',
key: 'menu.datastudio.jobConfig', key: RightMenuKey.JOB_CONFIG_KEY,
icon: <SettingOutlined />, icon: <SettingOutlined />,
label: l('menu.datastudio.jobConfig'), label: l(RightMenuKey.JOB_CONFIG_KEY),
children: <JobConfig />, children: <JobConfig />,
isShow: (type, subType) => isShow: (type, subType) =>
type === TabsPageType.project && type === TabsPageType.project &&
...@@ -105,9 +121,9 @@ export const RightSide: TabProp[] = [ ...@@ -105,9 +121,9 @@ export const RightSide: TabProp[] = [
}, },
{ {
auth: '/datastudio/right/previewConfig', auth: '/datastudio/right/previewConfig',
key: 'menu.datastudio.previewConfig', key: RightMenuKey.PREVIEW_CONFIG_KEY,
icon: <InsertRowRightOutlined />, icon: <InsertRowRightOutlined />,
label: l('menu.datastudio.previewConfig'), label: l(RightMenuKey.PREVIEW_CONFIG_KEY),
children: <PreViewConfig />, children: <PreViewConfig />,
isShow: (type, subType) => isShow: (type, subType) =>
(type === TabsPageType.project && TabsPageSubType.flinkSql === subType) || (type === TabsPageType.project && TabsPageSubType.flinkSql === subType) ||
...@@ -115,71 +131,102 @@ export const RightSide: TabProp[] = [ ...@@ -115,71 +131,102 @@ export const RightSide: TabProp[] = [
}, },
{ {
auth: '/datastudio/right/savePoint', auth: '/datastudio/right/savePoint',
key: 'menu.datastudio.savePoint', key: RightMenuKey.SAVEPOINT_KEY,
icon: <FolderOutlined />, icon: <FolderOutlined />,
label: l('menu.datastudio.savePoint'), label: l(RightMenuKey.SAVEPOINT_KEY),
children: <SavePoints />, children: <SavePoints />,
isShow: (type, subType) => type === TabsPageType.project && TabsPageSubType.flinkSql === subType isShow: (type, subType) => type === TabsPageType.project && TabsPageSubType.flinkSql === subType
}, },
{ {
auth: '/datastudio/right/historyVision', auth: '/datastudio/right/historyVision',
key: 'menu.datastudio.historyVision', key: RightMenuKey.HISTORY_VISION_KEY,
icon: <HistoryOutlined />, icon: <HistoryOutlined />,
label: l('menu.datastudio.historyVision'), label: l(RightMenuKey.HISTORY_VISION_KEY),
children: <HistoryVersion />, children: <HistoryVersion />,
isShow: (type, subType) => type === TabsPageType.project && TabsPageSubType.flinkSql === subType isShow: (type, subType) => type === TabsPageType.project && TabsPageSubType.flinkSql === subType
}, },
{ {
auth: '/datastudio/right/jobInfo', auth: '/datastudio/right/jobInfo',
key: 'menu.datastudio.jobInfo', key: RightMenuKey.JOB_INFO_KEY,
icon: <InfoCircleOutlined />, icon: <InfoCircleOutlined />,
label: l('menu.datastudio.jobInfo'), label: l(RightMenuKey.JOB_INFO_KEY),
children: <JobInfo />, children: <JobInfo />,
isShow: (type) => type === TabsPageType.project isShow: (type) => type === TabsPageType.project
} }
]; ];
export const LeftBottomSide = [ export const LeftBottomSide: TabProp[] = [
{ {
auth: '/datastudio/bottom/console', auth: '/datastudio/bottom/console',
key: 'menu.datastudio.console', key: LeftBottomKey.CONSOLE_KEY,
icon: <RightSquareOutlined />, icon: <RightSquareOutlined />,
label: l('menu.datastudio.console'), label: l(LeftBottomKey.CONSOLE_KEY),
children: <Console /> children: <Console />,
isShow: (type, subType) =>
type === TabsPageType.project &&
subType?.toLowerCase() !== DIALECT.FLINKSQLENV &&
subType?.toLowerCase() !== DIALECT.SCALA &&
subType?.toLowerCase() !== DIALECT.PYTHON_LONG &&
subType?.toLowerCase() !== DIALECT.JAVA
}, },
{ {
auth: '/datastudio/bottom/result', auth: '/datastudio/bottom/result',
key: 'menu.datastudio.result', key: LeftBottomKey.RESULT_KEY,
icon: <MonitorOutlined />, icon: <MonitorOutlined />,
label: l('menu.datastudio.result'), label: l(LeftBottomKey.RESULT_KEY),
children: <Result /> children: <Result />,
isShow: (type, subType) =>
type === TabsPageType.project &&
subType?.toLowerCase() !== DIALECT.FLINKSQLENV &&
subType?.toLowerCase() !== DIALECT.FLINKJAR &&
subType?.toLowerCase() !== DIALECT.SCALA &&
subType?.toLowerCase() !== DIALECT.PYTHON_LONG &&
subType?.toLowerCase() !== DIALECT.JAVA
}, },
{ {
auth: '/datastudio/bottom/lineage', auth: '/datastudio/bottom/lineage',
key: 'menu.datastudio.lineage', key: LeftBottomKey.LINEAGE_KEY,
icon: <ApartmentOutlined />, icon: <ApartmentOutlined />,
label: l('menu.datastudio.lineage'), label: l(LeftBottomKey.LINEAGE_KEY),
children: <Lineage /> children: <Lineage />,
isShow: (type, subType) =>
type === TabsPageType.project &&
subType?.toLowerCase() !== DIALECT.FLINKSQLENV &&
subType?.toLowerCase() !== DIALECT.FLINKJAR &&
subType?.toLowerCase() !== DIALECT.SCALA &&
subType?.toLowerCase() !== DIALECT.PYTHON_LONG &&
subType?.toLowerCase() !== DIALECT.JAVA
}, },
{ {
auth: '/datastudio/bottom/history', auth: '/datastudio/bottom/history',
key: 'menu.datastudio.history', key: LeftBottomKey.HISTORY_KEY,
icon: <HistoryOutlined />, icon: <HistoryOutlined />,
label: l('menu.datastudio.history'), label: l(LeftBottomKey.HISTORY_KEY),
children: <JobExecHistory /> children: <JobExecHistory />,
isShow: (type, subType) =>
type === TabsPageType.project &&
!isSql(subType ?? '') &&
subType?.toLowerCase() !== DIALECT.FLINKSQLENV &&
subType?.toLowerCase() !== DIALECT.FLINKJAR &&
subType?.toLowerCase() !== DIALECT.SCALA &&
subType?.toLowerCase() !== DIALECT.PYTHON_LONG &&
subType?.toLowerCase() !== DIALECT.JAVA
}, },
{ {
auth: '/datastudio/bottom/table-data', auth: '/datastudio/bottom/table-data',
key: 'menu.datastudio.table-data', key: LeftBottomKey.TABLE_DATA_KEY,
icon: <TableOutlined />, icon: <TableOutlined />,
label: l('menu.datastudio.table-data'), label: l(LeftBottomKey.TABLE_DATA_KEY),
children: <TableData /> children: <TableData />,
isShow: (type, subType) =>
type === TabsPageType.project && subType?.toLowerCase() === DIALECT.FLINK_SQL
}, },
{ {
auth: '/datastudio/bottom/tool', auth: '/datastudio/bottom/tool',
key: 'menu.datastudio.tool', key: LeftBottomKey.TOOLS_KEY,
icon: <ToolOutlined />, icon: <ToolOutlined />,
label: l('menu.datastudio.tool') label: l(LeftBottomKey.TOOLS_KEY),
children: <></>
} }
]; ];
......
...@@ -142,6 +142,7 @@ const AlertHistoryList = (props: JobProps) => { ...@@ -142,6 +142,7 @@ const AlertHistoryList = (props: JobProps) => {
<> <>
<ProTable<AlertHistory> <ProTable<AlertHistory>
rowKey={'id'} rowKey={'id'}
style={{ height: 'calc(100vh - 240px)' }}
dataSource={alertHistory.alertHistory} dataSource={alertHistory.alertHistory}
loading={alertHistory.loading} loading={alertHistory.loading}
pagination={{ pagination={{
......
...@@ -28,7 +28,6 @@ export default (props: JobProps) => { ...@@ -28,7 +28,6 @@ export default (props: JobProps) => {
return ( return (
<SlowlyAppear> <SlowlyAppear>
<Card> <Card>
{' '}
<AlertHistoryList jobDetail={jobDetail} /> <AlertHistoryList jobDetail={jobDetail} />
</Card> </Card>
</SlowlyAppear> </SlowlyAppear>
......
...@@ -70,7 +70,7 @@ const CheckpointTable = (props: JobProps) => { ...@@ -70,7 +70,7 @@ const CheckpointTable = (props: JobProps) => {
onOk: async () => { onOk: async () => {
const param = { const param = {
id: jobDetail?.instance?.taskId, id: jobDetail?.instance?.taskId,
isOnLine: jobDetail?.instance?.step == JOB_LIFE_CYCLE.ONLINE, isOnLine: jobDetail?.instance?.step == JOB_LIFE_CYCLE.PUBLISH,
savePointPath: row.external_path savePointPath: row.external_path
}; };
const result = await getData(API_CONSTANTS.RESTART_TASK_FROM_CHECKPOINT, param); const result = await getData(API_CONSTANTS.RESTART_TASK_FROM_CHECKPOINT, param);
...@@ -176,7 +176,7 @@ const CheckpointTable = (props: JobProps) => { ...@@ -176,7 +176,7 @@ const CheckpointTable = (props: JobProps) => {
return ( return (
<ProTable<CheckPointsDetailInfo> <ProTable<CheckPointsDetailInfo>
columns={columns} columns={columns}
style={{ width: '100%' }} style={{ width: '100%', height: 'calc(100vh - 450px)' }}
dataSource={checkpoints?.history} dataSource={checkpoints?.history}
onDataSourceChange={() => actionRef.current?.reload()} onDataSourceChange={() => actionRef.current?.reload()}
actionRef={actionRef} actionRef={actionRef}
......
...@@ -70,7 +70,7 @@ const SavepointTable = (props: JobProps) => { ...@@ -70,7 +70,7 @@ const SavepointTable = (props: JobProps) => {
return ( return (
<ProTable<SavePoint> <ProTable<SavePoint>
columns={columns} columns={columns}
style={{ width: '100%' }} style={{ width: '100%', height: 'calc(100vh - 450px)' }}
request={(params, sorter, filter) => request={(params, sorter, filter) =>
queryList(API_CONSTANTS.GET_SAVEPOINTS, { queryList(API_CONSTANTS.GET_SAVEPOINTS, {
...params, ...params,
......
...@@ -84,7 +84,7 @@ const ExceptionTab = (props: JobProps) => { ...@@ -84,7 +84,7 @@ const ExceptionTab = (props: JobProps) => {
</Paragraph> </Paragraph>
<CodeShow <CodeShow
code={currentLog.stacktrace ? currentLog.stacktrace : 'No Exception'} code={currentLog.stacktrace ? currentLog.stacktrace : 'No Exception'}
height={parent.innerHeight - 300} height={'calc(100vh - 350px)'}
showFloatButton showFloatButton
/> />
</Card> </Card>
...@@ -93,11 +93,7 @@ const ExceptionTab = (props: JobProps) => { ...@@ -93,11 +93,7 @@ const ExceptionTab = (props: JobProps) => {
); );
}; };
return ( return <ProCard bodyStyle={{ height: '100%', overflow: 'auto' }}>{renderLogTab()}</ProCard>;
<ProCard bodyStyle={{ height: parent.innerHeight - 200, overflow: 'auto' }}>
{renderLogTab()}
</ProCard>
);
}; };
export default ExceptionTab; export default ExceptionTab;
...@@ -76,7 +76,7 @@ const JobManagerLogsTab = (props: JobProps) => { ...@@ -76,7 +76,7 @@ const JobManagerLogsTab = (props: JobProps) => {
showFloatButton showFloatButton
language={language} language={language}
code={buildDumpLog(ur) ?? 'No Log'} code={buildDumpLog(ur) ?? 'No Log'}
height={parent.innerHeight - 300} height={'calc(100vh - 250px)'}
/> />
</Spin> </Spin>
); );
......
...@@ -95,7 +95,7 @@ const TaskManagerLogsTab = (props: JobProps) => { ...@@ -95,7 +95,7 @@ const TaskManagerLogsTab = (props: JobProps) => {
showFloatButton showFloatButton
code={tmLog.data} code={tmLog.data}
language={'javalog'} language={'javalog'}
height={parent.innerHeight - 300} height={'calc(100vh - 340px)'}
/> />
</Spin> </Spin>
</Card> </Card>
......
...@@ -98,7 +98,7 @@ const JobChart = (props: JobChartProps) => { ...@@ -98,7 +98,7 @@ const JobChart = (props: JobChartProps) => {
); );
}); });
} }
return <Empty />; return <Empty className={'code-content-empty'} />;
}; };
return ( return (
<Spin spinning={loading} delay={500}> <Spin spinning={loading} delay={500}>
......
...@@ -107,7 +107,7 @@ const JobList = () => { ...@@ -107,7 +107,7 @@ const JobList = () => {
}, []); }, []);
return ( return (
<ProCard boxShadow={true} style={{ height: '73vh' }}> <ProCard boxShadow={true} style={{ height: 'calc(100vh - 250px)' }}>
<ProTable<Jobs.JobInstance> <ProTable<Jobs.JobInstance>
{...PROTABLE_OPTIONS_PUBLIC} {...PROTABLE_OPTIONS_PUBLIC}
search={false} search={false}
......
...@@ -24,63 +24,53 @@ import TaskDialectRadar from '@/pages/Home/DevOverView/TaskDialectRadar'; ...@@ -24,63 +24,53 @@ import TaskDialectRadar from '@/pages/Home/DevOverView/TaskDialectRadar';
import { l } from '@/utils/intl'; import { l } from '@/utils/intl';
import { ProCard } from '@ant-design/pro-components'; import { ProCard } from '@ant-design/pro-components';
import { Badge } from 'antd'; import { Badge } from 'antd';
import RcResizeObserver from 'rc-resize-observer'; import React from 'react';
import React, { useState } from 'react';
const noPadding = { const noPadding = {
paddingInline: '0', paddingInline: '0',
paddingBlock: '0', paddingBlock: '0',
height: parent.innerHeight / 2 height: '100%'
}; };
const DevOverView: React.FC = () => { const DevOverView: React.FC = () => {
const [split, setSplit] = useState<'vertical' | 'horizontal' | undefined>('vertical');
return ( return (
<RcResizeObserver <ProCard
key='resize-observer' style={{ height: '100%' }}
onResize={(offset) => { title={
setSplit(offset.width < 596 ? 'horizontal' : 'vertical'); <>
}} <Badge status='processing' />
{l('home.develop')}
</>
}
headerBordered
bordered
size='small'
split={'vertical'}
bodyStyle={noPadding}
> >
<ProCard <ProCard split='vertical' bodyStyle={noPadding} style={{ height: '100%' }}>
style={{ height: '100%' }} <ProCard
title={ title={l('home.job.development')}
<> split='horizontal'
<Badge status='processing' /> colSpan={'40%'}
{l('home.develop')} bodyStyle={noPadding}
</> >
} <ProCard>
headerBordered <BatchStreamProportion />
bordered
size='small'
split={split}
bodyStyle={noPadding}
>
<ProCard split='vertical' bodyStyle={noPadding} style={{ height: '100%' }}>
<ProCard
title={l('home.job.development')}
split='horizontal'
colSpan={'40%'}
bodyStyle={noPadding}
>
<ProCard>
<BatchStreamProportion />
</ProCard>
<ProCard>
<DevHeatmap />
</ProCard>
</ProCard>
<ProCard title={l('home.job.onlineRate')} colSpan={'30%'} bodyStyle={noPadding}>
<TaskDialectRadar />
</ProCard> </ProCard>
<ProCard title={l('home.develop.re')} bodyStyle={noPadding}> <ProCard>
<ResourceView /> <DevHeatmap />
</ProCard> </ProCard>
</ProCard> </ProCard>
<ProCard title={l('home.job.onlineRate')} colSpan={'30%'} bodyStyle={noPadding}>
<TaskDialectRadar />
</ProCard>
<ProCard title={l('home.develop.re')} bodyStyle={noPadding}>
<ResourceView />
</ProCard>
</ProCard> </ProCard>
</RcResizeObserver> </ProCard>
); );
}; };
......
...@@ -25,20 +25,16 @@ import { Col, Row } from 'antd'; ...@@ -25,20 +25,16 @@ import { Col, Row } from 'antd';
export default () => { export default () => {
return ( return (
<PageContainer title={false} style={{ height: parent.innerHeight - 300 }}> <PageContainer title={false} style={{ height: 'calc(100% - 300px)' }}>
<Authorized path='/home/jobOverView'> <Authorized path='/home/jobOverView'>
<Row <Row style={{ marginTop: '5px', marginBottom: '10px', height: 'calc(100% - 50%)' }}>
style={{ marginTop: '5px', marginBottom: '10px', height: (parent.innerHeight - 300) / 2 }}
>
<Col span={24}> <Col span={24}>
<JobOverView /> <JobOverView />
</Col> </Col>
</Row> </Row>
</Authorized> </Authorized>
<Authorized path='/home/devOverView'> <Authorized path='/home/devOverView'>
<Row <Row style={{ marginTop: '5px', marginBottom: '10px', height: 'calc(100% - 50%)' }}>
style={{ marginTop: '5px', marginBottom: '10px', height: (parent.innerHeight - 300) / 2 }}
>
<Col span={24}> <Col span={24}>
<DevOverView /> <DevOverView />
</Col> </Col>
......
...@@ -240,7 +240,7 @@ const Job = () => { ...@@ -240,7 +240,7 @@ const Job = () => {
} }
extra={ extra={
<Button <Button
size='small' size='middle'
onClick={() => { onClick={() => {
const saveThisLayout = () => { const saveThisLayout = () => {
const metricsLayouts: MetricsLayout[] = jobMetricsList.map((job, index) => { const metricsLayouts: MetricsLayout[] = jobMetricsList.map((job, index) => {
......
...@@ -193,10 +193,14 @@ export default () => { ...@@ -193,10 +193,14 @@ export default () => {
<Server chartConfig={commonChartConfig} data={jvmData} /> <Server chartConfig={commonChartConfig} data={jvmData} />
</ProCard> </ProCard>
)} )}
<Job />
{layoutData != undefined && {layoutData != undefined &&
Object.keys(layoutData).map((name) => { Object.keys(layoutData).map((name, index) => {
return ( return (
<ProCard <ProCard
key={index}
collapsible collapsible
title={name} title={name}
ghost ghost
...@@ -210,6 +214,7 @@ export default () => { ...@@ -210,6 +214,7 @@ export default () => {
// return <></> // return <></>
return ( return (
<FlinkChart <FlinkChart
key={j.taskId + j.vertices + j.metrics}
chartSize={j.showSize} chartSize={j.showSize}
chartType={j.showType} chartType={j.showType}
onChangeJobState={(chartSize, chartType) => { onChangeJobState={(chartSize, chartType) => {
...@@ -226,7 +231,6 @@ export default () => { ...@@ -226,7 +231,6 @@ export default () => {
</ProCard> </ProCard>
); );
})} })}
<Job />
</PageContainer> </PageContainer>
); );
}; };
...@@ -167,7 +167,6 @@ const ResourceOverView: React.FC = () => { ...@@ -167,7 +167,6 @@ const ResourceOverView: React.FC = () => {
const handleRightClick = (info: any) => { const handleRightClick = (info: any) => {
// 获取右键点击的节点信息 // 获取右键点击的节点信息
const { node, event } = info; const { node, event } = info;
console.log('node', node);
setResourceState((prevState) => ({ setResourceState((prevState) => ({
...prevState, ...prevState,
selectedKeys: [node.key], selectedKeys: [node.key],
......
...@@ -65,7 +65,6 @@ export const ResourcesConfig = ({ data, onSave }: ResourcesConfigProps) => { ...@@ -65,7 +65,6 @@ export const ResourcesConfig = ({ data, onSave }: ResourcesConfigProps) => {
if (currentModel) { if (currentModel) {
setModel(currentModel); setModel(currentModel);
} }
console.log('data', data, 'filterData', currentModel, 'currentModel');
}, [data]); }, [data]);
const modelKey: string = 'sys.resource.settings.base.model'; const modelKey: string = 'sys.resource.settings.base.model';
......
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