32 Commits

Author SHA1 Message Date
695de6e0c0 chore(coderd/database): optimize AuditLogs queries (#18600)
Closes #17689

This PR optimizes the audit logs query performance by extracting the
count operation into a separate query and replacing the OR-based
workspace_builds with conditional joins.

## Query changes
* Extracted count query to separate one
* Replaced single `workspace_builds` join with OR conditions with
separate conditional joins
* Added conditional joins
* `wb_build` for workspace_build audit logs (which is a direct lookup)
    * `wb_workspace` for workspace create audit logs (via workspace)

Optimized AuditLogsOffset query:
https://explain.dalibo.com/plan/4g1hbedg4a564bg8

New CountAuditLogs query:
https://explain.dalibo.com/plan/ga2fbcecb9efbce3
2025-07-01 07:31:14 +02:00
fae30a00fd chore: remove unnecessary redeclarations in for loops (#18440) 2025-06-20 13:16:55 -06:00
591f5db5f6 feat: add has-ai-task filters to the /workspaces and /templates endpoints (#18387)
This PR allows filtering templates and workspaces with the `has-ai-task`
filter as described in the [Coder Tasks
RFC](https://www.notion.so/coderhq/Coder-Tasks-207d579be5928053ab68c8d9a4b59eaa?source=copy_link#20ad579be59280e6a000eb0646d3c2df).
2025-06-18 18:22:45 +02:00
0e658219b2 feat: support filtering users table by login type (#17238)
#15896 Mentions ability to add support for filtering by login type

The issue mentions that backend API support exists but the backend did
not seem to have the support for this filter. So I have added the
ability to filter it.

I also added a corresponding update to readme file to make sure the docs
will correctly showcase this feature
2025-04-09 13:59:41 +10:00
17ddee05e5 chore: update golang to 1.24.1 (#17035)
- Update go.mod to use Go 1.24.1
- Update GitHub Actions setup-go action to use Go 1.24.1
- Fix linting issues with golangci-lint by:
  - Updating to golangci-lint v1.57.1 (more compatible with Go 1.24.1)

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <claude@anthropic.com>
2025-03-26 01:56:39 -05:00
a71aa202dc feat: filter users by github user id in the users list CLI command (#17029)
Add the `--github-user-id` option to `coder users list`, which makes the
command only return users with a matching GitHub user id. This will
enable https://github.com/coder/start-workspace-action to find a Coder
user that corresponds to a GitHub user requesting to start a workspace.
2025-03-21 13:30:47 +01:00
546a549dcf feat: enable soft delete for organizations (#16584)
- Add deleted column to organizations table
- Add trigger to check for existing workspaces, templates, groups and
members in a org before allowing the soft delete

---------

Co-authored-by: Steven Masley <stevenmasley@gmail.com>
Co-authored-by: Steven Masley <Emyrk@users.noreply.github.com>
2025-02-24 12:59:41 -05:00
b5329ae1cd feat: add workspace agent connect and app open audit types (#16493)
This commit adds new audit resource types for workspace agents and
workspace apps, as well as connect/disconnect and open/close actions.

The idea is that we will log new audit events for connecting to the
agent via SSH/editor.

Likewise, we will log openings of `coder_app`s.

This change also introduces support for filtering by `request_id`.

Updates #15139
2025-02-17 13:02:30 +00:00
e191d9650c feat: support created_at filter for the GET /users endpoint (#15633)
Closes https://github.com/coder/coder/issues/12747

We support these filters currently:
https://coder.com/docs/v2/latest/admin/users#user-filtering, adding
`created_at` filter as well.
2024-12-17 15:24:54 +11:00
b96ac677f1 chore: add organization search query to workspaces (#14474)
* chore: add organization search query to workspaces
2024-08-28 15:18:45 -05:00
8563b372e8 feat: filter templates by organization (#14254) 2024-08-14 15:01:45 -06:00
591385f2ca chore: implement fuzzy name matching for templates (#14211)
* chore: add fuzzy name search for templates
* chore: implement fuzzy name matching for templates

Templates search query defaults to a fuzzy name match
2024-08-09 10:21:26 -05:00
9cbe2b27e7 chore: create workspaces and templates for multiple orgs (#13866)
* chore: creating workspaces and templates to work with orgs
* handle wrong org selected
* create org member in coderdtest helper
2024-07-12 15:47:28 -05:00
ccf34901bc chore: add templates search query to a filter (#13772)
* chore: add templates search query to a filter
2024-07-03 13:42:23 -05:00
6daf330d3a chore: allow organization name or uuid for audit log searching (#13721)
* chore: allow organization name or uuid for audit log searching
2024-06-28 10:01:23 -05:00
08e728bcb2 chore: implement organization scoped audit log requests (#13663)
* chore: add organization_id filter to audit logs
* chore: implement organization scoped audit log requests
2024-06-26 12:38:46 -05:00
5ccf5084e8 chore: create type for unique role names (#13506)
* chore: create type for unique role names

Using `string` was confusing when something should be combined with
org context, and when not to. Naming this new name, "RoleIdentifier"
2024-06-11 08:55:28 -05:00
c674128105 chore: allow search by build params in workspace search filter (#12694)
* chore: workspace search filter allow search by params
* has_param will return all workspaces with the param existance
* exact matching
2024-03-22 14:22:47 -05:00
b4492fffba chore: support multiple key:value search query params (#12690)
This more closely aligns with GitHub's label search style. Actual search params need to be converted to allow this format, by default they will throw an error if they do not support listing.
2024-03-21 08:37:19 -05:00
e3051dff0c chore: add workspace id filter on api (#12483)
* chore: add workspace id filter on api
2024-03-11 11:37:15 -05:00
d6ba0dfecb feat: add "updated" search param to workspaces (#11714)
* feat: add "updated" search param to workspaces
* rego -> sql needs to specify which <table>.organization_id
2024-01-23 11:52:06 -06:00
e73a202aed feat: show dormant workspaces by default (#11053) 2023-12-07 18:09:35 -06:00
ec9b480ac0 fix: use is-dormant instead of dormant_at (#10191) 2023-10-10 19:00:09 -05:00
7f14b50dbe chore: rename locked to dormant (#9290)
* chore: rename locked to dormant

- The following columns have been updated:
  - workspace.locked_at -> dormant_at
  - template.inactivity_ttl -> time_til_dormant
  - template.locked_ttl -> time_til_dormant_autodelete

This change has also been reflected in the SDK.

A route has also been updated from /workspaces/<id>/lock to /workspaces/<id>/dormant
2023-08-24 13:25:54 -05:00
37a3b42c55 feat: add last_used search params to workspaces (#9230)
* feat: add last_used search params to workspaces
2023-08-22 08:41:58 -05:00
22e781eced chore: add /v2 to import module path (#9072)
* chore: add /v2 to import module path

go mod requires semantic versioning with versions greater than 1.x

This was a mechanical update by running:
```
go install github.com/marwan-at-work/mod/cmd/mod@latest
mod upgrade
```

Migrate generated files to import /v2

* Fix gen
2023-08-18 18:55:43 +00:00
9a13814b46 fix: remove duplication from language of query param error (#9069) 2023-08-13 11:47:44 -05:00
e43608395c feat: add frontend for locked workspaces (#8655)
- Fix workspaces query for locked workspaces.
2023-08-03 19:46:02 -05:00
f67ccc9bc0 feat: add resource_target to audit log search (#8423)
* feat: add resource_target to audit log search
2023-07-11 13:05:21 -04:00
f56db1b41b feat: add user search query param on last_seen (#8139)
* feat: add sql filter for before/after on last_seen column
2023-06-22 15:24:48 -05:00
f13632cea8 feat: add impending deletion filter to workspaces page (#7860)
* add workspace deletion dialog

* add deleting_by query param

* added test

* filtering on workspaces to be deleted

* cleaned up form

* added story

* added banner filter

* PR feedback

* fix lint and stories

* PR feedback

* added enterprise test

* added unit tests in search_test.go

* remove unused fn

* unstaged changes
2023-06-12 11:55:51 -07:00
8cf292f50a feat: Guard search queries against common mistakes (#6404)
* feat: Error on excessive invalid search keys
* feat: Guard search queries against common mistakes
* Raise errors in FE on workspaces table
* All errors should be on newlines
2023-03-01 23:28:56 -06:00