Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 3 additions & 2 deletions custom/autoscaling/groups/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/clawscli/claws/internal/dao"
"github.com/clawscli/claws/internal/render"
"github.com/clawscli/claws/internal/ui"
)

// AutoScalingGroupRenderer renders Auto Scaling Groups
Expand Down Expand Up @@ -192,9 +193,9 @@ func (r *AutoScalingGroupRenderer) RenderDetail(resource dao.Resource) string {
}
if proc.ProcessName != nil {
if reason != "" {
d.FieldStyled(*proc.ProcessName, reason, render.WarningStyle())
d.FieldStyled(*proc.ProcessName, reason, ui.WarningStyle())
} else {
d.FieldStyled(*proc.ProcessName, "Suspended", render.WarningStyle())
d.FieldStyled(*proc.ProcessName, "Suspended", ui.WarningStyle())
}
}
}
Expand Down
9 changes: 5 additions & 4 deletions custom/cloudformation/events/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/clawscli/claws/internal/dao"
"github.com/clawscli/claws/internal/render"
"github.com/clawscli/claws/internal/ui"
)

// EventRenderer renders CloudFormation stack events
Expand Down Expand Up @@ -140,13 +141,13 @@ func (r *EventRenderer) RenderSummary(resource dao.Resource) []render.SummaryFie
func cfnResourceStatusColorer(status string) render.Style {
switch {
case strings.HasSuffix(status, "_COMPLETE") && !strings.Contains(status, "ROLLBACK") && !strings.Contains(status, "DELETE"):
return render.SuccessStyle()
return ui.SuccessStyle()
case strings.Contains(status, "IN_PROGRESS"):
return render.WarningStyle()
return ui.WarningStyle()
case strings.Contains(status, "FAILED") || strings.Contains(status, "ROLLBACK"):
return render.DangerStyle()
return ui.DangerStyle()
case strings.Contains(status, "DELETE_COMPLETE") || strings.Contains(status, "SKIPPED"):
return render.DimStyle()
return ui.DimStyle()
default:
return render.DefaultStyle()
}
Expand Down
15 changes: 8 additions & 7 deletions custom/cloudformation/resources/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/clawscli/claws/internal/dao"
"github.com/clawscli/claws/internal/registry"
"github.com/clawscli/claws/internal/render"
"github.com/clawscli/claws/internal/ui"
)

// Ensure ResourceRenderer implements render.Navigator
Expand Down Expand Up @@ -148,13 +149,13 @@ func (r *ResourceRenderer) RenderSummary(resource dao.Resource) []render.Summary
func cfnResourceStatusColorer(status string) render.Style {
switch {
case strings.HasSuffix(status, "_COMPLETE") && !strings.Contains(status, "ROLLBACK") && !strings.Contains(status, "DELETE"):
return render.SuccessStyle()
return ui.SuccessStyle()
case strings.Contains(status, "IN_PROGRESS"):
return render.WarningStyle()
return ui.WarningStyle()
case strings.Contains(status, "FAILED") || strings.Contains(status, "ROLLBACK"):
return render.DangerStyle()
return ui.DangerStyle()
case strings.Contains(status, "DELETE_COMPLETE") || strings.Contains(status, "SKIPPED"):
return render.DimStyle()
return ui.DimStyle()
default:
return render.DefaultStyle()
}
Expand All @@ -164,11 +165,11 @@ func cfnResourceStatusColorer(status string) render.Style {
func driftColorer(status string) render.Style {
switch status {
case "IN_SYNC":
return render.SuccessStyle()
return ui.SuccessStyle()
case "MODIFIED", "DELETED":
return render.DangerStyle()
return ui.DangerStyle()
case "NOT_CHECKED":
return render.DimStyle()
return ui.DimStyle()
default:
return render.DefaultStyle()
}
Expand Down
15 changes: 8 additions & 7 deletions custom/cloudformation/stacks/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
appaws "github.com/clawscli/claws/internal/aws"
"github.com/clawscli/claws/internal/dao"
"github.com/clawscli/claws/internal/render"
"github.com/clawscli/claws/internal/ui"
)

// Ensure StackRenderer implements render.Navigator
Expand Down Expand Up @@ -244,13 +245,13 @@ func (r *StackRenderer) RenderSummary(resource dao.Resource) []render.SummaryFie
func cfnStateColorer(status string) render.Style {
switch {
case strings.HasSuffix(status, "_COMPLETE") && !strings.Contains(status, "ROLLBACK") && !strings.Contains(status, "DELETE"):
return render.SuccessStyle()
return ui.SuccessStyle()
case strings.Contains(status, "IN_PROGRESS"):
return render.WarningStyle()
return ui.WarningStyle()
case strings.Contains(status, "FAILED") || strings.Contains(status, "ROLLBACK"):
return render.DangerStyle()
return ui.DangerStyle()
case strings.Contains(status, "DELETE_COMPLETE"):
return render.DimStyle()
return ui.DimStyle()
default:
return render.DefaultStyle()
}
Expand All @@ -260,11 +261,11 @@ func cfnStateColorer(status string) render.Style {
func driftColorer(status string) render.Style {
switch status {
case "IN_SYNC":
return render.SuccessStyle()
return ui.SuccessStyle()
case "DRIFTED":
return render.DangerStyle()
return ui.DangerStyle()
case "NOT_CHECKED":
return render.DimStyle()
return ui.DimStyle()
default:
return render.DefaultStyle()
}
Expand Down
5 changes: 3 additions & 2 deletions custom/cloudfront/distributions/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/clawscli/claws/internal/dao"
"github.com/clawscli/claws/internal/render"
"github.com/clawscli/claws/internal/ui"
)

// DistributionRenderer renders CloudFront distributions
Expand Down Expand Up @@ -165,15 +166,15 @@ func (r *DistributionRenderer) RenderDetail(resource dao.Resource) string {
d.Field("Price Class", dist.PriceClass())
d.Field("HTTP Version", dist.HttpVersion())
if dist.IsIPV6Enabled {
d.FieldStyled("IPv6", "Enabled", render.SuccessStyle())
d.FieldStyled("IPv6", "Enabled", ui.SuccessStyle())
} else {
d.Field("IPv6", "Disabled")
}

// Access Logging
if dist.Logging != nil && dist.Logging.Enabled != nil && *dist.Logging.Enabled {
d.Section("Access Logging")
d.FieldStyled("Status", "Enabled", render.SuccessStyle())
d.FieldStyled("Status", "Enabled", ui.SuccessStyle())
if dist.Logging.Bucket != nil {
d.Field("Bucket", *dist.Logging.Bucket)
}
Expand Down
6 changes: 1 addition & 5 deletions custom/cloudwatch/log-streams/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,13 @@ func executeLogStreamAction(ctx context.Context, act action.Action, resource dao
}
}

func getCloudWatchLogsClient(ctx context.Context) (*cloudwatchlogs.Client, error) {
return cwClient.GetLogsClient(ctx)
}

func executeDeleteLogStream(ctx context.Context, resource dao.Resource) action.ActionResult {
ls, ok := dao.UnwrapResource(resource).(*LogStreamResource)
if !ok {
return action.InvalidResourceResult()
}

client, err := getCloudWatchLogsClient(ctx)
client, err := cwClient.GetLogsClient(ctx)
if err != nil {
return action.ActionResult{Success: false, Error: err}
}
Expand Down
5 changes: 3 additions & 2 deletions custom/codebuild/projects/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/clawscli/claws/internal/dao"
"github.com/clawscli/claws/internal/render"
"github.com/clawscli/claws/internal/ui"
)

// ProjectRenderer renders CodeBuild projects
Expand Down Expand Up @@ -164,13 +165,13 @@ func (r *ProjectRenderer) RenderDetail(resource dao.Resource) string {
logs := project.Project.LogsConfig
d.Section("Logging")
if logs.CloudWatchLogs != nil && logs.CloudWatchLogs.Status == "ENABLED" {
d.FieldStyled("CloudWatch Logs", "Enabled", render.SuccessStyle())
d.FieldStyled("CloudWatch Logs", "Enabled", ui.SuccessStyle())
if logs.CloudWatchLogs.GroupName != nil {
d.Field(" Log Group", *logs.CloudWatchLogs.GroupName)
}
}
if logs.S3Logs != nil && logs.S3Logs.Status == "ENABLED" {
d.FieldStyled("S3 Logs", "Enabled", render.SuccessStyle())
d.FieldStyled("S3 Logs", "Enabled", ui.SuccessStyle())
if logs.S3Logs.Location != nil {
d.Field(" Location", *logs.S3Logs.Location)
}
Expand Down
3 changes: 2 additions & 1 deletion custom/ecs/services/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
appaws "github.com/clawscli/claws/internal/aws"
"github.com/clawscli/claws/internal/dao"
"github.com/clawscli/claws/internal/render"
"github.com/clawscli/claws/internal/ui"
)

// ServiceRenderer renders ECS services
Expand Down Expand Up @@ -155,7 +156,7 @@ func (r *ServiceRenderer) RenderDetail(resource dao.Resource) string {
if dc.DeploymentCircuitBreaker != nil {
cb := dc.DeploymentCircuitBreaker
if cb.Enable {
d.FieldStyled("Circuit Breaker", "Enabled", render.SuccessStyle())
d.FieldStyled("Circuit Breaker", "Enabled", ui.SuccessStyle())
if cb.Rollback {
d.Field("Rollback on Failure", "Enabled")
}
Expand Down
9 changes: 5 additions & 4 deletions custom/elasticache/clusters/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/clawscli/claws/internal/dao"
"github.com/clawscli/claws/internal/render"
"github.com/clawscli/claws/internal/ui"
)

// ClusterRenderer renders ElastiCache clusters
Expand Down Expand Up @@ -151,7 +152,7 @@ func (r *ClusterRenderer) RenderDetail(resource dao.Resource) string {
nodeId = *node.CacheNodeId
}
if status == "available" {
d.FieldStyled(nodeId, status, render.SuccessStyle())
d.FieldStyled(nodeId, status, ui.SuccessStyle())
} else {
d.Field(nodeId, status)
}
Expand All @@ -161,17 +162,17 @@ func (r *ClusterRenderer) RenderDetail(resource dao.Resource) string {
// Security
d.Section("Security")
if cluster.TransitEncryptionEnabled() {
d.FieldStyled("Transit Encryption", "Enabled", render.SuccessStyle())
d.FieldStyled("Transit Encryption", "Enabled", ui.SuccessStyle())
} else {
d.Field("Transit Encryption", "Disabled")
}
if cluster.AtRestEncryptionEnabled() {
d.FieldStyled("At-Rest Encryption", "Enabled", render.SuccessStyle())
d.FieldStyled("At-Rest Encryption", "Enabled", ui.SuccessStyle())
} else {
d.Field("At-Rest Encryption", "Disabled")
}
if cluster.Item.AuthTokenEnabled != nil && *cluster.Item.AuthTokenEnabled {
d.FieldStyled("AUTH Token", "Enabled", render.SuccessStyle())
d.FieldStyled("AUTH Token", "Enabled", ui.SuccessStyle())
}
d.Field("Auto Minor Version Upgrade", formatBool(cluster.AutoMinorVersionUpgrade()))

Expand Down
5 changes: 3 additions & 2 deletions custom/secretsmanager/secrets/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/clawscli/claws/internal/dao"
"github.com/clawscli/claws/internal/render"
"github.com/clawscli/claws/internal/ui"
)

// SecretRenderer renders Secrets Manager secrets
Expand Down Expand Up @@ -86,7 +87,7 @@ func (r *SecretRenderer) RenderDetail(resource dao.Resource) string {
// Deletion Status
if secret.DeletedDate != nil {
d.Section("Deletion")
d.FieldStyled("Status", "SCHEDULED FOR DELETION", render.DangerStyle())
d.FieldStyled("Status", "SCHEDULED FOR DELETION", ui.DangerStyle())
d.Field("Deletion Date", *secret.DeletedDate)
}

Expand All @@ -101,7 +102,7 @@ func (r *SecretRenderer) RenderDetail(resource dao.Resource) string {
// Rotation
d.Section("Rotation")
if secret.RotationEnabled {
d.FieldStyled("Rotation", "Enabled", render.SuccessStyle())
d.FieldStyled("Rotation", "Enabled", ui.SuccessStyle())
if secret.RotationLambdaARN != "" {
d.Field("Lambda ARN", secret.RotationLambdaARN)
}
Expand Down
11 changes: 6 additions & 5 deletions custom/sns/topics/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/clawscli/claws/internal/dao"
"github.com/clawscli/claws/internal/render"
"github.com/clawscli/claws/internal/ui"
)

// Ensure TopicRenderer implements render.Navigator
Expand Down Expand Up @@ -149,23 +150,23 @@ func (r *TopicRenderer) RenderDetail(resource dao.Resource) string {
}
if role, ok := tr.Attrs["HTTPSuccessFeedbackRoleArn"]; ok && role != "" {
loggingSection()
d.FieldStyled("HTTP", "Enabled", render.SuccessStyle())
d.FieldStyled("HTTP", "Enabled", ui.SuccessStyle())
}
if role, ok := tr.Attrs["LambdaSuccessFeedbackRoleArn"]; ok && role != "" {
loggingSection()
d.FieldStyled("Lambda", "Enabled", render.SuccessStyle())
d.FieldStyled("Lambda", "Enabled", ui.SuccessStyle())
}
if role, ok := tr.Attrs["SQSSuccessFeedbackRoleArn"]; ok && role != "" {
loggingSection()
d.FieldStyled("SQS", "Enabled", render.SuccessStyle())
d.FieldStyled("SQS", "Enabled", ui.SuccessStyle())
}
if role, ok := tr.Attrs["FirehoseSuccessFeedbackRoleArn"]; ok && role != "" {
loggingSection()
d.FieldStyled("Firehose", "Enabled", render.SuccessStyle())
d.FieldStyled("Firehose", "Enabled", ui.SuccessStyle())
}
if role, ok := tr.Attrs["ApplicationSuccessFeedbackRoleArn"]; ok && role != "" {
loggingSection()
d.FieldStyled("Application", "Enabled", render.SuccessStyle())
d.FieldStyled("Application", "Enabled", ui.SuccessStyle())
}

// Encryption
Expand Down
3 changes: 2 additions & 1 deletion custom/stepfunctions/state-machines/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

"github.com/clawscli/claws/internal/dao"
"github.com/clawscli/claws/internal/render"
"github.com/clawscli/claws/internal/ui"
)

// Ensure StateMachineRenderer implements render.Navigator
Expand Down Expand Up @@ -131,7 +132,7 @@ func (r *StateMachineRenderer) RenderDetail(resource dao.Resource) string {
tc := sr.Detail.TracingConfiguration
d.Section("Tracing (X-Ray)")
if tc.Enabled {
d.FieldStyled("X-Ray Tracing", "Enabled", render.SuccessStyle())
d.FieldStyled("X-Ray Tracing", "Enabled", ui.SuccessStyle())
} else {
d.Field("X-Ray Tracing", "Disabled")
}
Expand Down
7 changes: 3 additions & 4 deletions custom/vpc/subnets/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ package subnets
import (
"fmt"

"charm.land/lipgloss/v2"

appaws "github.com/clawscli/claws/internal/aws"
"github.com/clawscli/claws/internal/dao"
"github.com/clawscli/claws/internal/render"
"github.com/clawscli/claws/internal/ui"
)

// Ensure SubnetRenderer implements render.Navigator
Expand Down Expand Up @@ -126,9 +125,9 @@ func (r *SubnetRenderer) RenderDetail(resource dao.Resource) string {

// Public/Private subnet indicator
if sr.IsPublic() {
d.FieldStyled("Subnet Type", "Public", lipgloss.NewStyle().Foreground(lipgloss.Color("42")))
d.FieldStyled("Subnet Type", "Public", ui.SuccessStyle())
} else {
d.FieldStyled("Subnet Type", "Private", lipgloss.NewStyle().Foreground(lipgloss.Color("33")))
d.FieldStyled("Subnet Type", "Private", ui.SecondaryStyle())
}

if sr.Item.AvailabilityZoneId != nil {
Expand Down
5 changes: 3 additions & 2 deletions custom/vpc/vpcs/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
appaws "github.com/clawscli/claws/internal/aws"
"github.com/clawscli/claws/internal/dao"
"github.com/clawscli/claws/internal/render"
"github.com/clawscli/claws/internal/ui"
)

// Ensure VPCRenderer implements render.Navigator
Expand Down Expand Up @@ -117,12 +118,12 @@ func (r *VPCRenderer) RenderDetail(resource dao.Resource) string {
// DNS Settings
d.Section("DNS Settings")
if vr.EnableDnsSupport {
d.FieldStyled("DNS Resolution", "Enabled", render.SuccessStyle())
d.FieldStyled("DNS Resolution", "Enabled", ui.SuccessStyle())
} else {
d.Field("DNS Resolution", "Disabled")
}
if vr.EnableDnsHostnames {
d.FieldStyled("DNS Hostnames", "Enabled", render.SuccessStyle())
d.FieldStyled("DNS Hostnames", "Enabled", ui.SuccessStyle())
} else {
d.Field("DNS Hostnames", "Disabled")
}
Expand Down
Loading