Commit c3f77ec0 by zhaochengxiang

任务执行情况

parent c98f4530
......@@ -29,6 +29,7 @@ const EditTemplate = loadable(()=> import('./view/Manage/ModelConfig/Component/E
const AssetTree = loadable(()=> import('./view/Manage/AssetManage/Component/AssetManageTree'));
const DataMasterDefine = loadable(()=> import('./view/Manage/DataMaster/Define'));
const DataMasterManage = loadable(()=> import('./view/Manage/DataMaster/Manage'));
const MetadataHarvester = loadable(() => import('./view/Manage/MetadataHarvester'));
export class App extends React.Component {
constructor() {
......@@ -157,6 +158,7 @@ export class App extends React.Component {
<Route path={'/center-home/menu/asset-recycle'} component={AssetRecycle} exact />
<Route path={'/center-home/menu/msd-define'} component={DataMasterDefine} exact />
<Route path={'/center-home/menu/msd-manage'} component={DataMasterManage} exact />
<Route path={'/center-home/menu/metadata-harvester'} component={MetadataHarvester} exact />
<Route path={'/center-home/data-model-action'} component={EditModel} exact />
<Route path={'/center-home/asset-detail'} component={AssetDetailPage} exact />
</Switch>
......
......@@ -56,5 +56,6 @@ export async function unmount(props) {
}
export async function update(props) {
console.log('[data-govern] props update from main framework', props);
$hostParams.next(props?.data);
}
\ No newline at end of file
......@@ -47,6 +47,10 @@ export const routes = [
name: 'msd-manage',
text: '主数据管理'
},
{
name: 'metadata-harvester',
text: '采集任务管理'
},
]
}
];
......
{
"domainId": 1,
"domainName": "开发",
"options": null,
"label": "开发",
"title": "开发",
"key": "domain-1",
"value": 1,
"children": [
{
"catalogId": 1,
"catalogName": "风控",
"label": "风控",
"title": "风控",
"key": "catalog-1-1",
"value": 1,
"domain": 1,
"disabled": true,
"children": [
{
"scopeId": 4,
"scopeName": "新一代监察系统",
"catalog": 1,
"displayOrder": 4,
"admin": true,
"label": "新一代监察系统",
"title": "新一代监察系统",
"key": "system-4",
"value": 4,
"domainId": 1,
"prevnode": null,
"nextnode": {
"scopeId": 5,
"scopeName": "期权风控",
"owner": {
"domainId": 1,
"domainName": "开发",
"options": null
},
"catalog": null,
"displayOrder": 5,
"admin": true
}
},
{
"scopeId": 5,
"scopeName": "期权风控",
"catalog": 1,
"displayOrder": 5,
"admin": true,
"label": "期权风控",
"title": "期权风控",
"key": "system-5",
"value": 5,
"domainId": 1,
"prevnode": {
"scopeId": 4,
"scopeName": "新一代监察系统",
"owner": {
"domainId": 1,
"domainName": "开发",
"options": null
},
"catalog": null,
"displayOrder": 4,
"admin": true
},
"nextnode": {
"scopeId": 8,
"scopeName": "研究支持平台",
"owner": {
"domainId": 1,
"domainName": "开发",
"options": null
},
"catalog": null,
"displayOrder": 8,
"admin": true
}
},
{
"scopeId": 8,
"scopeName": "研究支持平台",
"catalog": 1,
"displayOrder": 8,
"admin": true,
"label": "研究支持平台",
"title": "研究支持平台",
"key": "system-8",
"value": 8,
"domainId": 1,
"prevnode": {
"scopeId": 5,
"scopeName": "期权风控",
"owner": {
"domainId": 1,
"domainName": "开发",
"options": null
},
"catalog": null,
"displayOrder": 5,
"admin": true
},
"nextnode": {
"scopeId": 11,
"scopeName": "测试系统",
"owner": {
"domainId": 822748082,
"domainName": "测试",
"options": null
},
"catalog": null,
"displayOrder": 11,
"admin": true
}
},
{
"scopeId": 40,
"scopeName": "测试12",
"catalog": 1,
"displayOrder": 40,
"admin": true,
"label": "测试12",
"title": "测试12",
"key": "system-40",
"value": 40,
"domainId": 1,
"prevnode": {
"scopeId": 30,
"scopeName": "人行金融基础数据",
"owner": {
"domainId": 26666984,
"domainName": "北京",
"options": {
"bgcolor": "#000000",
"fcolor": "#e7d7d7"
}
},
"catalog": null,
"displayOrder": 30,
"admin": true
},
"nextnode": null
}
]
},
{
"catalogId": 2,
"catalogName": "资管",
"label": "资管",
"title": "资管",
"key": "catalog-2-1",
"value": 2,
"domain": 1,
"disabled": true,
"children": [
{
"scopeId": 1,
"scopeName": "交易系统",
"catalog": 2,
"displayOrder": 1,
"admin": true,
"label": "交易系统",
"title": "交易系统",
"key": "system-1",
"value": 1,
"domainId": 1,
"prevnode": null,
"nextnode": {
"scopeId": 2,
"scopeName": "结算系统",
"owner": {
"domainId": 1,
"domainName": "开发",
"options": null
},
"catalog": null,
"displayOrder": 2,
"admin": true
}
},
{
"scopeId": 2,
"scopeName": "结算系统",
"catalog": 2,
"displayOrder": 2,
"admin": true,
"label": "结算系统",
"title": "结算系统",
"key": "system-2",
"value": 2,
"domainId": 1,
"prevnode": {
"scopeId": 1,
"scopeName": "交易系统",
"owner": {
"domainId": 1,
"domainName": "开发",
"options": null
},
"catalog": null,
"displayOrder": 1,
"admin": true
},
"nextnode": {
"scopeId": 6,
"scopeName": "中心数据库",
"owner": {
"domainId": 1,
"domainName": "开发",
"options": null
},
"catalog": null,
"displayOrder": 6,
"admin": true
}
},
{
"scopeId": 6,
"scopeName": "中心数据库",
"catalog": 2,
"displayOrder": 6,
"admin": true,
"label": "中心数据库",
"title": "中心数据库",
"key": "system-6",
"value": 6,
"domainId": 1,
"prevnode": {
"scopeId": 2,
"scopeName": "结算系统",
"owner": {
"domainId": 1,
"domainName": "开发",
"options": null
},
"catalog": null,
"displayOrder": 2,
"admin": true
},
"nextnode": {
"scopeId": 7,
"scopeName": "企业画像",
"owner": {
"domainId": 1,
"domainName": "开发",
"options": null
},
"catalog": null,
"displayOrder": 7,
"admin": true
}
},
{
"scopeId": 7,
"scopeName": "企业画像",
"catalog": 2,
"displayOrder": 7,
"admin": true,
"label": "企业画像",
"title": "企业画像",
"key": "system-7",
"value": 7,
"domainId": 1,
"prevnode": {
"scopeId": 6,
"scopeName": "中心数据库",
"owner": {
"domainId": 1,
"domainName": "开发",
"options": null
},
"catalog": null,
"displayOrder": 6,
"admin": true
},
"nextnode": {
"scopeId": 9,
"scopeName": "数据治理系统",
"owner": {
"domainId": 1,
"domainName": "开发",
"options": null
},
"catalog": null,
"displayOrder": 9,
"admin": true
}
},
{
"scopeId": 9,
"scopeName": "数据治理系统",
"catalog": 2,
"displayOrder": 9,
"admin": true,
"label": "数据治理系统",
"title": "数据治理系统",
"key": "system-9",
"value": 9,
"domainId": 1,
"prevnode": {
"scopeId": 7,
"scopeName": "企业画像",
"owner": {
"domainId": 1,
"domainName": "开发",
"options": null
},
"catalog": null,
"displayOrder": 7,
"admin": true
},
"nextnode": {
"scopeId": 15,
"scopeName": "数据治理系统",
"owner": {
"domainId": 822748082,
"domainName": "测试",
"options": null
},
"catalog": null,
"displayOrder": 15,
"admin": true
}
},
{
"scopeId": 39,
"scopeName": "88",
"catalog": 2,
"displayOrder": 39,
"admin": true,
"label": "88",
"title": "88",
"key": "system-39",
"value": 39,
"domainId": 1,
"prevnode": {
"scopeId": 15,
"scopeName": "数据治理系统",
"owner": {
"domainId": 822748082,
"domainName": "测试",
"options": null
},
"catalog": null,
"displayOrder": 15,
"admin": true
},
"nextnode": {
"scopeId": 41,
"scopeName": "智能舆情况分析系统",
"owner": {
"domainId": 1,
"domainName": "开发",
"options": null
},
"catalog": null,
"displayOrder": 41,
"admin": true
}
},
{
"scopeId": 41,
"scopeName": "智能舆情况分析系统",
"catalog": 2,
"displayOrder": 41,
"admin": true,
"label": "智能舆情况分析系统",
"title": "智能舆情况分析系统",
"key": "system-41",
"value": 41,
"domainId": 1,
"prevnode": {
"scopeId": 39,
"scopeName": "88",
"owner": {
"domainId": 1,
"domainName": "开发",
"options": null
},
"catalog": null,
"displayOrder": 39,
"admin": true
},
"nextnode": {
"scopeId": 42,
"scopeName": "人行金融基础数据",
"owner": {
"domainId": 1,
"domainName": "开发",
"options": null
},
"catalog": null,
"displayOrder": 42,
"admin": true
}
},
{
"scopeId": 42,
"scopeName": "人行金融基础数据",
"catalog": 2,
"displayOrder": 42,
"admin": true,
"label": "人行金融基础数据",
"title": "人行金融基础数据",
"key": "system-42",
"value": 42,
"domainId": 1,
"prevnode": {
"scopeId": 41,
"scopeName": "智能舆情况分析系统",
"owner": {
"domainId": 1,
"domainName": "开发",
"options": null
},
"catalog": null,
"displayOrder": 41,
"admin": true
},
"nextnode": null
}
]
},
{
"catalogId": 7,
"catalogName": "数仓",
"label": "数仓",
"title": "数仓",
"key": "catalog-7-1",
"value": 7,
"domain": 1,
"disabled": true,
"children": [
{
"scopeId": 25,
"scopeName": "指标系统",
"catalog": 7,
"displayOrder": 25,
"admin": true,
"label": "指标系统",
"title": "指标系统",
"key": "system-25",
"value": 25,
"domainId": 1,
"prevnode": {
"scopeId": 24,
"scopeName": "指标系统",
"owner": {
"domainId": 822748082,
"domainName": "测试",
"options": null
},
"catalog": null,
"displayOrder": 24,
"admin": true
},
"nextnode": {
"scopeId": 26,
"scopeName": "顾问系统",
"owner": {
"domainId": 1,
"domainName": "开发",
"options": null
},
"catalog": null,
"displayOrder": 26,
"admin": true
}
},
{
"scopeId": 26,
"scopeName": "顾问系统",
"catalog": 7,
"displayOrder": 26,
"admin": true,
"label": "顾问系统",
"title": "顾问系统",
"key": "system-26",
"value": 26,
"domainId": 1,
"prevnode": {
"scopeId": 25,
"scopeName": "指标系统",
"owner": {
"domainId": 1,
"domainName": "开发",
"options": null
},
"catalog": null,
"displayOrder": 25,
"admin": true
},
"nextnode": {
"scopeId": 27,
"scopeName": "顾问系统",
"owner": {
"domainId": 822748082,
"domainName": "测试",
"options": null
},
"catalog": null,
"displayOrder": 27,
"admin": true
}
}
]
}
]
}
\ No newline at end of file
import React, { useState, useEffect, useContext, useMemo } from 'react';
import { Space, DatePicker, Row, Col, Card, Table, Spin, Empty, Typography, Pagination, Input } from 'antd';
import 'moment/locale/zh-cn';
import locale from 'antd/es/date-picker/locale/zh_CN';
import { AppContext } from '../../../../App';
import { dispatch } from '../../../../model';
import { paginate } from '../../../../util';
// import env from '../../../../service/samples/env.json';
const { RangePicker } = DatePicker;
const { Meta } = Card;
function compare(val1, val2) {
var a = val1.seq;
var b = val2.seq;
return (a - b);
}
const FC = (props) => {
const { env } = useContext(AppContext);
const [rangeValue, setRangeValue] = useState(undefined);
const [datasources, setDatasources] = useState(undefined);
const [summaryData, setSummaryData] = useState(undefined);
const [reportData, setReportData] = useState(undefined);
const [tracerData, setTracerData] = useState(undefined);
const [loadingReport, setLoadingReport] = useState(false);
const [pagination, setPagination] = useState({pageNum: 1, pageSize: 20});
const [keyword, setKeyword] = useState(undefined);
const {pageNum, pageSize} = pagination;
const columns = useMemo(() => {
if (reportData) {
let newColumns = [...(reportData.title||[])];
newColumns.sort(compare);
newColumns.forEach(item => {
item.title = item.value||'';
item.dataIndex = item.name||'';
item.ellipsis = true;
});
newColumns = [{
title: '序号',
dataIndex: 'key',
render: (text, record, index) => {
return (index+1).toString();
},
width:80
}, ...newColumns];
return newColumns;
}
return [];
}, [reportData])
const tableData = useMemo(() => {
if (reportData) {
return paginate(reportData.datas, pageNum, pageSize);
}
return [];
}, [reportData, datasources, pageNum, pageSize])
const total = useMemo(() => {
if (reportData) {
return (reportData.datas||[]).length;
}
return 0;
}, [reportData])
useEffect(() => {
getTaskReportSummary();
getTaskReportDetail();
}, [env])
const getTaskReportSummary = () => {
dispatch({
type: 'datasource.getTaskReportSummary',
payload: {
namespace: env?.domainId,
startTime: (rangeValue||[]).length>0 ? rangeValue[0] : null,
endTime: (rangeValue||[]).length>1 ? rangeValue[1] : null
},
callback: data => {
data?.sort(compare);
setSummaryData(data);
}
})
}
const getTaskReportDetail = () => {
setLoadingReport(true);
dispatch({
type: 'datasource.getTaskReportDetail',
payload: {
namespace: env?.domainId,
params: 'READY,STARTED,FAILED,ENDED',
startTime: (rangeValue||[]).length>0 ? rangeValue[0] : null,
endTime: (rangeValue||[]).length>1 ? rangeValue[1] : null
},
callback: data => {
setReportData(data);
setLoadingReport(false);
},
error: () => {
setLoadingReport(false);
}
})
}
const getTaskTracer = (record) => {
dispatch({
type: 'datasource.getTaskTracerByStateId',
payload: {
taskStateId: record.taskStateId
},
callback: data => {
if (data) {
setTracerData(prevTracerData => {
return [...(prevTracerData||[]), {
id: record.taskStateId,
data
}];
});
}
}
});
}
const onTimeChange = (value, dateString) => {
if (!value) {
setRangeValue(undefined);
}
}
const onTimeOk = (value) => {
setRangeValue(value?.map(item => item.valueOf()));
}
const onSearchInputChange = (e) => {
setKeyword(e.target.value||'');
}
const onPaginationChange = (page,size) => {
setPagination({pageNum: page, pageSize: size });
}
return (
<div>
<div>
<Space>
<RangePicker
locale={locale}
showTime={{ format: 'HH:mm' }}
format='YYYY-MM-DD HH:mm'
onChange={onTimeChange}
onOk={onTimeOk}
/>
<Input
placeholder='请输入任务编号/数据库'
allowClear
value={keyword}
onChange={onSearchInputChange}
style={{ width: 250 }}
/>
</Space>
</div>
<Summary data={summaryData} />
<Table
className='mt-3'
loading={loadingReport}
columns={columns||[]}
rowKey='taskStateId'
dataSource={tableData||[]}
expandable={{
onExpand: (expanded, record) => {
if (expanded) {
getTaskTracer(record);
} else {
setTracerData(prevTracerData => {
const newTracerData = [...(prevTracerData||[])];
const index = newTracerData?.findIndex(item => item.id === record.taskStateId);
if (index !== -1) {
newTracerData.splice(index, 1);
}
return newTracerData;
})
}
},
expandedRowRender: record => {
const index = (tracerData||[]).findIndex(item => item.id === record.taskStateId);
let _tracer = null;
if (index !== -1) {
_tracer = tracerData[index].data;
}
return (
<Spin spinning={index===-1}>
{
(_tracer||[]).length === 0 ? <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description="暂无日志" />
: <React.Fragment>
{
_tracer?.map((_item, index) => {
return (
<Typography.Paragraph key={index} >
{_item.value||''}
</Typography.Paragraph>
)
})
}
</React.Fragment>
}
</Spin>
);
},
}}
pagination={false}
sticky
/>
<Pagination
size="small"
className="text-center m-3"
showSizeChanger
showQuickJumper
onChange={onPaginationChange}
onShowSizeChange={onPaginationChange}
current={pageNum}
pageSize={pageSize}
defaultCurrent={1}
total={total}
showTotal={total => `共 ${total} 条`}
/>
</div>
)
}
export default FC;
const Summary = ({ data }) => {
return (
<Row className='mt-5' gutter={20}>
{
data?.map((item, index) => {
return (
<Col key={index} span={6}>
<Card>
<Meta
title={
<div>
<span>{item.cnName}</span>
<span>{item.value||0}</span>
<span>{item.unit?`(${item.unit})`:''}</span>
</div>
}
/>
</Card>
</Col>
);
})
}
</Row>
)
}
\ No newline at end of file
import React, { useState } from 'react';
import { Tabs } from 'antd';
import TaskReport from './Component/TaskReport';
import './index.less';
const { TabPane } = Tabs;
const FC = (props) => {
const [tabKey, setTabKey] = useState('1');
const onTabChange = (key) => {
setTabKey(key);
}
return (
<div className='metadata-harvester'>
<Tabs activeKey={tabKey} onChange={onTabChange}>
<TabPane tab='采集任务' key='1'>
</TabPane>
<TabPane tab='任务执行情况' key='2'>
<TaskReport />
</TabPane>
</Tabs>
</div>
)
}
export default FC;
\ No newline at end of file
.metadata-harvester {
height: calc(100vh - 64px - 30px);
padding: 20px;
background: #fff;
overflow: auto;
}
\ No newline at end of file
......@@ -14,6 +14,7 @@ import AssetBrowse from './AssetBrowse';
import AssetRecycle from './AssetRecycle';
import DataMasterDefine from "./DataMaster/Define";
import DataMasterManage from "./DataMaster/Manage";
import MetadataHarvester from './MetadataHarvester';
class Manage extends Component {
......@@ -37,6 +38,7 @@ class Manage extends Component {
<Route path={`${match.path}/asset-recycle`} component={AssetRecycle} />
<Route path={`${match.path}/msd-define`} component={DataMasterDefine} />
<Route path={`${match.path}/msd-manage`} component={DataMasterManage} />
<Route path={`${match.path}/metadata-harvester`} component={MetadataHarvester} />
</Switch>
) : (
<GetSession {...this.props} />
......
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