From d93eb2c9879a2d80e3b8d0f88dce2a7693377f05 Mon Sep 17 00:00:00 2001 From: Kim Date: Tue, 29 Aug 2023 10:47:35 +0200 Subject: [PATCH] Added checkmarks for must reset password --- csharp/App/Backend/DbBackups/db.sqlite | Bin 122880 -> 0 bytes .../Backend/Properties/launchSettings.json | 2 +- .../src/components/Layout/Checkmark.tsx | 30 ++++++++++++++++++ .../Layout/InnovenergyPropertyGrid.tsx | 26 ++++++++++++--- .../Layout/InnovenergyTextfield.tsx | 12 +++---- .../src/components/Layout/UserProps.tsx | 13 ++++++++ .../src/components/Users/UserForm.tsx | 27 ++++++++-------- .../Frontend/src/config/axiosConfig.tsx | 4 +-- 8 files changed, 85 insertions(+), 29 deletions(-) delete mode 100644 csharp/App/Backend/DbBackups/db.sqlite create mode 100644 typescript/Frontend/src/components/Layout/Checkmark.tsx create mode 100644 typescript/Frontend/src/components/Layout/UserProps.tsx diff --git a/csharp/App/Backend/DbBackups/db.sqlite b/csharp/App/Backend/DbBackups/db.sqlite deleted file mode 100644 index 55d2bbbeb72b0663fdd6c765f6ff16c0bae667df..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 122880 zcmeI*Pi!06eFtz3DRD?i)L6FVSy|gPm#!fbws!eP6eXZWB3YD7o028bv@9(GVMsnv zw8$B0IFuy?+ko=ANQ$CJfTBf;oOLk~f>hag)7L7O5QAbm4K zQt$DPt*yPgwe~Am66eit-pu>_-W$$no~-mrs%Q}ZmZp~#!yk2=a|nXtn|{B;;YiWX zx9Df%!+hP-SfJkp=5@E1DaSjTmwU}%=`%CtkEG9he;D{=;Go~x_kHgL&j;d1V&45T z_jd1xz2EBjWzU4`$FB3vJ?ACir$ScP=vM7(QtmO2^Sw9R^7yFmeo@VngEXmBikiBa zQYuE85VgKMa(gu~^C00*F3lw#`2(#{0l%g;O9R&fjjaR0jO>ML+cKkVC&xHMF9d(@B}oKvkok)l$hHtX;k+%J;)UZN_SSQmq(DsiYV* zZ8NzX&EFswTb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f}g{SoHf!I%i_^dH2k-aL z3;khX&&mSFZ!Yxm?%aAC+|prBo_Aet`O2_B?}X^xj{W?MFT?po7ni%1mDg2z2si1L!DC4f<>6uB1Hr1(+`0Mb zrqIzS!gX&fx3mg#XpJZ7S>Xm{Y<4>FnvPCKH#*b7X>eia)uuC z;`0xhsgilg&CYxClt;{L|H8v%V}rGOBO+!AGII%SzQ&w6%o4O`a+=Tg*m*kElT>^1 zWdO4TPiE7;9i#cQ2&*|1H!scg~EbN1JOF(+`c+t9t$R|RWtO4iK1+PAF-;A|B8 z`doc4^(oZsD(k^`V^7S~TRWy@q_K;qm>?Hi8>CPCM}$L0qB+CE-htGq{mmFwnwtPp z^ZP`3WJEZ&=XBY1*N%J}V?dOr$AsFj)%g0n6#EdH?c+*) sJO#I|xrHslt>a+u{Qt$5a)^Kc1Rwwb2tWV=5P$##AOHafyzT=33tRN-cmMzZ diff --git a/csharp/App/Backend/Properties/launchSettings.json b/csharp/App/Backend/Properties/launchSettings.json index d04542990..c1c45c271 100644 --- a/csharp/App/Backend/Properties/launchSettings.json +++ b/csharp/App/Backend/Properties/launchSettings.json @@ -7,7 +7,7 @@ "dotnetRunMessages": true, "launchUrl": "swagger", - "applicationUrl": "https://localhost:8000", + "applicationUrl": "https://localhost:7087", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } diff --git a/typescript/Frontend/src/components/Layout/Checkmark.tsx b/typescript/Frontend/src/components/Layout/Checkmark.tsx new file mode 100644 index 000000000..4574d2323 --- /dev/null +++ b/typescript/Frontend/src/components/Layout/Checkmark.tsx @@ -0,0 +1,30 @@ +import UserProps from "./UserProps"; +import { Grid, InputLabel, TextField, Checkbox } from "@mui/material"; +import { I_InnovenergyTextfieldProps } from "./InnovenergyTextfield"; + +export type CheckmarkProps = UserProps & { + value:boolean; +} + + +const Checkmark = (props: CheckmarkProps) => { + return ( + + + {props.label} + + + + + + ); +}; + +export default CheckmarkProps; \ No newline at end of file diff --git a/typescript/Frontend/src/components/Layout/InnovenergyPropertyGrid.tsx b/typescript/Frontend/src/components/Layout/InnovenergyPropertyGrid.tsx index 8e12272ff..21992caac 100644 --- a/typescript/Frontend/src/components/Layout/InnovenergyPropertyGrid.tsx +++ b/typescript/Frontend/src/components/Layout/InnovenergyPropertyGrid.tsx @@ -1,11 +1,14 @@ -import { InputLabel, TextField } from "@mui/material"; +import {Checkbox, InputLabel, TextField} from "@mui/material"; import { colors } from "../../index"; import { I_InnovenergyTextfieldProps } from "./InnovenergyTextfield"; +import { CheckmarkProps } from "./Checkmark"; interface I_InnovenergyPropertyGridProps { - rows: I_InnovenergyTextfieldProps[]; + rows: Array; +} +function isTextfieldProps(type: I_InnovenergyTextfieldProps | CheckmarkProps): type is I_InnovenergyTextfieldProps{ + return typeof((type as I_InnovenergyTextfieldProps).value) === "string"; } - export const InnovenergyPropertyGrid = ( props: I_InnovenergyPropertyGridProps ) => { @@ -25,7 +28,8 @@ export const InnovenergyPropertyGrid = (
{props.rows.map((element) => { - return ( + if(isTextfieldProps(element)){ + return ( - ); + );} + else{ + return( + + ) + } })}
diff --git a/typescript/Frontend/src/components/Layout/InnovenergyTextfield.tsx b/typescript/Frontend/src/components/Layout/InnovenergyTextfield.tsx index 14abdfb7d..573ed73c0 100644 --- a/typescript/Frontend/src/components/Layout/InnovenergyTextfield.tsx +++ b/typescript/Frontend/src/components/Layout/InnovenergyTextfield.tsx @@ -1,16 +1,12 @@ import { Grid, InputLabel, TextField } from "@mui/material"; +import UserProps from "./UserProps"; -export interface I_InnovenergyTextfieldProps { - id: string; - label: string; + + +export type I_InnovenergyTextfieldProps = UserProps & { value: string; - name: string; - handleChange: (e: React.ChangeEvent) => void; type?: string; - readOnly?: boolean; - disabled?: boolean; helperText?: string; - error?: boolean; } const InnovenergyTextfield = (props: I_InnovenergyTextfieldProps) => { diff --git a/typescript/Frontend/src/components/Layout/UserProps.tsx b/typescript/Frontend/src/components/Layout/UserProps.tsx new file mode 100644 index 000000000..98a01aafb --- /dev/null +++ b/typescript/Frontend/src/components/Layout/UserProps.tsx @@ -0,0 +1,13 @@ + + +export type UserProps = { + id: string; + label: string; + name: string; + handleChange: (e: React.ChangeEvent) => void; + readOnly?: boolean; + disabled?: boolean; + error?: boolean; +} + +export default UserProps; \ No newline at end of file diff --git a/typescript/Frontend/src/components/Users/UserForm.tsx b/typescript/Frontend/src/components/Users/UserForm.tsx index 08c118baf..bb1b00833 100644 --- a/typescript/Frontend/src/components/Users/UserForm.tsx +++ b/typescript/Frontend/src/components/Users/UserForm.tsx @@ -15,6 +15,7 @@ import { I_InnovenergyTextfieldProps } from "../Layout/InnovenergyTextfield"; import { UserContext } from "../Context/UserContextProvider"; import { UsersContext } from "../Context/UsersContextProvider"; import InnovenergyPropertyGrid from "../Layout/InnovenergyPropertyGrid"; +import CheckmarkProps from "../Layout/Checkmark"; interface I_UserFormProps { handleSubmit: (formikValues: Partial) => Promise; @@ -62,7 +63,7 @@ const UserForm = (props: I_UserFormProps) => { setOpen(false); }; - const rows: I_InnovenergyTextfieldProps[] = [ + const rows: (I_InnovenergyTextfieldProps | CheckmarkProps)[] = [ { id: "name-textfield", label: intl.formatMessage({ @@ -96,20 +97,20 @@ 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, -// }, + { + id: "mustResetPassword-checkbox", + label: intl.formatMessage({ + id: "mustResetPassword", + defaultMessage: "Must reset password", + }), + name: "mustResetPassword", + value:formik.values.mustResetPassword, + handleChange: formik.handleChange, + disabled: readOnly, + }, ]; + return (
diff --git a/typescript/Frontend/src/config/axiosConfig.tsx b/typescript/Frontend/src/config/axiosConfig.tsx index 9b47c3c8a..7a223fd19 100644 --- a/typescript/Frontend/src/config/axiosConfig.tsx +++ b/typescript/Frontend/src/config/axiosConfig.tsx @@ -1,11 +1,11 @@ import axios from "axios"; export const axiosConfigWithoutToken = axios.create({ - baseURL: "https://localhost:7087", + baseURL: "https://localhost:7087/api", }); const axiosConfig = axios.create({ - baseURL: "https://localhost:7087", + baseURL: "https://localhost:7087/api", }); axiosConfig.defaults.params = {};