coder icon indicating copy to clipboard operation
coder copied to clipboard

Show only running workspaces

Open ammario opened this issue 3 years ago • 1 comments

As the cloud budget holder and admin, I want to quickly find all running workspaces to see if any should be shut down.

Screen Shot 2022-08-23 at 11 43 28 PM

I naturally reach for a filter. image

ammario avatar Aug 24 '22 04:08 ammario

Some thoughts:

  • We can make it in the FE only
  • I think making this in the BE can be tricky since the status is not a "well computed" value, and we are doing that in the FE. To make this happen in the BE, we should refactor the BE to compute the status and after, use it to filter the workspaces. Not sure how this could happen with the DB.

BrunoQuaresma avatar Aug 29 '22 16:08 BrunoQuaresma

@f0ssel this is where we translate from api values to workspace status (and then there's another translation to the actual wording used in various places, so like the status started displays as Running) https://github.com/coder/coder/blob/main/site/src/util/workspace.ts#L55

If we move this logic (transition + job status -> workspace status, that is; we can handle display labels on the frontend) to the backend, then adding a filter for running workspaces will be simple on the frontend.

Alternatively, if there is some way for the frontend to send a query that the backend can already understand (like transition=start&status=succeeded or something), that's also okay for the frontend.

presleyp avatar Sep 21 '22 20:09 presleyp

Sounds good, I'll see what looks easier, will probably ping @coadler for some heavy lifting on the DB side.

f0ssel avatar Sep 21 '22 21:09 f0ssel

Some thoughts:

  • We can make it in the FE only
  • I think making this in the BE can be tricky since the status is not a "well computed" value, and we are doing that in the FE. To make this happen in the BE, we should refactor the BE to compute the status and after, use it to filter the workspaces. Not sure how this could happen with the DB.

I think we need to approach these search and filtering features as backend ones, as they're most relevant to larger deployments where our current one-page solution presents poorly.

ammario avatar Sep 22 '22 17:09 ammario