Skip to content

Commit f116e9f

Browse files
authored
Merge pull request #1380 from utmstack/backlog/alert_false_positive_tag
fix[frontend](alert_management): marked as false positive on create false positive tag rule
2 parents e1c4962 + ea73c2e commit f116e9f

4 files changed

Lines changed: 13 additions & 7 deletions

File tree

frontend/src/app/data-management/alert-management/shared/components/alert-actions/alert-apply-tags/alert-tags-apply.component.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
<ng-container *ngIf="template === 'default'">
32
<div [ngbTooltip]="selected.length>0?selected.toString():null"
43
placement="auto"
@@ -26,7 +25,7 @@
2625
</ng-container>
2726

2827
<ng-container *ngIf="template === 'menu-item'">
29-
<a [ngClass]="action.background" class="span-small-icon" (click)="addNewTagRule()">
28+
<a [ngClass]="action.background" class="span-small-icon" (click)="addNewTagRule(true)">
3029
<i [ngClass]="action.icon"></i>&nbsp;
3130
{{ action.label }}
3231
</a>

frontend/src/app/data-management/alert-management/shared/components/alert-actions/alert-apply-tags/alert-tags-apply.component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {AlertTags} from '../../../../../../shared/types/alert/alert-tag.type';
44
import {UtmAlertType} from '../../../../../../shared/types/alert/utm-alert.type';
55
import {AlertUpdateTagBehavior} from '../../../behavior/alert-update-tag.behavior';
66
import {AlertRuleCreateComponent} from '../../alert-rule-create/alert-rule-create.component';
7+
import { FALSE_POSITIVE_OBJECT } from 'src/app/shared/constants/alert/alert-field.constant';
78

89
@Component({
910
selector: 'app-alert-tags-apply',
@@ -51,10 +52,11 @@ export class AlertTagsApplyComponent implements OnInit, OnChanges {
5152
}
5253
}
5354

54-
addNewTagRule() {
55+
addNewTagRule(isFalsePositive: boolean = false) {
5556
const modalRef = this.modalService.open(AlertRuleCreateComponent, {centered: true, size: 'lg'});
5657
modalRef.componentInstance.alert = this.alert;
5758
modalRef.componentInstance.action = 'select';
59+
modalRef.componentInstance.isFalsePositiveRule = isFalsePositive;
5860
modalRef.componentInstance.ruleAdd.subscribe((created) => {
5961
this.icon = this.getTagIcon();
6062
this.color = this.getColor();

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ import {AlertActionRefreshService} from "../../services/alert-action-refresh.ser
6363
export class AlertRuleCreateComponent implements OnInit, OnDestroy {
6464
@Input() alert: UtmAlertType;
6565
@Input() isForComplete = false;
66+
@Input() isFalsePositiveRule = false;
6667
@Input() action: 'create' | 'update' | 'select' = 'create';
6768
@Input() rule: AlertRuleType;
6869
@Output() ruleAdd = new EventEmitter<AlertRuleType>();
@@ -159,10 +160,14 @@ export class AlertRuleCreateComponent implements OnInit, OnDestroy {
159160
});
160161

161162
if (this.rule) {
162-
this.filters = [... this.rule.conditions];
163+
this.filters = [...this.rule.conditions];
163164
this.selected = this.rule.tags.length > 0 ? [...this.rule.tags] : [];
164165
}
165166

167+
if (this.isFalsePositiveRule) {
168+
this.selected.push(FALSE_POSITIVE_OBJECT);
169+
}
170+
166171
this.alerts$ = this.alertService.onRefresh$
167172
.pipe(
168173
takeUntil(this.destroy$),
@@ -362,7 +367,7 @@ export class AlertRuleCreateComponent implements OnInit, OnDestroy {
362367
}
363368

364369
isFalsePositive() {
365-
return this.selected.findIndex(value => value.tagName.includes('False positive')) !== -1;
370+
return this.isFalsePositiveRule || this.selected.findIndex(value => value.tagName.includes('False positive')) !== -1;
366371
}
367372

368373
getOperators(conditionField: string) {

frontend/src/environments/environment.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
export const environment = {
66
production: false,
7-
//SERVER_API_URL: 'https://192.168.1.18/',
8-
SERVER_API_URL: 'http://localhost:8080/',
7+
SERVER_API_URL: 'https://192.168.1.18/',
8+
// SERVER_API_URL: 'http://localhost:8080/',
99
SERVER_API_CONTEXT: '',
1010
SESSION_AUTH_TOKEN: window.location.host.split(':')[0].toLocaleUpperCase(),
1111
WEBSOCKET_URL: '//localhost:8080',

0 commit comments

Comments
 (0)