UI: add create machine suggestion

This commit is contained in:
Johannes Kirschbauer
2024-08-26 16:30:44 +02:00
parent 0f5062fa45
commit 3b48dfd2e0
2 changed files with 70 additions and 55 deletions

View File

@@ -59,7 +59,8 @@ export function CreateMachine() {
} }
}; };
return ( return (
<div class="px-1"> <div class="flex w-full justify-center">
<div class="mt-4 w-full max-w-3xl self-stretch px-2">
<span class="px-2">Create new Machine</span> <span class="px-2">Create new Machine</span>
<Form onSubmit={handleSubmit}> <Form onSubmit={handleSubmit}>
<Field <Field
@@ -101,8 +102,9 @@ export function CreateMachine() {
</> </>
)} )}
</Field> </Field>
<div class="mt-12 flex justify-end">
<button <button
class="btn btn-error float-right" class="btn btn-primary"
type="submit" type="submit"
classList={{ classList={{
"btn-disabled": formStore.submitting, "btn-disabled": formStore.submitting,
@@ -111,7 +113,8 @@ export function CreateMachine() {
<Switch <Switch
fallback={ fallback={
<> <>
<span class="loading loading-spinner loading-sm"></span>Creating <span class="loading loading-spinner loading-sm"></span>
Creating
</> </>
} }
> >
@@ -120,7 +123,9 @@ export function CreateMachine() {
</Match> </Match>
</Switch> </Switch>
</button> </button>
</div>
</Form> </Form>
</div> </div>
</div>
); );
} }

View File

@@ -113,7 +113,17 @@ export const MachineListView: Component = () => {
nixOnlyMachines()?.length === 0 nixOnlyMachines()?.length === 0
} }
> >
No machines found <div class="mt-8 flex w-full flex-col items-center justify-center gap-2">
<span class="text-lg text-neutral">
No machines defined yet. Click below to define one.
</span>
<button
class="btn btn-square btn-ghost size-28 overflow-hidden p-2"
onClick={() => navigate("/machines/create")}
>
<span class="material-icons text-6xl font-light">add</span>
</button>
</div>
</Match> </Match>
<Match when={!inventoryQuery.isLoading}> <Match when={!inventoryQuery.isLoading}>
<ul> <ul>