Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 30, 2024. It is now read-only.
/coder-v1-cliPublic archive

Commita727c6b

Browse files
committed
cli: Update UXState from config-ssh
Context:In optimizing the dashboard environment experiences, tracking whether auser has run config-ssh locally enables personalized education about thefeature.
1 parent0e6ae81 commita727c6b

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

‎coder-sdk/users.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@ func (c Client) Me(ctx context.Context) (*User, error) {
4646
returnc.UserByID(ctx,Me)
4747
}
4848

49+
// MyUXState updates the authenticated user's UX State.
50+
func (cClient)MyUXState(ctx context.Context,uxsPartialmap[string]interface{})error {
51+
iferr:=c.requestBody(ctx,http.MethodPut,"/api/private/users/me/ux-state",uxsPartial,nil);err!=nil {
52+
returnerr
53+
}
54+
returnnil
55+
}
56+
4957
// UserByID get the details of a user by their id.
5058
func (cClient)UserByID(ctx context.Context,idstring) (*User,error) {
5159
varuUser

‎internal/cmd/configssh.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ func configSSH(configpath *string, remove *bool) func(cmd *cobra.Command, _ []st
135135
fmt.Printf("Your private ssh key was written to\"%s\"\n",privateKeyFilepath)
136136
}
137137

138+
writeSSHUXState(ctx,client)
138139
fmt.Printf("An auto-generated ssh config was written to\"%s\"\n",*configpath)
139140
fmt.Println("You should now be able to ssh into your environment")
140141
fmt.Printf("For example, try running\n\n\t$ ssh coder.%s\n\n",envs[0].Name)
@@ -215,3 +216,12 @@ func readStr(filename string) (string, error) {
215216
}
216217
returnstring(contents),nil
217218
}
219+
220+
funcwriteSSHUXState(ctx context.Context,client*coder.Client) {
221+
// Update UXState that coder config-ssh has been run by the currently
222+
// authenticated user
223+
err:=client.MyUXState(ctx,map[string]interface{}{"cliSSHConfigured":true})
224+
iferr!=nil {
225+
fmt.Println("⚠ The Coder web client may not recognize that you've configured SSH.")
226+
}
227+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp