diff --git a/FRONT/BUILD/resources/app/src/components/workSpace/modules/workModules/networkInterfaces.tsx b/FRONT/BUILD/resources/app/src/components/workSpace/modules/workModules/networkInterfaces.tsx index 1996ddd..d0325ef 100644 --- a/FRONT/BUILD/resources/app/src/components/workSpace/modules/workModules/networkInterfaces.tsx +++ b/FRONT/BUILD/resources/app/src/components/workSpace/modules/workModules/networkInterfaces.tsx @@ -76,7 +76,7 @@ export const NetworkInterfaces = ({ startConnection, ws }: Props) => { setHasInited(false) initializationAttempt.current = 0; - const newSocket = new WebSocket(`wss://${ws}:8001/api/v1`); + const newSocket = new WebSocket(`ws://${ws}:8001/api/v1`); let connectionTimeout; setSocket(newSocket); diff --git a/FRONT/BUILD/resources/app/src/components/workSpace/sideBar/toolSpace/devicesBar.tsx b/FRONT/BUILD/resources/app/src/components/workSpace/sideBar/toolSpace/devicesBar.tsx index 8b919f4..dd5ca2b 100644 --- a/FRONT/BUILD/resources/app/src/components/workSpace/sideBar/toolSpace/devicesBar.tsx +++ b/FRONT/BUILD/resources/app/src/components/workSpace/sideBar/toolSpace/devicesBar.tsx @@ -115,7 +115,7 @@ export const DevicesBar = () => { const checkWebSocketAvailability = async (ip: string): Promise => { return new Promise((resolve) => { - const testSocket = new WebSocket(`wss://${ip}:8001/api/v1`); + const testSocket = new WebSocket(`ws://${ip}:8001/api/v1`); const timeout = setTimeout(() => { testSocket.close(); resolve(false); diff --git a/FRONT/DEV/preload.js b/FRONT/DEV/preload.js index 3e21ba6..1ceb420 100644 --- a/FRONT/DEV/preload.js +++ b/FRONT/DEV/preload.js @@ -1,19 +1,11 @@ const { contextBridge, ipcRenderer } = require('electron'); -contextBridge.exposeInMainWorld('electron', { - send: (channel, data) => { - ipcRenderer.send(channel, data); - }, - on: (channel, func) => { - ipcRenderer.on(channel, (event, ...args) => func(...args)); - }, - quitApp: () => { - ipcRenderer.send('quit-app'); - }, +contextBridge.exposeInMainWorld('electronAPI', { + send: (channel, data) => ipcRenderer.send(channel, data), + on: (channel, func) => ipcRenderer.on(channel, (event, ...args) => func(...args)), + quitApp: () => ipcRenderer.send('quit-app'), - onThemeChange: (callback) => { - ipcRenderer.on('theme-update', (event, theme) => { - callback(theme); - }); - } + showSaveDialog: (options) => ipcRenderer.invoke('show-save-dialog', options), + writeFile: (path, data) => ipcRenderer.invoke('write-file', { path, data }), + onThemeChange: (callback) => ipcRenderer.on('theme-update', (event, theme) => callback(theme)) }); \ No newline at end of file diff --git a/FRONT/DEV/src/api/request.ts b/FRONT/DEV/src/api/request.ts index d0ad0b1..ce00ee9 100644 --- a/FRONT/DEV/src/api/request.ts +++ b/FRONT/DEV/src/api/request.ts @@ -1,13 +1,13 @@ import axios, { AxiosResponse } from "axios"; const axiosWithoutCredentials = axios.create({ - baseURL: `https://localhost:8001`, + baseURL: `http://localhost:8001`, }) export class NetworkService { static createAxiosInstance(ipAddress: string) { return axios.create({ - baseURL: `https://${ipAddress}:8001`, + baseURL: `http://${ipAddress}:8001`, }); } diff --git a/FRONT/DEV/src/components/settings/Settings.tsx b/FRONT/DEV/src/components/settings/Settings.tsx index 9723bc4..a086a0d 100644 --- a/FRONT/DEV/src/components/settings/Settings.tsx +++ b/FRONT/DEV/src/components/settings/Settings.tsx @@ -1,12 +1,13 @@ import { ModalContainer, ModalTitle, ModalContent, ButtonContainer } from "../modalwindows/style"; import { MainButton } from "../UI/buttons/mainButton"; import {useCallback, useEffect, useMemo, useState} from "react"; -import styled from "styled-components"; +import styled, {useTheme} from "styled-components"; import {Setting, useSettingsStore} from "../../store/settings/settingsStore"; import {SettingItem} from "./SettingItem"; import {IconComponent} from "../../const/buttons/icons"; import {buttonNames} from "../../const/buttons/names"; + interface Props { onClose: () => void; } @@ -47,6 +48,16 @@ const SectionLine = styled.span` const CloseBtn = styled.span` cursor: pointer; ` +const SettingsButtons = styled.div` + display: flex; + justify-content: space-between; + align-items: center; + width: 100%; + span{ + display: flex; + gap: 12px; + } +` export const Settings = ({ onClose }: Props) => { const settingsConfig = useSettingsStore(state => state.settingsConfig); const settingsValues = useSettingsStore(state => state.settingsValues); @@ -57,10 +68,13 @@ export const Settings = ({ onClose }: Props) => { const applyChanges = useSettingsStore(state => state.applyChanges); const discardChanges = useSettingsStore(state => state.discardChanges); const getSetting = useSettingsStore(state => state.getSetting); + const resetToDefaults = useSettingsStore(state => state.resetToDefaults); const initializeSettings = useSettingsStore(state => state.initializeSettings); + const theme = useTheme() const [fieldErrors, setFieldErrors] = useState>({}); + // Проверка действий const handleValidationError = useCallback((fieldId: string, error: string | null) => { setFieldErrors(prev => { const newErrors = { ...prev }; @@ -126,6 +140,12 @@ export const Settings = ({ onClose }: Props) => { onClose(); }, [discardChanges, onClose]); + const handleReset = () => { + if (window.confirm('Вы уверены, что хотите сбросить все настройки к значениям по умолчанию?')) { + resetToDefaults(); + } + }; + return ( @@ -166,20 +186,32 @@ export const Settings = ({ onClose }: Props) => { - - + + + + + + + ); diff --git a/FRONT/DEV/src/components/workSpace/modules/appModules/usersScanner/modules/TableScanner.tsx b/FRONT/DEV/src/components/workSpace/modules/appModules/usersScanner/modules/TableScanner.tsx index d317634..0817650 100644 --- a/FRONT/DEV/src/components/workSpace/modules/appModules/usersScanner/modules/TableScanner.tsx +++ b/FRONT/DEV/src/components/workSpace/modules/appModules/usersScanner/modules/TableScanner.tsx @@ -107,7 +107,7 @@ export const TableScanner = ({ devices }: TableScannerProps) => { default: return ''; } }) - .filter(Boolean); // Убираем пустые значения + .filter(Boolean); }, [ordersColumns, disabledColumns]); // Пагинация diff --git a/FRONT/DEV/src/components/workSpace/modules/appModules/usersScanner/modules/TableUsers.tsx b/FRONT/DEV/src/components/workSpace/modules/appModules/usersScanner/modules/TableUsers.tsx index 22f9086..9d15ff9 100644 --- a/FRONT/DEV/src/components/workSpace/modules/appModules/usersScanner/modules/TableUsers.tsx +++ b/FRONT/DEV/src/components/workSpace/modules/appModules/usersScanner/modules/TableUsers.tsx @@ -1,8 +1,11 @@ import React from 'react'; import styled from 'styled-components'; -import DeviceCard from "../../../../../UI/Dropdown/DeviceCard"; import {DeviceUser} from "../../../../../../store/useDeviceStore"; import {TableScanner} from "./TableScanner"; +<<<<<<< HEAD + +======= +>>>>>>> 26a364aad6dc04d237ff4756cd322508cdffb2b1 const ScanBtn = styled.button` position: relative; diff --git a/FRONT/DEV/src/components/workSpace/modules/workModules/networkInterfaces.tsx b/FRONT/DEV/src/components/workSpace/modules/workModules/networkInterfaces.tsx index 1996ddd..d0325ef 100644 --- a/FRONT/DEV/src/components/workSpace/modules/workModules/networkInterfaces.tsx +++ b/FRONT/DEV/src/components/workSpace/modules/workModules/networkInterfaces.tsx @@ -76,7 +76,7 @@ export const NetworkInterfaces = ({ startConnection, ws }: Props) => { setHasInited(false) initializationAttempt.current = 0; - const newSocket = new WebSocket(`wss://${ws}:8001/api/v1`); + const newSocket = new WebSocket(`ws://${ws}:8001/api/v1`); let connectionTimeout; setSocket(newSocket); diff --git a/FRONT/DEV/src/components/workSpace/sideBar/toolSpace/devicesBar.tsx b/FRONT/DEV/src/components/workSpace/sideBar/toolSpace/devicesBar.tsx index 8b919f4..dd5ca2b 100644 --- a/FRONT/DEV/src/components/workSpace/sideBar/toolSpace/devicesBar.tsx +++ b/FRONT/DEV/src/components/workSpace/sideBar/toolSpace/devicesBar.tsx @@ -115,7 +115,7 @@ export const DevicesBar = () => { const checkWebSocketAvailability = async (ip: string): Promise => { return new Promise((resolve) => { - const testSocket = new WebSocket(`wss://${ip}:8001/api/v1`); + const testSocket = new WebSocket(`ws://${ip}:8001/api/v1`); const timeout = setTimeout(() => { testSocket.close(); resolve(false); diff --git a/FRONT/DEV/src/store/settings/settingsStore.ts b/FRONT/DEV/src/store/settings/settingsStore.ts index 45c8440..b26c98d 100644 --- a/FRONT/DEV/src/store/settings/settingsStore.ts +++ b/FRONT/DEV/src/store/settings/settingsStore.ts @@ -33,6 +33,7 @@ type SettingsState = { resetSettings: () => void; applyChanges: () => void; discardChanges: () => void; + resetToDefaults: () => void; getSettingValue: (id: string) => T; getNumberSetting: (id: string, fallback?: number) => number; }; @@ -58,6 +59,16 @@ export const useSettingsStore = create()( pendingChanges: { ...state.pendingChanges, [id]: value } })), + resetToDefaults: () => set({ + settingsValues: Object.fromEntries( + get().settingsConfig.map(setting => [ + setting.id, + setting.defaultValue + ]) + ), + pendingChanges: {} + }), + applyChanges: () => set((state) => ({ settingsValues: { ...state.settingsValues, ...state.pendingChanges },