mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-12 08:25:44 +01:00
Add ConfigurationAdapterBase and extension points for trash bin
Adds the new abstract class ConfigurationAdapterBase to simplify the creation of global configuration views. In addition there is some cleanup, interfaces and extension points for the repository trash bin plugin. Committed-by: Eduard Heimbuch <eduard.heimbuch@cloudogu.com> Co-authored-by: Eduard Heimbuch <eduard.heimbuch@cloudogu.com> Co-authored-by: René Pfeuffer <rene.pfeuffer@cloudogu.com> Co-authored-by: Konstantin Schaper <konstantin.schaper@cloudogu.com>
This commit is contained in:
@@ -33,6 +33,7 @@ import ControlledInputField from "./input/ControlledInputField";
|
||||
import ControlledCheckboxField from "./checkbox/ControlledCheckboxField";
|
||||
import ControlledSecretConfirmationField from "./input/ControlledSecretConfirmationField";
|
||||
import { HalRepresentation } from "@scm-manager/ui-types";
|
||||
import ControlledSelectField from "./select/ControlledSelectField";
|
||||
|
||||
type RenderProps<T extends Record<string, unknown>> = Omit<
|
||||
UseFormReturn<T>,
|
||||
@@ -61,6 +62,7 @@ type Props<FormType extends Record<string, unknown>, DefaultValues extends FormT
|
||||
submitButtonTestId?: string;
|
||||
};
|
||||
|
||||
/** @Beta */
|
||||
function Form<FormType extends Record<string, unknown>, DefaultValues extends FormType>({
|
||||
children,
|
||||
onSubmit,
|
||||
@@ -84,11 +86,11 @@ function Form<FormType extends Record<string, unknown>, DefaultValues extends Fo
|
||||
useEffect(() => {
|
||||
if (isSubmitSuccessful) {
|
||||
setShowSuccessNotification(true);
|
||||
reset(defaultValues as never);
|
||||
}
|
||||
/* eslint-disable-next-line react-hooks/exhaustive-deps */
|
||||
}, [isSubmitSuccessful]);
|
||||
|
||||
useEffect(() => reset(defaultValues as never), [defaultValues, reset]);
|
||||
|
||||
useEffect(() => {
|
||||
if (isDirty) {
|
||||
setShowSuccessNotification(false);
|
||||
@@ -158,4 +160,5 @@ export default Object.assign(Form, {
|
||||
Input: ControlledInputField,
|
||||
Checkbox: ControlledCheckboxField,
|
||||
SecretConfirmation: ControlledSecretConfirmationField,
|
||||
Select: ControlledSelectField,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user