fix: after success setting for the submit button (#5332)
Some checks are pending
Build Docker Image / build-and-push (push) Waiting to run
Build Pro Image / build-and-push (push) Waiting to run
E2E / Build (push) Waiting to run
E2E / Core and plugins (push) Blocked by required conditions
E2E / plugin-workflow (push) Blocked by required conditions
E2E / plugin-workflow-approval (push) Blocked by required conditions
E2E / plugin-data-source-main (push) Blocked by required conditions
E2E / Comment on PR (push) Blocked by required conditions
NocoBase FrontEnd Test / frontend-test (18) (push) Waiting to run

* fix: submit action should support after uccess setting

* fix: after success
This commit is contained in:
Katherine 2024-09-27 08:52:06 +08:00 committed by GitHub
parent 81d1353511
commit 0924ddfa80
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 2 deletions

View File

@ -251,6 +251,13 @@ export const useCreateActionProps = () => {
if (!onSuccess?.successMessage) {
message.success(t('Saved successfully'));
await resetFormCorrectly(form);
if (onSuccess?.redirecting && onSuccess?.redirectTo) {
if (isURL(onSuccess.redirectTo)) {
window.location.href = onSuccess.redirectTo;
} else {
navigate(onSuccess.redirectTo);
}
}
return;
}
if (onSuccess?.manualClose) {

View File

@ -8,7 +8,7 @@
*/
import { ArrayTable } from '@formily/antd-v5';
import { Field, onFieldValueChange } from '@formily/core';
import { onFieldValueChange } from '@formily/core';
import { ISchema, useField, useFieldSchema, useForm, useFormEffects } from '@formily/react';
import { isValid, uid } from '@formily/shared';
import { Alert, Flex, ModalProps, Tag } from 'antd';
@ -258,7 +258,13 @@ export function AfterSuccess() {
return (
<SchemaSettingsModalItem
title={t('After successful submission')}
initialValues={fieldSchema?.['x-action-settings']?.['onSuccess']}
initialValues={
fieldSchema?.['x-action-settings']?.['onSuccess'] || {
manualClose: false,
redirecting: false,
successMessage: '{{t("Saved successfully")}}',
}
}
schema={
{
type: 'object',