-
Notifications
You must be signed in to change notification settings - Fork 53
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
DATAUP-210 File size error dropzone #1903
Conversation
This pull request introduces 2 alerts when merging c8b2532 into a30f5aa - view on LGTM.com new alerts:
|
errorText = err.xhr.responseText; | ||
var $errorMessage = $errorElem.find('#error_message'); | ||
|
||
// I don't know how to determine if the file was too big other than looking at the preview message |
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.
yeah looks like dropzone doesn't offer much help here, there's a maxfilesexceeded event but not for maxFilesize
https://www.dropzonejs.com/#events
this approach seems to make sense given that
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.
The erroredFile
is a standard WebAPI File object, so it has a size attribute which gives up the size in bytes. In theory, that should be the error triggered by the maxFilesize
option way up above where the Dropzone is created. Maybe that's useful?
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.
A couple of places I could see minor improvements, but looks good overall, and works when I tested locally
kbase-extension/static/kbase/js/widgets/narrative_core/upload/fileUploadWidget.js
Outdated
Show resolved
Hide resolved
kbase-extension/static/kbase/js/widgets/narrative_core/upload/fileUploadWidget.js
Outdated
Show resolved
Hide resolved
<div id="status-message" style="display:none"></div> | ||
<div class="progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0" style="margin-bottom: inherit; margin-left: 5px"> | ||
<div class="progress-bar progress-bar-success" style="width:0%;" data-dz-uploadprogress></div> | ||
<div class="row file-row dz-file"> |
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.
look at all those inline styles - gone 😿 so beautiful
<div class="col-md-1 "> | ||
<span class="size pull-right" data-dz-size></span> | ||
</div> | ||
<div id="upload_progress_and_cancel" style="display: inline;"> |
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.
any way to remove this inline style?
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.
Just a couple minor suggestions. But looks good!
errorText = err.xhr.responseText; | ||
var $errorMessage = $errorElem.find('#error_message'); | ||
|
||
// I don't know how to determine if the file was too big other than looking at the preview message |
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.
The erroredFile
is a standard WebAPI File object, so it has a size attribute which gives up the size in bytes. In theory, that should be the error triggered by the maxFilesize
option way up above where the Dropzone is created. Maybe that's useful?
@@ -168,6 +186,37 @@ define([ | |||
$('#clear-all-btn').remove(); | |||
}, | |||
|
|||
makeGlobusErrorLink: function(globusUrlLinked) { | |||
let url = 'https://docs.kbase.us/data/globus'; |
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.
Should this be part of the uploadConfig
object?
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.
Also, this and $globusErrorLink
should be const
let $globusErrorLink = $("<a>") | ||
.attr('id', 'globus_error_link') | ||
.attr('href', url) | ||
// .attr('target', '_blank') |
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.
can delete this comment
78729d2
to
0736142
Compare
This pull request introduces 1 alert when merging 58162c2 into ab028c9 - view on LGTM.com new alerts:
|
This pull request introduces 1 alert when merging 69c834a into abd2004 - view on LGTM.com new alerts:
|
This pull request introduces 1 alert when merging a3b35cc into abd2004 - view on LGTM.com new alerts:
|
This pull request introduces 1 alert when merging 4a9890c into abd2004 - view on LGTM.com new alerts:
|
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Codecov Report
@@ Coverage Diff @@
## truss #1903 +/- ##
=======================================
Coverage 12.68% 12.68%
=======================================
Files 405 405
Lines 43725 43739 +14
=======================================
+ Hits 5545 5550 +5
- Misses 38180 38189 +9
Continue to review full report at Codecov.
|
Description of PR purpose/changes
This PR adds a file too large message as detailed in DATAUP-210.
Jira Ticket / Issue
https://kbase-jira.atlassian.net/browse/DATAUP-210
Testing Instructions
make test-frontend-unit
Dev Checklist:
Updating Version and Release Notes (if applicable)