Statistics
| Branch: | Tag: | Revision:

root / ui / templates / instances.html @ e690c75d

History | View | Annotate | Download (13.5 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 class="uptime">24 days uptime</div>
21
                    </div>
22
                    <img src="static/server.png" />
23
                    <img class="os" src={{ node.thumb }} />
24
                    <a href="#" class="name">
25
                        <h3><span>{{ node.name }}</span><span class="rename">rename</span></h3>
26
                    </a>
27
                    <a href="#" class="ip">
28
                        <h5><span>{{ node.public_ip }}</span><span class="configure">configure networking</span></h5>
29
                    </a>
30
                    <a href="#" class="storage">
31
                        <h5>34GB of total storage in 3 volumes <span class="configure">configure storage</span></h5>
32
                    </a>
33
                    </div>
34
                </div>
35
            {% endif %}
36
        {% endfor %}
37
    </div>
38
    <div class="seperator"></div>
39
    <div class="terminated">
40
        {% for node in nodes %}
41
            {% if node.state == '0' %}        
42
                <div class="instance terminated">
43
                    <div class="actions">
44
                        <a href="#" class="action">start</a>
45
                        <a href="#" class="action">destroy</a>
46
                        <a href="#" class="more">more &hellip;</a>
47
                    </div>
48
                    <div class="state">
49
                        <div>Stopped</div>
50
                        <div class="indicator" />
51
                        <div class="indicator" />
52
                        <div class="indicator" />
53
                        <div class="indicator" />
54
                    </div>
55
                    <img src="static/server.png" />
56
                    <img class="os" src={{ node.thumb }} />
57
                    <a href="#" class="name">
58
                        <h3><span>{{ node.name }}</span><span class="rename">rename</span></h3>
59
                    </a>
60
                    <a href="#" class="ip">
61
                        <h5><span>{{ node.public_ip }}</span><span class="configure">configure networking</span></h5>
62
                    </a>
63
                    <a href="#" class="storage">
64
                        <h5>34GB of total storage in 3 volumes <span class="configure">configure storage</span></h5>
65
                    </a>
66
                    </div>
67
                </div>
68
            {% endif %}
69
        {% endfor %}
70
    </div>
71
</div>
72

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

    
229
<div class="modal" id="misc">
230
    <h3>Your VM is being created!</h3>
231
    <p>Your password is:<strong> sdeEFre</strong></p>
232
    <p>Please copy this! Without it you can not connect to your VM.</p>
233
</div>
234

    
235
<script>
236
// <![CDATA[ 
237

238
$("#list").click(function(event){
239
    $("div#instancesview").load($("#list").attr("href"));
240
    return false;
241
});
242

243
$("ul.tabs").tabs("div.panes ul");
244

245
$(":range").rangeinput();
246

247
function disableSliders() {
248
    $("#cpu").attr('disabled',true);
249
    $("#ram").attr('disabled',true);
250
    $("#storage").attr('disabled',true);
251
}
252

253
$("#custom").click(function(event){
254
    $("#cpu").attr('disabled',false);
255
    $("#ram").attr('disabled',false);
256
    $("#storage").attr('disabled',false);
257
    $("strong.sliders").style = 'color: #778899;';
258
});
259

260
$("#small").click(function(event){
261
    $("#cpu").data('rangeinput').setValue(1);
262
    $("#ram").data('rangeinput').setValue(256);
263
    $("#storage").data('rangeinput').setValue(5);
264
});
265

266
$("#medium").click(function(event){
267
    $("#cpu").data('rangeinput').setValue(4);
268
    $("#ram").data('rangeinput').setValue(1024);
269
    $("#storage").data('rangeinput').setValue(30);
270
});
271

272
$("#large").click(function(event){
273
    $("#cpu").data('rangeinput').setValue(8);
274
    $("#ram").data('rangeinput').setValue(4096);
275
    $("#storage").data('rangeinput').setValue(80);
276
});
277

278
$("#cancel").click(function(event){
279
    $("a#create[rel]").overlay().close();
280
});
281

282
$("#start").click(function(event){
283
    $("a#create[rel]").overlay().close();
284

285
    var triggers = $("div#misc").overlay({
286
            // some mask tweaks suitable for modal dialogs
287
            mask: {
288
                    color: '#ebecff',
289
                    opacity: '0.9'
290
            },
291
        top: 'center',
292
        load: 'true',
293
            closeOnClick: 'false'  
294
    });
295
});
296

297
$("a#create").click(function(event){
298
    $("#wizard").scrollable().begin();
299
});
300

301
$("#cpu").change(function(event){
302
    $("#custom").click();
303
});
304

305
$("#ram").change(function(event){
306
    $("#custom").click();
307
});
308

309
$("#storage").change(function(event){
310
    $("#custom").click();
311
});
312

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

316
});
317

318
$(function() {
319
    var root = $("#wizard").scrollable();
320

321
    // some variables that we need
322
    var api = root.scrollable();
323

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

350
    // if tab is pressed on the next button seek to next page
351
    root.find("button.next").keydown(function(e) {
352
            if (e.keyCode == 9) {
353
                    // seeks to next tab by executing our validation routine
354
                    api.next();
355
                    e.preventDefault();
356
            }
357
    });
358
// ]]>
359
});
360
</script>
361