* chore(ws): comment workspace details logs tab while it is not supported
Signed-off-by: paulovmr <832830+paulovmr@users.noreply.github.com>
* chore(ws): comment workspace details pod template tab while it is not supported
Signed-off-by: paulovmr <832830+paulovmr@users.noreply.github.com>
---------
Signed-off-by: paulovmr <832830+paulovmr@users.noreply.github.com>
- Updated swaggo/swag from v1.16.4 to v1.16.6 in go.mod and Makefile.
- Added required fields to various OpenAPI definitions in docs.go and swagger.json for better validation via `--requiredByDefault` flag
- `swag` `v1.16.6` contains a commit we authored to treat `json:omitempty` as `required: false`. That, in conjunction with `--requiredByDefault` flag, allows us to generate models with proper _required-ness_
Signed-off-by: Andy Stoneberg <astonebe@redhat.com>
- added @ID annotations for all API routes to populate operationId Swagger attribute
- split GetWorkspacesHandler into 2 separate handlers to account for @ID needing to be unique-per-route
- GetAllWorkspacesHandler now services GET /workspaces
- GetWorkspacesByNamespaceHandler now services GET /workspaces/{namespace}
- non-exported getWorkspacesHandler function contains all business logic that existed in GetWorkspacesHandler
- Adjusted test cases to align with the new handler names.
Signed-off-by: Andy Stoneberg <astonebe@redhat.com>
Signed-off-by: Jenny <32821331+jenny-s51@users.noreply.github.com>
remove comment
fix(ws): remove set to first page when filters applied
Signed-off-by: Jenny <32821331+jenny-s51@users.noreply.github.com>
fix tests for filterWorkspacesTest
fix single filter test
Signed-off-by: Jenny <32821331+jenny-s51@users.noreply.github.com>
fix bug in ws kind table
related: #298
- Added PauseActionWorkspaceHandler to handle pausing or unpausing a given workspace
- Introduced single new route for starting and pausing workspaces in the API.
- `api/v1/workspaces/{namespace}/{name}/actions/pause`
- pausing or unpausing operation is specified in the request payload
- Created a new WorkspaceActionPauseEnvelope type for successful responses.
- Leveraging JSONPatch / client.RawPatch to ensure Workspace in "valid state" before attempting action
- for `start`: `spec.paused` must be `true`, and `status.state` must be `Paused`
- for `pause`: `spec.paused` must be `false`
- note: I would love to have a `status.state` check here of `status.state != Paused`, but that type of comparison is not supported in [JSONPatch](https://datatracker.ietf.org/doc/html/rfc6902#section-4.6)
- Added tests for the new API, including success and error cases.
- Updated README/OpenAPI documentation to include the new endpoints.
---
As an interesting "edge case" worth calling out, the following payload is currently honored by the API:
```
{
"data": {}
}
```
Given the `WorkspaceActionPause` struct is simply `{"paused": true|false}`, the "empty" Envelope presented above deserializes the JSON using the zero value of `bool` (which is `false`).
Our validation today is always performed against the **deserialized** object, and as such impossible to distinguish the following cases:
```
{
"data": {}
}
```
vs
```
{
"data": {
"paused": false
}
}
```
The effort and (relative) complexity to prevent this and return a `422` in this scenario was not deemed "worth it" for the time being. As a result, a test case has been added for this specific scenario to at minimum document this "strange" behavior.
- Clients, however, should **NOT** rely on this behavior and always provide a fully defined `WorkspaceActionPause` JSON object to ensure future compatibility.
Signed-off-by: Andy Stoneberg <astonebe@redhat.com>
Signed-off-by: Jenny <32821331+jenny-s51@users.noreply.github.com>
fix(ws): remove extra DrawerPanelBody
remove unused file
Signed-off-by: Jenny <32821331+jenny-s51@users.noreply.github.com>
fix(ws): remove comment and hide drawer on previousStep callback
Signed-off-by: Jenny <32821331+jenny-s51@users.noreply.github.com>
fix(ws): when navigating between wizard steps, show drawer for steps that have drawer content
Signed-off-by: Jenny <32821331+jenny-s51@users.noreply.github.com>
move formatLabel to separate util
add title, divider, and fix wizard buttons to align with PF design guidelines
Signed-off-by: Jenny <32821331+jenny-s51@users.noreply.github.com>
prevent wizard button from active state when no selection
Signed-off-by: Jenny <32821331+jenny-s51@users.noreply.github.com>
rebase
Signed-off-by: Jenny <32821331+jenny-s51@users.noreply.github.com>
handle standard infra resource types
* Add Pod Config to WorkspaceKind form
Signed-off-by: Charles Thao <cthao@redhat.com>
* Add resource section for PodConfig
Signed-off-by: Charles Thao <cthao@redhat.com>
* Use refactored types
Signed-off-by: Charles Thao <cthao@redhat.com>
* Improve Resource input
Signed-off-by: Charles Thao <cthao@redhat.com>
* Move form view to edit mode only
Signed-off-by: Charles Thao <cthao@redhat.com>
* Bug fix and improvements
Signed-off-by: Charles Thao <cthao@redhat.com>
---------
Signed-off-by: Charles Thao <cthao@redhat.com>