MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / ShowModal

Method ShowModal

tsunami/engine/clientimpl.go:435–453  ·  view source on GitHub ↗

ShowModal displays a modal and returns a channel that will receive the result

(config rpctypes.ModalConfig)

Source from the content-addressed store, hash-verified

433
434// ShowModal displays a modal and returns a channel that will receive the result
435func (c *ClientImpl) ShowModal(config rpctypes.ModalConfig) chan bool {
436 resultChan := c.addModalToMap(config)
437
438 data, err := json.Marshal(config)
439 if err != nil {
440 log.Printf("failed to marshal modal config: %v", err)
441 c.CloseModal(config.ModalId, false)
442 return resultChan
443 }
444
445 err = c.SendSSEvent(ssEvent{Event: "showmodal", Data: data})
446 if err != nil {
447 log.Printf("failed to send modal SSE event: %v", err)
448 c.CloseModal(config.ModalId, false)
449 return resultChan
450 }
451
452 return resultChan
453}
454
455// removeModalFromMap removes a modal from the map and returns its state
456func (c *ClientImpl) removeModalFromMap(modalId string) *ModalState {

Callers 2

UseAlertModalFunction · 0.80
UseConfirmModalFunction · 0.80

Calls 3

addModalToMapMethod · 0.95
CloseModalMethod · 0.95
SendSSEventMethod · 0.95

Tested by

no test coverage detected