Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
synnefo
Commits
64febc4d
Commit
64febc4d
authored
Mar 11, 2013
by
Kostas Papadimitriou
Browse files
Improve memory choices display in vm create view
Apply human readable (MB, GB) conversion
parent
00cc8195
Changes
2
Hide whitespace changes
Inline
Side-by-side
snf-cyclades-app/synnefo/ui/static/snf/js/ui/web/ui_create_view.js
View file @
64febc4d
...
...
@@ -827,10 +827,14 @@
}
if
(
this
.
__added_flavors
.
ram
.
indexOf
(
values
.
mem
)
==
-
1
)
{
var
mem
=
$
((
'
<li class="option mem value-{0}">
'
+
var
mem_value
=
parseInt
(
_
.
escape
(
values
.
mem
))
*
1024
*
1024
;
var
displayvalue
=
synnefo
.
util
.
readablizeBytes
(
mem_value
,
0
).
split
(
"
"
);
var
mem
=
$
((
'
<li class="option mem value-{2}">
'
+
'
<span class="value">{0}</span>
'
+
'
<span class="metric">MB</span></li>
'
).
format
(
_
.
escape
(
values
.
mem
))).
data
(
'
value
'
,
values
.
mem
);
'
<span class="metric">{1}</span></li>
'
).
format
(
displayvalue
[
0
],
displayvalue
[
1
],
values
.
mem
)).
data
(
'
value
'
,
values
.
mem
);
this
.
mems
.
append
(
mem
);
this
.
__added_flavors
.
ram
.
push
(
values
.
mem
);
}
...
...
snf-cyclades-app/synnefo/ui/static/snf/js/utils.js
View file @
64febc4d
...
...
@@ -236,10 +236,11 @@
return
string
.
substring
(
0
,
len
)
+
append
;
}
synnefo
.
util
.
readablizeBytes
=
function
(
bytes
)
{
synnefo
.
util
.
readablizeBytes
=
function
(
bytes
,
fix
)
{
if
(
fix
===
undefined
)
{
fix
=
2
;
}
var
s
=
[
'
bytes
'
,
'
kb
'
,
'
MB
'
,
'
GB
'
,
'
TB
'
,
'
PB
'
];
var
e
=
Math
.
floor
(
Math
.
log
(
bytes
)
/
Math
.
log
(
1024
));
return
(
bytes
/
Math
.
pow
(
1024
,
Math
.
floor
(
e
))).
toFixed
(
2
)
+
"
"
+
s
[
e
];
return
(
bytes
/
Math
.
pow
(
1024
,
Math
.
floor
(
e
))).
toFixed
(
fix
)
+
"
"
+
s
[
e
];
}
...
...
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