From f0dc84e3ba0a8416c988d14a4159c99ef9eb16e5 Mon Sep 17 00:00:00 2001 From: Kim Date: Wed, 23 Aug 2023 14:06:40 +0200 Subject: [PATCH] Small fixes from the todo list --- typescript/Frontend/src/Login.tsx | 10 ++++++++-- .../components/Installations/InstallationList.tsx | 2 +- .../Frontend/src/components/Users/UserForm.tsx | 13 +++++++++++++ .../Frontend/src/components/Users/UserList.tsx | 2 +- 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/typescript/Frontend/src/Login.tsx b/typescript/Frontend/src/Login.tsx index 8718f5ef1..61f2189cd 100644 --- a/typescript/Frontend/src/Login.tsx +++ b/typescript/Frontend/src/Login.tsx @@ -1,4 +1,4 @@ -import React, { useContext, useState } from "react"; +import React, { useContext, useState, KeyboardEvent } from "react"; import { Alert, CircularProgress, Grid, useTheme } from "@mui/material"; import Container from "@mui/material/Container"; import { axiosConfigWithoutToken } from "./config/axiosConfig"; @@ -31,6 +31,12 @@ const Login = ({ setToken, setLanguage }: I_LoginProps) => { params: { authToken: token }, }); }; + const handleKeypress = (e: KeyboardEvent) => { + //it triggers by pressing the enter key + if (e.keyCode === 13) { + handleSubmit(); + } + }; const handleSubmit = () => { setLoading(true); @@ -68,7 +74,7 @@ const Login = ({ setToken, setLanguage }: I_LoginProps) => { - + { } else if (data.length === 0) { return ( - + ); } diff --git a/typescript/Frontend/src/components/Users/UserForm.tsx b/typescript/Frontend/src/components/Users/UserForm.tsx index 4904e0054..08c118baf 100644 --- a/typescript/Frontend/src/components/Users/UserForm.tsx +++ b/typescript/Frontend/src/components/Users/UserForm.tsx @@ -40,6 +40,7 @@ const UserForm = (props: I_UserFormProps) => { email: values ? values.email : "", information: values ? values.information : "", name: values ? values.name : "", + mustResetPassword: values ? true:false, }, onSubmit: (formikValues) => { setLoading(true); @@ -95,6 +96,18 @@ const UserForm = (props: I_UserFormProps) => { handleChange: formik.handleChange, disabled: readOnly, }, +// This does not work as each field must be a textfield, great.... +// { +// id: "mustResetPassword-checkbox", +// label: intl.formatMessage({ +// id: "mustResetPassword", +// defaultMessage: "Must reset password", +// }), +// name: "mustResetPassword", +// checked:formik.values.mustResetPassword, +// handleChange: formik.handleChange, +// disabled: readOnly, +// }, ]; return ( diff --git a/typescript/Frontend/src/components/Users/UserList.tsx b/typescript/Frontend/src/components/Users/UserList.tsx index 90010a945..544ddaf18 100644 --- a/typescript/Frontend/src/components/Users/UserList.tsx +++ b/typescript/Frontend/src/components/Users/UserList.tsx @@ -90,7 +90,7 @@ const UserList = (props: I_UserListProps) => { } else if (filteredData?.length === 0) { return ( - + ); }