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

Centralize Add Plates modal dialog javascript and html #468

Merged
merged 14 commits into from
Apr 25, 2019

Conversation

AmandaBirmingham
Copy link
Collaborator

Fixes #246, #351, #466 and #458.

I request that the reviewers actually download this PR as a branch and install it, and try adding plates on each of the SEVEN different pages that are affected (see list below).

I realize this is a big pain; however, as far as I know LabControl has no front-end javascript unit testing approach, and the code changes here affect PRIMARILY the front-end javascript ... so the fact that the PR passes the back-end unit-tests provides approximately no assurances about its fitness. I have trialed the plate addition on each of these pages in my own test environment, but I certainly don't trust myself to catch all problems.


Affected pages to test "Add Plate" functionality on:
normalization.html
compression.html
extraction.html
library_pooling.html
library_prep_shotgun.html
library_prep_16S.html
parse_quantification.html

…lates dialog from 7 pages that use them, put into these files
…log with call to external shared javascript function and import of external shared html snippet.
…log with call to external shared javascript function and import of external shared html snippet. Move code from old plateList.js file into this page as this is the only place it is used.
@charles-cowart
Copy link
Collaborator

@AmandaBirmingham This sounds really nice! If you don't mind, I will finish up a WIP first before I review this one - should be in the next day or so.

@wasade
Copy link
Member

wasade commented Apr 19, 2019

Quick note for pulling this down, the branch is in "upstream" (i.e., jdereus). So for pulling:

$ git remote -v | grep upstream
upstream	[email protected]:jdereus/labman.git (fetch)
upstream	[email protected]:jdereus/labman.git (push)
$ git checkout -b issue_468
$ git pull --rebase upstream Issue246and351

@charles-cowart
Copy link
Collaborator

charles-cowart commented Apr 19, 2019 via email

@wasade
Copy link
Member

wasade commented Apr 23, 2019

Thanks, @AmandaBirmingham! I've gone through the requested pages. Below are the comments that I wasn't sure warranted separate issues. Doing a code review now.

Major:

  • There is a race condition with the user. If the user is adding plates fast, the modal pops up and disappears before the user can do anything. This behavior also appears to allow for unexpected behavior: I was able to add 5 384-well plates to compress resulting in an exception (see first .gif; traceback below .gif). It is likely this issue will worsen with increased network lag (this was running locally). I think this is generalized to multiple page. I don't believe this is due to the changes within the PR but leaving within this issue for the time being as it may make sense to place a protection within the add plate interface code.

compress_plate_modal_timing

AN ERROR HAS OCCURED!
Please copy the following into an issue in our github repository

Error
Cannot compress 5 gDNA plates. Please provide 1 to 4 gDNA plates

Traceback
Traceback (most recent call last): 
File "/Users/dtmcdonald/miniconda3/envs/labcontrol/lib/python3.7/site-packages/tornado/web.py", line 1697, in _execute result = method(*self.path_args, **self.path_kwargs) 
File "/Users/dtmcdonald/miniconda3/envs/labcontrol/lib/python3.7/site-packages/tornado/web.py", line 3174, in wrapper return method(self, *args, **kwargs) 
File "/Users/dtmcdonald/ResearchWork/software/labman/labcontrol/gui/handlers/process_handlers/gdna_compression_process.py", line 50, in post self.current_user, plates, plate_ext_id, Equipment(robot)) 
File "/Users/dtmcdonald/ResearchWork/software/labman/labcontrol/db/process.py", line 773, in create 'gDNA plates' % len(plates)) 
ValueError: Cannot compress 5 gDNA plates. Please provide 1 to 4 gDNA plates 

Minor:

  • Modal is dense with text, I wonder if forcing a name truncation, or widening the modal would be beneficial?
  • I'm not sure I grok the search functionality (note the search terms used):

Screen Shot 2019-04-22 at 3 45 27 PM

Copy link
Member

@wasade wasade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @AmandaBirmingham! Mostly just questions

addPlate(plateId);

// Disable the button to add the plate to the list
$('#addBtnPlate' + plateId).prop('disabled', true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the button be disabled before entering the try block?

Copy link
Collaborator

@charles-cowart charles-cowart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewing the code, it seems a suitable refactoring, based on what was removed. Installing the latest code to test.

@AmandaBirmingham
Copy link
Collaborator Author

Thanks, @wasade -- this is great! Re #468 (comment) , I tracked down the issue you found with adding 5 plates to the compression page and verified that it is not due to adding plates fast and exists in master, so I created a new issue for it at #477 ; fortunately it looks super easy to fix and the fix can be added easily to this PR.

With that red herring out of the way, could you say more about the race condition you observed? ("If the user is adding plates fast, the modal pops up and disappears before the user can do anything"). I have not been able to reproduce it--perhaps I am not fast enough? :) If you could provide either instructions to reproduce or a gif of it happening (on a page other than compression bc we know that one is screwed up) it would really help me track this down.

I will look into the search functionality ...

@AmandaBirmingham
Copy link
Collaborator Author

AmandaBirmingham commented Apr 23, 2019

Per #468 (comment) , I checked into the search functionality. It is provided by the external DataTables javascript library; here is the description of its search API: https://datatables.net/reference/api/search() .

Essentially, it appears to be a pretty greedy search that returns results that contain within them all of the strings entered, in any order, case-insensitively, across the union of all searchable fields . Since the study name is a searchable field and since "Identification of the Microbiomes for Cannabis Soils" contains the strings fo (in "for"), so (in "Soils"), ca (in "Cannabis"), and de (in "Identification"), and since the plate name is a searchable field and contains the string la (in "plates"), the results returned for the search input "fo so ca la de" are consistent with the DataTables search rules.

From the DataTables documentation, it looks like we can tweak the search functionality in various ways, e.g. below, pulled from the link above. @wasade, please provide feedback on whether you feel this is necessary.

The smart search ability of DataTables is performed using a regular expression and can be enabled or disabled using the third parameter of this method. If you wish to use a custom regular expression, for example to perform whole word exact matching, you would need to enable the regular expression option (second parameter) and disable the smart search option (third parameter) to ensure that the two do not conflict.

@wasade
Copy link
Member

wasade commented Apr 23, 2019

@AmandaBirmingham race condition may not be the most accurate term but felt approximately like what was observed :) I haven't had this happen on other pages, so it may have been isolated to the compression page. #473 and the gif contained highlights a possibly related issue though where the modal can be opened even though the loading is still happening which can be misleading

That makes total sense re: search. Let's drop that item.

@charles-cowart
Copy link
Collaborator

Putting this in the PR, since I'm testing these code changes: When I try to create a new sample plate, I find that I cannot. Has anyone else seen this issue? Possible it's something wrong with my configuration; in any case, it's odd that I have no idea why:

create_plate

@AmandaBirmingham
Copy link
Collaborator Author

@charles-cowart wooo, that is weird. @wasade can you reproduce in the PR branch? I cannot, although I will keep trying ...

@charles-cowart
Copy link
Collaborator

@AmandaBirmingham @wasade and I couldn't reproduce it in his dev environment, implying that it's something with my local configuration; although it's not immediately obvious to the both of us what it is. Confirmed I'm on commit fca5b..... I will look at a few other things. In the meantime, I took a screenshot of the developer console:

create_plate2

@charles-cowart
Copy link
Collaborator

charles-cowart commented Apr 24, 2019

I tested add plate functionality on all of the requested pages, and this is what I encountered:

normalization.html -> normalize
Appears to be working as intended, but I also get a js error

compression.html -> gdna_compression
Working as intended, no js errors

extraction.html -> gdna_extraction
Appears to be working as intended, but I also get a js error
(but not all the time when adding multiple plates)

library_pooling.html -> poollibraries
Working as intended, no js errors (both Amplicon and Shotgun)

library_prep_shotgun.html -> library_prep_shotgun
Appears to be working as intended, but I also get a js error

library_prep_16S.html -> library_prep_16S
Appears to be working as intended, but I also get a js error

parse_quantification.html -> parse_quantify
working as intended, no js error

I've attached animated GIFs for most of the errors I encountered. More than 3 seemed redundant:
create_plate2
normalize
prep_shotgun

@charles-cowart
Copy link
Collaborator

I also noticed some steps were not available in subsequent steps after I created them, but I will dig deeper on those and report anything as a separate issue.

@AmandaBirmingham
Copy link
Collaborator Author

AmandaBirmingham commented Apr 24, 2019 via email

@charles-cowart
Copy link
Collaborator

@AmandaBirmingham Ah, of course! :D Thanks for the clarification. It's a fresh pull from GH so I don't think anything should be removed or modified, but I'll look into it shortly - thanks for the tip!

@charles-cowart
Copy link
Collaborator

Found it! It looks like the 'slickgrid.plugins' directory didn't get installed into my '~/miniconda3/envs/labman/lib/python3.5/site-packages/labcontrol/gui/static/vendor/js' directory. Once I copied it manually from the source tree to the installed base, everything worked fine. I'll check out the install script to see if that's the cause. Thanks again!

@charles-cowart
Copy link
Collaborator

@AmandaBirmingham The slickgrid.plugins issue has been resolved w/ #484. No other issues w/this PR outside of what is currently being discussed.

…utton disabling to beginning of method to prevent user from trying to add same plate or another from modal while existing addition is in process.
…ateGUI for case where plate ids come in from querystring). Added more comments to clarify workings of prepopulateGUI (mostly to myself).
Copy link
Collaborator

@charles-cowart charles-cowart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the added comments!

@AmandaBirmingham
Copy link
Collaborator Author

@wasade Have updated pull request, please re-review when you can.

@wasade
Copy link
Member

wasade commented Apr 25, 2019

@AmandaBirmingham, a static view of the commits looks great, thank you!! Are you requesting a re-review of this PR in a live dev environment as well for the pages noted above, or are you comfortable with a static review?

@AmandaBirmingham
Copy link
Collaborator Author

AmandaBirmingham commented Apr 25, 2019

@wasade Urgh. I think I'm going to say static review .... Giving optimism a try :)

That said, if you felt the need to review in a live dev environment, I certainly wouldn't try to stop you.

@AmandaBirmingham
Copy link
Collaborator Author

@wasade Just realized I'm not sure where we stand with this. Assuming we are doing static review only, do you approve this PR? If so, I'd like to merge it soon; if not, would like to know what changes to make.

@wasade
Copy link
Member

wasade commented Apr 25, 2019 via email

@charles-cowart
Copy link
Collaborator

Just to clarify, this PR fixes: #246, #351, #466, #458, #477.

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

Successfully merging this pull request may close these issues.

In plate list interfaces, should also expose date stamp
3 participants