From 0c3cb3700a3fb9b69e396487bd7491dbbd8861c0 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Sat, 5 Apr 2025 10:50:28 +0000 Subject: [PATCH] fix: fix list jobs by tag --- backend/windmill-api/src/jobs.rs | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/backend/windmill-api/src/jobs.rs b/backend/windmill-api/src/jobs.rs index 15da4f29c8..d2f09cfdc9 100644 --- a/backend/windmill-api/src/jobs.rs +++ b/backend/windmill-api/src/jobs.rs @@ -1447,7 +1447,7 @@ pub fn filter_list_queue_query( sqlb.and_where_eq("created_by", "?".bind(cb)); } if let Some(t) = &lq.tag { - sqlb.and_where_eq("tag", "?".bind(t)); + sqlb.and_where_eq("v2_job.tag", "?".bind(t)); } if let Some(r) = &lq.running { sqlb.and_where_eq("running", &r); @@ -1539,7 +1539,10 @@ pub fn list_queue_jobs_query( .clone(); if let Some(tags) = tags { - sqlb.and_where_in("tag", &tags.iter().map(|x| quote(x)).collect::>()); + sqlb.and_where_in( + "v2_job.tag", + &tags.iter().map(|x| quote(x)).collect::>(), + ); } filter_list_queue_query(sqlb, lq, w_id, join_outstanding_wait_times) @@ -1746,7 +1749,10 @@ async fn list_filtered_uuids( .or_where_is_null("v2_job.trigger_kind"); if let Some(tags) = get_scope_tags(&authed) { - sqlb.and_where_in("tag", &tags.iter().map(|x| quote(x)).collect::>()); + sqlb.and_where_in( + "v2_job.tag", + &tags.iter().map(|x| quote(x)).collect::>(), + ); } sqlb = filter_list_queue_query(sqlb, &lq, w_id.as_str(), false); @@ -1829,7 +1835,7 @@ async fn count_completed_jobs_detail( if let Some(tags) = query.tags { sqlb.and_where_in( - "tag", + "v2_job.tag", &tags .split(",") .map(|t| format!("'{}'", t)) @@ -5469,7 +5475,7 @@ pub fn filter_list_completed_query( sqlb.and_where_eq("runnable_id", "?".bind(h)); } if let Some(t) = &lq.tag { - sqlb.and_where_eq("tag", "?".bind(t)); + sqlb.and_where_eq("v2_job.tag", "?".bind(t)); } if let Some(cb) = &lq.created_by { sqlb.and_where_eq("created_by", "?".bind(cb)); @@ -5570,7 +5576,10 @@ pub fn list_completed_jobs_query( .clone(); if let Some(tags) = tags { - sqlb.and_where_in("tag", &tags.iter().map(|x| quote(x)).collect::>()); + sqlb.and_where_in( + "v2_job.tag", + &tags.iter().map(|x| quote(x)).collect::>(), + ); } filter_list_completed_query(sqlb, lq, w_id, join_outstanding_wait_times)