Revision 3b463c5a
b/snf-cyclades-app/synnefo/ui/static/snf/css/main.css | ||
---|---|---|
32 | 32 |
font-family: monospace; |
33 | 33 |
} |
34 | 34 |
|
35 |
h4.error .title { |
|
36 |
color: red !important; |
|
37 |
} |
|
35 | 38 |
#okeanos-image { |
36 | 39 |
position: absolute; |
37 | 40 |
bottom: -0px; |
... | ... | |
5479 | 5482 |
margin-left: 2px; |
5480 | 5483 |
} |
5481 | 5484 |
|
5485 |
.create-vm .flavor-options span.available { |
|
5486 |
font-size: 0.8em; |
|
5487 |
font-weight: normal; |
|
5488 |
margin-left: 5px; |
|
5489 |
} |
|
5490 |
|
|
5482 | 5491 |
.create-vm .flavor-options span.title { |
5483 | 5492 |
color: #444; |
5484 | 5493 |
} |
b/snf-cyclades-app/synnefo/ui/static/snf/js/quota.js | ||
---|---|---|
152 | 152 |
|
153 | 153 |
can_consume: function(key, value) { |
154 | 154 |
return (this.get_available(key) - parseInt(value)) >= 0 |
155 |
}, |
|
156 |
|
|
157 |
get_available_readable: function(key) { |
|
158 |
var value; |
|
159 |
if (this.is_bytes(key)) { |
|
160 |
var value = this.get_available(key); |
|
161 |
if (!value) { return 0 } |
|
162 |
return snf.util.readablizeBytes(value); |
|
163 |
} else { |
|
164 |
return this.get_available(key); |
|
165 |
} |
|
155 | 166 |
} |
156 | 167 |
|
157 | 168 |
}); |
b/snf-cyclades-app/synnefo/ui/static/snf/js/ui/web/ui_create_view.js | ||
---|---|---|
531 | 531 |
}, this)); |
532 | 532 |
|
533 | 533 |
this.predefined = this.$(".predefined-list"); |
534 |
this.update_predefined_flavors(); |
|
535 | 534 |
}, |
536 | 535 |
|
537 | 536 |
handle_image_change: function(data) { |
... | ... | |
539 | 538 |
this.update_valid_predefined(); |
540 | 539 |
this.current_flavor = undefined; |
541 | 540 |
this.update_flavors_data(); |
541 |
this.update_predefined_flavors(); |
|
542 | 542 |
this.reset_flavors(); |
543 | 543 |
this.update_layout(); |
544 | 544 |
}, |
... | ... | |
578 | 578 |
select_valid_flavor: function() { |
579 | 579 |
var found = false; |
580 | 580 |
var self = this; |
581 |
|
|
582 |
_.each(["cpu", "mem", "disk"], function(t) { |
|
583 |
var el = $(".flavor-options."+t); |
|
584 |
var all = el.find(".flavor-opts-list li").length; |
|
585 |
var disabled = el.find(".flavor-opts-list li.disabled").length; |
|
586 |
if (disabled >= all) { |
|
587 |
el.find("h4").addClass("error"); |
|
588 |
} else { |
|
589 |
el.find("h4").removeClass("error"); |
|
590 |
} |
|
591 |
}) |
|
592 |
|
|
581 | 593 |
_.each(this.flavors, function(flv) { |
582 | 594 |
if (self.flavor_is_valid(flv)) { |
583 | 595 |
found = flv; |
... | ... | |
925 | 937 |
this.update_disabled_flavors(); |
926 | 938 |
this.validate(); |
927 | 939 |
this.validate_selected_flavor(); |
940 |
this.update_quota_display(); |
|
941 |
}, |
|
942 |
|
|
943 |
update_quota_display: function() { |
|
944 |
if (!snf.user.quota || !snf.user.quota.data) { return }; |
|
945 |
|
|
946 |
_.each(["disk", "ram", "cpu"], function(type) { |
|
947 |
var available_dsp = snf.user.quota.get_available_readable(type); |
|
948 |
var available = snf.user.quota.get_available(type); |
|
949 |
var content = "({0} left)".format(available_dsp); |
|
950 |
if (available <= 0) { content = "(None left)" } |
|
951 |
|
|
952 |
if (type == "ram") { type = "mem" } |
|
953 |
$(".flavor-options."+type+" h4 .available").text(content); |
|
954 |
if (available <= 0) { |
|
955 |
$(".flavor-options."+type+" h4 .available").addClass("error"); |
|
956 |
} else { |
|
957 |
$(".flavor-options."+type+" h4 .available").removeClass("error"); |
|
958 |
} |
|
959 |
}) |
|
928 | 960 |
}, |
929 | 961 |
|
930 | 962 |
reset: function() { |
b/snf-cyclades-app/synnefo/ui/static/snf/js/ui/web/ui_main_view.js | ||
---|---|---|
776 | 776 |
if (!snf.user.quota) { |
777 | 777 |
snf.user.quota = new snf.quota.Quota("cyclades"); |
778 | 778 |
main_view.init_quotas_handlers(); |
779 |
|
|
779 | 780 |
} |
780 | 781 |
|
781 | 782 |
snf.api.sync('read', undefined, { |
b/snf-cyclades-app/synnefo/ui/templates/partials/create_vm.html | ||
---|---|---|
149 | 149 |
<div class="flavor-options-inner-cont clearfix" |
150 | 150 |
id="create-vm-flavor-options"> |
151 | 151 |
<div class="flavor-options cpu clearfix"> |
152 |
<h4 class="clearfix"><span class="title">{% trans "CPUs" %}</span> |
|
152 |
<h4 class="clearfix"><span class="title">{% trans "CPUs" %}</span> |
|
153 |
<span class="available"></span> |
|
153 | 154 |
<span class="desc">{% trans "Choose number of CPU cores" %}</span> |
154 | 155 |
</h4> |
155 | 156 |
<ul class="flavors-cpu-list flavor-opts-list clearfix"> |
... | ... | |
157 | 158 |
</div> |
158 | 159 |
<div class="flavor-options mem clearfix"> |
159 | 160 |
<h4 class="clearfix"><span class="title">{% trans "Memory size" %}</span> |
161 |
<span class="available"></span> |
|
160 | 162 |
<span class="desc">{% trans "Choose memory size" %}</span> |
161 | 163 |
</h4> |
162 | 164 |
<ul class="flavors-mem-list flavor-opts-list clearfix"> |
... | ... | |
164 | 166 |
</div> |
165 | 167 |
<div class="flavor-options disk clearfix"> |
166 | 168 |
<h4 class="clearfix"><span class="title">{% trans "Disk size" %}</span> |
169 |
<span class="available"></span> |
|
167 | 170 |
<span class="desc">{% trans "Choose disk size" %}</span> |
168 | 171 |
</h4> |
169 | 172 |
<ul class="flavors-disk-list flavor-opts-list clearfix"> |
Also available in: Unified diff