diff --git a/react-ui/src/components/devices/index.module.ts b/react-ui/src/components/devices/index.module.ts deleted file mode 100755 index 5ef9299bda082cc2a810e86daa20372a9c11cfce..0000000000000000000000000000000000000000 --- a/react-ui/src/components/devices/index.module.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { fetchSelectedMneThunk } from './routines/mne.routine' - -const routines = { - fetchSelectedMneThunk: fetchSelectedMneThunk, -} diff --git a/react-ui/src/components/login/view/login.view.tsx b/react-ui/src/components/login/view/login.view.tsx index e393bb4b35f82e32d48517e9b84690b4c0e4c16c..03d7406f42bc37a78f9e6047f4aa70758e8b8258 100755 --- a/react-ui/src/components/login/view/login.view.tsx +++ b/react-ui/src/components/login/view/login.view.tsx @@ -1,12 +1,12 @@ -import { Alert, Button, Col, Container, Form, Image, Row, Spinner } from 'react-bootstrap' -import { useTranslation } from 'react-i18next' -import './login.scss' - import logo from '@assets/logo.svg' +import { BasicProp } from '@helper/interfaces' import React, { useRef } from 'react' +import { Alert, Button, Col, Container, Form, Image, Row, Spinner } from 'react-bootstrap' +import { useTranslation } from 'react-i18next' import useLoginViewModel from '../viewmodel/login.viewmodel' +import './login.scss' -const LoginView = ({ children }) => { +const LoginView: React.FC<BasicProp> = () => { const { t } = useTranslation('common') const { login, handleErrorMessageRendering, displayFormFieldChecks, loginLoading } = useLoginViewModel(); diff --git a/react-ui/src/shared/components/json_viewer/reducer/json_viewer.reducer.ts b/react-ui/src/shared/components/json_viewer/reducer/json_viewer.reducer.ts index 0779d0e184b44f7a018cde3344f7f6f605cd2f17..dd432535cba4f5cb7a37140ddfc00c05f8e28a94 100755 --- a/react-ui/src/shared/components/json_viewer/reducer/json_viewer.reducer.ts +++ b/react-ui/src/shared/components/json_viewer/reducer/json_viewer.reducer.ts @@ -55,7 +55,7 @@ const JsonViewerSlice = createSlice({ const { identifier, collapse } = payload // potentially find already collapsed - let i = state.collapseContainer.findIndex(i => compareIdentifier(identifier, i.identifier)) + const i = state.collapseContainer.findIndex(i => compareIdentifier(identifier, i.identifier)) if (i === -1) { diff --git a/react-ui/src/shared/components/json_viewer/viewmodel/json_viewer.viewmodel.tsx b/react-ui/src/shared/components/json_viewer/viewmodel/json_viewer.viewmodel.tsx index a1a9c89771d2939cbcbb1d2fddfa7707d34c1417..da78528f27ffa6adf9b252cb4ba53476949b927d 100644 --- a/react-ui/src/shared/components/json_viewer/viewmodel/json_viewer.viewmodel.tsx +++ b/react-ui/src/shared/components/json_viewer/viewmodel/json_viewer.viewmodel.tsx @@ -54,7 +54,7 @@ export const useJsonViewer = ({ json, search, container }: JsonViewerViewModelTy return !!item.length; } - const collapse = (key: string, nested: number, json: Object, collapseState: CollapseValues = CollapseValues.TOGGLE) => { + const collapse = (key: string, nested: number, json: object, collapseState: CollapseValues = CollapseValues.TOGGLE) => { const identifier = { key, nested }; dispatch(toggleCollapse({ identifier, collapse: collapseState })) @@ -95,7 +95,7 @@ export const useJsonViewer = ({ json, search, container }: JsonViewerViewModelTy } } - const innerSearch = (json: Object, searchValue: string, parentKey: string = "", path: string = "/"): boolean => { + const innerSearch = (json: object, searchValue: string, parentKey: string = "", path: string = "/"): boolean => { let found = false; path += parentKey + (parentKey === "" ? "" : "/") diff --git a/react-ui/src/shared/layouts/protected.layout/protected.layout.tsx b/react-ui/src/shared/layouts/protected.layout/protected.layout.tsx index 0708d87f1fef3cdf6922a2012c6a91d205fec993..c7e13c6fe55a2f874c6eeafbc956305986051b63 100755 --- a/react-ui/src/shared/layouts/protected.layout/protected.layout.tsx +++ b/react-ui/src/shared/layouts/protected.layout/protected.layout.tsx @@ -29,7 +29,7 @@ export const ProtectedLayout = () => { dispatch(fetchUser()); dispatch(fetchPnds()); - }, []); + }, [dispatch]); /** * Applies active css class to link if the link is active diff --git a/react-ui/src/shared/provider/auth.provider.tsx b/react-ui/src/shared/provider/auth.provider.tsx index 830a4d47d24aafab94075d89a0e0e716d1cf61d1..69bdccbdfbb3b6db3295d20a137e56a57d8504f2 100755 --- a/react-ui/src/shared/provider/auth.provider.tsx +++ b/react-ui/src/shared/provider/auth.provider.tsx @@ -103,7 +103,7 @@ export const AuthProvider: React.FC<BasicProp> = ({ children }) => { isAuthenticated, loginProperties }), - [] + [executeLogin, loginProperties, logout] ); return ( diff --git a/react-ui/src/shared/provider/menu/menu.provider.tsx b/react-ui/src/shared/provider/menu/menu.provider.tsx index 0cfc61f68128b8dc2910c27525106b16c1eb3885..a91f46639af28e2db261a3089f62e0a79fc13c41 100644 --- a/react-ui/src/shared/provider/menu/menu.provider.tsx +++ b/react-ui/src/shared/provider/menu/menu.provider.tsx @@ -23,7 +23,7 @@ interface MenuProviderType { } const MenuContext = createContext<MenuProviderType>({ - subscribe: function (value: SubscriptionValue): MenuSubscription { + subscribe: function (): MenuSubscription { throw new Error("Function not implemented."); } }) @@ -86,7 +86,7 @@ export const MenuProvider: React.FC<BasicProp> = ({ children }) => { hideMenu(); } }); - }, []) + }, [hideMenu]) const value = useMemo<MenuProviderType>(() => { return { diff --git a/react-ui/src/shared/provider/utils.provider.tsx b/react-ui/src/shared/provider/utils.provider.tsx index 6f6775343ec94b2e7fd2773ccf837fc2f4bf1f9b..ca6aa1d3235efe3e1f48441fc7a39a47e9ce7fb7 100644 --- a/react-ui/src/shared/provider/utils.provider.tsx +++ b/react-ui/src/shared/provider/utils.provider.tsx @@ -8,7 +8,7 @@ interface UtilsProviderType { } const UtilsContext = createContext<UtilsProviderType>({ - toClipboard: function (text: string): void { + toClipboard: function (): void { throw new Error("Function not implemented."); } }) @@ -23,7 +23,7 @@ export const UtilsProvider: React.FC<BasicProp> = ({ children }) => { toast.info(t('global.toast.copied')) }, } as UtilsProviderType - }, []) + }, [t]) return ( <UtilsContext.Provider value={value}> diff --git a/react-ui/src/shared/reducer/routine.reducer.ts b/react-ui/src/shared/reducer/routine.reducer.ts index c7f9a43c1054161d9b91eaa78867b3d73fca41b4..a52ee84d3f16e89f5e899919d59fcb44428a9213 100755 --- a/react-ui/src/shared/reducer/routine.reducer.ts +++ b/react-ui/src/shared/reducer/routine.reducer.ts @@ -6,7 +6,7 @@ import { setToken } from './user.reducer' interface ThunkEntityDTO { thunk: any - payload: any + payload: Object /** * Only one subscription per category is allowed. New subscription will unsubscribe and overwrite the old one @@ -45,14 +45,14 @@ const RoutineSlice = createSlice({ }, setThunkId: (state, { payload }: PayloadAction<{ id: number; category: CATEGORIES }>) => { - const thunk = state.thunks[CATEGORIES[payload.category]] + const thunk = state.thunks[CATEGORIES[payload.category] as any] if (!thunk) { // TODO throw new Error('Thunk not found') } - state.thunks[CATEGORIES[payload.category]] = { ...thunk, id: payload.id, locked: false } + state.thunks[CATEGORIES[payload.category] as any] = { ...thunk, id: payload.id, locked: false } }, removeAll: (state) => { @@ -107,8 +107,13 @@ startListening({ predicate: (action) => addRoutine.match(action), effect: async (action, listenerApi) => { const { routine } = listenerApi.getOriginalState() as RootState - const lastThunk = routine.thunks[CATEGORIES[action.payload.category]] + const lastThunk = routine.thunks[CATEGORIES[action.payload.category] as any] if (lastThunk) { + if (!lastThunk.id) { + throw new Error() + // TODO + } + RoutineManager.unsubscribe(lastThunk.id) } },