@nocobase/app-skills 0.1.0-beta.59 → 0.1.0-beta.61
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/LICENSE.txt +129 -0
- package/package.json +1 -1
- package/skills/nocobase-app-development/SKILL.md +5 -1
- package/skills/nocobase-app-development/assets/business-examples/onboarding/tests/client/onboarding.test.tsx +26 -3
- package/skills/nocobase-app-development/assets/business-examples/onboarding/tests/server/onboarding.test.ts +13 -1
- package/skills/nocobase-app-development/assets/business-examples/procurement/tests/server/procurement.test.ts +15 -1
- package/skills/nocobase-app-development/assets/customer-contacts-example/client/pages/customer-contacts/detail.tsx +66 -55
- package/skills/nocobase-app-development/assets/customer-contacts-example/client/pages/customer-contacts/index.tsx +11 -29
- package/skills/nocobase-app-development/assets/customer-contacts-example/client/pages/customer-contacts/locales.ts +0 -2
- package/skills/nocobase-app-development/assets/customer-contacts-example/client/pages/customer-contacts/relation-picker.tsx +68 -18
- package/skills/nocobase-app-development/assets/customer-contacts-example/client/pages/customer-contacts/shared.tsx +32 -12
- package/skills/nocobase-app-development/assets/customer-contacts-example/tests/client/customer-contacts.test.tsx +155 -2
- package/skills/nocobase-app-development/assets/date-picker-example/client/components/date-picker.tsx +152 -0
- package/skills/nocobase-app-development/assets/date-picker-example/client/lib/date-only.ts +13 -0
- package/skills/nocobase-app-development/assets/date-picker-example/tests/client/date-picker.test.tsx +185 -0
- package/skills/nocobase-app-development/assets/list-edit-example/client/pages/skill-projects/detail.tsx +103 -0
- package/skills/nocobase-app-development/assets/list-edit-example/client/pages/skill-projects/index.tsx +7 -2
- package/skills/nocobase-app-development/assets/list-edit-example/client/pages/skill-projects/locales.ts +5 -0
- package/skills/nocobase-app-development/assets/list-edit-example/tests/client/skill-projects.test.tsx +88 -0
- package/skills/nocobase-app-development/references/dev-server.md +1 -1
- package/skills/nocobase-app-development/references/frontend/component-selection.md +2 -0
- package/skills/nocobase-app-development/references/frontend/frontend-dev.md +2 -0
- package/skills/nocobase-app-development/references/frontend/references/child-routes.md +13 -14
- package/skills/nocobase-app-development/references/frontend/references/example/copy.md +0 -4
- package/skills/nocobase-app-development/references/frontend/references/example/create-page.md +12 -8
- package/skills/nocobase-app-development/references/frontend/references/example/detail-page-tabs.md +13 -11
- package/skills/nocobase-app-development/references/frontend/references/example/list-page.md +1 -1
- package/skills/nocobase-app-development/references/frontend/references/example/project-dashboard.md +21 -21
- package/skills/nocobase-app-development/references/frontend/references/example/project-summary.md +8 -27
- package/skills/nocobase-app-development/references/frontend/references/example/server-table.md +1 -1
- package/skills/nocobase-app-development/references/frontend/references/executable-list-edit.md +35 -3
- package/skills/nocobase-app-development/references/frontend/references/form.md +17 -10
- package/skills/nocobase-app-development/references/frontend/references/list-feedback.md +27 -22
- package/skills/nocobase-app-development/references/frontend/references/navigation.md +99 -0
- package/skills/nocobase-app-development/references/frontend/references/overlay.md +31 -0
- package/skills/nocobase-app-development/references/frontend/references/page-freshness.md +23 -0
- package/skills/nocobase-app-development/references/frontend/references/page.md +32 -28
- package/skills/nocobase-app-development/references/frontend/references/shadcn.md +1 -1
- package/skills/nocobase-app-development/references/frontend/references/styling.md +8 -8
- package/skills/nocobase-app-development/references/frontend/references/table.md +1 -1
- package/skills/nocobase-app-development/references/frontend/references/ui-library.md +43 -7
- package/skills/nocobase-app-development/references/frontend/scripts/capture.md +1 -1
- package/skills/nocobase-app-development/references/frontend/scripts/capture.mjs +2 -2
- package/skills/nocobase-app-development/references/frontend/ui-guidelines.md +14 -10
- package/skills/nocobase-app-development/references/pending-feedback.md +132 -0
- package/skills/nocobase-app-development/scripts/check-ui-components.mjs +75 -32
- package/skills/nocobase-app-plugin-development/SKILL.md +1 -0
- package/skills/nocobase-app-plugin-development/references/backends-configuration.md +56 -0
- package/skills/nocobase-app-plugin-development/references/client-child-routes.md +2 -0
- package/skills/nocobase-app-plugin-development/references/configuration.md +2 -0
- package/skills/nocobase-app-plugin-development/references/server.md +1 -1
- package/skills/nocobase-app-upgrade/references/list-feedback-upgrade.md +2 -0
- package/skills/nocobase-app-upgrade/references/realtime-upgrade.md +69 -1
- package/skills/nocobase-deployment/SKILL.md +3 -1
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
Updated Date: November 7, 2026
|
|
2
|
+
|
|
3
|
+
NocoBase License Agreement
|
|
4
|
+
|
|
5
|
+
NOCOBASE PTE. LTD., a Singaporean Exempt Private Company Limited by Shares with its principal place of business located at 112 ROBINSON ROAD, #03-01, SINGAPORE ("The Company") https://www.nocobase.com/ issues this License Agreement ("Agreement") to you. You, as an individual or a company ("The User"), will be deemed to voluntarily accept all terms of this Agreement by using NocoBase (including but not limited to obtaining NocoBase source code, installation package, or image in any form, installing and using NocoBase, developing Applications with NocoBase, purchasing NocoBase commercial license and services). If the User does not agree to any term of this Agreement, or cannot accurately understand our interpretation of the relevant terms, please stop using it immediately.
|
|
6
|
+
|
|
7
|
+
This Agreement applies to any use, quotation, contract, invoice, and all software delivered by the Company. The User and the Company or NocoBase's agents need not sign a separate license agreement for the sale and delivery of the software.
|
|
8
|
+
|
|
9
|
+
This Agreement applies to NocoBase 3 and later versions. NocoBase 2 and earlier versions are independent products and remain subject to their original license agreement. Where a NocoBase 2 Commercial Edition user uses NocoBase 3 or later versions under a policy announced by the Company, that use is subject to this Agreement.
|
|
10
|
+
|
|
11
|
+
The Company reserves the right to formulate and modify this Agreement from time to time as needed. If there are changes, the Company will announce them in the form of website announcements, without further individual notification. The changed Agreement will automatically take effect once it is announced, becoming part of this Agreement.
|
|
12
|
+
|
|
13
|
+
==============
|
|
14
|
+
1. Definitions
|
|
15
|
+
==============
|
|
16
|
+
|
|
17
|
+
1.1 "Software" refers to NocoBase, consisting of Core, Studio, and Commercial Plugins, including their source code, installation packages, images, and all their modifications, updates, and upgrades.
|
|
18
|
+
|
|
19
|
+
1.2 "Core" refers to NocoBase Core, the open source application foundation released by the Company, including the runtime, plugins, application templates, development standards, and development skills placed in the same code repository.
|
|
20
|
+
|
|
21
|
+
1.3 "Studio" refers to NocoBase Studio, the governance platform for people and agents building software together, provided in the Commercial Edition.
|
|
22
|
+
|
|
23
|
+
1.4 "Commercial Plugins" refers to the plugins provided in the Commercial Edition that extend the capabilities of Core, such as advanced approvals and enterprise SSO.
|
|
24
|
+
|
|
25
|
+
1.5 "Community Edition" refers to the free version of the Software provided to the User through public channels, namely Core.
|
|
26
|
+
|
|
27
|
+
1.6 "Commercial Edition" refers to the paid version of the Software purchased by the User from the Company or its agents, downloaded through exclusive channels, and includes additional benefits. In addition to Core, it includes Studio and Commercial Plugins, and consists of two versions: Professional Edition and Enterprise Edition.
|
|
28
|
+
|
|
29
|
+
1.7 "Application" refers to a specific business use case application serving internal or external customers of the User, developed based on the Software, such as ERP/CRM. Studio is a development tool and is not part of any Application.
|
|
30
|
+
|
|
31
|
+
1.8 "Customer" refers to the clients who commission the User to develop Applications or purchase the User's Applications.
|
|
32
|
+
|
|
33
|
+
1.9 "Agent" refers to an AI agent that works with the Software, including the coding agents the User uses to develop Applications and the business agents in Applications.
|
|
34
|
+
|
|
35
|
+
1.10 "Third-Party Services" refers to the large models, coding agents, cloud services, and other third-party products and services that the User chooses to use with the Software.
|
|
36
|
+
|
|
37
|
+
1.11 "Third-Party Open Source Software" refers to open source software provided with the Software. They are licensed through various published open source software licenses or copyright notices accompanying such software.
|
|
38
|
+
|
|
39
|
+
===================================
|
|
40
|
+
2. Intellectual Property Protection
|
|
41
|
+
===================================
|
|
42
|
+
|
|
43
|
+
Except for Third-Party Open Source Software, the Company owns all copyrights, trademark rights, patent rights, trade secrets, and other intellectual property rights of the Software, and has registered and protected them in relevant countries and regions according to the "Paris Convention" or "TRIPS Agreement", ensuring that the intellectual property rights of the Software are internationally recognized and protected.
|
|
44
|
+
|
|
45
|
+
The Company claims no intellectual property rights in the business code written by the User or by Agents when developing Applications, or in the User's business data, skills, and knowledge bases. The parts of the Software contained in an Application remain the intellectual property of the Company and are subject to this Agreement.
|
|
46
|
+
|
|
47
|
+
=============
|
|
48
|
+
3. Disclaimer
|
|
49
|
+
=============
|
|
50
|
+
|
|
51
|
+
3.1 The User shall not use the Software to engage in activities that contravene applicable laws and regulations or offend against public order or religious prohibitions. All legal liabilities and consequences arising from the User's use shall be borne by the User.
|
|
52
|
+
|
|
53
|
+
3.2 The Company shall not be liable for any direct, indirect, special, incidental, or consequential damages (including but not limited to loss of profits, business interruption, data loss, or business information disclosure) caused by the User's use of the Software, even if it has been previously informed of the possibility of such damages.
|
|
54
|
+
|
|
55
|
+
3.3 Code written, content generated, and actions taken by Agents shall be reviewed and accepted by the User before being used in production. All consequences arising from the use of the work of Agents shall be borne by the User.
|
|
56
|
+
|
|
57
|
+
3.4 Third-Party Services are chosen and paid for by the User and are subject to their own terms. The Company shall not be liable for the availability, output, or data handling of Third-Party Services.
|
|
58
|
+
|
|
59
|
+
===============
|
|
60
|
+
4. License Type
|
|
61
|
+
===============
|
|
62
|
+
|
|
63
|
+
4.1 This Agreement serves as the unified license agreement for NocoBase Software, applying to both the Community Edition and the Commercial Editions.
|
|
64
|
+
|
|
65
|
+
4.2 Core is open source software. This Agreement incorporates and references the full text of the Apache License, Version 2.0 ("Apache-2.0", available at: https://www.apache.org/licenses/LICENSE-2.0 ). Users of Core must comply with the Apache-2.0 License as well as the supplementary terms set forth in this Agreement. In case of any inconsistency between Apache-2.0 and this Agreement, the supplementary terms of this Agreement shall prevail.
|
|
66
|
+
|
|
67
|
+
4.3 Studio and Commercial Plugins are commercial software of the Company and are not licensed under Apache-2.0. They can only be used under the Commercial License and in accordance with this Agreement.
|
|
68
|
+
|
|
69
|
+
================================================
|
|
70
|
+
5. Rights and Obligations of Open Source License
|
|
71
|
+
================================================
|
|
72
|
+
|
|
73
|
+
5.1 The Community Edition can be used for commercial purposes, including developing Applications for Customers.
|
|
74
|
+
|
|
75
|
+
5.2 It is not allowed to remove or change the NocoBase statement "AI + NocoBase" and "Build reliable business systems", or its link to https://www.nocobase.com/, at the bottom left of the interface of any Application, including Applications delivered to Customers, even though the code that displays the statement is part of the Application. If the default layout is replaced, the statement shall be kept at an equally visible position on the main interface of the Application. Pages that can be accessed without signing in and pages embedded in other systems are not subject to this requirement. When the sidebar is collapsed, showing the statement as an icon with a tooltip, as provided by default, meets this requirement. The main LOGO in the upper left corner of the page, the version number, and other information on the interface can be changed.
|
|
76
|
+
|
|
77
|
+
5.3 It is not allowed to remove or change all intellectual property statements about NocoBase in the code.
|
|
78
|
+
|
|
79
|
+
5.4 It is not allowed to provide to the public any form of AI application development platform or agent development platform SaaS/PaaS products using the original or modified Software.
|
|
80
|
+
|
|
81
|
+
===============================
|
|
82
|
+
6. Rights of Commercial License
|
|
83
|
+
===============================
|
|
84
|
+
|
|
85
|
+
6.1 Obtain a permanent commercial license of the Software.
|
|
86
|
+
|
|
87
|
+
6.2 Can develop Applications for Customers, deploy the completed Applications, including the Commercial Plugins they use, on Customers' servers, or host them and provide them to Customers as a service. This does not include Studio.
|
|
88
|
+
|
|
89
|
+
6.3 Customers can use the Commercial Plugins in the Applications delivered to them, within those Applications only, and can continue to develop those Applications on their own or through others.
|
|
90
|
+
|
|
91
|
+
6.4 Get software upgrades and exclusive technical support during the upgrade validity period. Upgrades and technical support are provided to the User only, and the User can upgrade the Commercial Plugins in Applications delivered to Customers during this period.
|
|
92
|
+
|
|
93
|
+
6.5 The licensed Software can be used for commercial purposes with no restrictions on the number of Applications, Customers, users, and Agents.
|
|
94
|
+
|
|
95
|
+
6.6 Can remove or change the NocoBase statement described in 5.2, and the brand, name, link, and other information about NocoBase on the interface of Applications.
|
|
96
|
+
|
|
97
|
+
6.7 If there are other agreements in the contract for the above rights, the contract agreement shall prevail.
|
|
98
|
+
|
|
99
|
+
====================================
|
|
100
|
+
7. Obligations of Commercial License
|
|
101
|
+
====================================
|
|
102
|
+
|
|
103
|
+
7.1 It is not allowed to remove or change all intellectual property statements about NocoBase in the code.
|
|
104
|
+
|
|
105
|
+
7.2 It is not allowed to sell, transfer, lease, share, gift, or distribute the Commercial License. Deploying Applications for Customers under 6.2 is not considered sharing the Commercial License, but the license key, access token, or other credentials of the Commercial License shall not be provided to Customers for any purpose other than deploying and running the Applications delivered to them.
|
|
106
|
+
|
|
107
|
+
7.3 It is not allowed to sell, transfer, lease, share, or distribute any form of AI application development platform, agent development platform, or developer tools developed based on Software.
|
|
108
|
+
|
|
109
|
+
7.4 It is not allowed to provide any form of AI application development platform or agent development platform SaaS/PaaS products to the public using the original or modified Software.
|
|
110
|
+
|
|
111
|
+
7.5 Studio can only be used by the User holding the Commercial License, on servers owned or rented by the User. It is not allowed to deploy Studio for Customers, or to provide Studio to Customers or any third party in any form, including as a hosted service. Customers that need Studio shall purchase their own Commercial License.
|
|
112
|
+
|
|
113
|
+
7.6 Customer personnel can take part in requirement confirmation, acceptance, and release approval in the User's Studio for the Applications the User develops for them. This is not considered providing Studio to Customers, but it is not allowed to let Customers use Studio to develop their own projects.
|
|
114
|
+
|
|
115
|
+
7.7 If there is a violation of the above obligations or the terms of this Agreement, the rights owned by the User will be immediately terminated, the paid fees will not be refunded, and the Company reserves the right to pursue the User's legal responsibility.
|
|
116
|
+
|
|
117
|
+
7.8 If there are other agreements in the contract for the above obligations, the contract agreement shall prevail.
|
|
118
|
+
|
|
119
|
+
=============================================================
|
|
120
|
+
8. Legal Jurisdiction, Interpretation, and Dispute Resolution
|
|
121
|
+
=============================================================
|
|
122
|
+
|
|
123
|
+
8.1 Except for Mainland China, the interpretation, application, and all matters related to this agreement are subject to the jurisdiction of Singapore law.
|
|
124
|
+
|
|
125
|
+
8.2 Any dispute related to this Agreement should first be resolved through friendly negotiation. If the negotiation fails to resolve the dispute, the dispute should be submitted to the International Chamber of Commerce (ICC) for arbitration. The arbitration venue should be Singapore, conducted in English.
|
|
126
|
+
|
|
127
|
+
8.3 All terms and conditions of this Agreement shall be deemed enforceable to the maximum extent permitted by applicable law. If any term of this Agreement is deemed invalid by any applicable law, the invalidity of that term does not affect the validity of any other term of this Agreement, and it should be deemed that the invalid term has been modified as much as possible to make it valid and enforceable, or if the term cannot be modified, it should be deemed to have been deleted from this Agreement.
|
|
128
|
+
|
|
129
|
+
8.4 The arbitration award is final, binding on both parties, and can be enforced in any court with jurisdiction.
|
package/package.json
CHANGED
|
@@ -87,6 +87,10 @@ Install, update and customize plugins, and remove a direct NocoBase package, as
|
|
|
87
87
|
|
|
88
88
|
Business role assignments must be visible and editable through administration. Default to explicit users; do not assign application roles to every authenticated identity or broaden the inherited member role merely to enable a feature. Follow [permission assignment safety](references/authorization.md#visible-and-manageable-assignments) and run the template's initialized-assignment guard before delivery.
|
|
89
89
|
|
|
90
|
+
## Waiting feedback
|
|
91
|
+
|
|
92
|
+
For page/panel waits and native submit buttons, follow [pending feedback](references/pending-feedback.md). Use installed Loading/PendingButton and the shared timing hook; retain submission and list-state owners.
|
|
93
|
+
|
|
90
94
|
## Choose sample data or a demo system
|
|
91
95
|
|
|
92
96
|
A request to add example customers, orders or tasks normally means sample data in the existing application. Use `sample: true` seeds or `sampleDataToken`; see [sample data and demo systems](references/migrations.md#sample-data-and-demo-systems). Keep required initialization data in ordinary seeds. Do not infer an isolated demo deployment from the words "demo data" alone.
|
|
@@ -121,7 +125,7 @@ For initialization prerequisites introduced by the feature, apply [setup readine
|
|
|
121
125
|
|
|
122
126
|
## Frontend work
|
|
123
127
|
|
|
124
|
-
Before implementing interactions, follow [component selection and source review](references/frontend/component-selection.md): existing business component → installed shadcn primitive → registry addition → justified custom composition/primitive. Record the actual component source and run the targeted component checker before delivery; a matching screenshot alone does not justify duplicating a primitive.
|
|
128
|
+
Before implementing interactions, follow [component selection and source review](references/frontend/component-selection.md): existing business component → installed shadcn primitive → registry addition → justified custom composition/primitive. Record the actual component source and run the targeted component checker before delivery; a matching screenshot alone does not justify duplicating a primitive. A date field follows [Dates](references/frontend/references/form.md#dates): read the matching official shadcn Date Picker example, reuse or compose `client/components/date-picker.tsx` once, reuse it on every page, then run the checker and the field's behavior tests; a native or shadcn `Input` date input is never a date picker.
|
|
125
129
|
|
|
126
130
|
Application and plugin UI share [the UI design contract](references/frontend/design-contract.md). Read the application's existing design records and original UI references first: record whether a reference controls appearance, structure or style, apply authorized page exceptions, and retain reusable decisions outside synchronized Skills. Use the contract's system-design section when planning a business system across modules; do not redesign the system for a small edit. Plugin implementation still belongs to `nocobase-app-plugin-development`, whose UI entry points to these same design and acceptance rules.
|
|
127
131
|
|
|
@@ -3,6 +3,9 @@ import userEvent from '@testing-library/user-event';
|
|
|
3
3
|
import { expect, it } from 'vitest';
|
|
4
4
|
import { Route, Routes, Navigate } from 'react-router';
|
|
5
5
|
import { randomUUID } from 'node:crypto';
|
|
6
|
+
import type { ReactElement } from 'react';
|
|
7
|
+
import type { AppClientRegisteredRoute } from '@nocobase/app-client/plugins';
|
|
8
|
+
import { RouteTreeProvider } from '../../client/routing/route-context.js';
|
|
6
9
|
import OnboardingPage from '../../client/pages/onboarding/index.js';
|
|
7
10
|
import OnboardingWizard from '../../client/pages/onboarding/wizard.js';
|
|
8
11
|
import { renderAuthenticatedClient } from '../helpers/authenticated-client.js';
|
|
@@ -13,6 +16,26 @@ import {
|
|
|
13
16
|
type OnboardingInput,
|
|
14
17
|
type OnboardingDetail,
|
|
15
18
|
} from '../../shared/onboarding.js';
|
|
19
|
+
const routes: AppClientRegisteredRoute[] = [
|
|
20
|
+
{
|
|
21
|
+
id: 'onboarding',
|
|
22
|
+
name: 'onboarding',
|
|
23
|
+
path: '/onboarding',
|
|
24
|
+
packageName: '@nocobase/app-template-examples',
|
|
25
|
+
source: 'application',
|
|
26
|
+
authz: 'skip',
|
|
27
|
+
componentLoader: async () => ({ default: OnboardingPage }),
|
|
28
|
+
},
|
|
29
|
+
];
|
|
30
|
+
// The isolated page tree still supplies the registered list used by the safe return link.
|
|
31
|
+
const renderOnboardingClient = (
|
|
32
|
+
ui: ReactElement,
|
|
33
|
+
options: Parameters<typeof renderAuthenticatedClient>[1] = {},
|
|
34
|
+
) =>
|
|
35
|
+
renderAuthenticatedClient(
|
|
36
|
+
<RouteTreeProvider routes={routes}>{ui}</RouteTreeProvider>,
|
|
37
|
+
options,
|
|
38
|
+
);
|
|
16
39
|
const write = (input: unknown, method = 'POST') => ({
|
|
17
40
|
method,
|
|
18
41
|
headers: {
|
|
@@ -73,7 +96,7 @@ it('derives the first incomplete step with shared conditional and cross-step val
|
|
|
73
96
|
});
|
|
74
97
|
it('retains input while changing steps, validates conditions and recovers a private draft from the real API', async () => {
|
|
75
98
|
const writes: string[] = [];
|
|
76
|
-
await
|
|
99
|
+
await renderOnboardingClient(
|
|
77
100
|
<Routes>
|
|
78
101
|
<Route path='/onboarding' element={<OnboardingPage />}>
|
|
79
102
|
<Route path='new' element={<OnboardingWizard />} />
|
|
@@ -250,7 +273,7 @@ it('retains input while changing steps, validates conditions and recovers a priv
|
|
|
250
273
|
).not.toBeInTheDocument();
|
|
251
274
|
});
|
|
252
275
|
it('keeps unsaved child-page input until leaving is confirmed', async () => {
|
|
253
|
-
await
|
|
276
|
+
await renderOnboardingClient(
|
|
254
277
|
<Routes>
|
|
255
278
|
<Route path='/onboarding' element={<OnboardingPage />}>
|
|
256
279
|
<Route path='new' element={<OnboardingWizard />} />
|
|
@@ -300,7 +323,7 @@ it('locks save and submit through refresh and replays an uncertain submission wi
|
|
|
300
323
|
);
|
|
301
324
|
}
|
|
302
325
|
try {
|
|
303
|
-
const view = await
|
|
326
|
+
const view = await renderOnboardingClient(<RequestRoutes />, {
|
|
304
327
|
route: '/start',
|
|
305
328
|
async prepare(app, session) {
|
|
306
329
|
await app.connection.repository('onboardingDepartments').createOne({
|
|
@@ -20,7 +20,6 @@ import {
|
|
|
20
20
|
} from '../../shared/onboarding.js';
|
|
21
21
|
import { resetOnboarding } from '../../server/providers/onboarding-reset.js';
|
|
22
22
|
const test = createAppTest({
|
|
23
|
-
scope: 'test',
|
|
24
23
|
createServer: createStandaloneServer,
|
|
25
24
|
connections: ['main', 'analytics'],
|
|
26
25
|
config: {
|
|
@@ -31,6 +30,19 @@ const test = createAppTest({
|
|
|
31
30
|
emailAndPassword: { disableSignUp: false },
|
|
32
31
|
},
|
|
33
32
|
},
|
|
33
|
+
}).extend<{ resetData: void }>({
|
|
34
|
+
resetData: [
|
|
35
|
+
async ({ testApp }, use) => {
|
|
36
|
+
// Identities are unique per case; reset records and reference data before each one.
|
|
37
|
+
await resetOnboarding(testApp.connection, false);
|
|
38
|
+
await testApp.connection.query
|
|
39
|
+
.deleteFrom('onboardingDepartments')
|
|
40
|
+
.allowAllRows()
|
|
41
|
+
.execute();
|
|
42
|
+
await use(undefined);
|
|
43
|
+
},
|
|
44
|
+
{ auto: true },
|
|
45
|
+
],
|
|
34
46
|
});
|
|
35
47
|
const write = (
|
|
36
48
|
input: unknown,
|
|
@@ -11,7 +11,6 @@ import type { ProcurementDetail } from '../../shared/procurement.js';
|
|
|
11
11
|
import { resetProcurement } from '../../server/providers/procurement-reset.js';
|
|
12
12
|
|
|
13
13
|
const test = createAppTest({
|
|
14
|
-
scope: 'test',
|
|
15
14
|
createServer: createStandaloneServer,
|
|
16
15
|
connections: ['main', 'analytics'],
|
|
17
16
|
config: {
|
|
@@ -22,6 +21,21 @@ const test = createAppTest({
|
|
|
22
21
|
emailAndPassword: { disableSignUp: false },
|
|
23
22
|
},
|
|
24
23
|
},
|
|
24
|
+
}).extend<{ resetData: void }>({
|
|
25
|
+
resetData: [
|
|
26
|
+
async ({ testApp }, use) => {
|
|
27
|
+
// Keep the installed application, but start each case with empty business data.
|
|
28
|
+
await resetProcurement(testApp.connection, false);
|
|
29
|
+
for (const table of ['procurementMaterials', 'procurementSuppliers']) {
|
|
30
|
+
await testApp.connection.query
|
|
31
|
+
.deleteFrom(table)
|
|
32
|
+
.allowAllRows()
|
|
33
|
+
.execute();
|
|
34
|
+
}
|
|
35
|
+
await use(undefined);
|
|
36
|
+
},
|
|
37
|
+
{ auto: true },
|
|
38
|
+
],
|
|
25
39
|
});
|
|
26
40
|
const write = (
|
|
27
41
|
input: unknown,
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
resolveListState,
|
|
3
|
+
useApiClient,
|
|
4
|
+
useToaster,
|
|
5
|
+
} from '@nocobase/app-client';
|
|
2
6
|
import { useTranslation } from '@nocobase/i18n/client';
|
|
3
7
|
import { useEffect, useRef, useState } from 'react';
|
|
4
8
|
import {
|
|
@@ -9,13 +13,14 @@ import {
|
|
|
9
13
|
useParams,
|
|
10
14
|
} from 'react-router';
|
|
11
15
|
import type { ColumnDef } from '@tanstack/react-table';
|
|
12
|
-
import { MoreHorizontal
|
|
16
|
+
import { MoreHorizontal } from 'lucide-react';
|
|
13
17
|
import { RouteChildPage } from '#components/route-child-page';
|
|
14
18
|
import { BackButton } from '#components/back-button';
|
|
15
19
|
import { PageContainer } from '#components/page-container';
|
|
16
20
|
import { PageHeader } from '#components/page-header';
|
|
17
21
|
import { LongText } from '#components/long-text';
|
|
18
22
|
import { DataTable } from '#components/data-table';
|
|
23
|
+
import { RefreshIndicator } from '#components/loading';
|
|
19
24
|
import { RecordLink } from '#components/record-link';
|
|
20
25
|
import { StatusBadge } from '#components/status-badge';
|
|
21
26
|
import { Button } from '#components/ui/button';
|
|
@@ -83,6 +88,14 @@ export default function CustomerDetailPage() {
|
|
|
83
88
|
headingRef.current?.focus();
|
|
84
89
|
}, [active, request.loading]);
|
|
85
90
|
const customer = request.data?.data;
|
|
91
|
+
const contactState = resolveListState(
|
|
92
|
+
{
|
|
93
|
+
data: contacts.data,
|
|
94
|
+
error: contacts.error,
|
|
95
|
+
isPending: contacts.loading && !contacts.data,
|
|
96
|
+
},
|
|
97
|
+
contacts.data?.data.length ?? 0,
|
|
98
|
+
);
|
|
86
99
|
const writable = customer && customer.status !== 'closed';
|
|
87
100
|
const reload = () => {
|
|
88
101
|
request.reload();
|
|
@@ -206,14 +219,6 @@ export default function CustomerDetailPage() {
|
|
|
206
219
|
{t('customerContacts.edit')}
|
|
207
220
|
</Button>
|
|
208
221
|
)}
|
|
209
|
-
<Button
|
|
210
|
-
variant='outline'
|
|
211
|
-
disabled={request.loading}
|
|
212
|
-
onClick={reload}
|
|
213
|
-
>
|
|
214
|
-
<RefreshCw />
|
|
215
|
-
{t('customerContacts.refresh')}
|
|
216
|
-
</Button>
|
|
217
222
|
</>
|
|
218
223
|
)
|
|
219
224
|
}
|
|
@@ -224,28 +229,35 @@ export default function CustomerDetailPage() {
|
|
|
224
229
|
) : (
|
|
225
230
|
customer && (
|
|
226
231
|
<>
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
232
|
+
{/* The summary and the contacts table refresh independently; each owns its feedback. */}
|
|
233
|
+
<div className='relative'>
|
|
234
|
+
<RefreshIndicator pending={active && request.loading} />
|
|
235
|
+
<dl
|
|
236
|
+
className='grid grid-cols-[8rem_1fr] gap-4 text-sm'
|
|
237
|
+
aria-busy={active && request.loading}
|
|
238
|
+
>
|
|
239
|
+
<dt className='text-muted-foreground'>
|
|
240
|
+
{t('customerContacts.status')}
|
|
241
|
+
</dt>
|
|
242
|
+
<dd>
|
|
243
|
+
<StatusBadge>
|
|
244
|
+
{t(`customerContacts.${customer.status}`)}
|
|
245
|
+
</StatusBadge>
|
|
246
|
+
</dd>
|
|
247
|
+
<dt className='text-muted-foreground'>
|
|
248
|
+
{t('customerContacts.owner')}
|
|
249
|
+
</dt>
|
|
250
|
+
<dd>
|
|
251
|
+
<OwnerName id={customer.ownerId} />
|
|
252
|
+
</dd>
|
|
253
|
+
<dt className='text-muted-foreground'>
|
|
254
|
+
{t('customerContacts.notes')}
|
|
255
|
+
</dt>
|
|
256
|
+
<dd className='min-w-0 whitespace-pre-wrap break-words'>
|
|
257
|
+
<LongText>{customer.notes || '—'}</LongText>
|
|
258
|
+
</dd>
|
|
259
|
+
</dl>
|
|
260
|
+
</div>
|
|
249
261
|
{!writable && (
|
|
250
262
|
<p className='text-sm text-muted-foreground'>
|
|
251
263
|
{t('customerContacts.readOnly')}
|
|
@@ -272,29 +284,28 @@ export default function CustomerDetailPage() {
|
|
|
272
284
|
</Button>
|
|
273
285
|
)}
|
|
274
286
|
</div>
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
)}
|
|
287
|
+
<DataTable
|
|
288
|
+
columns={columns}
|
|
289
|
+
data={contacts.data?.data ?? []}
|
|
290
|
+
manualPagination
|
|
291
|
+
rowCount={contacts.data?.meta.total ?? 0}
|
|
292
|
+
paginationState={{ pageIndex: page, pageSize: 10 }}
|
|
293
|
+
onPaginationChange={(update) =>
|
|
294
|
+
setPage(
|
|
295
|
+
(old) =>
|
|
296
|
+
(typeof update === 'function'
|
|
297
|
+
? update({ pageIndex: old, pageSize: 10 })
|
|
298
|
+
: update
|
|
299
|
+
).pageIndex,
|
|
300
|
+
)
|
|
301
|
+
}
|
|
302
|
+
pageSizeOptions={[10]}
|
|
303
|
+
showSelectedCount={false}
|
|
304
|
+
loading={active && contacts.loading}
|
|
305
|
+
loadingIdentity={contacts.path}
|
|
306
|
+
listState={contactState}
|
|
307
|
+
onRetry={contacts.reload}
|
|
308
|
+
/>
|
|
298
309
|
</>
|
|
299
310
|
)
|
|
300
311
|
)}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { useQuery } from '@tanstack/react-query';
|
|
2
2
|
import { useAuthentication } from '@nocobase/app-plugin-authentication/client';
|
|
3
3
|
import {
|
|
4
|
+
resolveListState,
|
|
4
5
|
useApiClient,
|
|
5
6
|
useToaster,
|
|
6
|
-
ApiClientError,
|
|
7
|
-
type ListState,
|
|
8
7
|
} from '@nocobase/app-client';
|
|
9
8
|
import {
|
|
10
9
|
useCan,
|
|
@@ -14,7 +13,6 @@ import { useTranslation } from '@nocobase/i18n/client';
|
|
|
14
13
|
import { useEffect, useRef, useState } from 'react';
|
|
15
14
|
import { Link, Outlet, useLocation } from 'react-router';
|
|
16
15
|
import type { ColumnDef } from '@tanstack/react-table';
|
|
17
|
-
import { RefreshCw } from 'lucide-react';
|
|
18
16
|
import { DataTable } from '#components/data-table';
|
|
19
17
|
import { PageContainer } from '#components/page-container';
|
|
20
18
|
import { PageHeader } from '#components/page-header';
|
|
@@ -193,23 +191,15 @@ function CustomerContactsContent() {
|
|
|
193
191
|
cell: ({ row }) => <OwnerName id={row.original.ownerId} />,
|
|
194
192
|
},
|
|
195
193
|
];
|
|
196
|
-
const state
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
: request.error
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
? rows.length
|
|
206
|
-
? 'ready'
|
|
207
|
-
: 'loading'
|
|
208
|
-
: rows.length
|
|
209
|
-
? 'ready'
|
|
210
|
-
: search || status !== 'all' || owner
|
|
211
|
-
? 'no-results'
|
|
212
|
-
: 'empty';
|
|
194
|
+
const state = resolveListState(
|
|
195
|
+
{
|
|
196
|
+
data: currentData,
|
|
197
|
+
error: request.error,
|
|
198
|
+
isPending: request.loading && !currentData,
|
|
199
|
+
},
|
|
200
|
+
rows.length,
|
|
201
|
+
Boolean(search || status !== 'all' || owner),
|
|
202
|
+
);
|
|
213
203
|
const reload = () => {
|
|
214
204
|
setSelection({ key: '', ids: [] });
|
|
215
205
|
request.reload();
|
|
@@ -259,15 +249,6 @@ function CustomerContactsContent() {
|
|
|
259
249
|
{t('customerContacts.reset')}
|
|
260
250
|
</Button>
|
|
261
251
|
)}
|
|
262
|
-
<Button
|
|
263
|
-
variant='outline'
|
|
264
|
-
onClick={reload}
|
|
265
|
-
disabled={request.loading}
|
|
266
|
-
aria-label={t('customerContacts.refresh')}
|
|
267
|
-
>
|
|
268
|
-
<RefreshCw className={request.loading ? 'animate-spin' : ''} />
|
|
269
|
-
{t('customerContacts.refresh')}
|
|
270
|
-
</Button>
|
|
271
252
|
</>
|
|
272
253
|
}
|
|
273
254
|
/>
|
|
@@ -339,6 +320,7 @@ function CustomerContactsContent() {
|
|
|
339
320
|
showSelectedCount={false}
|
|
340
321
|
listState={state}
|
|
341
322
|
loading={active && request.loading}
|
|
323
|
+
loadingIdentity={path}
|
|
342
324
|
onRetry={reload}
|
|
343
325
|
/>
|
|
344
326
|
<AlertDialog
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export const enUS = {
|
|
2
|
-
refresh: 'Refresh',
|
|
3
2
|
signIn: 'Sign in',
|
|
4
3
|
title: 'Customers and contacts',
|
|
5
4
|
description:
|
|
@@ -77,7 +76,6 @@ export const enUS = {
|
|
|
77
76
|
invalid: 'Check the highlighted fields.',
|
|
78
77
|
};
|
|
79
78
|
export const zhCN: Record<keyof typeof enUS, string> = {
|
|
80
|
-
refresh: '刷新',
|
|
81
79
|
signIn: '登录',
|
|
82
80
|
title: '客户与联系人',
|
|
83
81
|
description: '练习按权限选择关联记录和批量修改当前页客户。',
|