Skip to content

Commit

Permalink
Merge pull request #18 from secretflow/sprint/v1.5
Browse files Browse the repository at this point in the history
v1.5: 版本迭代更新
  • Loading branch information
yinrouni authored Apr 16, 2024
2 parents bc41864 + 1068c10 commit 231b7d0
Show file tree
Hide file tree
Showing 72 changed files with 870 additions and 544 deletions.
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

version: 2.1

jobs:
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
"editor.rulers": [88],
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.fixAll.stylelint": "explicit"
"source.fixAll.eslint": true,
"source.fixAll.stylelint": true
},
"[markdown]": {
"editor.quickSuggestions": {
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pnpm bootstrap
pnpm dev
```

For more details on development and deployment,please refer 🛠 [Dev Guidelines](https://secretflow.github.io/secretpad-frontend/dev-doc).
For more details on development and deployment,please refer 🛠
[Dev Guidelines](https://secretflow.github.io/secretpad-frontend/dev-doc).

See [CONTRIBUTING.md](CONTRIBUTING.md) for more info.
4 changes: 3 additions & 1 deletion README.zh-Hans.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
pnpm bootstrap
pnpm dev
```
想了解更多开发和部署细节, 请参考 🛠 [Dev Guidelines](https://secretflow.github.io/secretpad-frontend/dev-doc)

想了解更多开发和部署细节, 请参考 🛠
[Dev Guidelines](https://secretflow.github.io/secretpad-frontend/dev-doc)

[CONTRIBUTING.md](CONTRIBUTING.zh-Hans.md).
2 changes: 1 addition & 1 deletion apps/docs/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# sceretpad DEV docs
# sceretpad-doc

A static site base on [dumi](https://d.umijs.org).

Expand Down
2 changes: 1 addition & 1 deletion apps/docs/docs/dev-doc/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
nav:
title: 文档
title: 开发文档
order: -1
group:
title: 入门
Expand Down
51 changes: 51 additions & 0 deletions apps/docs/docs/dev-doc/qiankun.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
nav: 文档
group:
title: 微前端集成
order: 6
order: 1
mobile: false
---

# qiankun

支持通过 [qiankun](https://qiankun.umijs.org/zh/guide) 进行集成, 可快速将其配置为 [qiankun](https://qiankun.umijs.org/zh/guide) 的子应用。

只需要在 `platform/config.ts` 中开启如下配置即可

```ts
export default defineConfig({
plugins: ['@umijs/plugins/dist/qiankun'],
qiankun: {
slave: {},
},
});
```

如果你的主应用项目是基于 `Umi` 开发的,可以开启以下配置接入子应用, 具体可参考 [UmiJS 文档](https://umijs.org/docs/max/micro-frontend)

```ts
export default defineConfig({
qiankun: {
master: {
apps: [
{
name: 'secretpad',
entry: '//localhost:8009', // 子应用启动的服务
},
],
},
},
routes: [
{
name: 'secretpad',
path: '/secretpad/*',
microApp: 'secretpad',
},
],
});
```

在你的主应用项目中,访问 `/secretpad/*` 路由即可看到平台被成功接入。

如果你的主应用不是基于 `Umi` 开发的, 接入子应用请参考 [qiankun 文档](https://qiankun.umijs.org/zh/guide)
3 changes: 2 additions & 1 deletion apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"start": "pnpm run dev",
"dev": "PORT=8001 dumi dev",
"build": "dumi build",
"prepare": "dumi setup"
"prepare": "dumi setup",
"preview": "dumi preview"
},
"authors": [],
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion apps/platform/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default defineConfig({
// apps: [
// {
// name: 'secretpad', // 后端应用名
// tag: 'feat/cx_merge', // 分支 tag
// tag: 'release/0.6.0b0_cml', // 分支 tag
// source: 'ZAPPINFO', // 应用来源,默认 ZAPPINFO,其他来源可在官网的应用信息中查看
// },
// ],
Expand Down
1 change: 1 addition & 0 deletions apps/platform/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"private": true,
"name": "secretpad",
"scripts": {
"dev": "umi dev",
"build": "umi build",
Expand Down
10 changes: 5 additions & 5 deletions apps/platform/src/components/datatable-preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { getProjectDatatable } from '@/services/secretpad/ProjectController';

import styles from './datatable-preview.less';
import { EdgeAuthWrapper } from './edge-wrapper-auth';
import { useLocation } from 'umi';
import { openNewTab } from '@/util/path';

interface DatatablePreviewInterface {
// tableInfo: Record<string, any>;
Expand Down Expand Up @@ -65,7 +67,7 @@ export const DatatablePreview = (props: DatatablePreviewInterface) => {
getDatatableInfo(props.node?.nodeId || '', props?.datatableId || '');
}
}, [popoverOpen]);

const { pathname } = useLocation();
const content = (
<>
<Table
Expand All @@ -79,10 +81,8 @@ export const DatatablePreview = (props: DatatablePreviewInterface) => {
<EdgeAuthWrapper>
<Link
onClick={() => {
const a = document.createElement('a');
a.href = `/node?nodeId=${props.node.nodeId}&tab=data-management`;
a.target = '_blank';
a.click();
const serarch = `nodeId=${props.node.nodeId}&tab=data-management`;
openNewTab(pathname, '/node', serarch);
}}
>
查看全部
Expand Down
4 changes: 2 additions & 2 deletions apps/platform/src/components/platform-wrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ export const EdgeRouteWrapper = (props: { children?: React.ReactNode }) => {
* 判断当前是不是p2p 的工作台页面
* @returns boolean
*/
export const isP2PWorkbench = () => {
const { pathname, search } = window.location;
export const isP2PWorkbench = (pathname: string) => {
const { search } = window.location;
const { tab } = parse(search);
return pathname === '/edge' && tab === 'workbench';
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ export class DefaultConfigRender implements ConfigRenderProtocol {
canHandle: (node: AtomicConfigNode) => (node.type === 'AT_STRING' ? 1 : false),
component: DefaultInput,
},
{
canHandle: (node: AtomicConfigNode) => (node.type === 'AT_PARTY' ? 1 : false),
component: DefaultNodeSelect,
},
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ import { parse } from 'query-string';
import type { Dispatch, SetStateAction } from 'react';
import { useState, useEffect } from 'react';
import { useLocation } from 'umi';
import { MultiTableFeatureSelection } from '../config-item-render/default-feature-selection/table-feature-selection';

import {
getProject,
getProjectDatatable,
} from '@/services/secretpad/ProjectController';

import { MultiTableFeatureSelection } from '../config-item-render/default-feature-selection/table-feature-selection';

import styles from './index.less';

const { Option } = Select;
Expand Down Expand Up @@ -40,6 +39,13 @@ export const QuickConfigPSIComponent = (props: QuickConfigPSIComponentProps) =>
const { search } = useLocation();
const { projectId } = parse(search) as { projectId: string };

const [nodeOptions, setNodeOptions] = useState<
{
label: string;
value: string;
}[]
>([]);

const [selectedTableInfo, setSelectedTableInfo] = useState<
{
datatableId: string;
Expand Down Expand Up @@ -85,6 +91,14 @@ export const QuickConfigPSIComponent = (props: QuickConfigPSIComponentProps) =>
}[];

if (tableSelected.length > 1) setSelectedTableInfo(tableSelected);
if (tableSelected.length > 0) {
setNodeOptions(
tableSelected.map((table) => ({
value: table.nodeId as string,
label: table.nodeName as string,
})),
);
}
}, [selectedReceiver, selectedSender, projectId]);

useEffect(() => {
Expand Down Expand Up @@ -279,7 +293,24 @@ export const QuickConfigPSIComponent = (props: QuickConfigPSIComponentProps) =>
))
}
</Form.List>

{type === 'MPC' && (
<Form.Item
name={'leftSide'}
label={<div className={styles.configItemLabel}>左表节点</div>}
required
messageVariables={{ label: '左表节点' }}
valuePropName="value"
getValueProps={(value) => {
return { value: value?.ss };
}}
tooltip={'和允许求交键重复的求交类型搭配使用'}
getValueFromEvent={(value) => {
return { ss: [value] };
}}
>
<Select options={nodeOptions} />
</Form.Item>
)}
{type === 'MPC' && (
<Form.Item
name="featureSelects"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,38 +104,12 @@ export const QuickConfigRisk = () => {

return (
<>
<QuickConfigPSIComponent tables={tables} tableList={tableList} form={form} />

<Form.Item
name="featureSelects"
label={<div className={styles.configItemLabel}>选择特征</div>}
required
messageVariables={{ msg: '请选择特征列' }}
rules={[
{
required: true,
message: '${msg}',
validator: (_, val) => {
if (!val || val.length === 0) return Promise.reject(new Error('${msg}'));

return Promise.resolve();
},
},
]}
getValueProps={(value) => {
return { value: value?.ss };
}}
getValueFromEvent={(value) => {
return { ss: value };
}}
>
<MultiTableFeatureSelection
tableKeys={selectedTableInfo}
size={'small'}
rules={{ min: 1 }}
/>
</Form.Item>

<QuickConfigPSIComponent
type="MPC"
tables={tables}
tableList={tableList}
form={form}
/>
<Form.Item
name="labelSelects"
label={<div className={styles.configItemLabel}>选择标签</div>}
Expand Down
1 change: 1 addition & 0 deletions apps/platform/src/modules/component-config/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export const typesMap: Record<AtomicParameterType, keyof AtomicParameter> = {
AT_FLOATS: 'fs',
AT_INTS: 'i64s',
AT_STRINGS: 'ss',
AT_PARTY: 'ss',
AT_SF_TABLE_COL: 'ss',
// AT_UNDEFINED: undefined,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ export type AtomicParameterType =
| 'AT_BOOLS'
// Special types.
// | 'ATTR_TYPE_UNSPECIFIED'
| 'AT_SF_TABLE_COL';
| 'AT_SF_TABLE_COL'
| 'AT_PARTY';

// export const ColSelectionParameter = 'AT_SF_TABLE_COL';

Expand Down
Loading

0 comments on commit 231b7d0

Please sign in to comment.