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

Commite13657f

Browse files
committed
fixup! cli: Update UXState from config-ssh
1 parenta727c6b commite13657f

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

‎coder-sdk/users.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,6 @@ 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-
5749
// UserByID get the details of a user by their id.
5850
func (cClient)UserByID(ctx context.Context,idstring) (*User,error) {
5951
varuUser
@@ -122,6 +114,14 @@ func (c Client) UpdateUser(ctx context.Context, userID string, req UpdateUserReq
122114
returnc.requestBody(ctx,http.MethodPatch,"/api/private/users/"+userID,req,nil)
123115
}
124116

117+
// UpdateUXState updates the authenticated user's UX State.
118+
func (cClient)UpdateUXState(ctx context.Context,userIDstring,uxsPartialmap[string]interface{})error {
119+
iferr:=c.requestBody(ctx,http.MethodPut,"/api/private/users/"+userID+"/ux-state",uxsPartial,nil);err!=nil {
120+
returnerr
121+
}
122+
returnnil
123+
}
124+
125125
// CreateUserReq defines the request parameters for creating a new user resource.
126126
typeCreateUserReqstruct {
127127
Namestring`json:"name"`

‎internal/cmd/configssh.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package cmd
22

33
import (
4+
"cdr.dev/coder-cli/pkg/clog"
45
"context"
56
"fmt"
67
"io/ioutil"
@@ -135,7 +136,7 @@ func configSSH(configpath *string, remove *bool) func(cmd *cobra.Command, _ []st
135136
fmt.Printf("Your private ssh key was written to\"%s\"\n",privateKeyFilepath)
136137
}
137138

138-
writeSSHUXState(ctx,client)
139+
writeSSHUXState(ctx,client,user.ID)
139140
fmt.Printf("An auto-generated ssh config was written to\"%s\"\n",*configpath)
140141
fmt.Println("You should now be able to ssh into your environment")
141142
fmt.Printf("For example, try running\n\n\t$ ssh coder.%s\n\n",envs[0].Name)
@@ -217,11 +218,11 @@ func readStr(filename string) (string, error) {
217218
returnstring(contents),nil
218219
}
219220

220-
funcwriteSSHUXState(ctx context.Context,client*coder.Client) {
221+
funcwriteSSHUXState(ctx context.Context,client*coder.Client,userIDstring) {
221222
// Update UXState that coder config-ssh has been run by the currently
222223
// authenticated user
223-
err:=client.MyUXState(ctx,map[string]interface{}{"cliSSHConfigured":true})
224+
err:=client.UpdateUXState(ctx,userID,map[string]interface{}{"cliSSHConfigured":true})
224225
iferr!=nil {
225-
fmt.Println("⚠The Coder web client may not recognize that you've configured SSH.")
226+
clog.LogWarn("The Coder web client may not recognize that you've configured SSH.")
226227
}
227228
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp