Commit f38479b4 authored by Kostas Papadimitriou's avatar Kostas Papadimitriou
Browse files

Merge branch 'ui-0.11' into devel-0.12

parents 5f69de67 a38a1f9c
......@@ -6032,13 +6032,35 @@ table.list-machines .wave {
height: 250px;
}
.create-vm .image-warning p {
width: 80%;
float: left;
}
.create-vm .image-warning .untrusted-image-confirm:hover {
background-color: #7D674E;
}
.create-vm .image-warning .untrusted-image-confirm {
display: inline-block;
padding: 5px;
background-color: #5C4D39;
color: #FFF;
width: 10%;
float: right;
margin-top: 4px;
margin-right: 2px;
cursor: pointer;
text-align: center;
}
.create-vm .image-warning {
display: none;
background-color: #987249;
color: #fff;
padding: 10px 15px;
font-size: 0.9em;
border-bottom: 1px solid #AAA;
border-top: 1px solid #AAA;
}
.create-vm .create-step-cont .rename input.rename-field {
......
......@@ -328,8 +328,8 @@
if (username != 'root') {
prepend = '/home'
}
return '{1}/{0}/.ssh/authorized_keys'.format(username,
prepend);
return {'user': username, 'path': '{1}/{0}/.ssh/authorized_keys'.format(username,
prepend)};
});
},
......@@ -351,7 +351,7 @@
},
personality_data_for_keys: function(keys) {
return _.map(this.ssh_keys_paths(), function(path) {
return _.map(this.ssh_keys_paths(), function(pathinfo) {
var contents = '';
_.each(keys, function(key){
contents = contents + key.get("content") + "\n"
......@@ -359,8 +359,11 @@
contents = $.base64.encode(contents);
return {
path: path,
contents: contents
path: pathinfo.path,
contents: contents,
mode: 0600,
owner: pathinfo.user,
group: pathinfo.user
}
});
}
......@@ -1285,7 +1288,11 @@
get_hostname: function() {
var hostname = this.get_meta('hostname');
if (!hostname) {
hostname = synnefo.config.vm_hostname_format.format(this.id);
if (synnefo.config.vm_hostname_format) {
hostname = synnefo.config.vm_hostname_format.format(this.id);
} else {
hostname = this.get_public_nic().get('ipv4');
}
}
return hostname;
},
......
......@@ -212,6 +212,11 @@
} else {
}
})
$(".image-warning .confirm").bind('click', function(){
$(".image-warning").hide();
$(".create-controls").show();
})
},
update_images: function(images) {
......@@ -278,6 +283,11 @@
this.reset_images();
this.select_image(this.selected_image);
this.hide_list_loading();
$(".custom-image-help").hide();
if (this.selected_type == 'personal' && !images.length) {
$(".custom-image-help").show();
}
},
select_type: function(type) {
......@@ -290,11 +300,6 @@
_.bind(this.hide_loading_view, this)
);
$(".custom-image-help").hide();
if (type == 'personal') {
$(".custom-image-help").show();
}
this.update_layout_for_type(type);
},
......@@ -316,10 +321,12 @@
},
display_warning_for_image: function(image) {
if (!image.is_system_image() && !image.owned_by(synnefo.user)) {
if (image && !image.is_system_image() && !image.owned_by(synnefo.user)) {
$(".create-vm .image-warning").show();
$(".create-controls").hide();
} else {
$(".create-vm .image-warning").hide();
$(".create-controls").show();
}
},
......
......@@ -78,13 +78,6 @@
</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">
......@@ -324,6 +317,14 @@
</div>
</div>
<div class="image-warning clearfix">
<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>
<span class="untrusted-image-confirm confirm">confirm</span>
</div>
<div class="create-controls clearfix">
<div class="form-action cancel">{% trans "cancel" %}</div>
<div class="form-action next">{% trans "next" %}</div>
......
......@@ -35,5 +35,5 @@ gatewayprofileusagemethod:i:0
promptcredentialonce:i:1
username:s:{{ username }}
domain:s:{{ domain }}
full address:s:{{ ip_address }}{% if extra_content %}
full address:s:{% if hostname %}{{ hostname }}{% else %}{{ ip_address }}{% endif %}{% if extra_content %}
{{ extra_content }}{% endif %}
......@@ -98,6 +98,10 @@ SKIP_TIMEOUTS = getattr(settings, "UI_SKIP_TIMEOUTS", 1)
VM_NAME_TEMPLATE = getattr(settings, "VM_CREATE_NAME_TPL", "My {0} server")
VM_HOSTNAME_FORMAT = getattr(settings, "UI_VM_HOSTNAME_FORMAT",
'snf-%(id)s.vm.okeanos.grnet.gr')
if isinstance(VM_HOSTNAME_FORMAT, basestring):
VM_HOSTNAME_FORMAT = VM_HOSTNAME_FORMAT % {'id':'{0}'}
MAX_SSH_KEYS_PER_USER = getattr(settings, "USERDATA_MAX_SSH_KEYS_PER_USER")
FLAVORS_DISK_TEMPLATES_INFO = getattr(settings, "UI_FLAVORS_DISK_TEMPLATES_INFO", {})
SYSTEM_IMAGES_OWNERS = getattr(settings, "UI_SYSTEM_IMAGES_OWNERS", {})
......@@ -208,7 +212,7 @@ def home(request):
'grouped_public_network_name': json.dumps(GROUPED_PUBLIC_NETWORK_NAME),
'group_public_networks': json.dumps(GROUP_PUBLIC_NETWORKS),
'diagnostics_update_interval': json.dumps(DIAGNOSTICS_UPDATE_INTERVAL),
'vm_hostname_format': json.dumps(VM_HOSTNAME_FORMAT % {'id':'{0}'})
'vm_hostname_format': json.dumps(VM_HOSTNAME_FORMAT)
}
return template('home', request, context)
......@@ -349,6 +353,7 @@ def machines_connect(request):
'username': username,
'domain': domain,
'ip_address': ip_address,
'hostname': hostname,
'extra_content': extra_rdp_content
}
......
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