diff --git a/pkg/dashboard/dashboardexecute/check_run.go b/pkg/dashboard/dashboardexecute/check_run.go index c00cae32b..b7f7abc2d 100644 --- a/pkg/dashboard/dashboardexecute/check_run.go +++ b/pkg/dashboard/dashboardexecute/check_run.go @@ -33,7 +33,7 @@ func NewCheckRun(resource modconfig.DashboardLeafNode, parent dashboardtypes.Das c := &CheckRun{SessionId: executionTree.sessionId} // create NewDashboardTreeRunImpl // (we must create after creating the run as it requires a ref to the run) - // TODO [node_reuse] do this a different way + // TODO [node_reuse] do this a different way https://github.com/turbot/steampipe/issues/2919 c.DashboardTreeRunImpl = NewDashboardTreeRunImpl(resource, parent, c, executionTree) // verify node type diff --git a/pkg/dashboard/dashboardexecute/container_run.go b/pkg/dashboard/dashboardexecute/container_run.go index 791d30b97..dfcbe5406 100644 --- a/pkg/dashboard/dashboardexecute/container_run.go +++ b/pkg/dashboard/dashboardexecute/container_run.go @@ -34,7 +34,7 @@ func NewDashboardContainerRun(container *modconfig.DashboardContainer, parent da r := &DashboardContainerRun{dashboardNode: container} // create NewDashboardTreeRunImpl // (we must create after creating the run as it requires a ref to the run) - // TODO [node_reuse] do this a different way + // TODO [node_reuse] do this a different way https://github.com/turbot/steampipe/issues/2919 r.DashboardTreeRunImpl = NewDashboardTreeRunImpl(container, parent, r, executionTree) if container.Title != nil { diff --git a/pkg/dashboard/dashboardexecute/dashboard_parent_impl.go b/pkg/dashboard/dashboardexecute/dashboard_parent_impl.go index d6dd68f73..bd172f869 100644 --- a/pkg/dashboard/dashboardexecute/dashboard_parent_impl.go +++ b/pkg/dashboard/dashboardexecute/dashboard_parent_impl.go @@ -94,7 +94,7 @@ func (r *DashboardParentImpl) waitForChildrenAsync() chan error { log.Printf("[TRACE] %s ALL children and withs complete, errors: %v", r.Name, errors) // so all children have completed - check for errors - // TODO [node_reuse] format better error + // TODO [node_reuse] format better error https://github.com/turbot/steampipe/issues/2920 doneChan <- error_helpers.CombineErrors(errors...) }() } diff --git a/pkg/dashboard/dashboardexecute/dashboard_run.go b/pkg/dashboard/dashboardexecute/dashboard_run.go index 0e601c11d..4e6a37a47 100644 --- a/pkg/dashboard/dashboardexecute/dashboard_run.go +++ b/pkg/dashboard/dashboardexecute/dashboard_run.go @@ -40,7 +40,7 @@ func NewDashboardRun(dashboard *modconfig.Dashboard, parent dashboardtypes.Dashb } // create RuntimeDependencyPublisherImpl- this handles 'with' run creation and resolving runtime dependency resolution // (we must create after creating the run as it requires a ref to the run) - // TODO [node_reuse] do this a different way + // TODO [node_reuse] do this a different way https://github.com/turbot/steampipe/issues/2919 r.RuntimeDependencyPublisherImpl = NewRuntimeDependencyPublisherImpl(dashboard, parent, r, executionTree) // add r into execution tree BEFORE creating child runs or initialising runtime depdencies // - this is so child runs can find this dashboard run @@ -160,7 +160,7 @@ func (r *DashboardRun) createChildRuns(executionTree *DashboardExecutionTree) er // TACTICAL: as this is a runtime dependency, set the run name to the 'scoped name' // this is to match the name in the panel dependendencies - // TODO [node_reuse] tidy this + // TODO [node_reuse] consider naming https://github.com/turbot/steampipe/issues/2921 inputRunName := fmt.Sprintf("%s.%s", r.DashboardName, i.UnqualifiedName) childRun, err = NewLeafRun(i.Clone(), r, executionTree, setName(inputRunName)) if err != nil { diff --git a/pkg/dashboard/dashboardexecute/dashboard_tree_run_impl.go b/pkg/dashboard/dashboardexecute/dashboard_tree_run_impl.go index d64c18a6a..7dbed5720 100644 --- a/pkg/dashboard/dashboardexecute/dashboard_tree_run_impl.go +++ b/pkg/dashboard/dashboardexecute/dashboard_tree_run_impl.go @@ -30,8 +30,7 @@ type DashboardTreeRunImpl struct { resource modconfig.DashboardLeafNode // store the top level run which embeds this struct // we need this for setStatus which serialises the run for the message payload - run dashboardtypes.DashboardTreeRun - executeConfig dashboardtypes.TreeRunExecuteConfig + run dashboardtypes.DashboardTreeRun } func NewDashboardTreeRunImpl(resource modconfig.DashboardLeafNode, parent dashboardtypes.DashboardParent, run dashboardtypes.DashboardTreeRun, executionTree *DashboardExecutionTree) DashboardTreeRunImpl { @@ -129,9 +128,6 @@ func (r *DashboardTreeRunImpl) GetResource() modconfig.DashboardLeafNode { return r.resource } -// TODO [node_reuse] do this a different way -// maybe move to a different embedded struct - ExecutableRun, to differentiate between Base runs - // SetError implements DashboardTreeRun func (r *DashboardTreeRunImpl) SetError(ctx context.Context, err error) { log.Printf("[TRACE] %s SetError err %v", r.Name, err) @@ -156,15 +152,12 @@ func (r *DashboardTreeRunImpl) SetComplete(context.Context) { func (r *DashboardTreeRunImpl) setStatus(status dashboardtypes.DashboardRunStatus) { r.Status = status - // do not send events for runtime dependency execution (i.e. when we are executing base resources - // for their runtime dependencies) - if !r.executeConfig.RuntimeDependenciesOnly { - // raise LeafNodeUpdated event - // TODO [node_reuse] tidy this up - // TACTICAL: pass the full run struct - 'r.run', rather than ourselves - so we serialize all properties - e, _ := dashboardevents.NewLeafNodeUpdate(r.run, r.executionTree.sessionId, r.executionTree.id) - r.executionTree.workspace.PublishDashboardEvent(e) - } + // raise LeafNodeUpdated event + // TODO [node_reuse] do this a different way https://github.com/turbot/steampipe/issues/2919 + // TACTICAL: pass the full run struct - 'r.run', rather than ourselves - so we serialize all properties + e, _ := dashboardevents.NewLeafNodeUpdate(r.run, r.executionTree.sessionId, r.executionTree.id) + r.executionTree.workspace.PublishDashboardEvent(e) + } func (r *DashboardTreeRunImpl) notifyParentOfCompletion() { diff --git a/pkg/dashboard/dashboardexecute/leaf_run.go b/pkg/dashboard/dashboardexecute/leaf_run.go index 219e3518a..5dc499515 100644 --- a/pkg/dashboard/dashboardexecute/leaf_run.go +++ b/pkg/dashboard/dashboardexecute/leaf_run.go @@ -133,7 +133,7 @@ func (r *LeafRun) Execute(ctx context.Context) { // if we have sql to execute, do it now // (if we are only performing a base execution, do not run the query) - if r.executeSQL != "" && !r.executeConfig.BaseExecution { + if r.executeSQL != "" { if err := r.executeQuery(ctx); err != nil { r.SetError(ctx, err) return diff --git a/pkg/dashboard/dashboardtypes/dashboard_tree_run.go b/pkg/dashboard/dashboardtypes/dashboard_tree_run.go index 4d17405c4..96d334e73 100644 --- a/pkg/dashboard/dashboardtypes/dashboard_tree_run.go +++ b/pkg/dashboard/dashboardtypes/dashboard_tree_run.go @@ -22,8 +22,3 @@ type DashboardTreeRun interface { AsTreeNode() *SnapshotTreeNode GetResource() modconfig.DashboardLeafNode } - -type TreeRunExecuteConfig struct { - RuntimeDependenciesOnly bool - BaseExecution bool -} diff --git a/pkg/steampipeconfig/modconfig/dashboard.go b/pkg/steampipeconfig/modconfig/dashboard.go index bf61af948..f4e96598d 100644 --- a/pkg/steampipeconfig/modconfig/dashboard.go +++ b/pkg/steampipeconfig/modconfig/dashboard.go @@ -263,9 +263,9 @@ func (d *Dashboard) ValidateRuntimeDependencies(workspace ResourceMapsProvider) } func (d *Dashboard) validateRuntimeDependenciesForResource(resource HclResource, workspace ResourceMapsProvider) error { + // TODO [node_reuse] re-add parse time validation https://github.com/turbot/steampipe/issues/2925 return nil //rdp := resource.(RuntimeDependencyProvider) - // TODO [node_reuse] validate param and args runtime deps //// WHAT ABOUT CHILDREN //if len(runtimeDependencies) == 0 { // return nil diff --git a/pkg/steampipeconfig/modconfig/dashboard_flow.go b/pkg/steampipeconfig/modconfig/dashboard_flow.go index c313f310b..0784ca8eb 100644 --- a/pkg/steampipeconfig/modconfig/dashboard_flow.go +++ b/pkg/steampipeconfig/modconfig/dashboard_flow.go @@ -82,7 +82,7 @@ func (f *DashboardFlow) GetReferences() []*ResourceReference { return f.References } -// TODO [node_reuse] PUT IN 1 PLACE FOR ALL EDGE PROVIDERS +// TODO [node_reuse] Add DashboardLeafNodeImpl and move this there https://github.com/turbot/steampipe/issues/2926 // GetChildren implements ModTreeItem func (f *DashboardFlow) GetChildren() []ModTreeItem { // return nodes and edges (if any) diff --git a/pkg/steampipeconfig/modconfig/dashboard_graph.go b/pkg/steampipeconfig/modconfig/dashboard_graph.go index 3fc6dc55d..ce96d3041 100644 --- a/pkg/steampipeconfig/modconfig/dashboard_graph.go +++ b/pkg/steampipeconfig/modconfig/dashboard_graph.go @@ -84,7 +84,8 @@ func (g *DashboardGraph) GetReferences() []*ResourceReference { return g.References } -// TODO [node_reuse] PUT IN 1 PLACE FOR ALL EDGE PROVIDERS +// TODO [node_reuse] Add DashboardLeafNodeImpl and move this there https://github.com/turbot/steampipe/issues/2926 + // GetChildren implements ModTreeItem func (g *DashboardGraph) GetChildren() []ModTreeItem { // return nodes and edges (if any) diff --git a/pkg/steampipeconfig/modconfig/dashboard_hierarchy.go b/pkg/steampipeconfig/modconfig/dashboard_hierarchy.go index 645e38c2b..8b80f6328 100644 --- a/pkg/steampipeconfig/modconfig/dashboard_hierarchy.go +++ b/pkg/steampipeconfig/modconfig/dashboard_hierarchy.go @@ -84,7 +84,8 @@ func (h *DashboardHierarchy) GetReferences() []*ResourceReference { return h.References } -// TODO [node_reuse] PUT IN 1 PLACE FOR ALL EDGE PROVIDERS +// TODO [node_reuse] Add DashboardLeafNodeImpl and move this there https://github.com/turbot/steampipe/issues/2926 + // GetChildren implements ModTreeItem func (h *DashboardHierarchy) GetChildren() []ModTreeItem { // return nodes and edges (if any) diff --git a/pkg/steampipeconfig/modconfig/interfaces.go b/pkg/steampipeconfig/modconfig/interfaces.go index 0d61eaf7f..d1f20c4e8 100644 --- a/pkg/steampipeconfig/modconfig/interfaces.go +++ b/pkg/steampipeconfig/modconfig/interfaces.go @@ -107,7 +107,7 @@ type ResourceMapsProvider interface { // NodeAndEdgeProvider must be implemented by any dashboard leaf node which supports edges and nodes // (DashboardGraph, DashboardFlow, DashboardHierarchy) -// TODO [node_reuse] add NodeAndEdgeProviderImpl +// TODO [node_reuse] add NodeAndEdgeProviderImpl https://github.com/turbot/steampipe/issues/2918 type NodeAndEdgeProvider interface { QueryProvider GetEdges() DashboardEdgeList diff --git a/pkg/steampipeconfig/modconfig/runtime_dependency.go b/pkg/steampipeconfig/modconfig/runtime_dependency.go index 71da13117..c365f417e 100644 --- a/pkg/steampipeconfig/modconfig/runtime_dependency.go +++ b/pkg/steampipeconfig/modconfig/runtime_dependency.go @@ -33,9 +33,9 @@ func (d *RuntimeDependency) String() string { } func (d *RuntimeDependency) ValidateSource(dashboard *Dashboard, workspace ResourceMapsProvider) error { + // TODO [node_reuse] re-add parse time validation https://github.com/turbot/steampipe/issues/2925 //resourceName := d.PropertyPath.ToResourceName() - var found bool - // TODO [node_reuse] validate source resource in resource tree + //var found bool ////var sourceResource HclResource //switch d.PropertyPath.ItemType { //// if this is a 'with' resolve from the parent resource @@ -51,9 +51,9 @@ func (d *RuntimeDependency) ValidateSource(dashboard *Dashboard, workspace Resou // // // otherwise, resolve from the global inputs // // _, found = workspace.GetResourceMaps().GlobalDashboardInputs[resourceName] //} - if !found { - return fmt.Errorf("could not resolve runtime dependency resource %s", d.PropertyPath) - } + //if !found { + // return fmt.Errorf("could not resolve runtime dependency resource %s", d.PropertyPath) + //} return nil } diff --git a/pkg/steampipeconfig/parse/decode.go b/pkg/steampipeconfig/parse/decode.go index f3dd82200..db0938267 100644 --- a/pkg/steampipeconfig/parse/decode.go +++ b/pkg/steampipeconfig/parse/decode.go @@ -288,7 +288,7 @@ func decodeVariable(block *hcl.Block, parseCtx *ModParseContext) (*modconfig.Var func decodeQueryProvider(block *hcl.Block, parseCtx *ModParseContext) (modconfig.QueryProvider, *decodeResult) { res := newDecodeResult() - // TODO [node_reuse] need raise errors for invalid properties + // TODO [node_reuse] need raise errors for invalid properties https://github.com/turbot/steampipe/issues/2923 // get shell resource resource, diags := resourceForBlock(block, parseCtx) @@ -367,7 +367,7 @@ func decodeQueryProviderBlocks(block *hcl.Block, content *hclsyntax.Body, resour func decodeNodeAndEdgeProvider(block *hcl.Block, parseCtx *ModParseContext) (modconfig.HclResource, *decodeResult) { res := newDecodeResult() - // TODO [node_reuse] need raise errors for invalid properties - update validateHcl to include attributes + // TODO [node_reuse] need raise errors for invalid properties https://github.com/turbot/steampipe/issues/2923 // get shell resource resource, diags := resourceForBlock(block, parseCtx) diff --git a/pkg/steampipeconfig/parse/mod_parse_context.go b/pkg/steampipeconfig/parse/mod_parse_context.go index 5e5bfdd18..c27d45593 100644 --- a/pkg/steampipeconfig/parse/mod_parse_context.go +++ b/pkg/steampipeconfig/parse/mod_parse_context.go @@ -329,7 +329,7 @@ func (r *ModParseContext) getResourceCtyValue(resource modconfig.HclResource) (c if ctyValue.Type().FriendlyName() != "object" { return ctyValue, nil } - // TODO [node_reuse] fetch nested structs and serialise automatically + // TODO [node_reuse] fetch nested structs and serialise automatically https://github.com/turbot/steampipe/issues/2924 valueMap := ctyValue.AsValueMap() if valueMap == nil { valueMap = make(map[string]cty.Value) diff --git a/pkg/steampipeconfig/parse/schema.go b/pkg/steampipeconfig/parse/schema.go index daed42879..2232d4784 100644 --- a/pkg/steampipeconfig/parse/schema.go +++ b/pkg/steampipeconfig/parse/schema.go @@ -5,8 +5,7 @@ import ( "github.com/turbot/steampipe/pkg/steampipeconfig/modconfig" ) -// TODO [node_reuse] Replace everything with consts -// TODO [node_reuse] add all attributes into validation-only-schemas +// TODO [node_reuse] Replace all block type with consts https://github.com/turbot/steampipe/issues/2922 var ConfigBlockSchema = &hcl.BodySchema{ Attributes: []hcl.AttributeSchema{}, @@ -165,7 +164,6 @@ var RequireModBlockSchema = &hcl.BodySchema{ } // DashboardBlockSchema is only used to validate the blocks of a Dashboard -// TODO [node_reuse] add all atttributes and validate these as well var DashboardBlockSchema = &hcl.BodySchema{ Blocks: []hcl.BlockHeaderSchema{ { @@ -216,7 +214,6 @@ var DashboardBlockSchema = &hcl.BodySchema{ } // DashboardContainerBlockSchema is only used to validate the blocks of a DashboardContainer -// TODO [node_reuse] add all atttributes and validate these as well var DashboardContainerBlockSchema = &hcl.BodySchema{ Blocks: []hcl.BlockHeaderSchema{ { diff --git a/pkg/steampipeconfig/parse/validate.go b/pkg/steampipeconfig/parse/validate.go index 966b5cae8..c92dfaa55 100644 --- a/pkg/steampipeconfig/parse/validate.go +++ b/pkg/steampipeconfig/parse/validate.go @@ -41,6 +41,7 @@ func validateRuntimeDependencyProvider(resource modconfig.RuntimeDependencyProvi // enrich the loaded nodes and edges with the fully parsed resources from the resourceMapProvider func validateNodeAndEdgeProvider(resource modconfig.NodeAndEdgeProvider) hcl.Diagnostics { // TODO [node_reuse] add NodeAndEdgeProviderImpl and move validate there + // https://github.com/turbot/steampipe/issues/2918 var diags hcl.Diagnostics containsEdgesOrNodes := len(resource.GetEdges())+len(resource.GetNodes()) > 0