Fixed styling of the other tools
This commit is contained in:
parent
809f9adfea
commit
eadf8d1720
|
@ -7,14 +7,15 @@ import (
|
|||
"github.com/charmbracelet/lipgloss"
|
||||
"github.com/lmika/awstools/internal/common/ui/commandctrl"
|
||||
"github.com/lmika/awstools/internal/common/ui/logging"
|
||||
"github.com/lmika/awstools/internal/slog-view/services/logreader"
|
||||
"github.com/lmika/awstools/internal/slog-view/controllers"
|
||||
"github.com/lmika/awstools/internal/slog-view/services/logreader"
|
||||
"github.com/lmika/awstools/internal/slog-view/ui"
|
||||
"github.com/lmika/gopkgs/cli"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
var flagDebug = flag.String("debug", "", "file to log debug messages")
|
||||
flag.Parse()
|
||||
|
||||
if flag.NArg() == 0 {
|
||||
|
@ -24,7 +25,7 @@ func main() {
|
|||
// Pre-determine if layout has dark background. This prevents calls for creating a list to hang.
|
||||
lipgloss.HasDarkBackground()
|
||||
|
||||
closeFn := logging.EnableLogging()
|
||||
closeFn := logging.EnableLogging(*flagDebug)
|
||||
defer closeFn()
|
||||
|
||||
service := logreader.NewService()
|
||||
|
|
|
@ -2,6 +2,7 @@ package main
|
|||
|
||||
import (
|
||||
"context"
|
||||
"flag"
|
||||
"fmt"
|
||||
"github.com/aws/aws-sdk-go-v2/config"
|
||||
"github.com/aws/aws-sdk-go-v2/service/ssm"
|
||||
|
@ -18,10 +19,13 @@ import (
|
|||
)
|
||||
|
||||
func main() {
|
||||
var flagDebug = flag.String("debug", "", "file to log debug messages")
|
||||
flag.Parse()
|
||||
|
||||
// Pre-determine if layout has dark background. This prevents calls for creating a list to hang.
|
||||
lipgloss.HasDarkBackground()
|
||||
|
||||
closeFn := logging.EnableLogging()
|
||||
closeFn := logging.EnableLogging(*flagDebug)
|
||||
defer closeFn()
|
||||
|
||||
cfg, err := config.LoadDefaultConfig(context.Background())
|
||||
|
|
|
@ -129,12 +129,12 @@ func (c *TableReadController) ExportCSV(filename string) tea.Cmd {
|
|||
cw := csv.NewWriter(f)
|
||||
defer cw.Flush()
|
||||
|
||||
columns := resultSet.Columns
|
||||
columns := resultSet.Columns()
|
||||
if err := cw.Write(columns); err != nil {
|
||||
return events.Error(errors.Wrapf(err, "cannot export to '%v'", filename))
|
||||
}
|
||||
|
||||
row := make([]string, len(resultSet.Columns))
|
||||
row := make([]string, len(columns))
|
||||
for _, item := range resultSet.Items() {
|
||||
for i, col := range columns {
|
||||
row[i], _ = item.AttributeValueAsString(col)
|
||||
|
|
|
@ -77,6 +77,7 @@ func (twc *TableWriteController) SetStringValue(idx int, key string) tea.Cmd {
|
|||
twc.state.withResultSet(func(set *models.ResultSet) {
|
||||
set.Items()[idx][key] = &types.AttributeValueMemberS{Value: value}
|
||||
set.SetDirty(idx, true)
|
||||
set.RefreshColumns()
|
||||
})
|
||||
return ResultSetUpdated{}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
package models
|
||||
|
||||
import "sort"
|
||||
|
||||
type ResultSet struct {
|
||||
TableInfo *TableInfo
|
||||
Query Queryable
|
||||
Columns []string
|
||||
TableInfo *TableInfo
|
||||
Query Queryable
|
||||
//Columns []string
|
||||
items []Item
|
||||
attributes []ItemAttribute
|
||||
|
||||
columns []string
|
||||
}
|
||||
|
||||
type Queryable interface {
|
||||
|
@ -75,3 +79,46 @@ func (rs *ResultSet) MarkedItems() []Item {
|
|||
}
|
||||
return items
|
||||
}
|
||||
|
||||
func (rs *ResultSet) Columns() []string {
|
||||
if rs.columns == nil {
|
||||
rs.RefreshColumns()
|
||||
}
|
||||
return rs.columns
|
||||
}
|
||||
|
||||
func (rs *ResultSet) RefreshColumns() {
|
||||
seenColumns := make(map[string]int)
|
||||
seenColumns[rs.TableInfo.Keys.PartitionKey] = 0
|
||||
if rs.TableInfo.Keys.SortKey != "" {
|
||||
seenColumns[rs.TableInfo.Keys.SortKey] = 1
|
||||
}
|
||||
|
||||
for _, definedAttribute := range rs.TableInfo.DefinedAttributes {
|
||||
if _, seen := seenColumns[definedAttribute]; !seen {
|
||||
seenColumns[definedAttribute] = len(seenColumns)
|
||||
}
|
||||
}
|
||||
|
||||
otherColsRank := len(seenColumns)
|
||||
for _, result := range rs.items {
|
||||
for k := range result {
|
||||
if _, isSeen := seenColumns[k]; !isSeen {
|
||||
seenColumns[k] = otherColsRank
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
columns := make([]string, 0, len(seenColumns))
|
||||
for k := range seenColumns {
|
||||
columns = append(columns, k)
|
||||
}
|
||||
sort.Slice(columns, func(i, j int) bool {
|
||||
if seenColumns[columns[i]] == seenColumns[columns[j]] {
|
||||
return columns[i] < columns[j]
|
||||
}
|
||||
return seenColumns[columns[i]] < seenColumns[columns[j]]
|
||||
})
|
||||
|
||||
rs.columns = columns
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package tables
|
|||
import (
|
||||
"context"
|
||||
"github.com/aws/aws-sdk-go-v2/feature/dynamodb/expression"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/lmika/awstools/internal/dynamo-browse/models"
|
||||
|
@ -55,46 +54,47 @@ func (s *Service) doScan(ctx context.Context, tableInfo *models.TableInfo, expr
|
|||
}
|
||||
|
||||
// Get the columns
|
||||
seenColumns := make(map[string]int)
|
||||
seenColumns[tableInfo.Keys.PartitionKey] = 0
|
||||
if tableInfo.Keys.SortKey != "" {
|
||||
seenColumns[tableInfo.Keys.SortKey] = 1
|
||||
}
|
||||
|
||||
for _, definedAttribute := range tableInfo.DefinedAttributes {
|
||||
if _, seen := seenColumns[definedAttribute]; !seen {
|
||||
seenColumns[definedAttribute] = len(seenColumns)
|
||||
}
|
||||
}
|
||||
|
||||
otherColsRank := len(seenColumns)
|
||||
for _, result := range results {
|
||||
for k := range result {
|
||||
if _, isSeen := seenColumns[k]; !isSeen {
|
||||
seenColumns[k] = otherColsRank
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
columns := make([]string, 0, len(seenColumns))
|
||||
for k := range seenColumns {
|
||||
columns = append(columns, k)
|
||||
}
|
||||
sort.Slice(columns, func(i, j int) bool {
|
||||
if seenColumns[columns[i]] == seenColumns[columns[j]] {
|
||||
return columns[i] < columns[j]
|
||||
}
|
||||
return seenColumns[columns[i]] < seenColumns[columns[j]]
|
||||
})
|
||||
//seenColumns := make(map[string]int)
|
||||
//seenColumns[tableInfo.Keys.PartitionKey] = 0
|
||||
//if tableInfo.Keys.SortKey != "" {
|
||||
// seenColumns[tableInfo.Keys.SortKey] = 1
|
||||
//}
|
||||
//
|
||||
//for _, definedAttribute := range tableInfo.DefinedAttributes {
|
||||
// if _, seen := seenColumns[definedAttribute]; !seen {
|
||||
// seenColumns[definedAttribute] = len(seenColumns)
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//otherColsRank := len(seenColumns)
|
||||
//for _, result := range results {
|
||||
// for k := range result {
|
||||
// if _, isSeen := seenColumns[k]; !isSeen {
|
||||
// seenColumns[k] = otherColsRank
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//columns := make([]string, 0, len(seenColumns))
|
||||
//for k := range seenColumns {
|
||||
// columns = append(columns, k)
|
||||
//}
|
||||
//sort.Slice(columns, func(i, j int) bool {
|
||||
// if seenColumns[columns[i]] == seenColumns[columns[j]] {
|
||||
// return columns[i] < columns[j]
|
||||
// }
|
||||
// return seenColumns[columns[i]] < seenColumns[columns[j]]
|
||||
//})
|
||||
|
||||
models.Sort(results, tableInfo)
|
||||
|
||||
resultSet := &models.ResultSet{
|
||||
TableInfo: tableInfo,
|
||||
Query: expr,
|
||||
Columns: columns,
|
||||
//Columns: columns,
|
||||
}
|
||||
resultSet.SetItems(results)
|
||||
resultSet.RefreshColumns()
|
||||
|
||||
return resultSet, nil
|
||||
}
|
||||
|
|
|
@ -89,11 +89,21 @@ func (m *Model) updateViewportToSelectedMessage() {
|
|||
|
||||
viewportContent := &strings.Builder{}
|
||||
tabWriter := tabwriter.NewWriter(viewportContent, 0, 1, 1, ' ', 0)
|
||||
for _, colName := range m.currentResultSet.Columns {
|
||||
|
||||
seenColumns := make(map[string]struct{})
|
||||
for _, colName := range m.currentResultSet.Columns() {
|
||||
seenColumns[colName] = struct{}{}
|
||||
if r := m.selectedItem.Renderer(colName); r != nil {
|
||||
m.renderItem(tabWriter, "", colName, r)
|
||||
}
|
||||
}
|
||||
for k, _ := range m.selectedItem {
|
||||
if _, seen := seenColumns[k]; !seen {
|
||||
if r := m.selectedItem.Renderer(k); r != nil {
|
||||
m.renderItem(tabWriter, "", k, r)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tabWriter.Flush()
|
||||
m.viewport.Width = m.w
|
||||
|
|
|
@ -48,11 +48,11 @@ type columnModel struct {
|
|||
}
|
||||
|
||||
func (cm columnModel) Len() int {
|
||||
return len(cm.m.resultSet.Columns[cm.m.colOffset:])
|
||||
return len(cm.m.resultSet.Columns()[cm.m.colOffset:])
|
||||
}
|
||||
|
||||
func (cm columnModel) Header(index int) string {
|
||||
return cm.m.resultSet.Columns[cm.m.colOffset+index]
|
||||
return cm.m.resultSet.Columns()[cm.m.colOffset+index]
|
||||
}
|
||||
|
||||
func New(uiStyles styles.Styles) *Model {
|
||||
|
@ -124,8 +124,8 @@ func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||
func (m *Model) setLeftmostDisplayedColumn(newCol int) {
|
||||
if newCol < 0 {
|
||||
m.colOffset = 0
|
||||
} else if newCol >= len(m.resultSet.Columns) {
|
||||
m.colOffset = len(m.resultSet.Columns) - 1
|
||||
} else if newCol >= len(m.resultSet.Columns()) {
|
||||
m.colOffset = len(m.resultSet.Columns()) - 1
|
||||
} else {
|
||||
m.colOffset = newCol
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ func (mtr itemTableRow) Render(w io.Writer, model table.Model, index int) {
|
|||
metaInfoStyle := style.Copy().Inherit(metaInfoStyle)
|
||||
|
||||
sb := strings.Builder{}
|
||||
for i, colName := range mtr.resultSet.Columns[mtr.model.colOffset:] {
|
||||
for i, colName := range mtr.resultSet.Columns()[mtr.model.colOffset:] {
|
||||
if i > 0 {
|
||||
sb.WriteString(style.Render("\t"))
|
||||
}
|
||||
|
|
29
internal/slog-view/styles/styles.go
Normal file
29
internal/slog-view/styles/styles.go
Normal file
|
@ -0,0 +1,29 @@
|
|||
package styles
|
||||
|
||||
import (
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
"github.com/lmika/awstools/internal/dynamo-browse/ui/teamodels/frame"
|
||||
"github.com/lmika/awstools/internal/dynamo-browse/ui/teamodels/statusandprompt"
|
||||
)
|
||||
|
||||
type Styles struct {
|
||||
Frames frame.Style
|
||||
StatusAndPrompt statusandprompt.Style
|
||||
}
|
||||
|
||||
var DefaultStyles = Styles{
|
||||
Frames: frame.Style{
|
||||
ActiveTitle: lipgloss.NewStyle().
|
||||
Bold(true).
|
||||
Foreground(lipgloss.Color("#000000")).
|
||||
Background(lipgloss.Color("#d1d1d1")),
|
||||
InactiveTitle: lipgloss.NewStyle().
|
||||
Foreground(lipgloss.Color("#000000")).
|
||||
Background(lipgloss.Color("#d1d1d1")),
|
||||
},
|
||||
StatusAndPrompt: statusandprompt.Style{
|
||||
ModeLine: lipgloss.NewStyle().
|
||||
Foreground(lipgloss.Color("#000000")).
|
||||
Background(lipgloss.Color("#d1d1d1")),
|
||||
},
|
||||
}
|
|
@ -2,6 +2,7 @@ package fullviewlinedetails
|
|||
|
||||
import (
|
||||
tea "github.com/charmbracelet/bubbletea"
|
||||
"github.com/lmika/awstools/internal/dynamo-browse/ui/teamodels/frame"
|
||||
"github.com/lmika/awstools/internal/dynamo-browse/ui/teamodels/layout"
|
||||
"github.com/lmika/awstools/internal/slog-view/models"
|
||||
"github.com/lmika/awstools/internal/slog-view/ui/linedetails"
|
||||
|
@ -14,10 +15,10 @@ type Model struct {
|
|||
visible bool
|
||||
}
|
||||
|
||||
func NewModel(submodel tea.Model) *Model {
|
||||
func NewModel(submodel tea.Model, style frame.Style) *Model {
|
||||
return &Model{
|
||||
submodel: submodel,
|
||||
lineDetails: linedetails.New(),
|
||||
lineDetails: linedetails.New(style),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,13 +10,6 @@ import (
|
|||
"github.com/lmika/awstools/internal/slog-view/models"
|
||||
)
|
||||
|
||||
var (
|
||||
activeHeaderStyle = lipgloss.NewStyle().
|
||||
Bold(true).
|
||||
Foreground(lipgloss.Color("#ffffff")).
|
||||
Background(lipgloss.Color("#9c9c9c"))
|
||||
)
|
||||
|
||||
type Model struct {
|
||||
frameTitle frame.FrameTitle
|
||||
viewport viewport.Model
|
||||
|
@ -27,11 +20,11 @@ type Model struct {
|
|||
selectedItem *models.LogLine
|
||||
}
|
||||
|
||||
func New() *Model {
|
||||
func New(style frame.Style) *Model {
|
||||
viewport := viewport.New(0, 0)
|
||||
viewport.SetContent("")
|
||||
return &Model{
|
||||
frameTitle: frame.NewFrameTitle("Item", false, activeHeaderStyle),
|
||||
frameTitle: frame.NewFrameTitle("Item", false, style),
|
||||
viewport: viewport,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,13 +10,6 @@ import (
|
|||
"path/filepath"
|
||||
)
|
||||
|
||||
var (
|
||||
activeHeaderStyle = lipgloss.NewStyle().
|
||||
Bold(true).
|
||||
Foreground(lipgloss.Color("#ffffff")).
|
||||
Background(lipgloss.Color("#9c9c9c"))
|
||||
)
|
||||
|
||||
type Model struct {
|
||||
frameTitle frame.FrameTitle
|
||||
table table.Model
|
||||
|
@ -26,8 +19,8 @@ type Model struct {
|
|||
w, h int
|
||||
}
|
||||
|
||||
func New() *Model {
|
||||
frameTitle := frame.NewFrameTitle("File: ", true, activeHeaderStyle)
|
||||
func New(style frame.Style) *Model {
|
||||
frameTitle := frame.NewFrameTitle("File: ", true, style)
|
||||
table := table.New(table.SimpleColumns{"level", "error", "message"}, 0, 0)
|
||||
|
||||
return &Model{
|
||||
|
|
|
@ -6,38 +6,40 @@ import (
|
|||
"github.com/lmika/awstools/internal/dynamo-browse/ui/teamodels/layout"
|
||||
"github.com/lmika/awstools/internal/dynamo-browse/ui/teamodels/statusandprompt"
|
||||
"github.com/lmika/awstools/internal/slog-view/controllers"
|
||||
"github.com/lmika/awstools/internal/slog-view/styles"
|
||||
"github.com/lmika/awstools/internal/slog-view/ui/fullviewlinedetails"
|
||||
"github.com/lmika/awstools/internal/slog-view/ui/linedetails"
|
||||
"github.com/lmika/awstools/internal/slog-view/ui/loglines"
|
||||
)
|
||||
|
||||
type Model struct {
|
||||
controller *controllers.LogFileController
|
||||
cmdController *commandctrl.CommandController
|
||||
controller *controllers.LogFileController
|
||||
cmdController *commandctrl.CommandController
|
||||
|
||||
root tea.Model
|
||||
logLines *loglines.Model
|
||||
lineDetails *linedetails.Model
|
||||
statusAndPrompt *statusandprompt.StatusAndPrompt
|
||||
root tea.Model
|
||||
logLines *loglines.Model
|
||||
lineDetails *linedetails.Model
|
||||
statusAndPrompt *statusandprompt.StatusAndPrompt
|
||||
fullViewLineDetails *fullviewlinedetails.Model
|
||||
}
|
||||
|
||||
func NewModel(controller *controllers.LogFileController, cmdController *commandctrl.CommandController) Model {
|
||||
logLines := loglines.New()
|
||||
lineDetails := linedetails.New()
|
||||
defaultStyles := styles.DefaultStyles
|
||||
logLines := loglines.New(defaultStyles.Frames)
|
||||
lineDetails := linedetails.New(defaultStyles.Frames)
|
||||
box := layout.NewVBox(layout.LastChildFixedAt(17), logLines, lineDetails)
|
||||
fullViewLineDetails := fullviewlinedetails.NewModel(box)
|
||||
statusAndPrompt := statusandprompt.New(fullViewLineDetails, "")
|
||||
fullViewLineDetails := fullviewlinedetails.NewModel(box, defaultStyles.Frames)
|
||||
statusAndPrompt := statusandprompt.New(fullViewLineDetails, "", defaultStyles.StatusAndPrompt)
|
||||
|
||||
root := layout.FullScreen(statusAndPrompt)
|
||||
|
||||
return Model{
|
||||
controller: controller,
|
||||
cmdController: cmdController,
|
||||
root: root,
|
||||
statusAndPrompt: statusAndPrompt,
|
||||
logLines: logLines,
|
||||
lineDetails: lineDetails,
|
||||
controller: controller,
|
||||
cmdController: cmdController,
|
||||
root: root,
|
||||
statusAndPrompt: statusAndPrompt,
|
||||
logLines: logLines,
|
||||
lineDetails: lineDetails,
|
||||
fullViewLineDetails: fullViewLineDetails,
|
||||
}
|
||||
}
|
||||
|
|
29
internal/sqs-browse/styles/styles.go
Normal file
29
internal/sqs-browse/styles/styles.go
Normal file
|
@ -0,0 +1,29 @@
|
|||
package styles
|
||||
|
||||
import (
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
"github.com/lmika/awstools/internal/dynamo-browse/ui/teamodels/frame"
|
||||
"github.com/lmika/awstools/internal/dynamo-browse/ui/teamodels/statusandprompt"
|
||||
)
|
||||
|
||||
type Styles struct {
|
||||
Frames frame.Style
|
||||
StatusAndPrompt statusandprompt.Style
|
||||
}
|
||||
|
||||
var DefaultStyles = Styles{
|
||||
Frames: frame.Style{
|
||||
ActiveTitle: lipgloss.NewStyle().
|
||||
Bold(true).
|
||||
Foreground(lipgloss.Color("#ffffff")).
|
||||
Background(lipgloss.Color("#4479ff")),
|
||||
InactiveTitle: lipgloss.NewStyle().
|
||||
Foreground(lipgloss.Color("#000000")).
|
||||
Background(lipgloss.Color("#d1d1d1")),
|
||||
},
|
||||
StatusAndPrompt: statusandprompt.Style{
|
||||
ModeLine: lipgloss.NewStyle().
|
||||
Foreground(lipgloss.Color("#000000")).
|
||||
Background(lipgloss.Color("#d1d1d1")),
|
||||
},
|
||||
}
|
29
internal/ssm-browse/styles/styles.go
Normal file
29
internal/ssm-browse/styles/styles.go
Normal file
|
@ -0,0 +1,29 @@
|
|||
package styles
|
||||
|
||||
import (
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
"github.com/lmika/awstools/internal/dynamo-browse/ui/teamodels/frame"
|
||||
"github.com/lmika/awstools/internal/dynamo-browse/ui/teamodels/statusandprompt"
|
||||
)
|
||||
|
||||
type Styles struct {
|
||||
Frames frame.Style
|
||||
StatusAndPrompt statusandprompt.Style
|
||||
}
|
||||
|
||||
var DefaultStyles = Styles{
|
||||
Frames: frame.Style{
|
||||
ActiveTitle: lipgloss.NewStyle().
|
||||
Bold(true).
|
||||
Foreground(lipgloss.Color("#ffffff")).
|
||||
Background(lipgloss.Color("#c144ff")),
|
||||
InactiveTitle: lipgloss.NewStyle().
|
||||
Foreground(lipgloss.Color("#000000")).
|
||||
Background(lipgloss.Color("#d1d1d1")),
|
||||
},
|
||||
StatusAndPrompt: statusandprompt.Style{
|
||||
ModeLine: lipgloss.NewStyle().
|
||||
Foreground(lipgloss.Color("#000000")).
|
||||
Background(lipgloss.Color("#d1d1d1")),
|
||||
},
|
||||
}
|
|
@ -7,6 +7,7 @@ import (
|
|||
"github.com/lmika/awstools/internal/dynamo-browse/ui/teamodels/layout"
|
||||
"github.com/lmika/awstools/internal/dynamo-browse/ui/teamodels/statusandprompt"
|
||||
"github.com/lmika/awstools/internal/ssm-browse/controllers"
|
||||
"github.com/lmika/awstools/internal/ssm-browse/styles"
|
||||
"github.com/lmika/awstools/internal/ssm-browse/ui/ssmdetails"
|
||||
"github.com/lmika/awstools/internal/ssm-browse/ui/ssmlist"
|
||||
"github.com/pkg/errors"
|
||||
|
@ -23,11 +24,11 @@ type Model struct {
|
|||
}
|
||||
|
||||
func NewModel(controller *controllers.SSMController, cmdController *commandctrl.CommandController) Model {
|
||||
ssmList := ssmlist.New()
|
||||
ssmdDetails := ssmdetails.New()
|
||||
defaultStyles := styles.DefaultStyles
|
||||
ssmList := ssmlist.New(defaultStyles.Frames)
|
||||
ssmdDetails := ssmdetails.New(defaultStyles.Frames)
|
||||
statusAndPrompt := statusandprompt.New(
|
||||
layout.NewVBox(layout.LastChildFixedAt(17), ssmList, ssmdDetails),
|
||||
"")
|
||||
layout.NewVBox(layout.LastChildFixedAt(17), ssmList, ssmdDetails), "", defaultStyles.StatusAndPrompt)
|
||||
|
||||
cmdController.AddCommands(&commandctrl.CommandContext{
|
||||
Commands: map[string]commandctrl.Command{
|
||||
|
|
|
@ -11,13 +11,6 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
var (
|
||||
activeHeaderStyle = lipgloss.NewStyle().
|
||||
Bold(true).
|
||||
Foreground(lipgloss.Color("#ffffff")).
|
||||
Background(lipgloss.Color("#c144ff"))
|
||||
)
|
||||
|
||||
type Model struct {
|
||||
frameTitle frame.FrameTitle
|
||||
viewport viewport.Model
|
||||
|
@ -28,11 +21,11 @@ type Model struct {
|
|||
selectedItem *models.SSMParameter
|
||||
}
|
||||
|
||||
func New() *Model {
|
||||
func New(style frame.Style) *Model {
|
||||
viewport := viewport.New(0, 0)
|
||||
viewport.SetContent("")
|
||||
return &Model{
|
||||
frameTitle: frame.NewFrameTitle("Item", false, activeHeaderStyle),
|
||||
frameTitle: frame.NewFrameTitle("Item", false, style),
|
||||
viewport: viewport,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,13 +9,6 @@ import (
|
|||
table "github.com/lmika/go-bubble-table"
|
||||
)
|
||||
|
||||
var (
|
||||
activeHeaderStyle = lipgloss.NewStyle().
|
||||
Bold(true).
|
||||
Foreground(lipgloss.Color("#ffffff")).
|
||||
Background(lipgloss.Color("#c144ff"))
|
||||
)
|
||||
|
||||
type Model struct {
|
||||
frameTitle frame.FrameTitle
|
||||
table table.Model
|
||||
|
@ -25,8 +18,8 @@ type Model struct {
|
|||
w, h int
|
||||
}
|
||||
|
||||
func New() *Model {
|
||||
frameTitle := frame.NewFrameTitle("SSM: /", true, activeHeaderStyle)
|
||||
func New(style frame.Style) *Model {
|
||||
frameTitle := frame.NewFrameTitle("SSM: /", true, style)
|
||||
table := table.New(table.SimpleColumns{"name", "type", "value"}, 0, 0)
|
||||
|
||||
return &Model{
|
||||
|
|
Loading…
Reference in a new issue