@windwalker-io/core 4.0.7 → 4.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/.gulp.json +7 -7
  2. package/LICENSE +19 -19
  3. package/dist/debugger/114.js.map +1 -0
  4. package/dist/debugger/338.js.map +1 -0
  5. package/dist/debugger/358.js.map +1 -0
  6. package/dist/debugger/500.js.map +1 -0
  7. package/dist/debugger/548.js.map +1 -0
  8. package/dist/debugger/694.js.map +1 -0
  9. package/dist/debugger/798.js.map +1 -0
  10. package/dist/debugger/851.js.map +1 -0
  11. package/dist/debugger/864.js.map +1 -0
  12. package/dist/debugger/chunk-vendor-114.js +3 -0
  13. package/dist/debugger/chunk-vendor-114.js.LICENSE.txt +8 -0
  14. package/dist/debugger/chunk-vendor-338.js +3 -0
  15. package/dist/debugger/chunk-vendor-338.js.LICENSE.txt +15 -0
  16. package/dist/debugger/chunk-vendor-358.js +2 -0
  17. package/dist/debugger/chunk-vendor-500.js +3 -0
  18. package/dist/debugger/chunk-vendor-500.js.LICENSE.txt +8 -0
  19. package/dist/debugger/chunk-vendor-548.js +3 -0
  20. package/dist/debugger/chunk-vendor-548.js.LICENSE.txt +15 -0
  21. package/dist/debugger/chunk-vendor-694.js +3 -0
  22. package/dist/debugger/chunk-vendor-694.js.LICENSE.txt +1 -0
  23. package/dist/debugger/chunk-vendor-798.js +3 -0
  24. package/dist/debugger/chunk-vendor-798.js.LICENSE.txt +1 -0
  25. package/dist/debugger/chunk-vendor-851.js +3 -0
  26. package/dist/debugger/chunk-vendor-851.js.LICENSE.txt +8 -0
  27. package/dist/debugger/chunk-vendor-864.js +3 -0
  28. package/dist/debugger/chunk-vendor-864.js.LICENSE.txt +1 -0
  29. package/dist/debugger/debugger.js +1 -1
  30. package/dist/debugger/debugger.js.LICENSE.txt +11 -2
  31. package/dist/debugger/debugger.js.map +1 -1
  32. package/dist/debugger/dev/chunk-vendor-scss_debugger_scss.js +219 -0
  33. package/dist/debugger/dev/chunk-vendor-src_debugger_layouts_DefaultLayout_vue.js +77 -0
  34. package/dist/debugger/dev/chunk-vendor-src_debugger_views_Dashboard_vue.js +81 -0
  35. package/dist/debugger/dev/chunk-vendor-src_debugger_views_Database_vue.js +187 -0
  36. package/dist/debugger/dev/chunk-vendor-src_debugger_views_Events_vue.js +122 -0
  37. package/dist/debugger/dev/chunk-vendor-src_debugger_views_Request_vue.js +122 -0
  38. package/dist/debugger/dev/chunk-vendor-src_debugger_views_Routing_vue.js +122 -0
  39. package/dist/debugger/dev/chunk-vendor-src_debugger_views_System_vue.js +67 -0
  40. package/dist/debugger/dev/chunk-vendor-src_debugger_views_Timeline_vue.js +132 -0
  41. package/dist/debugger/dev/chunk-vendor-vendors-node_modules_bootstrap_js_src_modal_js-node_modules_sql-formatter_lib_index_js.js +923 -0
  42. package/dist/debugger/dev/chunk-vendor-vendors-node_modules_sql-formatter_lib_index_js-node_modules_bootstrap_js_src_modal_js.js +923 -0
  43. package/fusionfile.mjs +25 -15
  44. package/package.json +11 -5
  45. package/scss/_variables.scss +8 -0
  46. package/scss/base/_typography.scss +9 -0
  47. package/scss/debugger.scss +46 -17
  48. package/scss/layout/_layout.scss +1 -2
  49. package/scss/layout/_sidebar.scss +7 -2
  50. package/src/debugger/App.vue +74 -38
  51. package/src/debugger/Store.vue +1 -1
  52. package/src/debugger/components/BsModal.vue +128 -0
  53. package/src/debugger/components/KeyValueTable.vue +51 -0
  54. package/src/debugger/components/db/{query-info.vue → QueryInfo.vue} +87 -55
  55. package/src/debugger/components/events/EventListenersTable.vue +75 -0
  56. package/src/debugger/components/timeline/TimelineTable.vue +107 -0
  57. package/src/debugger/debugger.js +4 -1
  58. package/src/debugger/font-awesome.js +23 -0
  59. package/src/debugger/layouts/DefaultLayout.vue +19 -4
  60. package/src/debugger/routes.js +9 -6
  61. package/src/debugger/services/utilities.js +18 -0
  62. package/src/debugger/views/Dashboard.vue +20 -10
  63. package/src/debugger/views/Database.vue +113 -26
  64. package/src/debugger/views/Events.vue +113 -0
  65. package/src/debugger/views/Request.vue +133 -1
  66. package/src/debugger/views/Routing.vue +210 -0
  67. package/src/debugger/views/System.vue +37 -8
  68. package/src/debugger/views/Timeline.vue +92 -0
  69. package/src/{webpack.config.js → debugger/webpack.config.js} +1 -1
  70. package/src/index.mjs +9 -9
  71. package/src/install-vendors.mjs +10 -3
  72. package/src/utils.mjs +1 -2
  73. package/dist/debugger/1.js +0 -2
  74. package/dist/debugger/1.js.map +0 -1
  75. package/dist/debugger/144.js +0 -2
  76. package/dist/debugger/144.js.map +0 -1
  77. package/dist/debugger/2.js +0 -8
  78. package/dist/debugger/2.js.map +0 -1
  79. package/dist/debugger/3.js +0 -2
  80. package/dist/debugger/3.js.map +0 -1
  81. package/dist/debugger/4.js +0 -2
  82. package/dist/debugger/4.js.map +0 -1
  83. package/dist/debugger/5.js +0 -2
  84. package/dist/debugger/5.js.map +0 -1
  85. package/dist/debugger/523.js +0 -2
  86. package/dist/debugger/523.js.map +0 -1
  87. package/dist/debugger/689.js +0 -2
  88. package/dist/debugger/689.js.map +0 -1
  89. package/dist/debugger/715.js +0 -2
  90. package/dist/debugger/715.js.map +0 -1
  91. package/dist/debugger/727.js +0 -3
  92. package/dist/debugger/727.js.LICENSE.txt +0 -6
  93. package/dist/debugger/727.js.map +0 -1
  94. package/tailwind/debugger.tailwind.config.cjs +0 -30
@@ -1,123 +1,137 @@
1
1
  <template>
2
- <!-- component -->
3
- <div :id="`query-${i}`" class="bg-white shadow-md rounded-lg overflow-hidden mx-auto">
4
- <div class="py-4 px-8 mt-3">
5
- <div class="flex items-center justify-between mb-4">
6
- <div>
7
- <h2 class="text-gray-700 font-semibold text-2xl tracking-wide mb-2">
8
- Query: {{ i }}
9
- </h2>
10
- </div>
11
- <div class="text-gray-500 text-base">
2
+ <div :id="`query-${i}`" class="card rounded-3 border border-1 border-primary">
3
+ <div class="card-header d-flex justify-content-between">
4
+ <h4 class="m-0">
5
+ Query: {{ i }}
6
+ </h4>
7
+
8
+ <div class="d-flex align-items-center justify-content-between">
9
+ <div class="text-muted">
12
10
  <button
13
11
  type="button"
14
- class="mr-2 border border-blue-500 text-blue-500 rounded-md px-4 py-1 transition duration-500 ease select-none hover:text-white hover:bg-blue-600 focus:outline-none focus:shadow-outline"
12
+ class="btn btn-outline-primary btn-sm"
15
13
  @click="copy"
16
14
  >
17
15
  <svg style="height: 14px; display: inline" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="clipboard" class="svg-inline--fa fa-clipboard fa-w-12" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path fill="currentColor" d="M336 64h-53.88C268.9 26.8 233.7 0 192 0S115.1 26.8 101.9 64H48C21.5 64 0 85.48 0 112v352C0 490.5 21.5 512 48 512h288c26.5 0 48-21.48 48-48v-352C384 85.48 362.5 64 336 64zM192 64c17.67 0 32 14.33 32 32c0 17.67-14.33 32-32 32S160 113.7 160 96C160 78.33 174.3 64 192 64zM272 224h-160C103.2 224 96 216.8 96 208C96 199.2 103.2 192 112 192h160C280.8 192 288 199.2 288 208S280.8 224 272 224z"></path></svg>
18
- <span class="text-sm ml-2">Copy</span>
16
+ <span class="">Copy</span>
19
17
  </button>
20
18
  <button
21
19
  type="button"
22
- class="mr-2 border border-indigo-500 text-indigo-500 rounded-md px-3 py-2 transition duration-500 ease select-none hover:text-white hover:bg-indigo-600 focus:outline-none focus:shadow-outline"
20
+ class="btn btn-primary btn-sm"
23
21
  >
24
22
  <svg style="height: 14px" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="link" class="svg-inline--fa fa-link fa-w-20" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><path fill="currentColor" d="M598.6 41.41C570.1 13.8 534.8 0 498.6 0s-72.36 13.8-99.96 41.41l-43.36 43.36c15.11 8.012 29.47 17.58 41.91 30.02c3.146 3.146 5.898 6.518 8.742 9.838l37.96-37.96C458.5 72.05 477.1 64 498.6 64c20.67 0 40.1 8.047 54.71 22.66c14.61 14.61 22.66 34.04 22.66 54.71s-8.049 40.1-22.66 54.71l-133.3 133.3C405.5 343.1 386 352 365.4 352s-40.1-8.048-54.71-22.66C296 314.7 287.1 295.3 287.1 274.6s8.047-40.1 22.66-54.71L314.2 216.4C312.1 212.5 309.9 208.5 306.7 205.3C298.1 196.7 286.8 192 274.6 192c-11.93 0-23.1 4.664-31.61 12.97c-30.71 53.96-23.63 123.6 22.39 169.6C293 402.2 329.2 416 365.4 416c36.18 0 72.36-13.8 99.96-41.41L598.6 241.3c28.45-28.45 42.24-66.01 41.37-103.3C639.1 102.1 625.4 68.16 598.6 41.41zM234 387.4L196.1 425.3C181.5 439.1 162 448 141.4 448c-20.67 0-40.1-8.047-54.71-22.66c-14.61-14.61-22.66-34.04-22.66-54.71s8.049-40.1 22.66-54.71l133.3-133.3C234.5 168 253.1 160 274.6 160s40.1 8.048 54.71 22.66c14.62 14.61 22.66 34.04 22.66 54.71s-8.047 40.1-22.66 54.71L325.8 295.6c2.094 3.939 4.219 7.895 7.465 11.15C341.9 315.3 353.3 320 365.4 320c11.93 0 23.1-4.664 31.61-12.97c30.71-53.96 23.63-123.6-22.39-169.6C346.1 109.8 310.8 96 274.6 96C238.4 96 202.3 109.8 174.7 137.4L41.41 270.7c-27.6 27.6-41.41 63.78-41.41 99.96c-.0001 36.18 13.8 72.36 41.41 99.97C69.01 498.2 105.2 512 141.4 512c36.18 0 72.36-13.8 99.96-41.41l43.36-43.36c-15.11-8.012-29.47-17.58-41.91-30.02C239.6 394.1 236.9 390.7 234 387.4z"></path></svg>
25
23
  </button>
26
24
  <button
27
25
  type="button"
28
- class="border border-green-500 text-green-500 rounded-md px-3 py-2 transition duration-500 ease select-none hover:text-white hover:bg-green-600 focus:outline-none focus:shadow-outline"
26
+ class="btn btn-success btn-sm"
29
27
  @click="goToLast('/db')"
30
28
  >
31
29
  <svg style="height: 14px" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="arrow-rotate-right" class="svg-inline--fa fa-arrow-rotate-right fa-w-16" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M496 48V192c0 17.69-14.31 32-32 32H320c-17.69 0-32-14.31-32-32s14.31-32 32-32h63.39c-29.97-39.7-77.25-63.78-127.6-63.78C167.7 96.22 96 167.9 96 256s71.69 159.8 159.8 159.8c34.88 0 68.03-11.03 95.88-31.94c14.22-10.53 34.22-7.75 44.81 6.375c10.59 14.16 7.75 34.22-6.375 44.81c-39.03 29.28-85.36 44.86-134.2 44.86C132.5 479.9 32 379.4 32 256s100.5-223.9 223.9-223.9c69.15 0 134 32.47 176.1 86.12V48c0-17.69 14.31-32 32-32S496 30.31 496 48z"></path></svg>
32
30
  </button>
33
31
  </div>
34
32
  </div>
35
- <div class="bg-gray-100 rounded-lg py-4 px-4"
36
- v-html="item.debug_query">
33
+ </div>
34
+ <div class="card-body">
37
35
 
36
+ <div class="">
37
+ <pre style="word-break: break-all; white-space: pre-wrap;"
38
+ class="bg-light p-4"
39
+ v-html="formatQuery(item.debug_query)"
40
+ ></pre>
38
41
  </div>
39
- <div class="py-4">
40
- Query Time:
41
- <span class="inline-block rounded-full text-gray-600 bg-gray-100 px-2 py-1 text-xs font-bold mr-3">
42
- {{ round(item.time * 1000) }}ms
43
- </span>
44
- Memory:
45
- <span class="inline-block rounded-full text-gray-600 bg-gray-100 px-2 py-1 text-xs font-bold mr-3">
46
- {{ round(item.memory / 1024 / 1024) }}MB
47
- </span>
48
- Return Rows
49
- <span class="inline-block rounded-full text-gray-600 bg-gray-100 px-2 py-1 text-xs font-bold mr-3">
50
- {{ item.count }}
51
- </span>
42
+ <div class="py-4 d-flex justify-content-between">
43
+ <div>
44
+ Query Time:
45
+ <span class="badge" :class="`bg-${stateColor(item.time * 1000, 15)}`">
46
+ {{ round(item.time * 1000) }}ms
47
+ </span>
48
+ Memory:
49
+ <span class="badge" :class="`bg-${stateColor(item.memory / 1024 / 1024, 0.05)}`">
50
+ {{ round(item.memory / 1024 / 1024) }}MB
51
+ </span>
52
+ Return Rows
53
+ <span class="badge bg-info rounded-pill">
54
+ {{ item.count }}
55
+ </span>
56
+ </div>
57
+
58
+ <div>
59
+ <button class="btn btn-primary" @click="openBacktrace(item.backtrace, i)">
60
+ <svg style="height: 14px; fill: white;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M40 48C26.7 48 16 58.7 16 72v48c0 13.3 10.7 24 24 24H88c13.3 0 24-10.7 24-24V72c0-13.3-10.7-24-24-24H40zM192 64c-17.7 0-32 14.3-32 32s14.3 32 32 32H480c17.7 0 32-14.3 32-32s-14.3-32-32-32H192zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32H480c17.7 0 32-14.3 32-32s-14.3-32-32-32H192zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32H480c17.7 0 32-14.3 32-32s-14.3-32-32-32H192zM16 232v48c0 13.3 10.7 24 24 24H88c13.3 0 24-10.7 24-24V232c0-13.3-10.7-24-24-24H40c-13.3 0-24 10.7-24 24zM40 368c-13.3 0-24 10.7-24 24v48c0 13.3 10.7 24 24 24H88c13.3 0 24-10.7 24-24V392c0-13.3-10.7-24-24-24H40z"/></svg>
61
+ Backtrace
62
+ </button>
63
+ </div>
52
64
  </div>
53
65
  </div>
54
66
 
55
67
  <div v-if="item.explain">
56
- <table class="min-w-full">
68
+ <table class="table">
57
69
  <thead>
58
70
  <tr>
59
- <th class="px-4 py-3 border-b-2 border-gray-300 text-left leading-4 text-blue-500 tracking-wider">
71
+ <th class="">
60
72
  ID
61
73
  </th>
62
- <th class="px-4 py-3 border-b-2 border-gray-300 text-left leading-4 text-blue-500 tracking-wider">
74
+ <th class="">
63
75
  Select Type
64
76
  </th>
65
- <th class="px-4 py-3 border-b-2 border-gray-300 text-left leading-4 text-blue-500 tracking-wider">
77
+ <th class="">
66
78
  Table
67
79
  </th>
68
- <th class="px-4 py-3 border-b-2 border-gray-300 text-left leading-4 text-blue-500 tracking-wider">
80
+ <th class="">
69
81
  Type
70
82
  </th>
71
- <th class="px-4 py-3 border-b-2 border-gray-300 text-left leading-4 text-blue-500 tracking-wider">
83
+ <th class="">
72
84
  Possible Keys
73
85
  </th>
74
- <th class="px-4 py-3 border-b-2 border-gray-300 text-left leading-4 text-blue-500 tracking-wider">
86
+ <th class="">
75
87
  Key
76
88
  </th>
77
- <th class="px-4 py-3 border-b-2 border-gray-300 text-left leading-4 text-blue-500 tracking-wider">
89
+ <th class="">
78
90
  Key Length
79
91
  </th>
80
- <th class="px-4 py-3 border-b-2 border-gray-300 text-left leading-4 text-blue-500 tracking-wider">
92
+ <th class="">
81
93
  Reference
82
94
  </th>
83
- <th class="px-4 py-3 border-b-2 border-gray-300 text-left leading-4 text-blue-500 tracking-wider">
95
+ <th class="">
84
96
  Rows
85
97
  </th>
86
- <th class="px-4 py-3 border-b-2 border-gray-300 text-left leading-4 text-blue-500 tracking-wider">
98
+ <th class="">
87
99
  Extra
88
100
  </th>
89
101
  </tr>
90
102
  </thead>
91
103
  <tbody class="bg-white">
92
104
  <tr v-for="explain of item.explain">
93
- <td class="p-4 text-xs whitespace-no-wrap border-b border-gray-500">
105
+ <td class="">
94
106
  {{ explain.id }}
95
107
  </td>
96
- <td class="p-4 text-xs whitespace-no-wrap border-b border-gray-500">
108
+ <td class="">
97
109
  {{ explain.select_type }}
98
110
  </td>
99
- <td class="p-4 text-xs whitespace-no-wrap border-b border-gray-500">
111
+ <td class="">
100
112
  {{ explain.table }}
101
113
  </td>
102
- <td class="p-4 text-xs whitespace-no-wrap border-b border-gray-500">
114
+ <td class="">
103
115
  {{ explain.type }}
104
116
  </td>
105
- <td class="p-4 text-xs whitespace-no-wrap border-b border-gray-500">
106
- {{ explain.possible_keys }}
117
+ <td class="text-wrap">
118
+ <div style="word-break: break-all">
119
+ {{ explain.possible_keys }}
120
+ </div>
107
121
  </td>
108
- <td class="p-4 text-xs whitespace-no-wrap border-b border-gray-500">
122
+ <td class="">
109
123
  {{ explain.key }}
110
124
  </td>
111
- <td class="p-4 text-xs whitespace-no-wrap border-b border-gray-500">
125
+ <td class="">
112
126
  {{ explain.key_len }}
113
127
  </td>
114
- <td class="p-4 text-xs whitespace-no-wrap border-b border-gray-500">
128
+ <td class="">
115
129
  {{ explain.ref }}
116
130
  </td>
117
- <td class="p-4 text-xs whitespace-no-wrap border-b border-gray-500">
131
+ <td class="">
118
132
  {{ explain.rows }}
119
133
  </td>
120
- <td class="p-4 text-xs whitespace-no-wrap border-b border-gray-500">
134
+ <td class="">
121
135
  {{ explain.Extra }}
122
136
  </td>
123
137
  </tr>
@@ -129,30 +143,48 @@
129
143
 
130
144
  <script>
131
145
  import { format } from 'sql-formatter';
146
+ import { stateColor } from '../../services/utilities.js';
132
147
  import { goToLast } from '../../services/nav.js';
133
148
 
134
149
  export default {
135
150
  name: 'query-info',
136
151
  props: {
137
152
  i: Number,
138
- item: Object
153
+ item: Object,
154
+ totalCount: Number,
155
+ totalTime: Number,
156
+ totalMemory: Number,
139
157
  },
140
- setup(props) {
158
+ setup(props, { emit }) {
141
159
  function copy() {
142
160
  navigator.clipboard.writeText(props.item.debug_query);
143
161
  }
144
162
 
163
+ function openBacktrace(backtrace) {
164
+ emit('open-backtrace', backtrace, props.i);
165
+ }
166
+
145
167
  return {
146
168
  formatQuery,
147
169
  round,
148
170
  goToLast,
149
- copy
171
+ copy,
172
+ stateColor,
173
+ openBacktrace
150
174
  };
151
175
  }
152
176
  };
153
177
 
154
178
  function formatQuery(query) {
155
- return format(query).replace(/\n/, '<br>');
179
+ try {
180
+ return format(query, {
181
+ keywordCase: 'upper',
182
+
183
+ }).replace(/\n/, '<br>');
184
+ } catch (e) {
185
+ console.error(e);
186
+ return query;
187
+ }
156
188
  }
157
189
 
158
190
  function round(num) {
@@ -0,0 +1,75 @@
1
+ <template>
2
+ <table class="table table-bordered">
3
+ <thead>
4
+ <tr>
5
+ <th>
6
+ Event Name
7
+ </th>
8
+ <th>
9
+ Times
10
+ </th>
11
+ <th>
12
+ Listener
13
+ </th>
14
+ </tr>
15
+ </thead>
16
+ <tbody>
17
+ <template v-for="(listeners, event) of events" :key="event">
18
+ <template v-if="Object.keys(listeners).length > 0">
19
+ <tr v-for="(count, listener) of listeners">
20
+ <td v-if="isFirstRow(event)" :rowspan="Object.keys(listeners).length">
21
+ <pre>{{ event }}</pre>
22
+ </td>
23
+ <td>
24
+ {{ count }}
25
+ </td>
26
+ <td>
27
+ <pre>{{ listener }}</pre>
28
+ </td>
29
+ </tr>
30
+ </template>
31
+ <template v-else>
32
+ <tr>
33
+ <td>
34
+ <pre>{{ event }}</pre>
35
+ </td>
36
+ <td>
37
+ -
38
+ </td>
39
+ <td>
40
+ -
41
+ </td>
42
+ </tr>
43
+ </template>
44
+ </template>
45
+ </tbody>
46
+ </table>
47
+ </template>
48
+
49
+ <script>
50
+ export default {
51
+ name: 'EventListenersTable',
52
+ props: {
53
+ events: Object,
54
+ },
55
+ setup() {
56
+ let lastEvent = null;
57
+
58
+ function isFirstRow(event) {
59
+ const isFirst = event !== lastEvent;
60
+
61
+ lastEvent = event;
62
+
63
+ return isFirst;
64
+ }
65
+
66
+ return {
67
+ isFirstRow,
68
+ };
69
+ }
70
+ };
71
+ </script>
72
+
73
+ <style scoped>
74
+
75
+ </style>
@@ -0,0 +1,107 @@
1
+ <template>
2
+ <div>
3
+ <table class="table table-bordered">
4
+ <thead>
5
+ <tr>
6
+ <th>Label</th>
7
+ <th class="text-end">Total Time</th>
8
+ <th class="text-end">Time</th>
9
+ <th class="text-end">Total Memory</th>
10
+ <th class="text-end">Memory</th>
11
+ </tr>
12
+ </thead>
13
+
14
+ <tbody>
15
+ <tr v-for="item of items">
16
+ <td>
17
+ {{ item.label }}
18
+ </td>
19
+ <td class="text-end">
20
+ <span class="badge bg-secondary">
21
+ {{ round(item.endTime) }}ms
22
+ </span>
23
+ </td>
24
+ <td class="text-end" v-if="getTimeOffset(item.endTime) || true">
25
+ <span class="badge" :class="'bg-' + stateColor(getCurrentTimeOffset(), 50)">
26
+ {{ round(getCurrentTimeOffset()) }}ms
27
+ </span>
28
+ </td>
29
+ <td class="text-end">
30
+ <span class="badge bg-secondary">
31
+ {{ round(bytesToMB(item.memory)) }}MB
32
+ </span>
33
+ </td>
34
+ <td class="text-end" v-if="getMemoryOffset(item.memory) || true">
35
+ <span class="badge" :class="'bg-' + stateColor(bytesToMB(getCurrentMemoryOffset()), 2)">
36
+ {{ round(bytesToMB(getCurrentMemoryOffset())) }}MB
37
+ </span>
38
+ </td>
39
+ </tr>
40
+ </tbody>
41
+ </table>
42
+ </div>
43
+ </template>
44
+
45
+ <script>
46
+ import { stateColor } from '../../services/utilities.js';
47
+
48
+ export default {
49
+ name: 'TimelineTable',
50
+ props: {
51
+ items: Array
52
+ },
53
+ setup() {
54
+ let lastTime = 0;
55
+ let timeOffset = 0;
56
+
57
+ function getTimeOffset(time) {
58
+ timeOffset = time - lastTime;
59
+
60
+ lastTime = time;
61
+
62
+ return timeOffset;
63
+ }
64
+
65
+ function getCurrentTimeOffset() {
66
+ return timeOffset;
67
+ }
68
+
69
+ let lastMemory = 0;
70
+ let memoryOffset = 0;
71
+
72
+ function getMemoryOffset(memory) {
73
+ memoryOffset = memory - lastMemory;
74
+
75
+ lastMemory = memory;
76
+
77
+ return memoryOffset;
78
+ }
79
+
80
+ function getCurrentMemoryOffset() {
81
+ return memoryOffset;
82
+ }
83
+
84
+ function bytesToMB(value) {
85
+ return value / 1024 / 1024;
86
+ }
87
+
88
+ function round(num) {
89
+ return Math.round(num * 10000) / 10000;
90
+ }
91
+
92
+ return {
93
+ getTimeOffset,
94
+ getCurrentTimeOffset,
95
+ getMemoryOffset,
96
+ getCurrentMemoryOffset,
97
+ stateColor,
98
+ bytesToMB,
99
+ round
100
+ };
101
+ }
102
+ };
103
+ </script>
104
+
105
+ <style scoped>
106
+
107
+ </style>
@@ -9,10 +9,13 @@ import 'regenerator-runtime';
9
9
  import App from '@/App.vue';
10
10
  import { createApp } from 'vue';
11
11
  import router from './routes.js';
12
+ import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
13
+ import './font-awesome.js';
12
14
 
13
15
  import '../../scss/debugger.scss';
14
16
 
15
17
  const app = createApp(App)
16
- .use(router);
18
+ .use(router)
19
+ .component('fa-icon', FontAwesomeIcon);
17
20
 
18
21
  app.mount('app');
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Part of earth project.
3
+ *
4
+ * @copyright Copyright (C) 2022 __ORGANIZATION__.
5
+ * @license __LICENSE__
6
+ */
7
+
8
+ /* import the fontawesome core */
9
+ import { library } from '@fortawesome/fontawesome-svg-core'
10
+
11
+ /* import specific icons */
12
+ import { faList } from '@fortawesome/free-solid-svg-icons/faList'
13
+ import { faArrowsRotate } from '@fortawesome/free-solid-svg-icons/faArrowsRotate'
14
+ import { faEye } from '@fortawesome/free-solid-svg-icons/faEye'
15
+ import { faExternalLink } from '@fortawesome/free-solid-svg-icons/faExternalLink'
16
+
17
+ /* add icons to the library */
18
+ library.add(
19
+ faEye,
20
+ faExternalLink,
21
+ faList,
22
+ faArrowsRotate,
23
+ );
@@ -1,11 +1,19 @@
1
1
  <template>
2
2
  <div v-if="currentData">
3
- <div class="p-6 bg-gray-300">
3
+ <div class="p-3" style="background-color: var(--bs-gray-200);">
4
4
  <h1 class="text-xl font-bold text-gray-800">
5
5
  <slot name="title"></slot>
6
6
  </h1>
7
- <div class="text-gray-600">
8
- {{ currentId }} / <a target="_blank" class="text-gray-600" :href="currentData.url">{{ currentData.url }}</a>
7
+ <div class="text-muted">
8
+ <router-link to="/" class="btn btn-sm btn-primary">
9
+ <fa-icon icon="fa-solid fa-list"></fa-icon>
10
+ </router-link>
11
+ <button type="button" @click="goToLast('/' + route.name)" class="btn btn-sm btn-success">
12
+ <fa-icon icon="fa-solid fa-arrows-rotate"></fa-icon>
13
+ </button>
14
+ /
15
+ {{ currentId }}
16
+ / <a target="_blank" class="text-gray-600" :href="currentData.url">{{ currentData.url }}</a>
9
17
  </div>
10
18
  </div>
11
19
 
@@ -14,14 +22,21 @@
14
22
  </template>
15
23
 
16
24
  <script>
25
+ import { useRoute } from 'vue-router';
26
+ import { goToLast } from '../services/nav.js';
17
27
  import { currentData, currentId } from '../services/store.js';
18
28
 
19
29
  export default {
20
30
  name: 'DefaultLayout',
21
31
  setup() {
32
+ const route = useRoute();
33
+
22
34
  return {
23
35
  currentId,
24
- currentData
36
+ currentData,
37
+ route,
38
+
39
+ goToLast
25
40
  };
26
41
  }
27
42
  };
@@ -10,10 +10,13 @@ import $http from './services/http.js';
10
10
  import { currentData, currentId } from './services/store.js';
11
11
 
12
12
  const routes = [
13
- { path: '/', component: () => import('./views/Dashboard.vue') },
14
- { path: '/system/:id?', component: () => import('./views/System.vue') },
15
- { path: '/request/:id?', component: () => import('./views/Request.vue') },
16
- { path: '/db/:id?', component: () => import('./views/Database.vue') },
13
+ { name: 'dashboard', path: '/', component: () => import('./views/Dashboard.vue') },
14
+ { name: 'system', path: '/system/:id?', component: () => import('./views/System.vue') },
15
+ { name: 'request', path: '/request/:id?', component: () => import('./views/Request.vue') },
16
+ { name: 'routing', path: '/routing/:id?', component: () => import('./views/Routing.vue') },
17
+ { name: 'timeline', path: '/timeline/:id?', component: () => import('./views/Timeline.vue') },
18
+ { name: 'events', path: '/events/:id?', component: () => import('./views/Events.vue') },
19
+ { name: 'db', path: '/db/:id?', component: () => import('./views/Database.vue') },
17
20
  ];
18
21
 
19
22
  const router = createRouter({
@@ -36,8 +39,8 @@ router.beforeEach(async (to, from) => {
36
39
  currentId.value = to.params.id;
37
40
 
38
41
  const params = new URLSearchParams({
39
- 'path[url]': 'http.systemUri.full',
40
- 'path[status]': 'http.response.status',
42
+ 'path[url]': 'http::systemUri.full',
43
+ 'path[status]': 'http::response.status',
41
44
  });
42
45
  const res = await $http.get('ajax/data?' + params.toString());
43
46
 
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Part of earth project.
3
+ *
4
+ * @copyright Copyright (C) 2022 __ORGANIZATION__.
5
+ * @license __LICENSE__
6
+ */
7
+
8
+ export function stateColor(value, avg) {
9
+ if (value > (avg * 2)) {
10
+ return 'danger';
11
+ } else if (value > (avg * 1.5)) {
12
+ return 'warning';
13
+ } else if (value < (avg / 2)) {
14
+ return 'success';
15
+ } else {
16
+ return 'info';
17
+ }
18
+ }
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div class="p-4">
3
- <table class="table table-auto">
4
- <thead>
3
+ <table class="table table-striped table-bordered">
4
+ <thead class="table-dark">
5
5
  <tr>
6
6
  <th>
7
7
  ID
@@ -30,13 +30,15 @@
30
30
  <tbody>
31
31
  <tr v-for="item of items">
32
32
  <td>
33
- {{ item.id }}
33
+ <a href="#" @click.prevent="selectId(item.id)" class="link-secondary">
34
+ {{ item.id }}
35
+ </a>
34
36
  </td>
35
37
  <td>
36
- <button class="bg-blue-400 rounded-sm px-3 py-2 text-white hover:bg-blue-500"
38
+ <button class="btn btn-primary btn-sm"
37
39
  type="button"
38
40
  @click="selectId(item.id)">
39
- <svg style="height: 16px" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="eye" class="svg-inline--fa fa-eye fa-w-18" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path fill="currentColor" d="M572.5 238.1C518.3 115.5 410.9 32 288 32S57.69 115.6 3.469 238.1C1.563 243.4 0 251 0 256c0 4.977 1.562 12.6 3.469 17.03C57.72 396.5 165.1 480 288 480s230.3-83.58 284.5-206.1C574.4 268.6 576 260.1 576 256C576 251 574.4 243.4 572.5 238.1zM432 256c0 79.45-64.47 144-143.9 144C208.6 400 144 335.5 144 256S208.5 112 288 112S432 176.5 432 256zM288 160C285.7 160 282.4 160.4 279.5 160.8C284.8 170 288 180.6 288 192c0 35.35-28.65 64-64 64C212.6 256 201.1 252.7 192.7 247.5C192.4 250.5 192 253.6 192 256c0 52.1 43 96 96 96s96-42.99 96-95.99S340.1 160 288 160z"></path></svg>
41
+ <fa-icon icon="fa-solid fa-eye"></fa-icon>
40
42
  </button>
41
43
  </td>
42
44
  <td>
@@ -46,16 +48,18 @@
46
48
  {{ item.method }}
47
49
  </td>
48
50
  <td>
49
- <a href="#"
50
- class="text-gray-400">
51
+ <a :href="item.url"
52
+ target="_blank"
53
+ class="link-secondary">
51
54
  {{ item.url }}
55
+ <fa-icon class="small" icon="fa-solid fa-external-link"></fa-icon>
52
56
  </a>
53
57
  </td>
54
58
  <td>
55
- {{ item.time }}
59
+ {{ dateFormat(item.time) }}
56
60
  </td>
57
61
  <td>
58
- {{ item.status }}
62
+ {{ item.response?.status }}
59
63
  </td>
60
64
  </tr>
61
65
  </tbody>
@@ -64,6 +68,7 @@
64
68
  </template>
65
69
 
66
70
  <script>
71
+ import * as dayjs from 'dayjs';
67
72
  import { onMounted, reactive, toRefs } from 'vue';
68
73
  import router from '@/routes.js';
69
74
  import $http from '@/services/http.js';
@@ -88,9 +93,14 @@ export default {
88
93
  router.push('/system/' + id);
89
94
  }
90
95
 
96
+ function dateFormat(ts) {
97
+ return dayjs.unix(ts).format('YYYY-MM-DD HH:mm:ssZ');
98
+ }
99
+
91
100
  return {
92
101
  ...toRefs(state),
93
- selectId
102
+ selectId,
103
+ dateFormat,
94
104
  };
95
105
  }
96
106
  };