changeset 483:27502291e564

docs: Added comments on non trivial parts of the code
author Thomas Junk <thomas.junk@intevation.de>
date Fri, 24 Aug 2018 10:50:58 +0200
parents 3e5ed9f40095
children 2ac37419f593
files client/src/components/Map.jsx client/src/components/Userdetail.vue client/src/lib/errors.js client/src/lib/session.js client/src/router.js
diffstat 5 files changed, 29 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/Map.jsx	Fri Aug 24 10:08:49 2018 +0200
+++ b/client/src/components/Map.jsx	Fri Aug 24 10:50:58 2018 +0200
@@ -1,3 +1,12 @@
+/**
+ * Map comonent and integration point with open layers
+ * Currently JSX was chosen to have more programmatic control
+ * over resulting HTML
+ *
+ * May change in the future
+ *
+ */
+
 /*eslint no-unused-vars: ["error", { "args": "none" }]*/
 import "ol/ol.css";
 import { Map, View } from "ol";
--- a/client/src/components/Userdetail.vue	Fri Aug 24 10:08:49 2018 +0200
+++ b/client/src/components/Userdetail.vue	Fri Aug 24 10:50:58 2018 +0200
@@ -90,7 +90,12 @@
 };
 
 const isEmailValid = email => {
-  /* cf. types.go */
+  /**
+   *
+   * For convenience purposes the same regex used as in the go code
+   * cf. types.go
+   *
+   */
   // eslint-disable-next-line
   return /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/.test(
     email
--- a/client/src/lib/errors.js	Fri Aug 24 10:08:49 2018 +0200
+++ b/client/src/lib/errors.js	Fri Aug 24 10:50:58 2018 +0200
@@ -1,3 +1,4 @@
+/** facade to wrap calls to vue2-toastr */
 import app from "../main";
 
 const displayError = ({ title, message }) => {
--- a/client/src/lib/session.js	Fri Aug 24 10:08:49 2018 +0200
+++ b/client/src/lib/session.js	Fri Aug 24 10:50:58 2018 +0200
@@ -1,10 +1,21 @@
+/**
+ * Compares whether session is current
+ * based on the expiry information and the
+ * current date
+ *
+ * @param  {number} expiresFromPastSession
+ */
 function sessionStillActive(expiresFromPastSession) {
   if (!expiresFromPastSession) return false;
   const now = Date.now();
   const stillActive = now < expiresFromPastSession;
   return stillActive;
 }
-
+/**
+ * Converts a given unix time to Milliseconds
+ *
+ * @param  {string} timestring
+ */
 function toMillisFromString(timestring) {
   return timestring * 1000;
 }
--- a/client/src/router.js	Fri Aug 24 10:08:49 2018 +0200
+++ b/client/src/router.js	Fri Aug 24 10:50:58 2018 +0200
@@ -3,6 +3,7 @@
 import store from "./store";
 import { sessionStillActive, toMillisFromString } from "./lib/session";
 
+/*  facilitate codesplitting */
 const Login = () => import("./views/Login.vue");
 const Main = () => import("./views/Main.vue");
 const Users = () => import("./views/Users.vue");