Skip to content

Commit 7946170

Browse files
committed
refactor(action-sidebar): improve layout and optimize scroll handling
Signed-off-by: Manuel Abascal <mjabascal10@gmail.com>
1 parent f116e9f commit 7946170

3 files changed

Lines changed: 15 additions & 38 deletions

File tree

frontend/src/app/incident-response/shared/component/action-sidebar/action-sidebar.component.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</label>
77
</div>
88

9-
<div class="card-body d-flex flex-column p-0 flex-grow-1">
9+
<div class="card-body d-flex flex-column p-0 flex-grow-1 m-h-0">
1010
<!-- search -->
1111
<div class="p-2">
1212
<app-utm-search-input (searchFor)="searchReport($event)"
@@ -21,9 +21,8 @@
2121
<div class="d-flex px-2 flex-column h-100 m-h-0">
2222
<div infiniteScroll
2323
(scrolled)="onScroll()"
24-
[fromRoot]="true"
2524
[infiniteScrollDistance]="1"
26-
[infiniteScrollThrottle]="80"
25+
[infiniteScrollThrottle]="150"
2726
[scrollWindow]="false"
2827
class="px-1 pb-0 mb-1 overflow-auto flex-grow-1">
2928
<div *ngFor="let action of actionSidebarService.actionTemplates$ | async; trackBy: trackByFn; let last = last"
@@ -40,7 +39,6 @@
4039
</div>
4140
</div>
4241
</div>
43-
4442
</div>
4543
<app-utm-spinner *ngIf="actionSidebarService.loading$ | async as loading"
4644
class="position-absolute top-50 right-35"

frontend/src/app/incident-response/shared/component/action-sidebar/action-sidebar.component.spec.ts

Lines changed: 0 additions & 25 deletions
This file was deleted.

frontend/src/app/incident-response/shared/component/action-sidebar/action-sidebar.component.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import {Component, OnDestroy, OnInit} from '@angular/core';
22
import {NgbModal} from '@ng-bootstrap/ng-bootstrap';
3+
import {last} from 'rxjs/operators';
34
import {WorkflowActionsService} from '../../services/workflow-actions.service';
45
import {ActionTerminalComponent} from '../action-terminal/action-terminal.component';
56
import {ActionSidebarService} from './action-sidebar.service';
6-
import {last} from "rxjs/operators";
77

88
@Component({
99
selector: 'app-action-sidebar',
@@ -12,17 +12,18 @@ import {last} from "rxjs/operators";
1212
})
1313
export class ActionSidebarComponent implements OnInit, OnDestroy {
1414

15+
constructor(private workFlowActionService: WorkflowActionsService,
16+
public actionSidebarService: ActionSidebarService,
17+
private modalService: NgbModal) { }
18+
1519
request = {
1620
page: 0,
1721
size: 10,
1822
'systemOwner.equals': true
1923
};
2024

2125
searching: any;
22-
23-
constructor(private workFlowActionService: WorkflowActionsService,
24-
public actionSidebarService: ActionSidebarService,
25-
private modalService: NgbModal) { }
26+
readonly last = last;
2627

2728
ngOnInit() {
2829
this.actionSidebarService.loadData({
@@ -56,9 +57,14 @@ export class ActionSidebarComponent implements OnInit, OnDestroy {
5657
}
5758

5859
onScroll() {
59-
this.actionSidebarService.loadData({
60+
61+
this.request = {
6062
...this.request,
61-
size: this.request.size + 10,
63+
size: this.request.size + 10
64+
};
65+
66+
this.actionSidebarService.loadData({
67+
...this.request
6268
});
6369
}
6470

@@ -69,6 +75,4 @@ export class ActionSidebarComponent implements OnInit, OnDestroy {
6975
ngOnDestroy() {
7076
this.actionSidebarService.reset();
7177
}
72-
73-
protected readonly last = last;
7478
}

0 commit comments

Comments
 (0)