mirror of
https://github.com/optim-enterprises-bv/OptimCloud-gw-ui.git
synced 2025-11-02 03:07:46 +00:00
Merge pull request #134 from stephb9959/main
[WIFI-11749] Limiting device search bar input text length
This commit is contained in:
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "ucentral-client",
|
"name": "ucentral-client",
|
||||||
"version": "2.8.0(24)",
|
"version": "2.8.0(25)",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "ucentral-client",
|
"name": "ucentral-client",
|
||||||
"version": "2.8.0(24)",
|
"version": "2.8.0(25)",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@chakra-ui/icons": "^2.0.11",
|
"@chakra-ui/icons": "^2.0.11",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ucentral-client",
|
"name": "ucentral-client",
|
||||||
"version": "2.8.0(24)",
|
"version": "2.8.0(25)",
|
||||||
"description": "",
|
"description": "",
|
||||||
"private": true,
|
"private": true,
|
||||||
"main": "index.tsx",
|
"main": "index.tsx",
|
||||||
|
|||||||
@@ -5,9 +5,10 @@ import { randomIntId } from 'helpers/stringHelper';
|
|||||||
|
|
||||||
export type UseControllerDeviceSearchProps = {
|
export type UseControllerDeviceSearchProps = {
|
||||||
minLength?: number;
|
minLength?: number;
|
||||||
|
maxLength?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const useControllerDeviceSearch = ({ minLength = 4 }: UseControllerDeviceSearchProps) => {
|
export const useControllerDeviceSearch = ({ minLength = 4, maxLength = 12 }: UseControllerDeviceSearchProps) => {
|
||||||
const [tempValue, setTempValue] = useState('');
|
const [tempValue, setTempValue] = useState('');
|
||||||
const [waitingSearch, setWaitingSearch] = useState<
|
const [waitingSearch, setWaitingSearch] = useState<
|
||||||
{ command: string; serial_prefix: string; operatorId?: string } | undefined
|
{ command: string; serial_prefix: string; operatorId?: string } | undefined
|
||||||
@@ -31,7 +32,8 @@ export const useControllerDeviceSearch = ({ minLength = 4 }: UseControllerDevice
|
|||||||
);
|
);
|
||||||
const onChange = useCallback(
|
const onChange = useCallback(
|
||||||
(v: string) => {
|
(v: string) => {
|
||||||
if (v.length >= minLength) setWaitingSearch({ command: 'serial_number_search', serial_prefix: v });
|
if (v.length >= minLength || v.length <= maxLength)
|
||||||
|
setWaitingSearch({ command: 'serial_number_search', serial_prefix: v });
|
||||||
},
|
},
|
||||||
[setWaitingSearch],
|
[setWaitingSearch],
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ export const useStatisticsCard = ({ serialNumber }: Props) => {
|
|||||||
const onProgressChange = React.useCallback((newProgress: number) => {
|
const onProgressChange = React.useCallback((newProgress: number) => {
|
||||||
setProgress(newProgress);
|
setProgress(newProgress);
|
||||||
}, []);
|
}, []);
|
||||||
const getStats = useGetDeviceNewestStats({ serialNumber, limit: 100 });
|
const getStats = useGetDeviceNewestStats({ serialNumber, limit: 30 });
|
||||||
const getCustomStats = useGetDeviceStatsWithTimestamps({
|
const getCustomStats = useGetDeviceStatsWithTimestamps({
|
||||||
serialNumber,
|
serialNumber,
|
||||||
start: time ? Math.floor(time.start.getTime() / 1000) : undefined,
|
start: time ? Math.floor(time.start.getTime() / 1000) : undefined,
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ const WifiAnalysisAssocationsTable = ({ data, ouis }: Props) => {
|
|||||||
hiddenColumns={hiddenColumns}
|
hiddenColumns={hiddenColumns}
|
||||||
data={data ?? []}
|
data={data ?? []}
|
||||||
hideEmptyListText
|
hideEmptyListText
|
||||||
sortBy={data?.[0]?.radio?.band ? [{ id: 'index', desc: true }] : undefined}
|
sortBy={[{ id: 'index', desc: true }]}
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
hideControls
|
hideControls
|
||||||
showAllRows
|
showAllRows
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ const WifiAnalysisRadioTable = ({ data }: Props) => {
|
|||||||
hiddenColumns={hiddenColumns}
|
hiddenColumns={hiddenColumns}
|
||||||
data={data ?? []}
|
data={data ?? []}
|
||||||
obj={t('controller.devices.logs')}
|
obj={t('controller.devices.logs')}
|
||||||
sortBy={data?.[0]?.band ? [{ id: 'index', desc: true }] : undefined}
|
sortBy={[{ id: 'index', desc: true }]}
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
hideControls
|
hideControls
|
||||||
showAllRows
|
showAllRows
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ const parseAssociations = (data: { data: DeviceStatistics; recorded: number }, r
|
|||||||
const WifiAnalysisCard = ({ serialNumber }: Props) => {
|
const WifiAnalysisCard = ({ serialNumber }: Props) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [sliderIndex, setSliderIndex] = React.useState(0);
|
const [sliderIndex, setSliderIndex] = React.useState(0);
|
||||||
const getStats = useGetDeviceNewestStats({ serialNumber, limit: 100 });
|
const getStats = useGetDeviceNewestStats({ serialNumber, limit: 30 });
|
||||||
const parsedData = React.useMemo(() => {
|
const parsedData = React.useMemo(() => {
|
||||||
if (!getStats.data) return undefined;
|
if (!getStats.data) return undefined;
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ const DeviceSearchBar = () => {
|
|||||||
navigate(`/devices/${v.value}`);
|
navigate(`/devices/${v.value}`);
|
||||||
}, []);
|
}, []);
|
||||||
const onChange = React.useCallback((v: string) => {
|
const onChange = React.useCallback((v: string) => {
|
||||||
if (v.length === 0 || v.match('^[a-fA-F0-9-*]+$')) onInputChange(v);
|
if ((v.length === 0 || v.match('^[a-fA-F0-9-*]+$')) && v.length <= 13) onInputChange(v);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const onFocus = () => {
|
const onFocus = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user