Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pretty print params #201

Merged
merged 2 commits into from
Apr 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
} */
Loading