Small fixes from the todo list
This commit is contained in:
parent
107a439e44
commit
f0dc84e3ba
|
@ -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 { Alert, CircularProgress, Grid, useTheme } from "@mui/material";
|
||||||
import Container from "@mui/material/Container";
|
import Container from "@mui/material/Container";
|
||||||
import { axiosConfigWithoutToken } from "./config/axiosConfig";
|
import { axiosConfigWithoutToken } from "./config/axiosConfig";
|
||||||
|
@ -31,6 +31,12 @@ const Login = ({ setToken, setLanguage }: I_LoginProps) => {
|
||||||
params: { authToken: token },
|
params: { authToken: token },
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
const handleKeypress = (e: KeyboardEvent) => {
|
||||||
|
//it triggers by pressing the enter key
|
||||||
|
if (e.keyCode === 13) {
|
||||||
|
handleSubmit();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const handleSubmit = () => {
|
const handleSubmit = () => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
|
@ -68,7 +74,7 @@ const Login = ({ setToken, setLanguage }: I_LoginProps) => {
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Container>
|
</Container>
|
||||||
<Container maxWidth="sm" sx={{ p: 2, alignContent: "center" }}>
|
<Container maxWidth="sm" sx={{ p: 2, alignContent: "center" }} onKeyDown={handleKeypress}>
|
||||||
<InnovenergyTextfield
|
<InnovenergyTextfield
|
||||||
id="username-textfield"
|
id="username-textfield"
|
||||||
label="Username"
|
label="Username"
|
||||||
|
|
|
@ -121,7 +121,7 @@ const InstallationList = (props: InstallationListProps) => {
|
||||||
} else if (data.length === 0) {
|
} else if (data.length === 0) {
|
||||||
return (
|
return (
|
||||||
<Alert severity="info" sx={{ mt: 1 }}>
|
<Alert severity="info" sx={{ mt: 1 }}>
|
||||||
<FormattedMessage id="noData" defaultMessage="No data found" />
|
<FormattedMessage id="noData" defaultMessage="No installations matching your search found" />
|
||||||
</Alert>
|
</Alert>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@ const UserForm = (props: I_UserFormProps) => {
|
||||||
email: values ? values.email : "",
|
email: values ? values.email : "",
|
||||||
information: values ? values.information : "",
|
information: values ? values.information : "",
|
||||||
name: values ? values.name : "",
|
name: values ? values.name : "",
|
||||||
|
mustResetPassword: values ? true:false,
|
||||||
},
|
},
|
||||||
onSubmit: (formikValues) => {
|
onSubmit: (formikValues) => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
|
@ -95,6 +96,18 @@ const UserForm = (props: I_UserFormProps) => {
|
||||||
handleChange: formik.handleChange,
|
handleChange: formik.handleChange,
|
||||||
disabled: readOnly,
|
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 (
|
return (
|
||||||
|
|
|
@ -90,7 +90,7 @@ const UserList = (props: I_UserListProps) => {
|
||||||
} else if (filteredData?.length === 0) {
|
} else if (filteredData?.length === 0) {
|
||||||
return (
|
return (
|
||||||
<Alert severity="info" sx={{ mt: 1 }}>
|
<Alert severity="info" sx={{ mt: 1 }}>
|
||||||
<FormattedMessage id="noData" defaultMessage="No data found" />
|
<FormattedMessage id="noData" defaultMessage="No users matching your search found" />
|
||||||
</Alert>
|
</Alert>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue