11<template >
2- <v-app v-if =" showInterface" class =" v-app-background" >
3- <v-content >
4- <v-container fluid fill-height >
5- <v-layout align-center justify-center >
6- <v-flex xs9 >
7- <v-card class =" elevation-12" >
8- <v-system-bar window dark >
9- mysql-async Explorer
10- <v-spacer ></v-spacer >
11- <v-icon @click =" close()" >close</v-icon >
12- </v-system-bar >
13- <v-tabs
14- v-model =" active"
15- color =" primary"
16- slider-color =" secondary"
17- >
18- <v-tab ripple >
19- Time-resolved
20- </v-tab >
21- <v-tab ripple >
22- Resources
23- </v-tab >
24- <v-tab ripple >
25- Slowest Queries
26- </v-tab >
27- <v-tab-item >
28- <v-flex xs12 pa-2 style =" height : 480px ;" >
29- <m-chart
30- id =" time-graph"
31- :labels =" timeLabels"
32- :datasets =" timeData"
33- height =" 540"
34- ></m-chart >
35- </v-flex >
36- </v-tab-item >
37- <v-tab-item >
38- <v-flex xs12 pa-2 style =" height : 480px ;" >
39- <m-chart
40- id =" resource-graph"
41- :labels =" resourceLabels"
42- :datasets =" resourceData"
43- height =" 540"
44- ></m-chart >
45- </v-flex >
46- </v-tab-item >
47- <v-tab-item >
48- <v-flex xs12 pa-2 style =" height : 480px ;" >
49- <v-data-table
50- align-end
51- :headers =" headers"
52- :items =" slowqueries"
53- :items-per-page =" 7"
54- :footer-props =" {
55- 'items-per-page-options': [7],
56- prevIcon: 'chevron_left',
57- nextIcon: 'chevron_right'
58- }"
59- >
60- <template v-slot :items =" props " >
61- <td >{{ props.item.resource }}</td >
62- <td >{{ props.item.sql }}</td >
63- <td >{{ props.item.queryTime }}</td >
64- </template >
65- </v-data-table >
66- </v-flex >
67- </v-tab-item >
68- </v-tabs >
69- <v-footer dark color =" black" height =" 28" style =" min-height : 28px ;" >
70- </v-footer >
71- </v-card >
72- </v-flex >
73- </v-layout >
74- </v-container >
75- </v-content >
76- </v-app >
2+ <main
3+ v-if =" showInterface"
4+ class =" flex h-screen bg-opacity-50 bg-black items-center justify-center"
5+ >
6+ <div class =" w-full bg-white shadow-2xl rounded-md max-w-screen-xl" >
7+ <m-app-bar >
8+ <m-icon class =" mr-2" >storage</m-icon >
9+ <span >MySQL Explorer</span >
10+ <div class =" flex-grow" />
11+ <m-icon
12+ @click.native =" close()"
13+ class ="
14+ cursor-pointer rounded-full hover:bg-white hover:bg-opacity-10
15+ transition duration-300 ease-in-out
16+ "
17+ >
18+ close
19+ </m-icon >
20+ </m-app-bar >
21+ <m-tabs >
22+ <m-tab-item label =" Time-resolved" icon =" timeline" >
23+ <div class =" p-2" style =" height : 480px ;" >
24+ <m-chart
25+ id =" time-graph"
26+ chartFontFamily =" 'Fira Sans', 'sans-serif'"
27+ :labels =" timeLabels"
28+ :datasets =" timeData"
29+ :height =" 540"
30+ ></m-chart >
31+ </div >
32+ </m-tab-item >
33+ <m-tab-item label =" Resources" icon =" apps" >
34+ <div class =" p-2" style =" height : 480px ;" >
35+ <m-chart
36+ id =" resource-graph"
37+ chartFontFamily =" 'Fira Sans', 'sans-serif'"
38+ :labels =" resourceLabels"
39+ :datasets =" resourceData"
40+ :height =" 540"
41+ ></m-chart >
42+ </div >
43+ </m-tab-item >
44+ <m-tab-item label =" Slowest Queries" icon =" slow_motion_video" >
45+ <div class =" p-2" style =" height : 480px ;" >
46+ <m-data-table
47+ :headers =" headers"
48+ :items =" slowqueries"
49+ :items-per-page =" 7"
50+ >
51+ <template v-slot :row =" props " >
52+ <td class =" text-center h-12" >{{ props.item.resource }}</td >
53+ <td class =" text-left h-12" >{{ props.item.sql }}</td >
54+ <td class =" text-center h-12" >{{ props.item.queryTime }}ms</td >
55+ </template >
56+ </m-data-table >
57+ </div >
58+ </m-tab-item >
59+ </m-tabs >
60+ <div class =" h-8 bg-black w-full rounded-b-md" />
61+ </div >
62+ </main >
7763</template >
7864
7965<script >
66+ import MAppBar from ' ../vendor/ghmattimysql/packages/ghmattimysql-ui/src/components/MAppBar.vue' ;
8067import MChart from ' ../vendor/ghmattimysql/packages/ghmattimysql-ui/src/components/MChart.vue' ;
68+ import MDataTable from ' ../vendor/ghmattimysql/packages/ghmattimysql-ui/src/components/MDataTable.vue' ;
69+ import MIcon from ' ../vendor/ghmattimysql/packages/ghmattimysql-ui/src/components/MIcon.vue' ;
70+ import MTabs from ' ../vendor/ghmattimysql/packages/ghmattimysql-ui/src/components/MTabs.vue' ;
71+ import MTabItem from ' ../vendor/ghmattimysql/packages/ghmattimysql-ui/src/components/MTabItem.vue' ;
8172
8273export default {
8374 components: {
75+ MAppBar,
8476 MChart,
77+ MDataTable,
78+ MIcon,
79+ MTabs,
80+ MTabItem,
8581 },
8682 data () {
8783 return {
@@ -129,12 +125,12 @@ export default {
129125 text: ' Resource' ,
130126 value: ' resource' ,
131127 },
132- {
133- text: ' Query' ,
128+ {
129+ text: ' Query' ,
134130 value: ' sql' ,
135- sortable: false ,
131+ sortable: false ,
136132 },
137- {
133+ {
138134 text: ' Execution Time (ms)' ,
139135 value: ' queryTime' ,
140136 },
@@ -164,14 +160,14 @@ export default {
164160 onTimeData ({ timeData }) {
165161 if (Array .isArray (timeData) && timeData .length === 3 ) {
166162 this .timeData = [
167- Object . assign ({}, this .colorGraphLoad , { label: ' Server Load (ms)' }, timeData[0 ]) ,
168- Object . assign ({}, this .colorGraphAvg , { label: ' Average Query Time (ms)' }, timeData[1 ]) ,
169- Object . assign ({}, this .colorGraphCount , { label: ' Query Count' }, timeData[2 ]) ,
163+ { ... this .colorGraphLoad , label: ' Server Load (ms)' , ... timeData[0 ] } ,
164+ { ... this .colorGraphAvg , label: ' Average Query Time (ms)' , ... timeData[1 ] } ,
165+ { ... this .colorGraphCount , label: ' Query Count' , ... timeData[2 ] } ,
170166 ];
171167 const labels = [];
172168 for (let i = timeData[0 ].data .length - 1 ; i > - 1 ; i -= 1 ) {
173169 if (i !== 0 ) {
174- labels .push (` -${ i* 5 } min` );
170+ labels .push (` -${ i * 5 } min` );
175171 } else {
176172 labels .push (' now' );
177173 }
@@ -182,9 +178,9 @@ export default {
182178 onResourceData ({ resourceData }) {
183179 if (Array .isArray (resourceData) && resourceData .length === 3 ) {
184180 this .resourceData = [
185- Object . assign ({}, this .colorGraphLoad , { label: ' Server Load (ms)' }, resourceData[0 ]) ,
186- Object . assign ({}, this .colorGraphAvg , { label: ' Average Query Time (ms)' }, resourceData[1 ]) ,
187- Object . assign ({}, this .colorGraphCount , { label: ' Query Count' }, resourceData[2 ]) ,
181+ { ... this .colorGraphLoad , label: ' Server Load (ms)' , ... resourceData[0 ] } ,
182+ { ... this .colorGraphAvg , label: ' Average Query Time (ms)' , ... resourceData[1 ] } ,
183+ { ... this .colorGraphCount , label: ' Query Count' , ... resourceData[2 ] } ,
188184 ];
189185 }
190186 },
@@ -199,17 +195,14 @@ export default {
199195 });
200196 },
201197 name: ' app' ,
202- }
198+ };
203199 </script >
204200
205201<style lang="scss">
202+ @import ' ./tailwind.css' ; // less configuring
206203@import ' ../vendor/ghmattimysql/packages/ghmattimysql-ui/src/styles/mixins' ;
207204
208- html {
209- overflow-y : auto ;
210- }
211-
212- @include font-face (' Fira Sans' , ' ./assets/fonts/fira-sans-v9-latin-regular' , 400 , normal , woff woff2);
213- @include font-face (' Fira Sans' , ' ./assets/fonts/fira-sans-v9-latin-italic' , 400 , italic , woff woff2);
214- @include font-face (' Fira Sans' , ' ./assets/fonts/fira-sans-v9-latin-700' , 700 , normal , woff woff2);
205+ @include font-face (' Fira Sans' , ' ./fonts/fira-sans-v9-latin-regular' , 400 , normal , woff woff2);
206+ @include font-face (' Fira Sans' , ' ./fonts/fira-sans-v9-latin-italic' , 400 , italic , woff woff2);
207+ @include font-face (' Fira Sans' , ' ./fonts/fira-sans-v9-latin-700' , 700 , normal , woff woff2);
215208 </style >
0 commit comments