* Add image name to details view When frequently opening multiple images perhaps concurrently on multiple terminals, it would be convenient to have the image name displayed. This commit adds the image name to the Image Details view. Image name is trickled down as an additional string argument design alternatives discarded: pass in analysis struct - is not related to analysis pass new struct with image attributes - premature abstraction * Fix CI lint errors Co-authored-by: Aviv Shavit <aviv.shavit@aquasec.com>
60 lines
1.1 KiB
Go
60 lines
1.1 KiB
Go
package view
|
|
|
|
import (
|
|
"github.com/jroimartin/gocui"
|
|
"github.com/wagoodman/dive/dive/filetree"
|
|
"github.com/wagoodman/dive/dive/image"
|
|
)
|
|
|
|
type Views struct {
|
|
Tree *FileTree
|
|
Layer *Layer
|
|
Status *Status
|
|
Filter *Filter
|
|
Details *Details
|
|
Debug *Debug
|
|
}
|
|
|
|
func NewViews(g *gocui.Gui, imageName string, analysis *image.AnalysisResult, cache filetree.Comparer) (*Views, error) {
|
|
Layer, err := newLayerView(g, analysis.Layers)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
treeStack := analysis.RefTrees[0]
|
|
Tree, err := newFileTreeView(g, treeStack, analysis.RefTrees, cache)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
Status := newStatusView(g)
|
|
|
|
// set the layer view as the first selected view
|
|
Status.SetCurrentView(Layer)
|
|
|
|
Filter := newFilterView(g)
|
|
|
|
Details := newDetailsView(g, imageName, analysis.Efficiency, analysis.Inefficiencies, analysis.SizeBytes)
|
|
|
|
Debug := newDebugView(g)
|
|
|
|
return &Views{
|
|
Tree: Tree,
|
|
Layer: Layer,
|
|
Status: Status,
|
|
Filter: Filter,
|
|
Details: Details,
|
|
Debug: Debug,
|
|
}, nil
|
|
}
|
|
|
|
func (views *Views) All() []Renderer {
|
|
return []Renderer{
|
|
views.Tree,
|
|
views.Layer,
|
|
views.Status,
|
|
views.Filter,
|
|
views.Details,
|
|
}
|
|
}
|