Skip to content

Commit a98204c

Browse files
committed
chore: wip
chore: wip
1 parent 2c203f3 commit a98204c

File tree

3 files changed

+179
-36
lines changed

3 files changed

+179
-36
lines changed

storage/framework/defaults/components/Dashboard/Sidebar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ const sectionContent: Record<string, SectionContent> = {
165165
content: {
166166
items: [
167167
{ to: '/content/dashboard', icon: 'i-hugeicons-dashboard-speed-01', text: 'Dashboard' },
168-
{ to: '/content/file-manager', icon: 'i-hugeicons-apple-finder', text: 'Files' },
168+
{ to: '/content/files', icon: 'i-hugeicons-apple-finder', text: 'Files' },
169169
{ to: '/content/pages', icon: 'i-hugeicons-file-02', text: 'Pages' },
170170
{ to: '/content/posts', icon: 'i-hugeicons-message-edit-02', text: 'Posts' },
171171
{ to: '/content/categories', icon: 'i-hugeicons-tags', text: 'Categories' },

storage/framework/defaults/views/dashboard/activity/index.vue

Lines changed: 177 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ const logNames = [
8888
{ id: 'posts', name: 'Posts', color: 'pink' },
8989
{ id: 'comments', name: 'Comments', color: 'rose' },
9090
{ id: 'media', name: 'Media', color: 'amber' },
91+
{ id: 'deployment', name: 'Deployment', color: 'emerald' },
92+
{ id: 'server', name: 'Server', color: 'cyan' },
93+
{ id: 'commerce', name: 'Commerce', color: 'orange' },
94+
{ id: 'blog', name: 'Blog', color: 'violet' },
9195
]
9296
9397
// Sample subject types
@@ -98,6 +102,11 @@ const subjectTypes = [
98102
{ type: 'App\\Models\\Media', name: 'Media' },
99103
{ type: 'App\\Models\\Role', name: 'Role' },
100104
{ type: 'App\\Models\\Permission', name: 'Permission' },
105+
{ type: 'App\\Models\\Order', name: 'Order' },
106+
{ type: 'App\\Services\\Deployment', name: 'Deployment' },
107+
{ type: 'App\\Services\\Server', name: 'Server' },
108+
{ type: 'App\\Services\\Api', name: 'API' },
109+
{ type: 'App\\Services\\Backup', name: 'Backup' },
101110
]
102111
103112
// Sample activity logs in Laravel Spatie Activity Log format
@@ -307,7 +316,106 @@ const sampleActivityLogs: ActivityLog[] = [
307316
created_at: new Date(Date.now() - 420000).toISOString(),
308317
updated_at: new Date(Date.now() - 420000).toISOString(),
309318
event: 'completed',
310-
}
319+
},
320+
{
321+
id: '11',
322+
log_name: 'deployment',
323+
description: 'Production deployment successful',
324+
subject_type: 'App\\Services\\Deployment',
325+
subject_id: '123',
326+
causer_type: 'App\\Models\\User',
327+
causer_id: '1',
328+
properties: {
329+
environment: 'production',
330+
branch: 'main',
331+
commit: '7829abc',
332+
duration: '45s',
333+
status: 'success',
334+
},
335+
created_at: new Date(Date.now() - 10 * 60000).toISOString(), // 10 minutes ago
336+
updated_at: new Date(Date.now() - 10 * 60000).toISOString(),
337+
event: 'completed',
338+
},
339+
{
340+
id: '12',
341+
log_name: 'blog',
342+
description: 'New blog post published',
343+
subject_type: 'App\\Models\\Post',
344+
subject_id: '45',
345+
causer_type: 'App\\Models\\User',
346+
causer_id: '3',
347+
properties: {
348+
attributes: {
349+
title: 'Getting Started with Activity Logs',
350+
slug: 'getting-started-with-activity-logs',
351+
status: 'published',
352+
created_at: new Date(Date.now() - 60 * 60000).toISOString(), // 1 hour ago
353+
},
354+
status: 'success',
355+
},
356+
created_at: new Date(Date.now() - 60 * 60000).toISOString(),
357+
updated_at: new Date(Date.now() - 60 * 60000).toISOString(),
358+
event: 'published',
359+
},
360+
{
361+
id: '13',
362+
log_name: 'server',
363+
description: 'Server maintenance completed',
364+
subject_type: 'App\\Services\\Server',
365+
subject_id: '2',
366+
causer_type: 'App\\Models\\User',
367+
causer_id: '4',
368+
properties: {
369+
server: 'app-server-01',
370+
maintenance_type: 'scheduled',
371+
duration: '120m',
372+
status: 'success',
373+
},
374+
created_at: new Date(Date.now() - 3 * 60 * 60000).toISOString(), // 3 hours ago
375+
updated_at: new Date(Date.now() - 3 * 60 * 60000).toISOString(),
376+
event: 'maintained',
377+
},
378+
{
379+
id: '14',
380+
log_name: 'default',
381+
description: 'API rate limit exceeded',
382+
subject_type: 'App\\Services\\Api',
383+
subject_id: '1',
384+
causer_type: null,
385+
causer_id: null,
386+
properties: {
387+
endpoint: '/api/v1/users',
388+
limit: 1000,
389+
period: '1 hour',
390+
ip: '192.168.1.50',
391+
status: 'error',
392+
},
393+
created_at: new Date(Date.now() - 5 * 60 * 60000).toISOString(), // 5 hours ago
394+
updated_at: new Date(Date.now() - 5 * 60 * 60000).toISOString(),
395+
event: 'exceeded',
396+
},
397+
{
398+
id: '15',
399+
log_name: 'commerce',
400+
description: 'New order received',
401+
subject_type: 'App\\Models\\Order',
402+
subject_id: '1001',
403+
causer_type: 'App\\Models\\User',
404+
causer_id: '2',
405+
properties: {
406+
attributes: {
407+
order_number: 'ORD-1001',
408+
total: '$129.99',
409+
items: 3,
410+
status: 'pending',
411+
created_at: new Date(Date.now() - 12 * 60 * 60000).toISOString(), // 12 hours ago
412+
},
413+
status: 'success',
414+
},
415+
created_at: new Date(Date.now() - 12 * 60 * 60000).toISOString(),
416+
updated_at: new Date(Date.now() - 12 * 60 * 60000).toISOString(),
417+
event: 'created',
418+
},
311419
]
312420
313421
// Process logs to add computed properties
@@ -326,48 +434,80 @@ const processLogs = (logs: ActivityLog[]) => {
326434
subject_name = log.properties.attributes.filename
327435
} else if (log.subject_type === 'App\\Services\\Backup') {
328436
subject_name = 'System Backup'
437+
} else if (log.subject_type === 'App\\Services\\Deployment') {
438+
subject_name = `Deployment to ${log.properties?.environment || 'unknown'}`
439+
} else if (log.subject_type === 'App\\Services\\Server') {
440+
subject_name = log.properties?.server || 'Server'
441+
} else if (log.subject_type === 'App\\Services\\Api') {
442+
subject_name = log.properties?.endpoint || 'API'
443+
} else if (log.subject_type === 'App\\Models\\Order' && log.properties?.attributes?.order_number) {
444+
subject_name = log.properties.attributes.order_number
329445
} else {
330446
// Get the last part of the subject type as a fallback
331447
const parts = log.subject_type.split('\\')
332448
subject_name = `${parts[parts.length - 1]} #${log.subject_id}`
333449
}
334450
335-
// Determine icon and color based on event
451+
// Determine icon and color based on event and status
336452
let icon = 'i-hugeicons-information-circle'
337453
let color = 'text-blue-500'
338454
339-
switch (log.event) {
340-
case 'created':
341-
icon = 'i-hugeicons-plus-sign-circle'
342-
color = 'text-green-500'
343-
break
344-
case 'updated':
345-
icon = 'i-hugeicons-edit-01'
346-
color = 'text-blue-500'
347-
break
348-
case 'deleted':
349-
icon = 'i-hugeicons-waste'
350-
color = 'text-red-500'
351-
break
352-
case 'login':
353-
icon = 'i-hugeicons-login-03'
354-
color = 'text-indigo-500'
355-
break
356-
case 'login_failed':
357-
icon = 'i-hugeicons-login-03'
358-
color = 'text-amber-500'
359-
break
360-
case 'uploaded':
361-
icon = 'i-hugeicons-upload-03'
362-
color = 'text-purple-500'
363-
break
364-
case 'completed':
365-
icon = 'i-hugeicons-checkmark-circle-02'
366-
color = 'text-green-500'
367-
break
368-
default:
369-
icon = 'i-hugeicons-information-circle'
370-
color = 'text-gray-500'
455+
// Check if there's a status in properties
456+
const status = log.properties?.status
457+
458+
if (status === 'error') {
459+
icon = 'i-hugeicons-alert-02'
460+
color = 'text-red-500'
461+
} else if (status === 'warning') {
462+
icon = 'i-hugeicons-alert-02'
463+
color = 'text-amber-500'
464+
} else {
465+
// If no status, use event to determine icon/color
466+
switch (log.event) {
467+
case 'created':
468+
icon = 'i-hugeicons-plus-sign-circle'
469+
color = 'text-green-500'
470+
break
471+
case 'updated':
472+
icon = 'i-hugeicons-edit-01'
473+
color = 'text-blue-500'
474+
break
475+
case 'deleted':
476+
icon = 'i-hugeicons-waste'
477+
color = 'text-red-500'
478+
break
479+
case 'login':
480+
icon = 'i-hugeicons-login-03'
481+
color = 'text-indigo-500'
482+
break
483+
case 'login_failed':
484+
icon = 'i-hugeicons-login-03'
485+
color = 'text-amber-500'
486+
break
487+
case 'uploaded':
488+
icon = 'i-hugeicons-upload-03'
489+
color = 'text-purple-500'
490+
break
491+
case 'completed':
492+
icon = 'i-hugeicons-checkmark-circle-02'
493+
color = 'text-green-500'
494+
break
495+
case 'published':
496+
icon = 'i-hugeicons-book-open-01'
497+
color = 'text-violet-500'
498+
break
499+
case 'maintained':
500+
icon = 'i-hugeicons-settings-01'
501+
color = 'text-cyan-500'
502+
break
503+
case 'exceeded':
504+
icon = 'i-hugeicons-alert-02'
505+
color = 'text-red-500'
506+
break
507+
default:
508+
icon = 'i-hugeicons-information-circle'
509+
color = 'text-gray-500'
510+
}
371511
}
372512
373513
return {
@@ -699,6 +839,9 @@ watch(timeRange, async () => {
699839
<option value="login_failed">Failed Login</option>
700840
<option value="uploaded">Uploaded</option>
701841
<option value="completed">Completed</option>
842+
<option value="published">Published</option>
843+
<option value="maintained">Maintained</option>
844+
<option value="exceeded">Rate Limited</option>
702845
</select>
703846

704847
<select

storage/framework/defaults/views/dashboard/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ function getActivityColor(status: string): string {
212212
</ul>
213213
</div>
214214
<div class="border-t border-gray-200 dark:border-gray-700 px-4 py-4 sm:px-6">
215-
<a href="#" class="text-sm font-medium text-blue-600 hover:text-blue-500 dark:text-blue-400 dark:hover:text-blue-300">
215+
<a href="/activity" class="text-sm font-medium text-blue-600 hover:text-blue-500 dark:text-blue-400 dark:hover:text-blue-300">
216216
View all activity
217217
<span aria-hidden="true"> &rarr;</span>
218218
</a>

0 commit comments

Comments
 (0)