import { DashboardModel } from '../../../domains/dashboarding/dashboard-model'; import { DataState } from '../../../shared/hooks/data-load-state-reducer.js'; import { HookEnableParam } from '../../../shared/hooks/types.js'; import { GetDashboardModelsOptions } from './get-dashboard-models.js'; /** * Parameters for {@link useGetDashboardModels} hook. */ export interface GetDashboardModelsParams extends GetDashboardModelsOptions, HookEnableParam { } /** * States of a dashboard models load. */ export type DashboardModelsState = DashboardModelsLoadingState | DashboardModelsErrorState | DashboardModelsSuccessState; /** * State of a dashboard models loading. */ export type DashboardModelsLoadingState = { /** Whether the dashboard models is loading */ isLoading: true; /** Whether the dashboard models load has failed */ isError: false; /** Whether the dashboard models load has succeeded */ isSuccess: false; /** The error if any occurred */ error: undefined; /** The result dashboard models if the load has succeeded */ dashboards: DashboardModel[] | undefined; /** The status of the dashboard models load */ status: 'loading'; }; /** * State of a dashboard models load that has failed. */ export type DashboardModelsErrorState = { /** Whether the dashboard models is loading */ isLoading: false; /** Whether the dashboard models load has failed */ isError: true; /** Whether the dashboard models load has succeeded */ isSuccess: false; /** The error if any occurred */ error: Error; /** The result dashboard models if the load has succeeded */ dashboards: undefined; /** The status of the dashboard models load */ status: 'error'; }; /** * State of a dashboard models load that has succeeded. */ export type DashboardModelsSuccessState = { /** Whether the dashboard models is loading */ isLoading: false; /** Whether the dashboard models load has failed */ isError: false; /** Whether the dashboard models load has succeeded */ isSuccess: true; /** The error if any occurred */ error: undefined; /** The result dashboard models if the load has succeeded */ dashboards: DashboardModel[]; /** The status of the dashboard models load */ status: 'success'; }; /** * React hook that retrieves existing dashboards that the user can access to from the Sisense instance. * * **Note:** Dashboard and Widget extensions based on JS scripts and add-ons in Fusion – for example, Blox and Jump To Dashboard – are not supported. * * @example ```tsx const { dashboards, isLoading, isError } = useGetDashboardModels(); if (isLoading) { return