Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pve-manager
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
pve-manager
Commits
57f14ce3
Commit
57f14ce3
authored
Jul 03, 2015
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
copy form/MemoryField.js from manager to manager5
parent
2a7ee062
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
83 additions
and
0 deletions
+83
-0
MemoryField.js
www/manager5/form/MemoryField.js
+83
-0
No files found.
www/manager5/form/MemoryField.js
0 → 100644
View file @
57f14ce3
Ext
.
define
(
'
PVE.form.MemoryField
'
,
{
extend
:
'
Ext.form.field.Number
'
,
alias
:
'
widget.pveMemoryField
'
,
allowBlank
:
false
,
hotplug
:
false
,
minValue
:
32
,
maxValue
:
4178944
,
step
:
32
,
value
:
'
512
'
,
// qm default
computeUpDown
:
function
(
value
)
{
var
me
=
this
;
if
(
!
me
.
hotplug
)
{
return
{
up
:
value
+
me
.
step
,
down
:
value
-
me
.
step
};
}
var
dimm_size
=
512
;
var
prev_dimm_size
=
0
;
var
min_size
=
1024
;
var
current_size
=
min_size
;
var
value_up
=
min_size
;
var
value_down
=
min_size
;
var
value_start
=
min_size
;
var
i
,
j
;
for
(
j
=
0
;
j
<
9
;
j
++
)
{
for
(
i
=
0
;
i
<
32
;
i
++
)
{
if
((
value
>=
current_size
)
&&
(
value
<
(
current_size
+
dimm_size
)))
{
value_start
=
current_size
,
value_up
=
current_size
+
dimm_size
;
value_down
=
current_size
-
((
i
===
0
)
?
prev_dimm_size
:
dimm_size
);
}
current_size
+=
dimm_size
;
}
prev_dimm_size
=
dimm_size
;
dimm_size
=
dimm_size
*
2
;
}
return
{
up
:
value_up
,
down
:
value_down
,
start
:
value_start
};
},
onSpinUp
:
function
()
{
var
me
=
this
;
if
(
!
me
.
readOnly
)
{
var
res
=
me
.
computeUpDown
(
me
.
getValue
());
me
.
setValue
(
Ext
.
Number
.
constrain
(
res
.
up
,
me
.
minValue
,
me
.
maxValue
));
}
},
onSpinDown
:
function
()
{
var
me
=
this
;
if
(
!
me
.
readOnly
)
{
var
res
=
me
.
computeUpDown
(
me
.
getValue
());
me
.
setValue
(
Ext
.
Number
.
constrain
(
res
.
down
,
me
.
minValue
,
me
.
maxValue
));
}
},
initComponent
:
function
()
{
var
me
=
this
;
if
(
me
.
hotplug
)
{
me
.
minValue
=
1024
;
me
.
on
(
'
blur
'
,
function
(
field
)
{
value
=
me
.
getValue
();
var
res
=
me
.
computeUpDown
(
value
);
if
(
value
===
res
.
start
||
value
===
res
.
up
||
value
===
res
.
down
)
{
return
;
}
field
.
setValue
(
res
.
up
);
});
}
me
.
callParent
();
}
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment