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,13 +1,21 @@
<script setup>
<script setup lang="ts">
import InputError from "@/components/InputError.vue";
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import AppLayout from "@/layouts/AppLayout.vue";
import { Head, useForm } from "@inertiajs/vue3";
import { Head, Link, useForm } from "@inertiajs/vue3";
defineProps<{
sourceProviders: Record<string, any>[];
repositoryTypes: Record<string, string>;
}>();
const form = useForm({
name: "",
source_provider_id: "",
repository_type: "git",
repository_url: "",
default_branch: "main",
environment_name: "production",
@@ -31,7 +39,7 @@ const form = useForm({
]"
>
<form
class="flex h-full max-w-2xl flex-1 flex-col gap-5 p-4"
class="flex h-full max-w-3xl flex-1 flex-col gap-5 p-4"
@submit.prevent="
form.post(
route('applications.store', { organisation: $page.props.organisation.id }),
@@ -42,6 +50,67 @@ const form = useForm({
<h2 class="text-3xl font-bold tracking-tight">Create Application</h2>
</div>
<Card>
<CardHeader>
<CardTitle>Repository access</CardTitle>
<CardDescription>
Keystone will generate a deploy key after creation.
</CardDescription>
</CardHeader>
<CardContent class="grid gap-3 text-sm">
<div class="grid gap-2">
<Label for="repository_type">Repository type</Label>
<select
id="repository_type"
v-model="form.repository_type"
class="h-9 rounded-md border border-input bg-transparent px-3 text-sm"
required
>
<option
v-for="(type, key) in repositoryTypes"
:key="key"
:value="type"
>
{{ type }}
</option>
</select>
<InputError :message="form.errors.repository_type" />
</div>
<div v-if="sourceProviders.length" class="grid gap-2">
<Label for="source_provider_id">Source provider</Label>
<select
id="source_provider_id"
v-model="form.source_provider_id"
class="h-9 rounded-md border border-input bg-transparent px-3 text-sm"
>
<option value="">No provider</option>
<option
v-for="provider in sourceProviders"
:key="provider.id"
:value="provider.id"
>
{{ provider.name }} · {{ provider.type }}
</option>
</select>
<InputError :message="form.errors.source_provider_id" />
</div>
<div v-else class="flex flex-wrap items-center justify-between gap-3 rounded-md border border-dashed p-3">
<span class="text-muted-foreground">
No source provider is configured yet. SSH URLs still work, but adding a
provider documents which Git host this repository belongs to.
</span>
<Button
:as="Link"
size="sm"
variant="secondary"
:href="route('source-providers.create', { organisation: $page.props.organisation.id })"
>
Add provider
</Button>
</div>
</CardContent>
</Card>
<div class="grid gap-2">
<Label for="name">Name</Label>
<Input

View File

@@ -0,0 +1,142 @@
<script setup lang="ts">
import InputError from "@/components/InputError.vue";
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
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<{
application: Record<string, any>;
repositoryTypes: Record<string, string>;
sourceProviders: Record<string, any>[];
}>();
const form = useForm({
name: props.application.name,
source_provider_id: props.application.source_provider_id ?? "",
repository_type: props.application.repository_type ?? "git",
repository_url: props.application.repository_url,
default_branch: props.application.default_branch,
});
const destroyApplication = (): void => {
if (!window.confirm(`Delete ${props.application.name}? This removes its environments too.`)) {
return;
}
router.delete(
route("applications.destroy", {
organisation: props.application.organisation_id,
application: props.application.id,
}),
);
};
</script>
<template>
<Head :title="`Edit ${application.name}`" />
<AppLayout
:breadcrumbs="[
{
title: 'Applications',
href: route('applications.index', { organisation: $page.props.organisation.id }),
},
{
title: application.name,
href: route('applications.show', {
organisation: $page.props.organisation.id,
application: application.id,
}),
},
{ title: 'Edit' },
]"
>
<form
class="flex h-full max-w-3xl flex-1 flex-col gap-5 p-4"
@submit.prevent="
form.put(
route('applications.update', {
organisation: $page.props.organisation.id,
application: application.id,
}),
)
"
>
<div>
<h2 class="text-3xl font-bold tracking-tight">Edit Application</h2>
<p class="mt-1 text-sm text-muted-foreground">
Update repository metadata used when resolving deploy targets.
</p>
</div>
<Card>
<CardHeader>
<CardTitle>Repository</CardTitle>
</CardHeader>
<CardContent class="grid gap-4">
<div class="grid gap-2">
<Label for="repository_type">Repository type</Label>
<select
id="repository_type"
v-model="form.repository_type"
class="h-9 rounded-md border border-input bg-transparent px-3 text-sm"
required
>
<option
v-for="(type, key) in repositoryTypes"
:key="key"
:value="type"
>
{{ type }}
</option>
</select>
<InputError :message="form.errors.repository_type" />
</div>
<div class="grid gap-2">
<Label for="source_provider_id">Source provider</Label>
<select
id="source_provider_id"
v-model="form.source_provider_id"
class="h-9 rounded-md border border-input bg-transparent px-3 text-sm"
>
<option value="">No provider</option>
<option
v-for="provider in sourceProviders"
:key="provider.id"
:value="provider.id"
>
{{ provider.name }} · {{ provider.type }}
</option>
</select>
<InputError :message="form.errors.source_provider_id" />
</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="repository_url">Repository SSH URL</Label>
<Input id="repository_url" v-model="form.repository_url" required />
<InputError :message="form.errors.repository_url" />
</div>
<div class="grid gap-2">
<Label for="default_branch">Default branch</Label>
<Input id="default_branch" v-model="form.default_branch" required />
<InputError :message="form.errors.default_branch" />
</div>
</CardContent>
</Card>
<div class="flex flex-wrap justify-between gap-2">
<Button type="button" variant="destructive" @click="destroyApplication">
Delete application
</Button>
<Button type="submit" :disabled="form.processing">Save changes</Button>
</div>
</form>
</AppLayout>
</template>

View File

@@ -1,15 +1,13 @@
<script setup>
<script setup lang="ts">
import { Button } from "@/components/ui/button";
import { Card, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
import AppLayout from "@/layouts/AppLayout.vue";
import { Head, Link } from "@inertiajs/vue3";
import { PlusIcon } from "lucide-vue-next";
const props = defineProps({
applications: {
type: [Object, null],
required: true,
},
});
defineProps<{
applications: Record<string, any>[];
}>();
</script>
<template>
@@ -26,7 +24,12 @@ const props = defineProps({
]"
>
<div class="flex items-center justify-between gap-3 p-4">
<h2 class="text-3xl font-bold tracking-tight">Applications</h2>
<div>
<h2 class="text-3xl font-bold tracking-tight">Applications</h2>
<p class="mt-1 text-sm text-muted-foreground">
Source repositories and their deployment environments.
</p>
</div>
<div>
<Button
:as="Link"
@@ -36,6 +39,7 @@ const props = defineProps({
})
"
>
<PlusIcon class="size-4" />
Create
</Button>
</div>
@@ -43,7 +47,7 @@ const props = defineProps({
<div class="grid gap-4 rounded-xl p-4 md:grid-cols-2 lg:grid-cols-3">
<Card
v-for="application in applications"
:key="`application{$applications.id}`"
:key="application.id"
class="relative w-full"
>
<CardHeader>
@@ -62,6 +66,28 @@ const props = defineProps({
class="absolute inset-0"
></Link>
</Card>
<Card v-if="applications.length === 0" class="md:col-span-2 lg:col-span-3">
<CardHeader>
<CardTitle>No applications yet</CardTitle>
<CardDescription>
Create an application to add the first environment, deploy key, and runtime
services.
</CardDescription>
<div>
<Button
:as="Link"
:href="
route('applications.create', {
organisation: $page.props.organisation.id,
})
"
>
<PlusIcon class="size-4" />
Create application
</Button>
</div>
</CardHeader>
</Card>
</div>
</AppLayout>
</template>

View File

@@ -2,22 +2,29 @@
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { Card, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import AppLayout from "@/layouts/AppLayout.vue";
import { Head, Link, router } from "@inertiajs/vue3";
import {
BoxesIcon,
ChevronDownIcon,
ExternalLinkIcon,
GitBranchIcon,
KeyRoundIcon,
PencilIcon,
PlusIcon,
RocketIcon,
} from "lucide-vue-next";
const props = defineProps({
application: {
type: Object,
required: true,
},
});
defineProps<{
application: Record<string, any>;
deploymentRequirements: Record<string, any>;
}>();
</script>
<template>
@@ -30,45 +37,122 @@ const props = defineProps({
href: route('applications.index', { organisation: $page.props.organisation.id }),
},
{
title: props.application.name,
title: application.name,
href: route('applications.show', {
organisation: $page.props.organisation.id,
application: props.application.id,
application: application.id,
}),
},
]"
>
<div class="flex h-full flex-1 flex-col gap-4 rounded-xl p-4">
<div class="flex items-center gap-3">
<h2 class="text-3xl font-bold tracking-tight">{{ application.name }}</h2>
<div>
<h2 class="text-3xl font-bold tracking-tight">{{ application.name }}</h2>
<p class="mt-1 text-sm text-muted-foreground">
{{ application.source_provider?.name ?? "No source provider" }} ·
{{ application.repository_type }}
</p>
</div>
<Button
:as="Link"
size="sm"
variant="secondary"
:href="
route('applications.edit', {
organisation: $page.props.organisation.id,
application: application.id,
})
"
>
<PencilIcon class="size-4" />
Edit
</Button>
</div>
<Card v-if="application.deploy_key_public && !application.deploy_key_installed_at">
<Card v-if="application.deploy_key_public">
<CardHeader>
<div class="flex items-start justify-between gap-4">
<div class="min-w-0 space-y-3">
<div class="flex items-center gap-2">
<KeyRoundIcon class="size-4" />
<CardTitle>Repository Deploy Key</CardTitle>
<Badge
:variant="
application.deploy_key_installed_at ? 'success' : 'secondary'
"
>
{{
application.deploy_key_installed_at
? "verified"
: "not verified"
}}
</Badge>
</div>
<div
v-if="application.deploy_key_fingerprint"
class="text-sm text-muted-foreground"
>
Fingerprint: {{ application.deploy_key_fingerprint }}
</div>
<pre
class="max-w-full overflow-x-auto rounded border bg-muted p-3 text-xs"
>{{ application.deploy_key_public }}</pre
>
</div>
<div class="flex shrink-0 flex-wrap gap-2">
<Button
variant="secondary"
@click="
router.post(
route('applications.deploy-key.rotate', {
organisation: $page.props.organisation.id,
application: application.id,
}),
)
"
>
<KeyRoundIcon class="size-4" />
Rotate key
</Button>
<Button
@click="
router.post(
route('applications.verify-repository', {
organisation: $page.props.organisation.id,
application: application.id,
}),
)
"
>
<GitBranchIcon class="size-4" />
Verify access
</Button>
</div>
</div>
</CardHeader>
</Card>
<Card v-if="deploymentRequirements.registryRequired">
<CardHeader>
<div class="flex flex-wrap items-center justify-between gap-3">
<div>
<CardTitle>Registry required before deployment</CardTitle>
<CardDescription>
This organisation has {{ deploymentRequirements.serverCount }}
servers and no registry. Multi-server deployments need a registry
so every server can pull the same build artifact.
</CardDescription>
</div>
<Button
class="shrink-0"
@click="
router.post(
route('applications.verify-repository', {
organisation: $page.props.organisation.id,
application: application.id,
}),
)
:as="Link"
:href="
route('registries.create', {
organisation: $page.props.organisation.id,
})
"
>
<GitBranchIcon class="size-4" />
Verify
Configure registry
</Button>
</div>
</CardHeader>
@@ -77,6 +161,19 @@ const props = defineProps({
<div>
<div class="mb-3 flex items-center justify-between">
<h3 class="text-2xl font-semibold tracking-tight">Environments</h3>
<Button
:as="Link"
size="sm"
:href="
route('environments.create', {
organisation: $page.props.organisation.id,
application: application.id,
})
"
>
<PlusIcon class="size-4" />
Add environment
</Button>
</div>
<div class="grid gap-4 md:grid-cols-2 lg:grid-cols-3">
<Card
@@ -103,6 +200,38 @@ const props = defineProps({
Branch: {{ environment.branch }} &bull;
{{ environment.services?.length ?? 0 }} services
</CardDescription>
<div class="mt-3 grid gap-1 text-sm text-muted-foreground">
<div>
Last deploy:
{{
environment.operations?.[0]?.finished_at ??
environment.operations?.[0]?.created_at ??
"never"
}}
</div>
<div>
Current commit:
{{
environment.services?.find(
(service) => service.desired_revision,
)?.desired_revision ?? "unknown"
}}
</div>
<div>
Current image:
{{
environment.services?.find(
(service) =>
service.current_image_digest ||
service.available_image_digest,
)?.current_image_digest ??
environment.services?.find(
(service) => service.available_image_digest,
)?.available_image_digest ??
"unknown"
}}
</div>
</div>
<div
v-if="environment.variables?.length"
class="mt-3 flex flex-wrap gap-2"
@@ -120,7 +249,7 @@ const props = defineProps({
</Badge>
</div>
</div>
<div class="flex shrink-0 gap-2">
<div class="flex shrink-0 flex-wrap gap-2">
<Button
:as="Link"
size="xs"
@@ -138,6 +267,12 @@ const props = defineProps({
</Button>
<Button
size="xs"
:disabled="deploymentRequirements.registryRequired"
:title="
deploymentRequirements.registryRequired
? 'Configure a registry before deploying to multiple servers.'
: undefined
"
@click="
router.post(
route('environment-deployments.store', {
@@ -151,63 +286,93 @@ const props = defineProps({
<RocketIcon class="size-4" />
Deploy
</Button>
<Button
size="xs"
variant="secondary"
@click="
router.post(
route('environment-migrations.store', {
organisation: $page.props.organisation.id,
application: application.id,
environment: environment.id,
}),
)
"
>
Migrate
</Button>
<Button
:as="Link"
size="xs"
variant="secondary"
:href="
route('environment-variables.create', {
organisation: $page.props.organisation.id,
application: application.id,
environment: environment.id,
})
"
>
Env
</Button>
<Button
size="xs"
variant="secondary"
@click="
router.post(
route('environment-workers.store', {
organisation: $page.props.organisation.id,
application: application.id,
environment: environment.id,
}),
)
"
>
Worker
</Button>
<Button
:as="Link"
size="xs"
:href="
route('environment-attachments.create', {
organisation: $page.props.organisation.id,
application: application.id,
environment: environment.id,
})
"
>
Attach
</Button>
<DropdownMenu>
<DropdownMenuTrigger :as-child="true">
<Button size="xs" variant="secondary">
More
<ChevronDownIcon class="size-4" />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
<DropdownMenuItem
:as="Link"
:href="
route('environments.edit', {
organisation: $page.props.organisation.id,
application: application.id,
environment: environment.id,
})
"
>
Settings
</DropdownMenuItem>
<DropdownMenuItem
@click="
router.post(
route('environment-migrations.store', {
organisation: $page.props.organisation.id,
application: application.id,
environment: environment.id,
}),
)
"
>
Migrate
</DropdownMenuItem>
<DropdownMenuItem
:as="Link"
:href="
route('environment-variables.create', {
organisation: $page.props.organisation.id,
application: application.id,
environment: environment.id,
})
"
>
Variables
</DropdownMenuItem>
<DropdownMenuItem
@click="
router.post(
route('environment-workers.store', {
organisation: $page.props.organisation.id,
application: application.id,
environment: environment.id,
}),
)
"
>
Add worker
</DropdownMenuItem>
<DropdownMenuItem
:as="Link"
:href="
route('environment-attachments.create', {
organisation: $page.props.organisation.id,
application: application.id,
environment: environment.id,
})
"
>
Attach service
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
</div>
</div>
<div
v-if="environment.build_artifacts?.length"
class="mt-4 grid gap-2 rounded-md bg-muted/40 p-3 text-sm"
>
<div class="font-medium">Recent builds</div>
<div
v-for="artifact in environment.build_artifacts"
:key="artifact.id"
class="flex flex-wrap items-center gap-2 text-muted-foreground"
>
<Badge variant="outline">{{ artifact.status }}</Badge>
<span>{{ artifact.commit_sha }}</span>
<span v-if="artifact.image_digest">{{ artifact.image_digest }}</span>
</div>
</div>
</CardHeader>