fix: apply rustfmt and address argus nit (cpu_quota optional chaining)
- rustfmt expanded two inline if-else expressions in lifecycle_ops.rs (lines exceeded rustfmt's line width limit) - core.js: use optional chaining (cv?.cpu_quota || '—') so a null/empty cpu_quota/memory_max on ContainerView renders '—' correctly (argus review 🟡, PR #2706)
This commit is contained in:
parent
6c9bf2012f
commit
3239526f98
2 changed files with 12 additions and 4 deletions
|
|
@ -220,8 +220,16 @@ pub(super) async fn post_resource_limits(
|
|||
Ok(i) => i,
|
||||
Err(e) => return (StatusCode::BAD_REQUEST, format!("bad agent name: {e}")).into_response(),
|
||||
};
|
||||
let cpu_quota = if form.cpu_quota.is_empty() { None } else { Some(form.cpu_quota.as_str()) };
|
||||
let memory_max = if form.memory_max.is_empty() { None } else { Some(form.memory_max.as_str()) };
|
||||
let cpu_quota = if form.cpu_quota.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(form.cpu_quota.as_str())
|
||||
};
|
||||
let memory_max = if form.memory_max.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(form.memory_max.as_str())
|
||||
};
|
||||
if let Some(v) = cpu_quota
|
||||
&& let Err(e) = crate::resource_limits::validate_cpu_quota(v)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue