4242 Memory usage
4343 </button >
4444 </div >
45+
46+ <div
47+ class =" profiler-page-call-graph__toolbar profiler-page-call-graph__toolbar--right"
48+ >
49+ <label class =" profiler-page-call-graph__toolbar-input-wr" >
50+ Threshold:
51+
52+ <input
53+ class =" profiler-page-call-graph__toolbar-input"
54+ type =" number"
55+ :value =" threshold"
56+ :min =" 0"
57+ :max =" 100"
58+ @input =" setThreshold($event.target.value)"
59+ />
60+ </label >
61+ </div >
4562 </div >
4663</template >
4764
@@ -55,6 +72,7 @@ import IconSvg from "~/components/IconSvg/IconSvg.vue";
5572import { defineComponent , PropType } from " vue" ;
5673import { Profiler , ProfilerEdge } from " ~/config/types" ;
5774import { addSlashes , DigraphBuilder } from " ~/utils/digraph-builder" ;
75+ import debounce from " lodash.debounce" ;
5876
5977export default defineComponent ({
6078 components: { IconSvg },
@@ -73,11 +91,6 @@ export default defineComponent({
7391 threshold: 1 ,
7492 };
7593 },
76- watch: {
77- threshold(): void {
78- this .renderGraph ();
79- },
80- },
8194 created(): void {
8295 this .renderGraph ();
8396 },
@@ -94,10 +107,21 @@ export default defineComponent({
94107 this .metricLoading = false ;
95108 }, 0 );
96109 },
97- buildDigraph(): string {
98- const builder = new DigraphBuilder (this .event .edges );
110+ setThreshold(threshold : number ): void {
111+ this .metricLoading = true ;
112+
113+ return debounce (() => {
114+ if (! threshold || this .threshold === threshold ) {
115+ return ;
116+ }
117+
118+ this .threshold = threshold ;
99119
100- return builder .build (this .metric , this .threshold );
120+ setTimeout (() => {
121+ this .renderGraph ();
122+ this .metricLoading = false ;
123+ }, 0 );
124+ }, 1000 )();
101125 },
102126
103127 findEdge(name : string ): ProfilerEdge | null {
@@ -139,7 +163,13 @@ export default defineComponent({
139163 .width (" 100%" )
140164 .height (" 100%" )
141165 .fit (true )
142- .renderDot (this .buildDigraph (), this .nodeHandler );
166+ .renderDot (
167+ new DigraphBuilder (this .event .edges ).build (
168+ this .metric ,
169+ this .threshold
170+ ),
171+ this .nodeHandler
172+ );
143173 });
144174 },
145175 },
@@ -163,6 +193,10 @@ export default defineComponent({
163193 z-index : 9999 ;
164194}
165195
196+ .profiler-page-call-graph__toolbar--right {
197+ @apply right-5 left-auto ;
198+ }
199+
166200.profiler-page-call-graph__toolbar-icon {
167201 @apply w-4 h-4 fill-blue- 500;
168202}
@@ -171,6 +205,14 @@ export default defineComponent({
171205 @apply text-xs uppercase text-gray- 600;
172206}
173207
208+ .profiler-page-call-graph__toolbar-input-wr {
209+ @apply text-xs uppercase text-gray- 600;
210+ }
211+
212+ .profiler-page-call-graph__toolbar-input {
213+ @apply border-b bg-transparent border-gray-600 text-gray-600 w- 8;
214+ }
215+
174216.profiler-page-call-graph__loading-wr {
175217 @apply absolute m-auto top-0 left-0 right-0 bottom-0 flex justify-center items-center ;
176218}
0 commit comments