Skip to content

Commit

Permalink
Add JSON viewer to inbound request list
Browse files Browse the repository at this point in the history
  • Loading branch information
Centurix committed Aug 17, 2023
1 parent 75e785f commit 27af56b
Showing 5 changed files with 90 additions and 24 deletions.
47 changes: 46 additions & 1 deletion src/traffcap/spa/package-lock.json

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

19 changes: 10 additions & 9 deletions src/traffcap/spa/package.json
Original file line number Diff line number Diff line change
@@ -13,30 +13,31 @@
"build": "quasar build"
},
"dependencies": {
"@quasar/extras": "^1.0.0",
"axios": "^1.2.1",
"vue-i18n": "^9.2.2",
"pinia": "^2.0.11",
"@quasar/extras": "^1.0.0",
"quasar": "^2.6.0",
"vue": "^3.0.0",
"vue-router": "^4.0.0"
"vue-i18n": "^9.2.2",
"vue-router": "^4.0.0",
"vue3-json-viewer": "^2.2.2"
},
"devDependencies": {
"@intlify/vite-plugin-vue-i18n": "^3.3.1",
"@quasar/app-vite": "^1.0.0",
"@types/node": "^12.20.21",
"@typescript-eslint/eslint-plugin": "^5.10.0",
"@typescript-eslint/parser": "^5.10.0",
"autoprefixer": "^10.4.2",
"eslint": "^8.10.0",
"eslint-plugin-vue": "^9.0.0",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-vue": "^9.0.0",
"prettier": "^2.5.1",
"@types/node": "^12.20.21",
"@intlify/vite-plugin-vue-i18n": "^3.3.1",
"@quasar/app-vite": "^1.0.0",
"autoprefixer": "^10.4.2",
"typescript": "^4.5.4"
},
"engines": {
"node": "^18 || ^16 || ^14.19",
"npm": ">= 6.13.4",
"yarn": ">= 1.21.1"
}
}
}
5 changes: 4 additions & 1 deletion src/traffcap/spa/quasar.config.js
Original file line number Diff line number Diff line change
@@ -32,6 +32,7 @@ module.exports = configure(function (/* ctx */) {
boot: [
'i18n',
'axios',
'json_viewer'
],

// https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#css
@@ -102,7 +103,9 @@ module.exports = configure(function (/* ctx */) {

// https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#framework
framework: {
config: {},
config: {
dark: 'auto'
},

// iconSet: 'material-icons', // Quasar icon set
// lang: 'en-US', // Quasar language pack
8 changes: 8 additions & 0 deletions src/traffcap/spa/src/boot/json_viewer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { boot } from 'quasar/wrappers';
import JsonViewer from 'vue3-json-viewer';
import 'vue3-json-viewer/dist/index.css';


export default boot(({ app }) => {
app.use(JsonViewer);
});
35 changes: 22 additions & 13 deletions src/traffcap/spa/src/pages/InboundRequests.vue
Original file line number Diff line number Diff line change
@@ -7,19 +7,23 @@
<q-btn flat color="white" label="Retry" @click="openWebsocket()"/>
</template>
</q-banner>
<q-table
flat bordered
title="Inbound Requests"
dense
:rows="rows"
:columns="columns"
row-key="name"
:rows-per-page-options="[0]"
>
<template v-slot:body-cell-method="props">
<q-chip square :color="method_colors[props.row.attributes.method]" text-color="white">{{ props.row.attributes.method }}</q-chip>
</template>
</q-table>
<q-list padding bordered class="rounded-borders">
<q-item v-for="row in rows" :key="row.id">
<q-item-section>
<q-item-label>
<q-chip square :color="method_colors[row.attributes.method]" text-color="white">{{ row.attributes.method }} @ {{ row.attributes.endpoint_code }}</q-chip>
</q-item-label>
</q-item-section>
<q-item-section>
<q-item-label>Query Params</q-item-label>
<JsonViewer :value="JSON.parse(row.attributes.query_params)" copyable boxed sort/>
</q-item-section>
<q-item-section>
<q-item-label>Headers</q-item-label>
<JsonViewer :value="JSON.parse(row.attributes.headers)" copyable boxed sort/>
</q-item-section>
</q-item>
</q-list>
</div>
</q-page>
</template>
@@ -28,9 +32,14 @@
import { defineComponent } from 'vue';
import { Request } from 'components/models';
import { serverWebSocketURL } from 'components/server';
import { JsonViewer } from 'vue3-json-viewer';
export default defineComponent({
name: 'InboundRequests',
components: {
JsonViewer
},
mounted () {
// Load the inbound requests
this.openWebsocket();

0 comments on commit 27af56b

Please sign in to comment.