From 77c18fcf662d0a8b1ea7bd442c9631775e1f07fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Banno-Cloutier?= <leo.banno-cloutier@savoirfairelinux.com> Date: Tue, 27 Jun 2023 16:37:41 -0400 Subject: [PATCH] jams-react-client: fix most compilation warnings Change-Id: I3ae7f1511acde7221cf0f502a586965b7081b2f5 --- jams-react-client/jsconfig.json | 5 ----- jams-react-client/src/auth.js | 4 ++-- jams-react-client/src/components/CaSetup/CaSetup.js | 2 +- jams-react-client/src/components/Devices/Devices.js | 8 ++++---- jams-react-client/src/components/Footer/Footer.js | 4 ++-- .../IdentityManagement/IdentityManagement.js | 4 ++-- .../components/ServerParameters/ServerParameters.js | 2 +- jams-react-client/src/components/Sidebar/Sidebar.js | 2 +- jams-react-client/src/layouts/BaseLayout.js | 2 +- jams-react-client/src/layouts/ListLayout.js | 2 +- jams-react-client/src/layouts/SignIn.js | 2 +- jams-react-client/src/routes/SettingsRoute.js | 2 +- .../src/views/Blueprint/EditBlueprintConfiguration.js | 2 +- .../src/views/Blueprint/updatePolicyData.js | 2 +- jams-react-client/src/views/Blueprints/Blueprints.js | 11 +++++------ jams-react-client/src/views/Contacts/Contacts.js | 8 ++++---- jams-react-client/src/views/Groups/EditGroup.js | 10 +++++----- jams-react-client/src/views/Groups/Groups.js | 8 ++++---- jams-react-client/src/views/Settings/Settings.js | 2 +- .../src/views/UserProfile/DisplayUserProfile.js | 4 ++-- .../src/views/UserProfile/EditCreateUserProfile.js | 6 +++--- jams-react-client/src/views/Users/Users.js | 2 +- 22 files changed, 44 insertions(+), 50 deletions(-) diff --git a/jams-react-client/jsconfig.json b/jams-react-client/jsconfig.json index a4b71542..5230ed4e 100644 --- a/jams-react-client/jsconfig.json +++ b/jams-react-client/jsconfig.json @@ -2,11 +2,6 @@ "compilerOptions": { "jsx": "react", "baseUrl": "src", - "paths": { - "*": [ - "./src/*" - ] - }, "checkJs": true }, "include": [ diff --git a/jams-react-client/src/auth.js b/jams-react-client/src/auth.js index 16c40f0c..e19d77d0 100644 --- a/jams-react-client/src/auth.js +++ b/jams-react-client/src/auth.js @@ -188,7 +188,7 @@ class Auth { this.authenticated = true; cb(); }) - .catch((error) => { + .catch(() => { cb(); }); } @@ -216,7 +216,7 @@ class Auth { this.authenticated = true; cb(); }) - .catch((error) => { + .catch(() => { cb(); }); } diff --git a/jams-react-client/src/components/CaSetup/CaSetup.js b/jams-react-client/src/components/CaSetup/CaSetup.js index 0029e005..e0886062 100644 --- a/jams-react-client/src/components/CaSetup/CaSetup.js +++ b/jams-react-client/src/components/CaSetup/CaSetup.js @@ -388,7 +388,7 @@ export default function CaSetup(props) { Key File (PEM-encoded) </Typography> <Field name="privkeyfile"> - {({ field, form, meta }) => ( + {({ field, meta }) => ( <div> <Input fullWidth type="file" {...field} /> {meta.touched && meta.error && ( diff --git a/jams-react-client/src/components/Devices/Devices.js b/jams-react-client/src/components/Devices/Devices.js index cbeef3ce..d4852b4f 100755 --- a/jams-react-client/src/components/Devices/Devices.js +++ b/jams-react-client/src/components/Devices/Devices.js @@ -152,7 +152,7 @@ export default function Devices(props) { null ) ) - .then((response) => { + .then(() => { setSelectedDevice({}); setOpenEdit(false); }) @@ -175,7 +175,7 @@ export default function Devices(props) { null ) ) - .then((response) => { + .then(() => { setSelectedDevice({}); setOpenEdit(false); }) @@ -203,7 +203,7 @@ export default function Devices(props) { null ) ) - .then((response) => { + .then(() => { setSelectedDevice({}); setOpenRevoke(false); }) @@ -219,7 +219,7 @@ export default function Devices(props) { null ) ) - .then((response) => { + .then(() => { setSelectedDevice({}); setOpenRevoke(false); }) diff --git a/jams-react-client/src/components/Footer/Footer.js b/jams-react-client/src/components/Footer/Footer.js index bade958c..eea542ed 100755 --- a/jams-react-client/src/components/Footer/Footer.js +++ b/jams-react-client/src/components/Footer/Footer.js @@ -8,14 +8,14 @@ const pjson = require("../../../package.json"); const useStyles = makeStyles(styles); -export default function Footer(props) { +export default function Footer() { const classes = useStyles(); return ( <footer className={classes.footer}> <div className={classes.container}> <p className={classes.right}> <span> - JAMS Version {pjson.version.slice(0, 3)} - ©{" "} + JAMS Version {pjson.version.slice(0, 3)} - © {1900 + new Date().getYear()}{" "} <a href="https://savoirfairelinux.com" diff --git a/jams-react-client/src/components/IdentityManagement/IdentityManagement.js b/jams-react-client/src/components/IdentityManagement/IdentityManagement.js index 31e560ba..d491f7f1 100644 --- a/jams-react-client/src/components/IdentityManagement/IdentityManagement.js +++ b/jams-react-client/src/components/IdentityManagement/IdentityManagement.js @@ -234,7 +234,7 @@ export default function IdentityManagement(props) { data = setAdStorageData(values); } axios(configApiCall(api_path_post_install_auth, "POST", data, null)) - .then((response) => { + .then(() => { callbackIdentityManagement(); }) .catch(() => { @@ -253,7 +253,7 @@ export default function IdentityManagement(props) { let data = {}; data = setLocalStorageData(); axios(configApiCall(api_path_post_install_auth, "POST", data, null)) - .then((response) => { + .then(() => { callbackIdentityManagement(); }) .catch(() => { diff --git a/jams-react-client/src/components/ServerParameters/ServerParameters.js b/jams-react-client/src/components/ServerParameters/ServerParameters.js index 7cb0c143..1ce5e8fe 100644 --- a/jams-react-client/src/components/ServerParameters/ServerParameters.js +++ b/jams-react-client/src/components/ServerParameters/ServerParameters.js @@ -128,7 +128,7 @@ export default function ServerParameters(props) { signingAlgorithm: "SHA512WITHRSA", }; axios(configApiCall(api_path_post_install_server, "POST", jsonData, null)) - .then((response) => { + .then(() => { callBackServerParameters(); }) .catch((error) => { diff --git a/jams-react-client/src/components/Sidebar/Sidebar.js b/jams-react-client/src/components/Sidebar/Sidebar.js index 7193525a..92e84bd7 100755 --- a/jams-react-client/src/components/Sidebar/Sidebar.js +++ b/jams-react-client/src/components/Sidebar/Sidebar.js @@ -119,7 +119,7 @@ export default function Sidebar(props) { <ListItem button className={classes.itemLink} - onClick={(e) => { + onClick={() => { props.handleQuery(); props.setOpenUpdate(true); }} diff --git a/jams-react-client/src/layouts/BaseLayout.js b/jams-react-client/src/layouts/BaseLayout.js index 4919d244..5f99b236 100644 --- a/jams-react-client/src/layouts/BaseLayout.js +++ b/jams-react-client/src/layouts/BaseLayout.js @@ -222,7 +222,7 @@ export default function Admin(props) { </DialogContent> <DialogActions> <Button - onClick={(e) => { + onClick={() => { if (auth.isActivated()) handleUpdate(); else window.location.href = "https://jami.biz/"; }} diff --git a/jams-react-client/src/layouts/ListLayout.js b/jams-react-client/src/layouts/ListLayout.js index 9d35c245..94da3297 100644 --- a/jams-react-client/src/layouts/ListLayout.js +++ b/jams-react-client/src/layouts/ListLayout.js @@ -224,7 +224,7 @@ export default function Admin(props) { </DialogContent> <DialogActions> <Button - onClick={(e) => { + onClick={() => { if (auth.isActivated()) handleUpdate(); else window.location.href = "https://jami.biz/"; }} diff --git a/jams-react-client/src/layouts/SignIn.js b/jams-react-client/src/layouts/SignIn.js index ef569398..c6393c00 100644 --- a/jams-react-client/src/layouts/SignIn.js +++ b/jams-react-client/src/layouts/SignIn.js @@ -55,7 +55,7 @@ const useStyles = makeStyles((theme) => ({ }, })); -export default function SignIn(props) { +export default function SignIn() { /** * Formik Validation Fields */ diff --git a/jams-react-client/src/routes/SettingsRoute.js b/jams-react-client/src/routes/SettingsRoute.js index 134e2d8d..be364822 100644 --- a/jams-react-client/src/routes/SettingsRoute.js +++ b/jams-react-client/src/routes/SettingsRoute.js @@ -4,6 +4,6 @@ import Settings from "views/Settings/Settings.js"; import BaseLayout from "layouts/BaseLayout.js"; -export default function SettingsRoute(props) { +export default function SettingsRoute() { return <BaseLayout component={<Settings />} />; } diff --git a/jams-react-client/src/views/Blueprint/EditBlueprintConfiguration.js b/jams-react-client/src/views/Blueprint/EditBlueprintConfiguration.js index 588e8317..2f4dfa99 100644 --- a/jams-react-client/src/views/Blueprint/EditBlueprintConfiguration.js +++ b/jams-react-client/src/views/Blueprint/EditBlueprintConfiguration.js @@ -43,7 +43,7 @@ import CustomPopupState from "components/CustomPopupState/CustomPopupState"; import { PolicyDataContext } from "./PolicyDataContext"; -const styles = (theme) => ({ +const styles = () => ({ ...dashboardStyle, root: { flexGrow: 1, diff --git a/jams-react-client/src/views/Blueprint/updatePolicyData.js b/jams-react-client/src/views/Blueprint/updatePolicyData.js index d5eafb0f..f301649f 100644 --- a/jams-react-client/src/views/Blueprint/updatePolicyData.js +++ b/jams-react-client/src/views/Blueprint/updatePolicyData.js @@ -119,7 +119,7 @@ const sendPutRequest = (blueprintName, data, setSnackbar) => { null ) ) - .then((response) => { + .then(() => { const message = i18next.t( "updated_blueprint_permissions_successfully", "Blueprint permissions successfully updated." diff --git a/jams-react-client/src/views/Blueprints/Blueprints.js b/jams-react-client/src/views/Blueprints/Blueprints.js index 02a57a88..2a250674 100644 --- a/jams-react-client/src/views/Blueprints/Blueprints.js +++ b/jams-react-client/src/views/Blueprints/Blueprints.js @@ -102,7 +102,6 @@ export default function Blueprints() { const [openRemoveDialog, setOpenRemoveDialog] = useState(false); useEffect(() => { - console.log("useEffect"); setLoading(true); const timer = setInterval(() => { setProgress((oldProgress) => { @@ -143,11 +142,11 @@ export default function Blueprints() { null ) ) - .then((response) => { + .then(() => { setDisableCreate(true); setBlueprintNameExits(true); }) - .catch((error) => { + .catch(() => { setDisableCreate(false); setBlueprintNameExits(false); }); @@ -191,7 +190,7 @@ export default function Blueprints() { null ) ) - .then((response) => { + .then(() => { setOpen(false); setDisableCreate(true); console.log("Successfully created " + blueprintName); @@ -217,7 +216,7 @@ export default function Blueprints() { null ) ) - .then((response) => { + .then(() => { console.log("Successfully create " + removedBlueprint); setOpenRemoveDialog(false); }) @@ -324,7 +323,7 @@ export default function Blueprints() { variant="contained" color="primary" href="#contained-buttons" - onClick={(e) => setOpen(true)} + onClick={() => setOpen(true)} > <AddCircleOutlineIcon />{" "} {i18next.t("create_blueprint", "Create blueprint")} diff --git a/jams-react-client/src/views/Contacts/Contacts.js b/jams-react-client/src/views/Contacts/Contacts.js index 85a6067e..2789cbb9 100644 --- a/jams-react-client/src/views/Contacts/Contacts.js +++ b/jams-react-client/src/views/Contacts/Contacts.js @@ -211,7 +211,7 @@ export default function Users(props) { null ) ) - .then((response) => { + .then(() => { getAllContacts(); setOpenDrawer(false); }) @@ -221,7 +221,7 @@ export default function Users(props) { }); } else { axios(configApiCall(api_path_get_auth_contacts, "PUT", data, null)) - .then((response) => { + .then(() => { getAllContacts(); setOpenDrawer(false); }) @@ -264,7 +264,7 @@ export default function Users(props) { null ) ) - .then((response) => { + .then(() => { setOpen(false); getAllContacts(); }) @@ -282,7 +282,7 @@ export default function Users(props) { null ) ) - .then((response) => { + .then(() => { setOpen(false); getAllContacts(); }) diff --git a/jams-react-client/src/views/Groups/EditGroup.js b/jams-react-client/src/views/Groups/EditGroup.js index f2323c32..3cc8e922 100644 --- a/jams-react-client/src/views/Groups/EditGroup.js +++ b/jams-react-client/src/views/Groups/EditGroup.js @@ -65,7 +65,7 @@ import { debounce } from "lodash"; import { getBlueprintsOptions } from "./getBlueprintsOptions"; -const useStyles = makeStyles((theme) => ({ +const useStyles = makeStyles(() => ({ ...devicesStyle, ...dashboardStyle, root: { @@ -223,7 +223,7 @@ export default function EditGroup(props) { null ) ) - .then((response) => { + .then(() => { setName(newName); }) .catch((error) => { @@ -273,7 +273,7 @@ export default function EditGroup(props) { null ) ) - .then((response) => { + .then(() => { let newGroupMembers = groupMembers; newGroupMembers.push(user); setGroupMembers(newGroupMembers); @@ -301,7 +301,7 @@ export default function EditGroup(props) { null ) ) - .then((response) => { + .then(() => { let newGroupMembers = groupMembers; newGroupMembers.splice(newGroupMembers.indexOf(user), 1); setGroupMembers(newGroupMembers); @@ -347,7 +347,7 @@ export default function EditGroup(props) { } }); }) - .catch((error) => { + .catch(() => { setGroupNameExits(false); }); }; diff --git a/jams-react-client/src/views/Groups/Groups.js b/jams-react-client/src/views/Groups/Groups.js index d4846e6b..d3060e53 100644 --- a/jams-react-client/src/views/Groups/Groups.js +++ b/jams-react-client/src/views/Groups/Groups.js @@ -133,7 +133,7 @@ export default function Groups() { null ) ) - .then((response) => { + .then(() => { console.log("Successfully deleted " + removedGroup.name); setOpenRemoveDialog(false); }) @@ -149,7 +149,7 @@ export default function Groups() { axios(configApiCall(api_path_blueprints + "?name=*", "GET", null, null)) .then((response) => { setBlueprints(response.data); - setSelectedBlueprint(getBlueprintsOptions(blueprints)[0]); + setSelectedBlueprint(getBlueprintsOptions(response.data)[0]); }) .catch((error) => { if (error.response.status === 401) { @@ -240,7 +240,7 @@ export default function Groups() { } }); }) - .catch((error) => { + .catch(() => { setDisableCreate(false); setGroupNameExits(false); }); @@ -427,7 +427,7 @@ export default function Groups() { variant="contained" color="primary" href="#contained-buttons" - onClick={(e) => setOpenCreate(true)} + onClick={() => setOpenCreate(true)} > <AddCircleOutlineIcon />{" "} {i18next.t("create_group", "Create group")} diff --git a/jams-react-client/src/views/Settings/Settings.js b/jams-react-client/src/views/Settings/Settings.js index 09f4dae7..5398e118 100644 --- a/jams-react-client/src/views/Settings/Settings.js +++ b/jams-react-client/src/views/Settings/Settings.js @@ -54,7 +54,7 @@ function Alert(props) { return <MuiAlert elevation={6} variant="filled" {...props} />; } -export default function Settings(props) { +export default function Settings() { const [value, setValue] = useState(0); const [error, setError] = useState(false); const [severity, setSeverity] = useState("error"); diff --git a/jams-react-client/src/views/UserProfile/DisplayUserProfile.js b/jams-react-client/src/views/UserProfile/DisplayUserProfile.js index 188e3c4f..5153a0c2 100644 --- a/jams-react-client/src/views/UserProfile/DisplayUserProfile.js +++ b/jams-react-client/src/views/UserProfile/DisplayUserProfile.js @@ -261,7 +261,7 @@ export default function DisplayUserProfile(props) { null ) ) - .then((response) => { + .then(() => { let newGroupMemberships = groupMemberships; newGroupMemberships.splice(newGroupMemberships.indexOf(group), 1); setGroupMemberships(newGroupMemberships); @@ -279,7 +279,7 @@ export default function DisplayUserProfile(props) { axios( configApiCall(api_path_post_group_member + group.id, "POST", data, null) ) - .then((response) => { + .then(() => { let newGroupMemberships = groupMemberships; newGroupMemberships.push({ groupId: group.id, diff --git a/jams-react-client/src/views/UserProfile/EditCreateUserProfile.js b/jams-react-client/src/views/UserProfile/EditCreateUserProfile.js index 45c82e1d..c8b2288f 100644 --- a/jams-react-client/src/views/UserProfile/EditCreateUserProfile.js +++ b/jams-react-client/src/views/UserProfile/EditCreateUserProfile.js @@ -376,10 +376,10 @@ export default function EditCreateUserProfile(props) { }; axios(configApiCall(api_path_post_create_user, "POST", body, null)) - .then((response) => { + .then(() => { handleUserProfileCreation(data); }) - .catch((error) => { + .catch(() => { console.log( "Failed to create new user. This is either because the username is already in use on the public nameserver, or another unknown error has occurred. Please choose another one." ); @@ -392,7 +392,7 @@ export default function EditCreateUserProfile(props) { const handleUpdateUser = (data) => { axios(configApiCall(api_path_put_update_user_profile, "PUT", data, null)) - .then((response) => { + .then(() => { handleUserUpdate(); }) .catch((error) => { diff --git a/jams-react-client/src/views/Users/Users.js b/jams-react-client/src/views/Users/Users.js index 1b7740a3..ac0226af 100644 --- a/jams-react-client/src/views/Users/Users.js +++ b/jams-react-client/src/views/Users/Users.js @@ -69,7 +69,7 @@ const styles = { }, }; const useStyles = makeStyles(styles); -export default function Users(props) { +export default function Users() { const classes = useStyles(); const history = useHistory(); const [users, setUsers] = useState([]); -- GitLab