@nocobase/client-v2 2.1.0-beta.37 → 2.1.0-beta.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/Application.d.ts +1 -0
- package/es/BaseApplication.d.ts +3 -0
- package/es/RouterManager.d.ts +1 -0
- package/es/components/KeepAlive.d.ts +22 -0
- package/es/components/RouterBridge.d.ts +9 -0
- package/es/data-source/ExtendCollectionsProvider.d.ts +28 -2
- package/es/flow/FlowPage.d.ts +2 -1
- package/es/flow/admin-shell/AdminLayoutRouteCoordinator.d.ts +8 -40
- package/es/flow/admin-shell/BaseLayoutModel.d.ts +89 -0
- package/es/flow/admin-shell/BaseLayoutRouteCoordinator.d.ts +74 -0
- package/es/flow/admin-shell/admin-layout/AdminLayoutEntryGuard.d.ts +12 -0
- package/es/flow/admin-shell/admin-layout/AdminLayoutModel.d.ts +7 -92
- package/es/flow/admin-shell/admin-layout/index.d.ts +2 -0
- package/es/flow/admin-shell/useAdminLayoutRoutePage.d.ts +2 -2
- package/es/flow/admin-shell/useLayoutRoutePage.d.ts +23 -0
- package/es/flow/components/FlowRoute.d.ts +10 -1
- package/es/flow/index.d.ts +4 -0
- package/es/flow/models/base/PageModel/PageModel.d.ts +3 -1
- package/es/flow/models/blocks/form/FormActionGroupModel.d.ts +1 -0
- package/es/flow/models/blocks/table/TableBlockModel.d.ts +10 -0
- package/es/flow/models/fields/AssociationFieldModel/SubTableFieldModel/index.d.ts +1 -1
- package/es/index.d.ts +1 -0
- package/es/index.mjs +484 -437
- package/es/layout-manager/LayoutContentRoute.d.ts +14 -0
- package/es/layout-manager/LayoutManager.d.ts +22 -0
- package/es/layout-manager/LayoutRoute.d.ts +14 -0
- package/es/layout-manager/index.d.ts +13 -0
- package/es/layout-manager/types.d.ts +20 -0
- package/es/layout-manager/utils.d.ts +14 -0
- package/es/settings-center/index.d.ts +1 -1
- package/es/settings-center/plugin-manager/BulkEnableButton.d.ts +15 -0
- package/es/settings-center/plugin-manager/PluginCard.d.ts +15 -0
- package/es/settings-center/plugin-manager/PluginDetail.d.ts +16 -0
- package/es/settings-center/{PluginManagerPage.d.ts → plugin-manager/index.d.ts} +1 -7
- package/es/settings-center/plugin-manager/types.d.ts +34 -0
- package/lib/index.js +484 -437
- package/package.json +8 -7
- package/src/Application.tsx +27 -12
- package/src/BaseApplication.tsx +6 -0
- package/src/PluginSettingsManager.ts +1 -1
- package/src/RouterManager.tsx +17 -1
- package/src/__tests__/PluginSettingsManager.test.ts +41 -2
- package/src/__tests__/app.test.tsx +8 -1
- package/src/__tests__/globalDeps.test.ts +1 -0
- package/src/__tests__/nocobase-buildin-plugin-auth.test.tsx +45 -2
- package/src/__tests__/plugin-manager.test.tsx +177 -0
- package/src/__tests__/settings-center.test.tsx +24 -2
- package/src/components/KeepAlive.tsx +131 -0
- package/src/components/RouterBridge.tsx +28 -4
- package/src/components/__tests__/KeepAlive.test.tsx +63 -0
- package/src/components/__tests__/RouterBridge.test.tsx +27 -0
- package/src/data-source/ExtendCollectionsProvider.tsx +94 -20
- package/src/data-source/__tests__/ExtendCollectionsProvider.test.tsx +264 -0
- package/src/flow/FlowPage.tsx +35 -7
- package/src/flow/__tests__/FlowPage.test.tsx +79 -0
- package/src/flow/__tests__/FlowRoute.test.tsx +529 -2
- package/src/flow/actions/__tests__/linkageRules.subFormSetFieldProps.test.ts +191 -0
- package/src/flow/actions/__tests__/openView.subModelKey.test.tsx +33 -0
- package/src/flow/actions/aclCheck.tsx +4 -0
- package/src/flow/actions/aclCheckRefresh.tsx +4 -0
- package/src/flow/actions/dateTimeFormat.tsx +12 -8
- package/src/flow/actions/linkageRules.tsx +122 -0
- package/src/flow/actions/openView.tsx +28 -4
- package/src/flow/admin-shell/AdminLayoutRouteCoordinator.ts +11 -329
- package/src/flow/admin-shell/BaseLayoutModel.tsx +455 -0
- package/src/flow/admin-shell/BaseLayoutRouteCoordinator.ts +502 -0
- package/src/flow/admin-shell/__tests__/AdminLayoutRouteCoordinator.test.ts +547 -3
- package/src/flow/admin-shell/admin-layout/AdminLayoutComponent.tsx +4 -4
- package/src/flow/admin-shell/admin-layout/AdminLayoutEntryGuard.tsx +160 -0
- package/src/flow/admin-shell/admin-layout/AdminLayoutMenuModels.tsx +0 -12
- package/src/flow/admin-shell/admin-layout/AdminLayoutModel.tsx +28 -201
- package/src/flow/admin-shell/admin-layout/AdminLayoutSlotModels.tsx +11 -2
- package/src/flow/admin-shell/admin-layout/__tests__/AdminLayoutMenuModels.test.ts +1 -26
- package/src/flow/admin-shell/admin-layout/__tests__/AdminLayoutModel.test.tsx +149 -27
- package/src/flow/admin-shell/admin-layout/index.ts +2 -0
- package/src/flow/admin-shell/useAdminLayoutRoutePage.ts +10 -26
- package/src/flow/admin-shell/useLayoutRoutePage.ts +61 -0
- package/src/flow/components/AdminLayout.tsx +4 -154
- package/src/flow/components/FlowRoute.tsx +105 -15
- package/src/flow/index.ts +4 -0
- package/src/flow/models/base/ActionModel.tsx +8 -1
- package/src/flow/models/base/PageModel/PageModel.tsx +51 -18
- package/src/flow/models/base/PageModel/RootPageModel.tsx +6 -13
- package/src/flow/models/base/PageModel/__tests__/PageModel.test.ts +102 -1
- package/src/flow/models/base/RouteModel.tsx +1 -1
- package/src/flow/models/blocks/form/FormActionGroupModel.tsx +14 -0
- package/src/flow/models/blocks/form/FormItemModel.tsx +8 -1
- package/src/flow/models/blocks/form/__tests__/FormActionGroupModel.test.ts +46 -0
- package/src/flow/models/blocks/form/submitValues.ts +4 -1
- package/src/flow/models/blocks/table/TableBlockModel.tsx +118 -16
- package/src/flow/models/blocks/table/__tests__/TableBlockModel.rowSelection.test.tsx +114 -0
- package/src/flow/models/fields/AssociationFieldModel/SubFormFieldModel.tsx +7 -1
- package/src/flow/models/fields/AssociationFieldModel/SubTableFieldModel/SubTableField.tsx +1 -1
- package/src/flow/models/fields/AssociationFieldModel/SubTableFieldModel/index.tsx +6 -5
- package/src/flow/models/fields/ClickableFieldModel.tsx +9 -1
- package/src/flow/models/fields/DisplayTimeFieldModel.tsx +1 -1
- package/src/flow/models/fields/TimeFieldModel.tsx +1 -1
- package/src/flow/models/fields/__tests__/TimeFieldModel.test.tsx +61 -0
- package/src/flow/models/fields/mobile-components/MobileDatePicker.tsx +19 -3
- package/src/flow/models/fields/mobile-components/__tests__/MobileDatePicker.test.tsx +94 -0
- package/src/flow/models/topbar/TopbarActionModel.tsx +1 -1
- package/src/flow/utils/__tests__/dateTimeFormat.test.ts +91 -0
- package/src/index.ts +1 -0
- package/src/layout-manager/LayoutContentRoute.tsx +90 -0
- package/src/layout-manager/LayoutManager.tsx +185 -0
- package/src/layout-manager/LayoutRoute.tsx +138 -0
- package/src/layout-manager/__tests__/LayoutManager.test.tsx +335 -0
- package/src/layout-manager/__tests__/LayoutRoute.test.tsx +473 -0
- package/src/layout-manager/index.ts +14 -0
- package/src/layout-manager/types.ts +22 -0
- package/src/layout-manager/utils.ts +37 -0
- package/src/nocobase-buildin-plugin/index.tsx +56 -48
- package/src/settings-center/index.ts +1 -1
- package/src/settings-center/plugin-manager/BulkEnableButton.tsx +111 -0
- package/src/settings-center/plugin-manager/PluginCard.tsx +270 -0
- package/src/settings-center/plugin-manager/PluginDetail.tsx +195 -0
- package/src/settings-center/plugin-manager/index.tsx +254 -0
- package/src/settings-center/plugin-manager/types.ts +35 -0
- package/src/settings-center/utils.tsx +8 -1
- package/src/theme/__tests__/globalStyles.test.ts +24 -0
- package/src/theme/globalStyles.ts +10 -0
- package/src/utils/globalDeps.ts +2 -0
- package/src/settings-center/PluginManagerPage.tsx +0 -162
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { Alert, Table, Tag, theme, Typography } from 'antd';
|
|
11
|
-
import React, { useEffect, useMemo, useState } from 'react';
|
|
12
|
-
import { useTranslation } from 'react-i18next';
|
|
13
|
-
import { useApp } from '../hooks/useApp';
|
|
14
|
-
|
|
15
|
-
type PluginManagerRecord = {
|
|
16
|
-
name?: string;
|
|
17
|
-
packageName?: string;
|
|
18
|
-
displayName?: string;
|
|
19
|
-
enabled?: boolean;
|
|
20
|
-
builtIn?: boolean;
|
|
21
|
-
version?: string;
|
|
22
|
-
isCompatible?: boolean;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* `Plugin manager` 的最小只读页面。
|
|
27
|
-
*
|
|
28
|
-
* 首版只负责展示 `pm:list` 返回的插件列表和关键状态,
|
|
29
|
-
* 不承载安装、升级、删除、启停等运维操作。
|
|
30
|
-
*/
|
|
31
|
-
export const PluginManagerPage = () => {
|
|
32
|
-
const app = useApp();
|
|
33
|
-
const { token } = theme.useToken();
|
|
34
|
-
const { t } = useTranslation();
|
|
35
|
-
const [loading, setLoading] = useState(true);
|
|
36
|
-
const [dataSource, setDataSource] = useState<PluginManagerRecord[]>([]);
|
|
37
|
-
const [errorMessage, setErrorMessage] = useState<string>('');
|
|
38
|
-
|
|
39
|
-
useEffect(() => {
|
|
40
|
-
let mounted = true;
|
|
41
|
-
|
|
42
|
-
const load = async () => {
|
|
43
|
-
setLoading(true);
|
|
44
|
-
setErrorMessage('');
|
|
45
|
-
|
|
46
|
-
try {
|
|
47
|
-
const response = await app.apiClient.request({
|
|
48
|
-
url: 'pm:list',
|
|
49
|
-
skipNotify: true,
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
if (!mounted) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
setDataSource(Array.isArray(response?.data?.data) ? response.data.data : []);
|
|
57
|
-
} catch (error) {
|
|
58
|
-
if (!mounted) {
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
setErrorMessage(error?.message || t('Failed to load plugins'));
|
|
62
|
-
} finally {
|
|
63
|
-
if (mounted) {
|
|
64
|
-
setLoading(false);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
void load();
|
|
70
|
-
|
|
71
|
-
return () => {
|
|
72
|
-
mounted = false;
|
|
73
|
-
};
|
|
74
|
-
}, [app, t]);
|
|
75
|
-
|
|
76
|
-
const columns = useMemo(
|
|
77
|
-
() => [
|
|
78
|
-
{
|
|
79
|
-
title: t('Name'),
|
|
80
|
-
dataIndex: 'name',
|
|
81
|
-
key: 'name',
|
|
82
|
-
render: (value: string) => value || '-',
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
title: t('Package name'),
|
|
86
|
-
dataIndex: 'packageName',
|
|
87
|
-
key: 'packageName',
|
|
88
|
-
render: (value: string) => (
|
|
89
|
-
<Typography.Text copyable={!!value} code>
|
|
90
|
-
{value || '-'}
|
|
91
|
-
</Typography.Text>
|
|
92
|
-
),
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
title: t('Display name'),
|
|
96
|
-
dataIndex: 'displayName',
|
|
97
|
-
key: 'displayName',
|
|
98
|
-
render: (value: string) => value || '-',
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
title: t('Enabled'),
|
|
102
|
-
dataIndex: 'enabled',
|
|
103
|
-
key: 'enabled',
|
|
104
|
-
width: 120,
|
|
105
|
-
render: (value: boolean) => <Tag color={value ? 'success' : 'default'}>{value ? t('Yes') : t('No')}</Tag>,
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
title: t('Built-in'),
|
|
109
|
-
dataIndex: 'builtIn',
|
|
110
|
-
key: 'builtIn',
|
|
111
|
-
width: 120,
|
|
112
|
-
render: (value: boolean) => <Tag color={value ? 'processing' : 'default'}>{value ? t('Yes') : t('No')}</Tag>,
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
title: t('Version'),
|
|
116
|
-
dataIndex: 'version',
|
|
117
|
-
key: 'version',
|
|
118
|
-
width: 140,
|
|
119
|
-
render: (value: string) => value || '-',
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
title: t('Compatible'),
|
|
123
|
-
dataIndex: 'isCompatible',
|
|
124
|
-
key: 'isCompatible',
|
|
125
|
-
width: 140,
|
|
126
|
-
render: (value: boolean) => (
|
|
127
|
-
<Tag color={value === false ? 'error' : 'success'}>{value === false ? t('No') : t('Yes')}</Tag>
|
|
128
|
-
),
|
|
129
|
-
},
|
|
130
|
-
],
|
|
131
|
-
[t],
|
|
132
|
-
);
|
|
133
|
-
|
|
134
|
-
return (
|
|
135
|
-
<div
|
|
136
|
-
style={{
|
|
137
|
-
background: token.colorBgContainer,
|
|
138
|
-
borderRadius: token.borderRadiusLG,
|
|
139
|
-
padding: token.paddingLG,
|
|
140
|
-
}}
|
|
141
|
-
>
|
|
142
|
-
{errorMessage ? (
|
|
143
|
-
<Alert
|
|
144
|
-
showIcon
|
|
145
|
-
type="error"
|
|
146
|
-
message={t('Failed to load plugins')}
|
|
147
|
-
description={errorMessage}
|
|
148
|
-
style={{ marginBottom: token.marginLG }}
|
|
149
|
-
/>
|
|
150
|
-
) : null}
|
|
151
|
-
<Table
|
|
152
|
-
rowKey={(record) => record.packageName || record.name || record.displayName || 'unknown-plugin'}
|
|
153
|
-
loading={loading}
|
|
154
|
-
dataSource={dataSource}
|
|
155
|
-
columns={columns}
|
|
156
|
-
pagination={{ pageSize: 20 }}
|
|
157
|
-
/>
|
|
158
|
-
</div>
|
|
159
|
-
);
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
export default PluginManagerPage;
|