Skip to content

Commit

Permalink
feat(frontend): auto view machine when started
Browse files Browse the repository at this point in the history
issue #812 angular version
  • Loading branch information
frankiejol committed Jul 16, 2018
1 parent 74b9904 commit 3374dd7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions etc/rvd_front.conf.example
Expand Up @@ -23,4 +23,5 @@
,guide_custom => ''
,session_timeout => 5*60
,session_timeout_admin => 15*60
,auto_view => 0
};
5 changes: 5 additions & 0 deletions public/js/ravada.js
Expand Up @@ -358,6 +358,7 @@
};

function run_domain_req_ctrl($scope, $http, $timeout, request ) {
var redirected_display = false;
$scope.get_domain_info = function() {
if ($scope.id_domain) {
var seconds = 1000;
Expand All @@ -371,6 +372,10 @@
if ($scope.domain.is_active) {
seconds = 5000;
$scope.redirect();
if ($scope.auto_view && !redirected_display && !$scope.domain.spice_password) {
location.href='/machine/display/'+$scope.domain.id;
redirected_display=true;
}
}
$timeout(function() {
$scope.get_domain_info();
Expand Down
5 changes: 4 additions & 1 deletion rvd_front.pl
Expand Up @@ -66,6 +66,7 @@
,autostart => 0
}
,config => $FILE_CONFIG_RAVADA
,auto_view => 0
}
,file => $FILE_CONFIG
};
Expand Down Expand Up @@ -1217,7 +1218,9 @@ sub _new_domain_name {
}

sub run_request($c, $request) {
return $c->render(template => 'main/run_request', request => $request );
return $c->render(template => 'main/run_request', request => $request
, auto_view => ( $CONFIG_FRONT->{auto_view} or $c->session('auto_view') or 0)
);
}

sub _open_iptables {
Expand Down
2 changes: 1 addition & 1 deletion templates/main/run_request.html.ep
Expand Up @@ -5,7 +5,7 @@
%= include 'bootstrap/navigation'
<div class="container theme-showcase" role="main"
ng-controller="run_domain_req"
ng-init="id_request=<%= $request->id %>"
ng-init="id_request=<%= $request->id %>;auto_view=<%= $auto_view %>"
>
<div class="jumbotron">

Expand Down

0 comments on commit 3374dd7

Please sign in to comment.