Files
keystone/resources/js/pages/providers/Create.vue
Harry Bayliss 5b977c1f41
Some checks failed
CI / Lint (push) Failing after 22s
CI / Tests (push) Failing after 33s
wowowowowo
2026-05-28 15:15:41 +01:00

78 lines
2.6 KiB
Vue

<script setup lang="ts">
import InputError from "@/components/InputError.vue";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import AppLayout from "@/layouts/AppLayout.vue";
import { Head, useForm } from "@inertiajs/vue3";
defineProps<{
providerTypes: string[];
}>();
const form = useForm({
name: "",
type: "hetzner",
token: "",
});
</script>
<template>
<Head title="Add Server Provider" />
<AppLayout
:breadcrumbs="[
{
title: $page.props.organisation.name,
href: route('organisations.show', { organisation: $page.props.organisation.id }),
},
{ title: 'Add Server Provider' },
]"
>
<form
class="flex h-full max-w-2xl flex-1 flex-col gap-5 p-4"
@submit.prevent="
form.post(route('providers.store', { organisation: $page.props.organisation.id }))
"
>
<div>
<h2 class="text-3xl font-bold tracking-tight">Add Server Provider</h2>
<p class="mt-1 text-sm text-muted-foreground">
Provider credentials are encrypted and used to create servers and private
networks.
</p>
</div>
<div class="grid gap-2">
<Label for="name">Name</Label>
<Input id="name" v-model="form.name" required placeholder="Hetzner production" />
<InputError :message="form.errors.name" />
</div>
<div class="grid gap-2">
<Label for="type">Type</Label>
<select
id="type"
v-model="form.type"
class="h-9 rounded-md border border-input bg-transparent px-3 text-sm"
>
<option v-for="type in providerTypes" :key="type" :value="type">
{{ type.replace("-", " ") }}
</option>
</select>
<InputError :message="form.errors.type" />
</div>
<div class="grid gap-2">
<Label for="token">API token</Label>
<Input id="token" v-model="form.token" type="password" required />
<InputError :message="form.errors.token" />
</div>
<div class="flex justify-end">
<Button type="submit" :disabled="form.processing">Save provider</Button>
</div>
</form>
</AppLayout>
</template>