-
Notifications
You must be signed in to change notification settings - Fork 79
Delete analysis #1175
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
Delete analysis #1175
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
dff6c49
GUI modifications
antgonza 39f7961
Merge branch 'fix-947' of https://github.com/antgonza/qiita into dele…
antgonza b78e50a
fix #1091
antgonza 742f9f1
fix
antgonza 0a54881
Merge branch 'master' of https://github.com/biocore/qiita into delete…
antgonza dc938f7
addressing suggestions from @josenavas
antgonza 368722e
addressing comments
antgonza 6619434
upstream master
antgonza 7e22a62
addressing @adamrp comment
antgonza 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
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
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
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 |
|---|---|---|
|
|
@@ -31,6 +31,7 @@ | |
| filepath_ids_to_rel_paths) | ||
| from qiita_db.exceptions import QiitaDBUnknownIDError | ||
| from qiita_db.study import Study | ||
| from qiita_db.logger import LogEntry | ||
|
|
||
| SELECT_SAMPLES = 2 | ||
| SELECT_COMMANDS = 3 | ||
|
|
@@ -153,21 +154,54 @@ def get(self, analysis_id): | |
| dropped[data_type].append((Study(study).title, len(samples), | ||
| ', '.join(samples))) | ||
|
|
||
| self.render("analysis_results.html", | ||
| self.render("analysis_results.html", analysis_id=analysis_id, | ||
| jobres=jobres, aname=analysis.name, dropped=dropped, | ||
| basefolder=get_db_files_base_dir()) | ||
|
|
||
| @authenticated | ||
| def post(self, analysis_id): | ||
| analysis_id = int(analysis_id.split("/")[0]) | ||
| analysis_id_sent = int(self.get_argument('analysis_id')) | ||
| action = self.get_argument('action') | ||
|
|
||
| if analysis_id != analysis_id_sent or action != 'delete_analysis': | ||
| raise QiitaPetAuthorizationError( | ||
| self.current_user.id, | ||
| 'analysis/results/%d-delete' % analysis_id) | ||
|
|
||
| analysis = Analysis(analysis_id) | ||
| analysis_name = analysis.name | ||
| check_analysis_access(self.current_user, analysis) | ||
|
|
||
| try: | ||
| Analysis.delete(analysis_id) | ||
| msg = ("Analysis <b><i>%s</i></b> has been deleted." % ( | ||
| analysis_name)) | ||
| level = "success" | ||
| except Exception as e: | ||
| e = str(e) | ||
| msg = ("Couldn't remove <b><i>%s</i></b> analysis: %s" % ( | ||
| analysis_name, e)) | ||
| level = "danger" | ||
|
Contributor
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. Can you log the error? |
||
| LogEntry.create('Runtime', "Couldn't remove analysis ID %d: %s" % | ||
| (analysis_id, e)) | ||
|
|
||
| self.redirect(u"/analysis/show/?level=%s&message=%s" % (level, msg)) | ||
|
|
||
|
|
||
| class ShowAnalysesHandler(BaseHandler): | ||
| """Shows the user's analyses""" | ||
| @authenticated | ||
| def get(self): | ||
| message = self.get_argument('message', '') | ||
| level = self.get_argument('level', '') | ||
| user = self.current_user | ||
|
|
||
| analyses = [Analysis(a) for a in | ||
| user.shared_analyses | user.private_analyses] | ||
|
|
||
| self.render("show_analyses.html", analyses=analyses) | ||
| self.render("show_analyses.html", analyses=analyses, message=message, | ||
| level=level) | ||
|
|
||
|
|
||
| class ResultsHandler(StaticFileHandler, BaseHandler): | ||
|
|
||
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.
@antgonza there is still another table in which the analysis can be present:
analysis_chain. Right now we are not using that table for anything, but we can easily forget about it on deletion once we start using it. There are 2 possible solutions:I'm fine with adding an issue, since currently we are not using that and a lot of other changes will be needed once that gets in place.
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.
I happy adding the check and the delete of those rows ... shouldn't be a problem.
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.
Decided to leave it as an issue #1176 so the solution is complete when implemented.
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.
Thanks @antgonza just one minor thing: can you add a comment with a reference to the issue? Like
# TODO: issue #1176, so we have a pointer in the code and we don't forget about it.