Skip to content

Commit b42cf72

Browse files
authored
Merge pull request #84 from buggregator/feature/78
Adds support for Ray application log
2 parents 8c2ba09 + e8eafde commit b42cf72

File tree

8 files changed

+101
-4
lines changed

8 files changed

+101
-4
lines changed

src/entities/ray/mocks-laravel/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import rayLaravelJobsMock from './ray-laravel-jobs.json';
77
import rayLaravelMailableMock from './ray-laravel-mailable.json';
88
import rayLaravelQueryNoBindingsMock from './ray-laravel-query-no-bindings.json';
99
import rayLaravelQueryMock from './ray-laravel-query.json';
10-
import rayLaravelViewsMock from './ray-laravel-views.json';
10+
import rayLaravelViewsMock from './ray-laravel-views.json'
11+
import rayLaravelApplicationLogMock from './ray-laravel-application-log.json';
1112

1213
export {
1314
rayLaravelCacheMock,
@@ -19,5 +20,6 @@ export {
1920
rayLaravelMailableMock,
2021
rayLaravelQueryMock,
2122
rayLaravelQueryNoBindingsMock,
22-
rayLaravelViewsMock
23+
rayLaravelViewsMock,
24+
rayLaravelApplicationLogMock
2325
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"uuid": "1fcae0a3-3965-4f1f-a4f7-f2171ccb1764",
3+
"type": "ray",
4+
"payload": {
5+
"uuid": "1fcae0a3-3965-4f1f-a4f7-f2171ccb1764",
6+
"payloads": [
7+
{
8+
"type": "application_log",
9+
"content": {
10+
"value": "{\"request\":\"a\",\"response\":\"a\"}"
11+
},
12+
"origin": {
13+
"file": "\/var\/www\/html\/vendor\/psy\/psysh\/src\/ExecutionLoopClosure.php(53) : eval()'d code",
14+
"line_number": 1,
15+
"hostname": "f5813cb9520f"
16+
}
17+
}
18+
],
19+
"meta": {
20+
"php_version": "8.2.10",
21+
"php_version_id": 80210,
22+
"project_name": "ThailandPostMart.com",
23+
"laravel_version": "10.31.0",
24+
"laravel_ray_package_version": "1.33.0.0",
25+
"ray_package_version": "1.40.0.0"
26+
}
27+
},
28+
"timestamp": 1701161948,
29+
"project_id": null
30+
}

src/entities/ray/types.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ export interface RayContentEloquent {
5454
attributes: string
5555
}
5656

57+
export interface RayContentApplicationLog {
58+
value: string
59+
}
60+
5761
export interface RayContentView {
5862
view_path: string,
5963
view_path_relative_to_project_root: string,
@@ -142,6 +146,7 @@ export interface RayPayload {
142146
| RayContentObject
143147
| RayContentCarbone
144148
| RayContentSQL
149+
| RayContentApplicationLog
145150
| RayContentEloquent
146151
| RayContentView
147152
| RayContentJob
@@ -196,6 +201,7 @@ export enum RAY_EVENT_TYPES {
196201
TABLE = "table",
197202
TRACE = "trace",
198203
QUERY = "executed_query",
204+
APPLICATION_LOG = "application_log",
199205
ELOQUENT = "eloquent_model",
200206
VIEW = "view",
201207
EVENT = "event",

src/entities/ray/ui/preview-card/preview-card.stories.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import {
2424
import {
2525
rayLaravelEloquentMock, rayLaravelEventsMock, rayLaravelJobsMock,
2626
rayLaravelQueryMock,
27-
rayLaravelQueryNoBindingsMock, rayLaravelViewsMock
27+
rayLaravelQueryNoBindingsMock, rayLaravelViewsMock, rayLaravelApplicationLogMock
2828
} from "../../mocks-laravel";
2929
import PreviewCard from './preview-card.vue';
3030

@@ -119,3 +119,7 @@ LaravelEvents.args = {event: normalizeRayEvent(rayLaravelEventsMock),};
119119

120120
export const LaravelJobs = Template.bind({});
121121
LaravelJobs.args = {event: normalizeRayEvent(rayLaravelJobsMock),};
122+
123+
export const LaravelApplicationLog = Template.bind({});
124+
LaravelApplicationLog.args = {event: normalizeRayEvent(rayLaravelApplicationLogMock),};
125+

src/entities/ray/ui/preview-card/preview-card.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
RayContentCarbone,
88
RayContentCustom,
99
RayContentEloquent,
10+
RayContentApplicationLog,
1011
RayContentEvent,
1112
RayContentException,
1213
RayContentFrame,
@@ -25,7 +26,8 @@ import {
2526
} from "../../types";
2627
import { RayCarbone } from "../ray-carbone";
2728
import { RayCustom } from "../ray-custom";
28-
import { RayEloquent } from "../ray-eloquent";
29+
import { RayEloquent } from "../ray-eloquent"
30+
import { RayApplicationLog } from "../ray-application-log";
2931
import { RayEvent } from "../ray-event";
3032
import { RayException } from "../ray-exception";
3133
import { RayFrame } from "../ray-frame";
@@ -118,6 +120,12 @@ const COMPONENT_TYPE_MAP = {
118120
content: payload.content as RayContentEloquent,
119121
}),
120122
},
123+
[RAY_EVENT_TYPES.APPLICATION_LOG]: {
124+
view: RayApplicationLog,
125+
getProps: (payload: RayPayload) => ({
126+
content: payload.content as RayContentApplicationLog,
127+
}),
128+
},
121129
[RAY_EVENT_TYPES.VIEW]: {
122130
view: RayView,
123131
getProps: (payload: RayPayload) => ({
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as RayApplicationLog } from './ray-application-log.vue';
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { Meta, Story } from "@storybook/vue3";
2+
import { useRay } from "../../lib";
3+
import { rayLaravelApplicationLogMock } from '../../mocks-laravel';
4+
import { RayContentApplicationLog } from '../../types';
5+
import RayApplicationLog from './ray-application-log.vue';
6+
7+
const { normalizeRayEvent } = useRay();
8+
9+
export default {
10+
title: "Entities/ray/RayApplicationLog",
11+
component: RayApplicationLog
12+
} as Meta<typeof RayApplicationLog>;
13+
14+
const Template: Story = (args) => ({
15+
components: { RayApplicationLog },
16+
setup() {
17+
return {
18+
args,
19+
};
20+
},
21+
template: `<RayApplicationLog v-bind="args" />`,
22+
});
23+
24+
export const Default = Template.bind({});
25+
Default.args = {
26+
content: (normalizeRayEvent(rayLaravelApplicationLogMock).payload.payloads[0].content as RayContentApplicationLog)
27+
};
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<script lang="ts" setup>
2+
import { RayContentApplicationLog } from "../../types";
3+
4+
type Props = {
5+
content: RayContentApplicationLog;
6+
};
7+
8+
defineProps<Props>();
9+
</script>
10+
11+
<template>
12+
<pre class="ray-application-log">{{ content.value }}</pre>
13+
</template>
14+
15+
<style lang="scss" scoped>
16+
.ray-application-log {
17+
@apply p-3 border border-gray-300 dark:border-gray-600 bg-gray-800 flex w-full overflow-auto;
18+
}
19+
</style>

0 commit comments

Comments
 (0)