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

Migrate REST API progress status to use Write-Progress #167

Merged
merged 1 commit into from
May 12, 2020

Conversation

HowardWolosky
Copy link
Member

@HowardWolosky HowardWolosky commented May 12, 2020

When this module was originally written, it used a special feature
of Write-Host in order to re-write the previously written line, in
order to show the user an indeterminate waiting indicator while the
module awaited a response from the server for a REST API request.

Unfortunately, this doesn't work well with all PowerShell hosts
(PowerShell ISE is one notable example). This approach had been taken
originally as it had seemed odd to use Write-Progress (which displays
an absolute progress percentage) for something where we didn't absolutely
know the final duration.

This change migrates the module over to use Write-Progress, and simply
loops through the displayed percentage completed in the same manor that
it loops through and shows an animation.

This method should achieve the same desired goal (letting users know
that something is happening and that they just need to wait a bit
longer) in a more standards-approved way.

Resolves #119

When this module was originally written, it used a special feature
of Write-Host in order to re-write the previously written line, in
order to show the user an indeterminate waiting indicator while the
module awaited a response from the server for a REST API request.

Unfortunately, this doesn't work well with all PowerShell hosts
(PowerShell ISE is one notable example).  This approach had been taken
originally as it had seemed odd to use Write-Progress (which displays
an absolute progress percentage) for something where we didn't absolutely
know the final duration.

This change migrates the module over to use Write-Progress, and simply
loops through the displayed percentage completed in the same manor that
it loops through and shows an animation.

This method should achieve the same desired goal (letting users know
that something is happening and that they just need to wait a bit
longer) in a more standards-approved way.

Resolve microsoft#119
@HowardWolosky HowardWolosky merged commit 992f678 into microsoft:master May 12, 2020
@StartAutomating
Copy link

Sorry for letting this fall of my radar.

Taking a brief look at implementation, I don't see where you send -Completed message to Write-Progress.

This will cause progress bars to stay visible while any other commands in the script execute. E.g. if you ran a Get- that returned many results, and piped to an expensive Foreach-Object, your progress bar wouldn't go away until the Foreach-Object ended.

Sorry to let this drift off the radar again. Thanks for improving your Write-Progress experience either way.

@HowardWolosky HowardWolosky deleted the progress branch May 12, 2020 20:32
@HowardWolosky
Copy link
Member Author

Thanks for the feedback. Putting out a fix now.

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.

Progress is Incorrectly Displayed
2 participants