root / ui / templates / alt_instances.pt @ 5edf48bd
History | View | Annotate | Download (12.2 kB)
1 |
<a id="create" rel="#wizard" href="#">Create New +</a> |
---|---|
2 |
|
3 |
<div id="instancesview" class="standard" tal:define="nodes context['nodes']"> |
4 |
<a id="list" href="/instances/list">list view</a> |
5 |
<tal:running tal:repeat="node nodes"> |
6 |
<div class="instance running" tal:condition="node['state']=='3'"> |
7 |
<div class="actions"> |
8 |
<a href="#" class="action">Reboot</a> |
9 |
<a href="#" class="action">Shutdown</a> |
10 |
<a href="#" class="more">more …</a> |
11 |
</div> |
12 |
|
13 |
<div class="state"> |
14 |
<div>Running</div> |
15 |
<div class="indicator" /> |
16 |
<div class="indicator" /> |
17 |
<div class="indicator" /> |
18 |
<div class="indicator" /> |
19 |
</div> |
20 |
|
21 |
<img src="static/pc.png" /> |
22 |
<img class="os" src="static/${node['thumb']}" /> |
23 |
<a href="#" class="name"> |
24 |
<h5>Hostname: <span tal:replace="node['name']" /><span class="rename"></span></h5> |
25 |
</a> |
26 |
<a href="#" class="ip"> |
27 |
<h5>IP: <span tal:replace="node['public_ip']" /></h5> |
28 |
</a> |
29 |
<br /> |
30 |
<h5 class="storage"> |
31 |
Show: <a href="#">disks</a> | <a href="#">networks</a> | <a href="#">group</a> | uptime: 24 days |
32 |
</h5> |
33 |
</div> |
34 |
</tal:running> |
35 |
<div class="seperator"></div> |
36 |
<tal:stopped tal:repeat="node nodes"> |
37 |
<div class="instance terminated" tal:condition="node['state']=='0'"> |
38 |
<div class="actions"> |
39 |
<a href="#" class="action">Start</a> |
40 |
<a href="#" class="action">Destroy</a> |
41 |
<a href="#" class="more">more …</a> |
42 |
</div> |
43 |
|
44 |
<div class="state"> |
45 |
<div>Terminated</div> |
46 |
<div class="indicator" /> |
47 |
<div class="indicator" /> |
48 |
<div class="indicator" /> |
49 |
<div class="indicator" /> |
50 |
</div> |
51 |
|
52 |
<img src="static/pc.png" /> |
53 |
<img class="os" src="static/${node['thumb']}" /> |
54 |
<a href="#" class="name"> |
55 |
<h5>Hostname: <span tal:replace="node['name']" /><span class="rename"></span></h5> |
56 |
</a> |
57 |
<a href="#" class="ip"> |
58 |
<h5>IP: <span tal:replace="node['public_ip']" /></h5> |
59 |
</a> |
60 |
<br /> |
61 |
<h5 class="storage"> |
62 |
Show: <a href="#">disks</a> | <a href="#">networks</a> | <a href="#">group</a> |
63 |
</h5> |
64 |
</div> |
65 |
</tal:stopped> |
66 |
</div> |
67 |
|
68 |
<!-- the form --> |
69 |
<form action="#"> |
70 |
<!-- scrollable root element --> |
71 |
<div class="modal" id="wizard"> |
72 |
<!-- status bar --> |
73 |
<ul id="status"> |
74 |
<li class="active"><strong>1.</strong> Select image</li> |
75 |
<li><strong>2.</strong> Instance type</li> |
76 |
<li><strong>3.</strong> Review</li> |
77 |
</ul> |
78 |
<!-- scrollable items --> |
79 |
<div class="items"> |
80 |
<!-- pages --> |
81 |
<div class="page"> |
82 |
<h2>Select an OS</h2> |
83 |
<ul class="tabs"> |
84 |
<li><a href="#">standard</a></li> |
85 |
<li><a href="#">custom</a></li> |
86 |
</ul> |
87 |
<div class="panes" tal:define="images context['images']"> |
88 |
<ul class="pane"> |
89 |
<!-- standard images --> |
90 |
<li> |
91 |
<label for="${image['id']}" tal:repeat="image images"> |
92 |
<a tal:condition="image['type']=='standard'"> |
93 |
<div class="image"> |
94 |
<img tal:attributes="src image['logo']" class="image-logo" /> <strong>${image['title']}</strong><br /> |
95 |
<span class="description">${image['description']}</span> |
96 |
<span class="size">${image['size']}MB</span> |
97 |
<input class="radio" type="radio" name="image-id" id="${image['id']}" value="${image['id']}" checked="${repeat.image.start}" /> |
98 |
</div> |
99 |
</a> |
100 |
</label> |
101 |
</li> |
102 |
</ul> |
103 |
<ul class="pane"> |
104 |
<!-- custom images --> |
105 |
<li> |
106 |
<label for="${image['id']}" tal:repeat="image images"> |
107 |
<a tal:condition="image['type']=='custom'"> |
108 |
<div class="image"> |
109 |
<img tal:attributes="src image['logo']" class="image-logo" /> <strong>${image['title']}</strong><br /> |
110 |
<span class="description">${image['description']}</span> |
111 |
<span class="size">${image['size']}MB</span> |
112 |
<input class="radio" type="radio" name="image-id" id="${image['id']}" value="${image['id']}" checked="${repeat.image.start}" /> |
113 |
</div> |
114 |
</a> |
115 |
</label> |
116 |
</li> |
117 |
</ul> |
118 |
</div> |
119 |
<button type="button" class="prev" id="cancel">Cancel</button> |
120 |
<button type="button" class="next right">Next »</button> |
121 |
</div> |
122 |
<div class="page"> |
123 |
<h2>Select CPU, RAM and storage</h2> |
124 |
<ul> |
125 |
<li> |
126 |
<div class="instance-type"> |
127 |
<label for="small"> |
128 |
<input type="radio" id="small" name="instance-type" value="small" checked="true" /> |
129 |
<strong>small</strong> |
130 |
</label> |
131 |
</div> |
132 |
<div class="instance-type"> |
133 |
<label for="medium"> |
134 |
<input type="radio" id="medium" name="instance-type" value="medium" /> |
135 |
<strong>medium</strong> |
136 |
</label> |
137 |
</div> |
138 |
<div class="instance-type"> |
139 |
<label for="large"> |
140 |
<input type="radio" id="large" name="instance-type" value="large" /> |
141 |
<strong>large</strong> |
142 |
</label> |
143 |
</div> |
144 |
<div class="instance-type"> |
145 |
<label for="custom"> |
146 |
<input type="radio" name="instance-type" id="custom" value="large" /> |
147 |
<strong>custom</strong> |
148 |
</label> |
149 |
</div> |
150 |
</li> |
151 |
<li> |
152 |
<label><strong class="sliders">CPU (cores)</strong></label> |
153 |
<input type="range" id="cpu" value="1" max="8" min="1" /> |
154 |
</li> |
155 |
<li> |
156 |
<label><strong class="sliders">RAM (MB)</strong></label> |
157 |
<input type="range" id="ram" value="256" max="2048" min="256" step="256" /> |
158 |
</li> |
159 |
<li> |
160 |
<label><strong class="sliders">Storage (GB)</strong></label> |
161 |
<input type="range" id="storage" value="5" step="1" max="100" min="2" /> |
162 |
</li> |
163 |
<li> |
164 |
<div class="cost"> |
165 |
Cost per hour for this VM: 20 credits | Credits currently in account: 10.000 |
166 |
</div> |
167 |
</li> |
168 |
</ul> |
169 |
<button type="button" class="prev">« Back</button> |
170 |
<button type="button" class="next right">Next »</button> |
171 |
</div> |
172 |
<div class="page"> |
173 |
<h2>Confirm your settings</h2> |
174 |
<ul> |
175 |
<li class="required"> |
176 |
<label> |
177 |
<strong></strong> Instance name <span>*</span><br /> |
178 |
<input type="text" class="text" name="instance_name" value="My Ubuntu 10.04 x86_64 server"/> |
179 |
</label> |
180 |
</li> |
181 |
<li> |
182 |
<strong>Image:</strong> <span>Ubuntu 10.04 x86_64 server</span> |
183 |
</li> |
184 |
<li> |
185 |
<strong>CPU:</strong> <span>2 cores</span> |
186 |
</li> |
187 |
<li> |
188 |
<strong>RAM:</strong> <span>1024MB</span> |
189 |
</li> |
190 |
<li> |
191 |
<strong>Storage:</strong> <span>10GB</span> |
192 |
</li> |
193 |
<li> |
194 |
<strong>Cost per hour:</strong> <span>20 credits</span> |
195 |
</li> |
196 |
<li> |
197 |
<strong>Remaining credits:</strong> <span>10.000</span> |
198 |
</li> |
199 |
</ul> |
200 |
<button type="button" class="prev">« Back</button> |
201 |
<button type="button" class="next right" id="start">Create VM</button> |
202 |
</div> |
203 |
</div> |
204 |
</div> |
205 |
</form> |
206 |
|
207 |
<div class="modal" id="misc"> |
208 |
<h3>Your VM is being created!</h3> |
209 |
<p>Your password is:<strong> sdeEFre</strong></p> |
210 |
<p>Please copy this! Without it you can not connect to your VM.</p> |
211 |
</div> |
212 |
|
213 |
<script> |
214 |
// <![CDATA[ |
215 |
|
216 |
$("#list").click(function(event){ |
217 |
$("div#instancesview").load($("#list").attr("href")); |
218 |
return false; |
219 |
}); |
220 |
|
221 |
$("ul.tabs").tabs("div.panes ul"); |
222 |
|
223 |
$(":range").rangeinput(); |
224 |
|
225 |
function disableSliders() { |
226 |
$("#cpu").attr('disabled',true); |
227 |
$("#ram").attr('disabled',true); |
228 |
$("#storage").attr('disabled',true); |
229 |
} |
230 |
|
231 |
$("#custom").click(function(event){ |
232 |
$("#cpu").attr('disabled',false); |
233 |
$("#ram").attr('disabled',false); |
234 |
$("#storage").attr('disabled',false); |
235 |
$("strong.sliders").style = 'color: #778899;'; |
236 |
}); |
237 |
|
238 |
$("#small").click(function(event){ |
239 |
$("#cpu").data('rangeinput').setValue(1); |
240 |
$("#ram").data('rangeinput').setValue(256); |
241 |
$("#storage").data('rangeinput').setValue(5); |
242 |
}); |
243 |
|
244 |
$("#medium").click(function(event){ |
245 |
$("#cpu").data('rangeinput').setValue(4); |
246 |
$("#ram").data('rangeinput').setValue(1024); |
247 |
$("#storage").data('rangeinput').setValue(30); |
248 |
}); |
249 |
|
250 |
$("#large").click(function(event){ |
251 |
$("#cpu").data('rangeinput').setValue(8); |
252 |
$("#ram").data('rangeinput').setValue(4096); |
253 |
$("#storage").data('rangeinput').setValue(80); |
254 |
}); |
255 |
|
256 |
$("#cancel").click(function(event){ |
257 |
$("a#create[rel]").overlay().close(); |
258 |
}); |
259 |
|
260 |
$("#start").click(function(event){ |
261 |
$("a#create[rel]").overlay().close(); |
262 |
|
263 |
var triggers = $("div#misc").overlay({ |
264 |
// some mask tweaks suitable for modal dialogs |
265 |
mask: { |
266 |
color: '#ebecff', |
267 |
opacity: '0.9' |
268 |
}, |
269 |
top: 'center', |
270 |
load: 'true', |
271 |
closeOnClick: 'false' |
272 |
}); |
273 |
}); |
274 |
|
275 |
$("a#create").click(function(event){ |
276 |
$("#wizard").scrollable().begin(); |
277 |
}); |
278 |
|
279 |
$("#cpu").change(function(event){ |
280 |
$("#custom").click(); |
281 |
}); |
282 |
|
283 |
$("#ram").change(function(event){ |
284 |
$("#custom").click(); |
285 |
}); |
286 |
|
287 |
$("#storage").change(function(event){ |
288 |
$("#custom").click(); |
289 |
}); |
290 |
|
291 |
$(function() { |
292 |
$("a#create[rel]").overlay({mask: '#000', effect: 'default', top: '5%'}); |
293 |
|
294 |
}); |
295 |
|
296 |
$(function() { |
297 |
var root = $("#wizard").scrollable(); |
298 |
|
299 |
// some variables that we need |
300 |
var api = root.scrollable(); |
301 |
|
302 |
// rangeinput with default configuration |
303 |
// validation logic is done inside the onBeforeSeek callback |
304 |
api.onBeforeSeek(function(event, i) { |
305 |
// we are going 1 step backwards so no need for validation |
306 |
if (api.getIndex() < i) { |
307 |
// 1. get current page |
308 |
var page = root.find(".page").eq(api.getIndex()), |
309 |
// 2. .. and all required fields inside the page |
310 |
inputs = page.find(".required :input").removeClass("error"), |
311 |
// 3. .. which are empty |
312 |
empty = inputs.filter(function() { |
313 |
return $(this).val().replace(/\s*/g, '') == ''; |
314 |
}); |
315 |
// if there are empty fields, then |
316 |
if (empty.length) { |
317 |
// add a CSS class name "error" for empty & required fields |
318 |
empty.addClass("error"); |
319 |
// cancel seeking of the scrollable by returning false |
320 |
return false; |
321 |
// everything is good |
322 |
} |
323 |
} |
324 |
// update status bar |
325 |
$("#status li").removeClass("active").eq(i).addClass("active"); |
326 |
}); |
327 |
|
328 |
// if tab is pressed on the next button seek to next page |
329 |
root.find("button.next").keydown(function(e) { |
330 |
if (e.keyCode == 9) { |
331 |
// seeks to next tab by executing our validation routine |
332 |
api.next(); |
333 |
e.preventDefault(); |
334 |
} |
335 |
}); |
336 |
// ]]> |
337 |
}); |
338 |
</script> |
339 |
|