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