Firewall rules wip, server show improved
This commit is contained in:
16
resources/js/components/ui/badge/Badge.vue
Normal file
16
resources/js/components/ui/badge/Badge.vue
Normal file
@@ -0,0 +1,16 @@
|
||||
<script setup lang="ts">
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { type BadgeVariants, badgeVariants } from '.'
|
||||
|
||||
const props = defineProps<{
|
||||
variant?: BadgeVariants['variant']
|
||||
class?: HTMLAttributes['class']
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div :class="cn(badgeVariants({ variant }), props.class)">
|
||||
<slot />
|
||||
</div>
|
||||
</template>
|
||||
27
resources/js/components/ui/badge/index.ts
Normal file
27
resources/js/components/ui/badge/index.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { cva, type VariantProps } from 'class-variance-authority'
|
||||
|
||||
export { default as Badge } from './Badge.vue'
|
||||
|
||||
export const badgeVariants = cva(
|
||||
'inline-flex items-center rounded-full border px-2 py-0.25 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2',
|
||||
{
|
||||
variants: {
|
||||
variant: {
|
||||
default:
|
||||
'border-transparent bg-primary text-primary-foreground hover:bg-primary/80',
|
||||
secondary:
|
||||
'border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80',
|
||||
destructive:
|
||||
'border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80',
|
||||
success:
|
||||
'border-transparent bg-green-200 text-green-800 hover:bg-green-200/80',
|
||||
outline: 'text-foreground',
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
variant: 'default',
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
export type BadgeVariants = VariantProps<typeof badgeVariants>
|
||||
@@ -1,6 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Card, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import AppLayout from '@/layouts/AppLayout.vue';
|
||||
import { Head } from '@inertiajs/vue3';
|
||||
import { DatabaseIcon, Layers2Icon } from 'lucide-vue-next';
|
||||
|
||||
const props = defineProps({
|
||||
server: {
|
||||
@@ -31,7 +34,32 @@ const props = defineProps({
|
||||
]"
|
||||
>
|
||||
<div class="flex h-full flex-1 flex-col gap-4 rounded-xl p-4">
|
||||
{{ server }}
|
||||
<div class="flex items-center gap-3">
|
||||
<h2 class="text-3xl font-bold tracking-tight">{{ server.name }}</h2>
|
||||
<div>
|
||||
<Badge :variant="server.status === 'active' ? 'success' : 'secondary'">{{ server.status }}</Badge>
|
||||
</div>
|
||||
<div class="leading-none opacity-40">{{ server.ipv4 }} • {{ server.ipv6 }}</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h3 class="text-2xl font-semibold tracking-tight mb-3">Services</h3>
|
||||
<div class="grid gap-4 md:grid-cols-2 lg:grid-cols-3">
|
||||
<Card v-for="service in server.services" :key="service.id">
|
||||
<CardHeader>
|
||||
<div class="flex items-center gap-2">
|
||||
<DatabaseIcon v-if="service.category === 'database'" class="size-5 opacity-50" />
|
||||
<CardTitle>{{ service.name }}</CardTitle>
|
||||
<Badge :variant="service.status === 'active' ? 'success' : 'secondary'">{{ service.status.replace('-', ' ') }}</Badge>
|
||||
</div>
|
||||
<CardDescription>
|
||||
<span class="capitalize">{{ service.type }}</span> {{ service.version }} •
|
||||
<Layers2Icon class="inline-block size-4" /> {{ service.slices?.length }} slices
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
</Card>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="$page.props.flash?.server_credentials" class="p-5">
|
||||
<div class="mb-4 text-sm font-medium text-gray-900 dark:text-white">
|
||||
@@ -39,6 +67,8 @@ const props = defineProps({
|
||||
{{ $page.props.flash.server_credentials }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- {{ server }} -->
|
||||
</div>
|
||||
</AppLayout>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user