Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

<ng-container *ngIf="template === 'default'">
<div [ngbTooltip]="selected.length>0?selected.toString():null"
placement="auto"
Expand Down Expand Up @@ -26,7 +25,7 @@
</ng-container>

<ng-container *ngIf="template === 'menu-item'">
<a [ngClass]="action.background" class="span-small-icon" (click)="addNewTagRule()">
<a [ngClass]="action.background" class="span-small-icon" (click)="addNewTagRule(true)">
<i [ngClass]="action.icon"></i>&nbsp;
{{ action.label }}
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {AlertTags} from '../../../../../../shared/types/alert/alert-tag.type';
import {UtmAlertType} from '../../../../../../shared/types/alert/utm-alert.type';
import {AlertUpdateTagBehavior} from '../../../behavior/alert-update-tag.behavior';
import {AlertRuleCreateComponent} from '../../alert-rule-create/alert-rule-create.component';
import { FALSE_POSITIVE_OBJECT } from 'src/app/shared/constants/alert/alert-field.constant';

@Component({
selector: 'app-alert-tags-apply',
Expand Down Expand Up @@ -51,10 +52,11 @@ export class AlertTagsApplyComponent implements OnInit, OnChanges {
}
}

addNewTagRule() {
addNewTagRule(isFalsePositive: boolean = false) {
const modalRef = this.modalService.open(AlertRuleCreateComponent, {centered: true, size: 'lg'});
modalRef.componentInstance.alert = this.alert;
modalRef.componentInstance.action = 'select';
modalRef.componentInstance.isFalsePositiveRule = isFalsePositive;
modalRef.componentInstance.ruleAdd.subscribe((created) => {
this.icon = this.getTagIcon();
this.color = this.getColor();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ import {AlertActionRefreshService} from "../../services/alert-action-refresh.ser
export class AlertRuleCreateComponent implements OnInit, OnDestroy {
@Input() alert: UtmAlertType;
@Input() isForComplete = false;
@Input() isFalsePositiveRule = false;
@Input() action: 'create' | 'update' | 'select' = 'create';
@Input() rule: AlertRuleType;
@Output() ruleAdd = new EventEmitter<AlertRuleType>();
Expand Down Expand Up @@ -159,10 +160,14 @@ export class AlertRuleCreateComponent implements OnInit, OnDestroy {
});

if (this.rule) {
this.filters = [... this.rule.conditions];
this.filters = [...this.rule.conditions];
this.selected = this.rule.tags.length > 0 ? [...this.rule.tags] : [];
}

if (this.isFalsePositiveRule) {
this.selected.push(FALSE_POSITIVE_OBJECT);
}

this.alerts$ = this.alertService.onRefresh$
.pipe(
takeUntil(this.destroy$),
Expand Down Expand Up @@ -362,7 +367,7 @@ export class AlertRuleCreateComponent implements OnInit, OnDestroy {
}

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

getOperators(conditionField: string) {
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/environments/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

export const environment = {
production: false,
//SERVER_API_URL: 'https://192.168.1.18/',
SERVER_API_URL: 'http://localhost:8080/',
SERVER_API_URL: 'https://192.168.1.18/',
// SERVER_API_URL: 'http://localhost:8080/',
SERVER_API_CONTEXT: '',
SESSION_AUTH_TOKEN: window.location.host.split(':')[0].toLocaleUpperCase(),
WEBSOCKET_URL: '//localhost:8080',
Expand Down