Skip to content

Commit 6e581f1

Browse files
authored
Merge pull request #871 from utmstack/bugfix/v10.5.12/870-bug-error-on-server-when-sorting-by-severity
fix: error on server when sorting by severity column in threat Management/Alerts view
2 parents 70e5488 + e111f82 commit 6e581f1

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

CHANGELOG.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# UTMStack 10.5.12 Release Notes
1+
# UTMStack 10.5.13 Release Notes
22
## Bugfix
3-
- Implemented validation checks during the user deletion process to prevent the deletion of the last admin user. This ensures that at least one admin user remains in the system, maintaining the integrity of the authentication process.
3+
- Error on server when sorting by severity column in threat Management/Alerts view.

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

+12-6
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ import {AlertManagementService} from '../shared/services/alert-management.servic
5454
import {AlertTagService} from '../shared/services/alert-tag.service';
5555
import {getCurrentAlertStatus, getStatusName} from '../shared/util/alert-util-function';
5656
import {CheckEmailConfigService, ParamShortType} from '../../../shared/services/util/check-email-config.service';
57+
import {Subject} from "rxjs";
58+
import {takeUntil} from "rxjs/operators";
5759

5860
@Component({
5961
selector: 'app-alert-view',
@@ -102,28 +104,24 @@ export class AlertViewComponent implements OnInit, OnDestroy {
102104
refreshingAlert = false;
103105
firstLoad = true;
104106
tags: AlertTags[];
107+
destroy$ = new Subject<void>();
105108

106109
constructor(private elasticDataService: ElasticDataService,
107110
private modalService: NgbModal,
108111
private utmToastService: UtmToastService,
109112
private translate: TranslateService,
110-
private alertServiceManagement: AlertManagementService,
111113
private alertFiltersBehavior: AlertFiltersBehavior,
112114
private updateStatusServiceBehavior: AlertStatusBehavior,
113115
private activatedRoute: ActivatedRoute,
114116
public router: Router,
115117
private newAlertBehavior: NewAlertBehavior,
116-
private alertUpdateTagBehavior: AlertUpdateTagBehavior,
117118
private alertDataTypeBehavior: AlertDataTypeBehavior,
118119
private alertTagService: AlertTagService,
119120
private spinner: NgxSpinnerService,
120121
private checkEmailConfigService: CheckEmailConfigService) {
121122
// this.tableWidth = this.pageWidth - 300;
122123
}
123124

124-
ngOnDestroy(): void {
125-
}
126-
127125
ngOnInit() {
128126
this.checkEmailConfigService.check(ParamShortType.Alert);
129127
this.setInitialWidth();
@@ -166,7 +164,9 @@ export class AlertViewComponent implements OnInit, OnDestroy {
166164
this.alertFiltersBehavior.$filters.next(this.filters);
167165
}
168166
});
169-
this.newAlertBehavior.$alertChange.subscribe(newAlerts => {
167+
this.newAlertBehavior.$alertChange
168+
.pipe(takeUntil(this.destroy$))
169+
.subscribe(newAlerts => {
170170
if (newAlerts && newAlerts !== 0) {
171171
this.incomingAlert = newAlerts;
172172
}
@@ -318,6 +318,7 @@ export class AlertViewComponent implements OnInit, OnDestroy {
318318
this.refreshingAlert = false;
319319
},
320320
(res: HttpResponse<any>) => {
321+
this.utmToastService.showError('Error', 'An error occurred while listing the alerts. Please try again later.');
321322
}
322323
);
323324
}
@@ -549,4 +550,9 @@ export class AlertViewComponent implements OnInit, OnDestroy {
549550
const modal = this.modalService.open(IrCreateRuleComponent, {size: 'lg', centered: true});
550551
modal.componentInstance.alert = alert;
551552
}
553+
554+
ngOnDestroy(): void {
555+
this.destroy$.next();
556+
this.destroy$.complete();
557+
}
552558
}

frontend/src/app/shared/constants/alert/alert-field.constant.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export const ALERT_FIELDS: UtmFieldType[] = [
8181
{
8282
label: 'Severity',
8383
field: ALERT_SEVERITY_FIELD_LABEL,
84-
type: ElasticDataTypesEnum.NUMBER,
84+
type: ElasticDataTypesEnum.STRING,
8585
visible: true,
8686
},
8787
{

version.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version: 10.5.12
1+
version: 10.5.13

0 commit comments

Comments
 (0)