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