-
Notifications
You must be signed in to change notification settings - Fork 3
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
Improve UX with two users that have identical names #8
Comments
I've been working on this issue on my fork/branch hydrian/timekpr-next-remote:UI-improvements I believe I've gotten all of the UI & JS issues resolved. I'm getting some inconsistencies with the /get_usage rest call returning I checked my auth.log logs on the target timekpr-next machine and the ssh logs are saying the service account user logged in successfully for all 3 of the queried users. The python server response gives the above failed response in the REST json HTTP request. I suspect some type of race/timing condition is happening with the python server. |
Yay! that's really great that you're into making a contribution to this project - thank you! As well, thanks for sharing your WIP branch - looking good! I have some early feedback:
thanks again! |
Oops! I see maybe you had some questions re "getting some inconsistencies with the As well, please confirm the problem doesn't exist on |
This exists when you query multiple users on the same server in quick succession. When the index.html loads and fires off /get_usage ajax calls in a quick manner. Of my three users, usually only 1-2 of the user calls come back successful. On each page reload, the users that fail are different. If I check my system's auth log, all 3 of the ssh sessions made for each user are successful. This seems like a 'threading-like' issue. |
wow! you're taking on two tickets - rockstar 😎 That said, checking on #7 I see that it's closed because there wasn't actually an issue with having identically named users on different boxes. Checking, I see there's good defense against this with the use of the If you just didn't notice that #7 is closed, then let's tighten up the scope of this PR to just add the one UX feature. |
If I go to the /get_usage url directly with curl/web browser I get the same inconsistent results. My branch only UI changes, no python changes. |
Here is a sanitized version of my conf.py:
|
Had to take a break this because I'm waiting on the bug to hit beta for testing: https://bugs.launchpad.net/timekpr-next/+bug/2061003 |
Thanks for the update! I'm in no rush, so take your time. I took a closer look at the code and have some suggestions
looking at the code you wrote was really helpful! I see the need for another inner loop to iterate over each user. by adding just one more function, I think this is clean, has a limited amount of changes, but adds all the functionality. $.getJSON( "/config", function( data ) {
$.each( data, function( computer, userList ) {
$("#people").append('<h2 class="computer">' + computer + '</h2>');
$.each( userList, function( userId, user ) {
let rand_dom = '_' + uuidv4();
// todo - click doesn't work and radio spans accross users'
$("#people").append(get_person_html(user, rand_dom, computer));
$('#' + user + rand_dom + " .notify").show().html("Loading...");
$('#' + user + rand_dom + ' .btn').addClass("disabled");
$('#' + user + rand_dom + ' .btn-check').addClass("disabled");
setInterval(function () {
$('#' + user + rand_dom + " .loading").fadeIn(1300).fadeOut(1300);
}, 1400);
$.getJSON( "/get_usage/" + computer + "/" + user, function( usage ) {
render_user_to_dom(user, computer, usage, rand_dom);
});
});
});
});
function get_person_html(user, rand_dom, computer){
let times = get_times(rand_dom);
return "<span class='user' id='" + user + rand_dom + "'>" +
"<p class='h3'>" + user + "<span class='notify loading'></span></p>" +
"<span class='time_wrapper'>" +
"Unused: <span class='time time_left'>...</span> " +
"Used: " +
"<span class='time time_spent'>...</span>" +
"</span><br/>" +
"<div class='btn-group' role='group' aria-label='Action'>" +
"<input type='radio' class='btn-check' id='add" + rand_dom + "' value='add' name='action' />" +
"<label class='btn btn-outline-primary' for='add" + rand_dom + "'>Add</label>" +
"<input type='radio' class='btn-check' id='remove" + rand_dom + "' value='remove' name='action' />" +
"<label class='btn btn-outline-primary' for='remove" + rand_dom + "'>Remove</label> " +
"</div> " +
"<div class='btn-group' role='group' aria-label='Times'>" +
times +
"</div>" +
"<div class='btn-group' role='group' aria-label='save'>" +
"<button class='btn btn-outline-primary save_me' " +
"value='save' user='" + user + "' computer='" + computer + "' >Save</button>" +
"</div> " +
"</span>"
} |
The jquery update should be a different PR. |
That looks to be a cleaner implementation than mine. |
Glad that code helps! If you're excited to see this PR through I'd be happy to have you revise yours and submit a PR. If you've lost interest I'd be happy to press ahead with what we've pieced together. Again no rush, but let me know how you'd like to proceed! |
Sorry. Had to take a break frome this because I was working with/waiting for the timekpr-next project to fix bug in their software. I thought it may have been causing some of my issues here but it didn't fix the unconsistencies I'm getting with the REST call. I think is my be an issue with the SSHd connectiins. It could be getting messed up with so many so fast. Ssshd maybe rate limiting the connects. I have an idea of how to fix this. |
Right now if you have two identically named users on different systems, you can't tell them apart (see #7). We should fix this so you can tell who is who.
Some ideas:
config.py
.The text was updated successfully, but these errors were encountered: