Commit 897f3211 authored by Michal Hrusecky's avatar Michal Hrusecky 🐉
Browse files

Merge tag 'v0.9.9' into HEAD

 Bump v0.9.9

 * Add Fluid Layout
 * Fix navigation items order
 * Add Guest Network warning

Conflicts:
	js/src/guestNetwork/GuestNetwork.js
	js/src/guestNetwork/__tests__/GuestNewtork.test.js
	js/src/password/ForisPasswordForm.js
	js/src/password/__tests__/__snapshots__/Password.test.js.snap
parents c8185fe8 1bc7ff87
Pipeline #68935 failed with stage
in 4 minutes and 8 seconds
This diff is collapsed.
{
"name": "reforis_js",
"author": "CZ.NIC, z.s.p.o.",
"repository": {
"type": "git",
"url": "https://gitlab.labs.nic.cz/turris/reforis/reforis.git"
},
"license": "GPL-3.0",
"version": "0.9.1",
"description": "Turris routers web configuration interface.",
"main": "./src/app.js",
"dependencies": {
"@fortawesome/fontawesome-free": "^5.12.1",
"axios": "^0.19.2",
"bootstrap": "4.4.1",
"bootswatch": "4.4.1",
"foris": "^5.0.0",
"immutability-helper": "3.0.1",
"ipaddr": "npm:ipaddr.js@^1.9.1",
"jquery": "^3.5.1",
"moment": "^2.24.0",
"pdfmake": "^0.1.63",
"popper.js": "^1.16.1",
"prop-types": "15.7.2",
"react": "16.9.0",
"react-datetime": "^2.16.3",
"react-dom": "16.9.0",
"react-router-dom": "^5.1.2",
"react-uid": "^2.2.0"
},
"devDependencies": {
"@babel/cli": "^7.8.4",
"@babel/core": "^7.8.6",
"@babel/plugin-transform-runtime": "^7.8.3",
"@babel/preset-env": "^7.9.0",
"@babel/preset-react": "^7.8.3",
"@testing-library/react": "^8.0.9",
"@testing-library/user-event": "^7.2.1",
"babel-loader": "^8.0.6",
"css-loader": "^3.4.2",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.11.0",
"eslint-config-reforis": "^1.0.0",
"expose-loader": "^0.7.5",
"file-loader": "^4.3.0",
"jest": "^24.9.0",
"jest-mock-axios": "^3.2.0",
"mini-css-extract-plugin": "^0.8.2",
"moment-timezone": "^0.5.28",
"optimize-css-assets-webpack-plugin": "^5.0.3",
"react-styleguidist": "^10.6.2",
"snapshot-diff": "^0.5.1",
"string-replace-loader": "^2.2.0",
"style-loader": "^0.23.1",
"terser-webpack-plugin": "^2.3.5",
"webpack": "^4.42.0",
"webpack-cli": "^3.3.11"
},
"scripts": {
"watch": "webpack --watch --watch-poll --mode=development --env.lighttpd",
"build": "webpack --mode=production --env.lighttpd",
"lint": "eslint src",
"lint:fix": "eslint --fix src",
"test": "jest",
"test:watch": "jest --watch",
"test:coverage": "jest --coverage --colors",
"docs": "npx styleguidist build",
"docs:watch": "styleguidist server"
}
"name": "reforis_js",
"author": "CZ.NIC, z.s.p.o.",
"repository": {
"type": "git",
"url": "https://gitlab.nic.cz/turris/reforis/reforis.git"
},
"license": "GPL-3.0",
"version": "0.9.9",
"description": "Turris routers web configuration interface.",
"main": "./src/app.js",
"dependencies": {
"@fortawesome/fontawesome-free": "^5.12.1",
"axios": "^0.19.2",
"bootstrap": "4.4.1",
"bootswatch": "4.4.1",
"foris": "^5.1.0",
"immutability-helper": "3.0.1",
"ipaddr": "npm:ipaddr.js@^1.9.1",
"jquery": "^3.5.1",
"moment": "^2.24.0",
"pdfmake": "^0.1.63",
"popper.js": "^1.16.1",
"prop-types": "15.7.2",
"react": "16.9.0",
"react-datetime": "^2.16.3",
"react-dom": "16.9.0",
"react-router-dom": "^5.1.2",
"react-uid": "^2.2.0"
},
"devDependencies": {
"@babel/cli": "^7.8.4",
"@babel/core": "^7.8.6",
"@babel/plugin-transform-runtime": "^7.8.3",
"@babel/preset-env": "^7.9.0",
"@babel/preset-react": "^7.8.3",
"@testing-library/react": "^8.0.9",
"@testing-library/user-event": "^7.2.1",
"babel-loader": "^8.0.6",
"css-loader": "^3.4.2",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.11.0",
"eslint-config-reforis": "^1.0.0",
"expose-loader": "^0.7.5",
"file-loader": "^4.3.0",
"jest": "^24.9.0",
"jest-mock-axios": "^3.2.0",
"mini-css-extract-plugin": "^0.8.2",
"moment-timezone": "^0.5.28",
"optimize-css-assets-webpack-plugin": "^5.0.3",
"react-styleguidist": "^10.6.2",
"snapshot-diff": "^0.5.1",
"string-replace-loader": "^2.2.0",
"style-loader": "^0.23.1",
"terser-webpack-plugin": "^2.3.5",
"webpack": "^4.42.0",
"webpack-cli": "^3.3.11"
},
"scripts": {
"watch": "webpack --watch --watch-poll --mode=development --env.lighttpd",
"build": "webpack --mode=production --env.lighttpd",
"lint": "eslint src",
"lint:fix": "eslint --fix src",
"test": "jest",
"test:watch": "jest --watch",
"test:coverage": "jest --coverage --colors",
"docs": "npx styleguidist build",
"docs:watch": "styleguidist server"
}
}
......@@ -53,14 +53,25 @@ function AboutTable({ deviceDetails }) {
<td>{deviceDetails.os_version}</td>
</tr>
<tr>
<th>{_("Turris OS branch")}</th>
<th>
{_("Turris OS branch")}
<i
className="text-muted fas fa-question-circle ml-1 help"
title={_(
"Turris OS is currently released in various branches, which have different functions and varying stability - you can pick, which branch you want to test."
)}
/>
</th>
<td>
{deviceDetails.os_branch.value.toUpperCase()}
<a
href="https://docs.turris.cz/geek/testing/#branches-available"
className="text-muted"
target="_blank"
rel="noopener noreferrer"
>
<i className="fas fa-question-circle ml-2" />
{deviceDetails.os_branch.value.toUpperCase()}
<sup>
<i className="fas fa-external-link-alt ml-1" />
</sup>
</a>
</td>
</tr>
......
/*
* 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.
* See /LICENSE for more information.
......@@ -20,13 +20,6 @@ body {
background-color: #f5f5f5;
}
/* Fixing twinks due to scroll bar appearing */
html {
width: 100vw;
overflow-x: hidden;
}
h1 {
font-size: 2.5rem;
}
......@@ -107,11 +100,14 @@ form > button {
user-select: none !important;
}
/* Fix disabled buttons */
a.disabled,
button:disabled {
cursor: not-allowed;
pointer-events: all !important;
}
/* Custom Scrollbar */
html {
......@@ -125,7 +121,7 @@ html {
}
::-webkit-scrollbar {
width: 8px;
width: 6px;
}
::-webkit-scrollbar-track {
......@@ -135,3 +131,7 @@ html {
background-color: var(--thumbBG);
border-radius: 6px;
}
.help {
cursor: help;
}
/*
* 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.
* See /LICENSE for more information.
*/
.scrollToTop {
position: fixed;
bottom: 20px;
right: 8px;
align-items: flex-end;
font-size: 2.5em;
justify-content: center;
z-index: 1000;
cursor: pointer;
animation: fadeIn 0.3s;
transition: opacity 0.4s;
opacity: 0.5;
width: 40px;
background-color: black;
color: white;
border-radius: 3px;
}
.scrollToTop:hover {
opacity: 1;
}
@keyframes fadeIn {
0% {
opacity: 0;
}
100% {
opacity: 0.5;
}
}
/*
* 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.
* See /LICENSE for more information.
*/
import React, { useState } from "react";
import "./ScrollToTopArrow.css";
const ScrollToTopArrow = () => {
const [showScrollArrow, setShowScrollArrow] = useState(false);
const checkScrollToTop = () => {
if (!showScrollArrow && window.pageYOffset > 400) {
setShowScrollArrow(true);
} else if (showScrollArrow && window.pageYOffset <= 400) {
setShowScrollArrow(false);
}
};
const scrollToTop = () => {
window.scrollTo({ top: 0, behavior: "smooth" });
};
window.addEventListener("scroll", checkScrollToTop);
return (
<div
title={_("Go to top")}
className="scrollToTop"
style={{
display: showScrollArrow ? "flex" : "none",
}}
onClick={scrollToTop}
onKeyPress={scrollToTop}
role="button"
tabIndex={0}
>
<i className="fas fa-angle-up" />
</div>
);
};
export default ScrollToTopArrow;
......@@ -16,7 +16,7 @@ export const HELP_TEXT = _(
DHCPServerForm.propTypes = {
formData: PropTypes.shape({
start: PropTypes.string,
start: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
limit: PropTypes.number,
lease_time: PropTypes.number,
}).isRequired,
......
......@@ -51,10 +51,10 @@ exports[`<ConnectionTest/> Snapshot after trigger DNS connection test. 1`] = `
</tbody>
</table>
<div
class="undefined text-right"
class="col-sm-12 col-lg-12 p-0 mb-3 text-right"
>
<button
class="btn btn-primary col-sm-12 col-lg-3"
class="btn btn-primary col-sm-12 col-md-3 col-lg-2"
disabled=""
type="submit"
>
......@@ -63,7 +63,7 @@ exports[`<ConnectionTest/> Snapshot after trigger DNS connection test. 1`] = `
class="spinner-border spinner-border-sm"
role="status"
/>
Test is running...
Test is running...
</button>
</div>
</form>
......@@ -160,10 +160,10 @@ exports[`<ConnectionTest/> Snapshot after trigger WAN connection test. 1`] = `
</tbody>
</table>
<div
class="undefined text-right"
class="col-sm-12 col-lg-12 p-0 mb-3 text-right"
>
<button
class="btn btn-primary col-sm-12 col-lg-3"
class="btn btn-primary col-sm-12 col-md-3 col-lg-2"
disabled=""
type="submit"
>
......@@ -172,7 +172,7 @@ exports[`<ConnectionTest/> Snapshot after trigger WAN connection test. 1`] = `
class="spinner-border spinner-border-sm"
role="status"
/>
Test is running...
Test is running...
</button>
</div>
</form>
......@@ -265,13 +265,13 @@ exports[`<ConnectionTest/> Snapshot before connection test. 1`] = `
</tbody>
</table>
<div
class="undefined text-right"
class="col-sm-12 col-lg-12 p-0 mb-3 text-right"
>
<button
class="btn btn-primary col-sm-12 col-lg-3"
class="btn btn-primary col-sm-12 col-md-3 col-lg-2"
type="submit"
>
Test connection
Test connection
</button>
</div>
</form>
......@@ -364,13 +364,13 @@ exports[`<ConnectionTest/> Snapshots with connection test results. 1`] = `
</tbody>
</table>
<div
class="undefined text-right"
class="col-sm-12 col-lg-12 p-0 mb-3 text-right"
>
<button
class="btn btn-primary col-sm-12 col-lg-3"
class="btn btn-primary col-sm-12 col-md-3 col-lg-2"
type="submit"
>
Test connection again
Test connection again
</button>
</div>
</form>
......
......@@ -38,7 +38,7 @@ exports[`<DNS/> Test with snapshot DHCP. 1`] = `
class=\\"text-right\\"
>
<button
class=\\"btn btn-primary col-sm-12 col-lg-3\\"
class=\\"btn btn-primary col-sm-12 col-md-3 col-lg-2\\"
type=\\"submit\\""
`;
......@@ -205,13 +205,13 @@ exports[`<DNS/> Test with snapshot forwarding. 1`] = `
+ class=\\"btn btn-primary btn-sm\\"
+ type=\\"button\\"
+ >
+ Edit
+ Edit
+ </button>
+ <button
+ class=\\"btn btn-danger btn-sm\\"
+ type=\\"button\\"
+ >
+ Delete
+ Delete
+ </button>
+ </div>
+ </td>
......@@ -222,10 +222,10 @@ exports[`<DNS/> Test with snapshot forwarding. 1`] = `
+ class=\\"text-right\\"
+ >
+ <button
+ class=\\"btn btn-outline-success btn mb-3 mb-sm-2 mb-md-0 col-sm-12 col-lg-3\\"
+ class=\\"btn btn-outline-success btn mb-3 mb-sm-2 mb-md-0 col-sm-12 col-md-3 col-lg-2\\"
+ type=\\"button\\"
+ >
+ Add custom forwarder
+ Add custom forwarder
+ </button>
+ </div>
<div
......@@ -271,7 +271,7 @@ this is a serious flaw on their side.
</p>
<div
class="col-sm-12 offset-lg-1 col-lg-10 p-0 mb-3"
class="card p-4 col-sm-12 col-lg-12 p-0 mb-3"
>
<form>
<div
......@@ -341,10 +341,10 @@ this is a serious flaw on their side.
class="text-right"
>
<button
class="btn btn-primary col-sm-12 col-lg-3"
class="btn btn-primary col-sm-12 col-md-3 col-lg-2"
type="submit"
>
Save
Save
</button>
</div>
</form>
......@@ -409,13 +409,13 @@ works as expected. Remember to click on the
</tbody>
</table>
<div
class="undefined text-right"
class="col-sm-12 col-lg-12 p-0 mb-3 text-right"
>
<button
class="btn btn-primary col-sm-12 col-lg-3"
class="btn btn-primary col-sm-12 col-md-3 col-lg-2"
type="submit"
>
Test connection
Test connection
</button>
</div>
</form>
......
......@@ -50,8 +50,6 @@ exports[`<ForwarderForm/>: existed forwarder. Test with snapshot. 1`] = `
class="btn btn-outline-success btn-sm col-12 mb-2"
type="button"
>
Add IPv4 address
</button>
</div>
......@@ -84,8 +82,6 @@ exports[`<ForwarderForm/>: existed forwarder. Test with snapshot. 1`] = `
class="btn btn-outline-success btn-sm col-12 mb-2"
type="button"
>
Add IPv6 address
</button>
</div>
......@@ -102,14 +98,14 @@ exports[`<ForwarderForm/>: existed forwarder. Test with snapshot. 1`] = `
id="4"
>
<option
value="no"
value="hostname"
>
No TLS
Hostname
</option>
<option
value="hostname"
value="no"
>
Hostname
No TLS
</option>
<option
value="pin"
......@@ -119,11 +115,9 @@ exports[`<ForwarderForm/>: existed forwarder. Test with snapshot. 1`] = `
</select>
</div>
<button
class="btn btn-primary col-sm-12 col-lg-3"
class="btn btn-primary col-sm-12 col-md-3 col-lg-2"
type="button"
>
Save forwarder
</button>
</div>
......@@ -189,8 +183,6 @@ exports[`<ForwarderForm/>: new forwarder. Test with snapshot. 1`] = `
class="btn btn-outline-success btn-sm col-12 mb-2"
type="button"
>
Add IPv4 address
</button>
</div>
......@@ -228,8 +220,6 @@ exports[`<ForwarderForm/>: new forwarder. Test with snapshot. 1`] = `
class="btn btn-outline-success btn-sm col-12 mb-2"
type="button"
>
Add IPv6 address
</button>
</div>
......@@ -246,14 +236,14 @@ exports[`<ForwarderForm/>: new forwarder. Test with snapshot. 1`] = `
id="4"
>
<option
value="no"
value="hostname"
>
No TLS
Hostname
</option>
<option
value="hostname"
value="no"
>
Hostname
No TLS
</option>
<option
value="pin"
......@@ -263,12 +253,10 @@ exports[`<ForwarderForm/>: new forwarder. Test with snapshot. 1`] = `
</select>
</div>
<button
class="btn btn-primary col-sm-12 col-lg-3"
class="btn btn-primary col-sm-12 col-md-3 col-lg-2"
disabled=""
type="button"
>
Save forwarder
</button>
</div>
......
......@@ -24,6 +24,7 @@ import {
import validateDHCP from "common/network/DHCPValidators";
import GuestNetworkForm, { validateQoS } from "./GuestNetworkForm";
import GuestNetworkDHCPClientsList from "./GuestNetworkDHCPClientsList";
import GuestNetworkNotification from "./GuestNetworkNotification";
GuestNetwork.propTypes = {
ws: PropTypes.object.isRequired,
......@@ -33,6 +34,7 @@ export default function GuestNetwork({ ws }) {
return (
<>
<h1>{_("Guest Network")}</h1>
<div id="guest-notification" />
<p
dangerouslySetInnerHTML={{
__html: _(`
......@@ -55,6 +57,7 @@ in LAN.
>
<GuestNetworkForm />
<GuestNetworkDHCPClientsList />
<GuestNetworkNotification />
</ForisForm>
<div id="dhcp-clients-container" />
</>
......@@ -62,8 +65,6 @@ in LAN.
}
function prepData(formData) {
delete formData.interface_count;
delete formData.interface_up_count;
return formData;
}
......@@ -83,13 +84,11 @@ export function prepDataToSubmit(formData) {
export function validator(formData) {
const errors = {
ip:
validateRequiredField(formData.ip)
|| validateIPv4Address(formData.ip),
ip: validateRequiredField(formData.ip) || validateIPv4Address(formData.ip),
netmask:
validateRequiredField(formData.netmask)
|| validateIPv4Address(formData.netmask)
|| validateNetworkMask(formData.netmask),
validateRequiredField(formData.netmask)
|| validateIPv4Address(formData.netmask)
|| validateNetworkMask(formData.netmask),
};
if (formData.qos.enabled) {
......