fix: refactor fetch_findings to use FindingsQuery struct to fix clippy too_many_arguments
All checks were successful
CI / Format (push) Successful in 3s
CI / Clippy (push) Successful in 5m10s
CI / Security Audit (push) Has been skipped
CI / Tests (push) Has been skipped
CI / Format (pull_request) Successful in 3s
CI / Security Audit (pull_request) Has been skipped
CI / Tests (pull_request) Has been skipped
CI / Detect Changes (push) Has been skipped
CI / Detect Changes (pull_request) Has been skipped
CI / Deploy Agent (push) Has been skipped
CI / Deploy Dashboard (push) Has been skipped
CI / Deploy Docs (push) Has been skipped
CI / Clippy (pull_request) Successful in 3m58s
CI / Deploy MCP (push) Has been skipped
CI / Deploy Agent (pull_request) Has been skipped
CI / Deploy Dashboard (pull_request) Has been skipped
CI / Deploy Docs (pull_request) Has been skipped
CI / Deploy MCP (pull_request) Has been skipped
All checks were successful
CI / Format (push) Successful in 3s
CI / Clippy (push) Successful in 5m10s
CI / Security Audit (push) Has been skipped
CI / Tests (push) Has been skipped
CI / Format (pull_request) Successful in 3s
CI / Security Audit (pull_request) Has been skipped
CI / Tests (pull_request) Has been skipped
CI / Detect Changes (push) Has been skipped
CI / Detect Changes (pull_request) Has been skipped
CI / Deploy Agent (push) Has been skipped
CI / Deploy Dashboard (push) Has been skipped
CI / Deploy Docs (push) Has been skipped
CI / Clippy (pull_request) Successful in 3m58s
CI / Deploy MCP (push) Has been skipped
CI / Deploy Agent (pull_request) Has been skipped
CI / Deploy Dashboard (pull_request) Has been skipped
CI / Deploy Docs (pull_request) Has been skipped
CI / Deploy MCP (pull_request) Has been skipped
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -10,48 +10,50 @@ pub struct FindingsListResponse {
|
|||||||
pub page: Option<u64>,
|
pub page: Option<u64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
|
||||||
|
pub struct FindingsQuery {
|
||||||
|
pub page: u64,
|
||||||
|
pub severity: String,
|
||||||
|
pub scan_type: String,
|
||||||
|
pub status: String,
|
||||||
|
pub repo_id: String,
|
||||||
|
pub q: String,
|
||||||
|
pub sort_by: String,
|
||||||
|
pub sort_order: String,
|
||||||
|
}
|
||||||
|
|
||||||
#[server]
|
#[server]
|
||||||
#[allow(clippy::too_many_arguments)]
|
pub async fn fetch_findings(query: FindingsQuery) -> Result<FindingsListResponse, ServerFnError> {
|
||||||
pub async fn fetch_findings(
|
|
||||||
page: u64,
|
|
||||||
severity: String,
|
|
||||||
scan_type: String,
|
|
||||||
status: String,
|
|
||||||
repo_id: String,
|
|
||||||
q: String,
|
|
||||||
sort_by: String,
|
|
||||||
sort_order: String,
|
|
||||||
) -> Result<FindingsListResponse, ServerFnError> {
|
|
||||||
let state: super::server_state::ServerState =
|
let state: super::server_state::ServerState =
|
||||||
dioxus_fullstack::FullstackContext::extract().await?;
|
dioxus_fullstack::FullstackContext::extract().await?;
|
||||||
|
|
||||||
let mut url = format!(
|
let mut url = format!(
|
||||||
"{}/api/v1/findings?page={page}&limit=20",
|
"{}/api/v1/findings?page={}&limit=20",
|
||||||
state.agent_api_url
|
state.agent_api_url, query.page
|
||||||
);
|
);
|
||||||
if !severity.is_empty() {
|
if !query.severity.is_empty() {
|
||||||
url.push_str(&format!("&severity={severity}"));
|
url.push_str(&format!("&severity={}", query.severity));
|
||||||
}
|
}
|
||||||
if !scan_type.is_empty() {
|
if !query.scan_type.is_empty() {
|
||||||
url.push_str(&format!("&scan_type={scan_type}"));
|
url.push_str(&format!("&scan_type={}", query.scan_type));
|
||||||
}
|
}
|
||||||
if !status.is_empty() {
|
if !query.status.is_empty() {
|
||||||
url.push_str(&format!("&status={status}"));
|
url.push_str(&format!("&status={}", query.status));
|
||||||
}
|
}
|
||||||
if !repo_id.is_empty() {
|
if !query.repo_id.is_empty() {
|
||||||
url.push_str(&format!("&repo_id={repo_id}"));
|
url.push_str(&format!("&repo_id={}", query.repo_id));
|
||||||
}
|
}
|
||||||
if !q.is_empty() {
|
if !query.q.is_empty() {
|
||||||
url.push_str(&format!(
|
url.push_str(&format!(
|
||||||
"&q={}",
|
"&q={}",
|
||||||
url::form_urlencoded::byte_serialize(q.as_bytes()).collect::<String>()
|
url::form_urlencoded::byte_serialize(query.q.as_bytes()).collect::<String>()
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
if !sort_by.is_empty() {
|
if !query.sort_by.is_empty() {
|
||||||
url.push_str(&format!("&sort_by={sort_by}"));
|
url.push_str(&format!("&sort_by={}", query.sort_by));
|
||||||
}
|
}
|
||||||
if !sort_order.is_empty() {
|
if !query.sort_order.is_empty() {
|
||||||
url.push_str(&format!("&sort_order={sort_order}"));
|
url.push_str(&format!("&sort_order={}", query.sort_order));
|
||||||
}
|
}
|
||||||
|
|
||||||
let resp = reqwest::get(&url)
|
let resp = reqwest::get(&url)
|
||||||
|
|||||||
@@ -24,16 +24,18 @@ pub fn FindingsPage() -> Element {
|
|||||||
});
|
});
|
||||||
|
|
||||||
let mut findings = use_resource(move || {
|
let mut findings = use_resource(move || {
|
||||||
let p = page();
|
let query = crate::infrastructure::findings::FindingsQuery {
|
||||||
let sev = severity_filter();
|
page: page(),
|
||||||
let typ = type_filter();
|
severity: severity_filter(),
|
||||||
let stat = status_filter();
|
scan_type: type_filter(),
|
||||||
let repo = repo_filter();
|
status: status_filter(),
|
||||||
let q = search_query();
|
repo_id: repo_filter(),
|
||||||
let sb = sort_by();
|
q: search_query(),
|
||||||
let so = sort_order();
|
sort_by: sort_by(),
|
||||||
|
sort_order: sort_order(),
|
||||||
|
};
|
||||||
async move {
|
async move {
|
||||||
crate::infrastructure::findings::fetch_findings(p, sev, typ, stat, repo, q, sb, so)
|
crate::infrastructure::findings::fetch_findings(query)
|
||||||
.await
|
.await
|
||||||
.ok()
|
.ok()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user