1
0
mirror of https://gitlab.nic.cz/turris/reforis/foris-js.git synced 2024-07-02 20:30:27 +00:00

Merge branch 'release-v5.1.4' into 'dev'

Release v5.1.4

See merge request turris/reforis/foris-js!133
This commit is contained in:
Aleksandr Gumroian 2020-09-25 17:43:10 +02:00
commit ed7cf34e76
8 changed files with 27 additions and 9 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "foris", "name": "foris",
"version": "5.1.3", "version": "5.1.4",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "foris", "name": "foris",
"version": "5.1.3", "version": "5.1.4",
"description": "Set of components and utils for Foris and its plugins.", "description": "Set of components and utils for Foris and its plugins.",
"author": "CZ.NIC, z.s.p.o.", "author": "CZ.NIC, z.s.p.o.",
"repository": { "repository": {

View File

@ -37,7 +37,11 @@ Alert.defaultProps = {
export function Alert({ type, onDismiss, children }) { export function Alert({ type, onDismiss, children }) {
return ( return (
<div className={`alert alert-dismissible alert-${type}`}> <div
className={`alert ${
onDismiss ? "alert-dismissible" : ""
} alert-${type}`}
>
{onDismiss ? ( {onDismiss ? (
<button type="button" className="close" onClick={onDismiss}> <button type="button" className="close" onClick={onDismiss}>
&times; &times;

View File

@ -1,11 +1,11 @@
/* /*
* Copyright (C) 2019 CZ.NIC z.s.p.o. (http://www.nic.cz/) * Copyright (C) 2020 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 React, { useRef } from "react"; import React, { useRef, useEffect } from "react";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { Portal } from "../utils/Portal"; import { Portal } from "../utils/Portal";
@ -31,6 +31,19 @@ export function Modal({ shown, setShown, scrollable, children }) {
useClickOutside(dialogRef, () => setShown(false)); useClickOutside(dialogRef, () => setShown(false));
useEffect(() => {
const handleEsc = (event) => {
if (event.keyCode === 27) {
setShown(false);
}
};
window.addEventListener("keydown", handleEsc);
return () => {
window.removeEventListener("keydown", handleEsc);
};
}, [setShown]);
return ( return (
<Portal containerId="modal-container"> <Portal containerId="modal-container">
<div className={`modal fade ${shown ? "show" : ""}`} role="dialog"> <div className={`modal fade ${shown ? "show" : ""}`} role="dialog">

View File

@ -63,7 +63,7 @@ RebootModal.propTypes = {
function RebootModal({ shown, setShown, onReboot }) { function RebootModal({ shown, setShown, onReboot }) {
return ( return (
<Modal shown={shown} setShown={setShown}> <Modal shown={shown} setShown={setShown}>
<ModalHeader setShown={setShown} title={_("Reboot confirmation")} /> <ModalHeader setShown={setShown} title={_("Warning!")} />
<ModalBody> <ModalBody>
<p>{_("Are you sure you want to restart the router?")}</p> <p>{_("Are you sure you want to restart the router?")}</p>
</ModalBody> </ModalBody>

View File

@ -157,6 +157,7 @@ function DeviceForm({
choices={getHwmodeChoices(formData)} choices={getHwmodeChoices(formData)}
value={formData.hwmode} value={formData.hwmode}
helpText={HELP_TEXTS.hwmode} helpText={HELP_TEXTS.hwmode}
inline
onChange={setFormValue((value) => ({ onChange={setFormValue((value) => ({
devices: { devices: {
[deviceIndex]: { [deviceIndex]: {

View File

@ -570,7 +570,7 @@ exports[`<WiFiSettings/> Snapshot one module enabled. 1`] = `
+ GHz + GHz
+ </label> + </label>
+ <div + <div
+ class=\\"custom-control custom-radio\\" + class=\\"custom-control custom-radio custom-control-inline\\"
+ > + >
+ <input + <input
+ class=\\"custom-control-input\\" + class=\\"custom-control-input\\"
@ -587,7 +587,7 @@ exports[`<WiFiSettings/> Snapshot one module enabled. 1`] = `
+ </label> + </label>
+ </div> + </div>
+ <div + <div
+ class=\\"custom-control custom-radio\\" + class=\\"custom-control custom-radio custom-control-inline\\"
+ > + >
+ <input + <input
+ checked=\\"\\" + checked=\\"\\"

View File

@ -22,7 +22,7 @@ exports[`<RebootButton/> Render modal. 1`] = `
<h5 <h5
class="modal-title" class="modal-title"
> >
Reboot confirmation Warning!
</h5> </h5>
<button <button
class="close" class="close"