mirror of
https://github.com/optim-enterprises-bv/OptimCloud-gw-ui.git
synced 2025-10-30 17:57:46 +00:00
[WIFI-13315] Wi-Fi analysis fixes
Signed-off-by: Charles <charles.bourque96@gmail.com>
This commit is contained in:
@@ -9,6 +9,7 @@ import { AxiosError } from 'models/Axios';
|
||||
import { DeviceRttyApiResponse, GatewayDevice, WifiScanCommand, WifiScanResult } from 'models/Device';
|
||||
import { Note } from 'models/Note';
|
||||
import { PageInfo } from 'models/Table';
|
||||
import { DeviceCommandHistory } from './Commands';
|
||||
|
||||
export const DEVICE_PLATFORMS = ['ALL', 'AP', 'SWITCH'] as const;
|
||||
export type DevicePlatform = (typeof DEVICE_PLATFORMS)[number];
|
||||
@@ -461,3 +462,29 @@ export const useDeleteDeviceBatch = () => {
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
export type PowerCyclePort = {
|
||||
/** Ex.: Ethernet0 */
|
||||
name: string;
|
||||
/** Cycle length in MS. Default is 10 000 */
|
||||
cycle?: number;
|
||||
};
|
||||
|
||||
export type PowerCycleRequest = {
|
||||
serial: string;
|
||||
when: number;
|
||||
ports: PowerCyclePort[];
|
||||
};
|
||||
|
||||
export const usePowerCycle = () => {
|
||||
const queryClient = useQueryClient();
|
||||
return useMutation(
|
||||
(request: PowerCycleRequest) =>
|
||||
axiosGw.post(`device/${request.serial}/powercycle`, request).then((res) => res.data as DeviceCommandHistory),
|
||||
{
|
||||
onSettled: () => {
|
||||
queryClient.invalidateQueries(['commands']);
|
||||
},
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user