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

DATAUP-210 File size error dropzone #1903

Merged
merged 22 commits into from
Oct 30, 2020
Merged

Conversation

eamahanna
Copy link
Contributor

Description of PR purpose/changes

This PR adds a file too large message as detailed in DATAUP-210.
Screen Shot 2020-10-27 at 6 03 13 PM

Jira Ticket / Issue

https://kbase-jira.atlassian.net/browse/DATAUP-210

  • Added the Jira Ticket to the title of the PR e.g. (DATAUP-69 Adds a PR template)

Testing Instructions

  • Details for how to test the PR:
  • execute make test-frontend-unit
  • Navigate to the data import tab on localhost. Add a file that exceeds 20 gb. You will now be able to see the error and click on the link to navigate to the globus docs or a globus account, depending on how you are signed in.

Dev Checklist:

  • My code follows the guidelines at https://sites.google.com/truss.works/kbasetruss/development
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have run Black and Flake8 on changed Python Code manually or with git precommit (and the travis build passes)

Updating Version and Release Notes (if applicable)

@eamahanna eamahanna marked this pull request as draft October 28, 2020 02:06
@lgtm-com
Copy link

lgtm-com bot commented Oct 28, 2020

This pull request introduces 2 alerts when merging c8b2532 into a30f5aa - view on LGTM.com

new alerts:

  • 1 for Useless assignment to local variable
  • 1 for Potentially unsafe external link

@coveralls
Copy link

coveralls commented Oct 28, 2020

Coverage Status

Coverage increased (+0.01%) to 17.035% when pulling 48c6fbb on DATAUP-210-dz-file-size-error into ab028c9 on truss.

@eamahanna eamahanna marked this pull request as ready for review October 28, 2020 15:32
@eamahanna eamahanna marked this pull request as draft October 28, 2020 15:52
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
Copy link
Contributor

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

Copy link
Member

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?

Copy link
Contributor

@leia-sefkin leia-sefkin left a 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

<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">
Copy link
Contributor

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;">
Copy link
Contributor

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?

Copy link
Member

@briehl briehl left a 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
Copy link
Member

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';
Copy link
Member

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?

Copy link
Member

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')
Copy link
Member

Choose a reason for hiding this comment

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

can delete this comment

@eamahanna eamahanna force-pushed the DATAUP-210-dz-file-size-error branch from 78729d2 to 0736142 Compare October 28, 2020 22:37
@eamahanna eamahanna marked this pull request as ready for review October 28, 2020 22:38
@lgtm-com
Copy link

lgtm-com bot commented Oct 28, 2020

This pull request introduces 1 alert when merging 58162c2 into ab028c9 - view on LGTM.com

new alerts:

  • 1 for Useless assignment to local variable

@lgtm-com
Copy link

lgtm-com bot commented Oct 29, 2020

This pull request introduces 1 alert when merging 69c834a into abd2004 - view on LGTM.com

new alerts:

  • 1 for Useless assignment to local variable

@lgtm-com
Copy link

lgtm-com bot commented Oct 29, 2020

This pull request introduces 1 alert when merging a3b35cc into abd2004 - view on LGTM.com

new alerts:

  • 1 for Useless assignment to local variable

@lgtm-com
Copy link

lgtm-com bot commented Oct 29, 2020

This pull request introduces 1 alert when merging 4a9890c into abd2004 - view on LGTM.com

new alerts:

  • 1 for Useless assignment to local variable

@sonarcloud
Copy link

sonarcloud bot commented Oct 30, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@codecov
Copy link

codecov bot commented Oct 30, 2020

Codecov Report

Merging #1903 into truss will increase coverage by 0.00%.
The diff coverage is 44.44%.

Impacted file tree graph

@@           Coverage Diff           @@
##            truss    #1903   +/-   ##
=======================================
  Coverage   12.68%   12.68%           
=======================================
  Files         405      405           
  Lines       43725    43739   +14     
=======================================
+ Hits         5545     5550    +5     
- Misses      38180    38189    +9     
Impacted Files Coverage Δ
.../widgets/narrative_core/upload/fileUploadWidget.js 74.74% <44.44%> (-1.73%) ⬇️
...widgets/narrative_core/upload/stagingAreaViewer.js 62.17% <0.00%> (-0.44%) ⬇️
...s/widgets/narrative_core/kbaseNarrativeDataList.js 35.19% <0.00%> (-0.42%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7f10503...91510ce. Read the comment docs.

@eamahanna eamahanna merged commit 7539b8d into truss Oct 30, 2020
@eamahanna eamahanna deleted the DATAUP-210-dz-file-size-error branch October 30, 2020 00:53
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.

4 participants