Statistics
| Branch: | Tag: | Revision:

root / ui / templates / alt_instances.html @ b303ba05

History | View | Annotate | Download (13 kB)

1
<a id="create" rel="#wizard" href="#">Create New +</a>
2

    
3
<div id="instancesview" class="standard">
4
    <a id="list" href="/instances/list">list view</a>
5
    <div class="running">
6
        {% for node in nodes %}
7
            {% if node.state == '3' %} 
8
                <div class="instance running">
9
                    <div class="actions">
10
                        <a href="#" class="action">Reboot</a>
11
                        <a href="#" class="action">Shutdown</a>
12
                        <a href="#" class="more">more &hellip;</a>
13
                    </div>
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
                    <img src="static/pc.png" />
22
                    <img class="os" src={{ node.thumb }} />
23
                    <a href="#" class="name">
24
                        <h5>Hostname: <span>{{ node.name }}</span><span class="rename"></span></h5>
25
                    </a>
26
                    <a href="#" class="ip">
27
                        <h5>IP: <span>{{ node.public_ip }}</span></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
            {% endif %}
35
        {% endfor %}
36
    </div>
37
    <div class="seperator"></div>
38
    <div class="terminated">
39
        {% for node in nodes %}
40
            {% if node.state == '0' %}
41
                <div class="instance terminated">
42
                    <div class="actions">
43
                        <a href="#" class="action">Start</a>
44
                        <a href="#" class="action">Destroy</a>
45
                        <a href="#" class="more">more &hellip;</a>
46
                    </div>
47
                    <div class="state">
48
                        <div>Terminated</div>
49
                        <div class="indicator" />
50
                        <div class="indicator" />
51
                        <div class="indicator" />
52
                        <div class="indicator" />
53
                    </div>
54
                    <img src="static/pc.png" />
55
                    <img class="os" src={{ node.thumb }} />
56
                    <a href="#" class="name">
57
                        <h5>Hostname: <span>{{ node.name }}</span><span class="rename"></span></h5>
58
                    </a>
59
                    <a href="#" class="ip">
60
                        <h5>IP: <span>{{ node.public_ip }}</span></h5>
61
                    </a>
62
                    <br />
63
                    <h5 class="storage">
64
                        Show: <a href="#">disks</a> | <a href="#">networks</a> | <a href="#">group</a> | uptime: 24 days
65
                    </h5>
66
                </div>
67
            {% endif %}
68
        {% endfor %} 
69
    </div>
70
</div>
71

    
72
<!-- the form -->
73
<form action="#">
74
        <!-- scrollable root element -->
75
        <div class="modal" id="wizard">
76
                <!-- status bar -->
77
                <ul id="status">
78
                        <li class="active"><strong>1.</strong> Image</li>
79
                        <li><strong>2.</strong> Instance</li>
80
                        <li><strong>3.</strong> Review</li>
81
                </ul>
82
                <!-- scrollable items -->
83
                <div class="items">
84
                        <!-- pages -->
85
                        <div class="page">
86
                <h2>Select an OS</h2>
87
                <ul class="tabs">
88
                    <li><a href="#">standard</a></li>
89
                    <li><a href="#">custom</a></li>
90
                </ul>
91
                <div class="panes">
92
                    <ul class="pane">
93
                                            <!-- standard images -->
94
                        {% for image in images %}
95
                            {% if image.type == 'standard' %}
96
                                                    <li>
97
                                                            <label> 
98
                                        <a><div class="image">
99
                                            <img src={{ image.logo }} class="image-logo"/>
100
                                            <strong>{{ image.title }}</strong>
101
                                            <br />
102
                                            <span class="description">{{ image.description }}</span> 
103
                                            <span class="size">{{ image.size }}MB</span>
104
                                            <input class="radio" type="radio" name="image-id" id={{ image.id }} />
105
                                        </div></a>
106
                                                            </label>
107
                                                    </li>
108
                            {% endif %}
109
                        {% endfor %} 
110
                                    </ul>
111
                    <ul class="pane">
112
                                            <!-- custom images -->
113
                        {% for image in images %}
114
                            {% if image.type == 'custom' %}
115
                                                    <li>
116
                                                            <label> 
117
                                        <a><div class="image">
118
                                            <img src={{ image.logo }} class="image-logo"/>
119
                                            <strong>{{ image.title }}</strong>
120
                                            <br />
121
                                            <span class="description">{{ image.description }}</span> 
122
                                            <span class="size">{{ image.size }}MB</span>
123
                                            <input class="radio" type="radio" name="image-id" id={{ image.id }} />
124
                                        </div></a>
125
                                                            </label>
126
                                                    </li>
127
                            {% endif %}
128
                        {% endfor %}
129
                    </ul>
130
                </div>
131
                                <button type="button" class="prev" id="cancel">Cancel</button>
132
                                <button type="button" class="next right">Next &raquo;</button>
133
            </div>
134
                        <div class="page">
135
                                <h2>Select CPU, RAM and storage</h2>
136
                <ul>
137
                    <li>
138
                        <div class="instance-type">
139
                            <label for="small">
140
                                <input type="radio" id="small" name="instance-type" value="small" checked="true" />
141
                                <strong>small</strong>
142
                            </label>
143
                        </div>
144
                        <div class="instance-type">      
145
                            <label for="medium">
146
                                <input type="radio" id="medium" name="instance-type" value="medium" />                  
147
                                <strong>medium</strong>
148
                            </label>
149
                        </div>
150
                        <div class="instance-type">
151
                            <label for="large">
152
                                <input type="radio" id="large" name="instance-type" value="large" />
153
                                <strong>large</strong>
154
                            </label>
155
                        </div>
156
                        <div class="instance-type">
157
                            <label for="custom">
158
                                <input type="radio" name="instance-type" id="custom" value="large" />
159
                                <strong>custom</strong>
160
                            </label>
161
                        </div>
162
                    </li>
163
                    <li>
164
                                    <label><strong class="sliders">CPU (cores)</strong></label>
165
                        <input type="range" id="cpu" value="1" max="8" min="1" />
166
                    </li>
167
                    <li>
168
                                    <label><strong class="sliders">RAM (MB)</strong></label>
169
                        <input type="range" id="ram" value="256" max="2048" min="256" step="256" />
170
                    </li>
171
                    <li>
172
                                <label><strong class="sliders">Storage (GB)</strong></label>
173
                        <input type="range" id="storage" value="5" step="1" max="100" min="2" />
174
                    </li>
175
                    <li>
176
                        <div class="cost">
177
                            Cost per hour for this VM: 20 credits | Credits currently in account: 10.000
178
                        </div>
179
                    </li>
180
                </ul>
181
                                <button type="button" class="prev">&laquo; Back</button>
182
                                <button type="button" class="next right">Next &raquo;</button>
183
            </div>
184
                        <div class="page">
185
                                <h2>Confirm your settings</h2>
186
                <ul>
187
                    <li class="required">
188
                        <label>
189
                            <strong></strong> Instance name<br />
190
                            <input type="text" class="text" name="instance_name" value="My Ubuntu 10.04 x86_64 server"/>
191
                        </label>
192
                    </li>
193
                    <li>
194
                        <strong>Image:</strong> <span>Ubuntu 10.04 x86_64 server</span>
195
                    </li>
196
                    <li>
197
                        <strong>CPU:</strong> <span>2 cores</span>
198
                    </li>
199
                    <li>
200
                        <strong>RAM:</strong> <span>1024MB</span>
201
                    </li>
202
                    <li>
203
                        <strong>Storage:</strong> <span>10GB</span>
204
                    </li>
205
                    <li>
206
                        <strong>Cost per hour:</strong> <span>20 credits</span>
207
                    </li>
208
                    <li>
209
                        <strong>Remaining credits:</strong> <span>10.000</span>
210
                    </li>
211
                </ul>
212
                                <button type="button" class="prev">&laquo; Back</button>
213
                                <button type="button" class="next right" id="start">Create VM</button>        
214
            </div>
215
                </div>
216
        </div>
217
</form>
218

    
219
<div class="modal" id="misc">
220
    <h3>Your VM is being created!</h3>
221
    <p>Your password is:<strong> sdeEFre</strong></p>
222
    <p>Please copy this! Without it you can not connect to your VM.</p>
223
</div>
224

    
225
<script>
226
// <![CDATA[ 
227

228
$("#list").click(function(event){
229
    $("div#instancesview").load($("#list").attr("href"));
230
    return false;
231
});
232

233
$("ul.tabs").tabs("div.panes ul");
234

235
$(":range").rangeinput();
236

237
function disableSliders() {
238
    $("#cpu").attr('disabled',true);
239
    $("#ram").attr('disabled',true);
240
    $("#storage").attr('disabled',true);
241
}
242

243
$("#custom").click(function(event){
244
    $("#cpu").attr('disabled',false);
245
    $("#ram").attr('disabled',false);
246
    $("#storage").attr('disabled',false);
247
    $("strong.sliders").style = 'color: #778899;';
248
});
249

250
$("#small").click(function(event){
251
    $("#cpu").data('rangeinput').setValue(1);
252
    $("#ram").data('rangeinput').setValue(256);
253
    $("#storage").data('rangeinput').setValue(5);
254
});
255

256
$("#medium").click(function(event){
257
    $("#cpu").data('rangeinput').setValue(4);
258
    $("#ram").data('rangeinput').setValue(1024);
259
    $("#storage").data('rangeinput').setValue(30);
260
});
261

262
$("#large").click(function(event){
263
    $("#cpu").data('rangeinput').setValue(8);
264
    $("#ram").data('rangeinput').setValue(4096);
265
    $("#storage").data('rangeinput').setValue(80);
266
});
267

268
$("#cancel").click(function(event){
269
    $("a#create[rel]").overlay().close();
270
});
271

272
$("#start").click(function(event){
273
    $("a#create[rel]").overlay().close();
274

275
    var triggers = $("div#misc").overlay({
276
            // some mask tweaks suitable for modal dialogs
277
            mask: {
278
                    color: '#ebecff',
279
                    opacity: '0.9'
280
            },
281
        top: 'center',
282
        load: 'true',
283
            closeOnClick: 'false'  
284
    });
285
});
286

287
$("a#create").click(function(event){
288
    $("#wizard").scrollable().begin();
289
});
290

291
$("#cpu").change(function(event){
292
    $("#custom").click();
293
});
294

295
$("#ram").change(function(event){
296
    $("#custom").click();
297
});
298

299
$("#storage").change(function(event){
300
    $("#custom").click();
301
});
302

303
$(function() { 
304
    $("a#create[rel]").overlay({mask: '#000', effect: 'default', top: '5%'});
305

306
});
307

308
$(function() {
309
    var root = $("#wizard").scrollable();
310

311
    // some variables that we need
312
    var api = root.scrollable();
313

314
    // rangeinput with default configuration
315
    // validation logic is done inside the onBeforeSeek callback
316
    api.onBeforeSeek(function(event, i) {
317
            // we are going 1 step backwards so no need for validation
318
            if (api.getIndex() < i) {
319
             // 1. get current page
320
                     var page = root.find(".page").eq(api.getIndex()),
321
                         // 2. .. and all required fields inside the page
322
                         inputs = page.find(".required :input").removeClass("error"),
323
                         // 3. .. which are empty
324
                         empty = inputs.filter(function() {
325
                                return $(this).val().replace(/\s*/g, '') == '';
326
                         });
327
                     // if there are empty fields, then
328
                    if (empty.length) {
329
                            // add a CSS class name "error" for empty & required fields
330
                            empty.addClass("error");
331
                            // cancel seeking of the scrollable by returning false
332
                            return false;
333
                    // everything is good
334
                    } 
335
            }
336
            // update status bar
337
            $("#status li").removeClass("active").eq(i).addClass("active");
338
    });
339

340
    // if tab is pressed on the next button seek to next page
341
    root.find("button.next").keydown(function(e) {
342
            if (e.keyCode == 9) {
343
                    // seeks to next tab by executing our validation routine
344
                    api.next();
345
                    e.preventDefault();
346
            }
347
    });
348
// ]]>
349
});
350
</script>
351