Files
keystone/resources/js/pages/source-providers/Edit.vue
Harry Bayliss 85c44296ac
Some checks failed
CI / Tests (push) Failing after 56s
CI / Lint (push) Failing after 1m35s
Restructure UX and seed a fully simulated organisation
Rework the dashboard, environment topology view, header navigation, and
status rendering, and standardise selects on a shadcn-vue component.

Replace the thin database seeder with a SimulatedEnvironmentSeeder that
builds a fully wired, mostly-running organisation (ACTIVE server fleet,
managed + GHCR registries, Gitea source provider, ClipBin app with
production/staging environments, services, slices, endpoints, managed
variables, build artifacts, and a completed/in-progress/failed operations
history) so the new UI renders against realistic data.
2026-06-08 22:09:57 +01:00

108 lines
3.5 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 {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
import AppLayout from "@/layouts/AppLayout.vue";
import { Head, router, useForm } from "@inertiajs/vue3";
const props = defineProps<{
sourceProvider: Record<string, any>;
sourceProviderTypes: string[];
}>();
const form = useForm({
name: props.sourceProvider.name,
type: props.sourceProvider.type,
url: props.sourceProvider.url ?? "",
});
const destroySourceProvider = (): void => {
if (!window.confirm(`Delete ${props.sourceProvider.name}?`)) {
return;
}
router.delete(
route("source-providers.destroy", {
organisation: props.sourceProvider.organisation_id,
source_provider: props.sourceProvider.id,
}),
);
};
</script>
<template>
<Head :title="`Edit ${sourceProvider.name}`" />
<AppLayout
:breadcrumbs="[
{
title: 'Organisation',
href: route('organisations.show', { organisation: $page.props.organisation.id }),
},
{ title: 'Edit Source Provider' },
]"
>
<form
class="flex h-full max-w-2xl flex-1 flex-col gap-5 p-4"
@submit.prevent="
form.put(
route('source-providers.update', {
organisation: $page.props.organisation.id,
source_provider: sourceProvider.id,
}),
)
"
>
<div>
<h2 class="text-3xl font-bold tracking-tight">Edit Source Provider</h2>
</div>
<div class="grid gap-2">
<Label for="name">Name</Label>
<Input id="name" v-model="form.name" required />
<InputError :message="form.errors.name" />
</div>
<div class="grid gap-2">
<Label for="type">Type</Label>
<Select v-model="form.type">
<SelectTrigger id="type">
<SelectValue placeholder="Select type" />
</SelectTrigger>
<SelectContent>
<SelectItem
v-for="sourceProviderType in sourceProviderTypes"
:key="sourceProviderType"
:value="sourceProviderType"
>
{{ sourceProviderType.replace("_", " ") }}
</SelectItem>
</SelectContent>
</Select>
<InputError :message="form.errors.type" />
</div>
<div class="grid gap-2">
<Label for="url">Base URL</Label>
<Input id="url" v-model="form.url" placeholder="https://gitea.example.com" />
<InputError :message="form.errors.url" />
</div>
<div class="flex flex-wrap justify-between gap-2">
<Button type="button" variant="destructive" @click="destroySourceProvider">
Delete source provider
</Button>
<Button type="submit" :disabled="form.processing">Save source provider</Button>
</div>
</form>
</AppLayout>
</template>