Fix: Resolve Tailwind CSS build error and Audit Logs FK issue
This commit is contained in:
@@ -22,21 +22,43 @@ export default async function AuditLogsPage() {
|
||||
|
||||
// Use admin client if available to bypass RLS for debugging
|
||||
const client = supabaseAdmin || supabase
|
||||
console.log("AuditLogsPage: Using admin client?", !!supabaseAdmin)
|
||||
|
||||
// Fetch logs without join first to avoid FK issues
|
||||
const { data: logs, error } = await client
|
||||
.from('audit_logs')
|
||||
.select(`
|
||||
*,
|
||||
profiles:user_id (full_name, role)
|
||||
`)
|
||||
.select('*')
|
||||
.order('created_at', { ascending: false })
|
||||
.limit(50)
|
||||
|
||||
if (error) {
|
||||
console.error("AuditLogsPage: Error fetching logs:", error)
|
||||
} else {
|
||||
console.log("AuditLogsPage: Fetched logs count:", logs?.length)
|
||||
}
|
||||
|
||||
// Manually fetch profiles for the logs
|
||||
let logsWithProfiles = []
|
||||
if (logs) {
|
||||
const userIds = Array.from(new Set(logs.map((log: any) => log.user_id).filter(Boolean)))
|
||||
|
||||
let profilesMap: Record<string, any> = {}
|
||||
|
||||
if (userIds.length > 0) {
|
||||
const { data: profiles } = await client
|
||||
.from('profiles')
|
||||
.select('id, full_name, role')
|
||||
.in('id', userIds)
|
||||
|
||||
if (profiles) {
|
||||
profilesMap = profiles.reduce((acc: any, profile: any) => {
|
||||
acc[profile.id] = profile
|
||||
return acc
|
||||
}, {})
|
||||
}
|
||||
}
|
||||
|
||||
logsWithProfiles = logs.map((log: any) => ({
|
||||
...log,
|
||||
profiles: profilesMap[log.user_id] || null
|
||||
}))
|
||||
}
|
||||
|
||||
const getActionBadge = (action: string) => {
|
||||
@@ -78,14 +100,14 @@ export default async function AuditLogsPage() {
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{logs?.length === 0 ? (
|
||||
{logsWithProfiles.length === 0 ? (
|
||||
<TableRow>
|
||||
<TableCell colSpan={4} className="text-center h-24 text-muted-foreground">
|
||||
Kayıt bulunamadı.
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
) : (
|
||||
logs?.map((log) => (
|
||||
logsWithProfiles.map((log: any) => (
|
||||
<TableRow key={log.id}>
|
||||
<TableCell className="font-medium">
|
||||
<div className="flex items-center gap-2">
|
||||
|
||||
@@ -7,6 +7,44 @@
|
||||
@theme {
|
||||
--font-sans: var(--font-geist-sans);
|
||||
--font-mono: var(--font-geist-mono);
|
||||
|
||||
--color-background: hsl(var(--background));
|
||||
--color-foreground: hsl(var(--foreground));
|
||||
|
||||
--color-card: hsl(var(--card));
|
||||
--color-card-foreground: hsl(var(--card-foreground));
|
||||
|
||||
--color-popover: hsl(var(--popover));
|
||||
--color-popover-foreground: hsl(var(--popover-foreground));
|
||||
|
||||
--color-primary: hsl(var(--primary));
|
||||
--color-primary-foreground: hsl(var(--primary-foreground));
|
||||
|
||||
--color-secondary: hsl(var(--secondary));
|
||||
--color-secondary-foreground: hsl(var(--secondary-foreground));
|
||||
|
||||
--color-muted: hsl(var(--muted));
|
||||
--color-muted-foreground: hsl(var(--muted-foreground));
|
||||
|
||||
--color-accent: hsl(var(--accent));
|
||||
--color-accent-foreground: hsl(var(--accent-foreground));
|
||||
|
||||
--color-destructive: hsl(var(--destructive));
|
||||
--color-destructive-foreground: hsl(var(--destructive-foreground));
|
||||
|
||||
--color-border: hsl(var(--border));
|
||||
--color-input: hsl(var(--input));
|
||||
--color-ring: hsl(var(--ring));
|
||||
|
||||
--color-chart-1: hsl(var(--chart-1));
|
||||
--color-chart-2: hsl(var(--chart-2));
|
||||
--color-chart-3: hsl(var(--chart-3));
|
||||
--color-chart-4: hsl(var(--chart-4));
|
||||
--color-chart-5: hsl(var(--chart-5));
|
||||
|
||||
--radius-lg: var(--radius);
|
||||
--radius-md: calc(var(--radius) - 2px);
|
||||
--radius-sm: calc(var(--radius) - 4px);
|
||||
}
|
||||
|
||||
:root {
|
||||
@@ -68,6 +106,7 @@
|
||||
* {
|
||||
@apply border-border outline-ring/50;
|
||||
}
|
||||
|
||||
body {
|
||||
@apply bg-background text-foreground;
|
||||
}
|
||||
@@ -78,7 +117,7 @@
|
||||
.glass {
|
||||
@apply bg-white/70 dark:bg-black/70 backdrop-blur-lg border border-white/20 dark:border-white/10 shadow-xl;
|
||||
}
|
||||
|
||||
|
||||
.card-hover {
|
||||
@apply transition-all duration-300 hover:shadow-lg hover:-translate-y-1;
|
||||
}
|
||||
@@ -86,4 +125,4 @@
|
||||
.gradient-text {
|
||||
@apply bg-clip-text text-transparent bg-gradient-to-r from-primary to-purple-600;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user