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 {
}
.create-vm .personalize-cont .confirm-params {
max-height: 190px;
max-height: 160px;
margin-right: 10px;
}
.create-vm .personalize-cont,
......@@ -6031,6 +6032,15 @@ table.list-machines .wave {
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 {
font-size: 1.4em;
padding: 5px;
......
......@@ -43,7 +43,9 @@
},
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 @@
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() {
var owner = this.get_owner();
if (_.include(_.keys(synnefo.config.system_images_owners), owner)) {
......@@ -285,8 +295,12 @@
return this.get_meta('GUI');
},
get_created_user: function() {
return synnefo.config.os_created_users[this.get_os()] || "root";
get_created_users: function() {
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() {
......@@ -308,12 +322,15 @@
return this.get('status') == "DELETED"
},
ssh_keys_path: function() {
prepend = '';
if (this.get_created_user() != 'root') {
prepend = '/home'
}
return '{1}/{0}/.ssh/authorized_keys'.format(this.get_created_user(), prepend);
ssh_keys_paths: function() {
return _.map(this.get_created_users(), function(username) {
prepend = '';
if (username != 'root') {
prepend = '/home'
}
return '{1}/{0}/.ssh/authorized_keys'.format(username,
prepend);
});
},
_supports_ssh: function() {
......@@ -334,16 +351,18 @@
},
personality_data_for_keys: function(keys) {
contents = '';
_.each(keys, function(key){
contents = contents + key.get("content") + "\n"
});
contents = $.base64.encode(contents);
return _.map(this.ssh_keys_paths(), function(path) {
var contents = '';
_.each(keys, function(key){
contents = contents + key.get("content") + "\n"
});
contents = $.base64.encode(contents);
return {
path: this.ssh_keys_path(),
contents: contents
}
return {
path: path,
contents: contents
}
});
}
});
......
......@@ -314,6 +314,14 @@
hide_list_loading: function() {
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) {
if (image && image.get('id') && !_.include(this.images_ids, image.get('id'))) {
......@@ -332,6 +340,7 @@
if ((!this.selected_image && image) || (this.selected_image != image))
this.trigger("change", image);
this.display_warning_for_image(image);
this.selected_image = image;
......@@ -350,7 +359,7 @@
update_image_details: function(image) {
this.image_details_desc.hide().parent().hide();
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"))
if (image.get("name")) {
......@@ -395,7 +404,7 @@
}
var row_cls = key.toLowerCase();
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) {
......@@ -455,7 +464,7 @@
img.id,
snf.ui.helpers.os_icon_tag(img.escape("OS")),
_.escape(img.get_readable_size()),
util.truncate(img.get_description(), 35),
util.truncate(img.get_description(false), 35),
_.escape(img.display_owner())));
image.data("image", img);
image.data("image_id", img.id);
......@@ -1276,7 +1285,7 @@
}
if (personality.length) {
extra['personality'] = personality;
extra['personality'] = _.flatten(personality);
}
storage.vms.create(data.name, data.image, data.flavor, meta, extra, _.bind(function(data){
......
{% load i18n %}
<div id="createvm-overlay-content" class="hidden create-vm">
<div class="steps-history clearfix">
<div class="steps-history-cont step1h completed step-header"
id="vm-create-step-history-1">
......@@ -79,6 +78,13 @@
</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="step-1 select-image wide create-step-cont clearfix">
<div class="clearfix step-header">
......
......@@ -16,8 +16,10 @@
</div>
<div class="extra-info">
<p>
<span class="important">
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>
</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