Commit aaf4fc48 authored by Francesc Guasch's avatar Francesc Guasch
Browse files

[#512] use "view" instead of "start"

It is misleading as the end user may think it can set
the machine to auto start. It is also enabled only for
password-less domains.
parent c58be5e1
......@@ -246,12 +246,12 @@
};
function run_domain_ctrl($scope, $http, request ) {
$http.get('/auto_start').then(function(response) {
$scope.auto_start = response.auto_start;
$http.get('/auto_view').then(function(response) {
$scope.auto_view = response.auto_view;
});
$scope.toggle_auto_start = function() {
$http.get('/auto_start/toggle').then(function(response) {
$scope.auto_start = response.auto_start;
$scope.toggle_auto_view = function() {
$http.get('/auto_view/toggle').then(function(response) {
$scope.auto_view = response.auto_view;
});
};
$scope.copy_password= function() {
......
......@@ -587,24 +587,24 @@ any '/settings' => sub {
$c->render(template => 'main/settings');
};
any '/auto_start/(#value)/' => sub {
any '/auto_view/(#value)/' => sub {
my $c = shift;
my $value = $c->stash('value');
if ($value =~ /toggle/i) {
$value = $c->session('auto_start');
$value = $c->session('auto_view');
if ($value) {
$value = 0;
} else {
$value = 1;
}
}
$c->session('auto_start' => $value);
return $c->render(json => {auto_start => $c->session('auto_start') });
$c->session('auto_view' => $value);
return $c->render(json => {auto_view => $c->session('auto_view') });
};
get '/auto_start' => sub {
get '/auto_view' => sub {
my $c = shift;
return $c->render(json => {auto_start => $c->session('auto_start') });
return $c->render(json => {auto_view => $c->session('auto_view') });
};
###################################################
......@@ -1133,7 +1133,7 @@ sub show_link {
_open_iptables($c,$domain)
if !$req;
my $uri_file = "/machine/display/".$domain->id;
$c->stash(url => $uri_file) if $c->session('auto_start');
$c->stash(url => $uri_file) if $c->session('auto_view') && ! $domain->spice_password;
my ($display_ip, $display_port) = $uri =~ m{\w+://(\d+\.\d+\.\d+\.\d+):(\d+)};
my $description = $domain->description;
if (!$description && $domain->id_base) {
......
......@@ -35,16 +35,18 @@
<li><%=l 'Display IP:' %> <b><%= $display_ip %></b></li>
<li><%=l 'Display Port:' %> <b><%= $display_port %></b></li>
</ul>
<label for="automatic"><input type="checkbox" ng-click="toggle_auto_start()"
% if ($c->session('auto_start')) {
% if (!$password) {
<label for="automatic"><input type="checkbox" ng-click="toggle_auto_view()"
% if ($c->session('auto_view')) {
checked
% }
> Start automatically next time</input>
> View automatically next time</input>
<br/>
% }
<a type="button" class="btn btn-success"
ng-click="copy_password()"
href="<%= $url_display_file %>">
<b><%=l 'start'%></b></a>
<b><%=l 'view'%></b></a>
</div>
<div class="panel-body">
......
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