Refactor(cli): name set_inv_machine back to set_machine
We don't want to leak information about our internals Such as 'inv' meaning 'inventory' this is not important from the outside
This commit is contained in:
@@ -391,7 +391,7 @@ const MachineForm = (props: MachineDetailsProps) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const machine_response = await callApi("set_inv_machine", {
|
const machine_response = await callApi("update_machine", {
|
||||||
machine: {
|
machine: {
|
||||||
name: props.initialData.machine.name || "My machine",
|
name: props.initialData.machine.name || "My machine",
|
||||||
flake: {
|
flake: {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ from clan_cli.machines.machines import Machine
|
|||||||
|
|
||||||
|
|
||||||
@API.register
|
@API.register
|
||||||
def get_inv_machine(machine: Machine) -> InventoryMachine:
|
def get_machine(machine: Machine) -> InventoryMachine:
|
||||||
inventory_store = InventoryStore(flake=machine.flake)
|
inventory_store = InventoryStore(flake=machine.flake)
|
||||||
inventory = inventory_store.read()
|
inventory = inventory_store.read()
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ def get_inv_machine(machine: Machine) -> InventoryMachine:
|
|||||||
|
|
||||||
|
|
||||||
@API.register
|
@API.register
|
||||||
def set_inv_machine(machine: Machine, update: InventoryMachine) -> None:
|
def update_machine(machine: Machine, update: InventoryMachine) -> None:
|
||||||
assert machine.name == update.get("name", machine.name), "Machine name mismatch"
|
assert machine.name == update.get("name", machine.name), "Machine name mismatch"
|
||||||
inventory_store = InventoryStore(flake=machine.flake)
|
inventory_store = InventoryStore(flake=machine.flake)
|
||||||
inventory = inventory_store.read()
|
inventory = inventory_store.read()
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ from clan_lib.persist.inventory_store import InventoryStore
|
|||||||
from clan_cli.completions import add_dynamic_completer, complete_tags
|
from clan_cli.completions import add_dynamic_completer, complete_tags
|
||||||
from clan_cli.dirs import specific_machine_dir
|
from clan_cli.dirs import specific_machine_dir
|
||||||
from clan_cli.machines.hardware import HardwareConfig
|
from clan_cli.machines.hardware import HardwareConfig
|
||||||
from clan_cli.machines.inventory import get_inv_machine
|
from clan_cli.machines.inventory import get_machine
|
||||||
from clan_cli.machines.machines import Machine
|
from clan_cli.machines.machines import Machine
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@@ -61,7 +61,7 @@ def query_machines_by_tags(flake: Flake, tags: list[str]) -> dict[str, Machine]:
|
|||||||
|
|
||||||
filtered_machines = {}
|
filtered_machines = {}
|
||||||
for machine in machines.values():
|
for machine in machines.values():
|
||||||
inv_machine = get_inv_machine(machine)
|
inv_machine = get_machine(machine)
|
||||||
if all(tag in inv_machine["tags"] for tag in tags):
|
if all(tag in inv_machine["tags"] for tag in tags):
|
||||||
filtered_machines[machine.name] = machine
|
filtered_machines[machine.name] = machine
|
||||||
|
|
||||||
@@ -88,7 +88,7 @@ def extract_header(c: str) -> str:
|
|||||||
|
|
||||||
@API.register
|
@API.register
|
||||||
def get_machine_details(machine: Machine) -> MachineDetails:
|
def get_machine_details(machine: Machine) -> MachineDetails:
|
||||||
machine_inv = get_inv_machine(machine)
|
machine_inv = get_machine(machine)
|
||||||
hw_config = HardwareConfig.detect_type(machine)
|
hw_config = HardwareConfig.detect_type(machine)
|
||||||
|
|
||||||
machine_dir = specific_machine_dir(machine)
|
machine_dir = specific_machine_dir(machine)
|
||||||
|
|||||||
Reference in New Issue
Block a user