Commit 5df3a06b by zhaochengxiang

服务目录统计

parent 17ff7421
......@@ -9,10 +9,18 @@ export function* loadDataServiceCatalog() {
return yield call(pds.loadDataServiceCatalog)
}
export function* loadDataServiceCatalogServiceCount() {
return yield call(pds.loadDataServiceCatalogServiceCount)
}
export function* loadStateCatalog(payload) {
return yield call(pds.loadStateCatalog, payload);
}
export function* loadDataServiceStateCatalogServiceCount() {
return yield call(pds.loadDataServiceStateCatalogServiceCount)
}
export function* saveCatalog(payload) {
return yield call(pds.saveCatalog, payload);
}
......
......@@ -9,10 +9,18 @@ export function loadDataServiceCatalog() {
return GetJSON("/pdataservice/pdsCURD/loadDataServiceCatalog");
}
export function loadDataServiceCatalogServiceCount() {
return GetJSON("/pdataservice/pdsCURD/loadDataServiceCatalogServiceCount");
}
export function loadStateCatalog(payload) {
return GetJSON("/pdataservice/pdsCURD/loadDataServiceStateCatalog", payload)
}
export function loadDataServiceStateCatalogServiceCount() {
return GetJSON("/pdataservice/pdsCURD/loadDataServiceStateCatalogServiceCount");
}
export function saveCatalog(payload) {
return PostJSON("/pdataservice/pdsCURD/saveDataServiceCatalog", payload)
}
......
import React, { useState, useEffect, useContext } from "react";
import React, { useState, useEffect, useContext, useMemo } from "react";
import { Tooltip, Tree, Modal, Spin, Dropdown, Menu, Button, AutoComplete } from "antd";
import { PlusOutlined, SwapOutlined, ImportOutlined, UnorderedListOutlined, ReloadOutlined } from '@ant-design/icons';
import classnames from 'classnames';
......@@ -57,6 +57,8 @@ const ModelTree = (props) => {
const [ dataList, setDataList ] = useState([]);
const [options, setOptions] = useState([]);
const [serviceCountMapping, setServiceCountMapping] = useState();
const [modal, contextHolder] = Modal.useModal();
const timestamp = getQueryParam(AnchorTimestamp, props.location?.search||'');
......@@ -106,6 +108,10 @@ const ModelTree = (props) => {
//eslint-disable-next-line react-hooks/exhaustive-deps
}, [ keyword ])
useEffect(() => {
getServiceCount()
}, [viewSelectedKey])
// const getShowSyncAndDomains = () => {
// dispatch({
// type: 'datamodel.isSetRootDomainId',
......@@ -125,6 +131,28 @@ const ModelTree = (props) => {
// });
// }
const getServiceCount = () => {
dispatch({
type: (viewSelectedKey==='dir') ? 'pds.loadDataServiceCatalogServiceCount': 'pds.loadDataServiceStateCatalogServiceCount',
callback: data => {
if (viewSelectedKey === 'dir') {
let newData = {}
for (const key in (data||{})) {
let total = 0
const item = data[key]
for (const id in item) {
total = total + item[id]??0
}
newData[key] = total
}
setServiceCountMapping(newData)
} else {
setServiceCountMapping(data)
}
}
});
}
const getDataModelLocationThenGetDirTreeData = () => {
setLoading(true);
dispatch({
......@@ -599,7 +627,16 @@ const ModelTree = (props) => {
treeData={treeData}
selectedKeys={[item?item.key:'']}
titleRender={(nodeData) => {
return <span title={nodeData?.remark||''} className='cursor-pointer-contextmenu'>{(nodeData.status===-1)?`${nodeData?.name}_已停用`:nodeData?.name||''}</span>;
let title = nodeData?.name
if (nodeData.status === -1) {
title = `${title}_已停用`
}
if (serviceCountMapping?.[nodeData.id] !== null && serviceCountMapping?.[nodeData.id] !== undefined) {
title = `${title} (${serviceCountMapping?.[nodeData.id]})`
}
return <span title={nodeData?.remark||''} className='cursor-pointer-contextmenu'>{title}</span>;
}}
onRightClick={({event, node}) => {
if (viewSelectedKey==='dir') {
......
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