remove dashboard, check options from workspace profile & default config

This commit is contained in:
Puskar Basu
2024-07-03 16:50:12 +05:30
parent c7cea201da
commit 2d687a83e3
5 changed files with 3 additions and 69 deletions

View File

@@ -19,11 +19,6 @@ const DefaultConnectionConfigContent = `
# cache_max_size_mb = 1024 # max total size of cache across all plugins
# }
# options "dashboard" {
# port = 9193 # any valid, open port number
# listen = "local" # local, network
# }
# options "general" {
# update_check = true # true, false
# telemetry = "info" # info, none

View File

@@ -36,16 +36,5 @@ const DefaultWorkspaceContent = `
# separator = "," # any single char
# timing = on # off, on, verbose
# }
#
# options "check" {
# header = true # true, false
# output = "text" # brief, csv, html, json, md, text, snapshot or none (default "text")
# separator = "," # any single char
# timing = true # true, false
# }
#
# options "dashboard" {
# browser = true
# }
# }
`

View File

@@ -39,11 +39,9 @@ type WorkspaceProfile struct {
Base *WorkspaceProfile `hcl:"base"`
// options
QueryOptions *options.Query `cty:"query-options"`
CheckOptions *options.Check `cty:"check-options"`
DashboardOptions *options.WorkspaceProfileDashboard `cty:"dashboard-options"`
DeclRange hcl.Range
block *hcl.Block
QueryOptions *options.Query `cty:"query-options"`
DeclRange hcl.Range
block *hcl.Block
}
func NewWorkspaceProfile(block *hcl.Block) *WorkspaceProfile {
@@ -64,16 +62,6 @@ func (p *WorkspaceProfile) SetOptions(opts options.Options, block *hcl.Block) hc
diags = append(diags, duplicateOptionsBlockDiag(block))
}
p.QueryOptions = o
case *options.Check:
if p.CheckOptions != nil {
diags = append(diags, duplicateOptionsBlockDiag(block))
}
p.CheckOptions = o
case *options.WorkspaceProfileDashboard:
if p.DashboardOptions != nil {
diags = append(diags, duplicateOptionsBlockDiag(block))
}
p.DashboardOptions = o
default:
diags = append(diags, &hcl.Diagnostic{
Severity: hcl.DiagError,
@@ -211,16 +199,6 @@ func (p *WorkspaceProfile) setBaseProperties() {
} else {
p.QueryOptions.SetBaseProperties(p.Base.QueryOptions)
}
if p.CheckOptions == nil {
p.CheckOptions = p.Base.CheckOptions
} else {
p.CheckOptions.SetBaseProperties(p.Base.CheckOptions)
}
if p.DashboardOptions == nil {
p.DashboardOptions = p.Base.DashboardOptions
} else {
p.DashboardOptions.SetBaseProperties(p.Base.DashboardOptions)
}
}
// ConfigMap creates a config map containing all options to pass to viper
@@ -251,12 +229,6 @@ func (p *WorkspaceProfile) ConfigMap(cmd *cobra.Command) map[string]interface{}
if cmd.Name() == constants.CmdNameQuery && p.QueryOptions != nil {
res.PopulateConfigMapForOptions(p.QueryOptions)
}
if cmd.Name() == constants.CmdNameCheck && p.CheckOptions != nil {
res.PopulateConfigMapForOptions(p.CheckOptions)
}
if cmd.Name() == constants.CmdNameDashboard && p.DashboardOptions != nil {
res.PopulateConfigMapForOptions(p.DashboardOptions)
}
return res
}

View File

@@ -33,7 +33,6 @@ type SteampipeConfig struct {
// Steampipe options
DefaultConnectionOptions *options.Connection
DatabaseOptions *options.Database
DashboardOptions *options.GlobalDashboard
TerminalOptions *options.Terminal
GeneralOptions *options.General
PluginOptions *options.Plugin
@@ -86,9 +85,6 @@ func (c *SteampipeConfig) ConfigMap() map[string]interface{} {
if c.DatabaseOptions != nil {
res.PopulateConfigMapForOptions(c.DatabaseOptions)
}
if c.DashboardOptions != nil {
res.PopulateConfigMapForOptions(c.DashboardOptions)
}
if c.PluginOptions != nil {
res.PopulateConfigMapForOptions(c.PluginOptions)
}
@@ -106,12 +102,6 @@ func (c *SteampipeConfig) SetOptions(opts options.Options) (errorsAndWarnings er
} else {
c.DatabaseOptions.Merge(o)
}
case *options.GlobalDashboard:
if c.DashboardOptions == nil {
c.DashboardOptions = o
} else {
c.DashboardOptions.Merge(o)
}
case *options.General:
if c.GeneralOptions == nil {
c.GeneralOptions = o
@@ -220,12 +210,6 @@ DefaultConnectionOptions:
DatabaseOptions:
%s`, c.DatabaseOptions.String())
}
if c.DashboardOptions != nil {
str += fmt.Sprintf(`
DashboardOptions:
%s`, c.DashboardOptions.String())
}
if c.TerminalOptions != nil {
str += fmt.Sprintf(`

View File

@@ -21,9 +21,6 @@ workspace "default" {
separator = "|"
timing = true
}
options "dashboard" {
browser = true
}
}
workspace "sample" {
@@ -49,7 +46,4 @@ workspace "sample" {
separator = ";"
timing = true
}
options "dashboard" {
browser = true
}
}