Skip to content

Commit 8315c46

Browse files
authored
Merge pull request #1507 from utmstack/backlog/add-detail-view-for-echoes
feat: add detail view for alerts in echoes component and improve aler…
2 parents e45cc54 + 0da8511 commit 8315c46

File tree

7 files changed

+53
-33
lines changed

7 files changed

+53
-33
lines changed

frontend/src/app/data-management/alert-management/shared/components/alert-description/alert-description.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div *ngIf="alertDetail" class="w-100 mt-2">
1+
<div *ngIf="alertDetail" class="w-100 mt-2 text-wrap">
22
<span class="font-weight-semibold">Summary:</span>
33
<p [innerHTML]="alertDetail" class="font-weight-light">
44
</p>

frontend/src/app/data-management/alert-management/shared/components/alert-echoes-timeline/alert-echoes-timeline.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ export class AlertEchoesTimelineComponent implements OnInit {
8585
group.startTimestamp = Math.floor(timestamps.reduce((sum, t) => sum + t, 0) / timestamps.length);
8686

8787
const rep = group.items[0] || ({} as any); // representative item
88-
console.log('group', group, rep);
8988
seriesData.push({
9089
value: [
9190
group.startTimestamp, // 0: timestamp (start of minute)

frontend/src/app/data-management/alert-management/shared/components/alert-echoes/alert-echoes.component.html

Lines changed: 36 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,29 @@
1515
</tr>
1616
</thead>
1717
<tbody *ngIf="alerts && alerts.length > 0">
18-
<ng-container *ngFor="let alert of alerts">
19-
<ng-container *ngTemplateOutlet="alertRowTemplate; context: { $implicit: alert }"></ng-container>
20-
</ng-container>
18+
<ng-container *ngFor="let alert of alerts">
19+
<ng-container *ngTemplateOutlet="alertRowTemplate; context: { $implicit: alert }"></ng-container>
20+
</ng-container>
2121
</tbody>
2222
<tbody *ngIf="(alerts && alerts.length===0) && !loading">
23-
<tr>
24-
<td [attr.colspan]="fields.length +1">
25-
<app-no-data-found></app-no-data-found>
26-
</td>
27-
</tr>
23+
<tr>
24+
<td [attr.colspan]="fields.length +1">
25+
<app-no-data-found></app-no-data-found>
26+
</td>
27+
</tr>
2828
</tbody>
2929
<tbody *ngIf="loading">
30-
<tr>
31-
<td [attr.colspan]="fields.length + 1">
32-
<div class="p-5 d-flex justify-content-center align-items-center text-blue-800">
33-
<app-utm-spinner [height]="'35px'"
34-
[label]="'Loading...'"
35-
[loading]="loading"
36-
[width]="'35px'">
37-
</app-utm-spinner>
38-
</div>
39-
</td>
40-
</tr>
30+
<tr>
31+
<td [attr.colspan]="fields.length + 1">
32+
<div class="p-5 d-flex justify-content-center align-items-center text-blue-800">
33+
<app-utm-spinner [height]="'35px'"
34+
[label]="'Loading...'"
35+
[loading]="loading"
36+
[width]="'35px'">
37+
</app-utm-spinner>
38+
</div>
39+
</td>
40+
</tr>
4141
</tbody>
4242
</table>
4343
</div>
@@ -58,14 +58,28 @@
5858
</div>
5959

6060
<ng-template #alertRowTemplate let-alert>
61-
<tr class="cursor-pointer">
61+
<tr (click)="viewDetail(alert)" class="cursor-pointer">
6262
<ng-container *ngFor="let td of fields">
6363
<td *ngIf="td.visible"
6464
[ngClass]="{'min-width': td.field === ALERT_ADVERSARY_FIELD || td.field === ALERT_TARGET_FIELD}">
65-
<app-data-field-render [data]="alert" [field]="td" [dataType]="dataType" [isEcho]="true" [showStatusChange]="true"
66-
(refreshData)="onRefreshData($event)">
65+
<app-data-field-render [data]="alert"
66+
[field]="td"
67+
[dataType]="dataType"
68+
[isEcho]="true"
69+
[showStatusChange]="true">
6770
</app-data-field-render>
6871
</td>
6972
</ng-container>
7073
</tr>
74+
<ng-container *ngIf="alert.expanded">
75+
<tr>
76+
<td class="expanded-row-detail" [attr.colspan]="fields.length + 2" >
77+
<app-alert-view-detail [isEcho]="true"
78+
[alert]="alert"
79+
[hideEmptyField]="true"
80+
[dataType]="dataType">
81+
</app-alert-view-detail>
82+
</td>
83+
</tr>
84+
</ng-container>
7185
</ng-template>

frontend/src/app/data-management/alert-management/shared/components/alert-echoes/alert-echoes.component.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {HttpResponse} from '@angular/common/http';
22
import {Component, Input, OnInit} from '@angular/core';
33
import {UtmToastService} from '../../../../../shared/alert/utm-toast.service';
44
import {
5-
ALERT_ADVERSARY_FIELD, ALERT_ECHOES_FIELDS, ALERT_PARENT_ID,
5+
ALERT_ADVERSARY_FIELD, ALERT_ECHOES_FIELDS, ALERT_FIELDS, ALERT_PARENT_ID,
66
ALERT_STATUS_FIELD_AUTO, ALERT_TAGS_FIELD,
77
ALERT_TARGET_FIELD, ALERT_TIMESTAMP_FIELD, FALSE_POSITIVE_OBJECT
88
} from '../../../../../shared/constants/alert/alert-field.constant';
@@ -94,4 +94,8 @@ export class AlertEchoesComponent implements OnInit {
9494
this.itemsPerPage = $event;
9595
this.loadChildrenAlerts();
9696
}
97+
98+
protected viewDetail(alert: UtmAlertType) {
99+
alert.expanded = !alert.expanded;
100+
}
97101
}

frontend/src/app/data-management/alert-management/shared/components/alert-view-detail/alert-view-detail.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
<app-alert-apply-note (applyNote)="refreshData.emit(true);" [alert]="alert"
9898
[showNote]="true"></app-alert-apply-note>
9999
</div>
100-
<div class="alert-details w-100 d-flex justify-content-start mb-2 ">
100+
<div *ngIf="!isEcho" class="alert-details w-100 d-flex justify-content-start mb-2 ">
101101
<span class="text-blue-800 font-weight-light has-minimum-width">Tags:</span>&nbsp;
102102
<app-alert-tags-apply (applyTagsEvent)="onApplyTags($event)"
103103
[alert]="alert"
@@ -146,8 +146,8 @@
146146
(emptyValue)="hideLastChange = $event"
147147
class=""></app-alert-view-last-change>
148148
</div>
149-
<div class="alert-details w-100 d-flex justify-content-start mb-2 align-items-start"
150-
*ngIf="alert.dataSource && (!hideEmptyField || (hideEmptyField && !incidentResponse))">
149+
<div *ngIf="alert.dataSource && (!hideEmptyField || (hideEmptyField && !incidentResponse))"
150+
class="alert-details w-100 d-flex justify-content-start mb-2 align-items-start">
151151
<span class="text-blue-800 font-weight-light has-minimum-width mr-2">Incident response:</span>&nbsp;
152152
<app-utm-console-check [hostname]="alert.dataSource"
153153
(emptyValue)="incidentResponse = $event"

frontend/src/app/data-management/alert-management/shared/components/alert-view-detail/alert-view-detail.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export class AlertViewDetailComponent implements OnInit {
4040
@Input() hideEmptyField = false;
4141
@Input() dataType: EventDataTypeEnum;
4242
@Input() tags: AlertTags[];
43+
@Input() isEcho = false;
4344
@Input() timeFilter: ElasticFilterType;
4445
@Output() refreshData = new EventEmitter<boolean>();
4546
ALERT_NAME = ALERT_NAME_FIELD;

frontend/src/app/shared/components/utm/util/utm-console-check/utm-console-check.component.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@ export class UtmConsoleCheckComponent implements OnInit {
2222
}
2323

2424
ngOnInit() {
25-
this.getAgent(this.hostname).then(value => {
26-
this.agent = value;
27-
this.canConnect = this.agent.status === AgentStatusEnum.ONLINE;
28-
this.emptyValue.emit(!this.canConnect);
29-
});
25+
this.getAgent(this.hostname)
26+
.then(value => {
27+
this.agent = value;
28+
this.canConnect = this.agent && this.agent.status === AgentStatusEnum.ONLINE;
29+
this.emptyValue.emit(!this.canConnect);
30+
})
31+
.catch(error => this.canConnect = false);
3032
}
3133

3234
getAgent(hostname: string): Promise<AgentType> {

0 commit comments

Comments
 (0)