mirror of
https://github.com/coder/coder.git
synced 2026-06-02 20:48:20 +00:00
feat: improve usability of coder show (#21539)
This PR improves the usability of `coder show`: - Adds a header with workspace owner/name, latest build status and time since, and template name / version name. - Updates `namedWorkspace` to allow looking up by UUID - Also improves associated `TestShow` to respect context deadlines.
This commit is contained in:
+3
-2
@@ -1,8 +1,10 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sort"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"golang.org/x/xerrors"
|
||||
@@ -43,11 +45,11 @@ func (r *RootCmd) show() *serpent.Command {
|
||||
if err != nil {
|
||||
return xerrors.Errorf("get workspace: %w", err)
|
||||
}
|
||||
|
||||
options := cliui.WorkspaceResourcesOptions{
|
||||
WorkspaceName: workspace.Name,
|
||||
ServerVersion: buildInfo.Version,
|
||||
ShowDetails: details,
|
||||
Title: fmt.Sprintf("%s/%s (%s since %s) %s:%s", workspace.OwnerName, workspace.Name, workspace.LatestBuild.Status, time.Since(workspace.LatestBuild.CreatedAt).Round(time.Second).String(), workspace.TemplateName, workspace.LatestBuild.TemplateVersionName),
|
||||
}
|
||||
if workspace.LatestBuild.Status == codersdk.WorkspaceStatusRunning {
|
||||
// Get listening ports for each agent.
|
||||
@@ -55,7 +57,6 @@ func (r *RootCmd) show() *serpent.Command {
|
||||
options.ListeningPorts = ports
|
||||
options.Devcontainers = devcontainers
|
||||
}
|
||||
|
||||
return cliui.WorkspaceResources(inv.Stdout, workspace.LatestBuild.Resources, options)
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user