-
Notifications
You must be signed in to change notification settings - Fork 80
DataTables load using AJAX, Search by metadata on studies page #1006
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
616300f
add get_info to Studies object
squirrelo d595016
expand tests
squirrelo 90313f7
use get_info in listing handler
squirrelo fb5eef3
condense view studies pages
squirrelo 1ffd4bc
clean up naming, add form elements
squirrelo 16257c4
load study tables through ajax
squirrelo 9ccc098
add message for zero results
squirrelo abeb46f
add search and retrieve to page
squirrelo 259bec2
fix bug in joins
squirrelo b8472a8
add full ajax search support
squirrelo cf6ca77
add error handling to datatables
squirrelo cd4f66e
alter/add tests for handlers to reflect changes
squirrelo ce4d334
fix tests
squirrelo 58b28cd
implement Jess' suggestions
squirrelo 1872555
Merge branch 'master' of https://github.com/biocore/qiita into cart
squirrelo 4b7ffcf
remove unneeded format loop, format datatables better
squirrelo 515f0f6
update tests
squirrelo 21b17d6
Merge branch 'master' of https://github.com/biocore/qiita into cart
squirrelo 04f87f4
specific ordering for PMIDs for testing
squirrelo ee4c9e2
flake8
squirrelo ef16d18
address issues
squirrelo fbe7c74
address comments
squirrelo e0f22d0
merge upstream/master
squirrelo 0df6666
fix merge issues
squirrelo 5085c35
more enhancements
squirrelo ea69fe8
address comments
squirrelo 3a12f87
update tests
squirrelo 25ae8f2
update schema and html files
squirrelo e01e224
fix search disabled and clearing table search
squirrelo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
add full ajax search support
- Loading branch information
commit b8472a82bc588daed1c351d5436677d790f8eff0
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,8 @@ | |
from qiita_db.user import User | ||
from qiita_db.study import Study, StudyPerson | ||
from qiita_db.search import QiitaStudySearch | ||
from qiita_db.metadata_template import SampleTemplate | ||
from qiita_db.util import get_table_cols | ||
from qiita_pet.handlers.base_handlers import BaseHandler | ||
from qiita_pet.handlers.util import study_person_linkifier, pubmed_linkifier | ||
|
||
|
@@ -53,10 +55,8 @@ def _build_study_info(studytype, user, studies=None): | |
studylist = user.user_studies | Study.get_by_status('public') | ||
elif studytype == "shared": | ||
studylist = user.shared_studies | ||
|
||
if not studylist: | ||
return set() | ||
|
||
StudyTuple = namedtuple('StudyInfo', 'id title meta_complete ' | ||
'num_samples_collected shared num_raw_data pi ' | ||
'pmids owner status abstract') | ||
|
@@ -72,8 +72,11 @@ def _build_study_info(studytype, user, studies=None): | |
owner = study_person_linkifier((info['email'], info['email'])) | ||
PI = StudyPerson(info['principal_investigator_id']) | ||
PI = study_person_linkifier((PI.email, PI.name)) | ||
pmids = ", ".join([pubmed_linkifier([p]) | ||
for p in info['pmid']]) | ||
if info['pmid'] is not None: | ||
pmids = ", ".join([pubmed_linkifier([p]) | ||
for p in info['pmid']]) | ||
else: | ||
pmids = "" | ||
shared = _get_shared_links_for_study(study) | ||
infolist.add(StudyTuple( | ||
study.id, study.title, info["metadata_complete"], | ||
|
@@ -95,7 +98,9 @@ class ListStudiesHandler(BaseHandler): | |
def get(self): | ||
all_emails_except_current = yield Task(self._get_all_emails) | ||
all_emails_except_current.remove(self.current_user.id) | ||
self.render('list_studies.html', | ||
availmeta = SampleTemplate.metadata_headers() +\ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
get_table_cols("study") | ||
self.render('list_studies.html', availmeta=availmeta, | ||
all_emails_except_current=all_emails_except_current) | ||
|
||
def _get_all_emails(self, callback): | ||
|
@@ -177,7 +182,6 @@ def get(self, ignore): | |
else: | ||
# show everything | ||
info = _build_study_info(search_type, self.current_user) | ||
print ">>>>>AJAX", len(info) | ||
# build the table json | ||
results = { | ||
"sEcho": echo, | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if possible, it would be nice to stick with either operators (this line), or methods (line 53), to improve consistency within the method being worked on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will stick with methods, since they are more universal.