Commit e10fedcb authored by Vangelis Koukis's avatar Vangelis Koukis
Browse files

Merge branch 'ui-refactor'

parents 4ed5120d 6c7a382d
......@@ -62,6 +62,20 @@ div#wrapper {
text-align: left;
}
#footer a {
color: #fff;
}
#footer .software .version {
font-weight: bold;
}
#footer .software {
font-size: 0.6em;
margin-top: 7px;
color: #fff;
}
#footer {
height: 80px;
background-color: #4085A5;
......@@ -5141,6 +5155,11 @@ table.list-machines .wave {
margin-right: 10px;
}
.form-field.error label {
color: #ff0000;
text-decoration: underline;
}
.form-field input {
border: 1px solid #aaa;
width: 200px;
......
......@@ -150,6 +150,10 @@
return parseInt(this.get('metadata') ? this.get('metadata').values.size : -1)
},
get_readable_size: function() {
return this.get_size() > 0 ? util.readablizeBytes(this.get_size() * 1024 * 1024) : "unknown";
},
get_os: function() {
return this.get("OS");
},
......@@ -920,20 +924,6 @@
// retrieve the metadata object
get_meta: function() {
//return {
//'OS': 'debian',
//'username': 'vinilios',
//'group': 'webservers',
//'meta2': 'meta value',
//'looooooooooooooooong meta': 'short value',
//'short meta': 'loooooooooooooooooooooooooooooooooong value',
//'21421': 'fdsfds fds',
//'21421': 'fdsfds fds',
//'1fds 21421': 'fdsfds fds',
//'fds 21421': 'fdsfds fds',
//'fge 21421': 'fdsfds fds',
//'21421 rew rew': 'fdsfds fds'
//}
try {
return this.get('metadata').values
} catch (err) {
......
......@@ -33,18 +33,32 @@
this.copy = this.$(".clip-copy");
this.$(".show-machine").click(_.bind(function(){
if (this.$(".show-machine").hasClass("in-progress")) {
return;
}
this.hide();
snf.ui.main.show_vm_details(storage.vms.get(this.vm_id));
}, this));
_.bindAll(this, "handle_vm_added");
storage.vms.bind("add", this.handle_vm_added);
},
handle_vm_added: function() {
this.$(".show-machine").removeClass("in-progress");
},
show_password: function() {
this.$(".show-machine").addClass("in-progress");
this.password.text(this.pass);
if (storage.vms.get(this.vm_id)) {
this.$(".show-machine").removeClass("in-progress");
}
},
onClose: function() {
this.password.text("");
this.vm_id = undefined;
},
beforeOpen: function() {
......@@ -65,7 +79,7 @@
show: function(pass, vm_id) {
this.pass = pass;
this.vm_id = vm_id;
views.VMCreationPasswordView.__super__.show.apply(this, arguments);
this.show_password();
}
......@@ -217,13 +231,16 @@
this.image_details_os.text(_(image.get("OS")).capitalize());
this.image_details_kernel.text(image.get("kernel"));
var size = util.readablizeBytes(parseInt(image.get("size")) * 1024 * 1024);
var size = image.get_readable_size();
this.image_details_size.text(size);
this.image_details_gui.text(image.get("GUI"));
} else {
this.image_details.hide();
}
this.validate();
},
reset_images: function() {
......@@ -258,7 +275,7 @@
'</span></li>').format(img.get("name"),
img.id,
snf.ui.helpers.os_icon_tag(img.get("OS")),
util.readablizeBytes(parseInt(img.get("size"))* 1024 * 1024),
img.get_readable_size(),
util.truncate(img.get("description"),35)));
image.data("image", img);
image.data("image_id", img.id);
......@@ -272,6 +289,14 @@
get: function() {
return {'image': this.selected_image};
},
validate: function() {
if (!this.selected_image) {
this.parent.$(".form-action.next").hide();
} else {
this.parent.$(".form-action.next").show();
}
}
});
......@@ -429,8 +454,12 @@
this.current_flavor = flv;
this.trigger("change");
this.update_selected_flavor();
this.update_selected_predefined();
if (this.current_flavor) {
this.update_selected_flavor();
this.update_selected_predefined();
}
this.validate();
},
select_default_flavor: function() {
......@@ -491,6 +520,7 @@
update_selected_flavor: function() {
var flv = this.current_flavor;
if (!flv) { return }
this.$(".option").removeClass("selected");
this.$(".option.cpu.value-" + flv.get("cpu")).addClass("selected");
......@@ -542,6 +572,7 @@
update_layout: function() {
this.update_selected_flavor();
this.update_disabled_flavors();
this.validate();
},
reset: function() {
......@@ -551,6 +582,14 @@
this.update_flavors_data();
},
validate: function() {
if (!this.current_flavor) {
this.parent.$(".form-action.next").hide();
} else {
this.parent.$(".form-action.next").show();
}
},
get: function() {
return {'flavor': this.current_flavor}
}
......@@ -630,12 +669,13 @@
set_detail("name");
set_detail("os", _(image.get("OS")).capitalize());
set_detail("gui", image.get("GUI"));
set_detail("size", util.readablizeBytes(image.get_size() * 1024 * 1024));
set_detail("size", image.get_readable_size());
set_detail("kernel");
},
update_layout: function() {
var params = this.parent.get_params();
if (!params.image || !params.flavor) { return }
if (!params.image) { return }
var vm_name = "My {0} server".format(params.image.get("name"));
......
......@@ -554,7 +554,7 @@
}
this.sel('image_name').text(util.truncate(image.get('name'), 13)).attr("title", image.get('name'));
this.sel('image_size').text(image.get('metadata').values.size).attr('title', image.get('metadata').values.size);
this.sel('image_size').text(image.get_readable_size()).attr('title', image.get_readable_size());
this.sel('cpu').text(flavor.get('cpu'));
this.sel('ram').text(flavor.get('ram'));
......
......@@ -283,7 +283,7 @@
connect_to_console: function(vm) {
vm.call("console", function(console_data) {
var url = vm.get_console_url(console_data);
snf.util.open_window(url, "Console to '" + vm.get("name") + "'", {});
snf.util.open_window(url, "VM_" + vm.get("id") + "_CONSOLE", {});
})
}
......
......@@ -16,5 +16,6 @@
</div>
<div id="footer-bg">
</div>
<div class="software">powered by <a href="http://code.grnet.gr/">synnefo</a> <span class="version">v{{ synnefo_version }}</span></div>
</div>
</div>
......@@ -6,10 +6,10 @@
<title>~okeanos</title>
<!--<meta http-equiv="X-UA-Compatible" content="IE=7">-->
<link href="http://fonts.googleapis.com/css?family=Ubuntu&subset=latin,greek" rel="stylesheet" type="text/css" >
<link href='http://fonts.googleapis.com/css?family=Open+Sans&subset=latin,greek' rel='stylesheet' type='text/css'>
<link href="https://fonts.googleapis.com/css?family=Ubuntu&subset=latin,greek" rel="stylesheet" type="text/css" >
<link href='https://fonts.googleapis.com/css?family=Open+Sans&subset=latin,greek' rel='stylesheet' type='text/css'>
<link rel="shortcut icon" href="{{ UI_MEDIA_URL }}favicon.ico" />
<link rel="shortcut icon" href="{{ SYNNEFO_IMAGES_URL }}favicon.ico" />
{% comment %}
<script type="text/javascript" src="{% url javascript_catalog %}"></script>
......@@ -526,6 +526,7 @@ We welcome any suggestions, questions and bug reports you may have.{% endblocktr
synnefo.config.handle_window_exceptions = {{ handle_window_exceptions }};
synnefo.config.ajax_timeout = {{ timeout }};
synnefo.config.skip_timeouts = {{ skip_timeouts }};
synnefo.VERSION = "{{ synnefo_version }}";
// TODO: make it dynamic
synnefo.config.api_url = '/api/v1.1';
......@@ -539,6 +540,7 @@ We welcome any suggestions, questions and bug reports you may have.{% endblocktr
synnefo.ui.init();
synnefo.ui.main.bind("initial", function(){})
})
</script>
</body>
......
......@@ -56,7 +56,7 @@
</div>
<div class="image-details">
<span class="vm-detail"><span class="key">{% trans "Image" %}:</span> <span class="value"><span class="image-data">Debian</span></span></span>
<span class="vm-detail"><span class="key">{% trans "Image Size" %}:</span> <span class="value"><span class="image-size-data">2.3</span>MB</span></span>
<span class="vm-detail"><span class="key">{% trans "Image Size" %}:</span> <span class="value"><span class="image-size-data">2.3</span></span></span>
</div>
</div>
<div class="vm-stats metadata-column">
......
......@@ -113,6 +113,7 @@ def home(request):
'suggested_flavors': json.dumps(SUGGESTED_FLAVORS),
'suggested_roles': json.dumps(SUGGESTED_ROLES),
'vm_image_common_metadata': json.dumps(VM_IMAGE_COMMON_METADATA),
'synnefo_version': SYNNEFO_JS_LIB_VERSION,
'invitations_per_page': INVITATIONS_PER_PAGE,
'delay_on_blur': json.dumps(DELAY_ON_BLUR),
'blur_delay': json.dumps(BLUR_DELAY),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment