-
Notifications
You must be signed in to change notification settings - Fork 929
chore: refactor dynamic parameters into dedicated package #18420
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
Changes from 1 commit
1ca9483
d4dab77
c50ee08
8152bb7
247470e
6799896
08bffe2
f651edc
67644cc
ea4aa7d
758cd26
e8f1d2d
23840d9
6328899
cd46813
21b24d2
7a1622d
db612b3
000f722
7b80138
c1902a7
d2634e2
21ce54b
ae82770
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,6 +68,7 @@ func (api *API) templateVersionDynamicParametersWebsocket(rw http.ResponseWriter | |
})(rw, r) | ||
} | ||
|
||
//nolint:revive // listen is a control flag | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is a control flag acceptable or desired here if the linter discourages it? Perhaps we should include that justification in the comment. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added 👍 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understood as much as you've described in the new comment. My question is why this needs to be a "control flag" in this way instead of being extracted from the context inside this endpoint. They're functionally equivalent as far as I can tell. I'm not saying one approach is better. I'm asking because I'm sure the linting rule was added for a reason and There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As I read it, you are right. I could refactor this to remove the control flag now that the I'm going to keep it for now, and I'm going to make an issue to revisit this. It is on the parameters board, so I can fix this up in my next maintenance cycle 👍 |
||
func (api *API) templateVersionDynamicParameters(listen bool 7B20 , initial codersdk.DynamicParametersRequest) func(rw http.ResponseWriter, r *http.Request) { | ||
return func(rw http.ResponseWriter, r *http.Request) { | ||
ctx := r.Context() | ||
|
@@ -78,16 +79,16 @@ func (api *API) templateVersionDynamicParameters(listen bool, initial codersdk.D | |
|
||
err := loader.Load(ctx, api.Database) | ||
if err != nil { | ||
|
||
if httpapi.Is404Error(err) { | ||
httpapi.ResourceNotFound(rw) | ||
return | ||
} | ||
|
||
if xerrors.Is(err, dynamicparameters.ErrorTemplateVersionNotReady) { | ||
if xerrors.Is(err, dynamicparameters.ErrTemplateVersionNotReady) { | ||
httpapi.Write(ctx, rw, http.StatusTooEarly, codersdk.Response{ | ||
Message: "Template version job has not finished", | ||
}) | ||
return | ||
} | ||
|
||
httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{ | ||
|
Uh oh!
There was an error while loading. Please reload this page.