Skip to content

Commit

Permalink
Merge pull request #201 from dejan/pretty_print_params
Browse files Browse the repository at this point in the history
Pretty print params
  • Loading branch information
dejan authored Apr 27, 2024
2 parents 076f173 + b492beb commit fbba73b
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 11 deletions.
6 changes: 6 additions & 0 deletions extension/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"ansi-to-html": "^0.7.2",
"highlight.js": "^11.9.0",
"pinia": "^2.1.7",
"pretty-print-json": "^3.0.0",
"primeicons": "^7.0.0",
"primevue": "^3.49.1",
"vue": "^3.4.19"
Expand Down
31 changes: 27 additions & 4 deletions extension/src/components/ActionParams.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,37 @@
<template>
<DetailsTable :value="store.selectedParams">
<Column field="name" header="Name" />
<Column field="value" header="Value" />
</DetailsTable>
<DetailsTable :value="store.selectedParams">
<Column field="name" header="Name" class="font-bold"/>
<Column field="value" header="Value">
<template #body="slotProps">
<pre v-html="pretty(slotProps.data.value)" class="whitespace-pre-wrap"></pre>
</template>
</Column>
</DetailsTable>
</template>

<script setup>
import { useEventsStore } from '../stores/events';
import Column from 'primevue/column';
import DetailsTable from './wrappers/DetailsTable.vue';
import { prettyPrintJson } from 'pretty-print-json';
const store = useEventsStore()
const prettyOptions = {
indent: 2,
quoteKeys: true,
quoteStyle: 'double',
trailingCommas: false,
linkUrls: false,
};
function pretty(obj) {
try {
return prettyPrintJson.toHtml(obj, prettyOptions);
} catch (e) {
console.log(e);
return obj;
}
}
</script>
2 changes: 1 addition & 1 deletion extension/src/components/ActiveRecordQueries.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<Column field="type" header="Type" class="whitespace-nowrap"/>
<Column field="query" header="Query">
<template #body="slotProps">
<div v-html="hljs.highlight(slotProps.data.query, { language: 'sql' }).value" class="font-mono"></div>
<pre v-html="hljs.highlight(slotProps.data.query, { language: 'sql' }).value" class="font-mono whitespace-pre-wrap"></pre>
</template>
</Column>
<Column field="binds" header="Binds">
Expand Down
2 changes: 1 addition & 1 deletion extension/src/components/wrappers/ToolbarToggle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ const preset = {
'transition-transform duration-200',
{
'-rotate-45': !props.modelValue,
'-rotate-90': props.modelValue
'rotate-0': props.modelValue
},
]
Expand Down
5 changes: 0 additions & 5 deletions extension/src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,3 @@
--primary-950: 69 10 10;

}

/* custom scrollbar */
/* ::-webkit-scrollbar {
width: 0px;
} */

0 comments on commit fbba73b

Please sign in to comment.