mirror of
https://github.com/turbot/steampipe.git
synced 2026-02-25 05:01:06 -05:00
36 lines
986 B
Go
36 lines
986 B
Go
package dashboardexecute
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/turbot/steampipe/control/controlhooks"
|
|
"github.com/turbot/steampipe/dashboard/dashboardevents"
|
|
)
|
|
|
|
// ControlEventHooks is a struct which implements ControlHooks, and displays the control progress as a status message
|
|
type ControlEventHooks struct {
|
|
CheckRun *CheckRun
|
|
}
|
|
|
|
func NewControlEventHooks(r *CheckRun) *ControlEventHooks {
|
|
return &ControlEventHooks{
|
|
CheckRun: r,
|
|
}
|
|
}
|
|
|
|
func (c *ControlEventHooks) OnStart(ctx context.Context, _ *controlhooks.ControlProgress) {
|
|
// nothing to do
|
|
}
|
|
|
|
func (c *ControlEventHooks) OnControlEvent(ctx context.Context, _ *controlhooks.ControlProgress) {
|
|
event := &dashboardevents.LeafNodeProgress{
|
|
LeafNode: c.CheckRun,
|
|
ExecutionId: c.CheckRun.executionTree.id,
|
|
}
|
|
c.CheckRun.executionTree.workspace.PublishDashboardEvent(event)
|
|
}
|
|
|
|
func (c *ControlEventHooks) OnDone(ctx context.Context, _ *controlhooks.ControlProgress) {
|
|
// nothing to do - LeadNodeDone will be sent anyway
|
|
}
|