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

fix resource & log list bug (#2396)

* Spotless Apply * fix resource && log bug --------- Co-authored-by: 's avatarzhu-mingye <zhu-mingye@users.noreply.github.com>
parent 7ebe8556
...@@ -41,7 +41,7 @@ import lombok.ToString; ...@@ -41,7 +41,7 @@ import lombok.ToString;
public class TreeNodeDTO { public class TreeNodeDTO {
@ApiModelProperty(value = "ID", dataType = "Integer", example = "1", notes = "The ID of the tree node") @ApiModelProperty(value = "ID", dataType = "Integer", example = "1", notes = "The ID of the tree node")
private Integer id; private Object id;
@ApiModelProperty(value = "Name", dataType = "String", example = "Node 1", notes = "The name of the tree node") @ApiModelProperty(value = "Name", dataType = "String", example = "Node 1", notes = "The name of the tree node")
private String name; private String name;
...@@ -61,7 +61,7 @@ public class TreeNodeDTO { ...@@ -61,7 +61,7 @@ public class TreeNodeDTO {
dataType = "Integer", dataType = "Integer",
example = "0", example = "0",
notes = "The ID of the parent tree node (0 for root)") notes = "The ID of the parent tree node (0 for root)")
private Integer parentId; private Object parentId;
@ApiModelProperty(value = "Size", dataType = "Long", example = "1024", notes = "The size of the tree node") @ApiModelProperty(value = "Size", dataType = "Long", example = "1024", notes = "The size of the tree node")
private Long size; private Long size;
...@@ -101,4 +101,14 @@ public class TreeNodeDTO { ...@@ -101,4 +101,14 @@ public class TreeNodeDTO {
this.children = children; this.children = children;
this.isLeaf = (children == null || children.size() == 0); this.isLeaf = (children == null || children.size() == 0);
} }
public TreeNodeDTO(String id, String name, String path, String parentId, String desc, List<TreeNodeDTO> children) {
this.id = id;
this.name = name;
this.path = path;
this.parentId = parentId;
this.desc = desc;
this.children = children;
this.isLeaf = (children == null || children.size() == 0);
}
} }
...@@ -1961,6 +1961,6 @@ INSERT INTO dinky_alert_template VALUES (1, 'Default', ' ...@@ -1961,6 +1961,6 @@ INSERT INTO dinky_alert_template VALUES (1, 'Default', '
- **Alert Time :** ${time} - **Alert Time :** ${time}
- **Start Time :** ${startTime} - **Start Time :** ${startTime}
- **End Time :** ${endTime} - **End Time :** ${endTime}
- **<font color=''red''>${exceptions.rootException.substring(0,20)}</font>** - **<font color=''red''>${(exceptions.rootException)?substring(0,20)}</font>**
[Go toTask Web](http://${taskUrl}) [Go toTask Web](http://${taskUrl})
', 1, null, null); ', 1, null, null);
import { queryDataByParams } from '@/services/BusinessCrud';
export function getConsoleData() { export function getConsoleData() {
// return queryDataByParams('api/process/getConsoleByUserId'); // return queryDataByParams('api/process/getConsoleByUserId');
} }
import {TagAlignLeft} from '@/components/StyledComponents'; import { TagAlignLeft } from '@/components/StyledComponents';
import {BtnRoute} from '@/pages/DataStudio/route'; import { BtnRoute } from '@/pages/DataStudio/route';
import SchemaTree from '@/pages/RegCenter/DataSource/components/DataSourceDetail/SchemaTree'; import SchemaTree from '@/pages/RegCenter/DataSource/components/DataSourceDetail/SchemaTree';
import {DataSources} from '@/types/RegCenter/data'; import DataSourceModal from '@/pages/RegCenter/DataSource/components/DataSourceModal';
import {l} from '@/utils/intl'; import { handleTest, saveOrUpdateHandle } from '@/pages/RegCenter/DataSource/service';
import {DatabaseOutlined, TableOutlined} from '@ant-design/icons'; import { DataSources } from '@/types/RegCenter/data';
import {Key, ProForm, ProFormSelect} from '@ant-design/pro-components'; import { l } from '@/utils/intl';
import {connect} from '@umijs/max'; import { DatabaseOutlined, TableOutlined } from '@ant-design/icons';
import {Spin, Tag} from 'antd'; import { Key, ProForm, ProFormSelect } from '@ant-design/pro-components';
import React, {useEffect, useState} from 'react'; import { connect } from '@umijs/max';
import {StateType, STUDIO_MODEL} from '../../model'; import { Spin, Tag } from 'antd';
import {clearMetaDataTable, getDataBase, showMetaDataTable} from './service'; import { useEffect, useState } from 'react';
import DataSourceModal from "@/pages/RegCenter/DataSource/components/DataSourceModal"; import { StateType, STUDIO_MODEL } from '../../model';
import {handleTest, saveOrUpdateHandle} from "@/pages/RegCenter/DataSource/service"; import { clearMetaDataTable, getDataBase, showMetaDataTable } from './service';
const MetaData = (props: any) => { const MetaData = (props: any) => {
const {
dispatch,
toolContentHeight,
database: { dbData, selectDatabaseId, expandKeys, selectKeys }
} = props;
const [treeData, setTreeData] = useState<[]>([]);
const [isLoadingDatabase, setIsLoadingDatabase] = useState(false);
const [showCreate, setShowCreate] = useState(false);
const selectDb = (dbData as DataSources.DataSource[]).filter((x) => x.id === selectDatabaseId)[0];
/**
* @description: 刷新树数据
* @param {number} databaseId
*/
const onRefreshTreeData = async (databaseId: number) => {
if (!databaseId) {
setIsLoadingDatabase(false);
return;
}
setIsLoadingDatabase(true);
const tables = (await showMetaDataTable(databaseId)) ?? [];
setIsLoadingDatabase(false);
for (let table of tables) {
table.title = table.name;
table.key = table.name;
table.icon = <DatabaseOutlined />;
table.children = table.tables;
for (let child of table.children) {
child.title = child.name;
child.key = table.name + '.' + child.name;
child.icon = <TableOutlined />;
child.isLeaf = true;
child.schema = table.name;
child.table = child.name;
}
}
setTreeData(tables);
};
useEffect(() => {
if (selectDatabaseId) {
onRefreshTreeData(selectDatabaseId);
}
}, []);
/**
* 数据库选择改变时间时 刷新树数据
* @param {number} value
*/
const onChangeDataBase = (value: number) => {
onRefreshTreeData(value);
};
BtnRoute['menu.datastudio.metadata'][0].onClick = () => {
setShowCreate(true);
};
BtnRoute['menu.datastudio.metadata'][1].onClick = () => {
if (!selectDatabaseId) return;
setIsLoadingDatabase(true);
clearMetaDataTable(selectDatabaseId).then(() => {
onChangeDataBase(selectDatabaseId);
});
};
/**
* 构建数据库列表 下拉框
*/
const getDataBaseOptions = () => {
return dbData.map(({ id, name, type, enabled, status }: DataSources.DataSource) => ({
key: id,
value: id,
label: (
<TagAlignLeft>
<Tag key={id} color={enabled ? 'processing' : 'error'}>
{type}
</Tag>
{name}
</TagAlignLeft>
),
disabled: !enabled || !status
}));
};
/**
* 树节点点击事件 添加tab页 并传递参数
* @param keys
* @param info
*/
const handleTreeNodeClick = async (keys: Key[], info: any) => {
// 选中的key
dispatch({
type: STUDIO_MODEL.updateDatabaseSelectKey,
payload: keys
});
const { const {
dispatch, node: { isLeaf, parentId: schemaName, name: tableName, fullInfo }
toolContentHeight, } = info;
database: {dbData, selectDatabaseId, expandKeys, selectKeys}
} = props; if (!isLeaf) {
const [treeData, setTreeData] = useState<[]>([]); return;
const [isLoadingDatabase, setIsLoadingDatabase] = useState(false); }
const [showCreate, setShowCreate] = useState(false);
const selectDb = (dbData as DataSources.DataSource[]).filter((x) => x.id === selectDatabaseId)[0]; const queryParams = { id: selectDatabaseId, schemaName, tableName };
dispatch({
/** type: STUDIO_MODEL.addTab,
* @description: 刷新树数据 payload: {
* @param {number} databaseId icon: selectDb.type,
*/ id: selectDatabaseId + schemaName + tableName,
const onRefreshTreeData = async (databaseId: number) => { breadcrumbLabel: [selectDb.type, selectDb.name].join('/'),
if (!databaseId) { label: schemaName + '.' + tableName,
setIsLoadingDatabase(false); params: { queryParams: queryParams, tableInfo: fullInfo },
return; type: 'metadata'
} }
});
setIsLoadingDatabase(true); };
const tables = (await showMetaDataTable(databaseId)) ?? [];
setIsLoadingDatabase(false); /**
* 数据库选择改变事件
for (let table of tables) { * @param {number} databaseId
table.title = table.name; */
table.key = table.name; const handleSelectDataBaseId = (databaseId: number) => {
table.icon = <DatabaseOutlined/>; dispatch({
table.children = table.tables; type: STUDIO_MODEL.updateSelectDatabaseId,
for (let child of table.children) { payload: databaseId
child.title = child.name; });
child.key = table.name + '.' + child.name; onChangeDataBase(databaseId);
child.icon = <TableOutlined/>; };
child.isLeaf = true;
child.schema = table.name; /**
child.table = child.name; * 树节点展开事件
} * @param {Key[]} expandedKeys
} */
setTreeData(tables); const handleTreeExpand = (expandedKeys: Key[]) => {
}; dispatch({
type: STUDIO_MODEL.updateDatabaseExpandKey,
useEffect(() => { payload: expandedKeys
if (selectDatabaseId) { });
onRefreshTreeData(selectDatabaseId); };
}
}, []); return (
<Spin spinning={isLoadingDatabase} delay={500}>
/** <DataSourceModal
* 数据库选择改变时间时 刷新树数据 values={{}}
* @param {number} value visible={showCreate}
*/ onCancel={() => setShowCreate(false)}
const onChangeDataBase = (value: number) => { onTest={(value) => handleTest(value)}
onRefreshTreeData(value); onSubmit={async (value) => {
}; await saveOrUpdateHandle(value);
const data = await getDataBase();
BtnRoute['menu.datastudio.metadata'][0].onClick = () => { dispatch({
setShowCreate(true) type: STUDIO_MODEL.saveDataBase,
}; payload: data
BtnRoute['menu.datastudio.metadata'][1].onClick = () => { });
if (!selectDatabaseId) return; }}
setIsLoadingDatabase(true); />
clearMetaDataTable(selectDatabaseId).then(() => { <ProForm
onChangeDataBase(selectDatabaseId); style={{ height: 40 }}
}); initialValues={{ selectDb: selectDatabaseId }}
}; submitter={false}
>
/** <ProFormSelect
* 构建数据库列表 下拉框 style={{ paddingInline: 6 }}
*/ // width={leftContainer.width }
const getDataBaseOptions = () => { width={'xl'}
return dbData.map(({id, name, type, enabled, status}: DataSources.DataSource) => ({ // addonAfter={<ReloadOutlined spin={isLoadingDatabase} title={l('button.refresh')} onClick={() => refreshDataBase()} />}
key: id, allowClear={false}
value: id, name={'selectDb'}
label: ( placeholder={l('pages.metadata.selectDatabase')}
<TagAlignLeft> options={getDataBaseOptions()}
<Tag key={id} color={enabled ? 'processing' : 'error'}> fieldProps={{
{type} onSelect: (selectId) => handleSelectDataBaseId(selectId as number)
</Tag> }}
{name} />
</TagAlignLeft> </ProForm>
), <SchemaTree
disabled: !enabled || !status selectKeys={selectKeys}
})); expandKeys={expandKeys}
}; style={{ height: toolContentHeight - 64 - 20 }}
onNodeClick={handleTreeNodeClick}
/** treeData={treeData}
* 树节点点击事件 添加tab页 并传递参数 onExpand={handleTreeExpand}
* @param keys />
* @param info </Spin>
*/ );
const handleTreeNodeClick = async (keys: Key[], info: any) => {
// 选中的key
dispatch({
type: STUDIO_MODEL.updateDatabaseSelectKey,
payload: keys
});
const {
node: {isLeaf, parentId: schemaName, name: tableName, fullInfo}
} = info;
if (!isLeaf) {
return;
}
const queryParams = {id: selectDatabaseId, schemaName, tableName};
dispatch({
type: STUDIO_MODEL.addTab,
payload: {
icon: selectDb.type,
id: selectDatabaseId + schemaName + tableName,
breadcrumbLabel: [selectDb.type, selectDb.name].join('/'),
label: schemaName + '.' + tableName,
params: {queryParams: queryParams, tableInfo: fullInfo},
type: 'metadata'
}
});
};
/**
* 数据库选择改变事件
* @param {number} databaseId
*/
const handleSelectDataBaseId = (databaseId: number) => {
dispatch({
type: STUDIO_MODEL.updateSelectDatabaseId,
payload: databaseId
});
onChangeDataBase(databaseId);
};
/**
* 树节点展开事件
* @param {Key[]} expandedKeys
*/
const handleTreeExpand = (expandedKeys: Key[]) => {
dispatch({
type: STUDIO_MODEL.updateDatabaseExpandKey,
payload: expandedKeys
});
};
return (
<Spin spinning={isLoadingDatabase} delay={500}>
<DataSourceModal
values={{}}
visible={showCreate}
onCancel={() => setShowCreate(false)}
onTest={(value) => handleTest(value)}
onSubmit={async (value) => {
await saveOrUpdateHandle(value);
const data = await getDataBase();
dispatch({
type: STUDIO_MODEL.saveDataBase,
payload: data
});
}}
/>
<ProForm
style={{height: 40}}
initialValues={{selectDb: selectDatabaseId}}
submitter={false}
>
<ProFormSelect
style={{paddingInline: 6}}
// width={leftContainer.width }
width={'xl'}
// addonAfter={<ReloadOutlined spin={isLoadingDatabase} title={l('button.refresh')} onClick={() => refreshDataBase()} />}
allowClear={false}
name={'selectDb'}
placeholder={l('pages.metadata.selectDatabase')}
options={getDataBaseOptions()}
fieldProps={{
onSelect: (selectId) => handleSelectDataBaseId(selectId as number)
}}
/>
</ProForm>
<SchemaTree
selectKeys={selectKeys}
expandKeys={expandKeys}
style={{height: toolContentHeight - 64 - 20}}
onNodeClick={handleTreeNodeClick}
treeData={treeData}
onExpand={handleTreeExpand}
/>
</Spin>
);
}; };
export default connect(({Studio}: { export default connect(({ Studio }: { Studio: StateType }) => ({
Studio: StateType toolContentHeight: Studio.toolContentHeight,
}) => ({ leftContainer: Studio.leftContainer,
toolContentHeight: Studio.toolContentHeight, database: Studio.database
leftContainer: Studio.leftContainer,
database: Studio.database
}))(MetaData); }))(MetaData);
...@@ -17,294 +17,288 @@ ...@@ -17,294 +17,288 @@
* *
*/ */
import {CircleDataStudioButtonProps} from '@/components/CallBackButton/CircleBtn'; import { CircleDataStudioButtonProps } from '@/components/CallBackButton/CircleBtn';
import Console from '@/pages/DataStudio/BottomContainer/Console'; import Console from '@/pages/DataStudio/BottomContainer/Console';
import Lineage from '@/pages/DataStudio/BottomContainer/Lineage'; import Lineage from '@/pages/DataStudio/BottomContainer/Lineage';
import Result from '@/pages/DataStudio/BottomContainer/Result'; import Result from '@/pages/DataStudio/BottomContainer/Result';
import TableData from '@/pages/DataStudio/BottomContainer/TableData'; import TableData from '@/pages/DataStudio/BottomContainer/TableData';
import {Catalog} from '@/pages/DataStudio/LeftContainer/Catalog'; import { Catalog } from '@/pages/DataStudio/LeftContainer/Catalog';
import MetaData from '@/pages/DataStudio/LeftContainer/MetaData'; import MetaData from '@/pages/DataStudio/LeftContainer/MetaData';
import Project from '@/pages/DataStudio/LeftContainer/Project'; import Project from '@/pages/DataStudio/LeftContainer/Project';
import {TabsPageSubType, TabsPageType} from '@/pages/DataStudio/model'; import { TabsPageSubType, TabsPageType } from '@/pages/DataStudio/model';
import ExecuteConfig from '@/pages/DataStudio/RightContainer/ExecuteConfig'; import ExecuteConfig from '@/pages/DataStudio/RightContainer/ExecuteConfig';
import HistoryVersion from '@/pages/DataStudio/RightContainer/HistoryVersion'; import HistoryVersion from '@/pages/DataStudio/RightContainer/HistoryVersion';
import JobConfig from '@/pages/DataStudio/RightContainer/JobConfig'; import JobConfig from '@/pages/DataStudio/RightContainer/JobConfig';
import JobInfo from '@/pages/DataStudio/RightContainer/JobInfo'; import JobInfo from '@/pages/DataStudio/RightContainer/JobInfo';
import SavePoints from '@/pages/DataStudio/RightContainer/SavePoints'; import SavePoints from '@/pages/DataStudio/RightContainer/SavePoints';
import {l} from '@/utils/intl'; import { l } from '@/utils/intl';
import { import {
ApartmentOutlined, ApartmentOutlined,
ArrowsAltOutlined, ArrowsAltOutlined,
BarChartOutlined, BarChartOutlined,
CalendarOutlined, CalendarOutlined,
ConsoleSqlOutlined, ConsoleSqlOutlined,
DatabaseOutlined, DatabaseOutlined,
DesktopOutlined, DesktopOutlined,
EnvironmentOutlined, EnvironmentOutlined,
FolderOutlined, FolderOutlined,
HistoryOutlined, HistoryOutlined,
InfoCircleOutlined, InfoCircleOutlined,
MonitorOutlined, MonitorOutlined,
PlayCircleOutlined, PlayCircleOutlined,
PlusCircleOutlined, PlusOutlined, PlusCircleOutlined,
ReloadOutlined, PlusOutlined,
RightSquareOutlined, ReloadOutlined,
SettingOutlined, RightSquareOutlined,
ShrinkOutlined, SettingOutlined,
TableOutlined, ShrinkOutlined,
ToolOutlined TableOutlined,
ToolOutlined
} from '@ant-design/icons'; } from '@ant-design/icons';
import {DiffEditor} from '@monaco-editor/react'; import { DiffEditor } from '@monaco-editor/react';
import {ReactNode} from 'react'; import { ReactNode } from 'react';
export const LeftSide = [ export const LeftSide = [
{ {
auth: '/datastudio/left/project', auth: '/datastudio/left/project',
key: 'menu.datastudio.project', key: 'menu.datastudio.project',
icon: <ConsoleSqlOutlined/>, icon: <ConsoleSqlOutlined />,
label: l('menu.datastudio.project'), label: l('menu.datastudio.project'),
children: <Project/> children: <Project />
}, },
{ {
auth: '/datastudio/left/catalog', auth: '/datastudio/left/catalog',
key: 'menu.datastudio.catalog', key: 'menu.datastudio.catalog',
icon: <TableOutlined/>, icon: <TableOutlined />,
label: l('menu.datastudio.catalog'), label: l('menu.datastudio.catalog'),
children: <Catalog/> children: <Catalog />
}, },
{ {
auth: '/datastudio/left/metadata', auth: '/datastudio/left/metadata',
key: 'menu.datastudio.metadata', key: 'menu.datastudio.metadata',
icon: <DatabaseOutlined/>, icon: <DatabaseOutlined />,
label: l('menu.datastudio.metadata'), label: l('menu.datastudio.metadata'),
children: <MetaData/> children: <MetaData />
} }
]; ];
export const RightSide: TabProp[] = [ export const RightSide: TabProp[] = [
{
auth: '/datastudio/right/jobConfig',
key: 'menu.datastudio.jobConfig',
icon: <SettingOutlined />,
label: l('menu.datastudio.jobConfig'),
children: <JobConfig />,
isShow: (type, subType) => type === TabsPageType.project && TabsPageSubType.flinkSql === subType
},
{
auth: '/datastudio/right/executeConfig',
key: 'menu.datastudio.executeConfig',
icon: <PlayCircleOutlined />,
label: l('menu.datastudio.executeConfig'),
children: <ExecuteConfig />,
isShow: (type, subType) => type === TabsPageType.project && TabsPageSubType.flinkSql === subType
},
{
auth: '/datastudio/right/savePoint',
key: 'menu.datastudio.savePoint',
icon: <FolderOutlined />,
label: l('menu.datastudio.savePoint'),
children: <SavePoints />,
isShow: (type, subType) => type === TabsPageType.project && TabsPageSubType.flinkSql === subType
},
{
auth: '/datastudio/right/historyVision',
key: 'menu.datastudio.historyVision',
icon: <HistoryOutlined />,
label: l('menu.datastudio.historyVision'),
children: <HistoryVersion />,
isShow: (type, subType) => type === TabsPageType.project && TabsPageSubType.flinkSql === subType
},
{
auth: '/datastudio/right/jobInfo',
key: 'menu.datastudio.jobInfo',
icon: <InfoCircleOutlined />,
label: l('menu.datastudio.jobInfo'),
children: <JobInfo />,
isShow: (type) => type !== TabsPageType.None
}
];
export const LeftBottomSide = [
{
auth: '/datastudio/bottom/console',
key: 'menu.datastudio.console',
icon: <RightSquareOutlined />,
label: l('menu.datastudio.console'),
children: <Console />
},
{
auth: '/datastudio/bottom/result',
key: 'menu.datastudio.result',
icon: <MonitorOutlined />,
label: l('menu.datastudio.result'),
children: <Result />
},
{
auth: '/datastudio/bottom/bi',
key: 'menu.datastudio.bi',
icon: <BarChartOutlined />,
label: l('menu.datastudio.bi')
},
{
auth: '/datastudio/bottom/lineage',
key: 'menu.datastudio.lineage',
icon: <ApartmentOutlined />,
label: l('menu.datastudio.lineage'),
children: <Lineage />
},
{
auth: '/datastudio/bottom/process',
key: 'menu.datastudio.process',
icon: <DesktopOutlined />,
label: l('menu.datastudio.process')
},
{
auth: '/datastudio/bottom/history',
key: 'menu.datastudio.history',
icon: <CalendarOutlined />,
label: l('menu.datastudio.history')
},
{
auth: '/datastudio/bottom/table-data',
key: 'menu.datastudio.table-data',
icon: <TableOutlined />,
label: l('menu.datastudio.table-data'),
children: <TableData />
},
{
auth: '/datastudio/bottom/tool',
key: 'menu.datastudio.tool',
icon: <ToolOutlined />,
label: l('menu.datastudio.tool')
}
];
export const LeftBottomMoreTabs: { [c: string]: TabProp[] } = {
'menu.datastudio.tool': [
{ {
auth: '/datastudio/right/jobConfig', key: 'menu.datastudio.tool.text-comparison',
key: 'menu.datastudio.jobConfig', icon: <ToolOutlined />,
icon: <SettingOutlined/>, label: l('menu.datastudio.tool.text-comparison'),
label: l('menu.datastudio.jobConfig'), children: (
children: <JobConfig/>, <DiffEditor
isShow: (type, subType) => type === TabsPageType.project && TabsPageSubType.flinkSql === subType height={'100%'}
}, options={{
{ readOnly: false,
auth: '/datastudio/right/executeConfig', originalEditable: true,
key: 'menu.datastudio.executeConfig', selectOnLineNumbers: true,
icon: <PlayCircleOutlined/>, lineDecorationsWidth: 20,
label: l('menu.datastudio.executeConfig'), mouseWheelZoom: true,
children: <ExecuteConfig/>, automaticLayout: true,
isShow: (type, subType) => type === TabsPageType.project && TabsPageSubType.flinkSql === subType scrollBeyondLastLine: false,
scrollbar: {
useShadows: false,
verticalScrollbarSize: 8,
horizontalScrollbarSize: 8,
arrowSize: 30
}
}}
language={'text'}
/>
)
}, },
{ {
auth: '/datastudio/right/savePoint', key: 'menu.datastudio.tool.datax2',
key: 'menu.datastudio.savePoint', icon: <ToolOutlined />,
icon: <FolderOutlined/>, label: 'menu.datastudio.tool.datax2',
label: l('menu.datastudio.savePoint'), children: <div>datax2</div>
children: <SavePoints/>, }
isShow: (type, subType) => type === TabsPageType.project && TabsPageSubType.flinkSql === subType ],
}, 'menu.datastudio.tool2': [
{ {
auth: '/datastudio/right/historyVision', key: 'menu.datastudio.tool.text-comparison',
key: 'menu.datastudio.historyVision', icon: <ToolOutlined />,
icon: <HistoryOutlined/>, label: 'menu.datastudio.tool.text-comparison',
label: l('menu.datastudio.historyVision'), children: (
children: <HistoryVersion/>, <DiffEditor
isShow: (type, subType) => type === TabsPageType.project && TabsPageSubType.flinkSql === subType height={'95%'}
options={{
readOnly: true,
selectOnLineNumbers: true,
lineDecorationsWidth: 20,
mouseWheelZoom: true,
automaticLayout: true
}}
language={'sql'}
original={''}
modified={''}
/>
)
}, },
{ {
auth: '/datastudio/right/jobInfo', key: 'menu.datastudio.tool.datax2',
key: 'menu.datastudio.jobInfo', icon: <ToolOutlined />,
icon: <InfoCircleOutlined/>, label: 'menu.datastudio.tool.datax2',
label: l('menu.datastudio.jobInfo'), children: <div>datax2</div>
children: <JobInfo/>,
isShow: (type) => type !== TabsPageType.None
} }
]; ]
};
export const LeftBottomSide = [ // btn route
{ export const BtnRoute: { [c: string]: CircleDataStudioButtonProps[] } = {
auth: '/datastudio/bottom/console', 'menu.datastudio.metadata': [
key: 'menu.datastudio.console',
icon: <RightSquareOutlined/>,
label: l('menu.datastudio.console'),
children: <Console/>
},
{ {
auth: '/datastudio/bottom/result', icon: <PlusOutlined />,
key: 'menu.datastudio.result', title: l('button.create'),
icon: <MonitorOutlined/>, onClick: () => {}
label: l('menu.datastudio.result'),
children: <Result/>
}, },
{ {
auth: '/datastudio/bottom/bi', icon: <ReloadOutlined />,
key: 'menu.datastudio.bi', title: l('button.refresh'),
icon: <BarChartOutlined/>, onClick: () => {}
label: l('menu.datastudio.bi') }
}, ],
'menu.datastudio.catalog': [
{ {
auth: '/datastudio/bottom/lineage', icon: <ReloadOutlined />,
key: 'menu.datastudio.lineage', title: l('button.refresh'),
icon: <ApartmentOutlined/>, onClick: () => {}
label: l('menu.datastudio.lineage'), }
children: <Lineage/> ],
}, 'menu.datastudio.project': [
{ {
auth: '/datastudio/bottom/process', icon: <PlusCircleOutlined />,
key: 'menu.datastudio.process', title: l('right.menu.createRoot'),
icon: <DesktopOutlined/>, key: 'right.menu.createRoot',
label: l('menu.datastudio.process') onClick: () => {}
}, },
{ {
auth: '/datastudio/bottom/history', icon: <ArrowsAltOutlined />,
key: 'menu.datastudio.history', title: l('button.expand-all'),
icon: <CalendarOutlined/>, key: 'button.expand-all',
label: l('menu.datastudio.history') onClick: () => {}
}, },
{ {
auth: '/datastudio/bottom/table-data', icon: <ShrinkOutlined />,
key: 'menu.datastudio.table-data', title: l('button.collapse-all'),
icon: <TableOutlined/>, key: 'button.collapse-all',
label: l('menu.datastudio.table-data'), onClick: () => {}
children: <TableData/>
}, },
{ {
auth: '/datastudio/bottom/tool', icon: <EnvironmentOutlined />,
key: 'menu.datastudio.tool', title: l('button.position'),
icon: <ToolOutlined/>, key: 'button.position',
label: l('menu.datastudio.tool') onClick: () => {}
} }
]; ]
export const LeftBottomMoreTabs: { [c: string]: TabProp[] } = {
'menu.datastudio.tool': [
{
key: 'menu.datastudio.tool.text-comparison',
icon: <ToolOutlined/>,
label: l('menu.datastudio.tool.text-comparison'),
children: (
<DiffEditor
height={'100%'}
options={{
readOnly: false,
originalEditable: true,
selectOnLineNumbers: true,
lineDecorationsWidth: 20,
mouseWheelZoom: true,
automaticLayout: true,
scrollBeyondLastLine: false,
scrollbar: {
useShadows: false,
verticalScrollbarSize: 8,
horizontalScrollbarSize: 8,
arrowSize: 30
}
}}
language={'text'}
/>
)
},
{
key: 'menu.datastudio.tool.datax2',
icon: <ToolOutlined/>,
label: 'menu.datastudio.tool.datax2',
children: <div>datax2</div>
}
],
'menu.datastudio.tool2': [
{
key: 'menu.datastudio.tool.text-comparison',
icon: <ToolOutlined/>,
label: 'menu.datastudio.tool.text-comparison',
children: (
<DiffEditor
height={'95%'}
options={{
readOnly: true,
selectOnLineNumbers: true,
lineDecorationsWidth: 20,
mouseWheelZoom: true,
automaticLayout: true
}}
language={'sql'}
original={''}
modified={''}
/>
)
},
{
key: 'menu.datastudio.tool.datax2',
icon: <ToolOutlined/>,
label: 'menu.datastudio.tool.datax2',
children: <div>datax2</div>
}
]
};
// btn route
export const BtnRoute: { [c: string]: CircleDataStudioButtonProps[] } = {
'menu.datastudio.metadata': [
{
icon: <PlusOutlined />,
title: l('button.create'),
onClick: () => {
}
},
{
icon: <ReloadOutlined/>,
title: l('button.refresh'),
onClick: () => {
}
}
],
'menu.datastudio.catalog': [
{
icon: <ReloadOutlined/>,
title: l('button.refresh'),
onClick: () => {
}
}
],
'menu.datastudio.project': [
{
icon: <PlusCircleOutlined/>,
title: l('right.menu.createRoot'),
key: 'right.menu.createRoot',
onClick: () => {
}
},
{
icon: <ArrowsAltOutlined/>,
title: l('button.expand-all'),
key: 'button.expand-all',
onClick: () => {
}
},
{
icon: <ShrinkOutlined/>,
title: l('button.collapse-all'),
key: 'button.collapse-all',
onClick: () => {
}
},
{
icon: <EnvironmentOutlined/>,
title: l('button.position'),
key: 'button.position',
onClick: () => {
}
}
]
}; };
export type TabProp = { export type TabProp = {
key: string; key: string;
icon: ReactNode; icon: ReactNode;
label: string; label: string;
children: ReactNode; children: ReactNode;
isShow?: (type: TabsPageType, subType?: TabsPageSubType) => boolean; isShow?: (type: TabsPageType, subType?: TabsPageSubType) => boolean;
auth?: string; auth?: string;
}; };
...@@ -21,7 +21,10 @@ const JobList = () => { ...@@ -21,7 +21,10 @@ const JobList = () => {
const jobListColumns: ProColumns<Jobs.JobInstance>[] = [ const jobListColumns: ProColumns<Jobs.JobInstance>[] = [
{ {
title: l('devops.jobinfo.config.taskId'), title: l('devops.jobinfo.config.taskId'),
dataIndex: 'taskId' dataIndex: 'taskId',
width: '6%',
valueType: 'indexBorder',
fixed: 'left'
}, },
{ {
title: l('global.table.jobname'), title: l('global.table.jobname'),
...@@ -43,7 +46,8 @@ const JobList = () => { ...@@ -43,7 +46,8 @@ const JobList = () => {
{ {
title: l('devops.jobinfo.config.JobId'), title: l('devops.jobinfo.config.JobId'),
dataIndex: 'jid', dataIndex: 'jid',
width: '15%' width: '20%',
copyable: true
}, },
{ {
title: l('global.table.createTime'), title: l('global.table.createTime'),
...@@ -67,6 +71,8 @@ const JobList = () => { ...@@ -67,6 +71,8 @@ const JobList = () => {
{ {
title: l('global.table.operate'), title: l('global.table.operate'),
valueType: 'option', valueType: 'option',
width: '5%',
fixed: 'right',
render: (text: any, record: Jobs.JobInstance) => [ render: (text: any, record: Jobs.JobInstance) => [
<Button <Button
className={'options-button'} className={'options-button'}
......
...@@ -305,7 +305,13 @@ export default () => { ...@@ -305,7 +305,13 @@ export default () => {
<Badge.Ribbon <Badge.Ribbon
className={'card-list-item-wrapper'} className={'card-list-item-wrapper'}
color={item.autoRegisters ? 'green' : 'yellow'} color={item.autoRegisters ? 'green' : 'yellow'}
text={item.autoRegisters ? l('rc.ci.ar') : <span style={{color:"crimson"}}>{l('rc.ci.mr')}</span>} text={
item.autoRegisters ? (
l('rc.ci.ar')
) : (
<span style={{ color: 'crimson' }}>{l('rc.ci.mr')}</span>
)
}
> >
<Card <Card
headStyle={{ minHeight: '10px' }} headStyle={{ minHeight: '10px' }}
......
...@@ -17,14 +17,13 @@ ...@@ -17,14 +17,13 @@
* *
*/ */
import {WebIcon} from '@/components/Icons/CustomIcons'; import { RUN_MODE } from '@/services/constants';
import {RUN_MODE} from '@/services/constants'; import { Cluster } from '@/types/RegCenter/data';
import {Cluster} from '@/types/RegCenter/data'; import { l } from '@/utils/intl';
import {l} from '@/utils/intl'; import { Typography } from 'antd';
import {Button, Typography} from 'antd'; import { RuleObject } from 'rc-field-form/es/interface';
import {RuleObject} from 'rc-field-form/es/interface';
const {Text, Paragraph, Link} = Typography; const { Text, Paragraph, Link } = Typography;
/** /**
* validatorJMHAAdderess * validatorJMHAAdderess
...@@ -32,21 +31,21 @@ const {Text, Paragraph, Link} = Typography; ...@@ -32,21 +31,21 @@ const {Text, Paragraph, Link} = Typography;
* @param value * @param value
*/ */
export const validatorJMHAAdderess = (rule: RuleObject, value = '') => { export const validatorJMHAAdderess = (rule: RuleObject, value = '') => {
let hostArray = []; let hostArray = [];
if (value.trim().length === 0) { if (value.trim().length === 0) {
return Promise.reject(new Error(l('rc.ci.jmhaPlaceholder'))); return Promise.reject(new Error(l('rc.ci.jmhaPlaceholder')));
} else { } else {
hostArray = value.split(','); hostArray = value.split(',');
for (let i = 0; i < hostArray.length; i++) { for (let i = 0; i < hostArray.length; i++) {
if (hostArray[i].includes('/')) { if (hostArray[i].includes('/')) {
return Promise.reject(new Error(l('rc.ci.jmha.validate.slash'))); return Promise.reject(new Error(l('rc.ci.jmha.validate.slash')));
} }
if (parseInt(hostArray[i].split(':')[1]) >= 65535) { if (parseInt(hostArray[i].split(':')[1]) >= 65535) {
return Promise.reject(new Error(l('rc.ci.jmha.validate.port'))); return Promise.reject(new Error(l('rc.ci.jmha.validate.port')));
} }
}
return Promise.resolve();
} }
return Promise.resolve();
}
}; };
/** /**
...@@ -54,20 +53,22 @@ export const validatorJMHAAdderess = (rule: RuleObject, value = '') => { ...@@ -54,20 +53,22 @@ export const validatorJMHAAdderess = (rule: RuleObject, value = '') => {
* @param record * @param record
*/ */
export const renderWebUiRedirect = (record: Cluster.Instance) => { export const renderWebUiRedirect = (record: Cluster.Instance) => {
if ( if (
record.status && record.status &&
(record.type === RUN_MODE.YARN_SESSION || (record.type === RUN_MODE.YARN_SESSION ||
record.type === RUN_MODE.STANDALONE || record.type === RUN_MODE.STANDALONE ||
record.type === RUN_MODE.YARN_APPLICATION || record.type === RUN_MODE.YARN_APPLICATION ||
record.type === RUN_MODE.YARN_PER_JOB) record.type === RUN_MODE.YARN_PER_JOB)
) { ) {
return ( return (
<Link <Link
href={`/api/flink/${record.jobManagerHost}/#/overview`} href={`/api/flink/${record.jobManagerHost}/#/overview`}
key={`${record.id}_webui`} key={`${record.id}_webui`}
target='_blank' target='_blank'
>{record.jobManagerHost}</Link> >
); {record.jobManagerHost}
} </Link>
return <Link>{record.hosts}</Link>; );
}
return <Link>{record.hosts}</Link>;
}; };
...@@ -24,6 +24,6 @@ export const enum ClusterType { ...@@ -24,6 +24,6 @@ export const enum ClusterType {
KUBERNETES_SESSION = 'kubernetes-session', KUBERNETES_SESSION = 'kubernetes-session',
KUBERNETES_NATIVE = 'kubernetes-application', KUBERNETES_NATIVE = 'kubernetes-application',
KUBERNETES_OPERATOR = 'kubernetes-application-operator', KUBERNETES_OPERATOR = 'kubernetes-application-operator',
YARN_APPLICATION = 'yarn-application', YARN_APPLICATION = 'yarn-application',
LOACL= 'local', LOACL = 'local'
} }
...@@ -24,9 +24,9 @@ import { Authorized, HasAuthority } from '@/hooks/useAccess'; ...@@ -24,9 +24,9 @@ import { Authorized, HasAuthority } from '@/hooks/useAccess';
import { StateType, STUDIO_MODEL } from '@/pages/DataStudio/model'; import { StateType, STUDIO_MODEL } from '@/pages/DataStudio/model';
import DataSourceDetail from '@/pages/RegCenter/DataSource/components/DataSourceDetail'; import DataSourceDetail from '@/pages/RegCenter/DataSource/components/DataSourceDetail';
import { renderDBIcon } from '@/pages/RegCenter/DataSource/components/function'; import { renderDBIcon } from '@/pages/RegCenter/DataSource/components/function';
import { handleTest, saveOrUpdateHandle } from '@/pages/RegCenter/DataSource/service';
import { queryList } from '@/services/api'; import { queryList } from '@/services/api';
import { import {
handleAddOrUpdate,
handleOption, handleOption,
handlePutDataByParams, handlePutDataByParams,
handleRemoveById, handleRemoveById,
...@@ -37,7 +37,7 @@ import { API_CONSTANTS } from '@/services/endpoints'; ...@@ -37,7 +37,7 @@ import { API_CONSTANTS } from '@/services/endpoints';
import { DataSources } from '@/types/RegCenter/data.d'; import { DataSources } from '@/types/RegCenter/data.d';
import { l } from '@/utils/intl'; import { l } from '@/utils/intl';
import { WarningMessage } from '@/utils/messages'; import { WarningMessage } from '@/utils/messages';
import {useNavigate} from '@@/exports'; import { useNavigate } from '@@/exports';
import { import {
CheckCircleOutlined, CheckCircleOutlined,
CopyTwoTone, CopyTwoTone,
...@@ -50,7 +50,6 @@ import DescriptionsItem from 'antd/es/descriptions/Item'; ...@@ -50,7 +50,6 @@ import DescriptionsItem from 'antd/es/descriptions/Item';
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { connect } from 'umi'; import { connect } from 'umi';
import DataSourceModal from '../DataSourceModal'; import DataSourceModal from '../DataSourceModal';
import {handleTest, saveOrUpdateHandle} from "@/pages/RegCenter/DataSource/service";
const DataSourceTable: React.FC<connect & StateType> = (props) => { const DataSourceTable: React.FC<connect & StateType> = (props) => {
const { dispatch } = props; const { dispatch } = props;
...@@ -118,8 +117,6 @@ const DataSourceTable: React.FC<connect & StateType> = (props) => { ...@@ -118,8 +117,6 @@ const DataSourceTable: React.FC<connect & StateType> = (props) => {
); );
}; };
/** /**
* handle check heart * handle check heart
* @param item * @param item
...@@ -138,8 +135,6 @@ const DataSourceTable: React.FC<connect & StateType> = (props) => { ...@@ -138,8 +135,6 @@ const DataSourceTable: React.FC<connect & StateType> = (props) => {
); );
}; };
/** /**
* render sub title * render sub title
* @param item * @param item
...@@ -290,7 +285,7 @@ const DataSourceTable: React.FC<connect & StateType> = (props) => { ...@@ -290,7 +285,7 @@ const DataSourceTable: React.FC<connect & StateType> = (props) => {
visible={modalVisible} visible={modalVisible}
onCancel={cancelAll} onCancel={cancelAll}
onTest={(value) => handleTest(value)} onTest={(value) => handleTest(value)}
onSubmit={(value) => executeAndCallbackRefresh(async ()=>saveOrUpdateHandle(value))} onSubmit={(value) => executeAndCallbackRefresh(async () => saveOrUpdateHandle(value))}
/> />
</> </>
) : ( ) : (
......
...@@ -17,168 +17,164 @@ ...@@ -17,168 +17,164 @@
import CodeEdit from '@/components/CustomEditor/CodeEdit'; import CodeEdit from '@/components/CustomEditor/CodeEdit';
import { import {
AUTO_COMPLETE_TYPE, AUTO_COMPLETE_TYPE,
DATA_SOURCE_TYPE_OPTIONS, DATA_SOURCE_TYPE_OPTIONS,
GROUP_TYPE GROUP_TYPE
} from '@/pages/RegCenter/DataSource/components/constants'; } from '@/pages/RegCenter/DataSource/components/constants';
import {DataSources} from '@/types/RegCenter/data.d'; import { DataSources } from '@/types/RegCenter/data.d';
import {l} from '@/utils/intl'; import { l } from '@/utils/intl';
import { import { ProForm, ProFormGroup, ProFormSelect, ProFormText } from '@ant-design/pro-components';
ProForm, import { AutoComplete, Form } from 'antd';
ProFormGroup, import { FormInstance } from 'antd/es/form/hooks/useForm';
ProFormSelect, import TextArea from 'antd/es/input/TextArea';
ProFormText import { Values } from 'async-validator';
} from '@ant-design/pro-components'; import React, { useState } from 'react';
import {AutoComplete, Form} from 'antd';
import {FormInstance} from 'antd/es/form/hooks/useForm';
import {Values} from 'async-validator';
import React, {useState} from 'react';
import TextArea from "antd/es/input/TextArea";
type DataSourceProFormProps = { type DataSourceProFormProps = {
values: Partial<DataSources.DataSource>; values: Partial<DataSources.DataSource>;
form: FormInstance<Values>; form: FormInstance<Values>;
flinkConfigChange: (value: string) => void; flinkConfigChange: (value: string) => void;
flinkTemplateChange: (value: string) => void; flinkTemplateChange: (value: string) => void;
}; };
const CodeEditProps = { const CodeEditProps = {
height: '30vh', height: '30vh',
width: '22vw', width: '22vw',
lineNumbers: 'off', lineNumbers: 'off',
language: 'sql' language: 'sql'
}; };
const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => { const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => {
const {values, form, flinkTemplateChange, flinkConfigChange} = props; const { values, form, flinkTemplateChange, flinkConfigChange } = props;
const [excludeFormItem, setExcludeFormItem] = useState<boolean>(false); const [excludeFormItem, setExcludeFormItem] = useState<boolean>(false);
const [dbType, setDbType] = useState<string>(values.type ?? 'MySQL');
const handleTypeChange = (value: any) => {
if (value.type) setDbType(value.type);
if (value.type === 'Hive' || value.type === 'Presto') {
setExcludeFormItem(true);
} else {
setExcludeFormItem(false);
}
};
const renderDataSourceForm = () => { const [dbType, setDbType] = useState<string>(values.type ?? 'MySQL');
return (
<>
<ProForm.Group>
<ProFormText
name='name'
width={'md'}
label={l('rc.ds.name')}
rules={[{required: true, message: l('rc.ds.namePlaceholder')}]}
placeholder={l('rc.ds.namePlaceholder')}
/>
<ProFormSelect
name='groupName'
width={'sm'}
label={l('rc.ds.groupName')}
options={GROUP_TYPE}
placeholder={l('rc.ds.groupNamePlaceholder')}
/>
<ProFormSelect
name='type'
width={'sm'}
label={l('rc.ds.type')}
showSearch
initialValue={dbType}
options={DATA_SOURCE_TYPE_OPTIONS}
rules={[{required: true, message: l('rc.ds.typePlaceholder')}]}
placeholder={l('rc.ds.typePlaceholder')}
/>
<ProFormText const handleTypeChange = (value: any) => {
name='username' if (value.type) setDbType(value.type);
width={'sm'} if (value.type === 'Hive' || value.type === 'Presto') {
label={l('rc.ds.username')} setExcludeFormItem(true);
rules={[{required: true, message: l('rc.ds.usernamePlaceholder')}]} } else {
placeholder={l('rc.ds.usernamePlaceholder')} setExcludeFormItem(false);
/> }
<ProFormText.Password };
name='password'
width={'sm'}
label={l('rc.ds.password')}
rules={[
{
required: dbType !== 'Doris',
message: l('rc.ds.passwordPlaceholder')
}
]}
placeholder={l('rc.ds.passwordPlaceholder')}
/>
<ProFormText
name='note'
width={'md'}
label={l('global.table.note')}
placeholder={l('global.table.notePlaceholder')}
/>
</ProForm.Group>
<ProForm.Group> const renderDataSourceForm = () => {
<Form.Item name="url" label={l('rc.ds.url')} return (
rules={[{required: true, message: l('rc.ds.urlPlaceholder')}]}> <>
<ProForm.Group>
<ProFormText
name='name'
width={'md'}
label={l('rc.ds.name')}
rules={[{ required: true, message: l('rc.ds.namePlaceholder') }]}
placeholder={l('rc.ds.namePlaceholder')}
/>
<ProFormSelect
name='groupName'
width={'sm'}
label={l('rc.ds.groupName')}
options={GROUP_TYPE}
placeholder={l('rc.ds.groupNamePlaceholder')}
/>
<ProFormSelect
name='type'
width={'sm'}
label={l('rc.ds.type')}
showSearch
initialValue={dbType}
options={DATA_SOURCE_TYPE_OPTIONS}
rules={[{ required: true, message: l('rc.ds.typePlaceholder') }]}
placeholder={l('rc.ds.typePlaceholder')}
/>
<AutoComplete <ProFormText
virtual name='username'
placement={'topLeft'} width={'sm'}
autoClearSearchValue label={l('rc.ds.username')}
options={AUTO_COMPLETE_TYPE} rules={[{ required: true, message: l('rc.ds.usernamePlaceholder') }]}
style={{ placeholder={l('rc.ds.usernamePlaceholder')}
width: parent.innerWidth / 2 - 80 />
}} <ProFormText.Password
filterOption name='password'
onSelect={(value) => form && form.setFieldsValue({url: value})} width={'sm'}
> label={l('rc.ds.password')}
<TextArea placeholder={l('rc.ds.urlPlaceholder')}/> rules={[
{/*<ProFormTextArea*/} {
{/* name='url'*/} required: dbType !== 'Doris',
{/* width={parent.innerWidth / 2 - 80}*/} message: l('rc.ds.passwordPlaceholder')
{/* label={l('rc.ds.url')}*/} }
{/* rules={[{ required: true, message: l('rc.ds.urlPlaceholder') }]}*/} ]}
{/* placeholder={l('rc.ds.urlPlaceholder')}*/} placeholder={l('rc.ds.passwordPlaceholder')}
{/*/>*/} />
</AutoComplete> <ProFormText
</Form.Item> name='note'
width={'md'}
label={l('global.table.note')}
placeholder={l('global.table.notePlaceholder')}
/>
</ProForm.Group>
</ProForm.Group> <ProForm.Group>
<Form.Item
name='url'
label={l('rc.ds.url')}
rules={[{ required: true, message: l('rc.ds.urlPlaceholder') }]}
>
<AutoComplete
virtual
placement={'topLeft'}
autoClearSearchValue
options={AUTO_COMPLETE_TYPE}
style={{
width: parent.innerWidth / 2 - 80
}}
filterOption
onSelect={(value) => form && form.setFieldsValue({ url: value })}
>
<TextArea placeholder={l('rc.ds.urlPlaceholder')} />
{/*<ProFormTextArea*/}
{/* name='url'*/}
{/* width={parent.innerWidth / 2 - 80}*/}
{/* label={l('rc.ds.url')}*/}
{/* rules={[{ required: true, message: l('rc.ds.urlPlaceholder') }]}*/}
{/* placeholder={l('rc.ds.urlPlaceholder')}*/}
{/*/>*/}
</AutoComplete>
</Form.Item>
</ProForm.Group>
{!excludeFormItem && ( {!excludeFormItem && (
<ProFormGroup> <ProFormGroup>
<ProForm.Item <ProForm.Item
name='flinkConfig' name='flinkConfig'
label={l('rc.ds.flinkConfig')} label={l('rc.ds.flinkConfig')}
tooltip={l('rc.ds.flinkConfigTooltip')} tooltip={l('rc.ds.flinkConfigTooltip')}
> >
<CodeEdit <CodeEdit
{...CodeEditProps} {...CodeEditProps}
onChange={(value) => flinkConfigChange(value ?? '')} onChange={(value) => flinkConfigChange(value ?? '')}
code={values.flinkConfig || ''} code={values.flinkConfig || ''}
/> />
</ProForm.Item> </ProForm.Item>
<ProForm.Item <ProForm.Item
name='flinkTemplate' name='flinkTemplate'
label={l('rc.ds.flinkTemplate')} label={l('rc.ds.flinkTemplate')}
tooltip={l('rc.ds.flinkTemplateTooltip')} tooltip={l('rc.ds.flinkTemplateTooltip')}
> >
<CodeEdit <CodeEdit
{...CodeEditProps} {...CodeEditProps}
onChange={(value) => flinkTemplateChange(value ?? '')} onChange={(value) => flinkTemplateChange(value ?? '')}
code={values.flinkTemplate || ''} code={values.flinkTemplate || ''}
/> />
</ProForm.Item> </ProForm.Item>
</ProFormGroup> </ProFormGroup>
)} )}
</> </>
); );
}; };
return renderDataSourceForm(); return renderDataSourceForm();
}; };
export default DataSourceProForm; export default DataSourceProForm;
...@@ -59,7 +59,7 @@ const DataSourceModal: React.FC<DataSourceModalProps> = (props) => { ...@@ -59,7 +59,7 @@ const DataSourceModal: React.FC<DataSourceModalProps> = (props) => {
useEffect(() => { useEffect(() => {
if (!visible) { if (!visible) {
form.resetFields(); form.resetFields();
}else { } else {
form.setFieldsValue(values); form.setFieldsValue(values);
} }
}, [visible, values]); }, [visible, values]);
......
import {DataSources} from "@/types/RegCenter/data"; import { handleAddOrUpdate, handleOption } from '@/services/BusinessCrud';
import {API_CONSTANTS} from "@/services/endpoints"; import { API_CONSTANTS } from '@/services/endpoints';
import {handleAddOrUpdate, handleOption} from "@/services/BusinessCrud"; import { DataSources } from '@/types/RegCenter/data';
import {l} from "@/utils/intl"; import { l } from '@/utils/intl';
/** /**
* handle test * handle test
* @param item * @param item
*/ */
export const handleTest = async (item: Partial<DataSources.DataSource>) => { export const handleTest = async (item: Partial<DataSources.DataSource>) => {
await handleOption(API_CONSTANTS.DATASOURCE_TEST, l('button.test'), item); await handleOption(API_CONSTANTS.DATASOURCE_TEST, l('button.test'), item);
}; };
/** /**
...@@ -16,5 +16,5 @@ export const handleTest = async (item: Partial<DataSources.DataSource>) => { ...@@ -16,5 +16,5 @@ export const handleTest = async (item: Partial<DataSources.DataSource>) => {
* @param item * @param item
*/ */
export const saveOrUpdateHandle = async (item: Partial<DataSources.DataSource>) => { export const saveOrUpdateHandle = async (item: Partial<DataSources.DataSource>) => {
await handleAddOrUpdate(API_CONSTANTS.DATASOURCE, item); await handleAddOrUpdate(API_CONSTANTS.DATASOURCE, item);
}; };
\ No newline at end of file
import { Resource } from '@/types/RegCenter/data';
import { renderIcon } from '@/utils/function';
import { l } from '@/utils/intl';
const buildTitleLabel = (item: Resource) => {
return (
<>
{item.fileName}
{!item.isDirectory && (
<span style={{ color: 'gray' }}>
{' '}
&nbsp;&nbsp;{l('global.size', '', { size: item.size })}
</span>
)}
</>
);
};
export const buildResourceTreeData = (data: Resource[]): any =>
data.map((item: Resource) => {
return {
isLeaf: !item.children,
name: item.fileName,
parentId: item.pid,
label: item.fullName + '/' + item.fileName,
icon: item.leaf && renderIcon(item.fileName, '.', item.leaf),
path: item.fullName,
title: buildTitleLabel(item),
fullInfo: item,
key: item.id,
id: item.id,
children: buildResourceTreeData(item.children)
};
});
...@@ -17,7 +17,8 @@ ...@@ -17,7 +17,8 @@
* *
*/ */
import { buildTreeData } from '@/utils/function'; import { buildResourceTreeData } from '@/pages/RegCenter/Resource/components/FileTree/function';
import { Resource } from '@/types/RegCenter/data';
import { l } from '@/utils/intl'; import { l } from '@/utils/intl';
import { UploadOutlined } from '@ant-design/icons'; import { UploadOutlined } from '@ant-design/icons';
import { Button, Tree, Typography, Upload } from 'antd'; import { Button, Tree, Typography, Upload } from 'antd';
...@@ -27,7 +28,7 @@ const { DirectoryTree } = Tree; ...@@ -27,7 +28,7 @@ const { DirectoryTree } = Tree;
const { Text } = Typography; const { Text } = Typography;
type FileTreeProps = { type FileTreeProps = {
treeData: Partial<any>[]; treeData: Resource[];
onNodeClick: (info: any) => void; onNodeClick: (info: any) => void;
onRightClick: (info: any) => void; onRightClick: (info: any) => void;
selectedKeys: string[]; selectedKeys: string[];
...@@ -45,7 +46,7 @@ const FileTree: React.FC<FileTreeProps> = (props) => { ...@@ -45,7 +46,7 @@ const FileTree: React.FC<FileTreeProps> = (props) => {
selectedKeys={selectedKeys} selectedKeys={selectedKeys}
onSelect={(_, info) => onNodeClick(info)} onSelect={(_, info) => onNodeClick(info)}
onRightClick={(info) => onRightClick(info)} onRightClick={(info) => onRightClick(info)}
treeData={buildTreeData(treeData)} treeData={buildResourceTreeData(treeData)}
/> />
) : ( ) : (
<> <>
......
...@@ -26,6 +26,7 @@ import ResourceModal from '@/pages/RegCenter/Resource/components/ResourceModal'; ...@@ -26,6 +26,7 @@ import ResourceModal from '@/pages/RegCenter/Resource/components/ResourceModal';
import ResourcesUploadModal from '@/pages/RegCenter/Resource/components/ResourcesUploadModal'; import ResourcesUploadModal from '@/pages/RegCenter/Resource/components/ResourcesUploadModal';
import { handleOption, handleRemoveById, queryDataByParams } from '@/services/BusinessCrud'; import { handleOption, handleRemoveById, queryDataByParams } from '@/services/BusinessCrud';
import { API_CONSTANTS } from '@/services/endpoints'; import { API_CONSTANTS } from '@/services/endpoints';
import { Resource } from '@/types/RegCenter/data';
import { InitResourceState } from '@/types/RegCenter/init.d'; import { InitResourceState } from '@/types/RegCenter/init.d';
import { ResourceState } from '@/types/RegCenter/state.d'; import { ResourceState } from '@/types/RegCenter/state.d';
import { ProCard } from '@ant-design/pro-components'; import { ProCard } from '@ant-design/pro-components';
...@@ -33,13 +34,6 @@ import { MenuInfo } from 'rc-menu/es/interface'; ...@@ -33,13 +34,6 @@ import { MenuInfo } from 'rc-menu/es/interface';
import { Resizable } from 're-resizable'; import { Resizable } from 're-resizable';
import React, { useCallback, useEffect, useState } from 'react'; import React, { useCallback, useEffect, useState } from 'react';
export type Resource = {
id: number;
fileName: string;
description: string;
type?: string;
};
const ResourceOverView: React.FC = () => { const ResourceOverView: React.FC = () => {
const [resourceState, setResourceState] = useState<ResourceState>(InitResourceState); const [resourceState, setResourceState] = useState<ResourceState>(InitResourceState);
...@@ -66,7 +60,7 @@ const ResourceOverView: React.FC = () => { ...@@ -66,7 +60,7 @@ const ResourceOverView: React.FC = () => {
}); });
const refreshTreeData = async (path: string) => { const refreshTreeData = async (path: string) => {
const data = await queryDataByParams<any[]>(API_CONSTANTS.RESOURCE_SHOW_TREE); const data = await queryDataByParams<Resource[]>(API_CONSTANTS.RESOURCE_SHOW_TREE);
setResourceState((prevState) => ({ setResourceState((prevState) => ({
...prevState, ...prevState,
treeData: updateTreeData(prevState.treeData, path, data ?? []) treeData: updateTreeData(prevState.treeData, path, data ?? [])
...@@ -74,7 +68,7 @@ const ResourceOverView: React.FC = () => { ...@@ -74,7 +68,7 @@ const ResourceOverView: React.FC = () => {
}; };
const refreshTree = async () => { const refreshTree = async () => {
await queryDataByParams<any[]>(API_CONSTANTS.RESOURCE_SHOW_TREE).then((res) => await queryDataByParams<Resource[]>(API_CONSTANTS.RESOURCE_SHOW_TREE).then((res) =>
setResourceState((prevState) => ({ ...prevState, treeData: res ?? [] })) setResourceState((prevState) => ({ ...prevState, treeData: res ?? [] }))
); );
}; };
......
import { LogInfo } from '@/types/SettingCenter/data';
import { parseByteStr, renderIcon } from '@/utils/function';
import { l } from '@/utils/intl';
const buildTitleLabel = (item: LogInfo) => {
return (
<>
{item.name}
{!item.leaf && (
<span style={{ color: 'gray' }}>
{' '}
&nbsp;&nbsp;{l('global.size', '', { size: parseByteStr(item.size) })}
</span>
)}
</>
);
};
export const buildLogInfoTreeData = (data: LogInfo[]): any =>
data.map((item: LogInfo) => {
return {
isLeaf: !item.leaf,
name: item.name,
parentId: item.parentId,
label: item.path,
icon: item.leaf && renderIcon(item.name, '.', item.leaf),
path: item.path,
title: buildTitleLabel(item),
fullInfo: item,
key: item.id,
id: item.id,
children: buildLogInfoTreeData(item.children)
};
});
...@@ -15,12 +15,13 @@ ...@@ -15,12 +15,13 @@
* limitations under the License. * limitations under the License.
*/ */
import { buildTreeData } from '@/utils/function'; import { buildLogInfoTreeData } from '@/pages/SettingCenter/SystemLogs/TagInfo/LogList/LogsTree/function';
import { LogInfo } from '@/types/SettingCenter/data';
import { Empty, Tree } from 'antd'; import { Empty, Tree } from 'antd';
import React from 'react'; import React from 'react';
type LogsTreeProps = { type LogsTreeProps = {
treeData: Partial<any>[]; treeData: LogInfo[];
onNodeClick: (info: any) => void; onNodeClick: (info: any) => void;
}; };
...@@ -34,7 +35,7 @@ const LogsTree: React.FC<LogsTreeProps> = (props) => { ...@@ -34,7 +35,7 @@ const LogsTree: React.FC<LogsTreeProps> = (props) => {
{treeData.length > 0 ? ( {treeData.length > 0 ? (
<DirectoryTree <DirectoryTree
onSelect={(_, info) => onNodeClick(info)} onSelect={(_, info) => onNodeClick(info)}
treeData={buildTreeData(treeData)} treeData={buildLogInfoTreeData(treeData)}
/> />
) : ( ) : (
<Empty className={'code-content-empty'} /> <Empty className={'code-content-empty'} />
......
...@@ -19,17 +19,18 @@ import LogsShow from '@/pages/SettingCenter/SystemLogs/TagInfo/LogList/LogsShow' ...@@ -19,17 +19,18 @@ import LogsShow from '@/pages/SettingCenter/SystemLogs/TagInfo/LogList/LogsShow'
import LogsTree from '@/pages/SettingCenter/SystemLogs/TagInfo/LogList/LogsTree'; import LogsTree from '@/pages/SettingCenter/SystemLogs/TagInfo/LogList/LogsTree';
import { queryDataByParams } from '@/services/BusinessCrud'; import { queryDataByParams } from '@/services/BusinessCrud';
import { API_CONSTANTS } from '@/services/endpoints'; import { API_CONSTANTS } from '@/services/endpoints';
import { LogInfo } from '@/types/SettingCenter/data';
import { ProCard } from '@ant-design/pro-components'; import { ProCard } from '@ant-design/pro-components';
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
const LogList = () => { const LogList = () => {
const [treeData, setTreeData] = useState<Partial<any>[]>([]); const [treeData, setTreeData] = useState<LogInfo[]>([]);
const [log, setLog] = useState<string>(''); const [log, setLog] = useState<string>('');
const [clickFileName, setClickFileName] = useState<any>(); const [clickFileName, setClickFileName] = useState<any>();
const queryLogList = async () => { const queryLogList = async () => {
await queryDataByParams(API_CONSTANTS.SYSTEM_ROOT_LOG_LIST).then((res) => { await queryDataByParams<LogInfo[]>(API_CONSTANTS.SYSTEM_ROOT_LOG_LIST).then((res) => {
setTreeData(res); setTreeData(res ?? []);
}); });
}; };
...@@ -37,7 +38,7 @@ const LogList = () => { ...@@ -37,7 +38,7 @@ const LogList = () => {
await queryDataByParams(API_CONSTANTS.SYSTEM_ROOT_LOG_READ, { await queryDataByParams(API_CONSTANTS.SYSTEM_ROOT_LOG_READ, {
path: fileName path: fileName
}).then((res) => { }).then((res) => {
setLog(res); setLog(res as string);
}); });
}; };
...@@ -61,11 +62,12 @@ const LogList = () => { ...@@ -61,11 +62,12 @@ const LogList = () => {
return ( return (
<> <>
<ProCard ghost> <ProCard ghost bordered>
<ProCard ghost colSpan={'18%'} className={'siderTree'}> <ProCard ghost hoverable bordered colSpan={'18%'} className={'siderTree'}>
<LogsTree treeData={treeData} onNodeClick={(info: any) => handleNodeClick(info)} /> <LogsTree treeData={treeData} onNodeClick={(info: any) => handleNodeClick(info)} />
</ProCard> </ProCard>
<ProCard ghost> <ProCard.Divider type={'vertical'} />
<ProCard ghost hoverable bordered>
<LogsShow code={log} refreshLogCallback={() => refreshLogByClickNode()} /> <LogsShow code={log} refreshLogCallback={() => refreshLogByClickNode()} />
</ProCard> </ProCard>
</ProCard> </ProCard>
......
...@@ -232,7 +232,7 @@ export const handlePutData = async (url: string, fields: any) => { ...@@ -232,7 +232,7 @@ export const handlePutData = async (url: string, fields: any) => {
} }
}; };
export const handlePutDataJson = async (url: string, fields: any) => { export const handlePutDataJson = async (url: string, fields: any) => {
const tipsTitle = fields.id ? l('app.request.update') : l('app.request.add'); const tipsTitle = fields?.id ? l('app.request.update') : l('app.request.add');
await LoadingMessageAsync(l('app.request.running') + tipsTitle); await LoadingMessageAsync(l('app.request.running') + tipsTitle);
try { try {
const { code, msg } = await putDataJson(url, { ...fields }); const { code, msg } = await putDataJson(url, { ...fields });
......
...@@ -220,3 +220,19 @@ export type UDFTemplate = BaseBeanColumns & { ...@@ -220,3 +220,19 @@ export type UDFTemplate = BaseBeanColumns & {
functionType: string; functionType: string;
templateCode: string; templateCode: string;
}; };
interface Resource {
id: number;
fileName: string;
description: string;
userId: number;
type: number;
size: number;
pid: number;
fullName: string;
isDirectory: boolean;
createTime: string;
updateTime: string;
children: Resource[];
leaf: boolean;
}
...@@ -110,7 +110,7 @@ export interface GlobalVarState extends BaseState { ...@@ -110,7 +110,7 @@ export interface GlobalVarState extends BaseState {
* resource state * resource state
*/ */
export interface ResourceState { export interface ResourceState {
treeData: any[]; treeData: Resource[];
content: string; content: string;
clickedNode: any; clickedNode: any;
rightClickedNode: any; rightClickedNode: any;
......
...@@ -77,3 +77,15 @@ export type BaseConfigProperties = { ...@@ -77,3 +77,15 @@ export type BaseConfigProperties = {
frontType: string; frontType: string;
example: string[]; example: string[];
}; };
export interface LogInfo {
id: number;
name: string;
path: string;
content: string;
parentId: number;
size: number;
desc: string;
children: LogInfo[];
leaf: boolean;
}
...@@ -436,60 +436,6 @@ export function differenceDays(startDateString: any, endDateString: any): number ...@@ -436,60 +436,6 @@ export function differenceDays(startDateString: any, endDateString: any): number
return Math.floor(daysDifference); return Math.floor(daysDifference);
} }
/**
* build tree data
* @param data
* @returns {any}
*/
export const buildTreeData = (data: any): any =>
data?.map((item: any) => {
// build key
let buildKey = item.path + folderSeparator() + item.fileName;
const buildTitleLabel = () => {
return (
<>
{item.fileName}
<span style={{ color: 'gray' }}>
{' '}
&nbsp;&nbsp;{l('global.size', '', { size: item.size })}
</span>
</>
);
};
// if has children , recursive build
if (item.children) {
return {
isLeaf: item.leaf,
id: item?.id,
fileName: item.fileName,
parentId: item.path ?? item.pid,
icon: renderIcon(item.fileName, '.', item.leaf),
content: item.content,
path: item.fullName,
fullName: item?.fullName,
title: buildTitleLabel(),
desc: item?.desc ?? item?.description,
key: buildKey,
children: buildTreeData(item.children)
};
}
return {
isLeaf: !item.leaf,
id: item?.id,
name: item.name,
parentId: item.path ?? item.parentId,
icon: renderIcon(item.name, '.', item.leaf),
content: item.content,
path: item.path,
fullName: item?.fullName,
desc: item?.desc ?? item?.description,
title: buildTitleLabel(),
key: buildKey
};
});
/** /**
* Determine whether the file is supported * Determine whether the file is supported
* @returns {boolean} * @returns {boolean}
......
...@@ -1381,7 +1381,7 @@ INSERT INTO dinky_alert_template VALUES (1, 'Default', ' ...@@ -1381,7 +1381,7 @@ INSERT INTO dinky_alert_template VALUES (1, 'Default', '
- **Alert Time :** ${time} - **Alert Time :** ${time}
- **Start Time :** ${startTime} - **Start Time :** ${startTime}
- **End Time :** ${endTime} - **End Time :** ${endTime}
- **<font color=''red''>${exceptions.rootException.substring(0,20)}</font>** - **<font color=''red''>${(exceptions.rootException)?substring(0,20)}</font>**
[Go toTask Web](http://${taskUrl}) [Go toTask Web](http://${taskUrl})
', 1, null, null); ', 1, null, null);
......
...@@ -2437,7 +2437,7 @@ INSERT INTO public.dinky_alert_template VALUES (1, 'Default', ' ...@@ -2437,7 +2437,7 @@ INSERT INTO public.dinky_alert_template VALUES (1, 'Default', '
- **Alert Time :** ${time} - **Alert Time :** ${time}
- **Start Time :** ${startTime} - **Start Time :** ${startTime}
- **End Time :** ${endTime} - **End Time :** ${endTime}
- **<font color=''red''>${exceptions.rootException.substring(0,20)}</font>** - **<font color=''red''>${(exceptions.rootException)?substring(0,20)}</font>**
[Go toTask Web](http://${taskUrl}) [Go toTask Web](http://${taskUrl})
', 1, null, null); ', 1, null, null);
......
...@@ -225,7 +225,7 @@ INSERT INTO dinky_alert_template VALUES (1, 'Default', ' ...@@ -225,7 +225,7 @@ INSERT INTO dinky_alert_template VALUES (1, 'Default', '
- **Alert Time :** ${time} - **Alert Time :** ${time}
- **Start Time :** ${startTime} - **Start Time :** ${startTime}
- **End Time :** ${endTime} - **End Time :** ${endTime}
- **<font color=''red''>${exceptions.rootException.substring(0,20)}</font>** - **<font color=''red''>${(exceptions.rootException)?substring(0,20)}</font>**
[Go toTask Web](http://${taskUrl}) [Go toTask Web](http://${taskUrl})
', 1, null, null); ', 1, null, null);
......
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