adrian Posted March 19, 2019 Author Posted March 19, 2019 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. 1
tpr Posted March 19, 2019 Posted March 19, 2019 @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. 1
dotnetic Posted March 19, 2019 Posted March 19, 2019 56 minutes ago, adrian said: if you actually have that many users you need to switch to Yes, I have some hundred users (800 atm) and I need to switch to all of them 1
adrian Posted March 19, 2019 Author Posted March 19, 2019 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?
tpr Posted March 19, 2019 Posted March 19, 2019 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 ? 1
adrian Posted March 19, 2019 Author Posted March 19, 2019 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?
dotnetic Posted March 19, 2019 Posted March 19, 2019 2 hours ago, adrian said: Is it fairly performant? Yes, there is a minimal noticable delay I think, but it loads very quickly. As far as I know Select2 is good but depends on jQuery. Some vanilla JavaScript alternatives are https://leaverou.github.io/awesomplete/ (from the famous Lea Verou, only 2KB gzipped) https://github.com/kraaden/autocomplete (Only 1KB gzipped) https://github.com/TarekRaafat/autoComplete.js 1
tpr Posted March 20, 2019 Posted March 20, 2019 For the record, there is also Choices which is also a good one: https://github.com/jshjohnson/Choices 2
adrian Posted March 20, 2019 Author Posted March 20, 2019 @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. 1 1
dotnetic Posted March 21, 2019 Posted March 21, 2019 @adrian @tpr Just made a donation. Thanks again. However, the filterbox seems to not work correctly, see my screenshot I entered "sb-1.1" as my search value, but users starting with "sb-1.x" and others are also found. 2
adrian Posted March 21, 2019 Author Posted March 21, 2019 @jmartsch - I am going to leave this to @tpr, but this is interesting:
tpr Posted March 21, 2019 Posted March 21, 2019 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. 2
adrian Posted March 22, 2019 Author Posted March 22, 2019 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?
tpr Posted March 22, 2019 Posted March 22, 2019 Just do it, I don't think I can devote time for a while to check. 3
adrian Posted March 22, 2019 Author Posted March 22, 2019 3 minutes ago, tpr said: Just do it, I don't think I can devote time for a while to check. Ok, change is committed - @jmartsch let us know how it goes for you also please. 1
adrian Posted March 22, 2019 Author Posted March 22, 2019 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.
szabesz Posted March 24, 2019 Posted March 24, 2019 (edited) 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. 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: I hope all this explanation makes sense ? Edited March 24, 2019 by szabesz display: none; is applied to the admin only, frontend is not affected
tpr Posted March 24, 2019 Posted March 24, 2019 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:443Stack 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 ? 3
matjazp Posted March 24, 2019 Posted March 24, 2019 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. 1
tpr Posted March 24, 2019 Posted March 24, 2019 You mean like this for example? Error: \tException: SQLSTATE[HY000] [2002] Nem hozhat\xf3 l\xe9tre kapcsolat
matjazp Posted March 24, 2019 Posted March 24, 2019 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). 2
adrian Posted March 24, 2019 Author Posted March 24, 2019 @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?
matjazp Posted March 24, 2019 Posted March 24, 2019 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.
adrian Posted March 24, 2019 Author Posted March 24, 2019 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.
Recommended Posts