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 209 fix error msg cutoff #1885

Merged
merged 12 commits into from
Oct 28, 2020
Merged

Conversation

eamahanna
Copy link
Contributor

@eamahanna eamahanna commented Oct 23, 2020

Description of PR purpose/changes

This PR alters the file row UI in the dropzone area. On success and error, the file row has been updated to reflect this figma mock: https://www.figma.com/file/zBQcHiLV4FlIkD3Y1ogNcy/concept-sketches2?node-id=13%3A153

Screen Shot 2020-10-23 at 7 09 28 AM

Screen Shot 2020-10-23 at 7 11 39 AM

Jira Ticket / Issue

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

  • 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:

To test this PR, run the narrative locally and navigate to the staging area. Drop a file that is larger than the max file size (20). This will cause the file to error and you will be able to see the changes.

To view the successful file upload, you should see it flash briefly upon success. If you would like to view it for a longer period, open devtools and put a break point on line 108 in file fileUploadWidget.js.

A question I am currently asking Mallory: If the successful files are cleared immediately, do we need the brief flash of the success styling? Does it make sense to leave those files in the dropzone or should we just remove it immediately?

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 changed the base branch from develop to truss October 23, 2020 04:05
@coveralls
Copy link

coveralls commented Oct 23, 2020

Coverage Status

Coverage increased (+0.05%) to 17.027% when pulling 5076004 on DATAUP-209-fix-error-msg-cutoff into beef10e on truss.

@eamahanna eamahanna marked this pull request as ready for review October 23, 2020 15:15
@@ -17,7 +17,7 @@
margin: 2em 4.5em;
}

.text-button {
.btn__text {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed the button name to match new BEM standard.

// If there is a button already in the area, it has to be removed,
// and appened to the new document when additional errored files are added.
this.deleteClearAllButton();
$dropzoneElem.append(this.makeClearAllButton());
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Deleted this and moved it to the 'added' file event to fix a bug with the clear all button.

})
.on('success', (file, serverResponse) => {
var $successElem = $(file.previewElement);
$successElem.find('#upload_progress_and_cancel').hide();
$successElem.find('#dz_file_row_1').css({"display": "flex", "align-items": "center"});
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Had to use display: flex to get the items in the row vertically aligned. I'm wasn't able to do this with any bootstrap trickery.

<div id="upload_progress_and_cancel" style="display: inline;">
<div class="col-md-3 text-center">
<div class="progress progress-striped active dz-file__progress__bar" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0">
<div class="progress-bar progress-bar-success" style="width:0%;" data-dz-uploadprogress></div>
Copy link
Collaborator

Choose a reason for hiding this comment

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

no unit for 0

Copy link
Collaborator

Choose a reason for hiding this comment

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

still needs the unit removing :)

Copy link
Contributor

Choose a reason for hiding this comment

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

is there a reason this styling is inline vs css?

@ialarmedalien
Copy link
Collaborator

Can you add a bit more space around the icons? They look a little cramped as-is.

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.

AJ already caught everything I would have asked to be fixed - otherwise things are looking good.

Small comment/tip for testing: but I've also been getting around testing with a 20GB file by setting the maxFileSize var in the fileUploadWidget manually to 2

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 few minor comments but looks good to me otherwise

@@ -168,6 +172,15 @@ define([
$('#clear-all-btn').remove();
},

removeProgressBar: function($dropzoneElem) {
if (this.dropzone.getQueuedFiles().length === 0 &&
Copy link
Contributor

Choose a reason for hiding this comment

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

minor but it should be enough to say .length without the ===0 check

<div id="upload_progress_and_cancel" style="display: inline;">
<div class="col-md-3 text-center">
<div class="progress progress-striped active dz-file__progress__bar" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0">
<div class="progress-bar progress-bar-success" style="width:0%;" data-dz-uploadprogress></div>
Copy link
Contributor

Choose a reason for hiding this comment

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

is there a reason this styling is inline vs css?

Comment on lines +99 to +101
$successElem.find('#dz_file_row_1').css({'display': 'flex', 'align-items': 'center'});
$successElem.find('#success_icon').css('display', 'flex');
$successElem.find('#success_message').css('display', 'inline');
Copy link
Collaborator

@ialarmedalien ialarmedalien Oct 27, 2020

Choose a reason for hiding this comment

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

Will there only ever be one file loading at a time -- i.e. will the IDs always be unique?

Can we change these so that rather than adding/removing inline styles, we are adding/removing a class instead? That way, all the css info can go in the stylesheet.

e.g.

<!-- this is not the real html, I made it up as an example -->
<div class="dz-file__status__success dz-file__status__success__hidden">
                <span>Completed</span>
                <i class="fa fa-2x fa-check-circle dz-file__status__icon" aria-hidden="true"></i>
</div>
<div class="dz-file__status__error dz-file__status__error__hidden">
                <span>ZOMG ERROR!</span>
                <i class="fa fa-2x fa-check-circle dz-file__status__icon" aria-hidden="true"></i>
</div>
.dz-file__status__success {
  display: flex;
 ...
}

.dz-file__status__success__hidden {
  display: none;
}
$successElem.find('#success_icon').removeClass('dz-file__status__success__hidden')

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So this code only changes the file template (that is shown in dropzone) for a the single file. The default template, which creates each file's html won't be changed by the .on('errorr'... changes. I don't know if that made sense. If it didn't, let me know and I can explain on a quick zoom call. I can work on making the styling changes in classes instead of jquery stuff :)

@sonarcloud
Copy link

sonarcloud bot commented Oct 28, 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 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

@eamahanna eamahanna merged commit ab028c9 into truss Oct 28, 2020
@eamahanna eamahanna deleted the DATAUP-209-fix-error-msg-cutoff branch October 28, 2020 15:16
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