Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions service/lib/agama/dbus/storage/manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,6 @@ def configure(serialized_product, serialized_config)
next_progress_step(CONFIGURING_STEP)
config_json = JSON.parse(serialized_config, symbolize_names: true)

# If config_json is nil, calculate_proposal re-calculates the proposal with the current
# config. We could skip that re-calculation if system_changed is false, but that's a
# pretty theoretical case (the method was called with an unchanged product configuration
# and with no storage configuration).
calculate_proposal(config_json)

finish_progress
Expand Down
9 changes: 7 additions & 2 deletions web/src/hooks/api/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import { useCallback } from "react";
import { useSuspenseQuery } from "@tanstack/react-query";
import { getExtendedConfig } from "~/api";
import { getConfig, getExtendedConfig } from "~/api";
import { useSystem } from "~/hooks/api/system";
import type { system } from "~/api";
import type { Config } from "~/api/config";
Expand All @@ -32,6 +32,11 @@ const extendedConfigQuery = {
queryFn: getExtendedConfig,
};

const configQuery = {
queryKey: ["config"],
queryFn: getConfig,
};

function useExtendedConfig(): Config | null {
return useSuspenseQuery(extendedConfigQuery)?.data;
}
Expand All @@ -52,5 +57,5 @@ function useProduct(): system.Product | null {
return data;
}

export { extendedConfigQuery, useExtendedConfig, useProduct };
export { configQuery, extendedConfigQuery, useExtendedConfig, useProduct };
export * as storage from "~/hooks/api/config/storage";
6 changes: 3 additions & 3 deletions web/src/hooks/api/config/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@
*/

import { useSuspenseQuery } from "@tanstack/react-query";
import { extendedConfigQuery } from "~/hooks/api/config";
import { configQuery } from "~/hooks/api/config";
import { putConfig, Response } from "~/api";
import type { Config } from "~/api/config";

const removeStorageConfig = (data: Config | null): Config =>
data ? { ...data, storage: null } : {};
data ? { ...data, storage: undefined } : {};

type ResetFn = () => Response;

function useReset(): ResetFn {
const { data } = useSuspenseQuery({
...extendedConfigQuery,
...configQuery,
select: removeStorageConfig,
});
return () => putConfig(data);
Expand Down
Loading