mirror of
https://github.com/coollabsio/coolify.git
synced 2026-03-11 08:55:47 +00:00
refactor(limits): enhance validation rules and UI for CPU limits
This commit is contained in:
parent
8b28e2986b
commit
96a93bfe2a
2 changed files with 9 additions and 9 deletions
|
|
@ -31,9 +31,9 @@ class ResourceLimits extends Component
|
|||
'limitsMemorySwap' => 'required|string',
|
||||
'limitsMemorySwappiness' => 'required|integer|min:0|max:100',
|
||||
'limitsMemoryReservation' => 'required|string',
|
||||
'limitsCpus' => 'nullable',
|
||||
'limitsCpuset' => 'nullable',
|
||||
'limitsCpuShares' => 'nullable',
|
||||
'limitsCpus' => 'nullable|numeric|min:0|max:1024',
|
||||
'limitsCpuset' => 'nullable|string',
|
||||
'limitsCpuShares' => 'nullable|integer|min:0|max:8192',
|
||||
];
|
||||
|
||||
protected $validationAttributes = [
|
||||
|
|
@ -85,19 +85,19 @@ class ResourceLimits extends Component
|
|||
$this->authorize('update', $this->resource);
|
||||
|
||||
// Apply default values to properties
|
||||
if (! $this->limitsMemory) {
|
||||
if (!$this->limitsMemory) {
|
||||
$this->limitsMemory = '0';
|
||||
}
|
||||
if (! $this->limitsMemorySwap) {
|
||||
if (!$this->limitsMemorySwap) {
|
||||
$this->limitsMemorySwap = '0';
|
||||
}
|
||||
if (is_null($this->limitsMemorySwappiness)) {
|
||||
$this->limitsMemorySwappiness = 60;
|
||||
}
|
||||
if (! $this->limitsMemoryReservation) {
|
||||
if (!$this->limitsMemoryReservation) {
|
||||
$this->limitsMemoryReservation = '0';
|
||||
}
|
||||
if (! $this->limitsCpus) {
|
||||
if (!$this->limitsCpus) {
|
||||
$this->limitsCpus = '0';
|
||||
}
|
||||
if ($this->limitsCpuset === '') {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<h3>Limit CPUs</h3>
|
||||
<div class="flex flex-col gap-4">
|
||||
<div class="flex flex-col md:flex-row gap-4">
|
||||
<x-forms.input canGate="update" :canResource="$resource" type="number" min="0" step="0.1"
|
||||
<x-forms.input canGate="update" :canResource="$resource" type="number" min="0" max="1024" step="0.1"
|
||||
placeholder="1.5"
|
||||
helper="Limit how much CPU the container can use. 0 means unlimited (use all available CPUs). Use decimal numbers like 1.5 for one and a half CPUs, or 0.5 for half a CPU.<br>More info <a class='underline dark:text-white' target='_blank' href='https://docs.docker.com/engine/reference/run/#cpu-quota-constraint'>cpu-quota</a>."
|
||||
label="CPU Limit" id="limitsCpus">
|
||||
|
|
@ -46,7 +46,7 @@
|
|||
</svg>
|
||||
</x-slot:suffix>
|
||||
</x-forms.input>
|
||||
<x-forms.input canGate="update" :canResource="$resource" type="number" min="0" step="64"
|
||||
<x-forms.input canGate="update" :canResource="$resource" type="number" min="0" max="8192" step="64"
|
||||
placeholder="1024"
|
||||
helper="Relative CPU priority when containers compete for resources. Default: 1024 (normal). Examples: 512 = half priority, 2048 = double priority.<br>More info <a class='underline dark:text-white' target='_blank' href='https://docs.docker.com/engine/reference/run/#cpu-share-constraint'>cpu_shares</a>."
|
||||
label="CPU Weight" id="limitsCpuShares">
|
||||
|
|
|
|||
Loading…
Reference in a new issue