mirror of
				https://gitlab.nic.cz/turris/reforis/foris-js.git
				synced 2025-11-03 23:00:31 +01:00 
			
		
		
		
	Merge branch 'revert-disable-prompt' into 'dev'
Revert "Prompt as an optional element of ForisForm." See merge request turris/reforis/foris-js!83
This commit is contained in:
		@@ -17,11 +17,10 @@ WiFiSettings.propTypes = {
 | 
				
			|||||||
    endpoint: PropTypes.string.isRequired,
 | 
					    endpoint: PropTypes.string.isRequired,
 | 
				
			||||||
    resetEndpoint: PropTypes.string.isRequired,
 | 
					    resetEndpoint: PropTypes.string.isRequired,
 | 
				
			||||||
    hasGuestNetwork: PropTypes.bool,
 | 
					    hasGuestNetwork: PropTypes.bool,
 | 
				
			||||||
    hasPrompt: PropTypes.bool,
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export function WiFiSettings({
 | 
					export function WiFiSettings({
 | 
				
			||||||
    ws, endpoint, resetEndpoint, hasGuestNetwork, hasPrompt,
 | 
					    ws, endpoint, resetEndpoint, hasGuestNetwork,
 | 
				
			||||||
}) {
 | 
					}) {
 | 
				
			||||||
    return (
 | 
					    return (
 | 
				
			||||||
        <>
 | 
					        <>
 | 
				
			||||||
@@ -34,7 +33,6 @@ export function WiFiSettings({
 | 
				
			|||||||
                prepData={prepData}
 | 
					                prepData={prepData}
 | 
				
			||||||
                prepDataToSubmit={prepDataToSubmit}
 | 
					                prepDataToSubmit={prepDataToSubmit}
 | 
				
			||||||
                validator={validator}
 | 
					                validator={validator}
 | 
				
			||||||
                hasPrompt={hasPrompt}
 | 
					 | 
				
			||||||
            >
 | 
					            >
 | 
				
			||||||
                <WiFiForm hasGuestNetwork={hasGuestNetwork} />
 | 
					                <WiFiForm hasGuestNetwork={hasGuestNetwork} />
 | 
				
			||||||
            </ForisForm>
 | 
					            </ForisForm>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -48,8 +48,6 @@ ForisForm.propTypes = {
 | 
				
			|||||||
    validator: PropTypes.func.isRequired,
 | 
					    validator: PropTypes.func.isRequired,
 | 
				
			||||||
    /** Disables form */
 | 
					    /** Disables form */
 | 
				
			||||||
    disabled: PropTypes.bool,
 | 
					    disabled: PropTypes.bool,
 | 
				
			||||||
    /** If true user will be prompted before leaving the page containing form. */
 | 
					 | 
				
			||||||
    hasPrompt: PropTypes.bool,
 | 
					 | 
				
			||||||
    /** reForis form components. */
 | 
					    /** reForis form components. */
 | 
				
			||||||
    children: PropTypes.node.isRequired,
 | 
					    children: PropTypes.node.isRequired,
 | 
				
			||||||
    /** Optional override of form submit callback */
 | 
					    /** Optional override of form submit callback */
 | 
				
			||||||
@@ -73,7 +71,6 @@ ForisForm.defaultProps = {
 | 
				
			|||||||
    postCallback: () => undefined,
 | 
					    postCallback: () => undefined,
 | 
				
			||||||
    validator: () => undefined,
 | 
					    validator: () => undefined,
 | 
				
			||||||
    disabled: false,
 | 
					    disabled: false,
 | 
				
			||||||
    hasPrompt: true,
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Serves as HOC for all foris forms components. */
 | 
					/** Serves as HOC for all foris forms components. */
 | 
				
			||||||
@@ -85,7 +82,6 @@ export function ForisForm({
 | 
				
			|||||||
    postCallback,
 | 
					    postCallback,
 | 
				
			||||||
    validator,
 | 
					    validator,
 | 
				
			||||||
    disabled,
 | 
					    disabled,
 | 
				
			||||||
    hasPrompt,
 | 
					 | 
				
			||||||
    onSubmitOverridden,
 | 
					    onSubmitOverridden,
 | 
				
			||||||
    children,
 | 
					    children,
 | 
				
			||||||
}) {
 | 
					}) {
 | 
				
			||||||
@@ -160,7 +156,7 @@ export function ForisForm({
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    return (
 | 
					    return (
 | 
				
			||||||
        <div className={formFieldsSize}>
 | 
					        <div className={formFieldsSize}>
 | 
				
			||||||
            {hasPrompt && <Prompt message={getMessageOnLeavingPage} />}
 | 
					            <Prompt message={getMessageOnLeavingPage} />
 | 
				
			||||||
            <form onSubmit={onSubmit}>
 | 
					            <form onSubmit={onSubmit}>
 | 
				
			||||||
                {childrenWithFormProps}
 | 
					                {childrenWithFormProps}
 | 
				
			||||||
                <div className="text-right">
 | 
					                <div className="text-right">
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user