Unverified Commit 1e58743a authored by Francesc Guasch's avatar Francesc Guasch Committed by GitHub
Browse files

Filter in admin machines (#1696)

feat(frontend): filter virtual machy by name
parent fd5ea27d
......@@ -416,6 +416,7 @@ ravadaApp.directive("solShowMachine", swMach)
$scope.auto_hide_clones = false;
$scope.show_active = false;
$scope.hide_clones = !value;
$scope.filter = '';
for (var i in $scope.list_machines){
mach = $scope.list_machines[i];
if (mach._level == 0 ) {
......@@ -552,6 +553,7 @@ ravadaApp.directive("solShowMachine", swMach)
}
};
$scope.do_show_active = function() {
$scope.filter = '';
$scope.show_active=true;
$scope.hide_clones = true;
$scope.n_active_hidden = 0;
......@@ -584,6 +586,33 @@ ravadaApp.directive("solShowMachine", swMach)
}
};
$scope.show_filter = function() {
$scope.hide_clones = true;
$scope.n_active_current = 0;
$scope.n_active_hidden = 0;
for (var [key, mach ] of Object.entries($scope.list_machines)) {
if ($scope.filter.length > 0) {
if ( mach.name.indexOf($scope.filter)>= 0) {
mach.show = true;
} else {
mach.show = false;
}
} else {
if (mach._level > 0 ) {
mach.show = false;
} else {
mach.show = true;
}
}
if (mach.status == 'active') {
$scope.n_active_current++;
if (!mach.show) {
$scope.n_active_hidden++;
}
}
}
};
//On load code
$scope.modalOpened=false;
$scope.rename= {new_name: 'new_name'};
......
......@@ -1188,7 +1188,7 @@ sub wait_request {
like($error,qr{^($|.*is not up|.*has ports down|nc: |Connection)});
$req->status('done');
} elsif($req->command eq 'open_exposed_ports') {
like($error,qr{^($|.*No ip in domain|.*duplicated port)});
like($error,qr{^($|.*No ip in domain|.*duplicated port|I can't get the internal IP)});
} elsif($req->command eq 'compact') {
like($error,qr{^($|.*compacted)});
} else {
......
......@@ -2,7 +2,7 @@
ng-cloak="true"
ng-controler="requestsCtrl">
<div class="row">
<div class="col-md-8">
<div class="col-md-11">
% if ($_user->can_create_machine){
<a type="button" class="btn btn-success btn-sm"
href="/new_machine.html">
......@@ -44,6 +44,9 @@
align="right"><%=l 'hide clones' %></a>
</button>
<input type="text" ng-model="filter" placeholder="<%=l 'filter' %>"
ng-change="show_filter()"
/>
<button class="btn btn-outline-warning btn-sm"
title="<%=l 'Reload' %>"
......
......@@ -146,7 +146,8 @@
}"
title ="<%=l 'Manage machine' %>">{{machine.name}}</a> {{machine.comment}}
<span class="comment" ng-show="machine.is_volatile"><%=l 'Volatile' %></span>
<button ng-show="machine.has_clones" type="button"
<button ng-show="machine.has_clones && !filter"
type="button"
class="badge badge-light text-blue"
ng-click="toggle_show_clones(machine.id)"
title="<%=l 'Show/Hide clones' %>">
......
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