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

Embedded license preview when uploading a package through UI #6807

Merged
merged 12 commits into from
Jan 11, 2019

Conversation

agr
Copy link
Contributor

@agr agr commented Jan 10, 2019

Addresses #6531

VerifyPackageRequest view model was extended with two properties: LicenseExpression and LicenseFileContents which are when set cause "License expression" and "License file" items to appear on verify package page.

Two code paths cause verify package page to be presented to the user: regular upload and picking up the past upload, so you can find two calls to GetLicenseFileContentsAsync.

License file contents is presented through <pre> to preserve formatting of the original text file as much as possible, yet some styling changes were made to make long lines to properly wrap.

Introduced the @default-margin-bottom to have the variable containing the default margin-bottom value for p elements (used to introduce white space between metadata items on verify package page), so that custom items that display the license information are also spaced properly, since they don't use the same template as other elements.

Changes to bootstrap.js and package-lock.json happened automagically while building the .less files and probably should be ignored (I can revert, but they'll come back next time someone runs grunt).

License expression preview:
image

License file preview with word wrapping:
image

Long license file preview with keeping text file formatting:

image
(no secondary scrolls, full text is completely displayed on the page increasing its height)

@agr agr changed the title Embedded license preview when uploading the package through UI Embedded license preview when uploading a package through UI Jan 10, 2019
catch (Exception ex)
{
_telemetryService.TraceException(ex);
return View(model);
Copy link
Member

Choose a reason for hiding this comment

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

We have a validationErrorMessage above for some error cases, should we have the same thing here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the case when someone comes to the upload page, but they had incomplete package upload from earlier. Our code tries to recover that incomplete upload, tries to extract the license file if one exists and fails bad enough so that exception is thrown. The whole scenario is complicated so I am hesitant to bubble up any error to the user at this point, anyway, the only way for them to "recover" is to reupload the file, and that's exactly what's going to be prompted from them.

@joelverhagen
Copy link
Member

I think it would be more consistent to linkify the license expression. Could we get a PM's insight on this? @anangaur, @karann-msft

@anangaur
Copy link
Member

Agree! Hope this can be done easily.

Copy link
Member

@joelverhagen joelverhagen left a comment

Choose a reason for hiding this comment

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

Nice 👍

@agr agr merged commit 06e5747 into dev Jan 11, 2019
@agr agr deleted the agr-license-exp-preview branch January 11, 2019 19:58
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