Commit 25a773f7 authored by Francesc Guasch's avatar Francesc Guasch
Browse files

wip(frontend): warn admin about configure proxy

To proxy webservers we need extra configuration documented
in https://ravada.readthedocs.io/en/latest/docs/apache.html

issue #1196
parent 1c7a9990
......@@ -115,7 +115,7 @@ ravadaApp.directive("solShowMachine", swMach)
});
};
function machinesPageC($scope, $http, $interval, request, listMach) {
function machinesPageC($scope, $http, $interval, $timeout, request, listMach) {
$http.get('/pingbackend.json').then(function(response) {
$scope.pingbe_fail = !response.data;
});
......@@ -142,8 +142,20 @@ ravadaApp.directive("solShowMachine", swMach)
subscribe_list_requests(url);
};
subscribe_list_machines= function(url) {
ws_connected = false;
$timeout(function() {
if (!ws_connected) {
$scope.ws_fail = true;
}
}, 5 * 1000 );
var ws = new WebSocket(url);
ws.onopen = function (event) { ws.send('list_machines') };
ws.onopen = function (event) {
ws_connected = true ;
$scope.ws_fail = false;
ws.send('list_machines');
};
ws.onmessage = function (event) {
var data = JSON.parse(event.data);
......
......@@ -107,13 +107,24 @@
}
};
ws_connected = false;
$timeout(function() {
if (!ws_connected) {
$scope.ws_fail = true;
}
}, 5 * 1000 );
$scope.subscribe_list_machines_user = function(url) {
var channel = 'list_machines_user';
if ($scope.anonymous) {
channel = 'list_bases_anonymous';
}
var ws = new WebSocket(url);
ws.onopen = function(event) { ws.send(channel) };
ws.onopen = function(event) {
$scope.ws_fail = false;
ws_connected = true;
ws.send(channel);
};
ws.onmessage = function(event) {
var data = JSON.parse(event.data);
$scope.$apply(function () {
......
......@@ -1460,6 +1460,7 @@ sub admin {
$c->stash(n_clones_hide => ($CONFIG_FRONT->{admin}->{hide_clones} or 10) );
$c->stash(autostart => ( $CONFIG_FRONT->{admin}->{autostart} or 0));
$c->stash(USER => $USER);
if ($USER && $USER->is_admin && $CONFIG_FRONT->{monitoring}) {
if (!defined $c->session('monitoring')) {
my $host = $c->req->url->to_abs->host;
......
......@@ -12,6 +12,9 @@
<div ng-show="pingbe_fail" class="alert alert-danger" ng-cloak>
<strong><%=l 'Error!' %></strong><%=l 'Backend no available!' %>
</div>
% if ($USER->is_operator || $USER->is_admin) {
%= include 'main/check_ws'
% }
<div class="row">
<div style="margin-right: 10px;" data-netdata="system.swap"
data-dimensions="used"
......
......@@ -4,7 +4,8 @@
% if ( $guide ) {
<a ng-show="public_bases" class="btn btn-large btn-success" href="javascript:void(0);" ng-click="startIntro();"><%= l 'Step-by-step guide' %></a>
% }
% if ($user && $user->is_admin) {
% if ($user && ( $user->is_operator || $user->is_admin)) {
%= include 'main/check_ws'
<div ng-cloak ng-show="public_bases && private_bases">
<a ng-click="toggle_only_public()" class="badge badge-primary text-white dropdown-toggle"
align="right" ng-show="!only_public"><%=l 'Hide Private' %></a>
......
Supports Markdown
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