Skip to content

Conversation

@bergmeister
Copy link
Contributor

@bergmeister bergmeister commented Jan 14, 2021

PR Summary

  • Display total download size and show progress
  • Show current download in human readable format. Because PowerShell treats 1 KB as 1024, it should probably use 1024 as the base for KB, MB, etc. The number of significant digits is 1 for KB, 2 for MB, 3 for GB, etc.

Note that because of the -Resume parameter, there can be special edge cases where the number of downloaded bytes is greater than the total download size, hence why Math.Min(x, 100) has to be used when setting the PercentComplete property of the ProgressRecord.

Demo:
progress

PR Context

Fixes #14610

PR Checklist

@bergmeister bergmeister marked this pull request as draft January 14, 2021 19:52
@bergmeister bergmeister marked this pull request as ready for review January 14, 2021 22:48
@iSazonov iSazonov added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Jan 15, 2021
@ghost ghost added the Review - Needed The PR is being reviewed label Jan 29, 2021
@ghost
Copy link

ghost commented Jan 29, 2021

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days.
Maintainer, please provide feedback and/or mark it as Waiting on Author

@bergmeister
Copy link
Contributor Author

@PoshChan please retry macos

@PoshChan
Copy link
Collaborator

@bergmeister, did not find matching build context: PowerShell-CI-macOS; allowed contexts: PowerShell-CI-SSH

@SteveL-MSFT SteveL-MSFT reopened this Jun 26, 2021
@ghost ghost removed the Review - Needed The PR is being reviewed label Jun 26, 2021
@SteveL-MSFT
Copy link
Member

SteveL-MSFT commented Jun 26, 2021

@bergmeister can you rebase and force push to force rerunning CI?

Edit: Nevermind, got it restarted.

@kilasuit kilasuit added the WG-Interactive-Console the console experience label Sep 1, 2022
@kilasuit
Copy link
Collaborator

kilasuit commented Sep 1, 2022

This is much more an Interactive UX decision than core cmdlets and personally whilst I can see where @iSazonov is coming from re the "dead code" we cannot be sure that PowerShell is not already being used with that amount of data via web requests, plus we also have a need to ensure that we also future proof PowerShell as we go, as not to need an additional PR to implement them in future.

Therefore I'd happily approve this PR on behalf of the Interactive UX Working Group.

I would however ask to see the differences in end package size to this PR and one based on the comments that @iSazonov is concerned about because honestly I can't see it making enough of a difference to not allow this PR through as it is

@daxian-dbw
Copy link
Member

@bergmeister I know it's been a long time, and you may have lost the interest in updating this PR. But, if not, could you please address #14611 (comment)? Or, I can help updating the PR.

@ghost ghost removed the Review - Needed The PR is being reviewed label Sep 13, 2022
@pull-request-quantifier-deprecated

This PR has 81 quantified lines of changes. In general, a change size of upto 200 lines is ideal for the best PR experience!


Quantification details

Label      : Small
Size       : +60 -21
Percentile : 32.4%

Total files changed: 7

Change summary by file extension:
.cs : +56 -17
.resx : +4 -4

Change counts above are quantified counts, based on the PullRequestQuantifier customizations.

Why proper sizing of changes matters

Optimal pull request sizes drive a better predictable PR flow as they strike a
balance between between PR complexity and PR review overhead. PRs within the
optimal size (typical small, or medium sized PRs) mean:

  • Fast and predictable releases to production:
    • Optimal size changes are more likely to be reviewed faster with fewer
      iterations.
    • Similarity in low PR complexity drives similar review times.
  • Review quality is likely higher as complexity is lower:
    • Bugs are more likely to be detected.
    • Code inconsistencies are more likely to be detected.
  • Knowledge sharing is improved within the participants:
    • Small portions can be assimilated better.
  • Better engineering practices are exercised:
    • Solving big problems by dividing them in well contained, smaller problems.
    • Exercising separation of concerns within the code changes.

What can I do to optimize my changes

  • Use the PullRequestQuantifier to quantify your PR accurately
    • Create a context profile for your repo using the context generator
    • Exclude files that are not necessary to be reviewed or do not increase the review complexity. Example: Autogenerated code, docs, project IDE setting files, binaries, etc. Check out the Excluded section from your prquantifier.yaml context profile.
    • Understand your typical change complexity, drive towards the desired complexity by adjusting the label mapping in your prquantifier.yaml context profile.
    • Only use the labels that matter to you, see context specification to customize your prquantifier.yaml context profile.
  • Change your engineering behaviors
    • For PRs that fall outside of the desired spectrum, review the details and check if:
      • Your PR could be split in smaller, self-contained PRs instead
      • Your PR only solves one particular issue. (For example, don't refactor and code new features in the same PR).

How to interpret the change counts in git diff output

  • One line was added: +1 -0
  • One line was deleted: +0 -1
  • One line was modified: +1 -1 (git diff doesn't know about modified, it will
    interpret that line like one addition plus one deletion)
  • Change percentiles: Change characteristics (addition, deletion, modification)
    of this PR in relation to all other PRs within the repository.


Was this comment helpful? 👍  :ok_hand:  :thumbsdown: (Email)
Customize PullRequestQuantifier for this repository.

@bergmeister
Copy link
Contributor Author

@bergmeister I know it's been a long time, and you may have lost the interest in updating this PR. But, if not, could you please address #14611 (comment)? Or, I can help updating the PR.

Definitely still interested, I just addressed that comment from Keith that you wanted me to do e8532db

Copy link
Member

@daxian-dbw daxian-dbw left a comment

Choose a reason for hiding this comment

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

@bergmeister It looks good to me overall with 2 comments. Please take a look when you get a chance. Thanks!

@iSazonov
Copy link
Collaborator

@daxian-dbw Have you already looked at the animation in the description of this PR or have you done an actual experiment? Do you see how the bar flickers? How the scale changes? After that, do you really think it's great UX? This is a nightmare.

@daxian-dbw
Copy link
Member

@iSazonov I built and played with the changes in this PR, and it looks pretty nice to me. As for the blinking cursor bar, that's out of the scope of this PR, but something powershell can handle, for example, make the cursor invisible when rendering the progress bar.

How the scale changes? After that, do you really think it's great UX? This is a nightmare.

I'm not sure what you mean by "scale changes", but the new UX is much better than the old UX in my opinion.

Old Classic and Minimal View

old-classic
old-minimal

New Classic and Minimal View

new-classic
new-minimal

Copy link
Member

@daxian-dbw daxian-dbw left a comment

Choose a reason for hiding this comment

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

LGTM

@iSazonov
Copy link
Collaborator

iSazonov commented Sep 16, 2022

@daxian-dbw Could you please also share screenshots for bytes, TB and PB too? I would really like to see how this code works.

If it can't be done, why this dead code? MB is the only thing we need.

@daxian-dbw
Copy link
Member

daxian-dbw commented Sep 16, 2022

I agree it should be super rare to download a package with the TB or PB size, but I'm fine keeping those switch branches in DisplayHumanReadableFileSize for completeness, because:

  1. Those switch branches are very simple, and thus won't cause any problem to maintenance.
  2. You can never say for 100% that no one will download a package with such large size. Maybe someone is using a Terabit Ethernet, and then downloading a TB/PB size package may not be that impossible :)

@kilasuit
Copy link
Collaborator

kilasuit commented Sep 16, 2022

@daxian-dbw Could you please also share screenshots for bytes, TB and PB too? I would really like to see how this code works.

If it can't be done, why this dead code? MB is the only thing we need.

@iSazonov, I'm not sure that this comment is useful, especially considering that we aren't just trying to get rid of "dead code" but trying to have code that is useful now and in the future too

@daxian-dbw
Copy link
Member

@iSazonov Given the discussion above, I will merge this PR as is.

@daxian-dbw daxian-dbw assigned daxian-dbw and unassigned iSazonov Sep 19, 2022
@daxian-dbw daxian-dbw merged commit d3d81c3 into PowerShell:master Sep 19, 2022
@TravisEz13 TravisEz13 mentioned this pull request Sep 30, 2022
22 tasks
@bergmeister bergmeister mentioned this pull request Dec 7, 2022
22 tasks
@VozdyxDev
Copy link

VozdyxDev commented Jul 12, 2023

Have these updates been cancelled?
I'm using the latest version of PowerShell but still getting bytes instead of the handy human display in megabytes
image

@bergmeister
Copy link
Contributor Author

@VozdyxDev Glad you're looking forward to using this feature. This feature didn't make it into 7.3 because it was too close to its release from a testing/risk perspective. It is in the preview of 7.4 though if you already want to use it.

@VozdyxDev
Copy link

Oh, thanks for the info)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log Small WG-Cmdlets general cmdlet issues WG-Interactive-Console the console experience

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Invoke-WebRequest to show expected download size and more human readable format (MB/GB instead of Bytes)