diff --git a/src/front/component/App.jsx b/src/front/component/App.jsx index 907e005..cf6c8a1 100644 --- a/src/front/component/App.jsx +++ b/src/front/component/App.jsx @@ -1,31 +1,29 @@ -import React from 'react'; -import { useLocation, useNavigate } from "react-router-dom"; -import Parse from 'parse'; - +import ArrowBack from '@mui/icons-material/ArrowBack'; +import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown'; import AppBar from '@mui/material/AppBar'; -import Toolbar from '@mui/material/Toolbar'; -import Typography from '@mui/material/Typography'; import Button from '@mui/material/Button'; - import ButtonGroup from '@mui/material/ButtonGroup'; -import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown'; import ClickAwayListener from '@mui/material/ClickAwayListener'; import Grow from '@mui/material/Grow'; -import Paper from '@mui/material/Paper'; -import Popper from '@mui/material/Popper'; +import IconButton from '@mui/material/IconButton'; import MenuItem from '@mui/material/MenuItem'; import MenuList from '@mui/material/MenuList'; +import Paper from '@mui/material/Paper'; +import Popper from '@mui/material/Popper'; +import Toolbar from '@mui/material/Toolbar'; +import Typography from '@mui/material/Typography'; +import Parse from 'parse'; +import React from 'react'; +import { useLocation, useNavigate } from "react-router-dom"; -import IconButton from '@mui/material/IconButton'; -import ArrowBack from '@mui/icons-material/ArrowBack'; +import UserService from '../services/user-service'; +import PubSub from '../utils/pub-sub'; import Router from './Router'; -import PubSub from '../utils/pub-sub'; -import UserService from '../services/user-service'; const options = ['Home', 'Documentation', 'My Profile']; -const App = function () { +const App = function App () { const [canBack, setCanBack] = React.useState(false); const [userConnected, setUserConnected] = React.useState(false); const [anchorEl, setAnchorEl] = React.useState(null); diff --git a/src/front/component/LoginActions.jsx b/src/front/component/LoginActions.jsx index e750618..b6a824f 100644 --- a/src/front/component/LoginActions.jsx +++ b/src/front/component/LoginActions.jsx @@ -1,7 +1,9 @@ -import React, { useState } from 'react'; +/* eslint-disable no-console */ import { CardActions, Button, TextField, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle } from '@mui/material'; -import PropTypes from 'prop-types'; import { withStyles } from '@mui/styles'; +import PropTypes from 'prop-types'; +import React, { useState } from 'react'; + import UserService from '../services/user-service'; const styles = { @@ -10,7 +12,7 @@ const styles = { }, }; -const LoginActions = function ({ classes, redirectPath, onUserLoggedIn }) { +const LoginActions = function LoginActions ({ classes, redirectPath, onUserLoggedIn }) { const [isDialogSignupOpened, setIsDialogSignupOpened] = useState(false); const [isDialogLoginOpened, setIsDialogLoginOpened] = useState(false); @@ -18,13 +20,13 @@ const LoginActions = function ({ classes, redirectPath, onUserLoggedIn }) { const [password, setPassword] = useState(''); const [textMessage, setTextMessage] = useState(null); - const handleDialogClose = function () { + const handleDialogClose = function handleDialogClose () { setIsDialogSignupOpened(false); setIsDialogLoginOpened(false); setTextMessage(null); }; - const onSubmitForm = async function () { + const onSubmitForm = async function onSubmitForm () { let user; try { if (isDialogLoginOpened) { @@ -45,7 +47,7 @@ const LoginActions = function ({ classes, redirectPath, onUserLoggedIn }) { } }; - const passwordReset = async function () { + const passwordReset = async function passwordReset () { try { if (!document.forms[0].email.reportValidity()) { return; @@ -66,10 +68,10 @@ const LoginActions = function ({ classes, redirectPath, onUserLoggedIn }) { }; - let githubRedirectUri = process.env.PUBLIC_URL + '/login/github'; + let githubRedirectUri = `${process.env.PUBLIC_URL }/login/github`; if (redirectPath) { githubRedirectUri = - githubRedirectUri + '?redirectPath=' + encodeURIComponent(redirectPath); + `${githubRedirectUri }?redirectPath=${ encodeURIComponent(redirectPath)}`; } githubRedirectUri = encodeURIComponent(githubRedirectUri); diff --git a/src/front/component/Router.jsx b/src/front/component/Router.jsx index 65b4383..7061190 100644 --- a/src/front/component/Router.jsx +++ b/src/front/component/Router.jsx @@ -1,15 +1,15 @@ import React from 'react'; import { Route, Routes } from 'react-router-dom'; -import LoginPage from '../pages/login/login'; +import DetailsPage from '../pages/details/details'; import HomePage from '../pages/home/home'; +import Github from '../pages/login/github'; +import LoginPage from '../pages/login/login'; +import NoFound404Page from '../pages/notfound/notfound'; import OAuthAuthorizePage from '../pages/oauth/authorize'; -import DetailsPage from '../pages/details/details'; import ProfilePage from '../pages/profile/profile'; -import NoFound404Page from '../pages/notfound/notfound'; -import Github from '../pages/login/github'; -const Router = function () { +const Router = function Router () { return ( } /> diff --git a/src/front/index.jsx b/src/front/index.jsx index 43add09..fdfb435 100644 --- a/src/front/index.jsx +++ b/src/front/index.jsx @@ -1,7 +1,7 @@ +import Parse from 'parse'; import React from 'react'; import { createRoot } from 'react-dom/client'; import { BrowserRouter } from 'react-router-dom'; -import Parse from 'parse'; import App from './component/App'; import './index.css'; diff --git a/src/front/pages/details/details.jsx b/src/front/pages/details/details.jsx index a9cee54..8b649ab 100644 --- a/src/front/pages/details/details.jsx +++ b/src/front/pages/details/details.jsx @@ -1,23 +1,23 @@ /* eslint-disable complexity */ /* eslint-disable max-lines */ -import React, { useEffect, useState } from 'react'; -import { useParams } from "react-router-dom"; -import withStyles from '@mui/styles/withStyles'; -import TextField from '@mui/material/TextField'; -import CircularProgress from '@mui/material/CircularProgress'; +import FileCopy from '@mui/icons-material/FileCopy'; import Button from '@mui/material/Button'; +import CircularProgress from '@mui/material/CircularProgress'; import { green } from '@mui/material/colors'; -import InputAdornment from '@mui/material/InputAdornment'; -import IconButton from '@mui/material/IconButton'; -import Switch from '@mui/material/Switch'; import FormControlLabel from '@mui/material/FormControlLabel'; -import FileCopy from '@mui/icons-material/FileCopy'; -import PropTypes from 'prop-types'; // ES6 +import IconButton from '@mui/material/IconButton'; +import InputAdornment from '@mui/material/InputAdornment'; import Snackbar from '@mui/material/Snackbar'; +import Switch from '@mui/material/Switch'; +import TextField from '@mui/material/TextField'; import Tooltip from '@mui/material/Tooltip'; +import withStyles from '@mui/styles/withStyles'; +import PropTypes from 'prop-types'; // ES6 +import React, { useEffect, useState } from 'react'; +import { useParams } from "react-router-dom"; -import { validateFormField, checkValid } from '../../services/formValidator'; import ApplicationsService from '../../services/applications-service'; +import { validateFormField, checkValid } from '../../services/formValidator'; const styles = { root: { @@ -64,7 +64,7 @@ const styles = { } }; -const DetailsPage = function ({ classes }) { +const DetailsPage = function DetailsPage ({ classes }) { const { appId } = useParams(); const [loading, setLoading] = useState(true); const [updateLoading, setUpdateLoading] = useState(false); @@ -85,7 +85,7 @@ const DetailsPage = function ({ classes }) { }); }, [appId]); - const handleChange = function (name, event) { + const handleChange = function handleChange (name, event) { const { value } = event.target; const validated = validateFormField(value, name); @@ -100,7 +100,7 @@ const DetailsPage = function ({ classes }) { }; - const handleToggle = function (name, event) { + const handleToggle = function handleToggle (name, event) { const { checked } = event.target; setApplicationUpdate((prevUpdate) => ({ @@ -109,7 +109,7 @@ const DetailsPage = function ({ classes }) { })); }; - const handleClose = function (event, reason) { + const handleClose = function handleClose (event, reason) { if (reason === 'clickaway') { return; } @@ -117,7 +117,7 @@ const DetailsPage = function ({ classes }) { setSnackBarText(''); }; - const clickUpdateApplication = async function () { + const clickUpdateApplication = async function clickUpdateApplication () { setUpdateLoading(true); Object.entries(applicationUpdate).forEach(([key, value]) => { @@ -130,7 +130,7 @@ const DetailsPage = function ({ classes }) { setSnackBarText("Application successfully updated"); }; - const copyToClipboard = function (key) { + const copyToClipboard = function copyToClipboard (key) { navigator.permissions.query({ name: 'clipboard-write' }).then((result) => { if (result.state === 'granted' || result.state === 'prompt') { navigator.clipboard.writeText( diff --git a/src/front/pages/home/home.jsx b/src/front/pages/home/home.jsx index 750a518..8c4ca3d 100644 --- a/src/front/pages/home/home.jsx +++ b/src/front/pages/home/home.jsx @@ -1,34 +1,33 @@ +/* eslint-disable no-console */ /* eslint-disable max-lines */ -import React, { useEffect, useState } from 'react'; -import { useNavigate } from "react-router-dom"; -import List from '@mui/material/List'; -import ListItem from '@mui/material/ListItem'; -import Divider from '@mui/material/Divider'; -import ListItemText from '@mui/material/ListItemText'; -import Typography from '@mui/material/Typography'; -import CircularProgress from '@mui/material/CircularProgress'; -import Fab from '@mui/material/Fab'; import AddIcon from '@mui/icons-material/Add'; import DeveloperModeIcon from '@mui/icons-material/DeveloperMode'; - import Button from '@mui/material/Button'; -import TextField from '@mui/material/TextField'; +import Card from '@mui/material/Card'; +import CardActions from '@mui/material/CardActions'; +import CardContent from '@mui/material/CardContent'; +import CircularProgress from '@mui/material/CircularProgress'; import Dialog from '@mui/material/Dialog'; import DialogActions from '@mui/material/DialogActions'; import DialogContent from '@mui/material/DialogContent'; import DialogContentText from '@mui/material/DialogContentText'; import DialogTitle from '@mui/material/DialogTitle'; -import Card from '@mui/material/Card'; -import CardActions from '@mui/material/CardActions'; -import CardContent from '@mui/material/CardContent'; - +import Divider from '@mui/material/Divider'; +import Fab from '@mui/material/Fab'; +import List from '@mui/material/List'; +import ListItem from '@mui/material/ListItem'; +import ListItemText from '@mui/material/ListItemText'; +import TextField from '@mui/material/TextField'; +import Typography from '@mui/material/Typography'; +import React, { useEffect, useState } from 'react'; import Moment from 'react-moment'; +import { useNavigate } from "react-router-dom"; -import { validateFormField, checkValid } from '../../services/formValidator'; import ApplicationsService from '../../services/applications-service'; +import { validateFormField, checkValid } from '../../services/formValidator'; -const HomePage = function () { +const HomePage = function HomePage () { const [loading, setLoading] = useState(true); const [dialogNewApplicationOpen, setDialogNewApplicationOpen] = useState(false); const [developerApplications, setDeveloperApplications] = useState([]); @@ -61,11 +60,11 @@ const HomePage = function () { }); }, []); - const handleClickOpen = function () { + const handleClickOpen = function handleClickOpen () { setDialogNewApplicationOpen(true); }; - const handleClose = function () { + const handleClose = function handleClose () { setDialogNewApplicationOpen(false); setNewApplication({ name: '', @@ -82,7 +81,7 @@ const HomePage = function () { setErrorMessage(null); }; - const handleChange = function (name, event) { + const handleChange = function handleChange (name, event) { const { value } = event.target; const validated = validateFormField(value, name); setNewApplication(prevState => ({ @@ -95,11 +94,11 @@ const HomePage = function () { })); }; - const rowClick = function (application) { + const rowClick = function rowClick (application) { navigate(`/application/${application.id}`); }; - const clickCreateApplication = async function () { + const clickCreateApplication = async function clickCreateApplication () { try { const app = await ApplicationsService.create(newApplication); navigate(`/application/${app.id}`); diff --git a/src/front/pages/login/github.jsx b/src/front/pages/login/github.jsx index 6cb89d6..73dde10 100644 --- a/src/front/pages/login/github.jsx +++ b/src/front/pages/login/github.jsx @@ -1,9 +1,11 @@ +/* eslint-disable no-console */ /* eslint-disable react/forbid-prop-types */ import React, { useEffect } from 'react'; import { useNavigate, useLocation } from "react-router-dom"; + import UserService from '../../services/user-service'; -const Github = function () { +const Github = function Github () { const location = useLocation(); const navigate = useNavigate(); const params = new URLSearchParams(location.search); diff --git a/src/front/pages/login/login.jsx b/src/front/pages/login/login.jsx index 5e0c2e0..1844dbf 100644 --- a/src/front/pages/login/login.jsx +++ b/src/front/pages/login/login.jsx @@ -1,14 +1,14 @@ -import withStyles from '@mui/styles/withStyles'; import Card from '@mui/material/Card'; import CardContent from '@mui/material/CardContent'; import CardMedia from '@mui/material/CardMedia'; import Typography from '@mui/material/Typography'; +import withStyles from '@mui/styles/withStyles'; import PropTypes from 'prop-types'; // ES6 - import React, { useEffect } from 'react'; import { useNavigate } from "react-router-dom"; -import UserService from '../../services/user-service'; + import LoginActions from '../../component/LoginActions'; +import UserService from '../../services/user-service'; const styles = { card: { @@ -22,7 +22,7 @@ const styles = { }, }; -const LoginPage = function ({ classes }) { +const LoginPage = function LoginPage ({ classes }) { const navigate = useNavigate(); useEffect(() => { @@ -32,7 +32,7 @@ const LoginPage = function ({ classes }) { } }); - const onUserLoggedIn = function (user) { + const onUserLoggedIn = function onUserLoggedIn (user) { if (user) { navigate('/home'); } diff --git a/src/front/pages/notfound/notfound.jsx b/src/front/pages/notfound/notfound.jsx index ea17044..7cfff7b 100644 --- a/src/front/pages/notfound/notfound.jsx +++ b/src/front/pages/notfound/notfound.jsx @@ -1,15 +1,13 @@ -import React from 'react'; -import { useNavigate } from "react-router-dom"; -import withStyles from '@mui/styles/withStyles'; -import Typography from '@mui/material/Typography'; import DeveloperModeIcon from '@mui/icons-material/DeveloperMode'; - import Button from '@mui/material/Button'; import Card from '@mui/material/Card'; import CardActions from '@mui/material/CardActions'; import CardContent from '@mui/material/CardContent'; - +import Typography from '@mui/material/Typography'; +import withStyles from '@mui/styles/withStyles'; import PropTypes from 'prop-types'; // ES6 +import React from 'react'; +import { useNavigate } from "react-router-dom"; const styles = { card: { @@ -19,8 +17,8 @@ const styles = { }, }; -const NoFound404Page = function ({ classes }) { - const goToHome = function () { +const NoFound404Page = function NoFound404Page ({ classes }) { + const goToHome = function goToHome () { const navigate = useNavigate(); setTimeout(navigate(`/home`), 1000); }; diff --git a/src/front/pages/profile/profile.jsx b/src/front/pages/profile/profile.jsx index bf07d3b..29616d2 100644 --- a/src/front/pages/profile/profile.jsx +++ b/src/front/pages/profile/profile.jsx @@ -1,5 +1,6 @@ /* eslint-disable max-lines */ +import FileCopy from '@mui/icons-material/FileCopy'; import Button from '@mui/material/Button'; import { green } from '@mui/material/colors'; import Dialog from '@mui/material/Dialog'; @@ -7,24 +8,24 @@ import DialogActions from '@mui/material/DialogActions'; import DialogContent from '@mui/material/DialogContent'; import DialogContentText from '@mui/material/DialogContentText'; import DialogTitle from '@mui/material/DialogTitle'; -import withStyles from '@mui/styles/withStyles'; -import TextField from '@mui/material/TextField'; -import PropTypes from 'prop-types'; // ES6 -import React, { useState, useEffect } from 'react'; -import { useNavigate } from "react-router-dom"; -import Snackbar from '@mui/material/Snackbar'; -import InputAdornment from '@mui/material/InputAdornment'; +import Divider from '@mui/material/Divider'; import IconButton from '@mui/material/IconButton'; -import FileCopy from '@mui/icons-material/FileCopy'; -import Tooltip from '@mui/material/Tooltip'; +import InputAdornment from '@mui/material/InputAdornment'; import List from '@mui/material/List'; import ListItem from '@mui/material/ListItem'; -import Divider from '@mui/material/Divider'; import ListItemText from '@mui/material/ListItemText'; +import Snackbar from '@mui/material/Snackbar'; +import TextField from '@mui/material/TextField'; +import Tooltip from '@mui/material/Tooltip'; import Typography from '@mui/material/Typography'; +import withStyles from '@mui/styles/withStyles'; +import PropTypes from 'prop-types'; // ES6 +import React, { useState, useEffect } from 'react'; import Moment from 'react-moment'; -import UserTokensManagementService from '../../services/user-tokens-management-service'; +import { useNavigate } from "react-router-dom"; + import UserService from '../../services/user-service'; +import UserTokensManagementService from '../../services/user-tokens-management-service'; const styles = { root: { @@ -72,7 +73,7 @@ const styles = { }, }; -const ProfilePage = function ({ classes }) { +const ProfilePage = function ProfilePage ({ classes }) { const [dialogOpen, setDialogOpen] = useState(false); const [snackBarOpen, setSnackBarOpen] = useState(false); const [grantedTokens, setGrantedTokens] = useState([]); @@ -80,7 +81,7 @@ const ProfilePage = function ({ classes }) { const user = UserService.getCurrentUser(); - const handleClose = async function (userToBeDeleted) { + const handleClose = async function handleClose (userToBeDeleted) { if (userToBeDeleted) { await UserService.deleteCurrentUser(); const navigate = useNavigate(); @@ -90,13 +91,13 @@ const ProfilePage = function ({ classes }) { } }; - const handleCloseSnackbar = function (event, reason) { + const handleCloseSnackbar = function handleCloseSnackbar (event, reason) { if (reason !== 'clickaway') { setSnackBarOpen(false); } }; - const copyToClipboard = function () { + const copyToClipboard = function copyToClipboard () { navigator.permissions.query({ name: 'clipboard-write' }).then((result) => { if (result.state === 'granted' || result.state === 'prompt') { navigator.clipboard.writeText(user.getSessionToken()); @@ -105,12 +106,12 @@ const ProfilePage = function ({ classes }) { }); }; - const refreshGrantedTokens = async function () { + const refreshGrantedTokens = async function refreshGrantedTokens () { const tokens = await UserTokensManagementService.getGrantedTokens(); setGrantedTokens(tokens || []); }; - const deleteToken = async function () { + const deleteToken = async function deleteToken () { await UserTokensManagementService.revokeToken({ tokenId: tokenToRevokeInDialog.id, }); diff --git a/src/parse/role/get.js b/src/parse/role/get.js index a4cf1d5..3c64208 100644 --- a/src/parse/role/get.js +++ b/src/parse/role/get.js @@ -1,6 +1,6 @@ /* global Parse */ -const getOne = async function (name) { +const getOne = async function getOne (name) { const Role = Parse.Object.extend('_Role'); const query = new Parse.Query(Role); query.equalTo('name', name); diff --git a/src/parse/schema/getClasses.js b/src/parse/schema/getClasses.js index 0690755..ebe1b39 100644 --- a/src/parse/schema/getClasses.js +++ b/src/parse/schema/getClasses.js @@ -1,6 +1,6 @@ import getSchemas from './getSchemas.js'; -const swaggerTypeToParseType = function (element) { +const swaggerTypeToParseType = function swaggerTypeToParseType (element) { let parseType; switch (element.type) { case 'string': @@ -29,7 +29,7 @@ const swaggerTypeToParseType = function (element) { return parseType; }; -const getClass = function (schema, isSandbox = false) { +const getClass = function getClass (schema, isSandbox = false) { const className = isSandbox ? `Sandbox_${schema.className}` : schema.className; const parseClass = {