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

feat(console): assessment results view updates #725

Closed
wants to merge 41 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
eb4ae08
feat(console): assessment-results updates
meganwolf0 Sep 23, 2024
9835571
feat(console): assessment-results tables
meganwolf0 Sep 30, 2024
f26be72
Merge remote-tracking branch 'origin/main' into 652-console-assessmen…
meganwolf0 Oct 2, 2024
83df32f
feat(console): assessment-results detail
meganwolf0 Oct 3, 2024
4c6a8ea
feat(console): added observation details, refactor
meganwolf0 Oct 4, 2024
b1a919c
feat(console): summary, table keys
meganwolf0 Oct 7, 2024
256ccb8
feat(console): validations detail
meganwolf0 Oct 7, 2024
075e34d
fix: minor cleanups
meganwolf0 Oct 7, 2024
3140fb5
Merge remote-tracking branch 'origin/main' into 652-console-assessmen…
meganwolf0 Oct 10, 2024
f879e87
feat(console): add validation detail, reorg, tests
meganwolf0 Oct 10, 2024
1d18599
fix: yaml dep
meganwolf0 Oct 10, 2024
543e7b0
fix: testdata
meganwolf0 Oct 10, 2024
f18c1d7
Merge branch 'main' into 722-console-lula-validation-view
meganwolf0 Oct 10, 2024
37acea1
feat(console): add support for multiple input files
meganwolf0 Oct 10, 2024
32fc410
fix: test updates
meganwolf0 Oct 11, 2024
295ef3c
Merge branch 'main' into 728-console-support-multiple-files-as-input
meganwolf0 Oct 11, 2024
22f7b62
fix: doc updates
meganwolf0 Oct 11, 2024
2d470bf
Merge remote-tracking branch 'refs/remotes/origin/728-console-support…
meganwolf0 Oct 11, 2024
42bea71
fix: updated organization, small bugs
meganwolf0 Oct 11, 2024
284b2ea
Merge branch 'main' into 728-console-support-multiple-files-as-input
meganwolf0 Oct 11, 2024
0d747c1
Merge branch 'main' into 728-console-support-multiple-files-as-input
meganwolf0 Oct 14, 2024
2fa2ee0
Merge branch 'main' into 722-console-lula-validation-view
meganwolf0 Oct 14, 2024
a0ab1b9
fix: minor cleanups
meganwolf0 Oct 15, 2024
1a55a42
Merge branch '722-console-lula-validation-view' into 723-console-asse…
meganwolf0 Oct 15, 2024
aeb4663
feat(console): assessment results with compare
meganwolf0 Oct 15, 2024
08f740d
feat(console): compare updates, tests
meganwolf0 Oct 15, 2024
6eeb0f7
fix: testdata
meganwolf0 Oct 15, 2024
b77df1c
fix: file save workflow
meganwolf0 Oct 15, 2024
c70da36
fix: duplicate observations during compare
meganwolf0 Oct 15, 2024
f41c467
fix: updated tests for consistency
meganwolf0 Oct 15, 2024
2b12747
Merge branch '722-console-lula-validation-view' into 723-console-asse…
meganwolf0 Oct 15, 2024
1a61d6f
Merge branch '728-console-support-multiple-files-as-input' into 723-c…
meganwolf0 Oct 15, 2024
7cfab34
feat(console): view updates, small fixes
meganwolf0 Oct 16, 2024
3e55168
feat(console): event cleanup, tests
meganwolf0 Oct 16, 2024
6d5de43
Merge remote-tracking branch 'origin/main' into 723-console-assessmen…
meganwolf0 Oct 18, 2024
37f6bf2
feat(console): docs
meganwolf0 Oct 18, 2024
292f393
fix: assessment testdata update
meganwolf0 Oct 18, 2024
d70c72e
Merge branch 'main' into 723-console-assessment-results-view-updates
meganwolf0 Oct 18, 2024
a53f8b7
Merge remote-tracking branch 'origin/main' into 723-console-assessmen…
meganwolf0 Oct 18, 2024
e671bfc
fix: small mods in component
meganwolf0 Oct 18, 2024
61adafa
fix: golangci-lint errs
meganwolf0 Oct 18, 2024
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
45 changes: 45 additions & 0 deletions demo/console/assessment-results-compare.tape
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
Output images/assessment-results-console-compare.gif

Require lula
Set FontSize 14
Set Width 1850
Set Height 925
Set Framerate 24
Set Padding 5

Hide
Type "lula console -f ./src/test/unit/common/oscal/valid-assessment-results-multi.yaml" Enter
Sleep 1s
Tab
Sleep 500ms
Show

# Select comparison result
Sleep 1s
Right
Sleep 500ms
Right
Sleep 500ms
Enter
Sleep 1s
Down
Sleep 500ms
Enter
Sleep 500ms

# Navigate to findings, observations
Right
Sleep 500ms
Right
Sleep 500ms
Down
Sleep 500ms
Up
Sleep 500ms
Left
Sleep 1s

# Show findings comparison detail
Type "d"
Sleep 2s

49 changes: 49 additions & 0 deletions demo/console/assessment-results.tape
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
Output images/assessment-results-console.gif

Require lula
Set FontSize 14
Set Width 1850
Set Height 925
Set Framerate 24
Set Padding 5

Hide
Type "lula console -f ./src/test/unit/common/oscal/valid-assessment-results-multi.yaml" Enter
Sleep 1s
Tab
Sleep 500ms
Show

# Show results picker
Sleep 1s
Right
Sleep 500ms
Enter
Sleep 1s
Down
Sleep 500ms
Enter
Sleep 500ms

# Navigate to findings, filter
Right
Sleep 500ms
Right
Sleep 500ms
Down
Sleep 500ms
Up
Sleep 500ms
Type "/"
Sleep 500ms
Type "ID-1"
Sleep 500ms
Enter
Sleep 1s

# Navigate to observations
Right
Sleep 500ms
Type "d"
Sleep 2s

39 changes: 39 additions & 0 deletions demo/console/component-validation-detail.tape
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Output images/component-defn-console-validation-detail.gif

Require lula
Set FontSize 14
Set Width 1850
Set Height 925
Set Framerate 24
Set Padding 5

Hide
Type "lula console -f ./src/test/unit/common/oscal/valid-multi-component-validations.yaml" Enter
Sleep 1s
Show

# Navigate to a control and select
Right
Sleep 500ms
Right
Sleep 500ms
Right
Sleep 500ms
Enter
Sleep 1s
Right
Sleep 500ms
Right
Sleep 500ms
Right
Sleep 500ms
Type "d"
Sleep 1s
Down
Sleep 500ms
Down
Sleep 1s
Up
Sleep 500ms
Up
Sleep 1s
35 changes: 33 additions & 2 deletions docs/console/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,38 @@

The Lula Console is a text-based terminal user interface that allows users to interact with the OSCAL documents in a more intuitive and visual way.

See the sub-pages for more information on interacting with OSCAL models in the Console.
Currently, only the **Component Definition** and **Assessment Results** models are supported in the Console.

* See the sub-pages for more information on interacting with each specific OSCAL model in the Console.

>[!NOTE]
>The Console is currently in development and is subject to change.
>The Console is currently in development and views are subject to change.

## Usage

To open the Console with particular OSCAL models:
```shell
lula console -f /path/to/oscal-component.yaml,/path/to/oscal-component-2.yaml,/path/to/assessment-results.yaml
```
The `-f` (or `--input-files`) flag can be used to specify multiple OSCAL model file paths to be loaded into the Console.

### Writing to Output
Currently, the Console supports only writing to the `component-definition` model.

To include an output file to save any changes made to the component definition, use the `--component-output` or `-c`flag:
```shell
lula console -f /path/to/oscal-component.yaml -c /path/to/output.yaml
```

If no output file is specified and a single component definition is passed, the provided component definition will be overwritten. If multiple component definitions are passed and no output file is specified, the Console will default to `component.yaml` in the current working directory.

## Keys

The Console responds to the following keys for navigation and interaction (each sub-model has additional key response, see respective help views for more information):

| Key | Description |
|-----|-------------|
| `?` | Toggle help |
| `ctrl+c` | Quit |
| `tab` | Tab right between models |
| `shift+tab` | Tab left between models |
40 changes: 40 additions & 0 deletions docs/console/assessment-results.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Assessment Results

The Assessment Result view provides the Console user with an interactive experience of the OSCAL Assessment Results model. The view supports navigation between the different results contained in the Assessment Results model, as well as the ability to view Findings and Observations in tabular and filterable formats. Additional `detail` views are available to view the raw OSCAL model data for selected Findings/Observations.

## Usage

The Assessment Results model supports the following views:
* [Result View](./assessment-results.md#result-view)
* [Result Comparison View](./assessment-results.md#result-comparison-view)

## Keys

The Assessment Results model responds to the following keys for navigation and interaction (some widgets have additional key response, see respective help views for more information):

| Key | Description |
|-----|-------------|
| `?` | Toggle help |
| `ctrl+c` | Quit |
| `tab` | Tab right between models |
| `shift+tab` | Tab left between models |
| `←/h` | Navigate left across widgets in model|
| `→/l` | Navigate right across widgets model |
| `↑/k` | Move up in table OR scroll up in panel |
| `↓/j` | Move down in table OR scroll up in panel |
| `/` | Filter table |
| `↳` | Select available item |
| `d` | Detail available item (findings and observations) |
| `esc` | Close OR esc filtering |

During console viewing, the top-right corner will display the help keys availble in the context of the selected widget. When an overlay is open, the help keys will be displayed in the overlay.

## Views

### Result View

<img align="right" src="../../images/assessment-results-console.gif" alt="assessment results console" style="width:100%; height:auto;">

### Result Comparison View

<img align="right" src="../../images/assessment-results-console-compare.gif" alt="assessment results console comparison" style="width:100%; height:auto;">
32 changes: 17 additions & 15 deletions docs/console/component-definition.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,10 @@ The Component Definition view currently allows for a read and limited write expe

## Usage

To view an OSCAL Component Definition model in the Console:
```shell
lula console -f /path/to/oscal-component.yaml
```
The `oscal-component.yaml` will need to be a valid OSCAL model - to use with the Component Definition view, it must contain the `component-definition` top level key.

To include an output file to save any changes made to the component definition, use the `--component-output` or `-c`flag:
```shell
lula console -f /path/to/oscal-component.yaml -c /path/to/output.yaml
```

> [!Note]
> Several component definition models can be passed into the console, via `-f` in a comma-separated list. For multiple component definitions, the output file will default to `component.yaml` unless specified.
The Component Definition model supports the following views:
* [Read-Only Navigation](./component-definition.md#read-only-navigation)
* [Editing Remarks and Description](./component-definition.md#editing-remarks-and-description)
* [Validation Detail](./component-definition.md#validation-detail)

## Keys

Expand All @@ -28,13 +19,14 @@ The Component Definition model responds to the following keys for navigation and
| `ctrl+c` | Quit |
| `tab` | Tab right between models |
| `shift+tab` | Tab left between models |
| `←/h` | Navigate left in model|
| `→/l` | Navigate right in model |
| `←/h` | Navigate left across widgets model|
| `→/l` | Navigate right across widgets model |
| `↑/k` | Move up in list OR scroll up in panel |
| `↓/j` | Move down in list OR scroll up in panel |
| `/` | Filter list |
| `↳` | Select item |
| `e` | Edit available fields (remarks and description) |
| `d` | Detail available fields (validations) |
| `ctrl+s` | Save changes (Note: this may overwrite the original file if an output file unspecified) |
| `esc` | Cancel |

Expand All @@ -44,8 +36,18 @@ During console viewing, the top-right corner will display the help keys availble

### Read-Only Navigation

The model can be sorted by Component, Framework, and Control. Additional data/features provided by the Component Definition OSCAL Model are not currently supported for viewing in the Console.

<img align="right" src="../../images/component-defn-console-read.gif" alt="component definition console read" style="width:100%; height:auto;">

### Editing Remarks and Description

Limited editing of the remarks and description is supported. Once changes are made, to be persisted back to the file, the data will need to be saved via the `ctrl+s` key.

<img align="right" src="../../images/component-defn-console-edit.gif" alt="component definition console edit" style="width:100%; height:auto;">

### Validation Detail

The Validation Detail is a view that displays a somewhat curated version of the Lula Validation. It is intended to be a quick view of the validation, and is not a one-to-one representation.

<img align="right" src="../../images/component-defn-console-validation-detail" alt="component definition console validation detail" style="width:100%; height:auto;">
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ require (
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
github.com/defenseunicorns/go-oscal v0.6.0
github.com/defenseunicorns/pkg/kubernetes v0.3.0
github.com/evertras/bubble-table v0.17.0
github.com/google/go-cmp v0.6.0
github.com/hashicorp/go-version v1.7.0
github.com/kyverno/kyverno-json v0.0.3
Expand Down Expand Up @@ -117,6 +118,7 @@ require (
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
github.com/muesli/cancelreader v0.2.2 // indirect
github.com/muesli/reflow v0.3.0 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
Expand Down
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ github.com/evanphx/json-patch v5.9.0+incompatible h1:fBXyNpNMuTTDdquAq/uisOr2lSh
github.com/evanphx/json-patch v5.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
github.com/evanphx/json-patch/v5 v5.9.0 h1:kcBlZQbplgElYIlo/n1hJbls2z/1awpXxpRi0/FOJfg=
github.com/evanphx/json-patch/v5 v5.9.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ=
github.com/evertras/bubble-table v0.17.0 h1:qQU4bi3IRxuZ5+Fvm3esyU/ucH9ufRXWhWL0fFuMn9c=
github.com/evertras/bubble-table v0.17.0/go.mod h1:ifHujS1YxwnYSOgcR2+m3GnJ84f7CVU/4kUOxUCjEbQ=
github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d h1:105gxyaGwCFad8crR9dcMQWvV9Hvulu6hwUh4tWPJnM=
github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d/go.mod h1:ZZMPRZwes7CROmyNKgQzC3XPs6L/G2EJLHddWejkmf4=
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
Expand Down Expand Up @@ -304,6 +306,7 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4=
github.com/mattn/go-localereader v0.0.1/go.mod h1:8fBrzywKY7BI3czFoHkuzRoWE9C+EiG4R1k4Cjx5p88=
github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
Expand Down Expand Up @@ -335,6 +338,8 @@ github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 h1:ZK8zHtRHOkbHy6Mmr5D
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6/go.mod h1:CJlz5H+gyd6CUWT45Oy4q24RdLyn7Md9Vj2/ldJBSIo=
github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA=
github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo=
github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s=
github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8=
github.com/muesli/termenv v0.15.2 h1:GohcuySI0QmI3wN8Ok9PtKGkgkFIk7y6Vpb5PvrY+Wo=
github.com/muesli/termenv v0.15.2/go.mod h1:Epx+iuz8sNs7mNKhxzH4fWXGNpZwUaJKRS1noLXviQ8=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
Expand Down Expand Up @@ -384,6 +389,7 @@ github.com/pterm/pterm v0.12.79 h1:lH3yrYMhdpeqX9y5Ep1u7DejyHy7NSQg9qrBjF9dFT4=
github.com/pterm/pterm v0.12.79/go.mod h1:1v/gzOF1N0FsjbgTHZ1wVycRkKiatFvJSJC4IGaQAAo=
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM=
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
Expand Down
Binary file added images/assessment-results-console-compare.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/assessment-results-console.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading