Parcourir la source

Add show_from filter support in the web UI. (#430)

Alexey Alexandrov il y a 6 ans
Parent
révision
fde099a545
No account linked to committer's email address
2 fichiers modifiés avec 8 ajouts et 4 suppressions
  1. 6
    4
      internal/driver/webhtml.go
  2. 2
    0
      internal/driver/webui.go

+ 6
- 4
internal/driver/webhtml.go Voir le fichier

@@ -274,6 +274,7 @@ table tr td {
274 274
       <a title="{{.Help.ignore}}" href="?" id="ignore">Ignore</a>
275 275
       <a title="{{.Help.hide}}" href="?" id="hide">Hide</a>
276 276
       <a title="{{.Help.show}}" href="?" id="show">Show</a>
277
+      <a title="{{.Help.show_from}}" href="?" id="show-from">Show from</a>
277 278
       <hr>
278 279
       <a title="{{.Help.reset}}" href="?">Reset</a>
279 280
     </div>
@@ -754,6 +755,7 @@ function viewer(baseUrl, nodes) {
754 755
     if (id == 'ignore') param = 'i';
755 756
     if (id == 'hide') param = 'h';
756 757
     if (id == 'show') param = 's';
758
+    if (id == 'show-from') param = 'sf';
757 759
 
758 760
     // We update on mouseenter so middle-click/right-click work properly.
759 761
     elem.addEventListener('mouseenter', updater);
@@ -768,8 +770,8 @@ function viewer(baseUrl, nodes) {
768 770
 
769 771
       setHrefParams(elem, function (params) {
770 772
         if (re != '') {
771
-          // For focus/show, forget old parameter.  For others, add to re.
772
-          if (param != 'f' && param != 's' && params.has(param)) {
773
+          // For focus/show/show-from, forget old parameter. For others, add to re.
774
+          if (param != 'f' && param != 's' && param != 'sf' && params.has(param)) {
773 775
             const old = params.get(param);
774 776
             if (old != '') {
775 777
               re += '|' + old;
@@ -830,7 +832,7 @@ function viewer(baseUrl, nodes) {
830 832
     const enable = (search.value != '' || selected.size != 0);
831 833
     if (buttonsEnabled == enable) return;
832 834
     buttonsEnabled = enable;
833
-    for (const id of ['focus', 'ignore', 'hide', 'show']) {
835
+    for (const id of ['focus', 'ignore', 'hide', 'show', 'show-from']) {
834 836
       const link = document.getElementById(id);
835 837
       if (link != null) {
836 838
         link.classList.toggle('disabled', !enable);
@@ -852,7 +854,7 @@ function viewer(baseUrl, nodes) {
852 854
   }
853 855
 
854 856
   const ids = ['topbtn', 'graphbtn', 'peek', 'list', 'disasm',
855
-               'focus', 'ignore', 'hide', 'show'];
857
+               'focus', 'ignore', 'hide', 'show', 'show-from'];
856 858
   ids.forEach(makeSearchLinkDynamic);
857 859
 
858 860
   const sampleIDs = [{{range .SampleTypes}}'{{.}}', {{end}}];

+ 2
- 0
internal/driver/webui.go Voir le fichier

@@ -200,6 +200,7 @@ func openBrowser(url string, o *plugin.Options) {
200 200
 	for _, p := range []struct{ param, key string }{
201 201
 		{"f", "focus"},
202 202
 		{"s", "show"},
203
+		{"sf", "show_from"},
203 204
 		{"i", "ignore"},
204 205
 		{"h", "hide"},
205 206
 		{"si", "sample_index"},
@@ -232,6 +233,7 @@ func varsFromURL(u *gourl.URL) variables {
232 233
 	vars := pprofVariables.makeCopy()
233 234
 	vars["focus"].value = u.Query().Get("f")
234 235
 	vars["show"].value = u.Query().Get("s")
236
+	vars["show_from"].value = u.Query().Get("sf")
235 237
 	vars["ignore"].value = u.Query().Get("i")
236 238
 	vars["hide"].value = u.Query().Get("h")
237 239
 	vars["sample_index"].value = u.Query().Get("si")