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

feat: add sharing info to /workspaces endpoint#21049

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
geokat wants to merge11 commits intomain
base:main
Choose a base branch
Loading
fromgeokat/internal-858-sharing-info-in-workspaces-response
Open
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletionscoderd/aitasks.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -469,15 +469,27 @@ func (api *API) convertTasks(ctx context.Context, requesterID uuid.UUID, dbTasks
returnnil,xerrors.Errorf("fetch workspaces: %w",err)
}

workspaces:=database.ConvertWorkspaceRows(workspaceRows)
workspaces,err:=database.ConvertWorkspaceRows(workspaceRows)
iferr!=nil {
returnnil,xerrors.Errorf("convert workspace rows: %w",err)
}

// Gather associated data and convert to API workspaces.
data,err:=api.workspaceData(ctx,workspaces)
iferr!=nil {
returnnil,xerrors.Errorf("fetch workspace data: %w",err)
}

apiWorkspaces,err:=convertWorkspaces(requesterID,workspaces,data)
apiWorkspaces,err:=convertWorkspaces(
ctx,
api.Experiments,
api.Logger,
requesterID,
workspaces,
data,
nil,
nil,
)
iferr!=nil {
returnnil,xerrors.Errorf("convert workspaces: %w",err)
}
Expand DownExpand Up@@ -551,12 +563,17 @@ func (api *API) taskGet(rw http.ResponseWriter, r *http.Request) {
}

ws,err:=convertWorkspace(
ctx,
api.Experiments,
api.Logger,
apiKey.UserID,
workspace,
data.builds[0],
data.templates[0],
api.Options.AllowWorkspaceRenames,
appStatus,
nil,
nil,
)
iferr!=nil {
httpapi.Write(ctx,rw,http.StatusInternalServerError, codersdk.Response{
Expand Down
50 changes: 50 additions & 0 deletionscoderd/apidoc/docs.go
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

44 changes: 44 additions & 0 deletionscoderd/apidoc/swagger.json
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

11 changes: 9 additions & 2 deletionscoderd/database/modelmethods.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -651,7 +651,7 @@ func ConvertUserRows(rows []GetUsersRow) []User {
returnusers
}

funcConvertWorkspaceRows(rows []GetWorkspacesRow) []Workspace {
funcConvertWorkspaceRows(rows []GetWorkspacesRow)([]Workspace,error) {
workspaces:=make([]Workspace,len(rows))
fori,r:=rangerows {
workspaces[i]=Workspace{
Expand DownExpand Up@@ -683,9 +683,16 @@ func ConvertWorkspaceRows(rows []GetWorkspacesRow) []Workspace {
NextStartAt:r.NextStartAt,
TaskID:r.TaskID,
}

iferr:=workspaces[i].UserACL.Scan(r.UserACL);err!=nil {
returnnil,xerrors.Errorf("scan user ACL %q: %w",r.UserACL,err)
}
iferr:=workspaces[i].GroupACL.Scan(r.GroupACL);err!=nil {
returnnil,xerrors.Errorf("scan group ACL %q: %w",r.GroupACL,err)
}
}

returnworkspaces
returnworkspaces,nil
}

func (gGroup)IsEveryone()bool {
Expand Down
14 changes: 8 additions & 6 deletionscoderd/database/types.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -67,9 +67,10 @@ func (t *TemplateACL) Scan(src interface{}) error {
switchv:=src.(type) {
casestring:
returnjson.Unmarshal([]byte(v),&t)
case []byte, json.RawMessage:
//nolint
returnjson.Unmarshal(v.([]byte),&t)
case []byte:
returnjson.Unmarshal(v,&t)
case json.RawMessage:
returnjson.Unmarshal(v,&t)
}

returnxerrors.Errorf("unexpected type %T",src)
Expand All@@ -85,9 +86,10 @@ func (t *WorkspaceACL) Scan(src interface{}) error {
switchv:=src.(type) {
casestring:
returnjson.Unmarshal([]byte(v),&t)
case []byte, json.RawMessage:
//nolint
returnjson.Unmarshal(v.([]byte),&t)
case []byte:
returnjson.Unmarshal(v,&t)
case json.RawMessage:
returnjson.Unmarshal(v,&t)
}

returnxerrors.Errorf("unexpected type %T",src)
Expand Down
5 changes: 4 additions & 1 deletioncoderd/telemetry/telemetry.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -521,7 +521,10 @@ func (r *remoteReporter) createSnapshot() (*Snapshot, error) {
iferr!=nil {
returnxerrors.Errorf("get workspaces: %w",err)
}
workspaces:=database.ConvertWorkspaceRows(workspaceRows)
workspaces,err:=database.ConvertWorkspaceRows(workspaceRows)
iferr!=nil {
returnxerrors.Errorf("convert workspace rows: %w",err)
}
snapshot.Workspaces=make([]Workspace,0,len(workspaces))
for_,dbWorkspace:=rangeworkspaces {
snapshot.Workspaces=append(snapshot.Workspaces,ConvertWorkspace(dbWorkspace))
Expand Down
Loading
Loading

[8]ページ先頭

©2009-2025 Movatter.jp