Skip to content

Commit 522f917

Browse files
Mutugiiidogi
andauthored
manager: smoother reports search filters (fixes #9039) (#9053)
Co-authored-by: dogi <[email protected]>
1 parent 32a14dd commit 522f917

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "planet",
33
"license": "AGPL-3.0",
4-
"version": "0.20.12",
4+
"version": "0.20.13",
55
"myplanet": {
66
"latest": "v0.30.25",
77
"min": "v0.29.25"

src/app/manager-dashboard/reports/logs-myplanet.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export class LogsMyPlanetComponent implements OnInit {
8989

9090
filterData(filterValue: string) {
9191
this.searchValue = filterValue;
92-
this.apklogs = this.allPlanets.filter(planet => filterSpecificFields([ 'name', 'doc.code' ])(planet, filterValue));
92+
this.applyFilters();
9393
}
9494

9595
setAllPlanets(planets: any[], apklogs: any[]) {
@@ -176,7 +176,7 @@ export class LogsMyPlanetComponent implements OnInit {
176176

177177
applyFilters() {
178178
this.apklogs = this.allPlanets
179-
.filter(planet => !this.searchValue || filterSpecificFields([ 'name', 'doc.code' ])(planet, this.searchValue))
179+
.filter(planet => filterSpecificFields([ 'name', 'doc.code' ])(planet, this.searchValue))
180180
.map(planet => ({
181181
...planet,
182182
children: this.filterLogs(planet.children)

src/app/manager-dashboard/reports/reports-myplanet.component.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { attachNamesToPlanets, getDomainParams, areNoChildren } from './reports.
1212
import { findDocuments } from '../../shared/mangoQueries';
1313
import { DeviceInfoService, DeviceType } from '../../shared/device-info.service';
1414
import { CsvService } from '../../shared/csv.service';
15+
import { filterSpecificFields } from '../../shared/table-helpers';
1516

1617
@Component({
1718
templateUrl: './reports-myplanet.component.html',
@@ -170,10 +171,12 @@ export class ReportsMyPlanetComponent implements OnInit {
170171
}
171172

172173
applyFilters() {
173-
this.planets = this.allPlanets.map(planet => ({
174-
...planet,
175-
children: this.filterMyPlanetData(planet.children)
176-
}));
174+
this.planets = this.allPlanets
175+
.filter(planet => filterSpecificFields([ 'name', 'doc.code' ])(planet, this.searchValue))
176+
.map(planet => ({
177+
...planet,
178+
children: this.filterMyPlanetData(planet.children)
179+
}));
177180
this.isEmpty = areNoChildren(this.planets);
178181
}
179182

0 commit comments

Comments
 (0)