wowowowowo
Some checks failed
CI / Lint (push) Failing after 22s
CI / Tests (push) Failing after 33s

This commit is contained in:
2026-05-28 15:15:41 +01:00
parent 8f603122e2
commit 5b977c1f41
129 changed files with 9943 additions and 722 deletions

View File

@@ -1,4 +1,4 @@
<script setup>
<script setup lang="ts">
import InputError from "@/components/InputError.vue";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
@@ -6,12 +6,9 @@ import { Label } from "@/components/ui/label";
import AppLayout from "@/layouts/AppLayout.vue";
import { Head, useForm } from "@inertiajs/vue3";
defineProps({
sourceProviderTypes: {
type: Array,
required: true,
},
});
defineProps<{
sourceProviderTypes: string[];
}>();
const form = useForm({
name: "",

View File

@@ -0,0 +1,99 @@
<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, 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
id="type"
v-model="form.type"
class="h-9 rounded-md border border-input bg-transparent px-3 text-sm"
>
<option
v-for="sourceProviderType in sourceProviderTypes"
:key="sourceProviderType"
:value="sourceProviderType"
>
{{ sourceProviderType.replace("_", " ") }}
</option>
</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>

View File

@@ -0,0 +1,115 @@
<script setup lang="ts">
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
import AppLayout from "@/layouts/AppLayout.vue";
import { Head, Link, router } from "@inertiajs/vue3";
import { PencilIcon, PlusIcon, Trash2Icon } from "lucide-vue-next";
defineProps<{
sourceProviders: Record<string, any>[];
}>();
const destroySourceProvider = (sourceProvider: Record<string, any>): void => {
if (!window.confirm(`Delete ${sourceProvider.name}?`)) {
return;
}
router.delete(
route("source-providers.destroy", {
organisation: route().params.organisation,
source_provider: sourceProvider.id,
}),
);
};
</script>
<template>
<Head title="Source Providers" />
<AppLayout
:breadcrumbs="[
{
title: 'Organisation',
href: route('organisations.show', { organisation: $page.props.organisation.id }),
},
{ title: 'Source Providers' },
]"
>
<div class="flex h-full flex-1 flex-col gap-4 p-4">
<div class="flex flex-wrap items-center justify-between gap-3">
<div>
<h2 class="text-3xl font-bold tracking-tight">Source Providers</h2>
<p class="mt-1 text-sm text-muted-foreground">
Git hosts used to classify application repository access.
</p>
</div>
<Button
:as="Link"
:href="
route('source-providers.create', {
organisation: $page.props.organisation.id,
})
"
>
<PlusIcon class="size-4" />
Add source provider
</Button>
</div>
<Card>
<CardHeader>
<CardTitle>Configured Source Providers</CardTitle>
<CardDescription>{{ sourceProviders.length }} providers</CardDescription>
</CardHeader>
<CardContent class="grid gap-2">
<div
v-for="sourceProvider in sourceProviders"
:key="sourceProvider.id"
class="flex flex-wrap items-center justify-between gap-3 rounded-md border p-3 text-sm"
>
<div>
<div class="flex flex-wrap items-center gap-2">
<span class="font-medium">{{ sourceProvider.name }}</span>
<Badge variant="outline">{{
sourceProvider.type?.replace("_", " ")
}}</Badge>
</div>
<div class="mt-1 text-muted-foreground">
{{ sourceProvider.url ?? "No base URL configured" }}
</div>
</div>
<div class="flex gap-1">
<Button
:as="Link"
size="iconxs"
variant="ghost"
:href="
route('source-providers.edit', {
organisation: $page.props.organisation.id,
source_provider: sourceProvider.id,
})
"
>
<PencilIcon class="size-3" />
</Button>
<Button
size="iconxs"
variant="ghost"
@click="destroySourceProvider(sourceProvider)"
>
<Trash2Icon class="size-3" />
</Button>
</div>
</div>
<div
v-if="sourceProviders.length === 0"
class="rounded-md border border-dashed p-4 text-sm text-muted-foreground"
>
No source providers configured.
</div>
</CardContent>
</Card>
</div>
</AppLayout>
</template>