diff --git a/web/src/queries/storage.ts b/web/src/queries/storage.ts index d37c7035d8..a6a53b7a48 100644 --- a/web/src/queries/storage.ts +++ b/web/src/queries/storage.ts @@ -51,6 +51,7 @@ import { Volume, VolumeTarget, } from "~/types/storage"; +import * as ConfigModel from "~/storage/model/config"; import { QueryHookOptions } from "~/types/queries"; @@ -149,6 +150,18 @@ const useConfigMutation = () => { return useMutation(query); }; +/** + * Hook that returns the config devices. + */ +const useConfigDevices = (options?: QueryHookOptions): ConfigModel.Device[] => { + const config = useConfig(options); + const solvedConfig = useSolvedConfig(options); + + if (!config || !solvedConfig) return []; + + return ConfigModel.generate(config, solvedConfig); +}; + /** * Hook that returns the list of storage devices for the given scope. * @@ -334,6 +347,7 @@ export { useConfig, useSolvedConfig, useConfigMutation, + useConfigDevices, useDevices, useAvailableDevices, useProductParams,