Skip to content

Conversation

@eharris128
Copy link
Contributor

What

  • Initial commit removed the the data channel from the image command's handler.go and added a Data method to execution context.
    • This approach can likely be deprecated now in favor of the approach taken for passing data to the debug tui via an internal channel on execution context
  • Move the debug tui to be a sibling file to handler.go
  • Add tui hotkeys to support interaction with the debug tui
  • Add an internal channel on execution context to feed data from .Info to a provided dataChannel via an internalDataCh [note - channel naming should be consistent]
    • When the OutputFormat for execution context is specified as "subscription" - then the channels are used to pipe data. This is only implemented for .Info at the moment for this Proof of Concept.

Why

  • Demonstrate PoC of using an internal channel inside of execution context
  • Begin to support a tui mode for debug

Questions

  • The approach to support debug --tui effectively drops all other provided flags on the floor. This could be a poor UX.
    • Will the pattern be to encourage people to only use the --tui flag as a standalone flag, then perform interactions inside of the interface?
    • Or will debug --tui --runtime=k8s --target=my-nginx be a desired entrypoint to support? DevX wise - for ease of using the last invoked command without writing out things by hand in a TUI, supporting flags alongside --tui feels relevant.

How Tested

mint debug --tui
mint images --tui
mint tui -> d

Signed-off-by: Evan Harris <echarris@smcm.edu>
Signed-off-by: Evan Harris <echarris@smcm.edu>
Signed-off-by: Evan Harris <echarris@smcm.edu>
Signed-off-by: Evan Harris <echarris@smcm.edu>
Signed-off-by: Evan Harris <echarris@smcm.edu>
Signed-off-by: Evan Harris <echarris@smcm.edu>
Signed-off-by: Evan Harris <echarris@smcm.edu>
Signed-off-by: Evan Harris <echarris@smcm.edu>
Signed-off-by: Evan Harris <echarris@smcm.edu>
Signed-off-by: Evan Harris <echarris@smcm.edu>
Signed-off-by: Evan Harris <echarris@smcm.edu>
Signed-off-by: Evan Harris <echarris@smcm.edu>
Signed-off-by: Evan Harris <echarris@smcm.edu>
Signed-off-by: Evan Harris <echarris@smcm.edu>
func (ref *Output) Data(channelKey string, data interface{}) {
if ch, exists := ref.DataChannels[channelKey]; exists {
ch <- data // Send data to the corresponding channel
fmt.Printf("Data sent to channel '%s': %v\n", channelKey, data)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's use logrus log instead of fmt.Printf

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted. Will update / remove.

ch <- data // Send data to the corresponding channel
fmt.Printf("Data sent to channel '%s': %v\n", channelKey, data)
} else {
fmt.Printf("Channel for channelKey '%s' not found\n", channelKey)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's use logrus log instead of fmt.Printf

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted. Will update / remove.

@kcq kcq merged commit bcb4e34 into mintoolkit:master Oct 28, 2024
3 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants