Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LDAP: List/Table in Users and Groups not sortable #399

Closed
bdunnaway opened this issue Feb 18, 2016 · 55 comments
Closed

LDAP: List/Table in Users and Groups not sortable #399

bdunnaway opened this issue Feb 18, 2016 · 55 comments

Comments

@bdunnaway
Copy link

The main List/Table in LDAP Users and Groups is no longer sortable by heading. The sort function works fine in the classic Users and Groups module with this theme.

@iliajie
Copy link
Collaborator

iliajie commented Feb 19, 2016

Can you inspect the table you're talking about? In Chrome, you could right click on that table that missing sorting, inspect it and make a screenshot of the source code?

I don't have this module setup.

@iliajie
Copy link
Collaborator

iliajie commented Feb 21, 2016

It's easy. Any help?

@bdunnaway
Copy link
Author

The source is easy enough to access, but the account data is sensitive company information.

I've tried to review it myself, but I can't seem to find any major differences in how the tables are implemented in LDAP Users and Groups and the standard Users and Groups module.

As a matter of fact, the LDAP Users and Groups module calls functions from the Users and Groups module to create the table. Could it be that you're making an exception for that module to force the table to be sortable? If so, perhaps LDAP Users and Groups could be included in such an exception.
It very much appears to have used the core Users and Groups module as a base for it's own code, and simply modified it to look up LDAP entries. They're almost identical.

I've done a little toward trying to sanitize the page source, to remove sensitive information, but there's still a lot there. If you feel that's essential to solving the problem, I can spend more time on it.

@iliajie
Copy link
Collaborator

iliajie commented Feb 23, 2016

I just need you to copy the selector path using console. I don't care about data.

@bdunnaway
Copy link
Author

I might need help with that. I can get the selector for the table, but I don't know how to get the selector path.

@bdunnaway
Copy link
Author

Best I can tell, the table on the LDAP UaG module has
#att_users > form > table.table.table-striped.table-condensed

Here's the selector tags for the table:
`

@bdunnaway
Copy link
Author

The original U&G module's tags are like this:
<div id="DataTables_Table_0_wrapper" class="dataTables_wrapper no-footer"><div id="DataTables_Table_0_filter" class="dataTables_filter"><label> <input type="search" class="" placeholder="Filter" aria-controls="DataTables_Table_0"></label></div><table class="table table-striped table-condensed dataTable no-footer" id="DataTables_Table_0" role="grid">

@iliajie
Copy link
Collaborator

iliajie commented Feb 24, 2016

Go to Chrome's console, switch top frame to page and run the following code:

__init_dt_($('form > table.table.table-striped.table-condensed'))

Does it work?

In case it does, take a look at the right frame source and tell me the name of the URL, like http://example.com:10000/ldap...

@bdunnaway
Copy link
Author

Uncaught ReferenceError: _init_dt is not defined(…)(anonymous function) @ VM12640:2InjectedScript._evaluateOn @ VM12630:875InjectedScript._evaluateAndWrap @ VM12630:808InjectedScript.evaluate @ VM12630:664

@iliajie
Copy link
Collaborator

iliajie commented Feb 24, 2016

What OS browser you have?

@bdunnaway
Copy link
Author

Just in case it still has some troubleshooting value, the frame source is https://server.example.com:10000/ldap-useradmin/index.cgi for LDAP UaG, and
https://server.example.com:10000/useradmin/ for the Webmin UaG module

@iliajie
Copy link
Collaborator

iliajie commented Feb 24, 2016

Ok, good. What if you add the code I provided to js extension using theme settings?

@bdunnaway
Copy link
Author

Windows 7 / Chrome Version 48.0.2564.116 m (64-bit)

@iliajie
Copy link
Collaborator

iliajie commented Feb 24, 2016

Can you add this __init_dt_($('form > table.table.table-striped.table-condensed')) code to .JS extension using theme settings?

@iliajie
Copy link
Collaborator

iliajie commented Feb 24, 2016

It should initialize your sortings in case you got the selector correctly.

@bdunnaway
Copy link
Author

I assume you mean add it to Webmin Configuration>>Webmin Themes>>Current Theme>>Theme Extensions>>Edit scripts.js and add the line:
_init_dt($('form > table.table.table-striped.table-condensed'))
Correct?

@bdunnaway
Copy link
Author

I tried that, and it doesn't seem to change anything.

@iliajie
Copy link
Collaborator

iliajie commented Feb 25, 2016

Then try removing form >, try different selector.

@iliajie
Copy link
Collaborator

iliajie commented Mar 2, 2016

Any luck?

@bdunnaway
Copy link
Author

Haven't had the time to do any more troubleshooting. I did discover that LDAP UaG uses the default sort order from the settings of the standard UaG module, so there's a workaround to tell it to sort by name, but default, but it's still not displaying like a sortable data table.

@iliajie iliajie changed the title List/Table in LDAP Users and Groups no longer sortable. LDAP: List/Table in Users and Groups not sortable Mar 3, 2016
@bdunnaway
Copy link
Author

This is working fine after 1.791-1 upgrade.

@iliajie
Copy link
Collaborator

iliajie commented Mar 10, 2016

I'm not sure what you mean. Nothing was changed in this regard on the theme's side.

You should still have no ability to sort, I guess.

@bdunnaway
Copy link
Author

Yeah, I couldn't find any related changes, either. But it started working. I have no idea why.
image

@iliajie
Copy link
Collaborator

iliajie commented Mar 15, 2016

Can you click bluе back button OR back button on top and see if issue comes back? I have a feeling, that I don't catch URL properly in some cases and when modules name starts to have index.cgi it fails.. I already noticed this happening in some cases.

@bdunnaway
Copy link
Author

I've tried both. I don't see any change. Sorting works as expected and everything. I haven't had time to check, but perhaps the LDAP U&G addon was updated with the last Webmin update.
It appears to be based on, and nearly identical to the standard U&G module. Since the update it behaves identically, also (the batch processing function was missing before, etc).

@bdunnaway
Copy link
Author

This is interesting: On the two servers I have Webmin running on, one of them is not showing the table under "Network Interfaces" as sortable, and the other one is. They are both on Webmin 1.791 and Authentic Theme 17.72.

@bdunnaway
Copy link
Author

I'm getting "uncaught TypeError: _init_dt is not a function" on the server that DOES display the table as sortable. The console shows no error for the other server.

@iliajie
Copy link
Collaborator

iliajie commented Mar 16, 2016

I don't see how is this possible in case versions are the same. Did you restart Webmin (# /etc/webmin/restart) after applying updates?

@iliajie
Copy link
Collaborator

iliajie commented Mar 16, 2016

Probably it's something that you left and forgot in theme's custom extensions? Check for it.

@iliajie
Copy link
Collaborator

iliajie commented Mar 16, 2016

LDAP started working after Webmin update? LDAP was updated 2 months ago.

@bdunnaway
Copy link
Author

Wait a second. The server that's working now, still has the code you asked me to add.
_init_dt($('form > table.table.table-striped.table-condensed'))

Perhaps that's why other tables are working/sortable (Network Interfaces, Webmin Actions Log, etc), whereas they are not on the server that doesn't have LDAP UaG

@iliajie
Copy link
Collaborator

iliajie commented Mar 16, 2016

Try removing that code and see if anything changes - it should, right?

@bdunnaway
Copy link
Author

Yes. When I do that, I lose the sortable columns in the Webmin Actions Log (using that for an example)

@bdunnaway
Copy link
Author

And in LDAP UaG, but not the standard UaG module

@bdunnaway
Copy link
Author

Okay, so for some reason, putting the code back into scripts.js and restarting the server, does NOT bring the sortable tables back. Even the ones that worked prior to removing that line of code.

@bdunnaway
Copy link
Author

So maybe the code fixed it, but it didn't get applied until the Webmin update? I'm not sure how to get it to re-read that scripts.js file.

@iliajie
Copy link
Collaborator

iliajie commented Mar 17, 2016

Script file is re-read each time when the page is reloaded (It should by the browser, no need for restarting Webmin).

Hard reload the page. Which browser are you using?

@bdunnaway
Copy link
Author

Chrome Version 49.0.2623.87 m (64-bit)

@iliajie
Copy link
Collaborator

iliajie commented Mar 17, 2016

Hard reloading will fix stuck cache.

@bdunnaway
Copy link
Author

Did a hard reload. The LDAP UaG is now sortable again, but for some odd reason, the Webmin Actions Log table is not; on either server. I'm 98% certain that it was working yesterday before I removed the code.

@bdunnaway
Copy link
Author

The URLs for the frames that work, and the ones that don't seem very different.
view-source:https://example.com:10000/ldap-useradmin/ ((SORTABLE))
view-source:https://example.com:10000/webminlog/search.cgi?uall=1&user=user001&nuser=user001&ouser=&mall=1&module=global&tall=1&from_d=&from_m=1&from_y=&to_d=&to_m=1&to_y=&desc=&long=0 ((NOT SORTABLE)
view-source:https://example.com:10000/net/list_ifcs.cgi ((SORTABLE))

@iliajie
Copy link
Collaborator

iliajie commented Mar 17, 2016

To make Webmin log sortable you would need

__init_dt_($('table.table.table-striped.table-condensed'))

Ok, I will make things work well by the 17.80 ;)

@iliajie
Copy link
Collaborator

iliajie commented Mar 17, 2016

I'll need you to test things before release, so stay tuned please.

One more time: LDAP sorting is working for you with out an issue?

@bdunnaway
Copy link
Author

Yes. LDAP Users and Groups sorting works without issue.

@bdunnaway
Copy link
Author

I'll be happy to help test. I appreciate your time and patience!

@iliajie
Copy link
Collaborator

iliajie commented Mar 18, 2016

LDAP works and you have nothing in custom scripts.js, right?

@bdunnaway
Copy link
Author

No. I still have _init_dt($('form > table.table.table-striped.table-condensed')) in scripts.js.
If I remove it, LDAP U&G stops being a sortable datatable

@bdunnaway
Copy link
Author

image

@bdunnaway
Copy link
Author

Here's the URL for that frame: https://server.example.com:10000/ldap-useradmin/

@iliajie
Copy link
Collaborator

iliajie commented Mar 18, 2016

Great, thanks for saying.

@iliajie
Copy link
Collaborator

iliajie commented Mar 29, 2016

Hi,

Could you please remove/comment out __init_dt_ from extensions scripts.js file, update theme's js with this update 17.80b, clear browser cache (or hard reload, Ctrl+Shift+R) and see if your LDAP Users and Groups are sortable and things look good.

Could you provide the screenshot of the top of the table starting with select all and other switches and ending with the table header in case it works?

Thanks.

@iliajie
Copy link
Collaborator

iliajie commented Mar 31, 2016

Will be fixed with 17.80.

Thanks for reporting.

@iliajie iliajie closed this as completed Mar 31, 2016
@bdunnaway
Copy link
Author

Thank you for all your work on this! 👍

@bdunnaway
Copy link
Author

I'm actually behind a Websense proxy that blocks .ru addresses. Can you post that code here?

@iliajie
Copy link
Collaborator

iliajie commented Apr 8, 2016

Please upgrade 17.80 is out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants