clan-cli: Use machine object everywhere instead of name + flake
This commit is contained in:
@@ -22,7 +22,9 @@ export { clanList, setClanList };
|
||||
(async function () {
|
||||
const curr = activeURI();
|
||||
if (curr) {
|
||||
const result = await callApi("show_clan_meta", { uri: curr });
|
||||
const result = await callApi("show_clan_meta", {
|
||||
flake: { identifier: curr },
|
||||
});
|
||||
console.log("refetched meta for ", curr);
|
||||
if (result.status === "error") {
|
||||
result.errors.forEach((error) => {
|
||||
|
||||
@@ -52,7 +52,9 @@ export const Sidebar = (props: RouteSectionProps) => {
|
||||
queryFn: async () => {
|
||||
const curr = activeURI();
|
||||
if (curr) {
|
||||
const result = await callApi("show_clan_meta", { uri: curr });
|
||||
const result = await callApi("show_clan_meta", {
|
||||
flake: { identifier: curr },
|
||||
});
|
||||
console.log("refetched meta for ", curr);
|
||||
if (result.status === "error") throw new Error("Failed to fetch data");
|
||||
|
||||
|
||||
@@ -329,7 +329,9 @@ export const ClanDetails = () => {
|
||||
const clanQuery = createQuery(() => ({
|
||||
queryKey: [clan_dir, "inventory", "meta"],
|
||||
queryFn: async () => {
|
||||
const result = await callApi("show_clan_meta", { uri: clan_dir });
|
||||
const result = await callApi("show_clan_meta", {
|
||||
flake: { identifier: clan_dir },
|
||||
});
|
||||
if (result.status === "error") throw new Error("Failed to fetch data");
|
||||
return result.data;
|
||||
},
|
||||
|
||||
@@ -18,7 +18,9 @@ const ClanItem = (props: ClanItemProps) => {
|
||||
const details = createQuery(() => ({
|
||||
queryKey: [clan_dir, "meta"],
|
||||
queryFn: async () => {
|
||||
const result = await callApi("show_clan_meta", { uri: clan_dir });
|
||||
const result = await callApi("show_clan_meta", {
|
||||
flake: { identifier: clan_dir },
|
||||
});
|
||||
if (result.status === "error") throw new Error("Failed to fetch data");
|
||||
return result.data;
|
||||
},
|
||||
|
||||
@@ -117,8 +117,10 @@ const InstallMachine = (props: InstallMachineProps) => {
|
||||
if (shouldRunDisk) {
|
||||
setProgressText("Setting up disk ... (1/5)");
|
||||
const disk_response = await callApi("set_machine_disk_schema", {
|
||||
flake: { identifier: curr_uri },
|
||||
machine_name: props.name,
|
||||
machine: {
|
||||
flake: { identifier: curr_uri },
|
||||
name: props.name,
|
||||
},
|
||||
placeholders: diskValues.placeholders,
|
||||
schema_name: diskValues.schema,
|
||||
force: true,
|
||||
|
||||
@@ -37,10 +37,12 @@ export const DiskStep = (props: StepProps<DiskValues>) => {
|
||||
queryKey: [props.dir, props.machine_id, "disk_schemas"],
|
||||
queryFn: async () => {
|
||||
const result = await callApi("get_disk_schemas", {
|
||||
flake: {
|
||||
identifier: props.dir,
|
||||
machine: {
|
||||
flake: {
|
||||
identifier: props.dir,
|
||||
},
|
||||
name: props.machine_id,
|
||||
},
|
||||
machine_name: props.machine_id,
|
||||
});
|
||||
if (result.status === "error") throw new Error("Failed to fetch data");
|
||||
return result.data;
|
||||
|
||||
@@ -52,10 +52,12 @@ export const HWStep = (props: StepProps<HardwareValues>) => {
|
||||
queryKey: [props.dir, props.machine_id, "hw_report"],
|
||||
queryFn: async () => {
|
||||
const result = await callApi("show_machine_hardware_config", {
|
||||
flake: {
|
||||
identifier: props.dir,
|
||||
machine: {
|
||||
flake: {
|
||||
identifier: props.dir,
|
||||
},
|
||||
name: props.machine_id,
|
||||
},
|
||||
machine_name: props.machine_id,
|
||||
});
|
||||
if (result.status === "error") throw new Error("Failed to fetch data");
|
||||
return result.data;
|
||||
@@ -85,9 +87,13 @@ export const HWStep = (props: StepProps<HardwareValues>) => {
|
||||
setIsGenerating(true);
|
||||
const r = await callApi("generate_machine_hardware_info", {
|
||||
opts: {
|
||||
flake: { identifier: curr_uri },
|
||||
machine: props.machine_id,
|
||||
target_host: target,
|
||||
machine: {
|
||||
name: props.machine_id,
|
||||
override_target_host: target,
|
||||
flake: {
|
||||
identifier: curr_uri,
|
||||
},
|
||||
},
|
||||
backend: "nixos-facter",
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user