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
|
|
@ -237,11 +237,11 @@ function renderContainerLoad(rows) {
|
|||
// values: per-agent override when set, hive-wide default otherwise).
|
||||
const cpuCap = document.createElement('td'); cpuCap.className = 'num cload-cap';
|
||||
cpuCap.title = 'configured ceiling — takes effect on next start';
|
||||
cpuCap.textContent = cv ? cv.cpu_quota : '—';
|
||||
cpuCap.textContent = cv?.cpu_quota || '—';
|
||||
tr.append(cpuCap);
|
||||
const memCap = document.createElement('td'); memCap.className = 'num cload-cap';
|
||||
memCap.title = 'configured ceiling — takes effect on next start';
|
||||
memCap.textContent = cv ? cv.memory_max : '—';
|
||||
memCap.textContent = cv?.memory_max || '—';
|
||||
tr.append(memCap);
|
||||
|
||||
// S3T button toggles the inline edit row for this agent.
|
||||
|
|
|
|||
|
|
@ -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