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;
public class TreeNodeDTO {
@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")
private String name;
......@@ -61,7 +61,7 @@ public class TreeNodeDTO {
dataType = "Integer",
example = "0",
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")
private Long size;
......@@ -101,4 +101,14 @@ public class TreeNodeDTO {
this.children = children;
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', '
- **Alert Time :** ${time}
- **Start Time :** ${startTime}
- **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})
', 1, null, null);
import { queryDataByParams } from '@/services/BusinessCrud';
export function getConsoleData() {
// return queryDataByParams('api/process/getConsoleByUserId');
}
import {TagAlignLeft} from '@/components/StyledComponents';
import {BtnRoute} from '@/pages/DataStudio/route';
import { TagAlignLeft } from '@/components/StyledComponents';
import { BtnRoute } from '@/pages/DataStudio/route';
import SchemaTree from '@/pages/RegCenter/DataSource/components/DataSourceDetail/SchemaTree';
import {DataSources} from '@/types/RegCenter/data';
import {l} from '@/utils/intl';
import {DatabaseOutlined, TableOutlined} from '@ant-design/icons';
import {Key, ProForm, ProFormSelect} from '@ant-design/pro-components';
import {connect} from '@umijs/max';
import {Spin, Tag} from 'antd';
import React, {useEffect, useState} from 'react';
import {StateType, STUDIO_MODEL} from '../../model';
import {clearMetaDataTable, getDataBase, showMetaDataTable} from './service';
import DataSourceModal from "@/pages/RegCenter/DataSource/components/DataSourceModal";
import {handleTest, saveOrUpdateHandle} from "@/pages/RegCenter/DataSource/service";
import DataSourceModal from '@/pages/RegCenter/DataSource/components/DataSourceModal';
import { handleTest, saveOrUpdateHandle } from '@/pages/RegCenter/DataSource/service';
import { DataSources } from '@/types/RegCenter/data';
import { l } from '@/utils/intl';
import { DatabaseOutlined, TableOutlined } from '@ant-design/icons';
import { Key, ProForm, ProFormSelect } from '@ant-design/pro-components';
import { connect } from '@umijs/max';
import { Spin, Tag } from 'antd';
import { useEffect, useState } from 'react';
import { StateType, STUDIO_MODEL } from '../../model';
import { clearMetaDataTable, getDataBase, showMetaDataTable } from './service';
const MetaData = (props: any) => {
const {
dispatch,
toolContentHeight,
database: {dbData, selectDatabaseId, expandKeys, selectKeys}
database: { dbData, selectDatabaseId, expandKeys, selectKeys }
} = props;
const [treeData, setTreeData] = useState<[]>([]);
const [isLoadingDatabase, setIsLoadingDatabase] = useState(false);
......@@ -41,12 +41,12 @@ const MetaData = (props: any) => {
for (let table of tables) {
table.title = table.name;
table.key = table.name;
table.icon = <DatabaseOutlined/>;
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.icon = <TableOutlined />;
child.isLeaf = true;
child.schema = table.name;
child.table = child.name;
......@@ -70,7 +70,7 @@ const MetaData = (props: any) => {
};
BtnRoute['menu.datastudio.metadata'][0].onClick = () => {
setShowCreate(true)
setShowCreate(true);
};
BtnRoute['menu.datastudio.metadata'][1].onClick = () => {
if (!selectDatabaseId) return;
......@@ -84,7 +84,7 @@ const MetaData = (props: any) => {
* 构建数据库列表 下拉框
*/
const getDataBaseOptions = () => {
return dbData.map(({id, name, type, enabled, status}: DataSources.DataSource) => ({
return dbData.map(({ id, name, type, enabled, status }: DataSources.DataSource) => ({
key: id,
value: id,
label: (
......@@ -112,14 +112,14 @@ const MetaData = (props: any) => {
});
const {
node: {isLeaf, parentId: schemaName, name: tableName, fullInfo}
node: { isLeaf, parentId: schemaName, name: tableName, fullInfo }
} = info;
if (!isLeaf) {
return;
}
const queryParams = {id: selectDatabaseId, schemaName, tableName};
const queryParams = { id: selectDatabaseId, schemaName, tableName };
dispatch({
type: STUDIO_MODEL.addTab,
payload: {
......@@ -127,7 +127,7 @@ const MetaData = (props: any) => {
id: selectDatabaseId + schemaName + tableName,
breadcrumbLabel: [selectDb.type, selectDb.name].join('/'),
label: schemaName + '.' + tableName,
params: {queryParams: queryParams, tableInfo: fullInfo},
params: { queryParams: queryParams, tableInfo: fullInfo },
type: 'metadata'
}
});
......@@ -173,12 +173,12 @@ const MetaData = (props: any) => {
}}
/>
<ProForm
style={{height: 40}}
initialValues={{selectDb: selectDatabaseId}}
style={{ height: 40 }}
initialValues={{ selectDb: selectDatabaseId }}
submitter={false}
>
<ProFormSelect
style={{paddingInline: 6}}
style={{ paddingInline: 6 }}
// width={leftContainer.width }
width={'xl'}
// addonAfter={<ReloadOutlined spin={isLoadingDatabase} title={l('button.refresh')} onClick={() => refreshDataBase()} />}
......@@ -194,7 +194,7 @@ const MetaData = (props: any) => {
<SchemaTree
selectKeys={selectKeys}
expandKeys={expandKeys}
style={{height: toolContentHeight - 64 - 20}}
style={{ height: toolContentHeight - 64 - 20 }}
onNodeClick={handleTreeNodeClick}
treeData={treeData}
onExpand={handleTreeExpand}
......@@ -203,9 +203,7 @@ const MetaData = (props: any) => {
);
};
export default connect(({Studio}: {
Studio: StateType
}) => ({
export default connect(({ Studio }: { Studio: StateType }) => ({
toolContentHeight: Studio.toolContentHeight,
leftContainer: Studio.leftContainer,
database: Studio.database
......
......@@ -17,21 +17,21 @@
*
*/
import {CircleDataStudioButtonProps} from '@/components/CallBackButton/CircleBtn';
import { CircleDataStudioButtonProps } from '@/components/CallBackButton/CircleBtn';
import Console from '@/pages/DataStudio/BottomContainer/Console';
import Lineage from '@/pages/DataStudio/BottomContainer/Lineage';
import Result from '@/pages/DataStudio/BottomContainer/Result';
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 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 HistoryVersion from '@/pages/DataStudio/RightContainer/HistoryVersion';
import JobConfig from '@/pages/DataStudio/RightContainer/JobConfig';
import JobInfo from '@/pages/DataStudio/RightContainer/JobInfo';
import SavePoints from '@/pages/DataStudio/RightContainer/SavePoints';
import {l} from '@/utils/intl';
import { l } from '@/utils/intl';
import {
ApartmentOutlined,
ArrowsAltOutlined,
......@@ -46,7 +46,8 @@ import {
InfoCircleOutlined,
MonitorOutlined,
PlayCircleOutlined,
PlusCircleOutlined, PlusOutlined,
PlusCircleOutlined,
PlusOutlined,
ReloadOutlined,
RightSquareOutlined,
SettingOutlined,
......@@ -54,30 +55,30 @@ import {
TableOutlined,
ToolOutlined
} from '@ant-design/icons';
import {DiffEditor} from '@monaco-editor/react';
import {ReactNode} from 'react';
import { DiffEditor } from '@monaco-editor/react';
import { ReactNode } from 'react';
export const LeftSide = [
{
auth: '/datastudio/left/project',
key: 'menu.datastudio.project',
icon: <ConsoleSqlOutlined/>,
icon: <ConsoleSqlOutlined />,
label: l('menu.datastudio.project'),
children: <Project/>
children: <Project />
},
{
auth: '/datastudio/left/catalog',
key: 'menu.datastudio.catalog',
icon: <TableOutlined/>,
icon: <TableOutlined />,
label: l('menu.datastudio.catalog'),
children: <Catalog/>
children: <Catalog />
},
{
auth: '/datastudio/left/metadata',
key: 'menu.datastudio.metadata',
icon: <DatabaseOutlined/>,
icon: <DatabaseOutlined />,
label: l('menu.datastudio.metadata'),
children: <MetaData/>
children: <MetaData />
}
];
......@@ -85,41 +86,41 @@ export const RightSide: TabProp[] = [
{
auth: '/datastudio/right/jobConfig',
key: 'menu.datastudio.jobConfig',
icon: <SettingOutlined/>,
icon: <SettingOutlined />,
label: l('menu.datastudio.jobConfig'),
children: <JobConfig/>,
children: <JobConfig />,
isShow: (type, subType) => type === TabsPageType.project && TabsPageSubType.flinkSql === subType
},
{
auth: '/datastudio/right/executeConfig',
key: 'menu.datastudio.executeConfig',
icon: <PlayCircleOutlined/>,
icon: <PlayCircleOutlined />,
label: l('menu.datastudio.executeConfig'),
children: <ExecuteConfig/>,
children: <ExecuteConfig />,
isShow: (type, subType) => type === TabsPageType.project && TabsPageSubType.flinkSql === subType
},
{
auth: '/datastudio/right/savePoint',
key: 'menu.datastudio.savePoint',
icon: <FolderOutlined/>,
icon: <FolderOutlined />,
label: l('menu.datastudio.savePoint'),
children: <SavePoints/>,
children: <SavePoints />,
isShow: (type, subType) => type === TabsPageType.project && TabsPageSubType.flinkSql === subType
},
{
auth: '/datastudio/right/historyVision',
key: 'menu.datastudio.historyVision',
icon: <HistoryOutlined/>,
icon: <HistoryOutlined />,
label: l('menu.datastudio.historyVision'),
children: <HistoryVersion/>,
children: <HistoryVersion />,
isShow: (type, subType) => type === TabsPageType.project && TabsPageSubType.flinkSql === subType
},
{
auth: '/datastudio/right/jobInfo',
key: 'menu.datastudio.jobInfo',
icon: <InfoCircleOutlined/>,
icon: <InfoCircleOutlined />,
label: l('menu.datastudio.jobInfo'),
children: <JobInfo/>,
children: <JobInfo />,
isShow: (type) => type !== TabsPageType.None
}
];
......@@ -128,53 +129,53 @@ export const LeftBottomSide = [
{
auth: '/datastudio/bottom/console',
key: 'menu.datastudio.console',
icon: <RightSquareOutlined/>,
icon: <RightSquareOutlined />,
label: l('menu.datastudio.console'),
children: <Console/>
children: <Console />
},
{
auth: '/datastudio/bottom/result',
key: 'menu.datastudio.result',
icon: <MonitorOutlined/>,
icon: <MonitorOutlined />,
label: l('menu.datastudio.result'),
children: <Result/>
children: <Result />
},
{
auth: '/datastudio/bottom/bi',
key: 'menu.datastudio.bi',
icon: <BarChartOutlined/>,
icon: <BarChartOutlined />,
label: l('menu.datastudio.bi')
},
{
auth: '/datastudio/bottom/lineage',
key: 'menu.datastudio.lineage',
icon: <ApartmentOutlined/>,
icon: <ApartmentOutlined />,
label: l('menu.datastudio.lineage'),
children: <Lineage/>
children: <Lineage />
},
{
auth: '/datastudio/bottom/process',
key: 'menu.datastudio.process',
icon: <DesktopOutlined/>,
icon: <DesktopOutlined />,
label: l('menu.datastudio.process')
},
{
auth: '/datastudio/bottom/history',
key: 'menu.datastudio.history',
icon: <CalendarOutlined/>,
icon: <CalendarOutlined />,
label: l('menu.datastudio.history')
},
{
auth: '/datastudio/bottom/table-data',
key: 'menu.datastudio.table-data',
icon: <TableOutlined/>,
icon: <TableOutlined />,
label: l('menu.datastudio.table-data'),
children: <TableData/>
children: <TableData />
},
{
auth: '/datastudio/bottom/tool',
key: 'menu.datastudio.tool',
icon: <ToolOutlined/>,
icon: <ToolOutlined />,
label: l('menu.datastudio.tool')
}
];
......@@ -183,7 +184,7 @@ export const LeftBottomMoreTabs: { [c: string]: TabProp[] } = {
'menu.datastudio.tool': [
{
key: 'menu.datastudio.tool.text-comparison',
icon: <ToolOutlined/>,
icon: <ToolOutlined />,
label: l('menu.datastudio.tool.text-comparison'),
children: (
<DiffEditor
......@@ -209,7 +210,7 @@ export const LeftBottomMoreTabs: { [c: string]: TabProp[] } = {
},
{
key: 'menu.datastudio.tool.datax2',
icon: <ToolOutlined/>,
icon: <ToolOutlined />,
label: 'menu.datastudio.tool.datax2',
children: <div>datax2</div>
}
......@@ -217,7 +218,7 @@ export const LeftBottomMoreTabs: { [c: string]: TabProp[] } = {
'menu.datastudio.tool2': [
{
key: 'menu.datastudio.tool.text-comparison',
icon: <ToolOutlined/>,
icon: <ToolOutlined />,
label: 'menu.datastudio.tool.text-comparison',
children: (
<DiffEditor
......@@ -237,7 +238,7 @@ export const LeftBottomMoreTabs: { [c: string]: TabProp[] } = {
},
{
key: 'menu.datastudio.tool.datax2',
icon: <ToolOutlined/>,
icon: <ToolOutlined />,
label: 'menu.datastudio.tool.datax2',
children: <div>datax2</div>
}
......@@ -250,52 +251,45 @@ export const BtnRoute: { [c: string]: CircleDataStudioButtonProps[] } = {
{
icon: <PlusOutlined />,
title: l('button.create'),
onClick: () => {
}
onClick: () => {}
},
{
icon: <ReloadOutlined/>,
icon: <ReloadOutlined />,
title: l('button.refresh'),
onClick: () => {
}
onClick: () => {}
}
],
'menu.datastudio.catalog': [
{
icon: <ReloadOutlined/>,
icon: <ReloadOutlined />,
title: l('button.refresh'),
onClick: () => {
}
onClick: () => {}
}
],
'menu.datastudio.project': [
{
icon: <PlusCircleOutlined/>,
icon: <PlusCircleOutlined />,
title: l('right.menu.createRoot'),
key: 'right.menu.createRoot',
onClick: () => {
}
onClick: () => {}
},
{
icon: <ArrowsAltOutlined/>,
icon: <ArrowsAltOutlined />,
title: l('button.expand-all'),
key: 'button.expand-all',
onClick: () => {
}
onClick: () => {}
},
{
icon: <ShrinkOutlined/>,
icon: <ShrinkOutlined />,
title: l('button.collapse-all'),
key: 'button.collapse-all',
onClick: () => {
}
onClick: () => {}
},
{
icon: <EnvironmentOutlined/>,
icon: <EnvironmentOutlined />,
title: l('button.position'),
key: 'button.position',
onClick: () => {
}
onClick: () => {}
}
]
};
......
......@@ -21,7 +21,10 @@ const JobList = () => {
const jobListColumns: ProColumns<Jobs.JobInstance>[] = [
{
title: l('devops.jobinfo.config.taskId'),
dataIndex: 'taskId'
dataIndex: 'taskId',
width: '6%',
valueType: 'indexBorder',
fixed: 'left'
},
{
title: l('global.table.jobname'),
......@@ -43,7 +46,8 @@ const JobList = () => {
{
title: l('devops.jobinfo.config.JobId'),
dataIndex: 'jid',
width: '15%'
width: '20%',
copyable: true
},
{
title: l('global.table.createTime'),
......@@ -67,6 +71,8 @@ const JobList = () => {
{
title: l('global.table.operate'),
valueType: 'option',
width: '5%',
fixed: 'right',
render: (text: any, record: Jobs.JobInstance) => [
<Button
className={'options-button'}
......
......@@ -305,7 +305,13 @@ export default () => {
<Badge.Ribbon
className={'card-list-item-wrapper'}
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
headStyle={{ minHeight: '10px' }}
......
......@@ -17,14 +17,13 @@
*
*/
import {WebIcon} from '@/components/Icons/CustomIcons';
import {RUN_MODE} from '@/services/constants';
import {Cluster} from '@/types/RegCenter/data';
import {l} from '@/utils/intl';
import {Button, Typography} from 'antd';
import {RuleObject} from 'rc-field-form/es/interface';
import { RUN_MODE } from '@/services/constants';
import { Cluster } from '@/types/RegCenter/data';
import { l } from '@/utils/intl';
import { Typography } from 'antd';
import { RuleObject } from 'rc-field-form/es/interface';
const {Text, Paragraph, Link} = Typography;
const { Text, Paragraph, Link } = Typography;
/**
* validatorJMHAAdderess
......@@ -66,7 +65,9 @@ export const renderWebUiRedirect = (record: Cluster.Instance) => {
href={`/api/flink/${record.jobManagerHost}/#/overview`}
key={`${record.id}_webui`}
target='_blank'
>{record.jobManagerHost}</Link>
>
{record.jobManagerHost}
</Link>
);
}
return <Link>{record.hosts}</Link>;
......
......@@ -25,5 +25,5 @@ export const enum ClusterType {
KUBERNETES_NATIVE = 'kubernetes-application',
KUBERNETES_OPERATOR = 'kubernetes-application-operator',
YARN_APPLICATION = 'yarn-application',
LOACL= 'local',
LOACL = 'local'
}
......@@ -24,9 +24,9 @@ import { Authorized, HasAuthority } from '@/hooks/useAccess';
import { StateType, STUDIO_MODEL } from '@/pages/DataStudio/model';
import DataSourceDetail from '@/pages/RegCenter/DataSource/components/DataSourceDetail';
import { renderDBIcon } from '@/pages/RegCenter/DataSource/components/function';
import { handleTest, saveOrUpdateHandle } from '@/pages/RegCenter/DataSource/service';
import { queryList } from '@/services/api';
import {
handleAddOrUpdate,
handleOption,
handlePutDataByParams,
handleRemoveById,
......@@ -37,7 +37,7 @@ import { API_CONSTANTS } from '@/services/endpoints';
import { DataSources } from '@/types/RegCenter/data.d';
import { l } from '@/utils/intl';
import { WarningMessage } from '@/utils/messages';
import {useNavigate} from '@@/exports';
import { useNavigate } from '@@/exports';
import {
CheckCircleOutlined,
CopyTwoTone,
......@@ -50,7 +50,6 @@ import DescriptionsItem from 'antd/es/descriptions/Item';
import React, { useEffect, useState } from 'react';
import { connect } from 'umi';
import DataSourceModal from '../DataSourceModal';
import {handleTest, saveOrUpdateHandle} from "@/pages/RegCenter/DataSource/service";
const DataSourceTable: React.FC<connect & StateType> = (props) => {
const { dispatch } = props;
......@@ -118,8 +117,6 @@ const DataSourceTable: React.FC<connect & StateType> = (props) => {
);
};
/**
* handle check heart
* @param item
......@@ -138,8 +135,6 @@ const DataSourceTable: React.FC<connect & StateType> = (props) => {
);
};
/**
* render sub title
* @param item
......@@ -290,7 +285,7 @@ const DataSourceTable: React.FC<connect & StateType> = (props) => {
visible={modalVisible}
onCancel={cancelAll}
onTest={(value) => handleTest(value)}
onSubmit={(value) => executeAndCallbackRefresh(async ()=>saveOrUpdateHandle(value))}
onSubmit={(value) => executeAndCallbackRefresh(async () => saveOrUpdateHandle(value))}
/>
</>
) : (
......
......@@ -21,19 +21,14 @@ import {
DATA_SOURCE_TYPE_OPTIONS,
GROUP_TYPE
} from '@/pages/RegCenter/DataSource/components/constants';
import {DataSources} from '@/types/RegCenter/data.d';
import {l} from '@/utils/intl';
import {
ProForm,
ProFormGroup,
ProFormSelect,
ProFormText
} from '@ant-design/pro-components';
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";
import { DataSources } from '@/types/RegCenter/data.d';
import { l } from '@/utils/intl';
import { ProForm, ProFormGroup, ProFormSelect, ProFormText } from '@ant-design/pro-components';
import { AutoComplete, Form } from 'antd';
import { FormInstance } from 'antd/es/form/hooks/useForm';
import TextArea from 'antd/es/input/TextArea';
import { Values } from 'async-validator';
import React, { useState } from 'react';
type DataSourceProFormProps = {
values: Partial<DataSources.DataSource>;
......@@ -50,7 +45,7 @@ const CodeEditProps = {
};
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 [dbType, setDbType] = useState<string>(values.type ?? 'MySQL');
......@@ -72,7 +67,7 @@ const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => {
name='name'
width={'md'}
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')}
/>
<ProFormSelect
......@@ -89,7 +84,7 @@ const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => {
showSearch
initialValue={dbType}
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')}
/>
......@@ -97,7 +92,7 @@ const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => {
name='username'
width={'sm'}
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')}
/>
<ProFormText.Password
......@@ -121,9 +116,11 @@ const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => {
</ProForm.Group>
<ProForm.Group>
<Form.Item name="url" label={l('rc.ds.url')}
rules={[{required: true, message: l('rc.ds.urlPlaceholder')}]}>
<Form.Item
name='url'
label={l('rc.ds.url')}
rules={[{ required: true, message: l('rc.ds.urlPlaceholder') }]}
>
<AutoComplete
virtual
placement={'topLeft'}
......@@ -133,9 +130,9 @@ const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => {
width: parent.innerWidth / 2 - 80
}}
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*/}
{/* name='url'*/}
{/* width={parent.innerWidth / 2 - 80}*/}
......@@ -145,7 +142,6 @@ const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => {
{/*/>*/}
</AutoComplete>
</Form.Item>
</ProForm.Group>
{!excludeFormItem && (
......
......@@ -59,7 +59,7 @@ const DataSourceModal: React.FC<DataSourceModalProps> = (props) => {
useEffect(() => {
if (!visible) {
form.resetFields();
}else {
} else {
form.setFieldsValue(values);
}
}, [visible, values]);
......
import {DataSources} from "@/types/RegCenter/data";
import {API_CONSTANTS} from "@/services/endpoints";
import {handleAddOrUpdate, handleOption} from "@/services/BusinessCrud";
import {l} from "@/utils/intl";
import { handleAddOrUpdate, handleOption } from '@/services/BusinessCrud';
import { API_CONSTANTS } from '@/services/endpoints';
import { DataSources } from '@/types/RegCenter/data';
import { l } from '@/utils/intl';
/**
* 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 @@
*
*/
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 { UploadOutlined } from '@ant-design/icons';
import { Button, Tree, Typography, Upload } from 'antd';
......@@ -27,7 +28,7 @@ const { DirectoryTree } = Tree;
const { Text } = Typography;
type FileTreeProps = {
treeData: Partial<any>[];
treeData: Resource[];
onNodeClick: (info: any) => void;
onRightClick: (info: any) => void;
selectedKeys: string[];
......@@ -45,7 +46,7 @@ const FileTree: React.FC<FileTreeProps> = (props) => {
selectedKeys={selectedKeys}
onSelect={(_, info) => onNodeClick(info)}
onRightClick={(info) => onRightClick(info)}
treeData={buildTreeData(treeData)}
treeData={buildResourceTreeData(treeData)}
/>
) : (
<>
......
......@@ -26,6 +26,7 @@ import ResourceModal from '@/pages/RegCenter/Resource/components/ResourceModal';
import ResourcesUploadModal from '@/pages/RegCenter/Resource/components/ResourcesUploadModal';
import { handleOption, handleRemoveById, queryDataByParams } from '@/services/BusinessCrud';
import { API_CONSTANTS } from '@/services/endpoints';
import { Resource } from '@/types/RegCenter/data';
import { InitResourceState } from '@/types/RegCenter/init.d';
import { ResourceState } from '@/types/RegCenter/state.d';
import { ProCard } from '@ant-design/pro-components';
......@@ -33,13 +34,6 @@ import { MenuInfo } from 'rc-menu/es/interface';
import { Resizable } from 're-resizable';
import React, { useCallback, useEffect, useState } from 'react';
export type Resource = {
id: number;
fileName: string;
description: string;
type?: string;
};
const ResourceOverView: React.FC = () => {
const [resourceState, setResourceState] = useState<ResourceState>(InitResourceState);
......@@ -66,7 +60,7 @@ const ResourceOverView: React.FC = () => {
});
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) => ({
...prevState,
treeData: updateTreeData(prevState.treeData, path, data ?? [])
......@@ -74,7 +68,7 @@ const ResourceOverView: React.FC = () => {
};
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 ?? [] }))
);
};
......
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 @@
* 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 React from 'react';
type LogsTreeProps = {
treeData: Partial<any>[];
treeData: LogInfo[];
onNodeClick: (info: any) => void;
};
......@@ -34,7 +35,7 @@ const LogsTree: React.FC<LogsTreeProps> = (props) => {
{treeData.length > 0 ? (
<DirectoryTree
onSelect={(_, info) => onNodeClick(info)}
treeData={buildTreeData(treeData)}
treeData={buildLogInfoTreeData(treeData)}
/>
) : (
<Empty className={'code-content-empty'} />
......
......@@ -19,17 +19,18 @@ import LogsShow from '@/pages/SettingCenter/SystemLogs/TagInfo/LogList/LogsShow'
import LogsTree from '@/pages/SettingCenter/SystemLogs/TagInfo/LogList/LogsTree';
import { queryDataByParams } from '@/services/BusinessCrud';
import { API_CONSTANTS } from '@/services/endpoints';
import { LogInfo } from '@/types/SettingCenter/data';
import { ProCard } from '@ant-design/pro-components';
import { useEffect, useState } from 'react';
const LogList = () => {
const [treeData, setTreeData] = useState<Partial<any>[]>([]);
const [treeData, setTreeData] = useState<LogInfo[]>([]);
const [log, setLog] = useState<string>('');
const [clickFileName, setClickFileName] = useState<any>();
const queryLogList = async () => {
await queryDataByParams(API_CONSTANTS.SYSTEM_ROOT_LOG_LIST).then((res) => {
setTreeData(res);
await queryDataByParams<LogInfo[]>(API_CONSTANTS.SYSTEM_ROOT_LOG_LIST).then((res) => {
setTreeData(res ?? []);
});
};
......@@ -37,7 +38,7 @@ const LogList = () => {
await queryDataByParams(API_CONSTANTS.SYSTEM_ROOT_LOG_READ, {
path: fileName
}).then((res) => {
setLog(res);
setLog(res as string);
});
};
......@@ -61,11 +62,12 @@ const LogList = () => {
return (
<>
<ProCard ghost>
<ProCard ghost colSpan={'18%'} className={'siderTree'}>
<ProCard ghost bordered>
<ProCard ghost hoverable bordered colSpan={'18%'} className={'siderTree'}>
<LogsTree treeData={treeData} onNodeClick={(info: any) => handleNodeClick(info)} />
</ProCard>
<ProCard ghost>
<ProCard.Divider type={'vertical'} />
<ProCard ghost hoverable bordered>
<LogsShow code={log} refreshLogCallback={() => refreshLogByClickNode()} />
</ProCard>
</ProCard>
......
......@@ -232,7 +232,7 @@ export const handlePutData = 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);
try {
const { code, msg } = await putDataJson(url, { ...fields });
......
......@@ -220,3 +220,19 @@ export type UDFTemplate = BaseBeanColumns & {
functionType: 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 {
* resource state
*/
export interface ResourceState {
treeData: any[];
treeData: Resource[];
content: string;
clickedNode: any;
rightClickedNode: any;
......
......@@ -77,3 +77,15 @@ export type BaseConfigProperties = {
frontType: 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
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
* @returns {boolean}
......
......@@ -1381,7 +1381,7 @@ INSERT INTO dinky_alert_template VALUES (1, 'Default', '
- **Alert Time :** ${time}
- **Start Time :** ${startTime}
- **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})
', 1, null, null);
......
......@@ -2437,7 +2437,7 @@ INSERT INTO public.dinky_alert_template VALUES (1, 'Default', '
- **Alert Time :** ${time}
- **Start Time :** ${startTime}
- **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})
', 1, null, null);
......
......@@ -225,7 +225,7 @@ INSERT INTO dinky_alert_template VALUES (1, 'Default', '
- **Alert Time :** ${time}
- **Start Time :** ${startTime}
- **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})
', 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