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