Commit 222d1ca7 authored by Kostas Papadimitriou's avatar Kostas Papadimitriou
Browse files

Merge branch 'ui-0.11' into devel-0.12

parents 47cf2052 def41d6d
...@@ -6023,7 +6023,8 @@ table.list-machines .wave { ...@@ -6023,7 +6023,8 @@ table.list-machines .wave {
} }
.create-vm .personalize-cont .confirm-params { .create-vm .personalize-cont .confirm-params {
max-height: 190px; max-height: 160px;
margin-right: 10px;
} }
.create-vm .personalize-cont, .create-vm .personalize-cont,
...@@ -6031,6 +6032,15 @@ table.list-machines .wave { ...@@ -6031,6 +6032,15 @@ table.list-machines .wave {
height: 250px; height: 250px;
} }
.create-vm .image-warning {
display: none;
background-color: #987249;
color: #fff;
padding: 10px 15px;
font-size: 0.9em;
border-bottom: 1px solid #AAA;
}
.create-vm .create-step-cont .rename input.rename-field { .create-vm .create-step-cont .rename input.rename-field {
font-size: 1.4em; font-size: 1.4em;
padding: 5px; padding: 5px;
......
...@@ -43,7 +43,9 @@ ...@@ -43,7 +43,9 @@
}, },
display_users: function() { display_users: function() {
return this.get_meta('users').split(' ').join(", "); try {
return this.get_meta('users').split(' ').join(", ");
} catch(err) { console.log(err); return ''}
} }
}) })
......
...@@ -261,6 +261,16 @@ ...@@ -261,6 +261,16 @@
return this.get('owner') || _.keys(synnefo.config.system_images_owners)[0]; return this.get('owner') || _.keys(synnefo.config.system_images_owners)[0];
}, },
is_system_image: function() {
var owner = this.get_owner();
return _.include(_.keys(synnefo.config.system_images_owners), owner)
},
owned_by: function(user) {
if (!user) { user = synnefo.user }
return user.username == this.get_owner();
},
display_owner: function() { display_owner: function() {
var owner = this.get_owner(); var owner = this.get_owner();
if (_.include(_.keys(synnefo.config.system_images_owners), owner)) { if (_.include(_.keys(synnefo.config.system_images_owners), owner)) {
...@@ -285,8 +295,12 @@ ...@@ -285,8 +295,12 @@
return this.get_meta('GUI'); return this.get_meta('GUI');
}, },
get_created_user: function() { get_created_users: function() {
return synnefo.config.os_created_users[this.get_os()] || "root"; try {
var users = this.get_meta('users').split(" ");
} catch (err) { users = null }
if (!users) { users = [synnefo.config.os_created_users[this.get_os()] || "root"]}
return users;
}, },
get_sort_order: function() { get_sort_order: function() {
...@@ -308,12 +322,15 @@ ...@@ -308,12 +322,15 @@
return this.get('status') == "DELETED" return this.get('status') == "DELETED"
}, },
ssh_keys_path: function() { ssh_keys_paths: function() {
prepend = ''; return _.map(this.get_created_users(), function(username) {
if (this.get_created_user() != 'root') { prepend = '';
prepend = '/home' if (username != 'root') {
} prepend = '/home'
return '{1}/{0}/.ssh/authorized_keys'.format(this.get_created_user(), prepend); }
return '{1}/{0}/.ssh/authorized_keys'.format(username,
prepend);
});
}, },
_supports_ssh: function() { _supports_ssh: function() {
...@@ -334,16 +351,18 @@ ...@@ -334,16 +351,18 @@
}, },
personality_data_for_keys: function(keys) { personality_data_for_keys: function(keys) {
contents = ''; return _.map(this.ssh_keys_paths(), function(path) {
_.each(keys, function(key){ var contents = '';
contents = contents + key.get("content") + "\n" _.each(keys, function(key){
}); contents = contents + key.get("content") + "\n"
contents = $.base64.encode(contents); });
contents = $.base64.encode(contents);
return { return {
path: this.ssh_keys_path(), path: path,
contents: contents contents: contents
} }
});
} }
}); });
......
...@@ -314,6 +314,14 @@ ...@@ -314,6 +314,14 @@
hide_list_loading: function() { hide_list_loading: function() {
this.$(".images-list-cont").removeClass("loading"); this.$(".images-list-cont").removeClass("loading");
}, },
display_warning_for_image: function(image) {
if (!image.is_system_image() && !image.owned_by(synnefo.user)) {
$(".create-vm .image-warning").show();
} else {
$(".create-vm .image-warning").hide();
}
},
select_image: function(image) { select_image: function(image) {
if (image && image.get('id') && !_.include(this.images_ids, image.get('id'))) { if (image && image.get('id') && !_.include(this.images_ids, image.get('id'))) {
...@@ -332,6 +340,7 @@ ...@@ -332,6 +340,7 @@
if ((!this.selected_image && image) || (this.selected_image != image)) if ((!this.selected_image && image) || (this.selected_image != image))
this.trigger("change", image); this.trigger("change", image);
this.display_warning_for_image(image);
this.selected_image = image; this.selected_image = image;
...@@ -350,7 +359,7 @@ ...@@ -350,7 +359,7 @@
update_image_details: function(image) { update_image_details: function(image) {
this.image_details_desc.hide().parent().hide(); this.image_details_desc.hide().parent().hide();
if (image.get_description()) { if (image.get_description()) {
this.image_details_desc.text(image.get_description(true)).show().parent().show(); this.image_details_desc.html(image.get_description(false)).show().parent().show();
} }
var img = snf.ui.helpers.os_icon_tag(image.escape("OS")) var img = snf.ui.helpers.os_icon_tag(image.escape("OS"))
if (image.get("name")) { if (image.get("name")) {
...@@ -395,7 +404,7 @@ ...@@ -395,7 +404,7 @@
} }
var row_cls = key.toLowerCase(); var row_cls = key.toLowerCase();
if (is_extra) { row_cls += " extra-meta" }; if (is_extra) { row_cls += " extra-meta" };
extra_details.append(detail_tpl.format(_.escape(label), _.escape(value), row_cls)); extra_details.append(detail_tpl.format(_.escape(label), value, row_cls));
} }
_.each(meta_keys, function(key) { _.each(meta_keys, function(key) {
...@@ -455,7 +464,7 @@ ...@@ -455,7 +464,7 @@
img.id, img.id,
snf.ui.helpers.os_icon_tag(img.escape("OS")), snf.ui.helpers.os_icon_tag(img.escape("OS")),
_.escape(img.get_readable_size()), _.escape(img.get_readable_size()),
util.truncate(img.get_description(), 35), util.truncate(img.get_description(false), 35),
_.escape(img.display_owner()))); _.escape(img.display_owner())));
image.data("image", img); image.data("image", img);
image.data("image_id", img.id); image.data("image_id", img.id);
...@@ -1276,7 +1285,7 @@ ...@@ -1276,7 +1285,7 @@
} }
if (personality.length) { if (personality.length) {
extra['personality'] = personality; extra['personality'] = _.flatten(personality);
} }
storage.vms.create(data.name, data.image, data.flavor, meta, extra, _.bind(function(data){ storage.vms.create(data.name, data.image, data.flavor, meta, extra, _.bind(function(data){
......
{% load i18n %} {% load i18n %}
<div id="createvm-overlay-content" class="hidden create-vm"> <div id="createvm-overlay-content" class="hidden create-vm">
<div class="steps-history clearfix"> <div class="steps-history clearfix">
<div class="steps-history-cont step1h completed step-header" <div class="steps-history-cont step1h completed step-header"
id="vm-create-step-history-1"> id="vm-create-step-history-1">
...@@ -79,6 +78,13 @@ ...@@ -79,6 +78,13 @@
</div> </div>
</div> </div>
</div> </div>
<div class="image-warning">
<p>
{% blocktrans %}You have selected a user-provided Image, which is not
officially endorsed by ~okeanos. Please make sure it is from a
trustworthy source.{% endblocktrans %}
</p>
</div>
<div class="steps-container clearfix"> <div class="steps-container clearfix">
<div class="step-1 select-image wide create-step-cont clearfix"> <div class="step-1 select-image wide create-step-cont clearfix">
<div class="clearfix step-header"> <div class="clearfix step-header">
......
...@@ -16,8 +16,10 @@ ...@@ -16,8 +16,10 @@
</div> </div>
<div class="extra-info"> <div class="extra-info">
<p> <p>
<span class="important">
Keep in mind that recently rebooted or created VMs may take up to 5 Keep in mind that recently rebooted or created VMs may take up to 5
minutes to connect to them minutes to connect to them.
</span>
</p> </p>
</div> </div>
</div> </div>
......
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