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 { const {
dispatch, dispatch,
toolContentHeight, toolContentHeight,
database: {dbData, selectDatabaseId, expandKeys, selectKeys} database: { dbData, selectDatabaseId, expandKeys, selectKeys }
} = props; } = props;
const [treeData, setTreeData] = useState<[]>([]); const [treeData, setTreeData] = useState<[]>([]);
const [isLoadingDatabase, setIsLoadingDatabase] = useState(false); const [isLoadingDatabase, setIsLoadingDatabase] = useState(false);
...@@ -41,12 +41,12 @@ const MetaData = (props: any) => { ...@@ -41,12 +41,12 @@ const MetaData = (props: any) => {
for (let table of tables) { for (let table of tables) {
table.title = table.name; table.title = table.name;
table.key = table.name; table.key = table.name;
table.icon = <DatabaseOutlined/>; table.icon = <DatabaseOutlined />;
table.children = table.tables; table.children = table.tables;
for (let child of table.children) { for (let child of table.children) {
child.title = child.name; child.title = child.name;
child.key = table.name + '.' + child.name; child.key = table.name + '.' + child.name;
child.icon = <TableOutlined/>; child.icon = <TableOutlined />;
child.isLeaf = true; child.isLeaf = true;
child.schema = table.name; child.schema = table.name;
child.table = child.name; child.table = child.name;
...@@ -70,7 +70,7 @@ const MetaData = (props: any) => { ...@@ -70,7 +70,7 @@ const MetaData = (props: any) => {
}; };
BtnRoute['menu.datastudio.metadata'][0].onClick = () => { BtnRoute['menu.datastudio.metadata'][0].onClick = () => {
setShowCreate(true) setShowCreate(true);
}; };
BtnRoute['menu.datastudio.metadata'][1].onClick = () => { BtnRoute['menu.datastudio.metadata'][1].onClick = () => {
if (!selectDatabaseId) return; if (!selectDatabaseId) return;
...@@ -84,7 +84,7 @@ const MetaData = (props: any) => { ...@@ -84,7 +84,7 @@ const MetaData = (props: any) => {
* 构建数据库列表 下拉框 * 构建数据库列表 下拉框
*/ */
const getDataBaseOptions = () => { const getDataBaseOptions = () => {
return dbData.map(({id, name, type, enabled, status}: DataSources.DataSource) => ({ return dbData.map(({ id, name, type, enabled, status }: DataSources.DataSource) => ({
key: id, key: id,
value: id, value: id,
label: ( label: (
...@@ -112,14 +112,14 @@ const MetaData = (props: any) => { ...@@ -112,14 +112,14 @@ const MetaData = (props: any) => {
}); });
const { const {
node: {isLeaf, parentId: schemaName, name: tableName, fullInfo} node: { isLeaf, parentId: schemaName, name: tableName, fullInfo }
} = info; } = info;
if (!isLeaf) { if (!isLeaf) {
return; return;
} }
const queryParams = {id: selectDatabaseId, schemaName, tableName}; const queryParams = { id: selectDatabaseId, schemaName, tableName };
dispatch({ dispatch({
type: STUDIO_MODEL.addTab, type: STUDIO_MODEL.addTab,
payload: { payload: {
...@@ -127,7 +127,7 @@ const MetaData = (props: any) => { ...@@ -127,7 +127,7 @@ const MetaData = (props: any) => {
id: selectDatabaseId + schemaName + tableName, id: selectDatabaseId + schemaName + tableName,
breadcrumbLabel: [selectDb.type, selectDb.name].join('/'), breadcrumbLabel: [selectDb.type, selectDb.name].join('/'),
label: schemaName + '.' + tableName, label: schemaName + '.' + tableName,
params: {queryParams: queryParams, tableInfo: fullInfo}, params: { queryParams: queryParams, tableInfo: fullInfo },
type: 'metadata' type: 'metadata'
} }
}); });
...@@ -173,12 +173,12 @@ const MetaData = (props: any) => { ...@@ -173,12 +173,12 @@ const MetaData = (props: any) => {
}} }}
/> />
<ProForm <ProForm
style={{height: 40}} style={{ height: 40 }}
initialValues={{selectDb: selectDatabaseId}} initialValues={{ selectDb: selectDatabaseId }}
submitter={false} submitter={false}
> >
<ProFormSelect <ProFormSelect
style={{paddingInline: 6}} style={{ paddingInline: 6 }}
// width={leftContainer.width } // width={leftContainer.width }
width={'xl'} width={'xl'}
// addonAfter={<ReloadOutlined spin={isLoadingDatabase} title={l('button.refresh')} onClick={() => refreshDataBase()} />} // addonAfter={<ReloadOutlined spin={isLoadingDatabase} title={l('button.refresh')} onClick={() => refreshDataBase()} />}
...@@ -194,7 +194,7 @@ const MetaData = (props: any) => { ...@@ -194,7 +194,7 @@ const MetaData = (props: any) => {
<SchemaTree <SchemaTree
selectKeys={selectKeys} selectKeys={selectKeys}
expandKeys={expandKeys} expandKeys={expandKeys}
style={{height: toolContentHeight - 64 - 20}} style={{ height: toolContentHeight - 64 - 20 }}
onNodeClick={handleTreeNodeClick} onNodeClick={handleTreeNodeClick}
treeData={treeData} treeData={treeData}
onExpand={handleTreeExpand} onExpand={handleTreeExpand}
...@@ -203,9 +203,7 @@ const MetaData = (props: any) => { ...@@ -203,9 +203,7 @@ const MetaData = (props: any) => {
); );
}; };
export default connect(({Studio}: { export default connect(({ Studio }: { Studio: StateType }) => ({
Studio: StateType
}) => ({
toolContentHeight: Studio.toolContentHeight, toolContentHeight: Studio.toolContentHeight,
leftContainer: Studio.leftContainer, leftContainer: Studio.leftContainer,
database: Studio.database database: Studio.database
......
...@@ -17,21 +17,21 @@ ...@@ -17,21 +17,21 @@
* *
*/ */
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,
...@@ -46,7 +46,8 @@ import { ...@@ -46,7 +46,8 @@ import {
InfoCircleOutlined, InfoCircleOutlined,
MonitorOutlined, MonitorOutlined,
PlayCircleOutlined, PlayCircleOutlined,
PlusCircleOutlined, PlusOutlined, PlusCircleOutlined,
PlusOutlined,
ReloadOutlined, ReloadOutlined,
RightSquareOutlined, RightSquareOutlined,
SettingOutlined, SettingOutlined,
...@@ -54,30 +55,30 @@ import { ...@@ -54,30 +55,30 @@ import {
TableOutlined, TableOutlined,
ToolOutlined 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 />
} }
]; ];
...@@ -85,41 +86,41 @@ export const RightSide: TabProp[] = [ ...@@ -85,41 +86,41 @@ export const RightSide: TabProp[] = [
{ {
auth: '/datastudio/right/jobConfig', auth: '/datastudio/right/jobConfig',
key: 'menu.datastudio.jobConfig', key: 'menu.datastudio.jobConfig',
icon: <SettingOutlined/>, icon: <SettingOutlined />,
label: l('menu.datastudio.jobConfig'), label: l('menu.datastudio.jobConfig'),
children: <JobConfig/>, children: <JobConfig />,
isShow: (type, subType) => type === TabsPageType.project && TabsPageSubType.flinkSql === subType isShow: (type, subType) => type === TabsPageType.project && TabsPageSubType.flinkSql === subType
}, },
{ {
auth: '/datastudio/right/executeConfig', auth: '/datastudio/right/executeConfig',
key: 'menu.datastudio.executeConfig', key: 'menu.datastudio.executeConfig',
icon: <PlayCircleOutlined/>, icon: <PlayCircleOutlined />,
label: l('menu.datastudio.executeConfig'), label: l('menu.datastudio.executeConfig'),
children: <ExecuteConfig/>, children: <ExecuteConfig />,
isShow: (type, subType) => type === TabsPageType.project && TabsPageSubType.flinkSql === subType isShow: (type, subType) => type === TabsPageType.project && TabsPageSubType.flinkSql === subType
}, },
{ {
auth: '/datastudio/right/savePoint', auth: '/datastudio/right/savePoint',
key: 'menu.datastudio.savePoint', key: 'menu.datastudio.savePoint',
icon: <FolderOutlined/>, icon: <FolderOutlined />,
label: l('menu.datastudio.savePoint'), label: l('menu.datastudio.savePoint'),
children: <SavePoints/>, children: <SavePoints />,
isShow: (type, subType) => type === TabsPageType.project && TabsPageSubType.flinkSql === subType isShow: (type, subType) => type === TabsPageType.project && TabsPageSubType.flinkSql === subType
}, },
{ {
auth: '/datastudio/right/historyVision', auth: '/datastudio/right/historyVision',
key: 'menu.datastudio.historyVision', key: 'menu.datastudio.historyVision',
icon: <HistoryOutlined/>, icon: <HistoryOutlined />,
label: l('menu.datastudio.historyVision'), label: l('menu.datastudio.historyVision'),
children: <HistoryVersion/>, children: <HistoryVersion />,
isShow: (type, subType) => type === TabsPageType.project && TabsPageSubType.flinkSql === subType isShow: (type, subType) => type === TabsPageType.project && TabsPageSubType.flinkSql === subType
}, },
{ {
auth: '/datastudio/right/jobInfo', auth: '/datastudio/right/jobInfo',
key: 'menu.datastudio.jobInfo', key: 'menu.datastudio.jobInfo',
icon: <InfoCircleOutlined/>, icon: <InfoCircleOutlined />,
label: l('menu.datastudio.jobInfo'), label: l('menu.datastudio.jobInfo'),
children: <JobInfo/>, children: <JobInfo />,
isShow: (type) => type !== TabsPageType.None isShow: (type) => type !== TabsPageType.None
} }
]; ];
...@@ -128,53 +129,53 @@ export const LeftBottomSide = [ ...@@ -128,53 +129,53 @@ export const LeftBottomSide = [
{ {
auth: '/datastudio/bottom/console', auth: '/datastudio/bottom/console',
key: 'menu.datastudio.console', key: 'menu.datastudio.console',
icon: <RightSquareOutlined/>, icon: <RightSquareOutlined />,
label: l('menu.datastudio.console'), label: l('menu.datastudio.console'),
children: <Console/> children: <Console />
}, },
{ {
auth: '/datastudio/bottom/result', auth: '/datastudio/bottom/result',
key: 'menu.datastudio.result', key: 'menu.datastudio.result',
icon: <MonitorOutlined/>, icon: <MonitorOutlined />,
label: l('menu.datastudio.result'), label: l('menu.datastudio.result'),
children: <Result/> children: <Result />
}, },
{ {
auth: '/datastudio/bottom/bi', auth: '/datastudio/bottom/bi',
key: 'menu.datastudio.bi', key: 'menu.datastudio.bi',
icon: <BarChartOutlined/>, icon: <BarChartOutlined />,
label: l('menu.datastudio.bi') label: l('menu.datastudio.bi')
}, },
{ {
auth: '/datastudio/bottom/lineage', auth: '/datastudio/bottom/lineage',
key: 'menu.datastudio.lineage', key: 'menu.datastudio.lineage',
icon: <ApartmentOutlined/>, icon: <ApartmentOutlined />,
label: l('menu.datastudio.lineage'), label: l('menu.datastudio.lineage'),
children: <Lineage/> children: <Lineage />
}, },
{ {
auth: '/datastudio/bottom/process', auth: '/datastudio/bottom/process',
key: 'menu.datastudio.process', key: 'menu.datastudio.process',
icon: <DesktopOutlined/>, icon: <DesktopOutlined />,
label: l('menu.datastudio.process') label: l('menu.datastudio.process')
}, },
{ {
auth: '/datastudio/bottom/history', auth: '/datastudio/bottom/history',
key: 'menu.datastudio.history', key: 'menu.datastudio.history',
icon: <CalendarOutlined/>, icon: <CalendarOutlined />,
label: l('menu.datastudio.history') label: l('menu.datastudio.history')
}, },
{ {
auth: '/datastudio/bottom/table-data', auth: '/datastudio/bottom/table-data',
key: 'menu.datastudio.table-data', key: 'menu.datastudio.table-data',
icon: <TableOutlined/>, icon: <TableOutlined />,
label: l('menu.datastudio.table-data'), label: l('menu.datastudio.table-data'),
children: <TableData/> children: <TableData />
}, },
{ {
auth: '/datastudio/bottom/tool', auth: '/datastudio/bottom/tool',
key: 'menu.datastudio.tool', key: 'menu.datastudio.tool',
icon: <ToolOutlined/>, icon: <ToolOutlined />,
label: l('menu.datastudio.tool') label: l('menu.datastudio.tool')
} }
]; ];
...@@ -183,7 +184,7 @@ export const LeftBottomMoreTabs: { [c: string]: TabProp[] } = { ...@@ -183,7 +184,7 @@ export const LeftBottomMoreTabs: { [c: string]: TabProp[] } = {
'menu.datastudio.tool': [ 'menu.datastudio.tool': [
{ {
key: 'menu.datastudio.tool.text-comparison', key: 'menu.datastudio.tool.text-comparison',
icon: <ToolOutlined/>, icon: <ToolOutlined />,
label: l('menu.datastudio.tool.text-comparison'), label: l('menu.datastudio.tool.text-comparison'),
children: ( children: (
<DiffEditor <DiffEditor
...@@ -209,7 +210,7 @@ export const LeftBottomMoreTabs: { [c: string]: TabProp[] } = { ...@@ -209,7 +210,7 @@ export const LeftBottomMoreTabs: { [c: string]: TabProp[] } = {
}, },
{ {
key: 'menu.datastudio.tool.datax2', key: 'menu.datastudio.tool.datax2',
icon: <ToolOutlined/>, icon: <ToolOutlined />,
label: 'menu.datastudio.tool.datax2', label: 'menu.datastudio.tool.datax2',
children: <div>datax2</div> children: <div>datax2</div>
} }
...@@ -217,7 +218,7 @@ export const LeftBottomMoreTabs: { [c: string]: TabProp[] } = { ...@@ -217,7 +218,7 @@ export const LeftBottomMoreTabs: { [c: string]: TabProp[] } = {
'menu.datastudio.tool2': [ 'menu.datastudio.tool2': [
{ {
key: 'menu.datastudio.tool.text-comparison', key: 'menu.datastudio.tool.text-comparison',
icon: <ToolOutlined/>, icon: <ToolOutlined />,
label: 'menu.datastudio.tool.text-comparison', label: 'menu.datastudio.tool.text-comparison',
children: ( children: (
<DiffEditor <DiffEditor
...@@ -237,7 +238,7 @@ export const LeftBottomMoreTabs: { [c: string]: TabProp[] } = { ...@@ -237,7 +238,7 @@ export const LeftBottomMoreTabs: { [c: string]: TabProp[] } = {
}, },
{ {
key: 'menu.datastudio.tool.datax2', key: 'menu.datastudio.tool.datax2',
icon: <ToolOutlined/>, icon: <ToolOutlined />,
label: 'menu.datastudio.tool.datax2', label: 'menu.datastudio.tool.datax2',
children: <div>datax2</div> children: <div>datax2</div>
} }
...@@ -250,52 +251,45 @@ export const BtnRoute: { [c: string]: CircleDataStudioButtonProps[] } = { ...@@ -250,52 +251,45 @@ export const BtnRoute: { [c: string]: CircleDataStudioButtonProps[] } = {
{ {
icon: <PlusOutlined />, icon: <PlusOutlined />,
title: l('button.create'), title: l('button.create'),
onClick: () => { onClick: () => {}
}
}, },
{ {
icon: <ReloadOutlined/>, icon: <ReloadOutlined />,
title: l('button.refresh'), title: l('button.refresh'),
onClick: () => { onClick: () => {}
}
} }
], ],
'menu.datastudio.catalog': [ 'menu.datastudio.catalog': [
{ {
icon: <ReloadOutlined/>, icon: <ReloadOutlined />,
title: l('button.refresh'), title: l('button.refresh'),
onClick: () => { onClick: () => {}
}
} }
], ],
'menu.datastudio.project': [ 'menu.datastudio.project': [
{ {
icon: <PlusCircleOutlined/>, icon: <PlusCircleOutlined />,
title: l('right.menu.createRoot'), title: l('right.menu.createRoot'),
key: 'right.menu.createRoot', key: 'right.menu.createRoot',
onClick: () => { onClick: () => {}
}
}, },
{ {
icon: <ArrowsAltOutlined/>, icon: <ArrowsAltOutlined />,
title: l('button.expand-all'), title: l('button.expand-all'),
key: 'button.expand-all', key: 'button.expand-all',
onClick: () => { onClick: () => {}
}
}, },
{ {
icon: <ShrinkOutlined/>, icon: <ShrinkOutlined />,
title: l('button.collapse-all'), title: l('button.collapse-all'),
key: 'button.collapse-all', key: 'button.collapse-all',
onClick: () => { onClick: () => {}
}
}, },
{ {
icon: <EnvironmentOutlined/>, icon: <EnvironmentOutlined />,
title: l('button.position'), title: l('button.position'),
key: 'button.position', key: 'button.position',
onClick: () => { onClick: () => {}
}
} }
] ]
}; };
......
...@@ -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
...@@ -66,7 +65,9 @@ export const renderWebUiRedirect = (record: Cluster.Instance) => { ...@@ -66,7 +65,9 @@ export const renderWebUiRedirect = (record: Cluster.Instance) => {
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>;
......
...@@ -25,5 +25,5 @@ export const enum ClusterType { ...@@ -25,5 +25,5 @@ export const enum ClusterType {
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))}
/> />
</> </>
) : ( ) : (
......
...@@ -21,19 +21,14 @@ import { ...@@ -21,19 +21,14 @@ import {
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>;
...@@ -50,7 +45,7 @@ const CodeEditProps = { ...@@ -50,7 +45,7 @@ const CodeEditProps = {
}; };
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 [dbType, setDbType] = useState<string>(values.type ?? 'MySQL');
...@@ -72,7 +67,7 @@ const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => { ...@@ -72,7 +67,7 @@ const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => {
name='name' name='name'
width={'md'} width={'md'}
label={l('rc.ds.name')} label={l('rc.ds.name')}
rules={[{required: true, message: l('rc.ds.namePlaceholder')}]} rules={[{ required: true, message: l('rc.ds.namePlaceholder') }]}
placeholder={l('rc.ds.namePlaceholder')} placeholder={l('rc.ds.namePlaceholder')}
/> />
<ProFormSelect <ProFormSelect
...@@ -89,7 +84,7 @@ const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => { ...@@ -89,7 +84,7 @@ const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => {
showSearch showSearch
initialValue={dbType} initialValue={dbType}
options={DATA_SOURCE_TYPE_OPTIONS} options={DATA_SOURCE_TYPE_OPTIONS}
rules={[{required: true, message: l('rc.ds.typePlaceholder')}]} rules={[{ required: true, message: l('rc.ds.typePlaceholder') }]}
placeholder={l('rc.ds.typePlaceholder')} placeholder={l('rc.ds.typePlaceholder')}
/> />
...@@ -97,7 +92,7 @@ const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => { ...@@ -97,7 +92,7 @@ const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => {
name='username' name='username'
width={'sm'} width={'sm'}
label={l('rc.ds.username')} label={l('rc.ds.username')}
rules={[{required: true, message: l('rc.ds.usernamePlaceholder')}]} rules={[{ required: true, message: l('rc.ds.usernamePlaceholder') }]}
placeholder={l('rc.ds.usernamePlaceholder')} placeholder={l('rc.ds.usernamePlaceholder')}
/> />
<ProFormText.Password <ProFormText.Password
...@@ -121,9 +116,11 @@ const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => { ...@@ -121,9 +116,11 @@ const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => {
</ProForm.Group> </ProForm.Group>
<ProForm.Group> <ProForm.Group>
<Form.Item name="url" label={l('rc.ds.url')} <Form.Item
rules={[{required: true, message: l('rc.ds.urlPlaceholder')}]}> name='url'
label={l('rc.ds.url')}
rules={[{ required: true, message: l('rc.ds.urlPlaceholder') }]}
>
<AutoComplete <AutoComplete
virtual virtual
placement={'topLeft'} placement={'topLeft'}
...@@ -133,9 +130,9 @@ const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => { ...@@ -133,9 +130,9 @@ const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => {
width: parent.innerWidth / 2 - 80 width: parent.innerWidth / 2 - 80
}} }}
filterOption filterOption
onSelect={(value) => form && form.setFieldsValue({url: value})} onSelect={(value) => form && form.setFieldsValue({ url: value })}
> >
<TextArea placeholder={l('rc.ds.urlPlaceholder')}/> <TextArea placeholder={l('rc.ds.urlPlaceholder')} />
{/*<ProFormTextArea*/} {/*<ProFormTextArea*/}
{/* name='url'*/} {/* name='url'*/}
{/* width={parent.innerWidth / 2 - 80}*/} {/* width={parent.innerWidth / 2 - 80}*/}
...@@ -145,7 +142,6 @@ const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => { ...@@ -145,7 +142,6 @@ const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => {
{/*/>*/} {/*/>*/}
</AutoComplete> </AutoComplete>
</Form.Item> </Form.Item>
</ProForm.Group> </ProForm.Group>
{!excludeFormItem && ( {!excludeFormItem && (
......
...@@ -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
......
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