Skip to content

Commit 240ae4b

Browse files
committed
Merge remote-tracking branch 'origin/release/v11.1.6' into release/v11.1.6
2 parents 864d2da + afed768 commit 240ae4b

11 files changed

Lines changed: 232 additions & 188 deletions

File tree

frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "7.1.0",
44
"scripts": {
55
"ng": "ng",
6-
"start": "ng serve --host 0.0.0.0",
6+
"start": "ng serve --host 0.0.0.0 --disable-host-check",
77
"build": "ng build --prod --base-href /",
88
"test": "ng test",
99
"lint": "ng lint",

frontend/src/app/app-management/app-logs/app-logs.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class AppLogsComponent implements OnInit {
2828
filters: [
2929
{field: '@timestamp', operator: ElasticOperatorsEnum.IS_BETWEEN, value: ['now-7d', 'now']},
3030
{field: 'log.containerName.keyword', operator: ElasticOperatorsEnum.IS, value: 'utmstack_backend'}
31-
], index: 'v11-log-utmstack-*', top: 10000000
31+
], index: 'v11-log-utmstack-*', top: 100000
3232
};
3333
sources = ['PANEL', 'AGENT'];
3434
types = ['ERROR', 'WARNING', 'INFO'];

frontend/src/app/data-management/alert-management/alert-full-detail/alert-full-detail.component.html

Lines changed: 155 additions & 151 deletions
Large diffs are not rendered by default.

frontend/src/app/data-management/alert-management/alert-full-detail/alert-full-detail.component.scss

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
:host {
2+
display: flex;
3+
flex-direction: column;
4+
flex: 1 1 auto;
5+
min-height: 0;
6+
height: 100%;
7+
}
8+
9+
110
.print-logo-img {
211
img {
312
width: 40px;
@@ -59,12 +68,23 @@ a {
5968
width: 1100px !important;
6069
}
6170

62-
//.w-1000 {
63-
// min-width: 1100px !important;
64-
// width: 1100px !important;
65-
// padding: 0 15px;
66-
//}
6771

6872
@media print {
69-
.page-break { page-break-inside: avoid; page-break-before: always; }
73+
:host {
74+
height: auto !important;
75+
min-height: auto !important;
76+
}
77+
78+
.overflow-auto {
79+
overflow: visible !important;
80+
}
81+
82+
.h-100 {
83+
height: auto !important;
84+
}
85+
86+
.d-flex {
87+
display: block !important;
88+
}
7089
}
90+

frontend/src/app/data-management/alert-management/alert-full-detail/alert-full-detail.component.ts

Lines changed: 39 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {HttpResponse} from '@angular/common/http';
2-
import {Component, OnInit} from '@angular/core';
2+
import {ChangeDetectorRef, Component, OnInit} from '@angular/core';
33
import {DomSanitizer} from '@angular/platform-browser';
44
import {ActivatedRoute, Router} from '@angular/router';
55
import * as moment from 'moment';
@@ -37,6 +37,7 @@ import {AlertDetailTabEnum} from '../shared/components/alert-view-detail/alert-v
3737
import {AlertHistoryActionEnum} from '../shared/enums/alert-history-action.enum';
3838
import {EventDataTypeEnum} from '../shared/enums/event-data-type.enum';
3939
import {AlertTagService} from '../shared/services/alert-tag.service';
40+
import {finalize} from "rxjs/operators";
4041

4142
@Component({
4243
selector: 'app-alert-full-detail',
@@ -100,11 +101,11 @@ export class AlertFullDetailComponent implements OnInit {
100101
private accountService: AccountService,
101102
private alertTagService: AlertTagService,
102103
private themeChangeBehavior: ThemeChangeBehavior,
103-
private activatedRoute: ActivatedRoute) {
104+
private activatedRoute: ActivatedRoute,
105+
private cdr: ChangeDetectorRef) {
104106
}
105107

106108
ngOnInit() {
107-
this.spinner.show('alertDetail');
108109
this.activatedRoute.params.subscribe(params => {
109110
this.alertId = params.id;
110111
if (this.alertId) {
@@ -139,31 +140,42 @@ export class AlertFullDetailComponent implements OnInit {
139140

140141
searchAlert() {
141142
this.elasticDataService.search(1, 1, 1, DataNatureTypeEnum.ALERT, this.filterAlert)
142-
.subscribe(reponse => {
143-
this.alert = reponse.body[0];
144-
this.loadingAlert = false;
145-
if (this.alert) {
146-
this.logs = this.alert.logs;
143+
.pipe(finalize(() => this.loadingAlert = false))
144+
.subscribe({
145+
next: response => {
146+
this.alert = response.body[0];
147+
148+
if (!this.alert) {
149+
this.noAlertFound = true;
150+
return;
151+
}
152+
153+
this.logs = this.alert.events || [];
154+
this.log = this.alert.lastEvent || null;
147155
this.countRelatedEvents = this.logs.length;
156+
148157
const ref = this.alert.reference;
149-
this.reference = (ref && typeof ref !== 'string') ? ref : [];
158+
this.reference = Array.isArray(ref) ? ref : [];
159+
150160
this.relatedTagsRules = this.alert.tagRulesApplied;
161+
151162
this.filterEvent = [{
152163
field: 'id',
153164
operator: ElasticOperatorsEnum.IS_ONE_OF,
154-
value: this.alert.logs.reverse().slice(0, 100)
165+
value: [...this.alert.events].reverse().slice(0, 100)
155166
}];
156-
this.resolveDataType().then(type => {
157-
this.dataType = type;
158-
});
159-
this.searchLastLog();
167+
168+
this.resolveDataType().then(type => this.dataType = type);
169+
160170
this.searchEventByAlert();
161-
} else {
162-
this.noAlertFound = true;
171+
},
172+
error: () => {
173+
this.spinner.hide('alertDetail');
163174
}
164175
});
165176
}
166177

178+
167179
resolveDataType(): Promise<EventDataTypeEnum> {
168180
return new Promise<EventDataTypeEnum>(resolve => {
169181
resolve(EventDataTypeEnum.ALERT);
@@ -172,13 +184,19 @@ export class AlertFullDetailComponent implements OnInit {
172184

173185
searchEventByAlert() {
174186
this.elasticDataService.search(1, 100, 100, DataNatureTypeEnum.EVENT, this.filterEvent)
175-
.subscribe(reponse => {
176-
this.rows = reponse.body;
177-
this.loadingEvents = false;
178-
this.spinner.hide('alertDetail');
187+
.pipe(finalize(() => this.spinner.hide('alertDetail')))
188+
.subscribe({
189+
next: response => {
190+
this.rows = response.body;
191+
this.loadingEvents = false;
192+
},
193+
error: () => {
194+
this.loadingEvents = false;
195+
}
179196
});
180197
}
181198

199+
182200
print() {
183201
this.printFormat = true;
184202
setTimeout(() => {
@@ -245,7 +263,7 @@ export class AlertFullDetailComponent implements OnInit {
245263
this.elasticDataService.search(1, 1,
246264
1, LOG_INDEX_PATTERN, filter).subscribe(
247265
(res: HttpResponse<any>) => {
248-
this.log = res.body[0];
266+
this.log = res.body[0] || null;
249267
this.getLastLog = false;
250268
},
251269
(res: HttpResponse<any>) => {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,8 @@ <h5 class="card-title mb-0 text-uppercase label-header">
154154
[pageSize]="itemsPerPage"
155155
[rotate]="true"
156156
[size]="'sm'"></ngb-pagination>
157-
<app-utm-items-per-page (itemsInPage)="onItemsPerPageChange($event)"
157+
<app-utm-items-per-page [itemsAmount]="itemsPerPage"
158+
(itemsInPage)="onItemsPerPageChange($event)"
158159
class="ml-3">
159160
</app-utm-items-per-page>
160161
</div>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export class AlertViewComponent implements OnInit, OnDestroy {
104104
viewAlertDetail: boolean;
105105
totalItems: any;
106106
page = 1;
107-
itemsPerPage = ITEMS_PER_PAGE;
107+
itemsPerPage = ITEMS_PER_PAGE * 4;
108108
filters: ElasticFilterType[] = [
109109
{field: ALERT_STATUS_FIELD_AUTO, operator: ElasticOperatorsEnum.IS_NOT, value: AUTOMATIC_REVIEW},
110110
{field: ALERT_TAGS_FIELD, operator: ElasticOperatorsEnum.IS_NOT, value: FALSE_POSITIVE_OBJECT.tagName},

frontend/src/app/rule-management/app-rule/components/rule-list/rule-list.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
<i (click)="activeRule(rule)"
4646
class="cursor-pointer ml-2"
4747
[ngClass]="{'icon-blocked': rule.ruleActive, 'icon-check2': !rule.ruleActive}"
48-
ngbTooltip="{{ !rule.ruleActive ? 'Active' : 'Deactivate' }}"
48+
ngbTooltip="{{ !rule.ruleActive ? 'Activate' : 'Deactivate' }}"
4949
container="body"
5050
*ngIf="!loadingRules.includes(rule.id);else spinner"
5151
placement="left"></i>

frontend/src/app/rule-management/app-rule/components/rule-list/rule-list.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,9 @@ export class RuleListComponent implements OnInit, OnDestroy {
154154
};
155155
this.loadingRules.push(rule.id);
156156
const index = this.loadingRules.length - 1;
157-
this.ruleService.activeRule(params).pipe(
158-
finalize(() => this.loadingRules.splice(index, 1))
159-
)
157+
this.ruleService.activeRule(params)
158+
.pipe(
159+
finalize(() => this.loadingRules.splice(index, 1)))
160160
.subscribe(() => this.ruleService.notifyRefresh(true),
161161
() => {
162162
this.utmToast.showError('Error', 'Error changing rule status');

frontend/src/app/shared/types/alert/utm-alert.type.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export class UtmAlertType {
3232
hasChildren: boolean;
3333
expanded: boolean;
3434
echoes: number;
35+
lastEvent: any;
3536
}
3637

3738
export enum AlertStatusLabelEnum {

0 commit comments

Comments
 (0)