File tree Expand file tree Collapse file tree 5 files changed +76
-10
lines changed Expand file tree Collapse file tree 5 files changed +76
-10
lines changed Original file line number Diff line number Diff line change 11<template >
22 <div class =" dump-preview" >
3- <CodeSnippet v-if =" isBooleanValue" language =" php" :code =" value === 1" />
4- <div
5- v-if =" !isBooleanValue"
6- class =" var-dump-preview__html"
7- v-html =" dumpBody"
8- />
3+ <div v-if =" !isString" class =" var-dump-preview__html" v-html =" dumpBody" />
4+
5+ <CodeSnippet v-if =" isString" language =" php" :code =" dumpBody" />
96 </div >
107</template >
118
129<script lang="ts">
1310import { defineComponent } from " vue" ;
14- import CodeSnippet from " ~/components/CodeSnippet/CodeSnippet.vue" ;
1511import { useNuxtApp } from " #app" ;
12+ import CodeSnippet from " ~/components/CodeSnippet/CodeSnippet.vue" ;
1613
1714export default defineComponent ({
1815 components: {
@@ -34,8 +31,8 @@ export default defineComponent({
3431 };
3532 },
3633 computed: {
37- isBooleanValue() : boolean {
38- return typeof this .value === " boolean " || this .type === " boolean " ;
34+ isString() {
35+ return typeof this .value === " string " && this .type === " string " ;
3936 },
4037 dumpId(): string | null {
4138 if (! this .value ) {
@@ -51,6 +48,10 @@ export default defineComponent({
5148 );
5249 }
5350
51+ if (this .isString ) {
52+ return ` "${this .value }" ` ;
53+ }
54+
5455 return this .value ;
5556 },
5657 },
Original file line number Diff line number Diff line change @@ -4,7 +4,9 @@ import { normalizeVarDumpEvent } from "~/utils/normalize-event";
44import varDumpObjectEventMock from '~/mocks/var-dump-object.json'
55import varDumpNumberEventMock from '~/mocks/var-dump-number.json'
66import varDumpStringEventMock from '~/mocks/var-dump-string.json'
7+ import varDumpStringEmptyEventMock from '~/mocks/var-dump-string-empty.json'
78import varDumpArrayEventMock from '~/mocks/var-dump-array.json'
9+ import varDumpBoolEventMock from '~/mocks/var-dump-boolean.json'
810import VarDumpPreview from '~/components/VarDumpPreview/VarDumpPreview.vue' ;
911
1012export default {
@@ -40,6 +42,19 @@ String.args = {
4042 event : normalizeVarDumpEvent ( varDumpStringEventMock ) ,
4143} ;
4244
45+ export const StringEmpty = Template . bind ( { } ) ;
46+
47+ StringEmpty . args = {
48+ event : normalizeVarDumpEvent ( varDumpStringEmptyEventMock ) ,
49+ } ;
50+
51+ export const Boolean = Template . bind ( { } ) ;
52+
53+ Boolean . args = {
54+ event : normalizeVarDumpEvent ( varDumpBoolEventMock ) ,
55+ } ;
56+
57+
4358export const Array = Template . bind ( { } ) ;
4459
4560Array . args = {
Original file line number Diff line number Diff line change @@ -142,7 +142,7 @@ export interface Sentry {
142142export interface VarDump {
143143 payload : {
144144 type : string ,
145- value : string
145+ value : string | number | boolean
146146 } ,
147147 context : {
148148 timestamp : number ,
Original file line number Diff line number Diff line change 1+ {
2+ "uuid" : " 49c77954-d17e-471d-9d5e-bf0aa856f90c" ,
3+ "type" : " var-dump" ,
4+ "payload" : {
5+ "payload" : {
6+ "type" : " boolean" ,
7+ "value" : true
8+ },
9+ "context" : {
10+ "timestamp" : 1678271981.325951 ,
11+ "cli" : {
12+ "command_line" : " app.php" ,
13+ "identifier" : " 799f2007"
14+ },
15+ "source" : {
16+ "name" : " HomeController.php" ,
17+ "file" : " /root/repos/spiral-apps/filters-bridge/app/src/Controller/HomeController.php" ,
18+ "line" : 48 ,
19+ "file_excerpt" : false
20+ }
21+ }
22+ },
23+ "timestamp" : 1678271981 ,
24+ "project_id" : null
25+ }
Original file line number Diff line number Diff line change 1+ {
2+ "uuid" : " 49c77954-d17e-471d-9d5e-bf0aa856f90c" ,
3+ "type" : " var-dump" ,
4+ "payload" : {
5+ "payload" : {
6+ "type" : " string" ,
7+ "value" : " \t "
8+ },
9+ "context" : {
10+ "timestamp" : 1678271981.325951 ,
11+ "cli" : {
12+ "command_line" : " app.php" ,
13+ "identifier" : " 799f2007"
14+ },
15+ "source" : {
16+ "name" : " HomeController.php" ,
17+ "file" : " /root/repos/spiral-apps/filters-bridge/app/src/Controller/HomeController.php" ,
18+ "line" : 48 ,
19+ "file_excerpt" : false
20+ }
21+ }
22+ },
23+ "timestamp" : 1678271981 ,
24+ "project_id" : null
25+ }
You can’t perform that action at this time.
0 commit comments