diff --git a/react-ui/src/stores/reducer/device.reducer/device.reducer.ts b/react-ui/src/components/devices/reducer/device.reducer.ts similarity index 96% rename from react-ui/src/stores/reducer/device.reducer/device.reducer.ts rename to react-ui/src/components/devices/reducer/device.reducer.ts index c9388adc54267801f264796633679053e1ca9803..ad702310bd11d5a72387af02ac56474d8eec4255 100644 --- a/react-ui/src/stores/reducer/device.reducer/device.reducer.ts +++ b/react-ui/src/components/devices/reducer/device.reducer.ts @@ -1,5 +1,5 @@ import { api, NetworkelementFlattenedManagedNetworkElement, NetworkelementManagedNetworkElement, PndPrincipalNetworkDomain, PndServiceGetPndListApiArg } from '@api/api'; -import { DeviceViewTabValues } from '@component/view/device/device.view.tabs'; +import { DeviceViewTabValues } from '@component/devices/view/device.view.tabs'; import { createAsyncThunk, createSlice, PayloadAction } from '@reduxjs/toolkit'; export type Device = NetworkelementFlattenedManagedNetworkElement; diff --git a/react-ui/src/stores/reducer/device.reducer/mne.subscription.ts b/react-ui/src/components/devices/reducer/mne.subscription.ts similarity index 81% rename from react-ui/src/stores/reducer/device.reducer/mne.subscription.ts rename to react-ui/src/components/devices/reducer/mne.subscription.ts index d84e7c5a5a4c954e26e44599df2d2715d9e48590..fec8a0b21dcddb1e3c9c6402346c2e0956869885 100644 --- a/react-ui/src/stores/reducer/device.reducer/mne.subscription.ts +++ b/react-ui/src/components/devices/reducer/mne.subscription.ts @@ -1,11 +1,11 @@ import { api, NetworkElementServiceGetApiArg } from "@api/api"; -import { Device, setSelectedDevice, setSelectedMne } from "@reducer/device.reducer/device.reducer"; -import { addRoutine, CATEGORIES } from "@reducer/routine.reducer"; +import { Device, setSelectedDevice, setSelectedMne } from "@component/devices/reducer/device.reducer"; import { createAsyncThunk } from "@reduxjs/toolkit"; +import { addRoutine, CATEGORIES } from "@shared/reducer/routine.reducer"; import { THUNK_KEY } from "@utils/routine.manager"; import { RootState } from "src/stores"; -import { FETCH_MNE_ACTION } from "../../../components/routines/action.routine"; -import { startListening } from "../../middleware/listener.middleware"; +import { startListening } from "../../../stores/middleware/listener.middleware"; +import { FETCH_MNE_ACTION } from "../routines/action.routine"; // fetch mne if selected device is set startListening({ diff --git a/react-ui/src/components/routines/action.routine.ts b/react-ui/src/components/devices/routines/action.routine.ts similarity index 100% rename from react-ui/src/components/routines/action.routine.ts rename to react-ui/src/components/devices/routines/action.routine.ts diff --git a/react-ui/src/components/routines/device.routine.ts b/react-ui/src/components/devices/routines/device.routine.ts similarity index 86% rename from react-ui/src/components/routines/device.routine.ts rename to react-ui/src/components/devices/routines/device.routine.ts index 7cafd91b7a9044904a5609f5cdb83c60889a4bb2..2d14e4bf5a7dd38a7ac264f659ac423f434fac48 100644 --- a/react-ui/src/components/routines/device.routine.ts +++ b/react-ui/src/components/devices/routines/device.routine.ts @@ -1,9 +1,9 @@ import { NetworkElementServiceGetAllFlattenedApiArg, api } from "@api/api"; -import { setDevices } from "@reducer/device.reducer/device.reducer"; +import { setDevices } from "@component/devices/reducer/device.reducer"; import { createAsyncThunk } from "@reduxjs/toolkit"; -import { setUser } from "@shared/store/user.reducer"; +import { setUser } from "@shared/reducer/user.reducer"; import { RootState } from "src/stores"; -import { startListening } from "../../stores/middleware/listener.middleware"; +import { startListening } from "../../../stores/middleware/listener.middleware"; import { FETCH_DEVICE_ACTION } from "./action.routine"; // continously fetch devices diff --git a/react-ui/src/components/view/device/device.scss b/react-ui/src/components/devices/view/device.scss similarity index 100% rename from react-ui/src/components/view/device/device.scss rename to react-ui/src/components/devices/view/device.scss diff --git a/react-ui/src/components/view/device/device.view.table.tsx b/react-ui/src/components/devices/view/device.view.table.tsx similarity index 96% rename from react-ui/src/components/view/device/device.view.table.tsx rename to react-ui/src/components/devices/view/device.view.table.tsx index 16c9c7730e44deaab9caa3a63c001fe771df4746..9ef441f1781c278b1a2faeb1147bfd193abaed35 100644 --- a/react-ui/src/components/view/device/device.view.table.tsx +++ b/react-ui/src/components/devices/view/device.view.table.tsx @@ -2,7 +2,7 @@ import { useAppSelector } from "@hooks"; import { MutableRefObject, useCallback } from "react"; import { OverlayTrigger, Table, Tooltip } from "react-bootstrap"; import { useTranslation } from "react-i18next"; -import { useDeviceTableViewModel } from "../../view_model/device.table.viewmodel"; +import { useDeviceTableViewModel } from "../view_model/device.table.viewmodel"; export const DeviceViewTable = (searchRef: MutableRefObject<HTMLInputElement>) => { const { devices, pnds } = useAppSelector(state => state.device); diff --git a/react-ui/src/components/view/device/device.view.tabs.tsx b/react-ui/src/components/devices/view/device.view.tabs.tsx similarity index 100% rename from react-ui/src/components/view/device/device.view.tabs.tsx rename to react-ui/src/components/devices/view/device.view.tabs.tsx diff --git a/react-ui/src/components/view/device/device.view.tsx b/react-ui/src/components/devices/view/device.view.tsx similarity index 96% rename from react-ui/src/components/view/device/device.view.tsx rename to react-ui/src/components/devices/view/device.view.tsx index c620636bf2ef808ef8fb0c84d2eece2b4cf6b227..9e176ae664e24cf20ad6f1dc7b44238d2f827d7c 100644 --- a/react-ui/src/components/view/device/device.view.tsx +++ b/react-ui/src/components/devices/view/device.view.tsx @@ -1,10 +1,10 @@ import { useRef } from 'react'; import { Button, Col, Container, Form, Nav, NavLink, Row } from 'react-bootstrap'; import { useTranslation } from 'react-i18next'; +import { useDeviceViewModel } from '../view_model/device.viewmodel'; import './device.scss'; import { DeviceViewTable } from './device.view.table'; import { DeviceViewTabs, DeviceViewTabValues } from './device.view.tabs'; -import { useDeviceViewModel } from '/src/components/view_model/device.viewmodel'; function DeviceView() { const { t } = useTranslation('common'); diff --git a/react-ui/src/components/view_model/device.table.viewmodel.ts b/react-ui/src/components/devices/view_model/device.table.viewmodel.ts similarity index 91% rename from react-ui/src/components/view_model/device.table.viewmodel.ts rename to react-ui/src/components/devices/view_model/device.table.viewmodel.ts index 0802d6b575c4240f6f0cb18be612e294d53e01cf..df75953288d659c17a53a744c7c4ba015f0dcab9 100644 --- a/react-ui/src/components/view_model/device.table.viewmodel.ts +++ b/react-ui/src/components/devices/view_model/device.table.viewmodel.ts @@ -1,5 +1,5 @@ +import { Device, setSelectedDevice } from "@component/devices/reducer/device.reducer"; import { useAppDispatch } from "@hooks"; -import { Device, setSelectedDevice } from "@reducer/device.reducer/device.reducer"; import { useEffect, useState } from "react"; export const useDeviceTableViewModel = (searchRef) => { diff --git a/react-ui/src/components/view_model/device.viewmodel.ts b/react-ui/src/components/devices/view_model/device.viewmodel.ts similarity index 86% rename from react-ui/src/components/view_model/device.viewmodel.ts rename to react-ui/src/components/devices/view_model/device.viewmodel.ts index 6dd01d07ede92c977e80702d2700a7b688e1107f..cfff6cf9af58de20d67c13034a9535b298fd4a1f 100644 --- a/react-ui/src/components/view_model/device.viewmodel.ts +++ b/react-ui/src/components/devices/view_model/device.viewmodel.ts @@ -1,5 +1,5 @@ +import { setActiveTab as setActiveTabState } from "@component/devices/reducer/device.reducer"; import { useAppDispatch, useAppSelector } from "@hooks"; -import { setActiveTab as setActiveTabState } from "@reducer/device.reducer/device.reducer"; import { DeviceViewTabValues } from "@view/device/device.view.tabs"; export const useDeviceViewModel = () => { diff --git a/react-ui/src/routes.tsx b/react-ui/src/routes.tsx index 1015d87af2554ebfd8e710cea981841b23f6af1a..368df55a472bdbc20bc2dd34bb9fb1f33b43047f 100644 --- a/react-ui/src/routes.tsx +++ b/react-ui/src/routes.tsx @@ -1,8 +1,8 @@ import { BasicLayout } from "@layout/basic.layout"; import { ProtectedLayout } from "@layout/protected.layout/protected.layout"; import { createBrowserRouter, createRoutesFromElements, Navigate, Route } from "react-router-dom"; +import DeviceView from "./components/devices/view/device.view"; import { LoginLayout } from "./components/login/layouts/login.layout"; -import DeviceView from "./components/view/device/device.view"; export const DEVICE_URL = '/device/'; export const LOGIN_URL = '/login'; 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 0203899842c5edf7f1060d3c1a871564a44c171c..03a188796368e0b9dd1ff9eff7788459e30858f8 100644 --- a/react-ui/src/shared/layouts/protected.layout/protected.layout.tsx +++ b/react-ui/src/shared/layouts/protected.layout/protected.layout.tsx @@ -1,11 +1,11 @@ import logo from '@assets/logo.svg'; +import { fetchPnds } from '@component/devices/reducer/device.reducer'; import { faCircleUser, faRightFromBracket } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { useAppDispatch, useAppSelector } from '@hooks'; import { useAuth } from "@provider/auth.provider"; -import { fetchPnds } from '@reducer/device.reducer/device.reducer'; import { DEVICE_URL, LOGIN_URL } from '@routes'; -import { fetchUser } from '@shared/store/user.reducer'; +import { fetchUser } from '@shared/reducer/user.reducer'; import React, { useEffect } from "react"; import { Dropdown } from "react-bootstrap"; import { useTranslation } from "react-i18next"; diff --git a/react-ui/src/shared/provider/auth.provider.tsx b/react-ui/src/shared/provider/auth.provider.tsx index b6bde926200361ce6a2149d03bc2794593d33796..4098eca5b2f8025d9294edbfc260b4d94d2731a4 100644 --- a/react-ui/src/shared/provider/auth.provider.tsx +++ b/react-ui/src/shared/provider/auth.provider.tsx @@ -5,7 +5,7 @@ import { DEVICE_URL, LOGIN_URL } from "@routes"; import { jwtDecode } from "jwt-decode"; import { createContext, useContext, useEffect, useMemo } from "react"; import { useNavigate } from "react-router-dom"; -import { setToken } from "../store/user.reducer"; +import { setToken } from "../reducer/user.reducer"; interface AuthProviderType { login: (username: string, password: string) => void, diff --git a/react-ui/src/stores/reducer/routine.reducer.ts b/react-ui/src/shared/reducer/routine.reducer.ts similarity index 95% rename from react-ui/src/stores/reducer/routine.reducer.ts rename to react-ui/src/shared/reducer/routine.reducer.ts index 79e7c86835de54db4fa5840056131dac2416999f..fb62e51593e5df30cb5534a3d2306b2dbbab7b3d 100644 --- a/react-ui/src/stores/reducer/routine.reducer.ts +++ b/react-ui/src/shared/reducer/routine.reducer.ts @@ -1,9 +1,9 @@ import { PayloadAction, createSlice } from '@reduxjs/toolkit'; -import { setToken } from '@shared/store/user.reducer'; import { RoutineDictionary, RoutineManager, THUNK_KEY } from '@utils/routine.manager'; import { REHYDRATE } from 'redux-persist'; -import { RootState } from '..'; -import { startListening } from '../middleware/listener.middleware'; +import { RootState } from '../../stores'; +import { startListening } from '../../stores/middleware/listener.middleware'; +import { setToken } from './user.reducer'; @@ -22,7 +22,6 @@ interface ThunkEntity extends ThunkEntityDTO { locked: boolean, } - export interface ReducerState { thunks: {[key in keyof typeof CATEGORIES]: ThunkEntity | null} } diff --git a/react-ui/src/shared/store/user.reducer.ts b/react-ui/src/shared/reducer/user.reducer.ts similarity index 100% rename from react-ui/src/shared/store/user.reducer.ts rename to react-ui/src/shared/reducer/user.reducer.ts diff --git a/react-ui/src/shared/utils/routine.manager.ts b/react-ui/src/shared/utils/routine.manager.ts index 449e2c690f874f6b87998ae425df5719648afbd7..891637fb8c1b681ca38c84a80778d437409a933d 100644 --- a/react-ui/src/shared/utils/routine.manager.ts +++ b/react-ui/src/shared/utils/routine.manager.ts @@ -1,5 +1,5 @@ -import { fetchDevicesThunk } from '@component/routines/device.routine'; -import { fetchSelectedMneThunk } from '@reducer/device.reducer/mne.subscription'; +import { fetchSelectedMneThunk } from '@component/devices/reducer/mne.subscription'; +import { fetchDevicesThunk } from '@component/devices/routines/device.routine'; import { AsyncThunk } from '@reduxjs/toolkit'; import { QueryActionCreatorResult } from '@reduxjs/toolkit/query'; diff --git a/react-ui/src/stores/index.ts b/react-ui/src/stores/index.ts index f620923b5bb639ae95791669259951078b21c9a6..8c24b876324974fae19a7cd3c4c839803a27946d 100644 --- a/react-ui/src/stores/index.ts +++ b/react-ui/src/stores/index.ts @@ -1,3 +1,4 @@ +import { FETCH_DEVICE_ACTION, FETCH_MNE_ACTION } from '@component/devices/routines/action.routine' import { configureStore } from '@reduxjs/toolkit' import { setupListeners } from '@reduxjs/toolkit/query' import { FLUSH, PAUSE, PERSIST, PURGE, REGISTER, REHYDRATE } from 'redux-persist' @@ -6,7 +7,6 @@ import { emptySplitApi } from './api.store' import { rtkQueryErrorLogger } from './middleware/devLogging.middleware' import { listenerMiddleware } from './middleware/listener.middleware' import persistedReducer from './persist.store' -import { FETCH_DEVICE_ACTION, FETCH_MNE_ACTION } from '/src/components/routines/action.routine' export const store = configureStore({ diff --git a/react-ui/src/stores/persist.store.ts b/react-ui/src/stores/persist.store.ts index d66bcf930db9eb5ca1b17a870d4e64c7081bf326..bda77de7e3a09996bf574020992b09cd8864bcbe 100644 --- a/react-ui/src/stores/persist.store.ts +++ b/react-ui/src/stores/persist.store.ts @@ -1,10 +1,10 @@ -import deviceReducer from "@reducer/device.reducer/device.reducer"; -import routineReducer from "@reducer/routine.reducer"; +import deviceReducer from "@component/devices/reducer/device.reducer"; +import routineReducer from "@shared/reducer/routine.reducer"; +import userReducer from "@shared/reducer/user.reducer"; import { combineReducers } from "redux"; import { persistReducer } from "redux-persist"; import storage from "redux-persist/es/storage"; import { emptySplitApi } from "./api.store"; -import userReducer from "/src/shared/store/user.reducer"; /** local storage config */