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

Add option to sort users table by "Last Seen" #20406

Open
Starker3 opened this issue Mar 1, 2023 · 7 comments
Open

Add option to sort users table by "Last Seen" #20406

Starker3 opened this issue Mar 1, 2023 · 7 comments
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.

Comments

@Starker3
Copy link
Contributor

Starker3 commented Mar 1, 2023

From an admin perspective, it would be really great if it was possible to sort the Users table by the "Last Seen" date. This would be incredibly useful to manage users who have never logged in or haven't logged in for a long period of time.

@Starker3 Starker3 added Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. To Triage An issue awaiting triage by a Matomo core team member labels Mar 1, 2023
@Starker3
Copy link
Contributor Author

Starker3 commented Mar 1, 2023

FYI for anyone who wants to do this manually, you can use the following SQL query:

SELECT matomo_user.login,
CASE WHEN matomo_option.option_value IS NULL THEN '' ELSE FROM_UNIXTIME(matomo_option.option_value) END AS last_seen
FROM matomo_user
LEFT JOIN matomo_option ON matomo_option.option_name = CONCAT('UsersManager.lastSeen.', matomo_user.login)
ORDER BY last_seen DESC;

@bx80 bx80 added this to the For Prioritization milestone Mar 3, 2023
@bx80 bx80 removed the To Triage An issue awaiting triage by a Matomo core team member label Mar 3, 2023
@bx80
Copy link
Contributor

bx80 commented Mar 3, 2023

Sounds like a useful feature @Starker3 👍

I've assigned the issue for prioritization.

@theVJagrawal
Copy link

hey @bx80 @Starker3 this issue looks interesting to me so can you assign it to me and elaborate it more, like which page are you talking about

@bx80
Copy link
Contributor

bx80 commented Mar 5, 2023

Hi @theVJagrawal, thanks for the interest 🙂

If you want to take a look then the users listing is at Administration > System > Users

image

A good place to start would be plugins/UsersManager/vue/src/PagedUsersList.vue

@theVJagrawal
Copy link

theVJagrawal commented Mar 22, 2023

hey @bx80 I have written the code for this function but could you plz tell me how can I test this and to see the changes in my localhost or at any online platform

@bx80
Copy link
Contributor

bx80 commented Mar 22, 2023

That's great @theVJagrawal 👍

The command ./console vue:build UsersManager run from your Matomo installation folder will build the typescript of the UsersManager plugin, after that compiles successfully then you should be able to see the changes on your localhost.

If you want to add some UI tests then take a look at plugins/UsersManager/tests/UI/UserManager_spec.js. For example a test could be added to await page.click(...) on the Last Seen header and then take a screenshot to confirm that the sort happened.

@theVJagrawal
Copy link

theVJagrawal commented Apr 4, 2023

hey @bx80 , @Starker3, @sgiehl have added a button and the sorting function in PagedUsersList.vue file but it seems not working fine so could you please review the code and help me on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.
Projects
None yet
Development

No branches or pull requests

3 participants