Skip to content

Frontend Workspace Resources Card #1031

Closed

Description

@presleyp

Screen Shot 2022-04-28 at 3 18 12 PM

  • read resources from api
  • decide how to handle nesting of agents in resources and ports in agents - subrows? Just rich cells?
  • build resources table component with columns for Resource, Lifetime, Status, and Access. (Lifetime (persistent or ephemerial) is in the Status column in the image but will be separated out)
  • nest agents in resources and ports in agents
  • design Access cell to always have Open in Terminal, and always have Any Port button where you can open any port on that agent. Also have any dev urls/applications that are assigned to that agent and a specific port. However, building Open in Terminal links and DevURL/application links are taken care of in other tickets.
  • Consider having Any Port show which ports are already assigned.
  • hook up all access buttons
  • storybook
  • test

Handled in other tickets:

  • Access Column: 760 and 805
  • Lifecycle Column: TBD

Activity

  1. added this to the V2 Beta milestone on Apr 15, 2022
  2. changed the title [-]Resources Card[/-] [+]Frontend Workspace Resources Card[/+] on Apr 15, 2022
  3. misskniss commented on Apr 26, 2022

    @misskniss

    There is a meeting on the calendar to discuss this one for details.

  4. misskniss commented on Apr 26, 2022

    @misskniss
  5. presleyp commented on Apr 28, 2022

    @presleyp
    ContributorAuthor

    table of resources with ability to open each in web terminal

    Button on each row called Open In Terminal

  6. presleyp commented on Apr 28, 2022

    @presleyp
    ContributorAuthor

    persistent/ephemeral is a different type of data than connection status. can call that column Lifetime?

  7. presleyp commented on Apr 28, 2022

    @presleyp
    ContributorAuthor

    subrows: could make it monospace and use the ascii elbow

  8. presleyp commented on Apr 28, 2022

    @presleyp
    ContributorAuthor

    Open Port button - opens dropdown where you type port number

    DevURLs are predefined port allocations (and use a certain resource)

    But resources can be opened in any port. If you open dev in the port VSCode is assigned to, you see VSCode.

  9. presleyp commented on Apr 28, 2022

    @presleyp
    ContributorAuthor

    Look into nesting dev urls/applications in resources card
    Resource - Agent - Ports (some are apps, can also open any port)

  10. presleyp commented on Apr 28, 2022

    @presleyp
    ContributorAuthor

    make agent connection status optional so we can reuse this component for a preview

  11. 8 remaining items

  12. greyscaled commented on May 11, 2022

    @greyscaled
    Contributor

    Breakout session notes

    coder/cli/show.go

    Lines 11 to 39 in 982769f

    func show() *cobra.Command {
    return &cobra.Command{
    Annotations: workspaceCommand,
    Use: "show",
    Short: "Show details of a workspace's resources and agents",
    Args: cobra.ExactArgs(1),
    RunE: func(cmd *cobra.Command, args []string) error {
    client, err := createClient(cmd)
    if err != nil {
    return err
    }
    organization, err := currentOrganization(cmd, client)
    if err != nil {
    return err
    }
    workspace, err := client.WorkspaceByOwnerAndName(cmd.Context(), organization.ID, codersdk.Me, args[0])
    if err != nil {
    return xerrors.Errorf("get workspace: %w", err)
    }
    resources, err := client.WorkspaceResourcesByBuild(cmd.Context(), workspace.LatestBuild.ID)
    if err != nil {
    return xerrors.Errorf("get workspace resources: %w", err)
    }
    return cliui.WorkspaceResources(cmd.OutOrStdout(), resources, cliui.WorkspaceResourcesOptions{
    WorkspaceName: workspace.Name,
    })
    },
    }
    }

    func (c *Client) WorkspaceResourcesByBuild(ctx context.Context, build uuid.UUID) ([]WorkspaceResource, error) {
    res, err := c.request(ctx, http.MethodGet, fmt.Sprintf("/api/v2/workspacebuilds/%s/resources", build), nil)
    if err != nil {
    return nil, err
    }
    defer res.Body.Close()
    if res.StatusCode != http.StatusOK {
    return nil, readBodyAsError(res)
    }
    var resources []WorkspaceResource
    return resources, json.NewDecoder(res.Body).Decode(&resources)
    }

    The API:

    /api/v2/workspacebuilds/%s/resources
    

    type WorkspaceResource struct {
    ID uuid.UUID `json:"id"`
    CreatedAt time.Time `json:"created_at"`
    JobID uuid.UUID `json:"job_id"`
    Transition database.WorkspaceTransition `json:"workspace_transition"`
    Type string `json:"type"`
    Name string `json:"name"`
    Agents []WorkspaceAgent `json:"agents,omitempty"`
    }

    Dev URLs will be added to this later (same endpoint).

    Desired (follow-up): open resource in terminal. We need to create another ticket for that.

    Step 1

    Present the data similarly to the CLI in a table.

    Step 2

    We're going to clean up the UI (TBD)

    Step 3

    Dev URLs


    Job associated to WorkspaceResource (job created resource)

    Workspace and WorkspaceResource do not have a relationship (job creates the resource)
    Type can be presented verbatim
    Name can be presented verbatim
    Agents - Running process attached to resource. (example coder agent running within v2 while dogfooding).


    Request --> We can safely poll without 4xx or 5xx, because the data is static (not actually touching the workspace itself). The FE can remain open and continue to poll.

  13. presleyp commented on May 12, 2022

    @presleyp
    ContributorAuthor

    "Desired (follow-up): open resource in terminal. We need to create another ticket for that." @code-asher isn't this essentially #760? It's just that instead of having one terminal link like in v1 there's one per workspace agent as shown here.

  14. presleyp commented on May 12, 2022

    @presleyp
    ContributorAuthor

    And adding Dev URLs is #805

  15. code-asher commented on May 12, 2022

    @code-asher
    Member

    "Desired (follow-up): open resource in terminal. We need to create another ticket for that." @code-asher isn't this essentially #760? It's just that instead of having one terminal link like in v1 there's one per workspace agent as shown here.

    Yup I think #760 is perfect for this

  16. greyscaled commented on May 16, 2022

    @greyscaled
    Contributor

    Dev URLs will be added to this later (same endpoint).

    We're currently blocked on this (@deansheather 's working on something)

  17. presleyp commented on May 17, 2022

    @presleyp
    ContributorAuthor

    lifecycle is computed on the frontend - we get what resources exist in Stop and what exist in Start, and those that exist in Start but not Stop, they're ephemeral (gets destroyed on Stop). query the template version for its resources. can't query workspace build bc it only shows for the state it's currently in. will get a flat array where each item is a resource with a workspace transition, so need to look for the resource by its name and type and see if the array has one with stop and one with start. prob a nice to have.

  18. presleyp commented on May 17, 2022

    @presleyp
    ContributorAuthor

    Agents will have an array of Apps soon, and status. WorkspaceApp will have external URL and I just need to render name, icon, and a link to that url.

  19. presleyp commented on May 18, 2022

    @presleyp
    ContributorAuthor

    I'm going to take out Lifecycle and Access for this ticket but here's where I envision them:

    Screen Shot 2022-05-17 at 10 08 27 PM

  20. tjcran commented on May 20, 2022

    @tjcran

    I'm going to take out Lifecycle and Access for this ticket but here's where I envision them:

    Screen Shot 2022-05-17 at 10 08 27 PM

    @BrunoQuaresma this is an example of what would go above the timeline in #1620

  21. BrunoQuaresma commented on May 20, 2022

    @BrunoQuaresma
    Contributor

    Ok. How are we going to add DEV URLs and apps inside of this?

  22. BrunoQuaresma commented on May 20, 2022

    @BrunoQuaresma
    Contributor

    What do you think about removing the Coming soon fields to not look "incomplete"?

  23. presleyp commented on May 20, 2022

    @presleyp
    ContributorAuthor

    @BrunoQuaresma that's what I meant by "I'm going to take out Lifecycle and Access" - I just put them in for the screenshot so we could all be on the same page about how it will look eventually. DevURLs and apps will go in the Access column.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

siteArea: frontend dashboard

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions