@qlover/create-app 0.7.5 → 0.7.6
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/CHANGELOG.md +20 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/templates/react-app/.env.template +0 -2
- package/dist/templates/react-app/__tests__/src/base/services/I18nService.test.ts +1 -1
- package/dist/templates/react-app/__tests__/src/core/IOC.test.ts +6 -31
- package/dist/templates/react-app/__tests__/src/core/bootstraps/BootstrapsApp.test.ts +1 -1
- package/dist/templates/react-app/config/IOCIdentifier.ts +77 -5
- package/dist/templates/react-app/config/app.router.ts +2 -2
- package/dist/templates/react-app/package.json +4 -7
- package/dist/templates/react-app/public/locales/en/common.json +1 -1
- package/dist/templates/react-app/public/locales/zh/common.json +1 -1
- package/dist/templates/react-app/src/App.tsx +9 -4
- package/dist/templates/react-app/src/base/apis/userApi/UserApi.ts +1 -1
- package/dist/templates/react-app/src/base/apis/userApi/UserApiBootstarp.ts +4 -0
- package/dist/templates/react-app/src/base/cases/DialogHandler.ts +16 -13
- package/dist/templates/react-app/src/base/cases/I18nKeyErrorPlugin.ts +4 -3
- package/dist/templates/react-app/src/base/cases/InversifyContainer.ts +2 -2
- package/dist/templates/react-app/src/base/cases/RequestLanguages.ts +39 -0
- package/dist/templates/react-app/src/base/cases/RequestState.ts +20 -0
- package/dist/templates/react-app/src/base/cases/RequestStatusCatcher.ts +2 -2
- package/dist/templates/react-app/src/base/cases/RouterLoader.ts +8 -2
- package/dist/templates/react-app/src/base/port/AsyncStateInterface.ts +7 -0
- package/dist/templates/react-app/src/base/port/ExecutorPageBridgeInterface.ts +24 -0
- package/dist/templates/react-app/src/base/port/I18nServiceInterface.ts +10 -0
- package/dist/templates/react-app/src/base/port/JSONStoragePageBridgeInterface.ts +20 -0
- package/dist/templates/react-app/src/base/port/ProcesserExecutorInterface.ts +20 -0
- package/dist/templates/react-app/src/base/port/RequestPageBridgeInterface.ts +23 -0
- package/dist/templates/react-app/src/base/port/RequestStatusInterface.ts +5 -0
- package/dist/templates/react-app/src/base/port/RouteServiceInterface.ts +27 -0
- package/dist/templates/react-app/src/base/port/UserServiceInterface.ts +12 -0
- package/dist/templates/react-app/src/base/services/I18nService.ts +10 -6
- package/dist/templates/react-app/src/base/services/ProcesserExecutor.ts +23 -5
- package/dist/templates/react-app/src/base/services/RouteService.ts +25 -54
- package/dist/templates/react-app/src/base/services/UserService.ts +10 -20
- package/dist/templates/react-app/src/core/IOC.ts +1 -26
- package/dist/templates/react-app/src/core/IocRegisterImpl.ts +125 -0
- package/dist/templates/react-app/src/core/bootstraps/BootstrapApp.ts +4 -6
- package/dist/templates/react-app/src/core/bootstraps/BootstrapsRegistry.ts +8 -6
- package/dist/templates/react-app/src/core/bootstraps/IocIdentifierTest.ts +26 -0
- package/dist/templates/react-app/src/pages/auth/Layout.tsx +2 -2
- package/dist/templates/react-app/src/pages/auth/LoginPage.tsx +5 -6
- package/dist/templates/react-app/src/pages/auth/RegisterPage.tsx +8 -7
- package/dist/templates/react-app/src/pages/base/ExecutorPage.tsx +8 -19
- package/dist/templates/react-app/src/pages/base/{ErrorIdentifierPage.tsx → IdentifierPage.tsx} +1 -1
- package/dist/templates/react-app/src/pages/base/JSONStoragePage.tsx +11 -15
- package/dist/templates/react-app/src/pages/base/Layout.tsx +1 -1
- package/dist/templates/react-app/src/pages/base/RedirectPathname.tsx +2 -2
- package/dist/templates/react-app/src/pages/base/RequestPage.tsx +34 -46
- package/dist/templates/react-app/src/styles/css/antd-themes/_default.css +2 -2
- package/dist/templates/react-app/src/styles/css/antd-themes/dark.css +2 -2
- package/dist/templates/react-app/src/styles/css/antd-themes/pink.css +2 -2
- package/dist/templates/react-app/src/styles/css/index.css +1 -0
- package/dist/templates/react-app/src/styles/css/page.css +8 -0
- package/dist/templates/react-app/src/styles/css/zIndex.css +9 -0
- package/dist/templates/react-app/src/uikit/{controllers/ExecutorController.ts → bridges/ExecutorPageBridge.ts} +13 -36
- package/dist/templates/react-app/src/uikit/bridges/JSONStoragePageBridge.ts +41 -0
- package/dist/templates/react-app/src/uikit/bridges/NavigateBridge.ts +16 -0
- package/dist/templates/react-app/src/uikit/bridges/RequestPageBridge.ts +136 -0
- package/dist/templates/react-app/src/uikit/components/LanguageSwitcher.tsx +3 -2
- package/dist/templates/react-app/src/uikit/components/LogoutButton.tsx +2 -2
- package/dist/templates/react-app/src/uikit/{providers → components}/ProcessExecutorProvider.tsx +4 -4
- package/dist/templates/react-app/src/uikit/components/RouterRenderComponent.tsx +1 -1
- package/dist/templates/react-app/src/uikit/components/ThemeSwitcher.tsx +3 -5
- package/dist/templates/react-app/src/uikit/{providers → components}/UserAuthProvider.tsx +3 -3
- package/dist/templates/react-app/src/uikit/hooks/useI18nGuard.ts +5 -2
- package/dist/templates/react-app/src/uikit/hooks/{userRouterService.ts → useNavigateBridge.ts} +3 -3
- package/dist/templates/react-app/src/uikit/hooks/useStore.ts +5 -2
- package/dist/templates/react-app/tsconfig.json +1 -4
- package/package.json +1 -1
- package/dist/templates/react-app/src/base/port/InteractionHubInterface.ts +0 -94
- package/dist/templates/react-app/src/base/port/UIDependenciesInterface.ts +0 -37
- package/dist/templates/react-app/src/core/registers/IocRegisterImpl.ts +0 -25
- package/dist/templates/react-app/src/core/registers/RegisterCommon.ts +0 -74
- package/dist/templates/react-app/src/core/registers/RegisterControllers.ts +0 -26
- package/dist/templates/react-app/src/core/registers/RegisterGlobals.ts +0 -30
- package/dist/templates/react-app/src/uikit/controllers/JSONStorageController.ts +0 -49
- package/dist/templates/react-app/src/uikit/controllers/RequestController.ts +0 -158
- /package/dist/templates/react-app/src/uikit/{providers → components}/BaseRouteProvider.tsx +0 -0
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
IOCContainerInterface,
|
|
4
4
|
IOCFunctionInterface
|
|
5
5
|
} from '@qlover/corekit-bridge';
|
|
6
|
+
import type { IOCIdentifierMap } from '@config/IOCIdentifier';
|
|
6
7
|
import { envBlackList, envPrefix, browserGlobalsName } from '@config/common';
|
|
7
8
|
import * as globals from '../globals';
|
|
8
|
-
import { IocRegisterImpl } from '../
|
|
9
|
+
import { IocRegisterImpl } from '../IocRegisterImpl';
|
|
9
10
|
import { BootstrapsRegistry } from './BootstrapsRegistry';
|
|
10
11
|
import { isObject } from 'lodash';
|
|
11
|
-
import { IOCIdentifierMap } from '../IOC';
|
|
12
12
|
|
|
13
13
|
export type BootstrapAppArgs = {
|
|
14
14
|
/**
|
|
@@ -44,10 +44,9 @@ export class BootstrapApp {
|
|
|
44
44
|
},
|
|
45
45
|
envOptions: {
|
|
46
46
|
target: appConfig,
|
|
47
|
-
source: {
|
|
48
|
-
...import.meta.env,
|
|
47
|
+
source: Object.assign({}, import.meta.env, {
|
|
49
48
|
[envPrefix + 'BOOT_HREF']: bootHref
|
|
50
|
-
},
|
|
49
|
+
}),
|
|
51
50
|
prefix: envPrefix,
|
|
52
51
|
blackList: envBlackList
|
|
53
52
|
},
|
|
@@ -67,7 +66,6 @@ export class BootstrapApp {
|
|
|
67
66
|
|
|
68
67
|
await bootstrap.use(bootstrapsRegistry.register()).start();
|
|
69
68
|
} catch (error) {
|
|
70
|
-
console.log(error);
|
|
71
69
|
logger.error(`${appConfig.appName} starup error:`, error);
|
|
72
70
|
}
|
|
73
71
|
|
|
@@ -8,10 +8,8 @@ import { UserApiBootstarp } from '@/base/apis/userApi/UserApiBootstarp';
|
|
|
8
8
|
import { FeApiBootstarp } from '@/base/apis/feApi/FeApiBootstarp';
|
|
9
9
|
import { AiApiBootstarp } from '@/base/apis/AiApi';
|
|
10
10
|
import { printBootstrap } from './PrintBootstrap';
|
|
11
|
-
import { IOCIdentifier } from '@config/IOCIdentifier';
|
|
12
|
-
import {
|
|
13
|
-
import { I18nKeyErrorPlugin } from '@/base/cases/I18nKeyErrorPlugin';
|
|
14
|
-
import { IOCIdentifierMap } from '../IOC';
|
|
11
|
+
import { IOCIdentifier, IOCIdentifierMap } from '@config/IOCIdentifier';
|
|
12
|
+
import { IocIdentifierTest } from './IocIdentifierTest';
|
|
15
13
|
|
|
16
14
|
export class BootstrapsRegistry {
|
|
17
15
|
constructor(
|
|
@@ -26,17 +24,21 @@ export class BootstrapsRegistry {
|
|
|
26
24
|
const IOC = this.IOC;
|
|
27
25
|
|
|
28
26
|
const bootstrapList = [
|
|
29
|
-
IOC(
|
|
27
|
+
IOC(IOCIdentifier.I18nServiceInterface),
|
|
30
28
|
new UserApiBootstarp(),
|
|
31
29
|
new FeApiBootstarp(),
|
|
32
30
|
AiApiBootstarp,
|
|
33
|
-
IOC(I18nKeyErrorPlugin)
|
|
31
|
+
IOC(IOCIdentifier.I18nKeyErrorPlugin)
|
|
34
32
|
];
|
|
35
33
|
|
|
36
34
|
if (!this.appConfig.isProduction) {
|
|
37
35
|
bootstrapList.push(printBootstrap);
|
|
38
36
|
}
|
|
39
37
|
|
|
38
|
+
bootstrapList.push(IocIdentifierTest);
|
|
39
|
+
// TODO: 需要使用到
|
|
40
|
+
bootstrapList.push(IOC(IOCIdentifier.ProcesserExecutorInterface));
|
|
41
|
+
|
|
40
42
|
return bootstrapList;
|
|
41
43
|
}
|
|
42
44
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { IOCIdentifier } from '@config/IOCIdentifier';
|
|
2
|
+
import { BootstrapExecutorPlugin } from '@qlover/corekit-bridge';
|
|
3
|
+
|
|
4
|
+
export const IocIdentifierTest: BootstrapExecutorPlugin = {
|
|
5
|
+
pluginName: 'IocIdentifierTest',
|
|
6
|
+
onSuccess({ parameters: { logger, ioc } }) {
|
|
7
|
+
const errorList: string[] = [];
|
|
8
|
+
const keyList: string[] = Object.keys(IOCIdentifier);
|
|
9
|
+
keyList.forEach((key) => {
|
|
10
|
+
try {
|
|
11
|
+
const value = ioc.get(key);
|
|
12
|
+
if (value === undefined) {
|
|
13
|
+
errorList.push(key);
|
|
14
|
+
}
|
|
15
|
+
} catch {
|
|
16
|
+
errorList.push(key);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
if (errorList.length > 0) {
|
|
21
|
+
logger.warn(`IOC ${errorList.join(', ')} is not found`);
|
|
22
|
+
} else {
|
|
23
|
+
logger.info(`IOC all identifiers are found ${keyList.length}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { IOC } from '@/core/IOC';
|
|
2
|
-
import { UserService } from '@/base/services/UserService';
|
|
3
2
|
import { Navigate, Outlet } from 'react-router-dom';
|
|
4
3
|
import { useStore } from '@/uikit/hooks/useStore';
|
|
5
4
|
import BaseHeader from '../../uikit/components/BaseHeader';
|
|
5
|
+
import { IOCIdentifier } from '@config/IOCIdentifier';
|
|
6
6
|
|
|
7
7
|
export default function Layout() {
|
|
8
|
-
const userService = IOC(
|
|
8
|
+
const userService = IOC(IOCIdentifier.UserServiceInterface);
|
|
9
9
|
useStore(userService.store);
|
|
10
10
|
|
|
11
11
|
// If user is authenticated, redirect to home page
|
|
@@ -3,10 +3,9 @@ import { Form, Input, Button } from 'antd';
|
|
|
3
3
|
import { UserOutlined, LockOutlined, GoogleOutlined } from '@ant-design/icons';
|
|
4
4
|
import { IOC } from '@/core/IOC';
|
|
5
5
|
import { useBaseRoutePage } from '@/uikit/contexts/BaseRouteContext';
|
|
6
|
-
import { RouteService } from '@/base/services/RouteService';
|
|
7
|
-
import { UserService } from '@/base/services/UserService';
|
|
8
6
|
import * as i18nKeys from '@config/Identifier/page.login';
|
|
9
7
|
import LocaleLink from '@/uikit/components/LocaleLink';
|
|
8
|
+
import { IOCIdentifier } from '@config/IOCIdentifier';
|
|
10
9
|
|
|
11
10
|
interface LoginFormData {
|
|
12
11
|
email: string;
|
|
@@ -15,8 +14,8 @@ interface LoginFormData {
|
|
|
15
14
|
|
|
16
15
|
export default function LoginPage() {
|
|
17
16
|
const { t } = useBaseRoutePage();
|
|
18
|
-
const userService = IOC(
|
|
19
|
-
const AppConfig = IOC(
|
|
17
|
+
const userService = IOC(IOCIdentifier.UserServiceInterface);
|
|
18
|
+
const AppConfig = IOC(IOCIdentifier.AppConfig);
|
|
20
19
|
const [loading, setLoading] = useState(false);
|
|
21
20
|
|
|
22
21
|
const handleLogin = async (values: LoginFormData) => {
|
|
@@ -26,9 +25,9 @@ export default function LoginPage() {
|
|
|
26
25
|
username: values.email,
|
|
27
26
|
password: values.password
|
|
28
27
|
});
|
|
29
|
-
IOC(
|
|
28
|
+
IOC(IOCIdentifier.RouteServiceInterface).replaceToHome();
|
|
30
29
|
} catch (error) {
|
|
31
|
-
|
|
30
|
+
IOC(IOCIdentifier.Logger).error(error);
|
|
32
31
|
} finally {
|
|
33
32
|
setLoading(false);
|
|
34
33
|
}
|
|
@@ -3,14 +3,15 @@ import { Form, Input, Button, Checkbox } from 'antd';
|
|
|
3
3
|
import { UserOutlined, LockOutlined, MailOutlined } from '@ant-design/icons';
|
|
4
4
|
import { IOC } from '@/core/IOC';
|
|
5
5
|
import { useBaseRoutePage } from '@/uikit/contexts/BaseRouteContext';
|
|
6
|
-
import {
|
|
7
|
-
import { RegisterFormData, UserService } from '@/base/services/UserService';
|
|
6
|
+
import { RegisterFormData } from '@/base/services/UserService';
|
|
8
7
|
import * as i18nKeys from '@config/Identifier/page.register';
|
|
8
|
+
import { IOCIdentifier } from '@config/IOCIdentifier';
|
|
9
9
|
|
|
10
10
|
export default function RegisterPage() {
|
|
11
11
|
const { t } = useBaseRoutePage();
|
|
12
|
-
const
|
|
13
|
-
const
|
|
12
|
+
const AppConfig = IOC(IOCIdentifier.AppConfig);
|
|
13
|
+
const userService = IOC(IOCIdentifier.UserServiceInterface);
|
|
14
|
+
const routeService = IOC(IOCIdentifier.RouteServiceInterface);
|
|
14
15
|
const [loading, setLoading] = useState(false);
|
|
15
16
|
const [form] = Form.useForm();
|
|
16
17
|
|
|
@@ -18,9 +19,9 @@ export default function RegisterPage() {
|
|
|
18
19
|
try {
|
|
19
20
|
setLoading(true);
|
|
20
21
|
await userService.register(values);
|
|
21
|
-
|
|
22
|
+
routeService.replaceToHome();
|
|
22
23
|
} catch (error) {
|
|
23
|
-
|
|
24
|
+
IOC(IOCIdentifier.Logger).error(error);
|
|
24
25
|
} finally {
|
|
25
26
|
setLoading(false);
|
|
26
27
|
}
|
|
@@ -28,7 +29,7 @@ export default function RegisterPage() {
|
|
|
28
29
|
|
|
29
30
|
const handleLoginClick = (e: React.MouseEvent) => {
|
|
30
31
|
e.preventDefault();
|
|
31
|
-
|
|
32
|
+
routeService.gotoLogin();
|
|
32
33
|
};
|
|
33
34
|
|
|
34
35
|
return (
|
|
@@ -2,10 +2,9 @@ import { Button, Progress, Tag, Space, Card, Input, Select } from 'antd';
|
|
|
2
2
|
import { useBaseRoutePage } from '@/uikit/contexts/BaseRouteContext';
|
|
3
3
|
import { useState, useEffect } from 'react';
|
|
4
4
|
import { IOC } from '@/core/IOC';
|
|
5
|
-
import { JSONStorageController } from '@/uikit/controllers/JSONStorageController';
|
|
6
|
-
import { ExecutorController } from '@/uikit/controllers/ExecutorController';
|
|
7
5
|
import { useStore } from '@/uikit/hooks/useStore';
|
|
8
6
|
import * as i18nKeys from '@config/Identifier/page.executor';
|
|
7
|
+
import { IOCIdentifier } from '@config/IOCIdentifier';
|
|
9
8
|
|
|
10
9
|
interface Task {
|
|
11
10
|
id: string;
|
|
@@ -22,17 +21,10 @@ interface Task {
|
|
|
22
21
|
|
|
23
22
|
export default function ExecutorPage() {
|
|
24
23
|
const { t } = useBaseRoutePage();
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const requestTimeout = useStore(
|
|
28
|
-
|
|
29
|
-
jSONStorageController.selector.requestTimeout
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
const helloState = useStore(
|
|
33
|
-
executorController,
|
|
34
|
-
executorController.selector.helloState
|
|
35
|
-
);
|
|
24
|
+
const pageBridge = IOC(IOCIdentifier.ExecutorPageBridgeInterface);
|
|
25
|
+
const jspBridge = IOC(IOCIdentifier.JSONStoragePageInterface);
|
|
26
|
+
const requestTimeout = useStore(jspBridge, jspBridge.selector.requestTimeout);
|
|
27
|
+
const helloState = useStore(pageBridge, pageBridge.selector.helloState);
|
|
36
28
|
|
|
37
29
|
const [tasks, setTasks] = useState<Task[]>([
|
|
38
30
|
{
|
|
@@ -164,7 +156,7 @@ export default function ExecutorPage() {
|
|
|
164
156
|
);
|
|
165
157
|
|
|
166
158
|
try {
|
|
167
|
-
await
|
|
159
|
+
await pageBridge.onTestPlugins();
|
|
168
160
|
|
|
169
161
|
setTasks((prevTasks) =>
|
|
170
162
|
prevTasks.map((t) =>
|
|
@@ -256,10 +248,7 @@ export default function ExecutorPage() {
|
|
|
256
248
|
{helloState.loading ? (
|
|
257
249
|
<div className="text-text-secondary">Loading...</div>
|
|
258
250
|
) : (
|
|
259
|
-
<Button
|
|
260
|
-
type="primary"
|
|
261
|
-
onClick={executorController.onTestPlugins}
|
|
262
|
-
>
|
|
251
|
+
<Button type="primary" onClick={pageBridge.onTestPlugins}>
|
|
263
252
|
{t(i18nKeys.PAGE_EXECUTOR_TEST_PLUGIN_TITLE)}
|
|
264
253
|
</Button>
|
|
265
254
|
)}
|
|
@@ -269,7 +258,7 @@ export default function ExecutorPage() {
|
|
|
269
258
|
<div className="text-red-500">{helloState.error.message}</div>
|
|
270
259
|
) : (
|
|
271
260
|
<pre className="text-text-secondary">
|
|
272
|
-
{IOC('
|
|
261
|
+
{IOC('JSONSerializer').stringify(helloState.result?.data)}
|
|
273
262
|
</pre>
|
|
274
263
|
)}
|
|
275
264
|
</div>
|
package/dist/templates/react-app/src/pages/base/{ErrorIdentifierPage.tsx → IdentifierPage.tsx}
RENAMED
|
@@ -3,7 +3,7 @@ import { useBaseRoutePage } from '@/uikit/contexts/BaseRouteContext';
|
|
|
3
3
|
import * as ErrorIdentifierList from '@config/Identifier/common.error';
|
|
4
4
|
import * as i18nKeys from '@config/Identifier/page.identifiter';
|
|
5
5
|
|
|
6
|
-
export default function
|
|
6
|
+
export default function IdentifierPage() {
|
|
7
7
|
const { t } = useBaseRoutePage();
|
|
8
8
|
|
|
9
9
|
return (
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { IOC } from '@/core/IOC';
|
|
2
2
|
import { useBaseRoutePage } from '@/uikit/contexts/BaseRouteContext';
|
|
3
3
|
import template from 'lodash/template';
|
|
4
|
-
import { JSONStorageController } from '@/uikit/controllers/JSONStorageController';
|
|
5
4
|
import { useStore } from '@/uikit/hooks/useStore';
|
|
6
5
|
import { Button, Input } from 'antd';
|
|
7
6
|
import * as i18nKeys from '@config/Identifier/page.jsonStorage';
|
|
7
|
+
import { IOCIdentifier } from '@config/IOCIdentifier';
|
|
8
8
|
|
|
9
9
|
export default function JSONStoragePage() {
|
|
10
|
-
const
|
|
11
|
-
const
|
|
10
|
+
const pageBridge = IOC(IOCIdentifier.JSONStoragePageInterface);
|
|
11
|
+
const pageState = useStore(pageBridge);
|
|
12
12
|
const { t } = useBaseRoutePage();
|
|
13
13
|
|
|
14
14
|
return (
|
|
@@ -36,7 +36,7 @@ export default function JSONStoragePage() {
|
|
|
36
36
|
<div className="flex flex-col items-center space-y-4">
|
|
37
37
|
<Button
|
|
38
38
|
type="primary"
|
|
39
|
-
onClick={
|
|
39
|
+
onClick={pageBridge.changeRandomTestKey1}
|
|
40
40
|
>
|
|
41
41
|
{t(i18nKeys.PAGE_JSONSTORAGE_SET_RANDOM)}
|
|
42
42
|
</Button>
|
|
@@ -46,7 +46,7 @@ export default function JSONStoragePage() {
|
|
|
46
46
|
{t(i18nKeys.PAGE_JSONSTORAGE_CURRENT_VALUE)}:{' '}
|
|
47
47
|
</span>
|
|
48
48
|
<span className="font-semibold text-text">
|
|
49
|
-
{JSON.stringify(
|
|
49
|
+
{JSON.stringify(pageState.testKey1)}
|
|
50
50
|
</span>
|
|
51
51
|
</div>
|
|
52
52
|
</div>
|
|
@@ -69,11 +69,9 @@ export default function JSONStoragePage() {
|
|
|
69
69
|
<div className="flex items-center space-x-4">
|
|
70
70
|
<Input
|
|
71
71
|
type="number"
|
|
72
|
-
value={
|
|
72
|
+
value={pageState.expireTime}
|
|
73
73
|
onChange={(e) =>
|
|
74
|
-
|
|
75
|
-
Number(e.target.value)
|
|
76
|
-
)
|
|
74
|
+
pageBridge.changeExpireTime(Number(e.target.value))
|
|
77
75
|
}
|
|
78
76
|
className="w-32"
|
|
79
77
|
min="1000"
|
|
@@ -86,7 +84,7 @@ export default function JSONStoragePage() {
|
|
|
86
84
|
|
|
87
85
|
<Button
|
|
88
86
|
type="primary"
|
|
89
|
-
onClick={
|
|
87
|
+
onClick={pageBridge.onChangeRandomTestKey2}
|
|
90
88
|
>
|
|
91
89
|
{t(i18nKeys.PAGE_JSONSTORAGE_SET_EXPIRE)}
|
|
92
90
|
</Button>
|
|
@@ -96,7 +94,7 @@ export default function JSONStoragePage() {
|
|
|
96
94
|
{t(i18nKeys.PAGE_JSONSTORAGE_CURRENT_VALUE)}:{' '}
|
|
97
95
|
</span>
|
|
98
96
|
<span className="font-semibold text-text">
|
|
99
|
-
{
|
|
97
|
+
{pageState.testKey2}
|
|
100
98
|
</span>
|
|
101
99
|
</div>
|
|
102
100
|
</div>
|
|
@@ -110,11 +108,9 @@ export default function JSONStoragePage() {
|
|
|
110
108
|
<div className="flex items-center space-x-4">
|
|
111
109
|
<Input
|
|
112
110
|
type="number"
|
|
113
|
-
value={
|
|
111
|
+
value={pageState.requestTimeout}
|
|
114
112
|
onChange={(e) =>
|
|
115
|
-
|
|
116
|
-
Number(e.target.value)
|
|
117
|
-
)
|
|
113
|
+
pageBridge.changeRequestTimeout(Number(e.target.value))
|
|
118
114
|
}
|
|
119
115
|
className="w-32"
|
|
120
116
|
min="1000"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import BaseHeader from '../../uikit/components/BaseHeader';
|
|
2
2
|
import { Outlet } from 'react-router-dom';
|
|
3
|
-
import { ProcessExecutorProvider } from '@/uikit/
|
|
3
|
+
import { ProcessExecutorProvider } from '@/uikit/components/ProcessExecutorProvider';
|
|
4
4
|
|
|
5
5
|
export default function Layout() {
|
|
6
6
|
return (
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RouteService } from '@/base/services/RouteService';
|
|
2
1
|
import { IOC } from '@/core/IOC';
|
|
2
|
+
import { IOCIdentifier } from '@config/IOCIdentifier';
|
|
3
3
|
import { useEffect } from 'react';
|
|
4
4
|
import { useNavigate } from 'react-router-dom';
|
|
5
5
|
|
|
@@ -8,7 +8,7 @@ const RedirectToDefault = () => {
|
|
|
8
8
|
|
|
9
9
|
useEffect(() => {
|
|
10
10
|
// Redirect to the default language path
|
|
11
|
-
IOC(
|
|
11
|
+
IOC(IOCIdentifier.RouteServiceInterface).redirectToDefault(navigate);
|
|
12
12
|
}, [navigate]);
|
|
13
13
|
|
|
14
14
|
return null;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { IOC } from '@/core/IOC';
|
|
2
2
|
import { useBaseRoutePage } from '@/uikit/contexts/BaseRouteContext';
|
|
3
|
-
import { JSONStorageController } from '@/uikit/controllers/JSONStorageController';
|
|
4
|
-
import { RequestController } from '@/uikit/controllers/RequestController';
|
|
5
3
|
import { useMemo } from 'react';
|
|
6
4
|
import { useStore } from '@/uikit/hooks/useStore';
|
|
7
5
|
import { Button } from 'antd';
|
|
8
6
|
import { LoadingOutlined } from '@ant-design/icons';
|
|
9
7
|
import * as i18nKeys from '@config/Identifier/page.request';
|
|
8
|
+
import { IOCIdentifier } from '@config/IOCIdentifier';
|
|
10
9
|
|
|
11
10
|
function JSONValue({ value }: { value: unknown }) {
|
|
12
11
|
const output = useMemo(() => {
|
|
@@ -24,9 +23,10 @@ function JSONValue({ value }: { value: unknown }) {
|
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
export default function RequestPage() {
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const
|
|
26
|
+
const pageBridge = IOC(IOCIdentifier.RequestPageBridgeInterface);
|
|
27
|
+
const pageState = useStore(pageBridge);
|
|
28
|
+
const jsonStoragePageBridge = IOC(IOCIdentifier.JSONStoragePageInterface);
|
|
29
|
+
const jsonStoragePageState = useStore(jsonStoragePageBridge);
|
|
30
30
|
const { t } = useBaseRoutePage();
|
|
31
31
|
|
|
32
32
|
return (
|
|
@@ -38,7 +38,7 @@ export default function RequestPage() {
|
|
|
38
38
|
{t(i18nKeys.PAGE_REQUEST_TIMEOUT)}
|
|
39
39
|
</h2>
|
|
40
40
|
<div className="text-sm text-text-secondary font-mono bg-base p-2 rounded">
|
|
41
|
-
{
|
|
41
|
+
{jsonStoragePageState.requestTimeout}
|
|
42
42
|
</div>
|
|
43
43
|
</div>
|
|
44
44
|
|
|
@@ -53,10 +53,10 @@ export default function RequestPage() {
|
|
|
53
53
|
</p>
|
|
54
54
|
<Button
|
|
55
55
|
type="primary"
|
|
56
|
-
onClick={
|
|
57
|
-
loading={
|
|
56
|
+
onClick={pageBridge.onHello}
|
|
57
|
+
loading={pageState.helloState.loading}
|
|
58
58
|
>
|
|
59
|
-
{
|
|
59
|
+
{pageState.helloState.loading
|
|
60
60
|
? t(i18nKeys.REQUEST_LOADING)
|
|
61
61
|
: t(i18nKeys.PAGE_REQUEST_HELLO_BUTTON)}
|
|
62
62
|
</Button>
|
|
@@ -66,14 +66,14 @@ export default function RequestPage() {
|
|
|
66
66
|
<p className="text-sm font-medium text-text">
|
|
67
67
|
{t(i18nKeys.REQUEST_HELLO_RESULT)}:
|
|
68
68
|
</p>
|
|
69
|
-
<JSONValue value={
|
|
69
|
+
<JSONValue value={pageState.helloState.result} />
|
|
70
70
|
</div>
|
|
71
71
|
|
|
72
72
|
<div>
|
|
73
73
|
<p className="text-sm font-medium text-text">
|
|
74
74
|
{t(i18nKeys.REQUEST_HELLO_ERROR)}:
|
|
75
75
|
</p>
|
|
76
|
-
<JSONValue value={
|
|
76
|
+
<JSONValue value={pageState.helloState.error} />
|
|
77
77
|
</div>
|
|
78
78
|
</div>
|
|
79
79
|
</div>
|
|
@@ -89,10 +89,10 @@ export default function RequestPage() {
|
|
|
89
89
|
</p>
|
|
90
90
|
<Button
|
|
91
91
|
type="primary"
|
|
92
|
-
onClick={
|
|
93
|
-
loading={
|
|
92
|
+
onClick={pageBridge.onIpInfo}
|
|
93
|
+
loading={pageState.ipInfoState.loading}
|
|
94
94
|
>
|
|
95
|
-
{
|
|
95
|
+
{pageState.ipInfoState.loading
|
|
96
96
|
? t(i18nKeys.REQUEST_LOADING)
|
|
97
97
|
: t(i18nKeys.REQUEST_IP_INFO)}
|
|
98
98
|
</Button>
|
|
@@ -101,7 +101,7 @@ export default function RequestPage() {
|
|
|
101
101
|
<p className="text-sm font-medium text-text">
|
|
102
102
|
{t(i18nKeys.REQUEST_IP_INFO_RESULT)}:
|
|
103
103
|
</p>
|
|
104
|
-
<JSONValue value={
|
|
104
|
+
<JSONValue value={pageState.ipInfoState.result} />
|
|
105
105
|
</div>
|
|
106
106
|
</div>
|
|
107
107
|
|
|
@@ -115,10 +115,10 @@ export default function RequestPage() {
|
|
|
115
115
|
</p>
|
|
116
116
|
<Button
|
|
117
117
|
type="primary"
|
|
118
|
-
onClick={
|
|
119
|
-
loading={
|
|
118
|
+
onClick={pageBridge.onRandomUser}
|
|
119
|
+
loading={pageState.randomUserState.loading}
|
|
120
120
|
>
|
|
121
|
-
{
|
|
121
|
+
{pageState.randomUserState.loading
|
|
122
122
|
? t(i18nKeys.REQUEST_LOADING)
|
|
123
123
|
: t(i18nKeys.REQUEST_RANDOM_USER)}
|
|
124
124
|
</Button>
|
|
@@ -128,16 +128,14 @@ export default function RequestPage() {
|
|
|
128
128
|
<p className="text-sm font-medium text-text">
|
|
129
129
|
{t(i18nKeys.REQUEST_RANDOM_USER_RESULT)}:
|
|
130
130
|
</p>
|
|
131
|
-
<JSONValue
|
|
132
|
-
value={requestControllerState.randomUserState.result}
|
|
133
|
-
/>
|
|
131
|
+
<JSONValue value={pageState.randomUserState.result} />
|
|
134
132
|
</div>
|
|
135
133
|
|
|
136
134
|
<div>
|
|
137
135
|
<p className="text-sm font-medium text-text">
|
|
138
136
|
{t(i18nKeys.REQUEST_RANDOM_USER_ERROR)}:
|
|
139
137
|
</p>
|
|
140
|
-
<JSONValue value={
|
|
138
|
+
<JSONValue value={pageState.randomUserState.error} />
|
|
141
139
|
</div>
|
|
142
140
|
</div>
|
|
143
141
|
</div>
|
|
@@ -148,16 +146,12 @@ export default function RequestPage() {
|
|
|
148
146
|
{t(i18nKeys.PAGE_REQUEST_API_CATCH_TITLE)}
|
|
149
147
|
</h2>
|
|
150
148
|
<Button
|
|
151
|
-
type={
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
}
|
|
156
|
-
danger={requestControllerState.apiCatchResultState.loading}
|
|
157
|
-
onClick={requestController.onTriggerApiCatchResult}
|
|
158
|
-
loading={requestControllerState.apiCatchResultState.loading}
|
|
149
|
+
type={pageState.apiCatchResultState.loading ? 'primary' : 'primary'}
|
|
150
|
+
danger={pageState.apiCatchResultState.loading}
|
|
151
|
+
onClick={pageBridge.onTriggerApiCatchResult}
|
|
152
|
+
loading={pageState.apiCatchResultState.loading}
|
|
159
153
|
>
|
|
160
|
-
{
|
|
154
|
+
{pageState.apiCatchResultState.loading
|
|
161
155
|
? t(i18nKeys.PAGE_REQUEST_STOP_API_CATCH)
|
|
162
156
|
: t(i18nKeys.PAGE_REQUEST_TRIGGER_API_CATCH)}
|
|
163
157
|
</Button>
|
|
@@ -167,18 +161,14 @@ export default function RequestPage() {
|
|
|
167
161
|
<p className="text-sm font-medium text-text">
|
|
168
162
|
{t(i18nKeys.REQUEST_ABORT_RESULT)}:
|
|
169
163
|
</p>
|
|
170
|
-
<JSONValue
|
|
171
|
-
value={requestControllerState.apiCatchResultState.result}
|
|
172
|
-
/>
|
|
164
|
+
<JSONValue value={pageState.apiCatchResultState.result} />
|
|
173
165
|
</div>
|
|
174
166
|
|
|
175
167
|
<div>
|
|
176
168
|
<p className="text-sm font-medium text-text">
|
|
177
169
|
{t(i18nKeys.REQUEST_ABORT_ERROR)}:
|
|
178
170
|
</p>
|
|
179
|
-
<JSONValue
|
|
180
|
-
value={requestControllerState.apiCatchResultState.error}
|
|
181
|
-
/>
|
|
171
|
+
<JSONValue value={pageState.apiCatchResultState.error} />
|
|
182
172
|
</div>
|
|
183
173
|
</div>
|
|
184
174
|
</div>
|
|
@@ -189,14 +179,12 @@ export default function RequestPage() {
|
|
|
189
179
|
{t(i18nKeys.PAGE_REQUEST_ABORT_TITLE)}
|
|
190
180
|
</h2>
|
|
191
181
|
<Button
|
|
192
|
-
type={
|
|
193
|
-
|
|
194
|
-
}
|
|
195
|
-
danger={requestControllerState.abortState.loading}
|
|
196
|
-
onClick={requestController.onTriggerAbortRequest}
|
|
182
|
+
type={pageState.abortState.loading ? 'primary' : 'primary'}
|
|
183
|
+
danger={pageState.abortState.loading}
|
|
184
|
+
onClick={pageBridge.onTriggerAbortRequest}
|
|
197
185
|
>
|
|
198
|
-
{
|
|
199
|
-
{
|
|
186
|
+
{pageState.abortState.loading && <LoadingOutlined />}
|
|
187
|
+
{pageState.abortState.loading
|
|
200
188
|
? t(i18nKeys.PAGE_REQUEST_STOP_ABORT)
|
|
201
189
|
: t(i18nKeys.PAGE_REQUEST_TRIGGER_ABORT)}
|
|
202
190
|
</Button>
|
|
@@ -206,14 +194,14 @@ export default function RequestPage() {
|
|
|
206
194
|
<p className="text-sm font-medium text-text">
|
|
207
195
|
{t(i18nKeys.REQUEST_ABORT_RESULT)}:
|
|
208
196
|
</p>
|
|
209
|
-
<JSONValue value={
|
|
197
|
+
<JSONValue value={pageState.abortState.result} />
|
|
210
198
|
</div>
|
|
211
199
|
|
|
212
200
|
<div>
|
|
213
201
|
<p className="text-sm font-medium text-text">
|
|
214
202
|
{t(i18nKeys.REQUEST_ABORT_ERROR)}:
|
|
215
203
|
</p>
|
|
216
|
-
<JSONValue value={
|
|
204
|
+
<JSONValue value={pageState.abortState.error} />
|
|
217
205
|
</div>
|
|
218
206
|
</div>
|
|
219
207
|
</div>
|
|
@@ -141,7 +141,7 @@ html,
|
|
|
141
141
|
.ant-select,
|
|
142
142
|
.ant-select-css-var {
|
|
143
143
|
--fe-select-internal_fixed_item_margin: 2px;
|
|
144
|
-
--fe-select-z-index-popup:
|
|
144
|
+
--fe-select-z-index-popup: var(--zi-select);
|
|
145
145
|
--fe-select-option-selected-color: rgba(0, 0, 0, 0.88);
|
|
146
146
|
--fe-select-option-selected-font-weight: 600;
|
|
147
147
|
--fe-select-option-selected-bg: var(--fe-color-primary-bg);
|
|
@@ -222,7 +222,7 @@ html,
|
|
|
222
222
|
/* Antd Message 组件变量 */
|
|
223
223
|
.ant-message,
|
|
224
224
|
.ant-message-css-var {
|
|
225
|
-
--fe-message-z-index-popup:
|
|
225
|
+
--fe-message-z-index-popup: var(--zi-message);
|
|
226
226
|
--fe-message-content-bg: var(--fe-color-bg-container);
|
|
227
227
|
--fe-message-content-padding: 9px 12px;
|
|
228
228
|
--fe-message-notice-content-padding: 10px 16px;
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
.ant-select,
|
|
97
97
|
.ant-select-css-var {
|
|
98
98
|
--fe-select-internal_fixed_item_margin: 2px;
|
|
99
|
-
--fe-select-z-index-popup:
|
|
99
|
+
--fe-select-z-index-popup: var(--zi-select);
|
|
100
100
|
--fe-select-option-selected-color: rgba(255, 255, 255, 0.88);
|
|
101
101
|
--fe-select-option-selected-font-weight: 600;
|
|
102
102
|
--fe-select-option-selected-bg: var(--fe-color-primary-bg);
|
|
@@ -154,7 +154,7 @@
|
|
|
154
154
|
/* Antd Message 组件变量 */
|
|
155
155
|
.ant-message,
|
|
156
156
|
.ant-message-css-var {
|
|
157
|
-
--fe-message-z-index-popup:
|
|
157
|
+
--fe-message-z-index-popup: var(--zi-message);
|
|
158
158
|
--fe-message-content-bg: rgb(51 65 85); /* slate-700,比容器背景色深一点 */
|
|
159
159
|
--fe-message-content-padding: 9px 12px;
|
|
160
160
|
--fe-message-notice-content-padding: 10px 16px;
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
.ant-select,
|
|
101
101
|
.ant-select-css-var {
|
|
102
102
|
--fe-select-internal_fixed_item_margin: 2px;
|
|
103
|
-
--fe-select-z-index-popup:
|
|
103
|
+
--fe-select-z-index-popup: var(--zi-select);
|
|
104
104
|
--fe-select-option-selected-color: rgba(190, 18, 60, 0.88);
|
|
105
105
|
--fe-select-option-selected-font-weight: 600;
|
|
106
106
|
--fe-select-option-selected-bg: var(--fe-color-primary-bg);
|
|
@@ -158,7 +158,7 @@
|
|
|
158
158
|
/* Antd Message 组件变量 */
|
|
159
159
|
.ant-message,
|
|
160
160
|
.ant-message-css-var {
|
|
161
|
-
--fe-message-z-index-popup:
|
|
161
|
+
--fe-message-z-index-popup: var(--zi-message);
|
|
162
162
|
--fe-message-content-bg: var(--ant-color-bg-container);
|
|
163
163
|
--fe-message-content-padding: 9px 12px;
|
|
164
164
|
--fe-message-notice-content-padding: 10px 16px;
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is used to define the page styles for the app.
|
|
3
|
+
*
|
|
4
|
+
* @example --color-primary
|
|
5
|
+
* ```tsx
|
|
6
|
+
* <div className="bg-primary text-primary border-text-tertiary"></div>
|
|
7
|
+
* ```
|
|
8
|
+
*/
|
|
1
9
|
@theme {
|
|
2
10
|
--color-primary: rgba(var(--color-bg-base));
|
|
3
11
|
--color-secondary: rgba(var(--color-bg-secondary));
|