Thanks to visit codestin.com
Credit goes to github.com

Skip to content

chore: derive workspace status on backend #4284

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 30, 2022
Merged

Conversation

f0ssel
Copy link
Contributor

@f0ssel f0ssel commented Sep 30, 2022

I wanted to just knock this out while I had the time so I went ahead but would like to explain my work here for learning purposes. Going through each commit should tell the story of my process.

  1. a71547e - I added the new types to the codersdk package, added the status field to the workspace type, and ran make gen to generate the ts client as well.
  2. de9623d - I knew we had a convertWorkspace function that took a few different DB objects and made a codersdk.Workspace for api responses. I also knew that the status was completely derived from the workspace build, which is already passed into this conversion function. I added the logic there and some tests for it that at least cover the states at rest.

Note I changed the state started to running in this case since it matched what we display and made more sense to me. I also did the same with changing error to failed. These changes made more sense to me as a consumer.

I'm going to leave the frontend changes for another PR to keep this simple and easy to read.

@f0ssel f0ssel marked this pull request as ready for review September 30, 2022 21:00
@f0ssel f0ssel requested a review from a team as a code owner September 30, 2022 21:00
@f0ssel f0ssel requested review from presleyp and a team and removed request for a team September 30, 2022 21:00
@f0ssel f0ssel enabled auto-merge (squash) September 30, 2022 21:06
Copy link
Contributor

@presleyp presleyp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually followed that, thanks! Looks great, I agree with updating the wording.

@f0ssel f0ssel merged commit 139bc6f into main Sep 30, 2022
@f0ssel f0ssel deleted the f0ssel/workspace-status branch September 30, 2022 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants