Small fixes from the todo list

This commit is contained in:
Kim 2023-08-23 14:06:40 +02:00
parent 107a439e44
commit f0dc84e3ba
4 changed files with 23 additions and 4 deletions

View File

@ -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) => {
</Grid>
</Grid>
</Container>
<Container maxWidth="sm" sx={{ p: 2, alignContent: "center" }}>
<Container maxWidth="sm" sx={{ p: 2, alignContent: "center" }} onKeyDown={handleKeypress}>
<InnovenergyTextfield
id="username-textfield"
label="Username"

View File

@ -121,7 +121,7 @@ const InstallationList = (props: InstallationListProps) => {
} else if (data.length === 0) {
return (
<Alert severity="info" sx={{ mt: 1 }}>
<FormattedMessage id="noData" defaultMessage="No data found" />
<FormattedMessage id="noData" defaultMessage="No installations matching your search found" />
</Alert>
);
}

View File

@ -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 (

View File

@ -90,7 +90,7 @@ const UserList = (props: I_UserListProps) => {
} else if (filteredData?.length === 0) {
return (
<Alert severity="info" sx={{ mt: 1 }}>
<FormattedMessage id="noData" defaultMessage="No data found" />
<FormattedMessage id="noData" defaultMessage="No users matching your search found" />
</Alert>
);
}