Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: add filtering options to provisioners list#19378

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
brettkolodny merged 13 commits intomainfromrafrdz/offline-provisioners
Aug 21, 2025

Conversation

rafrdz
Copy link

@rafrdzrafrdz commentedAug 15, 2025
edited
Loading

Summary

In this pull request we're adding support for additional filtering options to theprovisioners list CLI command and the/provisionerdaemons API endpoint.

Resolves:#18783

Changes

Added CLI Options

  • --show-offline: When this option is provided, all provisioner daemons will be returned. This means that when--show-offline is not provided onlyidle andbusy provisioner daemons will be returned.
  • --status=<list_of_statuses>: When this option is provided with a comma-separated list of valid statuses (idle,busy, oroffline) only provisioner daemons that have these statuses will be returned.
  • --max-age=<duration>: When this option is provided with a valid duration value (e.g.,24h,30s) only provisioner daemons with alast_seen_at timestamp within the provided max age will be returned.

Query Params

  • ?offline=true: Include offline provisioner daemons in the results. Offline provisioner daemons will be excluded if?offline=false or if offline is not provided.
  • ?status=<list_of_statuses>: Include provisioner daemons with the specified statuses.
  • ?max_age=<duration>: Include provisioner daemons with alast_seen_at timestamp within the max age duration.

Frontend

  • Since offline provisioners will not be returned by default anymore (--show-offline has to be provided to see them), a checkbox was added to the provisioners list page to allow for offline provisioners to be displayed

Current provisioners page (without checkbox)

Screenshot 2025-08-20 at 10 51 00 AM

Provisioners page with checkbox (unchecked)

Screenshot 2025-08-20 at 10 48 40 AM

Provisioner page with checkbox (checked) and URL updated with query parameters

Screenshot 2025-08-20 at 10 50 14 AM

Show Offline vs Offline Status

To list offline provisioner daemons, users can either:

  1. Include the--show-offline option

OR

  1. Includeoffline in the list of values provided to the--status option

@rafrdzrafrdz marked this pull request as draftAugust 15, 2025 21:26
@rafrdzrafrdz marked this pull request as ready for reviewAugust 20, 2025 16:43
@rafrdzrafrdz requested review fromEmyrk,a team,brettkolodny andaslilac and removed request foraslilac anda teamAugust 20, 2025 16:43
@brettkolodny
Copy link
Contributor

@rafrdz Going to take a look no! For the chromatic tests we typically self check those to make sure we didn't accidentally introduce some glaring UI bug. So you can go through those yourself when you have a chance, but feel free to ping me if you're having issues on that front

rafrdz reacted with thumbs up emojirafrdz reacted with heart emoji

Copy link
Contributor

@brettkolodnybrettkolodny left a comment

Choose a reason for hiding this comment

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

Just a few small changes on the TS side. The backend changes look good to me but@Emyrk may want to take another look as well

rafrdz reacted with thumbs up emoji
Copy link
Member

@EmyrkEmyrk left a comment

Choose a reason for hiding this comment

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

backend 👍

Comment on lines +114 to +144
AND (
sqlc.narg('max_age_ms')::bigint ISNULL
ORpd.last_seen_at ISNULL
ORpd.last_seen_at>= (NOW()- (sqlc.narg('max_age_ms')::bigint||' ms')::interval)
)
AND (
-- Always include online daemons
(pd.last_seen_atIS NOT NULLANDpd.last_seen_at>= (NOW()- (@stale_interval_ms::bigint||' ms')::interval))
-- Include offline daemons if offline param is true or 'offline' status is requested
OR (
(pd.last_seen_at ISNULLORpd.last_seen_at< (NOW()- (@stale_interval_ms::bigint||' ms')::interval))
AND (
COALESCE(sqlc.narg('offline')::bool, false)= true
OR'offline'::provisioner_daemon_status= ANY(@statuses::provisioner_daemon_status[])
)
)
)
AND (
-- Filter daemons by any statuses if provided
COALESCE(array_length(@statuses::provisioner_daemon_status[],1),0)=0
OR (current_job.idIS NOT NULLAND'busy'::provisioner_daemon_status= ANY(@statuses::provisioner_daemon_status[]))
OR (current_job.id ISNULLAND'idle'::provisioner_daemon_status= ANY(@statuses::provisioner_daemon_status[]))
OR (
'offline'::provisioner_daemon_status= ANY(@statuses::provisioner_daemon_status[])
AND (pd.last_seen_at ISNULLORpd.last_seen_at< (NOW()- (@stale_interval_ms::bigint||' ms')::interval))
)
OR (
COALESCE(sqlc.narg('offline')::bool, false)= true
AND (pd.last_seen_at ISNULLORpd.last_seen_at< (NOW()- (@stale_interval_ms::bigint||' ms')::interval))
)
)
Copy link
Member

Choose a reason for hiding this comment

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

We usually doCASE ... WHEN, but this works

rafrdz reacted with thumbs up emoji
Comment on lines +1 to +16
// Package sdk2db provides common conversion routines from codersdk types to database types
package sdk2db

import (
"github.com/coder/coder/v2/coderd/database"
"github.com/coder/coder/v2/coderd/database/db2sdk"
"github.com/coder/coder/v2/codersdk"
)

funcProvisionerDaemonStatus(status codersdk.ProvisionerDaemonStatus) database.ProvisionerDaemonStatus {
returndatabase.ProvisionerDaemonStatus(status)
}

funcProvisionerDaemonStatuses(params []codersdk.ProvisionerDaemonStatus) []database.ProvisionerDaemonStatus {
returndb2sdk.List(params,ProvisionerDaemonStatus)
}
Copy link
Member

Choose a reason for hiding this comment

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

👍

I bet we can move some things here later

rafrdz reacted with hooray emoji
Copy link
Member

@aslilacaslilac left a comment

Choose a reason for hiding this comment

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

frontend code looks good!

@brettkolodnybrettkolodny merged commitad5e678 intomainAug 21, 2025
31 checks passed
@brettkolodnybrettkolodny deleted the rafrdz/offline-provisioners branchAugust 21, 2025 20:03
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsAug 21, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@aslilacaslilacaslilac approved these changes

@EmyrkEmyrkEmyrk approved these changes

@brettkolodnybrettkolodnybrettkolodny approved these changes

Assignees

@rafrdzrafrdz

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Feature Request: Improve Provisioner List Display and Filtering
4 participants
@rafrdz@brettkolodny@aslilac@Emyrk

[8]ページ先頭

©2009-2025 Movatter.jp