Draft: Filter environments by used or unused
What does this MR do and why?
Filters records by usage status based on the last_deployment.finished_at timestamp.
Status meanings:
- "never_used": Records that have no finished deployment (either no deployment exists or the last deployment has not finished).
- "used": Records with a finished deployment within the given time window(default: last 7 days).
- "unused": Records with a finished deployment older than the given time window.
Params:
- usage_status: String indicating usage status ("never_used", "used", "unused")
- usage_since: Time duration used to determine recent usage (default: 7.days)
References
Screenshots or screen recordings
| screen record | |
|---|---|
How to set up and validate locally
- start gdk
- fetch branch
- run below cmd
- with default usage_since:
- curl --header "PRIVATE-TOKEN: glpat-jw.......................q296m" "http://gdk.test:3000/api/v4/projects/1/environments?usage_status=used"
- with user define usage_since:
- curl --header "PRIVATE-TOKEN: glpat-jw1lP...........................296m" "http://gdk.test:3000/api/v4/projects/1/environments?usage_status=used&usage_since=8d"
related issue:#493959
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by nagraj raikar