1
0
mirror of https://gitlab.nic.cz/turris/reforis/foris-js.git synced 2024-11-14 17:35:35 +01:00

Compare commits

..

No commits in common. "39257567d48b453df1e7649831be5f9483856a43" and "96785f07744955a806337266484307594e421951" have entirely different histories.

33 changed files with 519 additions and 514 deletions

View File

@ -11,7 +11,6 @@ MSGID_BUGS_ADDRESS="tech.support@turris.cz"
DEV_PYTHON=python3 DEV_PYTHON=python3
VENV_NAME?=venv VENV_NAME?=venv
JS_DIR=js
VENV_BIN=$(shell pwd)/$(VENV_NAME)/bin VENV_BIN=$(shell pwd)/$(VENV_NAME)/bin
.PHONY: all .PHONY: all

78
package-lock.json generated
View File

@ -22,11 +22,11 @@
"@babel/plugin-transform-runtime": "^7.9.0", "@babel/plugin-transform-runtime": "^7.9.0",
"@babel/preset-env": "^7.9.0", "@babel/preset-env": "^7.9.0",
"@babel/preset-react": "^7.9.4", "@babel/preset-react": "^7.9.4",
"@fortawesome/fontawesome-free": "^6.5.2", "@fortawesome/fontawesome-free": "^5.13.0",
"@testing-library/react": "^8.0.9", "@testing-library/react": "^8.0.9",
"babel-loader": "^8.1.0", "babel-loader": "^8.1.0",
"babel-polyfill": "^6.26.0", "babel-polyfill": "^6.26.0",
"bootstrap": "^5.3.3", "bootstrap": "^4.6.2",
"css-loader": "^5.2.4", "css-loader": "^5.2.4",
"eslint": "^6.8.0", "eslint": "^6.8.0",
"eslint-config-prettier": "^6.11.0", "eslint-config-prettier": "^6.11.0",
@ -47,7 +47,7 @@
"webpack": "^5.68.0" "webpack": "^5.68.0"
}, },
"peerDependencies": { "peerDependencies": {
"bootstrap": "^5.3.3", "bootstrap": "^4.6.2",
"prop-types": "15.8.1", "prop-types": "15.8.1",
"react": "16.9.0", "react": "16.9.0",
"react-dom": "16.9.0", "react-dom": "16.9.0",
@ -1822,9 +1822,9 @@
} }
}, },
"node_modules/@fortawesome/fontawesome-free": { "node_modules/@fortawesome/fontawesome-free": {
"version": "6.5.2", "version": "5.15.3",
"resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-6.5.2.tgz", "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-5.15.3.tgz",
"integrity": "sha512-hRILoInAx8GNT5IMkrtIt9blOdrqHOnPBH+k70aWUAqPZPgopb9G5EQJFpaBx/S8zp2fC+mPW349Bziuk1o28Q==", "integrity": "sha512-rFnSUN/QOtnOAgqFRooTA3H57JLDm0QEG/jPdk+tLQNL/eWd+Aok8g3qCI+Q1xuDPWpGW/i9JySpJVsq8Q0s9w==",
"dev": true, "dev": true,
"hasInstallScript": true, "hasInstallScript": true,
"engines": { "engines": {
@ -2814,9 +2814,9 @@
} }
}, },
"node_modules/@popperjs/core": { "node_modules/@popperjs/core": {
"version": "2.11.8", "version": "2.11.2",
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz", "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.2.tgz",
"integrity": "sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==", "integrity": "sha512-92FRmppjjqz29VMJ2dn+xdyXZBrMlE42AV6Kq6BwjWV7CNUW1hs2FtxSNLQE+gJhaZ6AAmYuO9y8dshhcBl7vA==",
"dev": true, "dev": true,
"funding": { "funding": {
"type": "opencollective", "type": "opencollective",
@ -4330,9 +4330,9 @@
} }
}, },
"node_modules/bootstrap": { "node_modules/bootstrap": {
"version": "5.3.3", "version": "4.6.2",
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.3.3.tgz", "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.6.2.tgz",
"integrity": "sha512-8HLCdWgyoMguSO9o+aH+iuZ+aht+mzW0u3HIMzVu7Srrpv7EBBxTnrFlSCskwdY1+EOFQSm7uMJhNQHkdPcmjg==", "integrity": "sha512-51Bbp/Uxr9aTuy6ca/8FbFloBUJZLHwnhTcnjIeRn2suQWsWzcuJhGjKDB5eppVte/8oCdOL3VuwxvZDUggwGQ==",
"dev": true, "dev": true,
"funding": [ "funding": [
{ {
@ -4345,7 +4345,8 @@
} }
], ],
"peerDependencies": { "peerDependencies": {
"@popperjs/core": "^2.11.8" "jquery": "1.9.1 - 3",
"popper.js": "^1.16.1"
} }
}, },
"node_modules/brace-expansion": { "node_modules/brace-expansion": {
@ -11672,6 +11673,13 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/jquery": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz",
"integrity": "sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw==",
"dev": true,
"peer": true
},
"node_modules/js-tokens": { "node_modules/js-tokens": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
@ -13783,6 +13791,18 @@
"integrity": "sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA==", "integrity": "sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA==",
"dev": true "dev": true
}, },
"node_modules/popper.js": {
"version": "1.16.1",
"resolved": "https://registry.npmjs.org/popper.js/-/popper.js-1.16.1.tgz",
"integrity": "sha512-Wb4p1J4zyFTbM+u6WuO4XstYx4Ky9Cewe4DWrel7B0w6VVICvPwdOpotjzcf6eD8TsckVnIMNONQyPIUFOUbCQ==",
"deprecated": "You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1",
"dev": true,
"peer": true,
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/popperjs"
}
},
"node_modules/portfinder": { "node_modules/portfinder": {
"version": "1.0.28", "version": "1.0.28",
"resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.28.tgz", "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.28.tgz",
@ -20378,9 +20398,9 @@
} }
}, },
"@fortawesome/fontawesome-free": { "@fortawesome/fontawesome-free": {
"version": "6.5.2", "version": "5.15.3",
"resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-6.5.2.tgz", "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-5.15.3.tgz",
"integrity": "sha512-hRILoInAx8GNT5IMkrtIt9blOdrqHOnPBH+k70aWUAqPZPgopb9G5EQJFpaBx/S8zp2fC+mPW349Bziuk1o28Q==", "integrity": "sha512-rFnSUN/QOtnOAgqFRooTA3H57JLDm0QEG/jPdk+tLQNL/eWd+Aok8g3qCI+Q1xuDPWpGW/i9JySpJVsq8Q0s9w==",
"dev": true "dev": true
}, },
"@gar/promisify": { "@gar/promisify": {
@ -21145,9 +21165,9 @@
} }
}, },
"@popperjs/core": { "@popperjs/core": {
"version": "2.11.8", "version": "2.11.2",
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz", "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.2.tgz",
"integrity": "sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==", "integrity": "sha512-92FRmppjjqz29VMJ2dn+xdyXZBrMlE42AV6Kq6BwjWV7CNUW1hs2FtxSNLQE+gJhaZ6AAmYuO9y8dshhcBl7vA==",
"dev": true "dev": true
}, },
"@sheerun/mutationobserver-shim": { "@sheerun/mutationobserver-shim": {
@ -22432,9 +22452,9 @@
} }
}, },
"bootstrap": { "bootstrap": {
"version": "5.3.3", "version": "4.6.2",
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.3.3.tgz", "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.6.2.tgz",
"integrity": "sha512-8HLCdWgyoMguSO9o+aH+iuZ+aht+mzW0u3HIMzVu7Srrpv7EBBxTnrFlSCskwdY1+EOFQSm7uMJhNQHkdPcmjg==", "integrity": "sha512-51Bbp/Uxr9aTuy6ca/8FbFloBUJZLHwnhTcnjIeRn2suQWsWzcuJhGjKDB5eppVte/8oCdOL3VuwxvZDUggwGQ==",
"dev": true, "dev": true,
"requires": {} "requires": {}
}, },
@ -28020,6 +28040,13 @@
} }
} }
}, },
"jquery": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz",
"integrity": "sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw==",
"dev": true,
"peer": true
},
"js-tokens": { "js-tokens": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
@ -29645,6 +29672,13 @@
"integrity": "sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA==", "integrity": "sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA==",
"dev": true "dev": true
}, },
"popper.js": {
"version": "1.16.1",
"resolved": "https://registry.npmjs.org/popper.js/-/popper.js-1.16.1.tgz",
"integrity": "sha512-Wb4p1J4zyFTbM+u6WuO4XstYx4Ky9Cewe4DWrel7B0w6VVICvPwdOpotjzcf6eD8TsckVnIMNONQyPIUFOUbCQ==",
"dev": true,
"peer": true
},
"portfinder": { "portfinder": {
"version": "1.0.28", "version": "1.0.28",
"resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.28.tgz", "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.28.tgz",

View File

@ -22,7 +22,7 @@
"react-uid": "^2.2.0" "react-uid": "^2.2.0"
}, },
"peerDependencies": { "peerDependencies": {
"bootstrap": "^5.3.3", "bootstrap": "^4.6.2",
"prop-types": "15.8.1", "prop-types": "15.8.1",
"react": "16.9.0", "react": "16.9.0",
"react-dom": "16.9.0", "react-dom": "16.9.0",
@ -34,11 +34,11 @@
"@babel/plugin-transform-runtime": "^7.9.0", "@babel/plugin-transform-runtime": "^7.9.0",
"@babel/preset-env": "^7.9.0", "@babel/preset-env": "^7.9.0",
"@babel/preset-react": "^7.9.4", "@babel/preset-react": "^7.9.4",
"@fortawesome/fontawesome-free": "^6.5.2", "@fortawesome/fontawesome-free": "^5.13.0",
"@testing-library/react": "^8.0.9", "@testing-library/react": "^8.0.9",
"babel-loader": "^8.1.0", "babel-loader": "^8.1.0",
"babel-polyfill": "^6.26.0", "babel-polyfill": "^6.26.0",
"bootstrap": "^5.3.3", "bootstrap": "^4.6.2",
"css-loader": "^5.2.4", "css-loader": "^5.2.4",
"eslint": "^6.8.0", "eslint": "^6.8.0",
"eslint-config-prettier": "^6.11.0", "eslint-config-prettier": "^6.11.0",

View File

@ -38,17 +38,16 @@ Alert.defaultProps = {
export function Alert({ type, onDismiss, children }) { export function Alert({ type, onDismiss, children }) {
return ( return (
<div <div
className={`alert alert-${type} ${ className={`alert ${
onDismiss ? "alert-dismissible" : "" onDismiss ? "alert-dismissible" : ""
}`.trim()} } alert-${type}`}
> >
{onDismiss && ( {onDismiss ? (
<button <button type="button" className="close" onClick={onDismiss}>
type="button" &times;
className="btn-close" </button>
onClick={onDismiss} ) : (
aria-label={_("Close")} false
/>
)} )}
{children} {children}
</div> </div>

View File

@ -33,7 +33,7 @@ export function Button({
}) { }) {
let buttonClass = className ? `btn ${className}` : "btn btn-primary"; let buttonClass = className ? `btn ${className}` : "btn btn-primary";
if (forisFormSize) { if (forisFormSize) {
buttonClass = `${buttonClass} col-12 col-md-3 col-lg-2`; buttonClass = `${buttonClass} col-sm-12 col-md-3 col-lg-2`;
} }
return ( return (
@ -44,7 +44,7 @@ export function Button({
> >
{loading && ( {loading && (
<span <span
className="spinner-border spinner-border-sm me-1" className="spinner-border spinner-border-sm mr-1"
role="status" role="status"
aria-hidden="true" aria-hidden="true"
/> />

View File

@ -24,24 +24,25 @@ CheckBox.defaultProps = {
export function CheckBox({ label, helpText, disabled, ...props }) { export function CheckBox({ label, helpText, disabled, ...props }) {
const uid = useUID(); const uid = useUID();
return ( return (
<div className="mb-3 form-check"> <div className="form-group">
<div className="custom-control custom-checkbox ">
<input <input
className="form-check-input" className="custom-control-input"
type="checkbox" type="checkbox"
id={uid} id={uid}
disabled={disabled} disabled={disabled}
{...props} {...props}
/> />
<label className="form-check-label" htmlFor={uid}> <label className="custom-control-label" htmlFor={uid}>
{label} {label}
</label>
{helpText && ( {helpText && (
<div className="form-text"> <small className="form-text text-muted">
<small>{helpText}</small> {helpText}
</div> </small>
)} )}
</label>
</div>
</div> </div>
); );
} }

View File

@ -27,21 +27,18 @@ export const Input = forwardRef(
) => { ) => {
const uid = useUID(); const uid = useUID();
const inputClassName = `${className || ""} ${ const inputClassName = `form-control ${className || ""} ${
error ? "is-invalid" : "" error ? "is-invalid" : ""
}`.trim(); }`.trim();
return ( return (
<div className="mb-3"> <div className="form-group">
<label <label className={labelClassName} htmlFor={uid}>
className={`form-label ${labelClassName || ""}`.trim()}
htmlFor={uid}
>
{label} {label}
</label> </label>
<div className={`input-group ${groupClassName || ""}`.trim()}> <div className={`input-group ${groupClassName || ""}`.trim()}>
<input <input
className={`form-control ${inputClassName}`.trim()} className={inputClassName}
type={type} type={type}
id={uid} id={uid}
ref={ref} ref={ref}
@ -49,12 +46,10 @@ export const Input = forwardRef(
/> />
{children} {children}
</div> </div>
{error && <div className="invalid-feedback">{error}</div>} {error ? <div className="invalid-feedback">{error}</div> : null}
{helpText && ( {helpText ? (
<div className="form-text"> <small className="form-text text-muted">{helpText}</small>
<small>{helpText}</small> ) : null}
</div>
)}
</div> </div>
); );
} }

View File

@ -92,10 +92,11 @@ export function ModalHeader({ setShown, title }) {
<h5 className="modal-title">{title}</h5> <h5 className="modal-title">{title}</h5>
<button <button
type="button" type="button"
className="btn-close" className="close"
onClick={() => setShown(false)} onClick={() => setShown(false)}
aria-label={_("Close")} >
/> <span aria-hidden="true">&times;</span>
</button>
</div> </div>
); );
} }

View File

@ -23,7 +23,7 @@ NumberInput.propTypes = {
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
/** Function called when value changes. */ /** Function called when value changes. */
onChange: PropTypes.func.isRequired, onChange: PropTypes.func.isRequired,
/** Additional description displayed to the right of input value. */ /** Additional description dispaled to the right of input value. */
inlineText: PropTypes.string, inlineText: PropTypes.string,
}; };
@ -49,9 +49,8 @@ export function NumberInput({ onChange, inlineText, value, ...props }) {
return ( return (
<Input type="number" onChange={onChange} value={value} {...props}> <Input type="number" onChange={onChange} value={value} {...props}>
{inlineText && ( <div className="input-group-append">
<span className="input-group-text">{inlineText}</span> {inlineText && <p className="input-group-text">{inlineText}</p>}
)}
<button <button
type="button" type="button"
className="btn btn-outline-secondary" className="btn btn-outline-secondary"
@ -70,6 +69,7 @@ export function NumberInput({ onChange, inlineText, value, ...props }) {
> >
<i className="fas fa-minus" /> <i className="fas fa-minus" />
</button> </button>
</div>
</Input> </Input>
); );
} }

View File

@ -34,7 +34,8 @@ export function PasswordInput({ withEye, newPass, ...props }) {
autoComplete={newPass ? "new-password" : "current-password"} autoComplete={newPass ? "new-password" : "current-password"}
{...props} {...props}
> >
{withEye && ( {withEye ? (
<div className="input-group-append">
<button <button
type="button" type="button"
className="input-group-text" className="input-group-text"
@ -44,10 +45,13 @@ export function PasswordInput({ withEye, newPass, ...props }) {
}} }}
> >
<i <i
className={`fa ${isHidden ? "fa-eye" : "fa-eye-slash"}`} className={`fa ${
isHidden ? "fa-eye" : "fa-eye-slash"
}`}
/> />
</button> </button>
)} </div>
) : null}
</Input> </Input>
); );
} }

View File

@ -17,7 +17,7 @@ RadioSet.propTypes = {
/** Choices . */ /** Choices . */
choices: PropTypes.arrayOf( choices: PropTypes.arrayOf(
PropTypes.shape({ PropTypes.shape({
/** Choice label . */ /** Choice lable . */
label: PropTypes.oneOfType([ label: PropTypes.oneOfType([
PropTypes.string, PropTypes.string,
PropTypes.element, PropTypes.element,
@ -64,7 +64,7 @@ export function RadioSet({
}); });
return ( return (
<div className="mb-3"> <div className="form-group">
{label && ( {label && (
<label htmlFor={uid} className="d-block"> <label htmlFor={uid} className="d-block">
{label} {label}
@ -72,9 +72,7 @@ export function RadioSet({
)} )}
{radios} {radios}
{helpText && ( {helpText && (
<div className="form-text"> <small className="form-text text-muted">{helpText}</small>
<small>{helpText}</small>
</div>
)} )}
</div> </div>
); );
@ -96,24 +94,24 @@ export function Radio({ label, id, helpText, inline, ...props }) {
return ( return (
<> <>
<div <div
className={`mb-2 ${ className={`custom-control custom-radio ${
inline ? "form-check form-check-inline" : "" inline ? "custom-control-inline" : ""
}`.trim()} }`.trim()}
> >
<input <input
id={id} id={id}
className="form-check-input me-2" className="custom-control-input"
type="radio" type="radio"
{...props} {...props}
/> />
<label className="form-check-label" htmlFor={id}> <label className="custom-control-label" htmlFor={id}>
{label} {label}
{helpText && (
<div className="form-text">
<small>{helpText}</small>
</div>
)}
</label> </label>
{helpText && (
<small className="form-text text-muted mt-0 mb-3">
{helpText}
</small>
)}
</div> </div>
</> </>
); );

View File

@ -30,18 +30,14 @@ export function Select({ label, choices, helpText, ...props }) {
)); ));
return ( return (
<div className="mb-3"> <div className="form-group">
<label className="form-label" htmlFor={uid}> <label htmlFor={uid}>{label}</label>
{label} <select className="custom-select" id={uid} {...props}>
</label>
<select className="form-select" id={uid} {...props}>
{options} {options}
</select> </select>
{helpText && ( {helpText ? (
<div className="form-text"> <small className="form-text text-muted">{helpText}</small>
<small>{helpText}</small> ) : null}
</div>
)}
</div> </div>
); );
} }

View File

@ -16,7 +16,7 @@ Spinner.propTypes = {
PropTypes.arrayOf(PropTypes.node), PropTypes.arrayOf(PropTypes.node),
PropTypes.node, PropTypes.node,
]), ]),
/** Render component with full-screen mode (using appropriate `.css` styles) */ /** Render component with full-screen mode (using apropriate `.css` styles) */
fullScreen: PropTypes.bool.isRequired, fullScreen: PropTypes.bool.isRequired,
className: PropTypes.string, className: PropTypes.string,
}; };

View File

@ -22,30 +22,28 @@ Switch.propTypes = {
export function Switch({ label, helpText, switchHeading, ...props }) { export function Switch({ label, helpText, switchHeading, ...props }) {
const uid = useUID(); const uid = useUID();
return ( return (
<div className={`form-group ${switchHeading ? "switch" : ""}`.trim()}>
<div <div
className={`form-check form-switch mb-3 ${ className={`custom-control custom-switch ${
switchHeading ? "d-flex align-items-center" : null !helpText ? "custom-control-inline" : ""
}`.trim()} } ${switchHeading ? "switch-heading" : ""}`.trim()}
> >
<input <input
type="checkbox" type="checkbox"
className={`form-check-input ${ className="custom-control-input"
switchHeading ? "me-2" : ""
}`.trim()}
role="switch"
id={uid} id={uid}
{...props} {...props}
/> />
<label className="form-check-label" htmlFor={uid}> <label className="custom-control-label" htmlFor={uid}>
{label} {label}
</label> </label>
{helpText && ( {helpText && (
<div className="form-text"> <small className="form-text text-muted mt-0 mb-3">
<small>{helpText}</small> {helpText}
</div> </small>
)} )}
</div> </div>
</div>
); );
} }

View File

@ -29,7 +29,7 @@ exports[`<Button /> Render button with spinner 1`] = `
> >
<span <span
aria-hidden="true" aria-hidden="true"
class="spinner-border spinner-border-sm me-1" class="spinner-border spinner-border-sm mr-1"
role="status" role="status"
/> />
<span> <span>

View File

@ -2,51 +2,55 @@
exports[`<Checkbox/> Render checkbox 1`] = ` exports[`<Checkbox/> Render checkbox 1`] = `
<div <div
class="mb-3 form-check" class="form-group"
>
<div
class="custom-control custom-checkbox "
> >
<input <input
checked="" checked=""
class="form-check-input" class="custom-control-input"
id="1" id="1"
type="checkbox" type="checkbox"
/> />
<label <label
class="form-check-label" class="custom-control-label"
for="1" for="1"
> >
Test label Test label
</label> <small
<div class="form-text text-muted"
class="form-text"
> >
<small>
Some help text Some help text
</small> </small>
</label>
</div> </div>
</div> </div>
`; `;
exports[`<Checkbox/> Render uncheked checkbox 1`] = ` exports[`<Checkbox/> Render uncheked checkbox 1`] = `
<div <div
class="mb-3 form-check" class="form-group"
>
<div
class="custom-control custom-checkbox "
> >
<input <input
class="form-check-input" class="custom-control-input"
id="1" id="1"
type="checkbox" type="checkbox"
/> />
<label <label
class="form-check-label" class="custom-control-label"
for="1" for="1"
> >
Test label Test label
</label> <small
<div class="form-text text-muted"
class="form-text"
> >
<small>
Some help text Some help text
</small> </small>
</label>
</div> </div>
</div> </div>
`; `;

View File

@ -2,10 +2,9 @@
exports[`<NumberInput/> Render number input 1`] = ` exports[`<NumberInput/> Render number input 1`] = `
<div <div
class="mb-3" class="form-group"
> >
<label <label
class="form-label"
for="1" for="1"
> >
Test label Test label
@ -19,6 +18,9 @@ exports[`<NumberInput/> Render number input 1`] = `
type="number" type="number"
value="1" value="1"
/> />
<div
class="input-group-append"
>
<button <button
aria-label="Increase" aria-label="Increase"
class="btn btn-outline-secondary" class="btn btn-outline-secondary"
@ -38,12 +40,11 @@ exports[`<NumberInput/> Render number input 1`] = `
/> />
</button> </button>
</div> </div>
<div </div>
class="form-text" <small
class="form-text text-muted"
> >
<small>
Some help text Some help text
</small> </small>
</div> </div>
</div>
`; `;

View File

@ -2,10 +2,9 @@
exports[`<PasswordInput/> Render password input 1`] = ` exports[`<PasswordInput/> Render password input 1`] = `
<div <div
class="mb-3" class="form-group"
> >
<label <label
class="form-label"
for="1" for="1"
> >
Test label Test label
@ -21,12 +20,10 @@ exports[`<PasswordInput/> Render password input 1`] = `
value="Some password" value="Some password"
/> />
</div> </div>
<div <small
class="form-text" class="form-text text-muted"
> >
<small>
Some help text Some help text
</small> </small>
</div> </div>
</div>
`; `;

View File

@ -2,7 +2,7 @@
exports[`<RadioSet/> Render radio set 1`] = ` exports[`<RadioSet/> Render radio set 1`] = `
<div <div
class="mb-3" class="form-group"
> >
<label <label
class="d-block" class="d-block"
@ -11,63 +11,61 @@ exports[`<RadioSet/> Render radio set 1`] = `
Radios set label Radios set label
</label> </label>
<div <div
class="mb-2" class="custom-control custom-radio"
> >
<input <input
checked="" checked=""
class="form-check-input me-2" class="custom-control-input"
id="test_name-0" id="test_name-0"
name="test_name" name="test_name"
type="radio" type="radio"
value="value" value="value"
/> />
<label <label
class="form-check-label" class="custom-control-label"
for="test_name-0" for="test_name-0"
> >
label label
</label> </label>
</div> </div>
<div <div
class="mb-2" class="custom-control custom-radio"
> >
<input <input
class="form-check-input me-2" class="custom-control-input"
id="test_name-1" id="test_name-1"
name="test_name" name="test_name"
type="radio" type="radio"
value="another value" value="another value"
/> />
<label <label
class="form-check-label" class="custom-control-label"
for="test_name-1" for="test_name-1"
> >
another label another label
</label> </label>
</div> </div>
<div <div
class="mb-2" class="custom-control custom-radio"
> >
<input <input
class="form-check-input me-2" class="custom-control-input"
id="test_name-2" id="test_name-2"
name="test_name" name="test_name"
type="radio" type="radio"
value="another on value" value="another on value"
/> />
<label <label
class="form-check-label" class="custom-control-label"
for="test_name-2" for="test_name-2"
> >
another one label another one label
</label> </label>
</div> </div>
<div <small
class="form-text" class="form-text text-muted"
> >
<small>
Some help text Some help text
</small> </small>
</div> </div>
</div>
`; `;

View File

@ -3,16 +3,15 @@
exports[`<Select/> Test with snapshot. 1`] = ` exports[`<Select/> Test with snapshot. 1`] = `
<div> <div>
<div <div
class="mb-3" class="form-group"
> >
<label <label
class="form-label"
for="1" for="1"
> >
Test label Test label
</label> </label>
<select <select
class="form-select" class="custom-select"
id="1" id="1"
> >
<option <option
@ -31,13 +30,11 @@ exports[`<Select/> Test with snapshot. 1`] = `
three three
</option> </option>
</select> </select>
<div <small
class="form-text" class="form-text text-muted"
> >
<small>
Help text Help text
</small> </small>
</div> </div>
</div> </div>
</div>
`; `;

View File

@ -2,25 +2,26 @@
exports[`<Switch/> Render switch 1`] = ` exports[`<Switch/> Render switch 1`] = `
<div <div
class="form-check form-switch mb-3 null" class="form-group"
>
<div
class="custom-control custom-switch"
> >
<input <input
checked="" checked=""
class="form-check-input" class="custom-control-input"
id="1" id="1"
role="switch"
type="checkbox" type="checkbox"
/> />
<label <label
class="form-check-label" class="custom-control-label"
for="1" for="1"
> >
Test label Test label
</label> </label>
<div <small
class="form-text" class="form-text text-muted mt-0 mb-3"
> >
<small>
Some help text Some help text
</small> </small>
</div> </div>
@ -29,24 +30,25 @@ exports[`<Switch/> Render switch 1`] = `
exports[`<Switch/> Render uncheked switch 1`] = ` exports[`<Switch/> Render uncheked switch 1`] = `
<div <div
class="form-check form-switch mb-3 null" class="form-group"
>
<div
class="custom-control custom-switch"
> >
<input <input
class="form-check-input" class="custom-control-input"
id="1" id="1"
role="switch"
type="checkbox" type="checkbox"
/> />
<label <label
class="form-check-label" class="custom-control-label"
for="1" for="1"
> >
Test label Test label
</label> </label>
<div <small
class="form-text" class="form-text text-muted mt-0 mb-3"
> >
<small>
Some help text Some help text
</small> </small>
</div> </div>

View File

@ -2,10 +2,9 @@
exports[`<TextInput/> Render text input 1`] = ` exports[`<TextInput/> Render text input 1`] = `
<div <div
class="mb-3" class="form-group"
> >
<label <label
class="form-label"
for="1" for="1"
> >
Test label Test label
@ -20,12 +19,10 @@ exports[`<TextInput/> Render text input 1`] = `
value="Some text" value="Some text"
/> />
</div> </div>
<div <small
class="form-text" class="form-text text-muted"
> >
<small>
Some help text Some help text
</small> </small>
</div> </div>
</div>
`; `;

View File

@ -58,7 +58,7 @@ export function ResetWiFiSettings({ ws, endpoint }) {
"If a number of wireless cards doesn't match, you may try to reset the Wi-Fi settings. Note that this will remove the current Wi-Fi configuration and restore the default values." "If a number of wireless cards doesn't match, you may try to reset the Wi-Fi settings. Note that this will remove the current Wi-Fi configuration and restore the default values."
)} )}
</p> </p>
<div className="text-end"> <div className="text-right">
<Button <Button
className="btn-primary" className="btn-primary"
forisFormSize forisFormSize

View File

@ -92,7 +92,7 @@ function DeviceForm({
return ( return (
<> <>
<Switch <Switch
label={<h2 className="mb-0">{_(`Wi-Fi ${deviceID + 1}`)}</h2>} label={<h2>{_(`Wi-Fi ${deviceID + 1}`)}</h2>}
checked={formData.enabled} checked={formData.enabled}
onChange={setFormValue((value) => ({ onChange={setFormValue((value) => ({
devices: { devices: {
@ -119,10 +119,12 @@ function DeviceForm({
}))} }))}
{...props} {...props}
> >
<div className="input-group-append">
<WiFiQRCode <WiFiQRCode
SSID={formData.SSID} SSID={formData.SSID}
password={formData.password} password={formData.password}
/> />
</div>
</TextInput> </TextInput>
<PasswordInput <PasswordInput

View File

@ -87,7 +87,7 @@ function QRCodeModal({ shown, setShown, SSID, password }) {
createAndDownloadPdf(SSID, password); createAndDownloadPdf(SSID, password);
}} }}
> >
<i className="fas fa-file-download me-2" /> <i className="fas fa-arrow-down mr-2" />
{_("Download PDF")} {_("Download PDF")}
</Button> </Button>
</ModalFooter> </ModalFooter>

View File

@ -5,7 +5,7 @@ exports[`<WiFiSettings/> Snapshot 2.4 GHz 1`] = `
- First value - First value
+ Second value + Second value
@@ -243,207 +243,95 @@ @@ -241,207 +241,95 @@
value=\\"0\\" value=\\"0\\"
> >
auto auto
@ -255,51 +255,53 @@ exports[`<WiFiSettings/> Snapshot both modules disabled. 1`] = `
> >
<form> <form>
<div <div
class="form-check form-switch mb-3 d-flex align-items-center" class="form-group switch"
>
<div
class="custom-control custom-switch custom-control-inline switch-heading"
> >
<input <input
class="form-check-input me-2" class="custom-control-input"
id="1" id="1"
role="switch"
type="checkbox" type="checkbox"
/> />
<label <label
class="form-check-label" class="custom-control-label"
for="1" for="1"
> >
<h2 <h2>
class="mb-0"
>
Wi-Fi 1 Wi-Fi 1
</h2> </h2>
</label> </label>
</div> </div>
</div>
<hr /> <hr />
<div <div
class="form-check form-switch mb-3 d-flex align-items-center" class="form-group switch"
>
<div
class="custom-control custom-switch custom-control-inline switch-heading"
> >
<input <input
class="form-check-input me-2" class="custom-control-input"
id="2" id="2"
role="switch"
type="checkbox" type="checkbox"
/> />
<label <label
class="form-check-label" class="custom-control-label"
for="2" for="2"
> >
<h2 <h2>
class="mb-0"
>
Wi-Fi 2 Wi-Fi 2
</h2> </h2>
</label> </label>
</div> </div>
</div>
<div <div
class="text-end" class="text-right"
> >
<button <button
class="btn btn-primary col-12 col-md-3 col-lg-2 d-inline-flex justify-content-center align-items-center" class="btn btn-primary col-sm-12 col-md-3 col-lg-2 d-inline-flex justify-content-center align-items-center"
type="submit" type="submit"
> >
<span> <span>
@ -319,10 +321,10 @@ exports[`<WiFiSettings/> Snapshot both modules disabled. 1`] = `
If a number of wireless cards doesn't match, you may try to reset the Wi-Fi settings. Note that this will remove the current Wi-Fi configuration and restore the default values. If a number of wireless cards doesn't match, you may try to reset the Wi-Fi settings. Note that this will remove the current Wi-Fi configuration and restore the default values.
</p> </p>
<div <div
class="text-end" class="text-right"
> >
<button <button
class="btn btn-primary col-12 col-md-3 col-lg-2 d-inline-flex justify-content-center align-items-center" class="btn btn-primary col-sm-12 col-md-3 col-lg-2 d-inline-flex justify-content-center align-items-center"
type="button" type="button"
> >
<span> <span>
@ -339,17 +341,16 @@ exports[`<WiFiSettings/> Snapshot guest network. 1`] = `
- First value - First value
+ Second value + Second value
@@ -527,10 +527,94 @@ @@ -524,10 +524,92 @@
<small> >
Enables Wi-Fi for guests, which is separated from LAN network. Devices connected to this network are allowed to access the internet, but aren't allowed to access other devices and the configuration interface of the router. Parameters of the guest network can be set in the Guest network tab. Enables Wi-Fi for guests, which is separated from LAN network. Devices connected to this network are allowed to access the internet, but aren't allowed to access other devices and the configuration interface of the router. Parameters of the guest network can be set in the Guest network tab.
</small> </small>
</div> </div>
</div> </div>
+ <div + <div
+ class=\\"mb-3\\" + class=\\"form-group\\"
+ > + >
+ <label + <label
+ class=\\"form-label\\"
+ for=\\"24\\" + for=\\"24\\"
+ > + >
+ SSID + SSID
@ -379,19 +380,16 @@ exports[`<WiFiSettings/> Snapshot guest network. 1`] = `
+ </button> + </button>
+ </div> + </div>
+ </div> + </div>
+ <div + <small
+ class=\\"form-text\\" + class=\\"form-text text-muted\\"
+ > + >
+ <small>
+ SSID which contains non-standard characters could cause problems on some devices. + SSID which contains non-standard characters could cause problems on some devices.
+ </small> + </small>
+ </div> + </div>
+ </div>
+ <div + <div
+ class=\\"mb-3\\" + class=\\"form-group\\"
+ > + >
+ <label + <label
+ class=\\"form-label\\"
+ for=\\"25\\" + for=\\"25\\"
+ > + >
+ Password + Password
@ -407,6 +405,9 @@ exports[`<WiFiSettings/> Snapshot guest network. 1`] = `
+ type=\\"password\\" + type=\\"password\\"
+ value=\\"\\" + value=\\"\\"
+ /> + />
+ <div
+ class=\\"input-group-append\\"
+ >
+ <button + <button
+ class=\\"input-group-text\\" + class=\\"input-group-text\\"
+ type=\\"button\\" + type=\\"button\\"
@ -416,30 +417,29 @@ exports[`<WiFiSettings/> Snapshot guest network. 1`] = `
+ /> + />
+ </button> + </button>
+ </div> + </div>
+ </div>
+ <div + <div
+ class=\\"invalid-feedback\\" + class=\\"invalid-feedback\\"
+ > + >
+ Password must contain at least 8 symbols + Password must contain at least 8 symbols
+ </div> + </div>
+ <div + <small
+ class=\\"form-text\\" + class=\\"form-text text-muted\\"
+ > + >
+ <small>
+ WPA2/3 pre-shared key, that is required to connect to the network. + WPA2/3 pre-shared key, that is required to connect to the network.
+ </small> + </small>
+ </div>
+ </div> + </div>
<hr /> <hr />
<div <div
class=\\"form-check form-switch mb-3 d-flex align-items-center\\" class=\\"form-group switch\\"
> >
<input
@@ -553,10 +637,11 @@
<div <div
class=\\"text-end\\" @@ -551,10 +633,11 @@
<div
class=\\"text-right\\"
> >
<button <button
class=\\"btn btn-primary col-12 col-md-3 col-lg-2 d-inline-flex justify-content-center align-items-center\\" class=\\"btn btn-primary col-sm-12 col-md-3 col-lg-2 d-inline-flex justify-content-center align-items-center\\"
+ disabled=\\"\\" + disabled=\\"\\"
type=\\"submit\\" type=\\"submit\\"
> >
@ -453,17 +453,16 @@ exports[`<WiFiSettings/> Snapshot one module enabled. 1`] = `
- First value - First value
+ Second value + Second value
@@ -21,10 +21,516 @@ @@ -22,10 +22,512 @@
>
Wi-Fi 1 Wi-Fi 1
</h2> </h2>
</label> </label>
</div> </div>
</div>
+ <div + <div
+ class=\\"mb-3\\" + class=\\"form-group\\"
+ > + >
+ <label + <label
+ class=\\"form-label\\"
+ for=\\"4\\" + for=\\"4\\"
+ > + >
+ SSID + SSID
@ -478,6 +477,9 @@ exports[`<WiFiSettings/> Snapshot one module enabled. 1`] = `
+ type=\\"text\\" + type=\\"text\\"
+ value=\\"TestSSID1\\" + value=\\"TestSSID1\\"
+ /> + />
+ <div
+ class=\\"input-group-append\\"
+ >
+ <button + <button
+ class=\\"input-group-text\\" + class=\\"input-group-text\\"
+ type=\\"button\\" + type=\\"button\\"
@ -490,19 +492,17 @@ exports[`<WiFiSettings/> Snapshot one module enabled. 1`] = `
+ /> + />
+ </button> + </button>
+ </div> + </div>
+ <div + </div>
+ class=\\"form-text\\" + <small
+ class=\\"form-text text-muted\\"
+ > + >
+ <small>
+ SSID which contains non-standard characters could cause problems on some devices. + SSID which contains non-standard characters could cause problems on some devices.
+ </small> + </small>
+ </div> + </div>
+ </div>
+ <div + <div
+ class=\\"mb-3\\" + class=\\"form-group\\"
+ > + >
+ <label + <label
+ class=\\"form-label\\"
+ for=\\"5\\" + for=\\"5\\"
+ > + >
+ Password + Password
@ -518,6 +518,9 @@ exports[`<WiFiSettings/> Snapshot one module enabled. 1`] = `
+ type=\\"password\\" + type=\\"password\\"
+ value=\\"TestPass\\" + value=\\"TestPass\\"
+ /> + />
+ <div
+ class=\\"input-group-append\\"
+ >
+ <button + <button
+ class=\\"input-group-text\\" + class=\\"input-group-text\\"
+ type=\\"button\\" + type=\\"button\\"
@ -527,39 +530,39 @@ exports[`<WiFiSettings/> Snapshot one module enabled. 1`] = `
+ /> + />
+ </button> + </button>
+ </div> + </div>
+ <div + </div>
+ class=\\"form-text\\" + <small
+ class=\\"form-text text-muted\\"
+ > + >
+ <small>
+ WPA2/3 pre-shared key, that is required to connect to the network. + WPA2/3 pre-shared key, that is required to connect to the network.
+ </small> + </small>
+ </div> + </div>
+ </div>
+ <div + <div
+ class=\\"form-check form-switch mb-3 null\\" + class=\\"form-group\\"
+ >
+ <div
+ class=\\"custom-control custom-switch\\"
+ > + >
+ <input + <input
+ class=\\"form-check-input\\" + class=\\"custom-control-input\\"
+ id=\\"6\\" + id=\\"6\\"
+ role=\\"switch\\"
+ type=\\"checkbox\\" + type=\\"checkbox\\"
+ /> + />
+ <label + <label
+ class=\\"form-check-label\\" + class=\\"custom-control-label\\"
+ for=\\"6\\" + for=\\"6\\"
+ > + >
+ Hide SSID + Hide SSID
+ </label> + </label>
+ <div + <small
+ class=\\"form-text\\" + class=\\"form-text text-muted mt-0 mb-3\\"
+ > + >
+ <small>
+ If set, network is not visible when scanning for available networks. + If set, network is not visible when scanning for available networks.
+ </small> + </small>
+ </div> + </div>
+ </div> + </div>
+ <div + <div
+ class=\\"mb-3\\" + class=\\"form-group\\"
+ > + >
+ <label + <label
+ class=\\"d-block\\" + class=\\"d-block\\"
@ -568,59 +571,56 @@ exports[`<WiFiSettings/> Snapshot one module enabled. 1`] = `
+ GHz + GHz
+ </label> + </label>
+ <div + <div
+ class=\\"mb-2 form-check form-check-inline\\" + class=\\"custom-control custom-radio custom-control-inline\\"
+ > + >
+ <input + <input
+ class=\\"form-check-input me-2\\" + class=\\"custom-control-input\\"
+ id=\\"hwmode-0-0\\" + id=\\"hwmode-0-0\\"
+ name=\\"hwmode-0\\" + name=\\"hwmode-0\\"
+ type=\\"radio\\" + type=\\"radio\\"
+ value=\\"11g\\" + value=\\"11g\\"
+ /> + />
+ <label + <label
+ class=\\"form-check-label\\" + class=\\"custom-control-label\\"
+ for=\\"hwmode-0-0\\" + for=\\"hwmode-0-0\\"
+ > + >
+ 2.4 + 2.4
+ </label> + </label>
+ </div> + </div>
+ <div + <div
+ class=\\"mb-2 form-check form-check-inline\\" + class=\\"custom-control custom-radio custom-control-inline\\"
+ > + >
+ <input + <input
+ checked=\\"\\" + checked=\\"\\"
+ class=\\"form-check-input me-2\\" + class=\\"custom-control-input\\"
+ id=\\"hwmode-0-1\\" + id=\\"hwmode-0-1\\"
+ name=\\"hwmode-0\\" + name=\\"hwmode-0\\"
+ type=\\"radio\\" + type=\\"radio\\"
+ value=\\"11a\\" + value=\\"11a\\"
+ /> + />
+ <label + <label
+ class=\\"form-check-label\\" + class=\\"custom-control-label\\"
+ for=\\"hwmode-0-1\\" + for=\\"hwmode-0-1\\"
+ > + >
+ 5 + 5
+ </label> + </label>
+ </div> + </div>
+ <div + <small
+ class=\\"form-text\\" + class=\\"form-text text-muted\\"
+ > + >
+ <small>
+ The 2.4 GHz band is more widely supported by clients, but tends to have more interference. The 5 GHz band is a newer standard and may not be supported by all your devices. It usually has less interference, but the signal does not carry so well indoors. + The 2.4 GHz band is more widely supported by clients, but tends to have more interference. The 5 GHz band is a newer standard and may not be supported by all your devices. It usually has less interference, but the signal does not carry so well indoors.
+ </small> + </small>
+ </div> + </div>
+ </div>
+ <div + <div
+ class=\\"mb-3\\" + class=\\"form-group\\"
+ > + >
+ <label + <label
+ class=\\"form-label\\"
+ for=\\"8\\" + for=\\"8\\"
+ > + >
+ 802.11n/ac/ax mode + 802.11n/ac/ax mode
+ </label> + </label>
+ <select + <select
+ class=\\"form-select\\" + class=\\"custom-select\\"
+ id=\\"8\\" + id=\\"8\\"
+ > + >
+ <option + <option
@ -654,25 +654,22 @@ exports[`<WiFiSettings/> Snapshot one module enabled. 1`] = `
+ 802.11ac - 80 MHz wide channel + 802.11ac - 80 MHz wide channel
+ </option> + </option>
+ </select> + </select>
+ <div + <small
+ class=\\"form-text\\" + class=\\"form-text text-muted\\"
+ > + >
+ <small>
+ Change this to adjust 802.11n/ac/ax mode of operation. 802.11n with 40 MHz wide channels can yield higher throughput but can cause more interference in the network. If you don't know what to choose, use the default option with 20 MHz wide channel. + Change this to adjust 802.11n/ac/ax mode of operation. 802.11n with 40 MHz wide channels can yield higher throughput but can cause more interference in the network. If you don't know what to choose, use the default option with 20 MHz wide channel.
+ </small> + </small>
+ </div> + </div>
+ </div>
+ <div + <div
+ class=\\"mb-3\\" + class=\\"form-group\\"
+ > + >
+ <label + <label
+ class=\\"form-label\\"
+ for=\\"9\\" + for=\\"9\\"
+ > + >
+ Channel + Channel
+ </label> + </label>
+ <select + <select
+ class=\\"form-select\\" + class=\\"custom-select\\"
+ id=\\"9\\" + id=\\"9\\"
+ > + >
+ <option + <option
@ -883,16 +880,15 @@ exports[`<WiFiSettings/> Snapshot one module enabled. 1`] = `
+ </select> + </select>
+ </div> + </div>
+ <div + <div
+ class=\\"mb-3\\" + class=\\"form-group\\"
+ > + >
+ <label + <label
+ class=\\"form-label\\"
+ for=\\"10\\" + for=\\"10\\"
+ > + >
+ Encryption + Encryption
+ </label> + </label>
+ <select + <select
+ class=\\"form-select\\" + class=\\"custom-select\\"
+ id=\\"10\\" + id=\\"10\\"
+ > + >
+ <option + <option
@ -911,63 +907,63 @@ exports[`<WiFiSettings/> Snapshot one module enabled. 1`] = `
+ WPA2 only + WPA2 only
+ </option> + </option>
+ </select> + </select>
+ <div + <small
+ class=\\"form-text\\" + class=\\"form-text text-muted\\"
+ > + >
+ <small>
+ The WPA3 standard is the new most secure encryption method that is suggested to be used with any device that supports it. The older devices without WPA3 support require older WPA2. If you experience issues with connecting older devices, try to enable WPA2. + The WPA3 standard is the new most secure encryption method that is suggested to be used with any device that supports it. The older devices without WPA3 support require older WPA2. If you experience issues with connecting older devices, try to enable WPA2.
+ </small> + </small>
+ </div> + </div>
+ </div>
+ <div + <div
+ class=\\"form-check form-switch mb-3 null\\" + class=\\"form-group\\"
+ >
+ <div
+ class=\\"custom-control custom-switch\\"
+ > + >
+ <input + <input
+ class=\\"form-check-input\\" + class=\\"custom-control-input\\"
+ id=\\"11\\" + id=\\"11\\"
+ role=\\"switch\\"
+ type=\\"checkbox\\" + type=\\"checkbox\\"
+ /> + />
+ <label + <label
+ class=\\"form-check-label\\" + class=\\"custom-control-label\\"
+ for=\\"11\\" + for=\\"11\\"
+ > + >
+ Disable Management Frame Protection + Disable Management Frame Protection
+ </label> + </label>
+ <div + <small
+ class=\\"form-text\\" + class=\\"form-text text-muted mt-0 mb-3\\"
+ > + >
+ <small>
+ In case you have trouble connecting to WiFi Access Point, try disabling Management Frame Protection. + In case you have trouble connecting to WiFi Access Point, try disabling Management Frame Protection.
+ </small> + </small>
+ </div> + </div>
+ </div> + </div>
+ <div + <div
+ class=\\"form-check form-switch mb-3 null\\" + class=\\"form-group\\"
+ >
+ <div
+ class=\\"custom-control custom-switch\\"
+ > + >
+ <input + <input
+ class=\\"form-check-input\\" + class=\\"custom-control-input\\"
+ id=\\"12\\" + id=\\"12\\"
+ role=\\"switch\\"
+ type=\\"checkbox\\" + type=\\"checkbox\\"
+ /> + />
+ <label + <label
+ class=\\"form-check-label\\" + class=\\"custom-control-label\\"
+ for=\\"12\\" + for=\\"12\\"
+ > + >
+ Enable Guest Wi-Fi + Enable Guest Wi-Fi
+ </label> + </label>
+ <div + <small
+ class=\\"form-text\\" + class=\\"form-text text-muted mt-0 mb-3\\"
+ > + >
+ <small>
+ Enables Wi-Fi for guests, which is separated from LAN network. Devices connected to this network are allowed to access the internet, but aren't allowed to access other devices and the configuration interface of the router. Parameters of the guest network can be set in the Guest network tab. + Enables Wi-Fi for guests, which is separated from LAN network. Devices connected to this network are allowed to access the internet, but aren't allowed to access other devices and the configuration interface of the router. Parameters of the guest network can be set in the Guest network tab.
+ </small> + </small>
+ </div> + </div>
+ </div> + </div>
<hr /> <hr />
<div <div
class=\\"form-check form-switch mb-3 d-flex align-items-center\\" class=\\"form-group switch\\"
> >
<input" <div"
`; `;

View File

@ -25,10 +25,15 @@ exports[`<RebootButton/> Render modal. 1`] = `
Warning! Warning!
</h5> </h5>
<button <button
aria-label="Close" class="close"
class="btn-close"
type="button" type="button"
/> >
<span
aria-hidden="true"
>
×
</span>
</button>
</div> </div>
<div <div
class="modal-body" class="modal-body"

View File

@ -48,7 +48,7 @@ describe("AlertContext", () => {
// Alert is present // Alert is present
expect(getByText(componentContainer, "Alert content")).toBeDefined(); expect(getByText(componentContainer, "Alert content")).toBeDefined();
fireEvent.click(componentContainer.querySelector(".btn-close")); fireEvent.click(componentContainer.querySelector(".close"));
// Alert is gone // Alert is gone
expect(queryByText(componentContainer, "Alert content")).toBeNull(); expect(queryByText(componentContainer, "Alert content")).toBeNull();
}); });

View File

@ -6,13 +6,14 @@ exports[`AlertContext should render alert 1`] = `
id="alert-container" id="alert-container"
> >
<div <div
class="alert alert-danger alert-dismissible" class="alert alert-dismissible alert-danger"
> >
<button <button
aria-label="Close" class="close"
class="btn-close"
type="button" type="button"
/> >
×
</button>
Alert content Alert content
</div> </div>
</div> </div>

View File

@ -3,13 +3,13 @@
exports[`<SubmitButton/> Render load 1`] = ` exports[`<SubmitButton/> Render load 1`] = `
<div> <div>
<button <button
class="btn btn-primary col-12 col-md-3 col-lg-2 d-inline-flex justify-content-center align-items-center" class="btn btn-primary col-sm-12 col-md-3 col-lg-2 d-inline-flex justify-content-center align-items-center"
disabled="" disabled=""
type="submit" type="submit"
> >
<span <span
aria-hidden="true" aria-hidden="true"
class="spinner-border spinner-border-sm me-1" class="spinner-border spinner-border-sm mr-1"
role="status" role="status"
/> />
<span> <span>
@ -22,7 +22,7 @@ exports[`<SubmitButton/> Render load 1`] = `
exports[`<SubmitButton/> Render ready 1`] = ` exports[`<SubmitButton/> Render ready 1`] = `
<div> <div>
<button <button
class="btn btn-primary col-12 col-md-3 col-lg-2 d-inline-flex justify-content-center align-items-center" class="btn btn-primary col-sm-12 col-md-3 col-lg-2 d-inline-flex justify-content-center align-items-center"
type="submit" type="submit"
> >
<span> <span>
@ -35,13 +35,13 @@ exports[`<SubmitButton/> Render ready 1`] = `
exports[`<SubmitButton/> Render saving 1`] = ` exports[`<SubmitButton/> Render saving 1`] = `
<div> <div>
<button <button
class="btn btn-primary col-12 col-md-3 col-lg-2 d-inline-flex justify-content-center align-items-center" class="btn btn-primary col-sm-12 col-md-3 col-lg-2 d-inline-flex justify-content-center align-items-center"
disabled="" disabled=""
type="submit" type="submit"
> >
<span <span
aria-hidden="true" aria-hidden="true"
class="spinner-border spinner-border-sm me-1" class="spinner-border spinner-border-sm mr-1"
role="status" role="status"
/> />
<span> <span>

View File

@ -190,7 +190,7 @@ export function ForisForm({
<Prompt message={getMessageOnLeavingPage} /> <Prompt message={getMessageOnLeavingPage} />
<form onSubmit={onSubmit} ref={formReference}> <form onSubmit={onSubmit} ref={formReference}>
{childrenWithFormProps} {childrenWithFormProps}
<div className="text-end"> <div className="text-right">
<SubmitButton <SubmitButton
state={getSubmitButtonState()} state={getSubmitButtonState()}
disabled={submitButtonIsDisabled} disabled={submitButtonIsDisabled}

View File

@ -69,7 +69,7 @@ export {
withErrorMessage, withErrorMessage,
} from "./utils/conditionalHOCs"; } from "./utils/conditionalHOCs";
export { ErrorMessage } from "./utils/ErrorMessage"; export { ErrorMessage } from "./utils/ErrorMessage";
export { useClickOutside, useTooltip } from "./utils/hooks"; export { useClickOutside } from "./utils/hooks";
export { toLocaleDateString } from "./utils/datetime"; export { toLocaleDateString } from "./utils/datetime";
export { displayCard } from "./utils/displayCard"; export { displayCard } from "./utils/displayCard";
export { isPluginInstalled } from "./utils/isPluginInstalled"; export { isPluginInstalled } from "./utils/isPluginInstalled";

View File

@ -1,12 +1,11 @@
/* /*
* Copyright (C) 2019-2024 CZ.NIC z.s.p.o. (https://www.nic.cz/) * Copyright (C) 2019 CZ.NIC z.s.p.o. (http://www.nic.cz/)
* *
* This is free software, licensed under the GNU General Public License v3. * This is free software, licensed under the GNU General Public License v3.
* See /LICENSE for more information. * See /LICENSE for more information.
*/ */
import { useState, useEffect, useRef } from "react"; import { useState, useEffect } from "react";
import { Tooltip } from "bootstrap/dist/js/bootstrap.bundle.min";
/** Execute callback when condition is set to true. */ /** Execute callback when condition is set to true. */
export function useConditionalTimeout( export function useConditionalTimeout(
@ -41,22 +40,3 @@ export function useClickOutside(element, callback) {
}; };
}); });
} }
/** useTooltip hook for Bootstrap tooltips. */
export function useTooltip(description, placement = "top", trigger = "hover") {
const tooltipRef = useRef();
useEffect(() => {
const tooltip = new Tooltip(tooltipRef.current, {
title: description,
placement,
trigger,
});
return () => {
tooltip.dispose();
};
});
return tooltipRef;
}