Revision 6d744470
src/sunstone/public/app/app.js | ||
---|---|---|
219 | 219 |
//source https://datatables.net/plug-ins/sorting/ip-address (modified) |
220 | 220 |
jQuery.extend( jQuery.fn.dataTableExt.oSort, { |
221 | 221 |
"ip-address-pre": function ( a ) { |
222 |
if(a.split){ |
|
222 | 223 |
var ip = a.split("<br>"); |
223 | 224 |
var i, item; |
224 | 225 |
if(ip.length == 1){ |
... | ... | |
299 | 300 |
} |
300 | 301 |
|
301 | 302 |
return x; |
303 |
}else return a; |
|
302 | 304 |
}, |
303 | 305 |
|
304 | 306 |
"ip-address-asc": function ( a, b ) { |
src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general.js | ||
---|---|---|
96 | 96 |
|
97 | 97 |
//context.foundation('slider', 'reflow'); |
98 | 98 |
} |
99 |
function convertCostNumber(number){ |
|
100 |
if(number >= 1000000){ |
|
101 |
number = (number/1000000).toFixed(2) |
|
102 |
return number.toString()+"M"; |
|
103 |
} |
|
104 |
else if(number >= 1000){ |
|
105 |
number = (number/1000).toFixed(2) |
|
106 |
return number.toString()+"K"; |
|
107 |
} |
|
108 |
return number; |
|
109 |
} |
|
110 |
function caculatedTotalMemory(context){ |
|
111 |
var memory = document.getElementById('MEMORY_COST').value; |
|
112 |
var type = document.getElementById('MEMORY_UNIT_COST').value; |
|
113 |
if(type == "GB") |
|
114 |
memory *= 1024; |
|
115 |
memory = memory * 24 * 30; //24 hours and 30 days |
|
116 |
document.getElementById('total_value_memory').textContent = convertCostNumber(memory); |
|
117 |
$(".total_memory_cost", context).show(); |
|
118 |
} |
|
99 | 119 |
|
100 | 120 |
function _setup(context) { |
101 | 121 |
var that = this; |
... | ... | |
104 | 124 |
//context.foundation('slider', 'reflow'); |
105 | 125 |
}); |
106 | 126 |
|
127 |
context.on("change", "#MEMORY_COST", function() { |
|
128 |
caculatedTotalMemory(context); |
|
129 |
CapacityCreate.calculatedRealMemory(context); |
|
130 |
}); |
|
131 |
|
|
132 |
context.on("change", "#MEMORY_UNIT_COST", function() { |
|
133 |
caculatedTotalMemory(context); |
|
134 |
CapacityCreate.calculatedRealMemory(); |
|
135 |
}); |
|
136 |
|
|
137 |
context.on("change", "#CPU_COST", function() { |
|
138 |
var cpu = document.getElementById('CPU_COST').value; |
|
139 |
document.getElementById('total_value_cpu').textContent = convertCostNumber(cpu * 24 * 30); |
|
140 |
$(".total_cpu_cost", context).show(); |
|
141 |
CapacityCreate.calculatedRealCpu(); |
|
142 |
}); |
|
143 |
|
|
144 |
context.on("change", "#DISK_COST", function() { |
|
145 |
var disk = document.getElementById('DISK_COST').value; |
|
146 |
document.getElementById('total_value_disk').textContent = convertCostNumber(disk * 1024 * 24 * 30); |
|
147 |
$(".total_disk_cost", context).show(); |
|
148 |
}); |
|
149 |
|
|
107 | 150 |
context.on("change", "#LOGO", function() { |
108 | 151 |
$("#template_create_logo", context).show(); |
109 | 152 |
$("#template_create_logo", context).html('<span class="">' + |
... | ... | |
135 | 178 |
|
136 | 179 |
function _retrieve(context) { |
137 | 180 |
var templateJSON = WizardFields.retrieve(context); |
138 |
|
|
181 |
templateJSON["DISK_COST"] = templateJSON["DISK_COST"] * 1024; |
|
182 |
if(templateJSON["MEMORY_UNIT_COST"] == "GB") |
|
183 |
templateJSON["MEMORY_COST"] = templateJSON["MEMORY_COST"] * 1024; |
|
139 | 184 |
if (templateJSON["HYPERVISOR"] == 'vcenter') { |
140 | 185 |
templateJSON["VCENTER_PUBLIC_CLOUD"] = { |
141 | 186 |
'TYPE': 'vcenter', |
... | ... | |
211 | 256 |
|
212 | 257 |
function _fill(context, templateJSON) { |
213 | 258 |
var sunstone_template = templateJSON.SUNSTONE; |
259 |
if(templateJSON["MEMORY_UNIT_COST"] =="GB") |
|
260 |
templateJSON["MEMORY_COST"] = templateJSON["MEMORY_COST"] / 1024; |
|
214 | 261 |
if (sunstone_template) { |
215 | 262 |
if (sunstone_template["NETWORK_SELECT"] && |
216 | 263 |
sunstone_template["NETWORK_SELECT"].toUpperCase() == "NO") { |
src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general/capacity-create.js | ||
---|---|---|
39 | 39 |
'html': _html, |
40 | 40 |
'setup': _setup, |
41 | 41 |
'fill': _fill, |
42 |
'retrieve': _retrieve |
|
42 |
'retrieve': _retrieve, |
|
43 |
'calculatedRealMemory': _calculatedRealMemory, |
|
44 |
'calculatedRealCpu': _calculatedRealCpu, |
|
45 |
'totalCost': _totalCost |
|
43 | 46 |
}; |
44 | 47 |
|
45 | 48 |
/* |
... | ... | |
65 | 68 |
|
66 | 69 |
return Math.floor(val * 1024); |
67 | 70 |
} |
71 |
function convertCostNumber(number){ |
|
72 |
if(number >= 1000000){ |
|
73 |
number = (number/1000000).toFixed(2) |
|
74 |
return number.toString()+"M"; |
|
75 |
} |
|
76 |
else if(number >= 1000){ |
|
77 |
number = (number/1000).toFixed(2) |
|
78 |
return number.toString()+"K"; |
|
79 |
} |
|
80 |
else if (number >= 0 && number < 1000) |
|
81 |
return number.toFixed(2); |
|
82 |
else |
|
83 |
return number; |
|
84 |
} |
|
85 |
|
|
86 |
function _totalCost(){ |
|
87 |
var total = document.getElementById('real_memory_cost').value + document.getElementById('real_cpu_cost').value; |
|
88 |
document.getElementById('total_cost').textContent = "Total: "+ convertCostNumber(total); |
|
89 |
} |
|
90 |
|
|
91 |
function _calculatedRealMemory(){ |
|
92 |
var memory_cost = document.getElementById('MEMORY_COST').value; |
|
93 |
var type_cost = document.getElementById('MEMORY_UNIT_COST').value; |
|
94 |
var memory = document.getElementById('MEMORY').value; |
|
95 |
var type = document.getElementById('memory_unit').value; |
|
96 |
if(type_cost == "GB" && type == "MB") |
|
97 |
memory = (memory/1024)*memory_cost*24*30; |
|
98 |
else |
|
99 |
memory = memory*memory_cost*24*30; |
|
100 |
document.getElementById('real_memory_cost').textContent = "Cost: "+ convertCostNumber(memory); |
|
101 |
document.getElementById('real_memory_cost').value = memory; |
|
102 |
_totalCost(); |
|
103 |
} |
|
104 |
|
|
105 |
function _calculatedRealCpu(){ |
|
106 |
var cpu_cost = document.getElementById('CPU_COST').value; |
|
107 |
var cpu = document.getElementById('CPU').value; |
|
108 |
cpu = cpu*cpu_cost*24*30; |
|
109 |
document.getElementById('real_cpu_cost').textContent = "Cost: "+ convertCostNumber(cpu); |
|
110 |
document.getElementById('real_cpu_cost').value = cpu; |
|
111 |
_totalCost(); |
|
112 |
} |
|
68 | 113 |
|
69 | 114 |
function _setup(context) { |
70 | 115 |
|
116 |
context.on("change", "#MEMORY", function() { |
|
117 |
_calculatedRealMemory(); |
|
118 |
}); |
|
119 |
|
|
120 |
context.on("change", "#MEMORY_GB", function() { |
|
121 |
_calculatedRealMemory(); |
|
122 |
}); |
|
123 |
|
|
124 |
context.on("change", "#memory_unit", function() { |
|
125 |
_calculatedRealMemory(); |
|
126 |
}); |
|
127 |
|
|
128 |
context.on("change", "#CPU", function() { |
|
129 |
_calculatedRealCpu(); |
|
130 |
}); |
|
131 |
|
|
71 | 132 |
// MB to GB |
72 | 133 |
context.on("input", "div.memory_input input", function(){ |
73 | 134 |
$("div.memory_gb_input input", context).val(_m2g(this.value)); |
src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general/capacity-create/html.hbs | ||
---|---|---|
24 | 24 |
</label> |
25 | 25 |
</div> |
26 | 26 |
<div class="small-12 columns"> |
27 |
<div class="input-group"> |
|
27 |
<div class="input-group" style="margin-bottom:0rem;">
|
|
28 | 28 |
<div class="mb_unit memory_input input-group-field"> |
29 |
<input type="number" min="0" step="256" wizard_field="MEMORY" id="MEMORY"/> |
|
29 |
<input type="number" min="0" step="256" wizard_field="MEMORY" id="MEMORY"style="margin-bottom:0rem;"/>
|
|
30 | 30 |
</div> |
31 | 31 |
<div class="gb_unit memory_gb_input input-group-field"> |
32 |
<input type="number" min="0" step="1" name="memory_gb"/>
|
|
32 |
<input id="MEMORY_GB" type="number" min="0" step="1" name="memory_gb" style="margin-bottom:0rem;"/>
|
|
33 | 33 |
</div> |
34 | 34 |
<div class="input-group-button"> |
35 |
<select id="memory_unit" name="MEMORY_UNIT" class="mb_input_unit"> |
|
35 |
<select id="memory_unit" name="MEMORY_UNIT" class="mb_input_unit" style="margin-bottom:0rem;">
|
|
36 | 36 |
<option value="MB">{{tr "MB"}}</option> |
37 | 37 |
<option value="GB" selected>{{tr "GB"}}</option> |
38 | 38 |
</select> |
39 | 39 |
</div> |
40 | 40 |
</div> |
41 |
<span style="color:gray;margin-bottom:1rem"> |
|
42 |
<span id="real_memory_cost">Cost</span> |
|
43 |
<small>{{tr "COST"}} / {{tr "MONTH"}}</small> |
|
44 |
</span> |
|
41 | 45 |
</div> |
42 | 46 |
</div> |
43 | 47 |
</div> |
... | ... | |
97 | 101 |
{{{tip (tr "Percentage of CPU divided by 100 required for the Virtual Machine. Half a processor is written 0.5.")}}} |
98 | 102 |
</label> |
99 | 103 |
<div class="cpu_input"> |
100 |
<input type="number" step="0.01" min="0" wizard_field="CPU" id="CPU"/> |
|
104 |
<input type="number" step="0.01" min="0" wizard_field="CPU" id="CPU" style="margin-bottom:0rem;"/>
|
|
101 | 105 |
</div> |
106 |
<span style="color:gray;margin-bottom:1rem"> |
|
107 |
<span id="real_cpu_cost" >Cost</span> |
|
108 |
<small>{{tr "COST"}} / {{tr "MONTH"}}</small> |
|
109 |
</span> |
|
102 | 110 |
</div> |
103 | 111 |
</div> |
104 | 112 |
</div> |
src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general/html.hbs | ||
---|---|---|
126 | 126 |
</div> |
127 | 127 |
{{#isFeatureEnabled "showback"}} |
128 | 128 |
<div class="row"> |
129 |
<div class="medium-6 columns">
|
|
129 |
<div class="medium-12 columns">
|
|
130 | 130 |
<fieldset> |
131 |
<legend>{{tr "Cost"}}</legend> |
|
132 |
<div class="medium-6 columns"> |
|
131 |
<legend> |
|
132 |
{{tr "Cost"}} |
|
133 |
<span> |
|
134 |
<span id="total_cost">0.00</span> |
|
135 |
<small>{{tr "COST"}} / {{tr "MONTH"}}</small> |
|
136 |
</span> |
|
137 |
</legend> |
|
138 |
<div class="medium-4 columns"> |
|
133 | 139 |
<label for="MEMORY_COST"> |
134 | 140 |
{{tr "Memory"}} |
135 |
{{{tip (tr "Cost of each MB per hour")}}} |
|
141 |
{{{tip (tr "Cost of each MB or GB per hour")}}}
|
|
136 | 142 |
</label> |
137 |
<input type="number" step="any" min="0" wizard_field="MEMORY_COST" id="MEMORY_COST"/> |
|
143 |
<div class="input-group" style="margin-bottom:0;"> |
|
144 |
<input type="number" step="any" min="0" wizard_field="MEMORY_COST" id="MEMORY_COST"/> |
|
145 |
<div class="input-group-button"> |
|
146 |
<select id="MEMORY_UNIT_COST" wizard_field="MEMORY_UNIT_COST" class="mb_input_unit"> |
|
147 |
<option value="MB" selected>{{tr "MB"}}</option> |
|
148 |
<option value="GB" >{{tr "GB"}}</option> |
|
149 |
</select> |
|
150 |
</div> |
|
151 |
</div> |
|
152 |
<div class="target_cost" align="center" style="background-color:lightgrey;"> |
|
153 |
<label class="total_memory_cost" hidden="true">{{tr "TOTAL"}}</label> |
|
154 |
<label class="total_memory_cost" style="font-size:200%;" id="total_value_memory" hidden="true"></label> |
|
155 |
<label class="total_memory_cost" hidden="true">/{{tr "month"}} |
|
156 |
</label> |
|
157 |
</div> |
|
138 | 158 |
</div> |
139 |
<div class="medium-6 columns">
|
|
159 |
<div class="medium-4 columns">
|
|
140 | 160 |
<label for="CPU_COST"> |
141 | 161 |
{{tr "CPU"}} |
142 | 162 |
{{{tip (tr "Cost of each CPU per hour")}}} |
143 | 163 |
</label> |
144 | 164 |
<input type="number" step="any" min="0" wizard_field="CPU_COST" id="CPU_COST"/> |
165 |
<span></span> |
|
166 |
<div class="target_cost" align="center" style="background-color:lightgrey;"> |
|
167 |
<label class="total_cpu_cost" hidden="true">{{tr "TOTAL"}}</label> |
|
168 |
<label class="total_cpu_cost" style="font-size:200%;" id="total_value_cpu" hidden="true"></label> |
|
169 |
<label class="total_cpu_cost" hidden="true">/{{tr "month"}}</label> |
|
170 |
</div> |
|
145 | 171 |
</div> |
146 |
<div class="medium-6 columns left">
|
|
172 |
<div class="medium-4 columns left">
|
|
147 | 173 |
<label for="DISK_COST"> |
148 | 174 |
{{tr "Disk"}} |
149 |
{{{tip (tr "Cost of each MB per hour")}}}
|
|
175 |
{{{tip (tr "Cost of each GB per hour")}}}
|
|
150 | 176 |
</label> |
151 | 177 |
<input type="number" step="any" min="0" wizard_field="DISK_COST" id="DISK_COST"/> |
178 |
<div class="target_cost" align="center" style="background-color:lightgrey;"> |
|
179 |
<label class="total_disk_cost" hidden="true">{{tr "TOTAL"}}</label> |
|
180 |
<label class="total_disk_cost" style="font-size:200%;" id="total_value_disk" hidden="true"></label> |
|
181 |
<label class="total_disk_cost" hidden="true">/{{tr "month"}}</label> |
|
182 |
</div> |
|
152 | 183 |
</div> |
153 | 184 |
</fieldset> |
154 | 185 |
</div> |
src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/storage/disk-tab.js | ||
---|---|---|
146 | 146 |
} |
147 | 147 |
|
148 | 148 |
var tmpl = WizardFields.retrieve(selectedContext); |
149 |
|
|
149 |
tmpl["SIZE"] = tmpl["SIZE"] * 1024; |
|
150 | 150 |
var dev_prefix = WizardFields.retrieveInput($('#disk_dev_prefix', selectedContext)); |
151 | 151 |
if (dev_prefix != undefined && dev_prefix.length) { |
152 | 152 |
if (dev_prefix == "custom") { |
src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/storage/disk-tab/html.hbs | ||
---|---|---|
64 | 64 |
<div class="row"> |
65 | 65 |
<div class="medium-6 columns left"> |
66 | 66 |
<label for="SIZE"> |
67 |
{{tr "Size in MB"}}
|
|
67 |
{{tr "Size in GB"}}
|
|
68 | 68 |
</label> |
69 | 69 |
<input wizard_field="SIZE" type="number" id="SIZE" name="SIZE"/> |
70 | 70 |
</div> |
Also available in: Unified diff