diff --git a/config/telescope.php b/config/telescope.php
index 54880800f..bc34fc341 100644
--- a/config/telescope.php
+++ b/config/telescope.php
@@ -152,5 +152,7 @@
],
Watchers\ScheduleWatcher::class => env('TELESCOPE_SCHEDULE_WATCHER', true),
+
+ Watchers\ViewWatcher::class => env('TELESCOPE_VIEW_WATCHER', true),
],
];
diff --git a/resources/js/components/RelatedEntries.vue b/resources/js/components/RelatedEntries.vue
index 32267622d..d35a61d32 100644
--- a/resources/js/components/RelatedEntries.vue
+++ b/resources/js/components/RelatedEntries.vue
@@ -60,6 +60,8 @@
this.currentTab = 'gates'
} else if (this.redis.length) {
this.currentTab = 'redis'
+ } else if (this.views.length) {
+ this.currentTab = 'views'
}
},
},
@@ -120,6 +122,10 @@
return _.filter(this.batch, {type: 'notification'});
},
+ views() {
+ return _.filter(this.batch, {type: 'view'});
+ },
+
tabs(){
return _.filter([
{title: "Exceptions", type: "exceptions", count: this.exceptions.length},
@@ -133,6 +139,7 @@
{title: "Events", type: "events", count: this.events.length},
{title: "Cache", type: "cache", count: this.cache.length},
{title: "Redis", type: "redis", count: this.redis.length},
+ {title: "Views", type: "views", count: this.views.length},
], tab => tab.count > 0);
},
@@ -524,6 +531,36 @@
+
+
+
+
+
+ Name |
+ Path |
+ |
+
+
+
+
+
+
+ {{entry.content.name}}
+ |
+
+ {{truncate(entry.content.path, 100)}} |
+
+
+
+
+
+ |
+
+
+
+
diff --git a/resources/js/routes.js b/resources/js/routes.js
index 100d6b312..3a03da02f 100644
--- a/resources/js/routes.js
+++ b/resources/js/routes.js
@@ -180,4 +180,17 @@ export default [
name: 'gates',
component: require('./screens/gates/index').default,
},
+
+ {
+ path: '/views/:id',
+ name: 'view-preview',
+ component: require('./screens/views/preview').default,
+ },
+
+ {
+ path: '/views',
+ name: 'views',
+ component: require('./screens/views/index').default,
+ },
+
];
diff --git a/resources/js/screens/views/index.vue b/resources/js/screens/views/index.vue
new file mode 100644
index 000000000..449a26c5b
--- /dev/null
+++ b/resources/js/screens/views/index.vue
@@ -0,0 +1,40 @@
+
+
+
+
+
+ Name |
+ Path |
+ Happened |
+ |
+
+
+
+
+
+
+ {{slotProps.entry.content.name}}
+ |
+
+ {{truncate(slotProps.entry.content.path, 80)}} |
+
+ {{timeAgo(slotProps.entry.created_at)}} |
+
+
+
+
+
+ |
+
+
+
diff --git a/resources/js/screens/views/preview.vue b/resources/js/screens/views/preview.vue
new file mode 100644
index 000000000..219710fa5
--- /dev/null
+++ b/resources/js/screens/views/preview.vue
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+ View |
+
+ {{slotProps.entry.content.name}}
+ |
+
+
+
+ Path |
+
+ {{slotProps.entry.content.path}}
+ |
+
+
+
+
+
+
diff --git a/resources/views/layout.blade.php b/resources/views/layout.blade.php
index c5d2c9ffd..c2f0e691e 100644
--- a/resources/views/layout.blade.php
+++ b/resources/views/layout.blade.php
@@ -178,6 +178,14 @@
Redis
+
+
+
+ Views
+
+
diff --git a/src/EntryType.php b/src/EntryType.php
index 6d1888d72..3c14b65f9 100644
--- a/src/EntryType.php
+++ b/src/EntryType.php
@@ -19,4 +19,5 @@ class EntryType
public const REQUEST = 'request';
public const SCHEDULED_TASK = 'schedule';
public const GATE = 'gate';
+ public const VIEW = 'view';
}
diff --git a/src/Http/Controllers/ViewsController.php b/src/Http/Controllers/ViewsController.php
new file mode 100644
index 000000000..2df234516
--- /dev/null
+++ b/src/Http/Controllers/ViewsController.php
@@ -0,0 +1,30 @@
+listen($this->options['events'] ?? 'composing:*', [$this, 'recordAction']);
+ }
+
+ /**
+ * Record an action.
+ *
+ * @param string $event
+ * @param array $data
+ * @return void
+ */
+ public function recordAction($event, $data)
+ {
+ if (! Telescope::isRecording()) {
+ return;
+ }
+
+ /** @var View $view */
+ $view = $data[0];
+
+ Telescope::recordView(IncomingEntry::make(array_filter([
+ 'name' => $view->getName(),
+ 'path' => $view->getPath(),
+ 'data' => array_keys($view->getData()),
+ ])));
+ }
+}