Skip to content

Commit

Permalink
Merge branch 'master' into fix/ci
Browse files Browse the repository at this point in the history
  • Loading branch information
Aarebecca committed Jul 12, 2023
2 parents 164e17d + 027aebc commit a3d7d87
Show file tree
Hide file tree
Showing 61 changed files with 1,773 additions and 1,007 deletions.
42 changes: 42 additions & 0 deletions packages/gi-assets-algorithm/.must.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// more config: http://gitlab.alibaba-inc.com/parrot/parrot-tool-must/blob/master/doc/config.md
module.exports = {
extract: {
name: 'gi-assets-algorithm',
sourcePath: 'src',
fileType: 'ts',
prettier: true,
macro: {
path: 'src/i18n',
method: '$i18n.get({id:"$key$",dm:"$defaultMessage$"})',
import: 'import $i18n from "src/i18n"',
keySplitter: '.',
placeholder: variable => {
return `{${variable}}`;
},
dependencies: ['@aligov/global-locale', '@aligov/global-string-format'],
},
babel: {
allowImportExportEverywhere: true,
decoratorsBeforeExport: true,
plugins: [
'asyncGenerators',
'classProperties',
'decorators-legacy',
'doExpressions',
'exportExtensions',
'exportDefaultFrom',
'typescript',
'functionSent',
'functionBind',
'jsx',
'objectRestSpread',
'dynamicImport',
'numericSeparator',
'optionalChaining',
'optionalCatchBinding',
],
},
isNeedUploadCopyToMedusa: true,
sourceLang: 'zh-CN',
},
};
4 changes: 3 additions & 1 deletion packages/gi-assets-algorithm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@
"postpublish": "tnpm sync @antv/gi-assets-algorithm"
},
"dependencies": {
"@antv/gi-sdk": "workspace:*",
"@aligov/global-locale": "^1.0.5",
"@aligov/global-string-format": "^1.0.7",
"@ant-design/icons": "^4.7.0",
"@antv/algorithm": "^0.1.26-beta.0",
"@antv/g2plot": "^2.4.31",
"@antv/gi-sdk": "workspace:*",
"@antv/matrix-util": "^3.0.4",
"@antv/s2": "^1.48.0",
"@antv/s2-react": "^1.41.0",
Expand Down
13 changes: 10 additions & 3 deletions packages/gi-assets-algorithm/src/ClusterTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import React, { Component } from 'react';
import type { PlainObject } from '../types';
import { exportCSV, formatFileName } from '../utils/csv';
import './index.less';
import FormattedMessage, { formatMessage } from './locale';
import $i18n from '../i18n';

const getConfig = (data: GraphinData, clusterTitle, properties) => {
const resData = [];
Expand All @@ -36,6 +36,7 @@ const getConfig = (data: GraphinData, clusterTitle, properties) => {
name: 'id',
},
],

data: resData || [],
};
return { dataCfg, resData, properties };
Expand Down Expand Up @@ -89,7 +90,10 @@ export default class ClustersTable extends Component<Props, State> {
exportCSV(
{
data: resData,
title: [clusterTitle, formatMessage({ id: 'node-name' })].concat(properties),
title: [
clusterTitle,
$i18n.get({ id: 'gi-assets-algorithm.src.ClusterTable.NodeName', dm: '节点名称' }),
].concat(properties),
titleForKey: ['clusterId', 'label'].concat(properties),
},
fileName,
Expand All @@ -111,7 +115,10 @@ export default class ClustersTable extends Component<Props, State> {

return (
<>
<Tooltip title={<FormattedMessage id="download-csv" />} placement="topRight">
<Tooltip
title={$i18n.get({ id: 'gi-assets-algorithm.src.ClusterTable.DownloadCsv', dm: '下载 CSV' })}
placement="topRight"
>
<DownloadOutlined style={{ float: 'right' }} onClick={this.download} />
</Tooltip>
<div className="community-cluster-table-wrapper">
Expand Down
18 changes: 0 additions & 18 deletions packages/gi-assets-algorithm/src/ClusterTable/locale/en-US.js

This file was deleted.

41 changes: 0 additions & 41 deletions packages/gi-assets-algorithm/src/ClusterTable/locale/index.tsx

This file was deleted.

19 changes: 0 additions & 19 deletions packages/gi-assets-algorithm/src/ClusterTable/locale/zh-CN.js

This file was deleted.

65 changes: 47 additions & 18 deletions packages/gi-assets-algorithm/src/CommunityDetection/Component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { cloneDeep } from 'lodash';
import React, { useEffect, useState } from 'react';
import ClusterTable from '../ClusterTable';
import Utils from '../utils/index';
import FormattedMessage, { formatMessage } from './locale';
import './index.less';
import $i18n from '../i18n';

const { ClickSelect } = Behaviors;

Expand Down Expand Up @@ -97,7 +97,7 @@ const CommunityDetection: React.FunctionComponent<CommunityDetectionProps> = pro
content: (
<div className="community-detection-algo-body">
<span>
<FormattedMessage id="k-core.set-k" />
{$i18n.get({ id: 'gi-assets-algorithm.src.CommunityDetection.Component.SetCoreK', dm: '设置核心度k:' })}
</span>
<InputNumber
min={1}
Expand Down Expand Up @@ -214,7 +214,13 @@ const CommunityDetection: React.FunctionComponent<CommunityDetectionProps> = pro
setLoading(true);
setTimeout(() => {
if (!graph || graph.destroyed) {
handleUpateHistory(false, '图实例不存在');
handleUpateHistory(
false,
$i18n.get({
id: 'gi-assets-algorithm.src.CommunityDetection.Component.TheGraphInstanceDoesNot',
dm: '图实例不存在',
}),
);
return;
}
const formatData = formatOriginData(data);
Expand Down Expand Up @@ -299,7 +305,12 @@ const CommunityDetection: React.FunctionComponent<CommunityDetectionProps> = pro
case CommunityDetectionAlgorithm.ConnectedComponent:
const components = connectedComponent(formatData);
if (components.length <= 1) {
message.info(formatMessage({ id: 'connected-component.all-connected' }));
message.info(
$i18n.get({
id: 'gi-assets-algorithm.src.CommunityDetection.Component.TheCurrentGraphIsConnected',
dm: '当前图整体连通,无非连通子图',
}),
);
break;
}
const clustersComponent: { id: string; nodes: any[] }[] = [];
Expand All @@ -316,7 +327,12 @@ const CommunityDetection: React.FunctionComponent<CommunityDetectionProps> = pro
});
});
if (existSingleNode) {
message.info(formatMessage({ id: 'connected-component.has-single' }));
message.info(
$i18n.get({
id: 'gi-assets-algorithm.src.CommunityDetection.Component.ThereAreIsolatedPointOn',
dm: '当前图上存在孤点,将不参与社区划分',
}),
);
}
setResData(formatData);
setAllClusters(clustersComponent);
Expand Down Expand Up @@ -344,7 +360,10 @@ const CommunityDetection: React.FunctionComponent<CommunityDetectionProps> = pro
updateHistory({
componentId: 'CommunityDetection',
type: 'analyse',
subType: '社区发现',
subType: $i18n.get({
id: 'gi-assets-algorithm.src.CommunityDetection.Component.CommunityDiscovery',
dm: '社区发现',
}),
statement: communityAlgo,
success,
errorMsg,
Expand Down Expand Up @@ -382,18 +401,29 @@ const CommunityDetection: React.FunctionComponent<CommunityDetectionProps> = pro
}

if (!resData?.nodes?.length) {
return <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description={<FormattedMessage id="data.no-data" />} />;
return (
<Empty
image={Empty.PRESENTED_IMAGE_SIMPLE}
description={$i18n.get({
id: 'gi-assets-algorithm.src.CommunityDetection.Component.NoDataAvailable',
dm: '暂无数据',
})}
/>
);
}

if (divisionAlgo.includes(communityAlgo)) {
return (
<div className="community-detection-result-wrapper">
<span className="community-detection-title">
<FormattedMessage id="analysis-result" />
{$i18n.get({ id: 'gi-assets-algorithm.src.CommunityDetection.Component.AnalysisResults', dm: '分析结果' })}
</span>
<ClusterTable
data={resData}
clusterTitle={formatMessage({ id: 'community-index' })}
clusterTitle={$i18n.get({
id: 'gi-assets-algorithm.src.CommunityDetection.Component.CommunityNumber',
dm: '社区编号',
})}
focusNodeAndHighlightHull={focusNodeAndHighlightHull}
properties={nodeProperties}
/>
Expand All @@ -404,7 +434,7 @@ const CommunityDetection: React.FunctionComponent<CommunityDetectionProps> = pro
return (
<div className="community-detection-result-wrapper">
<p className="community-detection-title">
<FormattedMessage id="analysis-result" />
{$i18n.get({ id: 'gi-assets-algorithm.src.CommunityDetection.Component.AnalysisResults', dm: '分析结果' })}
</p>
<div className="community-detection-graph-container">
<Graphin
Expand Down Expand Up @@ -450,7 +480,10 @@ const CommunityDetection: React.FunctionComponent<CommunityDetectionProps> = pro
<div className="community-detection-wrapper">
<div className="top-info">
<p className="community-detection-title">
<FormattedMessage id="select-algo" />
{$i18n.get({
id: 'gi-assets-algorithm.src.CommunityDetection.Component.SelectionAlgorithm',
dm: '选择算法',
})}
</p>
<ReloadOutlined onClick={reset} />
</div>
Expand All @@ -460,12 +493,8 @@ const CommunityDetection: React.FunctionComponent<CommunityDetectionProps> = pro
<div key={selection.name}>
<Radio value={selection.name} className="community-detection-algo-radio">
<div className="community-detection-algo-title">
<span className="community-detection-algo-title-name">
<FormattedMessage id={`${selection.name}`} />
</span>
<span className="community-detection-algo-title-tip">
<FormattedMessage id={`${selection.name}-tip`} />
</span>
<span className="community-detection-algo-title-name">{selection.name}</span>
<span className="community-detection-algo-title-tip">{selection.name}</span>
</div>
</Radio>
{selection.content}
Expand All @@ -479,7 +508,7 @@ const CommunityDetection: React.FunctionComponent<CommunityDetectionProps> = pro
loading={loading}
onClick={() => onCommunityAnalyse()}
>
<FormattedMessage id="analyse" />
{$i18n.get({ id: 'gi-assets-algorithm.src.CommunityDetection.Component.Analysis', dm: '分析' })}
</Button>

{renderResult()}
Expand Down
8 changes: 6 additions & 2 deletions packages/gi-assets-algorithm/src/CommunityDetection/info.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import $i18n from '../i18n';
const info = {
id: 'CommunityDetection',
name: '社区发现',
name: $i18n.get({ id: 'gi-assets-algorithm.src.CommunityDetection.info.CommunityDiscovery', dm: '社区发现' }),
category: 'algorithm-analysis',
type: 'GIAC_CONTENT',
desc: '通过 K-Core、Lopuvain、iLouvain',
desc: $i18n.get({
id: 'gi-assets-algorithm.src.CommunityDetection.info.ThroughKCoreLopuvainAnd',
dm: '通过 K-Core、Lopuvain、iLouvain',
}),
cover: 'http://xxxx.jpg',
icon: 'icon-associate',
docs: 'https://www.yuque.com/antv/gi/wx332z4ox2kylghu',
Expand Down

This file was deleted.

Loading

0 comments on commit a3d7d87

Please sign in to comment.