Skip to content

Cross-Platform-OutGridView #203

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

Merged
merged 3 commits into from
Mar 10, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions 2-Draft-Accepted/RFCNNNN-Cross-Platform-Out-GridView.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
RFC:
Author: John Zeiders
Status: Draft
SupercededBy:
Version: 0.1
Area: Commands
Comments Due: 6/25/2019
---

# Cross Platform Out-GridView

Out-Gridview was a popular command in Windows PowerShell.
Its dependence on Windows Presentation Foundation API's meant that it didn't make it into PowerShell Core.

> The Out-GridView cmdlet sends the output from a command to a grid view window where the output is displayed in an interactive table.

# Motivation

The feature is a commonly cited reason for not migrating to Powershell Core and its implementation will help further adoption.

# Specification

## cmdlet

The cmdlet will be a modern implementation of [Out-GridView](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/out-gridview?view=powershell-5.1) and also cross platform supported.

```powershell
Out-GridView
[-InputObject <PSObject>]
[-Title <String>]
[-PassThru]
[<CommonParameters>]

Out-GridView
[-InputObject <PSObject>]
[-Title <String>]
[-Wait]
[<CommonParameters>]

Out-GridView
[-InputObject <PSObject>]
[-Title <String>]
[-OutputMode <OutputModeOption>]
[<CommonParameters>]
```

## GUI

The GUI will be implemented on top of [Avalonia UI Framework](https://github.com/AvaloniaUI/Avalonia).
The project was chosen for its active development, implemented capabilities, modeling of WPF, and cross platform support.

A new feature `Show Script` will be added that will generate an equivalent PowerShell script that represents the filters manually applied to Out-GridView.
The goal being to enable better automation at scale while also allowing graphical editing of filters.

Wireframe of the new design.
The wireframe is intended for visual reference, it is **not** a pixel perfect representation.
The most important part to note is the new layout for filters as opposed to the original "Criteria Panel".

![Out-GridViewMockup](../assets/Out-GridView/out_gridview_mockup.png)

## Module

Out-GridView will be added to the PowerShell Graphical Tools Module Microsoft.PowerShell.GraphicalTools.
Forming the basis for future cross-platform graphical commands.

## Removed Features

* Search in Column - Better solved by filters

# Alternative Proposals and Considerations

## GUI Frameworks

### Electron

Despite it's popularity as a cross-platform framework, it's slow boot times make it the wrong choice for a command that is frequently used to create confirmation and selection prompts.

### Web

An interesting concept, particularly interesting for the ability to integrate directly into VSCode.
However, the dependency on having a browser pre-installed makes it less than ideal.

Choose a reason for hiding this comment

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

I don't understand this comment.

Certainly in the primary use-cases (core on Windows, core on Mac, core on WSL, core on Linux desktop) a browser will already exist. I find it unlikely that, in other cases where a graphical interface is needed, a browser won't exist.

I don't think it's reasonable to assume that Out-Gridview would be used in a nginx container. :-)

Copy link
Member

Choose a reason for hiding this comment

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

Yes that's a fair point.

I will say...

Leveraging a web stack for a true Out-GridView that allows options like -PassThru to work is a lot of extra work because it involves having to leverage a web server in order to send the results from the web back to the PowerShell process which is hosting a web server.

I've personally looked into this, and it's a good chunk of work.

Leveraging a GUI framework that works nicely in process is much easier to manage.

Copy link
Member

@TylerLeonhardt TylerLeonhardt Jun 27, 2019

Choose a reason for hiding this comment

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

Przemyslaw did a great job with Out-HtmlView which is like Out-GridView but doesn't support PassThru - likely because he, like me, realized it's harder than first anticipated.

Choose a reason for hiding this comment

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

Do you have metrics?

I use Out-HtmlView daily. Perhaps because I am aware of its limits, I do not feel constrained by those limits.

How often are other use-cases actually necessary?

Copy link
Member

Choose a reason for hiding this comment

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

not sure if we have metrics but getting feedback at conferences... they need -PassThru. Lots of folks use it as a filter for what happens next in the pipeline.

example:
stop the processes you want.

Get-Process | Out-GridView -PassThru | Stop-Process

Copy link
Member

Choose a reason for hiding this comment

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

-PassThru is absolutely necessary. Many IT scripts use it as a way to interactively select objects to act against (like a list of computers or users, etc...).

Choose a reason for hiding this comment

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

I was certainly not coming out "against" -passthru as a requirement.

My point was (and is):

Certainly in the primary use-cases (core on Windows, core on Mac, core on WSL, core on Linux desktop) a browser will already exist. I find it unlikely that, in other cases where a graphical interface is needed, a browser won't exist.

Copy link
Contributor

Choose a reason for hiding this comment

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

Right. The point is, though, that getting data back from a browser instance on the command line in a format that is usable (much less even remotely similar to what was originally put in) would be a bit of a tall order, I think.

Copy link
Member

Choose a reason for hiding this comment

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

The wording of the RFC should be updated to shift focus from the "not having a browser" problem to the PassThru problem.

Binary file added assets/Out-GridView/out_gridview_mockup.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.