This commit is contained in:
Ildar Kamalov
2025-08-11 12:40:49 +03:00
parent 87eb68e519
commit d0cf6ad5ab
23 changed files with 45 additions and 47 deletions

View File

@@ -1,11 +1,10 @@
import { createAction } from 'redux-actions'; import { createAction } from 'redux-actions';
import i18next from 'i18next';
import intl from 'panel/common/intl';
import { apiClient } from '../api/Api'; import { apiClient } from '../api/Api';
import { splitByNewLine } from '../helpers/helpers'; import { splitByNewLine } from '../helpers/helpers';
import { addErrorToast, addSuccessToast } from './toasts'; import { addErrorToast, addSuccessToast } from './toasts';
import intl from 'panel/common/intl';
export const getDnsConfigRequest = createAction('GET_DNS_CONFIG_REQUEST'); export const getDnsConfigRequest = createAction('GET_DNS_CONFIG_REQUEST');
export const getDnsConfigFailure = createAction('GET_DNS_CONFIG_FAILURE'); export const getDnsConfigFailure = createAction('GET_DNS_CONFIG_FAILURE');

View File

@@ -1,9 +1,9 @@
import { createAction } from 'redux-actions'; import { createAction } from 'redux-actions';
import intl from 'panel/common/intl';
import { apiClient } from '../api/Api'; import { apiClient } from '../api/Api';
import { redirectToCurrentProtocol } from '../helpers/helpers'; import { redirectToCurrentProtocol } from '../helpers/helpers';
import { addErrorToast, addSuccessToast } from './toasts'; import { addErrorToast, addSuccessToast } from './toasts';
import intl from 'panel/common/intl';
export const getTlsStatusRequest = createAction('GET_TLS_STATUS_REQUEST'); export const getTlsStatusRequest = createAction('GET_TLS_STATUS_REQUEST');
export const getTlsStatusFailure = createAction('GET_TLS_STATUS_FAILURE'); export const getTlsStatusFailure = createAction('GET_TLS_STATUS_FAILURE');

View File

@@ -6,6 +6,8 @@ import endsWith from 'lodash/endsWith';
import escapeRegExp from 'lodash/escapeRegExp'; import escapeRegExp from 'lodash/escapeRegExp';
import React from 'react'; import React from 'react';
import { compose } from 'redux'; import { compose } from 'redux';
import type { Dispatch } from 'redux';
import intl from 'panel/common/intl';
import { import {
splitByNewLine, splitByNewLine,
sortClients, sortClients,
@@ -27,18 +29,16 @@ import { getTlsStatus } from './encryption';
import { apiClient } from '../api/Api'; import { apiClient } from '../api/Api';
import { addErrorToast, addNoticeToast, addSuccessToast } from './toasts'; import { addErrorToast, addNoticeToast, addSuccessToast } from './toasts';
import { getFilteringStatus, setRules } from './filtering'; import { getFilteringStatus, setRules } from './filtering';
import type { Dispatch } from 'redux';
import intl from 'panel/common/intl';
export const toggleSettingStatus = createAction<{
settingKey: keyof typeof SETTINGS_NAMES;
value?: boolean | SafeSearchConfig;
}>('SETTING_STATUS_TOGGLE');
export const showSettingsFailure = createAction('SETTINGS_FAILURE_SHOW');
type SafeSearchConfig = Record<string, boolean> & { enabled: boolean }; type SafeSearchConfig = Record<string, boolean> & { enabled: boolean };
type ToggleSettingKey = keyof typeof SETTINGS_NAMES; type ToggleSettingKey = keyof typeof SETTINGS_NAMES;
export const toggleSettingStatus = createAction<{
settingKey: ToggleSettingKey;
value?: boolean | SafeSearchConfig;
}>('SETTING_STATUS_TOGGLE');
export const showSettingsFailure = createAction('SETTINGS_FAILURE_SHOW');
/** /**
* *
* @param {*} settingKey = SETTINGS_NAMES * @param {*} settingKey = SETTINGS_NAMES

View File

@@ -1,11 +1,11 @@
import { createAction } from 'redux-actions'; import { createAction } from 'redux-actions';
import intl from 'panel/common/intl';
import { apiClient } from '../api/Api'; import { apiClient } from '../api/Api';
import { normalizeLogs } from '../helpers/helpers'; import { normalizeLogs } from '../helpers/helpers';
import { DEFAULT_LOGS_FILTER, QUERY_LOGS_PAGE_LIMIT } from '../helpers/constants'; import { DEFAULT_LOGS_FILTER, QUERY_LOGS_PAGE_LIMIT } from '../helpers/constants';
import { addErrorToast, addSuccessToast } from './toasts'; import { addErrorToast, addSuccessToast } from './toasts';
import intl from 'panel/common/intl';
type SearchFormValues = { type SearchFormValues = {
search: string; search: string;

View File

@@ -1,9 +1,9 @@
import { createAction } from 'redux-actions'; import { createAction } from 'redux-actions';
import intl from 'panel/common/intl';
import { apiClient } from '../api/Api'; import { apiClient } from '../api/Api';
import { normalizeTopStats, secondsToMilliseconds, getParamsForClientsSearch, addClientInfo } from '../helpers/helpers'; import { normalizeTopStats, secondsToMilliseconds, getParamsForClientsSearch, addClientInfo } from '../helpers/helpers';
import { addErrorToast, addSuccessToast } from './toasts'; import { addErrorToast, addSuccessToast } from './toasts';
import intl from 'panel/common/intl';
export const getStatsConfigRequest = createAction('GET_STATS_CONFIG_REQUEST'); export const getStatsConfigRequest = createAction('GET_STATS_CONFIG_REQUEST');
export const getStatsConfigFailure = createAction('GET_STATS_CONFIG_FAILURE'); export const getStatsConfigFailure = createAction('GET_STATS_CONFIG_FAILURE');

View File

@@ -1,4 +1,4 @@
import React, { ChangeEvent, ComponentProps, MouseEvent, ReactNode } from 'react'; import React, { ComponentProps, MouseEvent, ReactNode } from 'react';
import cn from 'clsx'; import cn from 'clsx';
import theme from 'panel/lib/theme'; import theme from 'panel/lib/theme';
import { Icon } from 'panel/common/ui/Icon'; import { Icon } from 'panel/common/ui/Icon';

View File

@@ -1,4 +1,4 @@
import React, { ChangeEvent, ComponentProps, forwardRef, type ReactNode, useState } from 'react'; import React, { ComponentProps, forwardRef, type ReactNode, useState } from 'react';
import cn from 'clsx'; import cn from 'clsx';
import s from './Input.module.pcss'; import s from './Input.module.pcss';

View File

@@ -1,8 +1,8 @@
import React from 'react'; import React from 'react';
import cn from 'clsx'; import cn from 'clsx';
import s from './Radio.module.pcss';
import { Icon } from 'panel/common/ui/Icon'; import { Icon } from 'panel/common/ui/Icon';
import s from './Radio.module.pcss';
type Props<T> = { type Props<T> = {
className?: string; className?: string;

View File

@@ -22,8 +22,8 @@ export type ISelectValue<T, Multi extends boolean> = Multi extends true ? IOptio
const CustomMenuList = < const CustomMenuList = <
T, T,
Multi extends boolean, Multi extends boolean,
Group extends GroupBase<IOption<T> & ExtendOption>,
ExtendOption extends Record<string, any>, ExtendOption extends Record<string, any>,
Group extends GroupBase<IOption<T> & ExtendOption>,
>( >(
props: MenuListProps<IOption<T> & ExtendOption, Multi, Group>, props: MenuListProps<IOption<T> & ExtendOption, Multi, Group>,
): React.ReactElement => { ): React.ReactElement => {
@@ -45,8 +45,8 @@ const CustomMenuList = <
interface SelectProps< interface SelectProps<
T, T,
Multi extends boolean, Multi extends boolean,
Group extends GroupBase<IOption<T> & ExtendOption>,
ExtendOption extends Record<string, any>, ExtendOption extends Record<string, any>,
Group extends GroupBase<IOption<T> & ExtendOption>,
> { > {
size?: ISelectSize; size?: ISelectSize;
height?: ISelectHeight; height?: ISelectHeight;
@@ -84,7 +84,7 @@ interface SelectProps<
export const Select = < export const Select = <
T, T,
Multi extends boolean = false, Multi extends boolean = false,
ExtendOption extends Record<any, any> = {}, ExtendOption extends Record<any, any> = object,
Group extends GroupBase<IOption<T> & ExtendOption> = GroupBase<IOption<T> & ExtendOption>, Group extends GroupBase<IOption<T> & ExtendOption> = GroupBase<IOption<T> & ExtendOption>,
>({ >({
autoFocus, autoFocus,
@@ -118,7 +118,7 @@ export const Select = <
isDropdownSelect, isDropdownSelect,
onMenuOpen, onMenuOpen,
onMenuClose, onMenuClose,
}: SelectProps<T, Multi, Group, ExtendOption>) => { }: SelectProps<T, Multi, ExtendOption, Group>) => {
const selectClass = cn( const selectClass = cn(
{ 'desktop-select-always': mobile === false }, { 'desktop-select-always': mobile === false },
{ 'mobile-select-always': mobile }, { 'mobile-select-always': mobile },

View File

@@ -51,4 +51,4 @@ export const Switch = forwardRef(
}, },
); );
export default Switch; Switch.displayName = 'Switch';

View File

@@ -53,3 +53,5 @@ export const Textarea = forwardRef<HTMLTextAreaElement, Props>(
</div> </div>
), ),
); );
Textarea.displayName = 'Textarea';

View File

@@ -5,6 +5,7 @@ import cn from 'clsx';
import theme from 'panel/lib/theme'; import theme from 'panel/lib/theme';
import { Dropdown } from 'panel/common/ui/Dropdown'; import { Dropdown } from 'panel/common/ui/Dropdown';
import { Icon } from 'panel/common/ui/Icon'; import { Icon } from 'panel/common/ui/Icon';
import intl, { LocalesType } from 'panel/common/intl';
import { REPOSITORY, PRIVACY_POLICY_LINK, THEMES } from '../../../helpers/constants'; import { REPOSITORY, PRIVACY_POLICY_LINK, THEMES } from '../../../helpers/constants';
import { LANGUAGES } from '../../../helpers/twosky'; import { LANGUAGES } from '../../../helpers/twosky';
@@ -13,7 +14,6 @@ import { changeTheme, changeLanguage as changeLanguageAction } from '../../../ac
import { RootState } from '../../../initialState'; import { RootState } from '../../../initialState';
import s from './styles.module.pcss'; import s from './styles.module.pcss';
import intl, { LocalesType } from 'panel/common/intl';
const linksData = [ const linksData = [
{ {

View File

@@ -328,23 +328,23 @@ export const Icons = memo(() => (
r="9" r="9"
transform="matrix(1 0 0 -1 3 21)" transform="matrix(1 0 0 -1 3 21)"
stroke="currentColor" stroke="currentColor"
stroke-width="1.5" strokeWidth="1.5"
stroke-linecap="round" strokeLinecap="round"
stroke-linejoin="round" strokeLinejoin="round"
/> />
<path <path
d="M12 8V14" d="M12 8V14"
stroke="currentColor" stroke="currentColor"
stroke-width="1.5" strokeWidth="1.5"
stroke-linecap="round" strokeLinecap="round"
stroke-linejoin="round" strokeLinejoin="round"
/> />
<path <path
d="M11.997 16.4045C12.009 16.4025 11.997 16.5955 11.997 16.5955" d="M11.997 16.4045C12.009 16.4025 11.997 16.5955 11.997 16.5955"
stroke="currentColor" stroke="currentColor"
stroke-width="1.5" strokeWidth="1.5"
stroke-linecap="round" strokeLinecap="round"
stroke-linejoin="round" strokeLinejoin="round"
/> />
</symbol> </symbol>
</svg> </svg>

View File

@@ -36,7 +36,7 @@ export const Menu = ({ headerMenu }: Props) => {
return false; return false;
} }
const normalizedPath = p.endsWith('/') ? p : p + '/'; const normalizedPath = p.endsWith('/') ? p : `${p}/`;
return currentPath.startsWith(normalizedPath); return currentPath.startsWith(normalizedPath);
}); });
}; };

View File

@@ -7,18 +7,16 @@ import { Sidebar } from 'panel/common/ui/Sidebar';
import { Icons } from 'panel/common/ui/Icons'; import { Icons } from 'panel/common/ui/Icons';
import { Footer } from 'panel/common/ui/Footer'; import { Footer } from 'panel/common/ui/Footer';
import { Header } from 'panel/common/ui/Header'; import { Header } from 'panel/common/ui/Header';
import Settings from 'panel/containers/Settings';
import Toasts from '../Toasts'; import Toasts from '../Toasts';
import i18n from '../../i18n'; import i18n from '../../i18n';
import { THEMES } from '../../helpers/constants'; import { THEMES } from '../../helpers/constants';
import { setHtmlLangAttr, setUITheme } from '../../helpers/helpers'; import { setHtmlLangAttr, setUITheme } from '../../helpers/helpers';
import { changeLanguage, getDnsStatus, getTimerStatus } from '../../actions'; import { changeLanguage, getDnsStatus, getTimerStatus } from '../../actions';
import { RootState } from '../../initialState'; import { RootState } from '../../initialState';
import s from './styles.module.pcss'; import s from './styles.module.pcss';
import Settings from 'panel/containers/Settings';
type RouteConfig = { type RouteConfig = {
path: string; path: string;

View File

@@ -3,16 +3,15 @@ import { Controller, type Control, type UseFormSetValue } from 'react-hook-form'
import cn from 'clsx'; import cn from 'clsx';
import { Textarea } from 'panel/common/controls/Textarea'; import { Textarea } from 'panel/common/controls/Textarea';
import { SwitchGroup } from '../SettingsGroup';
import intl from 'panel/common/intl'; import intl from 'panel/common/intl';
import { trimLinesAndRemoveEmpty } from 'panel/helpers/helpers'; import { trimLinesAndRemoveEmpty } from 'panel/helpers/helpers';
import s from './styles.module.pcss';
import { Dropdown } from 'panel/common/ui/Dropdown'; import { Dropdown } from 'panel/common/ui/Dropdown';
import theme from 'panel/lib/theme'; import theme from 'panel/lib/theme';
import { Icon } from 'panel/common/ui/Icon'; import { Icon } from 'panel/common/ui/Icon';
import s from './styles.module.pcss';
import { SwitchGroup } from '../SettingsGroup';
type Props = { type Props = {
control: Control<any>; control: Control<any>;
processing: boolean; processing: boolean;

View File

@@ -1,10 +1,10 @@
import React, { useState } from 'react'; import React, { useState } from 'react';
import { Form, FormValues } from './Form';
import { ConfirmDialog } from 'panel/common/ui/ConfirmDialog'; import { ConfirmDialog } from 'panel/common/ui/ConfirmDialog';
import intl from 'panel/common/intl'; import intl from 'panel/common/intl';
import { HOUR } from 'panel/helpers/constants'; import { HOUR } from 'panel/helpers/constants';
import { formatIntervalText } from 'panel/components/Settings/helpers'; import { formatIntervalText } from 'panel/components/Settings/helpers';
import { Form, FormValues } from './Form';
export type LogsConfigPayload = { export type LogsConfigPayload = {
enabled: boolean; enabled: boolean;

View File

@@ -1,10 +1,10 @@
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';
import { getIntervalTitle } from '../helpers';
import { Controller, useForm } from 'react-hook-form'; import { Controller, useForm } from 'react-hook-form';
import { Button } from 'panel/common/ui/Button'; import { Button } from 'panel/common/ui/Button';
import intl from 'panel/common/intl'; import intl from 'panel/common/intl';
import theme from 'panel/lib/theme'; import theme from 'panel/lib/theme';
import { getIntervalTitle } from '../helpers';
import { STATS_INTERVALS_DAYS, DAY, RETENTION_CUSTOM } from '../../../helpers/constants'; import { STATS_INTERVALS_DAYS, DAY, RETENTION_CUSTOM } from '../../../helpers/constants';
import { RadioGroup, SwitchGroup } from '../SettingsGroup'; import { RadioGroup, SwitchGroup } from '../SettingsGroup';

View File

@@ -1,11 +1,11 @@
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { useDispatch } from 'react-redux'; import { useDispatch } from 'react-redux';
import { Icon } from 'panel/common/ui/Icon';
import cn from 'clsx';
import { TOAST_TIMEOUTS } from '../../helpers/constants'; import { TOAST_TIMEOUTS } from '../../helpers/constants';
import { removeToast } from '../../actions'; import { removeToast } from '../../actions';
import { Icon } from 'panel/common/ui/Icon';
import s from './styles.module.pcss'; import s from './styles.module.pcss';
import cn from 'clsx';
interface ToastProps { interface ToastProps {
id: string; id: string;

View File

@@ -1,9 +1,9 @@
import React from 'react'; import React from 'react';
import theme from 'panel/lib/theme';
import { getIpList, getDnsAddress, getWebAddress } from '../../helpers/helpers'; import { getIpList, getDnsAddress, getWebAddress } from '../../helpers/helpers';
import { ALL_INTERFACES_IP } from '../../helpers/constants'; import { ALL_INTERFACES_IP } from '../../helpers/constants';
import { InstallInterface } from '../../initialState'; import { InstallInterface } from '../../initialState';
import theme from 'panel/lib/theme';
interface renderItemProps { interface renderItemProps {
ip: string; ip: string;

View File

@@ -1,9 +1,9 @@
import React from 'react'; import React from 'react';
import { Controller, useForm } from 'react-hook-form'; import { Controller, useForm } from 'react-hook-form';
import { Trans, useTranslation } from 'react-i18next'; import { Trans, useTranslation } from 'react-i18next';
import { Input } from 'panel/common/controls/Input';
import Controls from './Controls'; import Controls from './Controls';
import { validatePasswordLength, validateRequiredValue } from '../../helpers/validators'; import { validatePasswordLength, validateRequiredValue } from '../../helpers/validators';
import { Input } from 'panel/common/controls/Input';
type AuthFormValues = { type AuthFormValues = {
username: string; username: string;

View File

@@ -2,8 +2,8 @@ import React, { Component } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { Trans } from 'react-i18next'; import { Trans } from 'react-i18next';
import * as actionCreators from '../../actions/install';
import { Button } from 'panel/common/ui/Button'; import { Button } from 'panel/common/ui/Button';
import * as actionCreators from '../../actions/install';
interface ControlsProps { interface ControlsProps {
install: { install: {

View File

@@ -3,6 +3,7 @@ import { useForm, Controller } from 'react-hook-form';
import { Trans, useTranslation } from 'react-i18next'; import { Trans, useTranslation } from 'react-i18next';
import i18n from 'i18next'; import i18n from 'i18next';
import { Input } from 'panel/common/controls/Input';
import Controls from './Controls'; import Controls from './Controls';
import AddressList from './AddressList'; import AddressList from './AddressList';
@@ -21,7 +22,6 @@ import {
import { validateRequiredValue } from '../../helpers/validators'; import { validateRequiredValue } from '../../helpers/validators';
import { InstallInterface } from '../../initialState'; import { InstallInterface } from '../../initialState';
import { toNumber } from '../../helpers/form'; import { toNumber } from '../../helpers/form';
import { Input } from 'panel/common/controls/Input';
const validateInstallPort = (value: number) => { const validateInstallPort = (value: number) => {
if (value < MIN_PORT || value > MAX_PORT) { if (value < MIN_PORT || value > MAX_PORT) {