@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.
- package/.gulp.json +7 -7
- package/LICENSE +19 -19
- package/dist/debugger/114.js.map +1 -0
- package/dist/debugger/338.js.map +1 -0
- package/dist/debugger/358.js.map +1 -0
- package/dist/debugger/500.js.map +1 -0
- package/dist/debugger/548.js.map +1 -0
- package/dist/debugger/694.js.map +1 -0
- package/dist/debugger/798.js.map +1 -0
- package/dist/debugger/851.js.map +1 -0
- package/dist/debugger/864.js.map +1 -0
- package/dist/debugger/chunk-vendor-114.js +3 -0
- package/dist/debugger/chunk-vendor-114.js.LICENSE.txt +8 -0
- package/dist/debugger/chunk-vendor-338.js +3 -0
- package/dist/debugger/chunk-vendor-338.js.LICENSE.txt +15 -0
- package/dist/debugger/chunk-vendor-358.js +2 -0
- package/dist/debugger/chunk-vendor-500.js +3 -0
- package/dist/debugger/chunk-vendor-500.js.LICENSE.txt +8 -0
- package/dist/debugger/chunk-vendor-548.js +3 -0
- package/dist/debugger/chunk-vendor-548.js.LICENSE.txt +15 -0
- package/dist/debugger/chunk-vendor-694.js +3 -0
- package/dist/debugger/chunk-vendor-694.js.LICENSE.txt +1 -0
- package/dist/debugger/chunk-vendor-798.js +3 -0
- package/dist/debugger/chunk-vendor-798.js.LICENSE.txt +1 -0
- package/dist/debugger/chunk-vendor-851.js +3 -0
- package/dist/debugger/chunk-vendor-851.js.LICENSE.txt +8 -0
- package/dist/debugger/chunk-vendor-864.js +3 -0
- package/dist/debugger/chunk-vendor-864.js.LICENSE.txt +1 -0
- package/dist/debugger/debugger.js +1 -1
- package/dist/debugger/debugger.js.LICENSE.txt +11 -2
- package/dist/debugger/debugger.js.map +1 -1
- package/dist/debugger/dev/chunk-vendor-scss_debugger_scss.js +219 -0
- package/dist/debugger/dev/chunk-vendor-src_debugger_layouts_DefaultLayout_vue.js +77 -0
- package/dist/debugger/dev/chunk-vendor-src_debugger_views_Dashboard_vue.js +81 -0
- package/dist/debugger/dev/chunk-vendor-src_debugger_views_Database_vue.js +187 -0
- package/dist/debugger/dev/chunk-vendor-src_debugger_views_Events_vue.js +122 -0
- package/dist/debugger/dev/chunk-vendor-src_debugger_views_Request_vue.js +122 -0
- package/dist/debugger/dev/chunk-vendor-src_debugger_views_Routing_vue.js +122 -0
- package/dist/debugger/dev/chunk-vendor-src_debugger_views_System_vue.js +67 -0
- package/dist/debugger/dev/chunk-vendor-src_debugger_views_Timeline_vue.js +132 -0
- package/dist/debugger/dev/chunk-vendor-vendors-node_modules_bootstrap_js_src_modal_js-node_modules_sql-formatter_lib_index_js.js +923 -0
- package/dist/debugger/dev/chunk-vendor-vendors-node_modules_sql-formatter_lib_index_js-node_modules_bootstrap_js_src_modal_js.js +923 -0
- package/fusionfile.mjs +25 -15
- package/package.json +11 -5
- package/scss/_variables.scss +8 -0
- package/scss/base/_typography.scss +9 -0
- package/scss/debugger.scss +46 -17
- package/scss/layout/_layout.scss +1 -2
- package/scss/layout/_sidebar.scss +7 -2
- package/src/debugger/App.vue +74 -38
- package/src/debugger/Store.vue +1 -1
- package/src/debugger/components/BsModal.vue +128 -0
- package/src/debugger/components/KeyValueTable.vue +51 -0
- package/src/debugger/components/db/{query-info.vue → QueryInfo.vue} +87 -55
- package/src/debugger/components/events/EventListenersTable.vue +75 -0
- package/src/debugger/components/timeline/TimelineTable.vue +107 -0
- package/src/debugger/debugger.js +4 -1
- package/src/debugger/font-awesome.js +23 -0
- package/src/debugger/layouts/DefaultLayout.vue +19 -4
- package/src/debugger/routes.js +9 -6
- package/src/debugger/services/utilities.js +18 -0
- package/src/debugger/views/Dashboard.vue +20 -10
- package/src/debugger/views/Database.vue +113 -26
- package/src/debugger/views/Events.vue +113 -0
- package/src/debugger/views/Request.vue +133 -1
- package/src/debugger/views/Routing.vue +210 -0
- package/src/debugger/views/System.vue +37 -8
- package/src/debugger/views/Timeline.vue +92 -0
- package/src/{webpack.config.js → debugger/webpack.config.js} +1 -1
- package/src/index.mjs +9 -9
- package/src/install-vendors.mjs +10 -3
- package/src/utils.mjs +1 -2
- package/dist/debugger/1.js +0 -2
- package/dist/debugger/1.js.map +0 -1
- package/dist/debugger/144.js +0 -2
- package/dist/debugger/144.js.map +0 -1
- package/dist/debugger/2.js +0 -8
- package/dist/debugger/2.js.map +0 -1
- package/dist/debugger/3.js +0 -2
- package/dist/debugger/3.js.map +0 -1
- package/dist/debugger/4.js +0 -2
- package/dist/debugger/4.js.map +0 -1
- package/dist/debugger/5.js +0 -2
- package/dist/debugger/5.js.map +0 -1
- package/dist/debugger/523.js +0 -2
- package/dist/debugger/523.js.map +0 -1
- package/dist/debugger/689.js +0 -2
- package/dist/debugger/689.js.map +0 -1
- package/dist/debugger/715.js +0 -2
- package/dist/debugger/715.js.map +0 -1
- package/dist/debugger/727.js +0 -3
- package/dist/debugger/727.js.LICENSE.txt +0 -6
- package/dist/debugger/727.js.map +0 -1
- package/tailwind/debugger.tailwind.config.cjs +0 -30
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<defaultLayout>
|
|
3
3
|
<template #title>
|
|
4
4
|
Database
|
|
5
5
|
</template>
|
|
@@ -7,37 +7,91 @@
|
|
|
7
7
|
<div v-if="data" class="p-4">
|
|
8
8
|
<!-- DB info -->
|
|
9
9
|
|
|
10
|
-
<
|
|
11
|
-
<
|
|
10
|
+
<ul class="nav nav-pills" id="profilers-tab" role="tablist">
|
|
11
|
+
<li class="nav-item" role="presentation"
|
|
12
|
+
v-for="(instance, i) of instances">
|
|
13
|
+
<button class="nav-link active" id="home-tab" data-bs-toggle="tab"
|
|
14
|
+
:data-bs-target="`tab-${instance}`"
|
|
15
|
+
type="button"
|
|
16
|
+
role="tab"
|
|
17
|
+
aria-selected="true">
|
|
18
|
+
{{ instance }}
|
|
19
|
+
</button>
|
|
20
|
+
</li>
|
|
21
|
+
</ul>
|
|
12
22
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
23
|
+
<div class="tab-content mt-4" id="myTabContent">
|
|
24
|
+
<div class="tab-pane fade "
|
|
25
|
+
v-for="(instance, i) of instances"
|
|
26
|
+
:class="[ i === 0 ? 'show active' : '' ]"
|
|
27
|
+
:id="`tab-${instance}`"
|
|
28
|
+
role="tabpanel"
|
|
29
|
+
tabindex="0">
|
|
30
|
+
|
|
31
|
+
<div>
|
|
32
|
+
<h4>Queries</h4>
|
|
33
|
+
|
|
34
|
+
<div class="my-3">
|
|
35
|
+
Count: <span class="badge bg-info">{{ data?.queries[instance]?.length || 0 }}</span>
|
|
36
|
+
-
|
|
37
|
+
Time:
|
|
38
|
+
<span class="badge" :class="`bg-${stateColor(totalTime(instance), 15 * (data?.queries[instance]?.length || 0))}`">
|
|
39
|
+
{{ round(totalTime(instance)) }}ms
|
|
40
|
+
</span>
|
|
41
|
+
-
|
|
42
|
+
Memory:
|
|
43
|
+
<span class="badge" :class="`bg-${stateColor(totalMemory(instance), 0.05 * (data?.queries[instance]?.length || 0))}`">
|
|
44
|
+
{{ round(totalMemory(instance)) }}MB
|
|
45
|
+
</span>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<div class="mt-5">
|
|
50
|
+
<div class="mb-4" v-for="(query, i) of data.queries[instance]">
|
|
51
|
+
<QueryInfo :item="query" :i="i + 1"
|
|
52
|
+
:total-count="data?.queries[instance]?.length || 0"
|
|
53
|
+
:total-time="totalTime(instance)"
|
|
54
|
+
:total-memory="totalMemory(instance)"
|
|
55
|
+
@open-backtrace="openBacktrace"
|
|
56
|
+
/>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
21
59
|
|
|
22
|
-
<div class="mt-5">
|
|
23
|
-
<div class="mb-4" v-for="(query, i) of data.queries">
|
|
24
|
-
<query-info :item="query" :i="i + 1" />
|
|
25
60
|
</div>
|
|
26
61
|
</div>
|
|
27
62
|
|
|
63
|
+
<BsModal :open="showBacktraceModal" @hidden="showBacktraceModal = false"
|
|
64
|
+
:title="`Query ${backtraceIndex}: Backtrace`" size="xl">
|
|
65
|
+
<table class="table table-striped table-bordered">
|
|
66
|
+
<tbody>
|
|
67
|
+
<tr v-for="traceItem of backtrace" style="font-family: monospace; font-size: 13px; word-break: break-all;">
|
|
68
|
+
<td>
|
|
69
|
+
{{ traceItem.function }}
|
|
70
|
+
</td>
|
|
71
|
+
<td>
|
|
72
|
+
<a :href="getEditorLink(traceItem)">
|
|
73
|
+
{{ replaceRoot(traceItem.pathname) }}
|
|
74
|
+
</a>
|
|
75
|
+
</td>
|
|
76
|
+
</tr>
|
|
77
|
+
</tbody>
|
|
78
|
+
</table>
|
|
79
|
+
</BsModal>
|
|
28
80
|
</div>
|
|
29
|
-
</
|
|
81
|
+
</defaultLayout>
|
|
30
82
|
</template>
|
|
31
83
|
|
|
32
84
|
<script>
|
|
33
85
|
import { computed, ref } from 'vue';
|
|
34
|
-
import
|
|
35
|
-
import
|
|
36
|
-
import
|
|
86
|
+
import BsModal from '@/components/BsModal.vue';
|
|
87
|
+
import QueryInfo from '@/components/db/QueryInfo.vue';
|
|
88
|
+
import DefaultLayout from '@/layouts/DefaultLayout.vue';
|
|
89
|
+
import $http from '@/services/http.js';
|
|
90
|
+
import { stateColor } from '../services/utilities.js';
|
|
37
91
|
|
|
38
92
|
export default {
|
|
39
93
|
name: 'Database',
|
|
40
|
-
components: {
|
|
94
|
+
components: { BsModal, QueryInfo, DefaultLayout },
|
|
41
95
|
async beforeRouteEnter(to, from ,next) {
|
|
42
96
|
next(async (vm) => {
|
|
43
97
|
const res = await $http.get('ajax/data?path=db');
|
|
@@ -51,23 +105,56 @@ export default {
|
|
|
51
105
|
setup() {
|
|
52
106
|
const data = ref(null);
|
|
53
107
|
|
|
54
|
-
|
|
55
|
-
return data.value?.queries?.reduce((sum, query) => {
|
|
108
|
+
function totalTime(instance) {
|
|
109
|
+
return data.value?.queries[instance]?.reduce((sum, query) => {
|
|
56
110
|
return sum + query.time;
|
|
57
111
|
}, 0) * 1000;
|
|
58
|
-
}
|
|
112
|
+
}
|
|
59
113
|
|
|
60
|
-
|
|
61
|
-
return data.value?.queries?.reduce((sum, query) => {
|
|
114
|
+
function totalMemory(instance) {
|
|
115
|
+
return data.value?.queries[instance]?.reduce((sum, query) => {
|
|
62
116
|
return sum + query.memory;
|
|
63
117
|
}, 0) / 1024 / 1024;
|
|
64
|
-
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const showBacktraceModal = ref(false);
|
|
121
|
+
const backtrace = ref([]);
|
|
122
|
+
const backtraceIndex = ref(0);
|
|
123
|
+
|
|
124
|
+
function openBacktrace(trace, i) {
|
|
125
|
+
backtrace.value = trace;
|
|
126
|
+
backtraceIndex.value = i;
|
|
127
|
+
showBacktraceModal.value = true;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const editor = document.__data.editor;
|
|
131
|
+
const sysPath = document.__data.systemPath;
|
|
132
|
+
|
|
133
|
+
function getEditorLink(trace) {
|
|
134
|
+
return `${editor}://open?file=${trace.pathname}&line=${trace.line}`;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function replaceRoot(path) {
|
|
138
|
+
return path.replace(sysPath, 'ROOT');
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const instances = computed(() => data.value.connections.map((conn) => conn.name));
|
|
65
142
|
|
|
66
143
|
return {
|
|
67
144
|
data,
|
|
68
145
|
totalTime,
|
|
69
146
|
totalMemory,
|
|
70
|
-
|
|
147
|
+
showBacktraceModal,
|
|
148
|
+
backtrace,
|
|
149
|
+
backtraceIndex,
|
|
150
|
+
instances,
|
|
151
|
+
|
|
152
|
+
openBacktrace,
|
|
153
|
+
getEditorLink,
|
|
154
|
+
|
|
155
|
+
stateColor,
|
|
156
|
+
round,
|
|
157
|
+
replaceRoot,
|
|
71
158
|
}
|
|
72
159
|
}
|
|
73
160
|
};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<DefaultLayout>
|
|
3
|
+
<template #title>
|
|
4
|
+
Events
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<div class="p-4" v-if="data">
|
|
8
|
+
|
|
9
|
+
<section class="l-section l-section--triggered">
|
|
10
|
+
<h3>Event Triggered</h3>
|
|
11
|
+
|
|
12
|
+
<EventListenersTable :events="data.invoked" />
|
|
13
|
+
</section>
|
|
14
|
+
|
|
15
|
+
<section class="l-section l-section--untriggered mt-5">
|
|
16
|
+
<h3>Event Not Triggered (But has Listeners)</h3>
|
|
17
|
+
|
|
18
|
+
<EventListenersTable :events="data.uninvoked" />
|
|
19
|
+
</section>
|
|
20
|
+
|
|
21
|
+
</div>
|
|
22
|
+
</DefaultLayout>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<script>
|
|
26
|
+
import { computed, ref } from 'vue';
|
|
27
|
+
import EventListenersTable from '../components/events/EventListenersTable.vue';
|
|
28
|
+
import DefaultLayout from '../layouts/DefaultLayout.vue';
|
|
29
|
+
import $http from '../services/http.js';
|
|
30
|
+
export default {
|
|
31
|
+
name: 'Events',
|
|
32
|
+
components: { EventListenersTable, DefaultLayout },
|
|
33
|
+
async beforeRouteEnter(to, from ,next) {
|
|
34
|
+
next(async (vm) => {
|
|
35
|
+
const res = await $http.get('ajax/data?path=events');
|
|
36
|
+
vm.data = res.data.data;
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
async beforeRouteUpdate(to, from ,next) {
|
|
40
|
+
const res = await $http.get('ajax/data?path=events');
|
|
41
|
+
this.data = res.data.data;
|
|
42
|
+
},
|
|
43
|
+
setup() {
|
|
44
|
+
const data = ref(null);
|
|
45
|
+
|
|
46
|
+
// const events = computed(() => {
|
|
47
|
+
// const items = [];
|
|
48
|
+
//
|
|
49
|
+
// for (const eventName in data.value) {
|
|
50
|
+
// const listeners = data.value[eventName] || {};
|
|
51
|
+
//
|
|
52
|
+
// for (const listenerName in listeners) {
|
|
53
|
+
// const count = listeners[listenerName] || 0;
|
|
54
|
+
//
|
|
55
|
+
// items.push({
|
|
56
|
+
// event: eventName,
|
|
57
|
+
// listener: listenerName,
|
|
58
|
+
// count
|
|
59
|
+
// });
|
|
60
|
+
// }
|
|
61
|
+
// }
|
|
62
|
+
//
|
|
63
|
+
// return items;
|
|
64
|
+
// });
|
|
65
|
+
|
|
66
|
+
// const triggeredEvents = computed(() => {
|
|
67
|
+
// const items = {};
|
|
68
|
+
//
|
|
69
|
+
// for (const eventName in data.value) {
|
|
70
|
+
// const listeners = data.value[eventName] || {};
|
|
71
|
+
//
|
|
72
|
+
// for (const listenerName in listeners) {
|
|
73
|
+
// const count = listeners[listenerName] || 0;
|
|
74
|
+
//
|
|
75
|
+
// if (count > 0) {
|
|
76
|
+
// items[eventName] = items[eventName] || {};
|
|
77
|
+
// items[eventName][listenerName] = count;
|
|
78
|
+
// }
|
|
79
|
+
// }
|
|
80
|
+
// }
|
|
81
|
+
//
|
|
82
|
+
// return items;
|
|
83
|
+
// });
|
|
84
|
+
//
|
|
85
|
+
// const untriggeredEvents = computed(() => {
|
|
86
|
+
// const items = {};
|
|
87
|
+
//
|
|
88
|
+
// for (const eventName in data.value) {
|
|
89
|
+
// const listeners = data.value[eventName] || {};
|
|
90
|
+
//
|
|
91
|
+
// for (const listenerName in listeners) {
|
|
92
|
+
// const count = listeners[listenerName] || 0;
|
|
93
|
+
//
|
|
94
|
+
// if (count <= 0) {
|
|
95
|
+
// items[eventName] = items[eventName] || {};
|
|
96
|
+
// items[eventName][listenerName] = count;
|
|
97
|
+
// }
|
|
98
|
+
// }
|
|
99
|
+
// }
|
|
100
|
+
//
|
|
101
|
+
// return items;
|
|
102
|
+
// });
|
|
103
|
+
|
|
104
|
+
return {
|
|
105
|
+
data,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
</script>
|
|
110
|
+
|
|
111
|
+
<style scoped>
|
|
112
|
+
|
|
113
|
+
</style>
|
|
@@ -1,10 +1,142 @@
|
|
|
1
1
|
<template>
|
|
2
|
+
<DefaultLayout>
|
|
3
|
+
<template #title>
|
|
4
|
+
Request
|
|
5
|
+
</template>
|
|
2
6
|
|
|
7
|
+
<div ref="root" class="p-4" v-if="data">
|
|
8
|
+
<section class="l-section l-section--get mt-5">
|
|
9
|
+
<h3>GET Variables</h3>
|
|
10
|
+
|
|
11
|
+
<KeyValueTable :data="data.request.query" />
|
|
12
|
+
|
|
13
|
+
</section>
|
|
14
|
+
|
|
15
|
+
<section class="l-section l-section--body mt-5">
|
|
16
|
+
<h3>Body Variables</h3>
|
|
17
|
+
|
|
18
|
+
<KeyValueTable :data="data.request.body" />
|
|
19
|
+
|
|
20
|
+
</section>
|
|
21
|
+
|
|
22
|
+
<section class="l-section l-section--files mt-5">
|
|
23
|
+
<h3>FILES Variables</h3>
|
|
24
|
+
|
|
25
|
+
<KeyValueTable :data="data.request.files" />
|
|
26
|
+
|
|
27
|
+
</section>
|
|
28
|
+
|
|
29
|
+
<section class="l-section l-section--session mt-5">
|
|
30
|
+
<h3>Session Variables</h3>
|
|
31
|
+
|
|
32
|
+
<KeyValueTable :data="data.session" />
|
|
33
|
+
|
|
34
|
+
</section>
|
|
35
|
+
|
|
36
|
+
<section class="l-section l-section--cookies mt-5">
|
|
37
|
+
<h3>Cookies Variables</h3>
|
|
38
|
+
|
|
39
|
+
<KeyValueTable :data="data.cookies || data.request.cookies" />
|
|
40
|
+
|
|
41
|
+
</section>
|
|
42
|
+
|
|
43
|
+
<section class="l-section l-section--server mt-5">
|
|
44
|
+
<h3>SERVER Variables</h3>
|
|
45
|
+
|
|
46
|
+
<KeyValueTable :data="data.request.server" />
|
|
47
|
+
|
|
48
|
+
</section>
|
|
49
|
+
|
|
50
|
+
<section class="l-section l-section--env mt-5">
|
|
51
|
+
<h3>ENV Variables</h3>
|
|
52
|
+
|
|
53
|
+
<KeyValueTable :data="data.request.env" />
|
|
54
|
+
|
|
55
|
+
</section>
|
|
56
|
+
</div>
|
|
57
|
+
|
|
58
|
+
<teleport to=".nav-item--request">
|
|
59
|
+
<ul class="nav flex-column ps-4 small">
|
|
60
|
+
<li class="nav-item">
|
|
61
|
+
<a href="#" class="nav-link" @click.prevent="goto('get')">
|
|
62
|
+
GET Variables
|
|
63
|
+
</a>
|
|
64
|
+
</li>
|
|
65
|
+
<li class="nav-item">
|
|
66
|
+
<a href="#" class="nav-link" @click.prevent="goto('body')">
|
|
67
|
+
Body Variables
|
|
68
|
+
</a>
|
|
69
|
+
</li>
|
|
70
|
+
<li class="nav-item">
|
|
71
|
+
<a href="#" class="nav-link" @click.prevent="goto('files')">
|
|
72
|
+
Files Variables
|
|
73
|
+
</a>
|
|
74
|
+
</li>
|
|
75
|
+
<li class="nav-item">
|
|
76
|
+
<a href="#" class="nav-link" @click.prevent="goto('session')">
|
|
77
|
+
Session Variables
|
|
78
|
+
</a>
|
|
79
|
+
</li>
|
|
80
|
+
<li class="nav-item">
|
|
81
|
+
<a href="#" class="nav-link" @click.prevent="goto('cookies')">
|
|
82
|
+
Cookies Variables
|
|
83
|
+
</a>
|
|
84
|
+
</li>
|
|
85
|
+
<li class="nav-item">
|
|
86
|
+
<a href="#" class="nav-link" @click.prevent="goto('server')">
|
|
87
|
+
SERVER Variables
|
|
88
|
+
</a>
|
|
89
|
+
</li>
|
|
90
|
+
<li class="nav-item">
|
|
91
|
+
<a href="#" class="nav-link" @click.prevent="goto('env')">
|
|
92
|
+
ENV Variables
|
|
93
|
+
</a>
|
|
94
|
+
</li>
|
|
95
|
+
</ul>
|
|
96
|
+
</teleport>
|
|
97
|
+
</DefaultLayout>
|
|
3
98
|
</template>
|
|
4
99
|
|
|
5
100
|
<script>
|
|
101
|
+
import { ref } from 'vue';
|
|
102
|
+
import KeyValueTable from '../components/KeyValueTable.vue';
|
|
103
|
+
import DefaultLayout from '../layouts/DefaultLayout.vue';
|
|
104
|
+
import $http from '../services/http.js';
|
|
105
|
+
|
|
6
106
|
export default {
|
|
7
|
-
name: 'Request'
|
|
107
|
+
name: 'Request',
|
|
108
|
+
components: { KeyValueTable, DefaultLayout },
|
|
109
|
+
async beforeRouteEnter(to, from ,next) {
|
|
110
|
+
next(async (vm) => {
|
|
111
|
+
const res = await $http.get('ajax/data?path=http');
|
|
112
|
+
vm.data = res.data.data;
|
|
113
|
+
});
|
|
114
|
+
},
|
|
115
|
+
async beforeRouteUpdate(to, from ,next) {
|
|
116
|
+
const res = await $http.get('ajax/data?path=http');
|
|
117
|
+
this.data = res.data.data;
|
|
118
|
+
},
|
|
119
|
+
setup() {
|
|
120
|
+
const data = ref(null);
|
|
121
|
+
const root = ref(null);
|
|
122
|
+
|
|
123
|
+
function goto(section) {
|
|
124
|
+
const sec = root.value.querySelector(`.l-section--${section}`);
|
|
125
|
+
|
|
126
|
+
if (sec) {
|
|
127
|
+
window.scrollTo({
|
|
128
|
+
top: sec.offsetTop - 100,
|
|
129
|
+
behavior: 'smooth'
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return {
|
|
135
|
+
data,
|
|
136
|
+
root,
|
|
137
|
+
goto,
|
|
138
|
+
}
|
|
139
|
+
}
|
|
8
140
|
};
|
|
9
141
|
</script>
|
|
10
142
|
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<DefaultLayout>
|
|
3
|
+
<template #title>
|
|
4
|
+
Routing
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<div class="p-4" v-if="data">
|
|
8
|
+
|
|
9
|
+
<section class="l-section l-section--info">
|
|
10
|
+
<h3 class="mb-3">Route Information</h3>
|
|
11
|
+
|
|
12
|
+
<table class="table table-bordered">
|
|
13
|
+
<tbody>
|
|
14
|
+
<!-- Method -->
|
|
15
|
+
<tr>
|
|
16
|
+
<th style="width: 20%">
|
|
17
|
+
Request Method
|
|
18
|
+
</th>
|
|
19
|
+
<td>
|
|
20
|
+
{{ data.request.method }}
|
|
21
|
+
</td>
|
|
22
|
+
</tr>
|
|
23
|
+
|
|
24
|
+
<!-- Routes -->
|
|
25
|
+
<tr>
|
|
26
|
+
<th>
|
|
27
|
+
Total Routes
|
|
28
|
+
</th>
|
|
29
|
+
<td>
|
|
30
|
+
{{ Object.keys(data.routing.routes).length }}
|
|
31
|
+
</td>
|
|
32
|
+
</tr>
|
|
33
|
+
|
|
34
|
+
<!-- Matched -->
|
|
35
|
+
<tr>
|
|
36
|
+
<th>
|
|
37
|
+
Matched Route
|
|
38
|
+
</th>
|
|
39
|
+
<td>
|
|
40
|
+
<pre class="m-0">{{ data.routing.matched?.name }}</pre>
|
|
41
|
+
</td>
|
|
42
|
+
</tr>
|
|
43
|
+
|
|
44
|
+
<!-- Controller -->
|
|
45
|
+
<tr>
|
|
46
|
+
<th>
|
|
47
|
+
Controller / View
|
|
48
|
+
</th>
|
|
49
|
+
<td>
|
|
50
|
+
<pre class="m-0">{{ data.routing.controller }}</pre>
|
|
51
|
+
|
|
52
|
+
<div v-if="data.routing.matched?.options?.vars?.view"
|
|
53
|
+
class="ps-3 mt-2">
|
|
54
|
+
<pre class="m-0"><strong>View:</strong> {{ data.routing.matched?.options?.vars?.view }}</pre>
|
|
55
|
+
</div>
|
|
56
|
+
</td>
|
|
57
|
+
</tr>
|
|
58
|
+
|
|
59
|
+
<!-- Handler -->
|
|
60
|
+
<tr>
|
|
61
|
+
<th>
|
|
62
|
+
Handler
|
|
63
|
+
</th>
|
|
64
|
+
<td>
|
|
65
|
+
<pre class="m-0">{{ JSON.stringify(data.routing.matched?.options?.handlers, null, 2) }}</pre>
|
|
66
|
+
</td>
|
|
67
|
+
</tr>
|
|
68
|
+
|
|
69
|
+
<!-- Middlewares -->
|
|
70
|
+
<tr>
|
|
71
|
+
<th>
|
|
72
|
+
Middlewares
|
|
73
|
+
</th>
|
|
74
|
+
<td>
|
|
75
|
+
<div v-for="middleware of data.routing?.matched?.options?.middlewares">
|
|
76
|
+
<pre class="mb-1">{{ middleware }}</pre>
|
|
77
|
+
</div>
|
|
78
|
+
</td>
|
|
79
|
+
</tr>
|
|
80
|
+
</tbody>
|
|
81
|
+
</table>
|
|
82
|
+
</section>
|
|
83
|
+
|
|
84
|
+
<section class="l-section l-section--uri mt-5">
|
|
85
|
+
<h3 class="mb-3">Uri Information</h3>
|
|
86
|
+
|
|
87
|
+
<KeyValueTable :data="data.uri" />
|
|
88
|
+
</section>
|
|
89
|
+
|
|
90
|
+
<section class="l-section l-section--routes mt-5">
|
|
91
|
+
<h3 class="mb-3">Routes</h3>
|
|
92
|
+
|
|
93
|
+
<table class="table table-bordered">
|
|
94
|
+
<thead>
|
|
95
|
+
<tr>
|
|
96
|
+
<th>
|
|
97
|
+
Route Name
|
|
98
|
+
</th>
|
|
99
|
+
<th>
|
|
100
|
+
Pattern
|
|
101
|
+
</th>
|
|
102
|
+
<th>
|
|
103
|
+
Methods
|
|
104
|
+
</th>
|
|
105
|
+
<th>
|
|
106
|
+
Controller / View
|
|
107
|
+
</th>
|
|
108
|
+
<!--<th>-->
|
|
109
|
+
<!-- Detail-->
|
|
110
|
+
<!--</th>-->
|
|
111
|
+
</tr>
|
|
112
|
+
</thead>
|
|
113
|
+
|
|
114
|
+
<tbody>
|
|
115
|
+
<tr v-for="(route, name) of data.routing.routes"
|
|
116
|
+
:class="{ 'table-success': data.routing.matched?.name === route.name }">
|
|
117
|
+
<td>
|
|
118
|
+
<code>{{ route.name }}</code>
|
|
119
|
+
</td>
|
|
120
|
+
<td>
|
|
121
|
+
<code>{{ route.options.pattern }}</code>
|
|
122
|
+
</td>
|
|
123
|
+
<td>
|
|
124
|
+
{{ route.options?.method?.join('|') || 'Any' }}
|
|
125
|
+
</td>
|
|
126
|
+
<td style="max-width: 400px">
|
|
127
|
+
<div style="overflow-x: auto">
|
|
128
|
+
<div v-if="route?.options?.vars?.view"
|
|
129
|
+
class="">
|
|
130
|
+
<pre class="m-0">{{ route?.options?.vars?.view }}</pre>
|
|
131
|
+
</div>
|
|
132
|
+
<div v-else>
|
|
133
|
+
<pre>{{ getHandler(route.options.handlers || {}) }}</pre>
|
|
134
|
+
</div>
|
|
135
|
+
</div>
|
|
136
|
+
</td>
|
|
137
|
+
<!--<td></td>-->
|
|
138
|
+
</tr>
|
|
139
|
+
</tbody>
|
|
140
|
+
</table>
|
|
141
|
+
|
|
142
|
+
</section>
|
|
143
|
+
|
|
144
|
+
</div>
|
|
145
|
+
</DefaultLayout>
|
|
146
|
+
</template>
|
|
147
|
+
|
|
148
|
+
<script>
|
|
149
|
+
import { ref } from 'vue';
|
|
150
|
+
import KeyValueTable from '../components/KeyValueTable.vue';
|
|
151
|
+
import DefaultLayout from '../layouts/DefaultLayout.vue';
|
|
152
|
+
import $http from '../services/http.js';
|
|
153
|
+
export default {
|
|
154
|
+
name: 'Routing',
|
|
155
|
+
components: { KeyValueTable, DefaultLayout },
|
|
156
|
+
async beforeRouteEnter(to, from ,next) {
|
|
157
|
+
next(async (vm) => {
|
|
158
|
+
const params = new URLSearchParams();
|
|
159
|
+
params.set('path[request]', 'http::request');
|
|
160
|
+
params.set('path[uri]', 'http::systemUri');
|
|
161
|
+
params.set('path[routing]', 'routing');
|
|
162
|
+
|
|
163
|
+
const res = await $http.get('ajax/data?' + params.toString());
|
|
164
|
+
vm.data = res.data.data;
|
|
165
|
+
});
|
|
166
|
+
},
|
|
167
|
+
async beforeRouteUpdate(to, from ,next) {
|
|
168
|
+
const params = new URLSearchParams();
|
|
169
|
+
params.set('path[request]', 'http::request');
|
|
170
|
+
params.set('path[uri]', 'http::systemUri');
|
|
171
|
+
params.set('path[routing]', 'routing');
|
|
172
|
+
|
|
173
|
+
const res = await $http.get('ajax/data?' + params.toString());
|
|
174
|
+
vm.data = res.data.data;
|
|
175
|
+
},
|
|
176
|
+
setup() {
|
|
177
|
+
const data = ref(null);
|
|
178
|
+
|
|
179
|
+
function getHandler(handlers) {
|
|
180
|
+
if (handlers['*']) {
|
|
181
|
+
return getCallable(handlers['*']);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return getCallable(Object.values(handlers)[0]);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function getCallable(callable) {
|
|
188
|
+
if (!callable) {
|
|
189
|
+
return '-';
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if (typeof callable === 'string') {
|
|
193
|
+
return callable;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
return callable.join('::') + '()';
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
return {
|
|
200
|
+
data,
|
|
201
|
+
|
|
202
|
+
getHandler
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
</script>
|
|
207
|
+
|
|
208
|
+
<style scoped>
|
|
209
|
+
|
|
210
|
+
</style>
|