Commit 7b44cf39 authored by joansp's avatar joansp
Browse files

Ping BE fixed and Bases controller

parent 4e0934f7
......@@ -79,7 +79,7 @@ has '_vm' => (
##################################################################################3
#
# Method Modifiers
#
#
before 'display' => \&_allowed;
......@@ -87,12 +87,12 @@ before 'remove' => \&_allow_remove;
after 'remove' => \&_after_remove_domain;
before 'prepare_base' => \&_allow_prepare_base;
after 'prepare_base' => sub {
my $self = shift;
after 'prepare_base' => sub {
my $self = shift;
my ($user) = @_;
$self->is_base(1);
$self->is_base(1);
if ($self->{_was_active} ) {
$self->resume($user);
}
......@@ -148,8 +148,8 @@ sub _allow_remove {
}
sub _allow_prepare_base {
my $self = shift;
sub _allow_prepare_base {
my $self = shift;
my ($user) = @_;
$self->_allowed($user);
......@@ -166,7 +166,7 @@ sub _allow_prepare_base {
sub _check_has_clones {
my $self = shift;
my @clones;
eval { @clones = $self->clones };
die $@ if $@ && $@ !~ /No DB info/i;
die "Domain ".$self->name." has ".scalar @clones." clones : ".Dumper(\@clones)
......@@ -214,7 +214,7 @@ sub _check_disk_modified {
$last_stat_base = $stat_base[9] if$stat_base[9] > $last_stat_base;
# warn $last_stat_base;
}
my $files_updated = 0;
for my $file ( $self->disk_device ) {
my @stat = stat($file) or next;
......@@ -296,7 +296,7 @@ sub __open {
sub _select_domain_db {
my $self = shift;
my %args = @_;
my %args = @_;
if (!keys %args) {
my $id;
......@@ -402,10 +402,10 @@ sub _remove_files_base {
Returns true or false if the domain is a prepared base
=cut
sub is_base {
sub is_base {
my $self = shift;
my $value = shift;
$self->_select_domain_db or return 0;
if (defined $value ) {
......@@ -419,7 +419,7 @@ sub is_base {
}
my $ret = $self->_data('is_base');
$ret = 0 if $self->_data('is_base') =~ /n/i;
return $ret;
};
......@@ -489,6 +489,7 @@ sub clones {
return @clones;
}
=head2 list_files_base
Returns a list of the filenames of this base-type domain
=cut
......
......@@ -34,7 +34,7 @@ body {
@media(min-width:768px) {
#wrapper {
}
#page-wrapper {
......@@ -348,9 +348,13 @@ ul.alert-dropdown {
padding: 0 !important;
}
[ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {
display: none !important;
}
.table>tbody+tbody {
border-top: none;
}
.modal-backdrop {
z-index: -1 !important;
}
\ No newline at end of file
}
......@@ -15,6 +15,7 @@
.controller("new_machine", newMachineCtrl)
.controller("SupportForm", suppFormCtrl)
.controller("machines", machinesCrtl)
.controller("bases", mainpageCrtl)
.controller("messages", messagesCrtl)
.controller("users", usersCrtl)
......@@ -78,12 +79,17 @@
$scope.list_machines= response.data;
});
$http.get('/list_bases.json').then(function(response) {
$scope.list_bases= response.data;
});
request.get(function( res ) {
$scope.res = res;
});
$http.get('/pingbackend.json').then(function(response) {
$scope.pingbe = response.data;
$scope.pingbe_fail = !response.data;
});
......@@ -124,6 +130,29 @@
};
// list machines
function mainpageCrtl($scope, $http, request, listMach) {
$url_list = "/list_bases.json";
if ( typeof $_anonymous !== 'undefined' && $_anonymous ) {
$url_list = "/list_bases_anonymous.json";
}
$http.get($url_list).then(function(response) {
$scope.list_bases= response.data;
});
request.get(function( res ) {
$scope.res = res;
});
$http.get('/pingbackend.json').then(function(response) {
$scope.pingbe_fail = !response.data;
});
};
function swListMach() {
return {
......
<div class="panel-body">
<div class="col-lg-12">
<div ng-hide="pingbe" class="alert alert-danger">
<div ng-show="!pingbe" class="alert alert-danger" ng-cloak>
<strong>Error!</strong> Backend no available!
</div>
<table class="table table-striped">
......
<div ng-repeat="machine in list_machines" ng-show="{{machine.is_base}}">
<div ng-repeat="machine in list_bases">
<div class="col-sm-4">
<div class="panel panel-success machine">
......
......@@ -252,6 +252,11 @@ get '/machine/start/*.json' => sub {
my $c = shift;
return start_machine($c);
};
get '/machine/clones/*.json' => sub {
my $c = shift;
return machine_num_clones($c);
};
##make admin
get '/users/make_admin/*.json' => sub {
......
......@@ -10,8 +10,8 @@
<div id="page-wrapper">
<!--MACHINES SELECTION-->
<div class="page-header" ng-controller="machines">
<div ng-hide="pingbe" class="alert alert-danger">
<div class="page-header" ng-controller="bases">
<div ng-show="pingbe_fail" class="alert alert-danger" ng-cloak>
<strong>Error!</strong> Backend no available!
</div>
<div class="row">
......@@ -29,7 +29,7 @@
</div>
<!--/row-->
<!--SUPPORT CONTACT-->
<!--SUPPORT CONTACT
<div class="page-header" ng-controller="SupportForm as formCtrl">
<div class="row">
<div class="col-lg-12">
......@@ -37,7 +37,7 @@
</div>
</div>
</div>
<!--/row-->
/row-->
</div>
%= include 'bootstrap/scripts'
</div>
......
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