Github user simonellistonball commented on a diff in the pull request:

    https://github.com/apache/metron/pull/788#discussion_r143158180
  
    --- Diff: 
metron-interface/metron-alerts/src/app/alerts/alert-details/alert-details.component.ts
 ---
    @@ -133,6 +173,40 @@ export class AlertDetailsComponent implements OnInit {
         });
       }
     
    +  onAddComment() {
    +    let alertComment = new AlertComment(this.alertCommentStr, 
this.authenticationService.getCurrentUserName(), new Date().getTime());
    +    let tAlertComments = this.alertCommentsWrapper.map(alertsWrapper => 
alertsWrapper.alertComment);
    +    tAlertComments.unshift(alertComment);
    +    this.patchAlert(new Patch('add', '/comments', tAlertComments));
    +  }
    +
    +  patchAlert(patch: Patch) {
    +    let patchRequest = new PatchRequest();
    +    patchRequest.guid = this.alertSource.guid;
    +    patchRequest.index = this.alertIndex;
    +    patchRequest.patch = [patch];
    +    patchRequest.sensorType = this.alertSourceType;
    +
    +    this.updateService.patch(patchRequest).subscribe(() => {
    +      this.getData();
    +    });
    +  }
    +
    +  onDeleteComment(index: number) {
    +    let commentText =  'Do you wish to delete the comment ';
    +    if (this.alertCommentsWrapper[index].alertComment.comment.length > 25 
) {
    +      commentText += ' \'' + 
this.alertCommentsWrapper[index].alertComment.comment.substr(0, 25) + '...\'';
    +    } else {
    +      commentText += ' \'' + 
this.alertCommentsWrapper[index].alertComment.comment + '\'';
    +    }
    +
    +    
this.metronDialogBox.showConfirmationMessage(commentText).subscribe(response => 
{
    +      if (response) {
    +        this.alertCommentsWrapper.splice(index, 1);
    +        this.patchAlert(new Patch('add', '/comments', 
this.alertCommentsWrapper.map(alertsWrapper => alertsWrapper.alertComment)));
    --- End diff --
    
    In the short term, we could just consider this an unanalysed field, and not 
have comments searchable, no? 
    
    In terms of doing it properly, we already have the nested field issue with 
the meta-alerts concept, so reusing the same coping mechanisms seems viable.


---

Reply via email to