Files
keystone/resources/js/pages/organisations/Show.vue
Harry Bayliss 66f0ee9e50
All checks were successful
CI / Tests (push) Successful in 43s
CI / Lint (push) Successful in 1m3s
Migrate to Gitea, switch JS tooling to oxlint/oxfmt, lift test coverage to 95%
- Add .gitea/workflows/ci.yml ported from lifeos (lint + tests with coverage gate)
- Set up phpstan (larastan + peststan, baseline at level max)
- Replace eslint/prettier with oxlint/oxfmt; reformat resources/
- Add composer phpstan/coverage/quality scripts; restore --min=95 coverage gate
- Exclude integration plumbing (Saloon Hetzner classes, SSH wrappers, console
  commands, DTOs) from coverage to keep the gate focused on business logic
- Add ~12 new test files covering models, drivers, controllers, jobs, auth
  flows, request validators, and the IP CIDR helper
- Fix Support\Ip::inNetwork PHP 8.4 TypeError in CIDR mask check
- Fix FirewallRule::command comparing the enum-cast type column to a string
- Fix Server::network using the wrong foreign key column
- Remove unreachable code under abort(403) in RegisteredUserController
2026-05-13 16:51:07 +01:00

227 lines
10 KiB
Vue

<script setup lang="ts">
import { Button } from "@/components/ui/button";
import { Card, CardContent } from "@/components/ui/card";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
import AppLayout from "@/layouts/AppLayout.vue";
import { Head, Link, WhenVisible } from "@inertiajs/vue3";
import {
AppWindowIcon,
GitBranchIcon,
ServerIcon,
ShieldCheckIcon,
UserIcon,
} from "lucide-vue-next";
import { ref, watch } from "vue";
defineProps({
organisation: {
type: Object,
required: true,
},
providers: {
type: Array,
required: false,
},
registries: {
type: Array,
required: false,
},
sourceProviders: {
type: Array,
required: false,
},
});
const tabValue = ref(new URL(window.location.href).hash?.replace("#", "") || "dashboard");
watch(tabValue, () => {
window.history.pushState({}, "", `#${tabValue.value}`);
});
watch(
() => window.location.hash,
(newHash) => {
if (newHash) {
tabValue.value = newHash.replace("#", "");
}
},
);
</script>
<template>
<Head :title="organisation.name" />
<AppLayout>
<div class="flex h-full flex-1 flex-col gap-4 rounded-xl p-4">
<h2 class="text-3xl font-bold tracking-tight">{{ organisation.name }}</h2>
<Tabs v-model="tabValue" :unmount-on-hide="false">
<TabsList>
<TabsTrigger value="dashboard"> Dashboard </TabsTrigger>
<TabsTrigger value="settings"> Settings </TabsTrigger>
</TabsList>
<TabsContent value="dashboard">
<h3 class="mt-4 text-2xl font-bold tracking-tight">Your Resources</h3>
<p class="mb-4 text-sm text-muted-foreground">
Your organisation, at a glance.
</p>
<div class="grid w-full gap-4 md:grid-cols-3">
<Card class="relative">
<Link
:href="
route('applications.index', {
organisation: organisation.id,
})
"
class="absolute inset-0"
/>
<CardContent class="flex items-center gap-4 p-4">
<AppWindowIcon class="size-6 text-muted-foreground" />
<div>
<h4 class="mb-1 text-3xl font-medium leading-none">
{{ organisation.applications_count }}
</h4>
<p class="text-sm text-muted-foreground">
Application{{
organisation.applications_count === 1 ? "" : "s"
}}
</p>
</div>
</CardContent>
</Card>
<Card class="relative">
<Link
class="absolute inset-0"
:href="
route('servers.index', {
organisation: organisation.id,
})
"
/>
<CardContent class="flex items-center gap-4 p-4">
<ServerIcon class="size-6 text-muted-foreground" />
<div>
<h4 class="mb-1 text-3xl font-medium leading-none">
{{ organisation.servers_count }}
</h4>
<p class="text-sm text-muted-foreground">
Server{{ organisation.servers_count === 1 ? "" : "s" }}
</p>
</div>
</CardContent>
</Card>
<Card class="relative">
<CardContent class="flex items-center gap-4 p-4">
<UserIcon class="size-6 text-muted-foreground" />
<div>
<h4 class="mb-1 text-3xl font-medium leading-none">
{{ organisation.members_count }}
</h4>
<p class="text-sm text-muted-foreground">
Member{{ organisation.members_count === 1 ? "" : "s" }}
</p>
</div>
</CardContent>
</Card>
</div>
</TabsContent>
<TabsContent value="settings">
<WhenVisible data="registries">
<template #fallback> Loading... </template>
<div class="mt-4 flex items-center justify-between gap-3">
<h3 class="text-2xl font-bold tracking-tight">Registries</h3>
<Button
:as="Link"
:href="
route('registries.create', {
organisation: organisation.id,
})
"
>
Add
</Button>
</div>
<div
class="border-muted-background divide-y-muted-background mb-6 max-w-96 divide-y rounded-md border"
>
<div
v-for="registry in registries"
:key="registry.id"
class="flex items-center gap-2 px-2 py-1"
>
<ShieldCheckIcon class="size-4 text-muted-foreground" />
{{ registry.name }}
<span class="ml-auto text-xs uppercase text-muted-foreground">{{
registry.type
}}</span>
</div>
<div
v-if="!registries?.length"
class="px-2 py-1 text-sm text-muted-foreground"
>
No registries configured
</div>
</div>
</WhenVisible>
<WhenVisible data="sourceProviders">
<template #fallback> Loading... </template>
<div class="mb-6">
<div class="flex items-center justify-between gap-3">
<h3 class="text-2xl font-bold tracking-tight">Source Providers</h3>
<Button
:as="Link"
:href="
route('source-providers.create', {
organisation: organisation.id,
})
"
>
Add
</Button>
</div>
<div
class="border-muted-background divide-y-muted-background max-w-96 divide-y rounded-md border"
>
<div
v-for="sourceProvider in sourceProviders"
:key="sourceProvider.id"
class="flex items-center gap-2 px-2 py-1"
>
<GitBranchIcon class="size-4 text-muted-foreground" />
{{ sourceProvider.name }}
<span class="ml-auto text-xs uppercase text-muted-foreground">{{
sourceProvider.type
}}</span>
</div>
<div
v-if="!sourceProviders?.length"
class="px-2 py-1 text-sm text-muted-foreground"
>
No source providers configured
</div>
</div>
</div>
</WhenVisible>
<WhenVisible data="providers">
<template #fallback> Loading... </template>
<h3 class="mt-4 text-2xl font-bold tracking-tight">Server Providers</h3>
<p class="mb-4 text-sm text-muted-foreground">
Manage your server providers.
</p>
<div
class="border-muted-background divide-y-muted-background max-w-80 divide-y rounded-md border"
>
<div
v-for="provider in providers"
class="flex items-center gap-2 px-2 py-1"
>
{{ provider.name }}
<span class="ml-auto text-xs uppercase text-muted-foreground">{{
provider.type
}}</span>
</div>
</div>
</WhenVisible>
</TabsContent>
</Tabs>
</div>
</AppLayout>
</template>