Skip to content

Commit

Permalink
Pretty print params
Browse files Browse the repository at this point in the history
  • Loading branch information
dejan committed Apr 27, 2024
1 parent 076f173 commit b86c102
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 10 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
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 b86c102

Please sign in to comment.