fix: failed required validation for map management secret key fields (#6509)

This commit is contained in:
Katherine 2025-03-20 09:50:56 +08:00 committed by GitHub
parent 92f7f3f390
commit 87c1fee425
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 19 additions and 7 deletions

View File

@ -7,8 +7,8 @@
"description.zh-CN": "地图区块,支持高德地图和 Google 地图,你也可以扩展更多地图类型。", "description.zh-CN": "地图区块,支持高德地图和 Google 地图,你也可以扩展更多地图类型。",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"main": "./dist/server/index.js", "main": "./dist/server/index.js",
"homepage": "https://docs.nocobase.com/handbook/map", "homepage": "https://docs.nocobase.com/handbook/block-map",
"homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/map", "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/block-map",
"devDependencies": { "devDependencies": {
"@amap/amap-jsapi-loader": "^1.0.1", "@amap/amap-jsapi-loader": "^1.0.1",
"@amap/amap-jsapi-types": "^0.0.10", "@amap/amap-jsapi-types": "^0.0.10",

View File

@ -32,7 +32,8 @@ const BaseConfiguration: React.FC<BaseConfigurationProps> = ({ type, children })
return apiClient.resource(MapConfigurationResourceKey); return apiClient.resource(MapConfigurationResourceKey);
}, [apiClient]); }, [apiClient]);
const onSubmit = (values) => { const onSubmit = async (values) => {
await form.validateFields();
resource resource
.set({ .set({
...values, ...values,
@ -62,10 +63,18 @@ const AMapConfiguration = () => {
const { t } = useMapTranslation(); const { t } = useMapTranslation();
return ( return (
<BaseConfiguration type="amap"> <BaseConfiguration type="amap">
<Form.Item required name="accessKey" label={t('Access key')}> <Form.Item
rules={[{ required: true, message: t('Access key is required') }]}
name="accessKey"
label={t('Access key')}
>
<TextAreaWithGlobalScope /> <TextAreaWithGlobalScope />
</Form.Item> </Form.Item>
<Form.Item required name="securityJsCode" label={t('securityJsCode or serviceHost')}> <Form.Item
rules={[{ required: true, message: t('securityJsCode or serviceHost is required') }]}
name="securityJsCode"
label={t('securityJsCode or serviceHost')}
>
<TextAreaWithGlobalScope /> <TextAreaWithGlobalScope />
</Form.Item> </Form.Item>
</BaseConfiguration> </BaseConfiguration>
@ -76,7 +85,7 @@ const GoogleMapConfiguration = () => {
const { t } = useMapTranslation(); const { t } = useMapTranslation();
return ( return (
<BaseConfiguration type="google"> <BaseConfiguration type="google">
<Form.Item required name="accessKey" label={t('Api key')}> <Form.Item rules={[{ required: true, message: t('Api key is required') }]} name="accessKey" label={t('Api key')}>
<TextAreaWithGlobalScope /> <TextAreaWithGlobalScope />
</Form.Item> </Form.Item>
</BaseConfiguration> </BaseConfiguration>

View File

@ -47,5 +47,8 @@
"Create map block": "创建地图区块", "Create map block": "创建地图区块",
"Start point": "起点", "Start point": "起点",
"End point": "终点", "End point": "终点",
"Concatenation order field": "连接顺序字段" "Concatenation order field": "连接顺序字段",
"securityJsCode or serviceHost is required": "securityJsCode 或 serviceHost 是必填",
"Access key is required": "访问密钥是必填",
"Api key is required": "Api key 是必填"
} }