-
Notifications
You must be signed in to change notification settings - Fork 31
WIP: Support showing a message returned by GetAuthenticationModes #1181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,13 +42,20 @@ var ( | |
| Light: "#909090", | ||
| Dark: "#7f7f7f", | ||
| }).Padding(1, 0, 0, 2) | ||
|
|
||
| warningMsgStyle = lipgloss.NewStyle().Foreground(lipgloss.AdaptiveColor{ | ||
| // Use a light yellow/orange color for warnings. | ||
| Light: "#f0c674", | ||
| Dark: "#e6bf69", | ||
| }).Padding(1, 0, 0, 2) | ||
| ) | ||
|
|
||
| // sessionInfo contains the global broker session information. | ||
| type sessionInfo struct { | ||
| brokerID string | ||
| sessionID string | ||
| encryptionKey *rsa.PublicKey | ||
| brokerID string | ||
| sessionID string | ||
| encryptionKey *rsa.PublicKey | ||
| getAuthenticationModesMessage string | ||
| } | ||
|
|
||
| // uiModel is the global models orchestrator. | ||
|
|
@@ -281,6 +288,12 @@ func (m uiModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { | |
| } | ||
| return m, m.userSelectionModel.SelectUser() | ||
|
|
||
| case authModesReceived: | ||
| if msg.msg != "" { | ||
| safeMessageDebug(msg, "GetAuthenticationModes message: %q", msg.msg) | ||
| m.currentSession.getAuthenticationModesMessage = msg.msg | ||
| } | ||
|
|
||
| case UsernameSelected: | ||
| safeMessageDebug(msg, "user: %q", m.username()) | ||
| if m.username() == "" { | ||
|
|
@@ -447,6 +460,11 @@ func (m uiModel) View() string { | |
|
|
||
| view := viewBuilder.String() | ||
|
|
||
| if m.currentSession != nil && m.currentSession.getAuthenticationModesMessage != "" { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do not forget the native model (for ssh and friends) too :)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right. The GDM part is much more important though, without it it doesn't make sense to merge this IMO. If you get the GDM part done, I can implement the missing parts for the native model. |
||
| warningMessage := warningMsgStyle.Render(m.currentSession.getAuthenticationModesMessage) | ||
| view = lipgloss.JoinVertical(lipgloss.Left, view, warningMessage) | ||
| } | ||
|
|
||
| if len(view) > 0 && m.canGoBack() { | ||
| infoMessage := infoMsgStyle.Render(fmt.Sprintf("Press escape key to %s", | ||
| goBackLabel(m.previousStage()))) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's time to move
ptrValueoutside the_test.gocode?