Skip to content

Commit f962630

Browse files
feat: log workspace name immediately and add spinner for targets collection (#1439)
# Log workspace name immediately and add spinner for targets collection ## Changes - Log workspace name as soon as it comes back from the API for faster user feedback - Use `interactivity.StartSpinner` while collecting targets data to provide visual feedback during the operation ## Testing - Changes have been verified to build correctly Link to Devin run: https://app.devin.ai/sessions/8c7be7b118e9458d8446ddd088743374 Requested by: David Adler ([email protected]) --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: David Adler <[email protected]>
1 parent 6398816 commit f962630

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

cmd/status.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818

1919
"github.com/speakeasy-api/speakeasy/internal/charm/styles"
2020
"github.com/speakeasy-api/speakeasy/internal/config"
21+
"github.com/speakeasy-api/speakeasy/internal/interactivity"
2122
"github.com/speakeasy-api/speakeasy/internal/links"
2223
"github.com/speakeasy-api/speakeasy/internal/log"
2324
"github.com/speakeasy-api/speakeasy/internal/model"
@@ -100,6 +101,8 @@ func newStatusModel(ctx context.Context, client *speakeasyclientsdkgo.Speakeasy)
100101
return result, fmt.Errorf("unexpected missing workspace response")
101102
}
102103

104+
log.From(ctx).Printf("Workspace: %s", wsRes.Workspace.Name)
105+
103106
orgReq := operations.GetOrganizationRequest{
104107
OrganizationID: wsRes.Workspace.OrganizationID,
105108
}
@@ -217,20 +220,26 @@ func newStatusWorkspaceModel(ctx context.Context, client *speakeasyclientsdkgo.S
217220
slug: workspace.Slug,
218221
}
219222

223+
stopSpinner := interactivity.StartSpinner("Querying for active SDKs and other targets...")
224+
220225
wsTargetsreq := operations.GetWorkspaceTargetsRequest{}
221226

222227
wsTargetsRes, err := client.Events.GetTargets(ctx, wsTargetsreq)
223228

224229
if err != nil {
230+
stopSpinner()
225231
return result, fmt.Errorf("error getting Speakeasy workspace targets: %w", err)
226232
}
227233

228234
if wsTargetsRes.StatusCode != 200 {
235+
stopSpinner()
229236
return result, fmt.Errorf("unexpected status code getting Speakeasy workspace targets: %d", wsTargetsRes.StatusCode)
230237
}
231238

232239
targets, err := newStatusWorkspaceTargetsModel(ctx, client, org, result, wsTargetsRes.TargetSDKList)
233240

241+
stopSpinner()
242+
234243
if err != nil {
235244
return result, err
236245
}

0 commit comments

Comments
 (0)