1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-02 04:15:28 +02:00

feat(edge-devices): set specific page to view [EE-2082] (#6869)

This commit is contained in:
Chaim Lev-Ari 2022-05-23 10:57:22 +03:00 committed by GitHub
parent 12cddbd896
commit b031a30f62
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
54 changed files with 892 additions and 639 deletions

View file

@ -1,32 +0,0 @@
import { useEffect, useMemo } from 'react';
import { useQuery } from 'react-query';
import { getDevices } from '@/portainer/hostmanagement/open-amt/open-amt.service';
import { EnvironmentId } from '@/portainer/environments/types';
import PortainerError from '@/portainer/error';
import * as notifications from '@/portainer/services/notifications';
export function useAMTDevices(environmentId: EnvironmentId) {
const { isLoading, data, isError, error } = useQuery(
['amt_devices', environmentId],
() => getDevices(environmentId)
);
useEffect(() => {
if (isError) {
notifications.error(
'Failure',
error as Error,
'Failed retrieving AMT devices'
);
}
}, [isError, error]);
const devices = useMemo(() => data || [], [data]);
return {
isLoading,
devices,
error: isError ? (error as PortainerError) : undefined,
};
}