Jump to content

Tracy Debugger


adrian

Recommended Posts

3 hours ago, jmartsch said:

Could you please also add it to the user switcher panel?

I expect it would work ok, but I am wondering if you actually have that many users you need to switch to. Have you considered making use of the Restricted Roles option in the User Switcher settings? If that doesn't suit your needs and filterbox really is needed, let me know and I'll take a look at implementing it.

  • Like 1
Link to comment
Share on other sites

2 hours ago, tpr said:

@adrian FYI it is possible to load filterbox only if some criteria is meet, eg. the number of data to filter is greater than 20.

Is this a built-in FB option, or do I need to base its loading on countTotal(), or perhaps even conditionally load the filterbox files based on a PHP count of items?

Link to comment
Share on other sites

It's the onInit callback where you can return false, eg. based on the number of DOM elements.

2 hours ago, jmartsch said:

Yes, I have some hundred users (800 atm)

That's nice ? 

  • Like 1
Link to comment
Share on other sites

5 hours ago, jmartsch said:

Yes, I have some hundred users (800 atm) and I need to switch to all of them

That's a lot of users to want to switch to. On sites that have large numbers of users I usually exclude that role, or if I need to be able to test someone with the same permissions, I create another role (with same permissions) and assign that to one test user. Sounds like that won't be useful in your case though.

I am curious - that's a lot of <option> entries for that <select> field. Is it fairly performant? I worry about when you have 10K or 100K users though.

@tpr and I have been looking into adding filterbox to this and it will probably work, but I do wonder whether some sort of autocomplete option would be better. @tpr suggested Select2 - they support ajax loading, so that might work. There is of course also selectize, but both of these require jQuery so I think I would probable just end up homebrewing something for this. I think I would automatically switch the input based on the number of available users.

Any thoughts?

Link to comment
Share on other sites

2 hours ago, adrian said:

Is it fairly performant?

Yes, there is a minimal noticable delay I think, but it loads very quickly.

image.png.9331be9d966040d8326022ae6d4e916e.png

As far as I know Select2 is good but depends on jQuery.

Some vanilla JavaScript alternatives are

 

  • Like 1
Link to comment
Share on other sites

@jmartsch - @tpr has just added support for the UserSwitcher panel to filterbox and made lots of other improvements. We all owe him a huge debt of gratitude for his work on this lately - maybe even send him a donation for his hard work on this: https://www.paypal.me/rolandtothpal/5 - it's such a huge improvement especially for the API Explorer and Captain Hook panels!

Let us know how you find it with your 800 users - hopefully this will work well and there won't be a need for an ajax approach to loading users just yet, although if I do that, I think I'll probably just code something up myself - no real need for a library for this.

 

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Thanks @jmartsch!

It seems that a regex in FilterBox allows only specific characters to use for filtering. I don't remember why I did this but I think it's too restrictive. Could you try replacing the line at 552 with this?

var i, aStr = str.match(/[^\s]+|"[^"]+"/g);

I think I'll need to revisit this sometime but in my quick tests it works better then the previous.

  • Like 2
Link to comment
Share on other sites

7 minutes ago, tpr said:

Thanks @jmartsch!

It seems that a regex in FilterBox allows only specific characters to use for filtering. I don't remember why I did this but I think it's too restrictive. Could you try replacing the line at 552 with this?


var i, aStr = str.match(/[^\s]+|"[^"]+"/g);

I think I'll need to revisit this sometime but in my quick tests it works better then the previous.

That seems to work well for me also.

Are you happy for me to commit that change to Tracy yet, or do you want to wait?

Link to comment
Share on other sites

Hey @bernhard - no rush, but @matjazp took care of some Windows / UTF8 issues which I have committed.

I still can't replicate your layout problems, but when you get a minute it would be great if you could help to narrow down what might be causing the issues at your end. Thanks!

Also, did my explanation help to alleviate your security concerns? If not, let me know what still concerns you and I'll address it.

Link to comment
Share on other sites

Hello Adrain,

Updating from 4.18.15 to 4.19.6 I've found that .tracyHidden { display: none; } is applied to <body> of the admin so yeah, when Tracy is hidden the whole admin is hidden too... Is that just me having this issue? (I did perform "Empty Cache and Hard Reload".)

Also, two permanent issues have been bugging me for a while but I did not bother to report, and I guess now is the right time to force myself to do it ?

1. Hide icon + browser's scrollbar issue:

As you can see, the browser's scrollbar covers the hide icon, making it impossible to click it. I have to be very fast in order to be able to click it or else Chrome kicks in, so I find myself spending a lot of time playing this reflex game. Also, I've been wondering if it is possible to have the dabugbar on the left? When a site has an off-canvas on the right, then having the debugbar also on the right is very problematic. Currently I'm working on such a site, so I keep the debugbar hidden most of the time when possible.  

debugbar-n-browser-scroll.png.e09169f0e4c2abcb2ebbfa80bc87c448.png

2. Icons without right dimensions

Since I often have to keep the debugbar hidden because of the off-canvas element on the right, I often have to reload the page one extra time because these SVG icons do not have the correct dimensions right after "unhiding" the debugbar:

debugbar-n-icons.png.66ddbe96713727fc75b32f802ca3e743.png

I hope all this explanation makes sense ? 

Edited by szabesz
display: none; is applied to the admin only, frontend is not affected
Link to comment
Share on other sites

I got an "Error in ProcessWireLogsPanel":

Spoiler

ProcessWire\WireException: Unable to encode array data for cache: TracyLogData.ProcessWire in D:\Projects\www\aos\wire\core\WireCache.php:443
Stack trace:
#0 D:\Projects\www\aos\site\assets\cache\FileCompiler\site\modules\TracyDebugger\panels\ProcesswireLogsPanel.php(44): ProcessWire\WireCache->save('TracyLogData.Pr...', false, '2010-04-08 03:1...')
#1 D:\Projects\www\aos\site\assets\cache\FileCompiler\site\modules\TracyDebugger\tracy-2.6.x\src\Tracy\Bar\Bar.php(147): ProcesswireLogsPanel->getTab()
#2 D:\Projects\www\aos\site\assets\cache\FileCompiler\site\modules\TracyDebugger\tracy-2.6.x\src\Tracy\Bar\Bar.php(121): Tracy\Bar->renderPanels('')
#3 D:\Projects\www\aos\site\assets\cache\FileCompiler\site\modules\TracyDebugger\tracy-2.6.x\src\Tracy\Bar\Bar.php(97): Tracy\Bar->renderHtml('main')
#4 D:\Projects\www\aos\site\assets\cache\FileCompiler\site\modules\TracyDebugger\tracy-2.6.x\src\Tracy\Debugger\Debugger.php(287): Tracy\Bar->render()
#5 [internal function]: Tracy\Debugger::shutdownHandler()
#6 {main}

Let me know how to get more info if you need.

Btw it's unbelievable that there are soo many panels in Tracy - you may need to add a filterbox just here too ?

image.thumb.png.a5589a0a26e705f547a11acb0372f008.png

  • Haha 3
Link to comment
Share on other sites

It looks familiar with the issue I had with the terminal panel. Would you mind var_dump($data) in WireCache.php at line 442, just before json_encode($data). Examine the $data to ensure it doesn't contain non UTF-8 characters.

  • Like 1
Link to comment
Share on other sites

Yep, that's it. That error contains non UTF-8 characters, I assume they are in Windows-1250 character set. The best option is to configure MySQL to return errors in English. Your my.ini will most likely be found in %programdata%\MySQL folder, in [mysqld] section add lc_messages=en_US. Restart mysqld service for changes to take effect. I guess this commit is the culprit for the PW error (SQL error is, of course, another thing).

  • Like 2
Link to comment
Share on other sites

@matjazp - thanks for helping to figure that out. I think this error was introduced when I added caching to the two logs panels - wireCache json encodes content for storing. Do you think the fix you provided for the Terminal panel for converting unknown characters to "?" would also work in this case? Obviously the mysql error change would also work, but I don't want everyone to have to do that.

@szabesz - I haven't seen any of these issues. Is it browser specific, or any chance the scrollbar issue could be related to this: https://processwire.com/talk/topic/13389-adminonsteroids/?do=findComment&comment=179123 or something else in AOS?

 

Link to comment
Share on other sites

53 minutes ago, matjazp said:

The fix would work, but you would have to call it before using wireCache obviously. Don't know if this would impact performance if it would run on a large array. 

What do you think about doing  a 

mb_convert_encoding($str, "UTF-8", "Windows-1252");

before the json_encode. I guess we can't be certain it's Windows-1252 but it seems most likely and would maybe be a cleaner solution?

Actually is it more likely 1252 or 1250 - most of my quick reading seems to refer to 1252.

Link to comment
Share on other sites

  • adrian pinned and locked this topic
  • adrian unpinned and pinned this topic
Guest
This topic is now closed to further replies.
×
×
  • Create New...