debugbar 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/debugbar/assets_controller.rb +1 -1
  3. data/build.sh +7 -0
  4. data/debugbar.gemspec +9 -2
  5. data/lib/debugbar/engine.rb +0 -8
  6. data/lib/debugbar/version.rb +1 -1
  7. data/lib/debugbar.rb +0 -7
  8. data/{client/dist/assets/debugbar-u5mP-5-z.js → public/debugbar.js} +10 -10
  9. metadata +3 -55
  10. data/.prettierrc +0 -6
  11. data/client/.gitignore +0 -25
  12. data/client/README.md +0 -0
  13. data/client/dist/.vite/manifest.json +0 -14
  14. data/client/dist/assets/ruby-logo-kn_8RniZ.svg +0 -946
  15. data/client/index.html +0 -78
  16. data/client/package-lock.json +0 -2393
  17. data/client/package.json +0 -32
  18. data/client/postcss.config.js +0 -6
  19. data/client/src/App.vue +0 -17
  20. data/client/src/AppDemo.vue +0 -29
  21. data/client/src/AppDev.vue +0 -20
  22. data/client/src/Debugbar.vue +0 -276
  23. data/client/src/assets/rails-logo.svg +0 -1
  24. data/client/src/assets/ruby-logo.svg +0 -946
  25. data/client/src/components/TabButton.vue +0 -32
  26. data/client/src/components/panels/CachePanel.vue +0 -41
  27. data/client/src/components/panels/JobsPanel.vue +0 -52
  28. data/client/src/components/panels/JsonPanel.vue +0 -15
  29. data/client/src/components/panels/LogsPanel.vue +0 -43
  30. data/client/src/components/panels/MessagesPanel.vue +0 -25
  31. data/client/src/components/panels/ModelsPanel.vue +0 -37
  32. data/client/src/components/panels/Panel.vue +0 -7
  33. data/client/src/components/panels/RequestPanel.vue +0 -98
  34. data/client/src/components/queries/QueriesPanel.vue +0 -17
  35. data/client/src/components/queries/QueryItem.vue +0 -65
  36. data/client/src/components/ui/Foldable.vue +0 -39
  37. data/client/src/components/ui/KeyValueTable.vue +0 -16
  38. data/client/src/components/ui/Row.vue +0 -14
  39. data/client/src/components/ui/logo-ruby.vue +0 -547
  40. data/client/src/demo.ts +0 -17
  41. data/client/src/dev.ts +0 -20
  42. data/client/src/main.ts +0 -17
  43. data/client/src/models/Config.ts +0 -27
  44. data/client/src/models/Request.ts +0 -183
  45. data/client/src/stores/RequestsStore.ts +0 -36
  46. data/client/src/stores/configStore.ts +0 -8
  47. data/client/src/style.css +0 -23
  48. data/client/src/types.d.ts +0 -9
  49. data/client/src/vite-env.d.ts +0 -1
  50. data/client/tailwind.config.js +0 -16
  51. data/client/tsconfig.json +0 -29
  52. data/client/tsconfig.node.json +0 -10
  53. data/client/vite.config.ts +0 -44
  54. data/fixtures/requests/1706607114--demo_post_list.json +0 -499
  55. data/fixtures/requests/1706607120--api_jobs.json +0 -176
  56. data/fixtures/requests/1706607123--api_jobs.json +0 -119
  57. data/fixtures/requests/1706607133--demo_slow_page.json +0 -130
  58. data/fixtures/requests/1706607136--demo_post.json +0 -164
  59. data/fixtures/requests/1706607136--demo_random_post.json +0 -106
  60. data/fixtures/requests/1706607141--api_errors.json +0 -73
  61. data/package-lock.json +0 -50
  62. data/package.json +0 -5
@@ -1,183 +0,0 @@
1
- export type BackendRequestData = {
2
- id: string
3
- meta: RequestMeta
4
- request: RequestRequest
5
- response: RequestResponse
6
- models: { [key: string]: number }
7
- queries: Query[]
8
- jobs: Job[]
9
- messages: Message[]
10
- cache: Cache[]
11
- logs: Log[]
12
- }
13
-
14
- export type RequestMeta = {
15
- controller: string
16
- action: string
17
- params: { [key: string]: string }
18
- format: string
19
- method: string
20
- path: string
21
- status: number
22
- view_runtime: number
23
- db_runtime: number
24
- duration: number
25
- cpu_time: number
26
- idle_time: number
27
- allocations: number
28
- }
29
-
30
- export type RequestRequest = {
31
- method: string
32
- path: string
33
- format: string
34
- headers: Headers
35
- params: { [key: string]: any }
36
- }
37
-
38
- export type RequestResponse = {
39
- status: number
40
- headers: Headers
41
- body: string
42
- }
43
-
44
- export type Headers = { [key: string]: string }
45
-
46
- export type Query = {
47
- id: string
48
- name: string
49
- sql: string
50
- cached: boolean
51
- async: boolean
52
- binds: any[]
53
- source: string[]
54
- duration: number
55
- lock_wait: number
56
- }
57
-
58
- export type Job = {
59
- id: string
60
- class: string
61
- queue: string
62
- args: any[]
63
- successfully_enqueued: boolean
64
- scheduled_at?: number
65
- logs: string[]
66
- }
67
-
68
- export type Message = {
69
- msg: string
70
- extra: any
71
- }
72
-
73
- export type Cache = {
74
- time: string
75
- name: string
76
- label: string
77
- key: string
78
- store: string
79
- transaction_id: string
80
- hit?: boolean
81
- super_operation?: string
82
- }
83
-
84
- export type Log = {
85
- time: string
86
- severity: number
87
- severity_label: string
88
- message: string
89
- progname: string
90
- }
91
-
92
- export class BackendRequest {
93
- id: string
94
- meta: RequestMeta
95
- request: RequestRequest
96
- response: RequestResponse
97
- models: { [key: string]: number }
98
- queries: Query[]
99
- jobs: Job[]
100
- messages: Message[]
101
- cache: Cache[]
102
- logs: Log[]
103
-
104
- constructor(data: BackendRequestData) {
105
- if (import.meta.env.DEV) {
106
- console.log(data)
107
- }
108
-
109
- this.id = data?.id || "null"
110
- this.meta = data?.meta || ({} as unknown as RequestMeta)
111
- this.request = data?.request || ({} as unknown as RequestRequest)
112
- this.response = data?.response || ({} as unknown as RequestResponse)
113
- this.models = data?.models || {}
114
- this.queries = data?.queries || []
115
- this.jobs = data?.jobs || []
116
- this.messages = data?.messages || []
117
- this.cache = data?.cache || []
118
- this.logs = data?.logs || []
119
- }
120
-
121
- get modelsCount(): number {
122
- return Object.values(this.models).reduce((a, b) => a + b, 0)
123
- }
124
-
125
- get queryCount(): number {
126
- return this.queries.length
127
- }
128
-
129
- get jobsCount(): number {
130
- return this.jobs.length
131
- }
132
-
133
- get messagesCount(): number {
134
- return this.messages.length
135
- }
136
-
137
- get cacheCount(): number {
138
- // count unique cache message per transaction_id
139
- return this.cache.reduce((acc, curr) => {
140
- if (acc.indexOf(curr.transaction_id) === -1) {
141
- acc.push(curr.transaction_id)
142
- }
143
- return acc
144
- }, []).length
145
- }
146
-
147
- get pathWithVerb(): string {
148
- return `${this.meta.method.toUpperCase()} ${this.meta.path}`
149
- }
150
-
151
- get dataForTabs(): { [key: string]: any } {
152
- const tabs = {
153
- messages: {
154
- label: "Debug",
155
- count: this.messagesCount,
156
- },
157
- models: {
158
- label: "Models",
159
- count: this.modelsCount,
160
- },
161
- queries: {
162
- label: "Queries",
163
- count: this.queryCount,
164
- },
165
- jobs: {
166
- label: "Jobs",
167
- count: this.jobsCount,
168
- },
169
- cache: {
170
- label: "Cache",
171
- count: this.cacheCount,
172
- },
173
- }
174
-
175
- if (this.logs.length > 0) {
176
- tabs["logs"] = {
177
- label: "Logs",
178
- }
179
- }
180
-
181
- return tabs
182
- }
183
- }
@@ -1,36 +0,0 @@
1
- import { defineStore } from "pinia"
2
- import { BackendRequest, BackendRequestData } from "@/models/Request.ts"
3
-
4
- export let useRequestsStore = defineStore("requests", {
5
- state: () => {
6
- return {
7
- requests: [],
8
- currentRequest: null,
9
- } as {
10
- requests: BackendRequest[]
11
- currentRequest: BackendRequest
12
- }
13
- },
14
- actions: {
15
- addRequests(requests: BackendRequestData[]): string[] {
16
- const ids = []
17
- requests.forEach((r) => {
18
- if (!this.requests.find((req) => req.id === r.id)) {
19
- this.requests.push(new BackendRequest(r))
20
- }
21
- ids.push(r.id)
22
- })
23
- return ids
24
- },
25
- setCurrentRequestById(id: string) {
26
- this.currentRequest = this.requests.find((r) => r.id === id)!
27
- },
28
- clearRequests() {
29
- this.requests = []
30
- this.currentRequest = null
31
- },
32
- // removeRequest(request) {
33
- // this.requests.splice(this.requests.indexOf(request), 1)
34
- // },
35
- },
36
- })
@@ -1,8 +0,0 @@
1
- import { defineStore } from "pinia"
2
- import { newDebugbarConfig } from "@/models/Config.ts"
3
-
4
- export let useConfigStore = defineStore("config", {
5
- state: () => ({
6
- config: newDebugbarConfig(window._debugbarConfigOptions),
7
- }),
8
- })
data/client/src/style.css DELETED
@@ -1,23 +0,0 @@
1
- @import "highlight.js/styles/github.css";
2
-
3
- @tailwind base;
4
- @tailwind components;
5
- @tailwind utilities;
6
-
7
- @layer components {
8
- pre, pre code.hljs {
9
- @apply w-full !m-0 !p-0;
10
- }
11
- }
12
-
13
- button {
14
- @apply cursor-pointer;
15
- }
16
-
17
- .simple-button {
18
- @apply border border-stone-300 shadow px-1.5 text-sm hover:bg-stone-200 hover:shadow-md;
19
- }
20
-
21
- button[disabled] {
22
- @apply opacity-50 cursor-not-allowed;
23
- }
@@ -1,9 +0,0 @@
1
- import { DebugbarConfig, DebugbarConfigOptions } from "@/models/Config.ts"
2
-
3
- export {}
4
-
5
- declare global {
6
- interface Window {
7
- _debugbarConfigOptions?: DebugbarConfigOptions
8
- }
9
- }
@@ -1 +0,0 @@
1
- /// <reference types="vite/client" />
@@ -1,16 +0,0 @@
1
- /** @type {import('tailwindcss').Config} */
2
- export default {
3
- content: ["./index.html", "./src/**/*.{vue,js,ts,jsx,tsx}"],
4
- theme: {
5
- extend: {
6
- colors: {
7
- "red-rails": "#D30001",
8
- "gray-rails": "#F0E7E9",
9
- },
10
- },
11
- },
12
- plugins: [],
13
- corePlugins: {
14
- preflight: true,
15
- },
16
- }
data/client/tsconfig.json DELETED
@@ -1,29 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2020",
4
- "useDefineForClassFields": true,
5
- "typeRoots": ["./node_modules/@types", "./src/types"],
6
- "module": "ESNext",
7
- "lib": ["ES2020", "DOM", "DOM.Iterable"],
8
- "skipLibCheck": true,
9
- "paths": {
10
- "@/*": ["./src/*"]
11
- },
12
-
13
- /* Bundler mode */
14
- "moduleResolution": "bundler",
15
- "allowImportingTsExtensions": true,
16
- "resolveJsonModule": true,
17
- "isolatedModules": true,
18
- "noEmit": true,
19
- "jsx": "preserve",
20
-
21
- /* Linting */
22
- "strict": false,
23
- "noUnusedLocals": true,
24
- "noUnusedParameters": true,
25
- "noFallthroughCasesInSwitch": true
26
- },
27
- "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"],
28
- "references": [{ "path": "./tsconfig.node.json" }]
29
- }
@@ -1,10 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "composite": true,
4
- "skipLibCheck": true,
5
- "module": "ESNext",
6
- "moduleResolution": "bundler",
7
- "allowSyntheticDefaultImports": true
8
- },
9
- "include": ["vite.config.ts"]
10
- }
@@ -1,44 +0,0 @@
1
- import { fileURLToPath, URL } from "node:url"
2
-
3
- import { defineConfig } from "vite"
4
- import vue from "@vitejs/plugin-vue"
5
- import { resolve } from "path"
6
-
7
- const entryFile = process.env.VITE_DEMO_MODE ? "./src/demo.ts" : "./src/main.ts"
8
-
9
- const currentConfig = {
10
- entry: resolve(__dirname, entryFile),
11
- fileName: "debugbar.js",
12
- }
13
-
14
- const isNotReallyProd = () => {
15
- if (process.env.VITE_DEMO_MODE && process.env.NODE_ENV === "production") {
16
- return true
17
- }
18
-
19
- return process.env.NODE_ENV != "production"
20
- }
21
-
22
- // https://vitejs.dev/config/
23
- export default defineConfig({
24
- define: {
25
- __VUE_PROD_DEVTOOLS__: isNotReallyProd(),
26
- },
27
- plugins: [vue()],
28
- resolve: {
29
- alias: {
30
- "@": fileURLToPath(new URL("./src", import.meta.url)),
31
- },
32
- },
33
- build: {
34
- manifest: true,
35
- sourcemap: isNotReallyProd(),
36
- emptyOutDir: false,
37
- outDir: process.env.VITE_DEMO_MODE ? "./dist-demo" : "./dist",
38
- rollupOptions: {
39
- input: {
40
- debugbar: fileURLToPath(new URL(entryFile, import.meta.url)),
41
- },
42
- },
43
- },
44
- })