wowowowowo
This commit is contained in:
@@ -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({
|
||||
registryTypes: {
|
||||
type: Array,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
defineProps<{
|
||||
registryTypes: string[];
|
||||
}>();
|
||||
|
||||
const form = useForm({
|
||||
name: "",
|
||||
|
||||
118
resources/js/pages/registries/Edit.vue
Normal file
118
resources/js/pages/registries/Edit.vue
Normal file
@@ -0,0 +1,118 @@
|
||||
<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<{
|
||||
registry: Record<string, any>;
|
||||
registryTypes: string[];
|
||||
}>();
|
||||
|
||||
const form = useForm({
|
||||
name: props.registry.name,
|
||||
type: props.registry.type,
|
||||
url: props.registry.url,
|
||||
username: "",
|
||||
password: "",
|
||||
});
|
||||
|
||||
const destroyRegistry = (): void => {
|
||||
if (!window.confirm(`Delete ${props.registry.name}?`)) {
|
||||
return;
|
||||
}
|
||||
|
||||
router.delete(
|
||||
route("registries.destroy", {
|
||||
organisation: props.registry.organisation_id,
|
||||
registry: props.registry.id,
|
||||
}),
|
||||
);
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Head :title="`Edit ${registry.name}`" />
|
||||
|
||||
<AppLayout
|
||||
:breadcrumbs="[
|
||||
{
|
||||
title: 'Organisation',
|
||||
href: route('organisations.show', { organisation: $page.props.organisation.id }),
|
||||
},
|
||||
{ title: 'Edit Registry' },
|
||||
]"
|
||||
>
|
||||
<form
|
||||
class="flex h-full max-w-2xl flex-1 flex-col gap-5 p-4"
|
||||
@submit.prevent="
|
||||
form.put(
|
||||
route('registries.update', {
|
||||
organisation: $page.props.organisation.id,
|
||||
registry: registry.id,
|
||||
}),
|
||||
)
|
||||
"
|
||||
>
|
||||
<div>
|
||||
<h2 class="text-3xl font-bold tracking-tight">Edit Registry</h2>
|
||||
<p class="mt-1 text-sm text-muted-foreground">
|
||||
Leave password blank to keep the current credential.
|
||||
</p>
|
||||
</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="registryType in registryTypes" :key="registryType" :value="registryType">
|
||||
{{ registryType.replace("_", " ") }}
|
||||
</option>
|
||||
</select>
|
||||
<InputError :message="form.errors.type" />
|
||||
</div>
|
||||
|
||||
<div class="grid gap-2">
|
||||
<Label for="url">Registry URL</Label>
|
||||
<Input id="url" v-model="form.url" required />
|
||||
<InputError :message="form.errors.url" />
|
||||
</div>
|
||||
|
||||
<div class="grid gap-4 md:grid-cols-2">
|
||||
<div class="grid gap-2">
|
||||
<Label for="username">Username</Label>
|
||||
<Input id="username" v-model="form.username" autocomplete="username" />
|
||||
<InputError :message="form.errors.username" />
|
||||
</div>
|
||||
<div class="grid gap-2">
|
||||
<Label for="password">New password/token</Label>
|
||||
<Input
|
||||
id="password"
|
||||
v-model="form.password"
|
||||
type="password"
|
||||
autocomplete="new-password"
|
||||
/>
|
||||
<InputError :message="form.errors.password" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-wrap justify-between gap-2">
|
||||
<Button type="button" variant="destructive" @click="destroyRegistry">
|
||||
Delete registry
|
||||
</Button>
|
||||
<Button type="submit" :disabled="form.processing">Save registry</Button>
|
||||
</div>
|
||||
</form>
|
||||
</AppLayout>
|
||||
</template>
|
||||
118
resources/js/pages/registries/Index.vue
Normal file
118
resources/js/pages/registries/Index.vue
Normal file
@@ -0,0 +1,118 @@
|
||||
<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 { EyeIcon, PencilIcon, PlusIcon, Trash2Icon } from "lucide-vue-next";
|
||||
|
||||
defineProps<{
|
||||
registries: Record<string, any>[];
|
||||
}>();
|
||||
|
||||
const destroyRegistry = (registry: Record<string, any>): void => {
|
||||
if (!window.confirm(`Delete ${registry.name}?`)) {
|
||||
return;
|
||||
}
|
||||
|
||||
router.delete(
|
||||
route("registries.destroy", {
|
||||
organisation: route().params.organisation,
|
||||
registry: registry.id,
|
||||
}),
|
||||
);
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Head title="Registries" />
|
||||
|
||||
<AppLayout
|
||||
:breadcrumbs="[
|
||||
{
|
||||
title: 'Organisation',
|
||||
href: route('organisations.show', { organisation: $page.props.organisation.id }),
|
||||
},
|
||||
{ title: 'Registries' },
|
||||
]"
|
||||
>
|
||||
<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">Registries</h2>
|
||||
<p class="mt-1 text-sm text-muted-foreground">
|
||||
Container registries used for multi-server environment deployments.
|
||||
</p>
|
||||
</div>
|
||||
<Button
|
||||
:as="Link"
|
||||
:href="route('registries.create', { organisation: $page.props.organisation.id })"
|
||||
>
|
||||
<PlusIcon class="size-4" />
|
||||
Add registry
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Configured Registries</CardTitle>
|
||||
<CardDescription>{{ registries.length }} registries</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent class="grid gap-2">
|
||||
<div
|
||||
v-for="registry in registries"
|
||||
:key="registry.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">{{ registry.name }}</span>
|
||||
<Badge variant="outline">{{ registry.type?.replace("_", " ") }}</Badge>
|
||||
</div>
|
||||
<div class="mt-1 text-muted-foreground">
|
||||
{{ registry.url ?? "No registry URL configured" }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex gap-1">
|
||||
<Button
|
||||
:as="Link"
|
||||
size="iconxs"
|
||||
variant="ghost"
|
||||
:href="
|
||||
route('registries.show', {
|
||||
organisation: $page.props.organisation.id,
|
||||
registry: registry.id,
|
||||
})
|
||||
"
|
||||
>
|
||||
<EyeIcon class="size-3" />
|
||||
</Button>
|
||||
<Button
|
||||
:as="Link"
|
||||
size="iconxs"
|
||||
variant="ghost"
|
||||
:href="
|
||||
route('registries.edit', {
|
||||
organisation: $page.props.organisation.id,
|
||||
registry: registry.id,
|
||||
})
|
||||
"
|
||||
>
|
||||
<PencilIcon class="size-3" />
|
||||
</Button>
|
||||
<Button size="iconxs" variant="ghost" @click="destroyRegistry(registry)">
|
||||
<Trash2Icon class="size-3" />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-if="registries.length === 0"
|
||||
class="rounded-md border border-dashed p-4 text-sm text-muted-foreground"
|
||||
>
|
||||
No registries configured.
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</AppLayout>
|
||||
</template>
|
||||
118
resources/js/pages/registries/Show.vue
Normal file
118
resources/js/pages/registries/Show.vue
Normal file
@@ -0,0 +1,118 @@
|
||||
<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 } from "@inertiajs/vue3";
|
||||
import { PencilIcon } from "lucide-vue-next";
|
||||
|
||||
defineProps<{
|
||||
registry: Record<string, any>;
|
||||
artifactCount: number;
|
||||
environmentCount: number;
|
||||
artifacts: Record<string, any>;
|
||||
}>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Head :title="registry.name" />
|
||||
|
||||
<AppLayout
|
||||
:breadcrumbs="[
|
||||
{
|
||||
title: 'Organisation',
|
||||
href: route('organisations.show', { organisation: $page.props.organisation.id }),
|
||||
},
|
||||
{ title: registry.name },
|
||||
]"
|
||||
>
|
||||
<div class="flex h-full flex-1 flex-col gap-4 p-4">
|
||||
<div class="flex flex-wrap items-start justify-between gap-3">
|
||||
<div>
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<h2 class="text-3xl font-bold tracking-tight">{{ registry.name }}</h2>
|
||||
<Badge variant="outline">{{ registry.type.replace("_", " ") }}</Badge>
|
||||
</div>
|
||||
<p class="mt-1 text-sm text-muted-foreground">
|
||||
{{ registry.url ?? "No registry URL configured" }}
|
||||
</p>
|
||||
</div>
|
||||
<Button
|
||||
:as="Link"
|
||||
variant="secondary"
|
||||
:href="
|
||||
route('registries.edit', {
|
||||
organisation: $page.props.organisation.id,
|
||||
registry: registry.id,
|
||||
})
|
||||
"
|
||||
>
|
||||
<PencilIcon class="size-4" />
|
||||
Edit
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div class="grid gap-4 md:grid-cols-3">
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Artifacts</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent class="text-3xl font-semibold">{{ artifactCount }}</CardContent>
|
||||
</Card>
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Environments</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent class="text-3xl font-semibold">{{ environmentCount }}</CardContent>
|
||||
</Card>
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Credential</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent class="text-sm text-muted-foreground">
|
||||
Stored encrypted. Rotate it from registry settings.
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Published Artifacts</CardTitle>
|
||||
<CardDescription>
|
||||
Artifacts whose registry reference starts with this registry URL.
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent class="grid gap-2">
|
||||
<Link
|
||||
v-for="artifact in artifacts.data"
|
||||
:key="artifact.id"
|
||||
:href="
|
||||
route('build-artifacts.show', {
|
||||
organisation: $page.props.organisation.id,
|
||||
application: artifact.environment.application.id,
|
||||
environment: artifact.environment.id,
|
||||
artifact: artifact.id,
|
||||
})
|
||||
"
|
||||
class="rounded-md border p-3 text-sm hover:bg-muted/50"
|
||||
>
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<Badge variant="outline">{{ artifact.status }}</Badge>
|
||||
<span class="font-medium">{{ artifact.environment.name }}</span>
|
||||
<span class="text-muted-foreground">{{ artifact.commit_sha }}</span>
|
||||
</div>
|
||||
<p class="mt-1 text-muted-foreground">
|
||||
{{ artifact.registry_ref ?? "No registry ref" }}
|
||||
</p>
|
||||
</Link>
|
||||
<div
|
||||
v-if="artifacts.data.length === 0"
|
||||
class="rounded-md border border-dashed p-4 text-sm text-muted-foreground"
|
||||
>
|
||||
No artifacts have been published to this registry.
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</AppLayout>
|
||||
</template>
|
||||
Reference in New Issue
Block a user