You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@metron.apache.org by iraghumitra <gi...@git.apache.org> on 2017/10/05 09:46:02 UTC
[GitHub] metron pull request #787: METRON-1232: Alert status changes are not reflecte...
GitHub user iraghumitra opened a pull request:
https://github.com/apache/metron/pull/787
METRON-1232: Alert status changes are not reflected in list view
## Contributor Comments
The Jira has all the description of the issue.
In addition, the e2e test for removing search chip was consistently failing provided a small fix for it.
## Steps to reproduce the problem
- Login to alerts UI
- Click on the pause button for alerts polling
- Select an alert, this will open the details pane for the selected alert
- Change the Alerts status by selecting the button on the top (Ex: ESCALATE, NEW, OPEN etc)
- Close the deatils pane by clicking on the close icon
- Thought the status of alert is persisted, the status field in list view is not updated (This is fixed in the PR)
## Pull Request Checklist
Thank you for submitting a contribution to Apache Metron.
Please refer to our [Development Guidelines](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=61332235) for the complete guide to follow for contributions.
Please refer also to our [Build Verification Guidelines](https://cwiki.apache.org/confluence/display/METRON/Verifying+Builds?show-miniview) for complete smoke testing guides.
In order to streamline the review of the contribution we ask you follow these guidelines and ask you to double check the following:
### For all changes:
- [x] Is there a JIRA ticket associated with this PR? If not one needs to be created at [Metron Jira](https://issues.apache.org/jira/browse/METRON/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel).
- [x] Does your PR title start with METRON-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
- [x] Has your PR been rebased against the latest commit within the target branch (typically master)?
### For code changes:
- [x] Have you included steps to reproduce the behavior or problem that is being changed or addressed?
- [x] Have you included steps or a guide to how the change may be verified and tested manually?
- [x] Have you ensured that the full suite of tests and checks have been executed in the root metron folder via:
```
mvn -q clean integration-test install && build_utils/verify_licenses.sh
```
- [ ] Have you written or updated unit tests and or integration tests to verify your changes?
- [x] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)?
- [x] Have you verified the basic functionality of the build by building and running locally with Vagrant full-dev environment or the equivalent?
### For documentation related changes:
- [x] Have you ensured that format looks appropriate for the output in which it is rendered by building and verifying the site-book? If not then run the following commands and the verify changes via `site-book/target/site/index.html`:
```
cd site-book
mvn site
```
#### Note:
Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.
It is also recommended that [travis-ci](https://travis-ci.org) is set up for your personal repository such that your branches are built there before submitting a pull request.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/iraghumitra/incubator-metron METRON-1232
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/metron/pull/787.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #787
----
commit 759373eed1a39e277596721c77d6290ffdaeca18
Author: iraghumitra <ra...@gmail.com>
Date: 2017-10-05T09:34:53Z
Fixed issue with table update after alert details are changed.
----
---
[GitHub] metron pull request #787: METRON-1232: Alert status changes are not reflecte...
Posted by iraghumitra <gi...@git.apache.org>.
Github user iraghumitra closed the pull request at:
https://github.com/apache/metron/pull/787
---
[GitHub] metron pull request #787: METRON-1232: Alert status changes are not reflecte...
Posted by iraghumitra <gi...@git.apache.org>.
GitHub user iraghumitra reopened a pull request:
https://github.com/apache/metron/pull/787
METRON-1232: Alert status changes are not reflected in list view
## Contributor Comments
The Jira has all the description of the issue.
In addition, the e2e test for removing search chip was consistently failing provided a small fix for it.
## Steps to reproduce the problem
- Login to alerts UI
- Click on the pause button for alerts polling
- Select an alert, this will open the details pane for the selected alert
- Change the Alerts status by selecting the button on the top (Ex: ESCALATE, NEW, OPEN etc)
- Close the deatils pane by clicking on the close icon
- Thought the status of alert is persisted, the status field in list view is not updated (This is fixed in the PR)
## Pull Request Checklist
Thank you for submitting a contribution to Apache Metron.
Please refer to our [Development Guidelines](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=61332235) for the complete guide to follow for contributions.
Please refer also to our [Build Verification Guidelines](https://cwiki.apache.org/confluence/display/METRON/Verifying+Builds?show-miniview) for complete smoke testing guides.
In order to streamline the review of the contribution we ask you follow these guidelines and ask you to double check the following:
### For all changes:
- [x] Is there a JIRA ticket associated with this PR? If not one needs to be created at [Metron Jira](https://issues.apache.org/jira/browse/METRON/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel).
- [x] Does your PR title start with METRON-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
- [x] Has your PR been rebased against the latest commit within the target branch (typically master)?
### For code changes:
- [x] Have you included steps to reproduce the behavior or problem that is being changed or addressed?
- [x] Have you included steps or a guide to how the change may be verified and tested manually?
- [x] Have you ensured that the full suite of tests and checks have been executed in the root metron folder via:
```
mvn -q clean integration-test install && build_utils/verify_licenses.sh
```
- [ ] Have you written or updated unit tests and or integration tests to verify your changes?
- [x] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)?
- [x] Have you verified the basic functionality of the build by building and running locally with Vagrant full-dev environment or the equivalent?
### For documentation related changes:
- [x] Have you ensured that format looks appropriate for the output in which it is rendered by building and verifying the site-book? If not then run the following commands and the verify changes via `site-book/target/site/index.html`:
```
cd site-book
mvn site
```
#### Note:
Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.
It is also recommended that [travis-ci](https://travis-ci.org) is set up for your personal repository such that your branches are built there before submitting a pull request.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/iraghumitra/incubator-metron METRON-1232
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/metron/pull/787.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #787
----
commit 759373eed1a39e277596721c77d6290ffdaeca18
Author: iraghumitra <ra...@gmail.com>
Date: 2017-10-05T09:34:53Z
Fixed issue with table update after alert details are changed.
----
---
[GitHub] metron pull request #787: METRON-1232: Alert status changes are not reflecte...
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/metron/pull/787
---
[GitHub] metron pull request #787: METRON-1232: Alert status changes are not reflecte...
Posted by iraghumitra <gi...@git.apache.org>.
Github user iraghumitra commented on a diff in the pull request:
https://github.com/apache/metron/pull/787#discussion_r143731034
--- Diff: metron-interface/metron-alerts/src/app/shared/directives/alert-search.directive.ts ---
@@ -130,7 +130,7 @@ export class AlertSearchDirective implements AfterViewInit, OnChanges {
private handleMouseEvent (callback: Function) {
clearTimeout(this.mouseEventTimer);
- this.mouseEventTimer = setTimeout(() => { callback(); }, 500);
+ this.mouseEventTimer = setTimeout(() => { callback(); }, 100);
--- End diff --
yeah i feel this is making some of the flaky tests stable, especially the ones where we hover on search text and delete them
---
[GitHub] metron issue #787: METRON-1232: Alert status changes are not reflected in li...
Posted by iraghumitra <gi...@git.apache.org>.
Github user iraghumitra commented on the issue:
https://github.com/apache/metron/pull/787
@nickwallen @mmiklavc @merrimanr replies are inline in the review
---
[GitHub] metron issue #787: METRON-1232: Alert status changes are not reflected in li...
Posted by merrimanr <gi...@git.apache.org>.
Github user merrimanr commented on the issue:
https://github.com/apache/metron/pull/787
+1
---
[GitHub] metron pull request #787: METRON-1232: Alert status changes are not reflecte...
Posted by iraghumitra <gi...@git.apache.org>.
Github user iraghumitra commented on a diff in the pull request:
https://github.com/apache/metron/pull/787#discussion_r144372796
--- Diff: metron-interface/metron-alerts/src/app/service/update.service.ts ---
@@ -32,13 +33,31 @@ export class UpdateService {
defaultHeaders = {'Content-Type': 'application/json', 'X-Requested-With': 'XMLHttpRequest'};
+ alertChangedSource = new Subject<PatchRequest>();
+ alertChanged$ = this.alertChangedSource.asObservable();
constructor(private http: Http) { }
public patch(patchRequest: PatchRequest): Observable<{}> {
let url = '/api/v1/update/patch';
- return this.http.patch(url, patchRequest, new RequestOptions({headers: new Headers(this.defaultHeaders)}))
- .catch(HttpUtil.handleError);
+ let observable = Observable.create((observer => {
--- End diff --
@merrimanr removed the extra observable made change similar to your suggestion
---
[GitHub] metron pull request #787: METRON-1232: Alert status changes are not reflecte...
Posted by iraghumitra <gi...@git.apache.org>.
Github user iraghumitra commented on a diff in the pull request:
https://github.com/apache/metron/pull/787#discussion_r143771524
--- Diff: metron-interface/metron-alerts/src/app/shared/directives/alert-search.directive.ts ---
@@ -130,7 +130,7 @@ export class AlertSearchDirective implements AfterViewInit, OnChanges {
private handleMouseEvent (callback: Function) {
clearTimeout(this.mouseEventTimer);
- this.mouseEventTimer = setTimeout(() => { callback(); }, 500);
+ this.mouseEventTimer = setTimeout(() => { callback(); }, 100);
--- End diff --
@nickwallen The status check was getting checked implicitly when we assert the table data. NowI added a explicit assert as well
---
[GitHub] metron issue #787: METRON-1232: Alert status changes are not reflected in li...
Posted by mmiklavc <gi...@git.apache.org>.
Github user mmiklavc commented on the issue:
https://github.com/apache/metron/pull/787
+1
---
[GitHub] metron pull request #787: METRON-1232: Alert status changes are not reflecte...
Posted by nickwallen <gi...@git.apache.org>.
Github user nickwallen commented on a diff in the pull request:
https://github.com/apache/metron/pull/787#discussion_r143535792
--- Diff: metron-interface/metron-alerts/src/app/shared/directives/alert-search.directive.ts ---
@@ -130,7 +130,7 @@ export class AlertSearchDirective implements AfterViewInit, OnChanges {
private handleMouseEvent (callback: Function) {
clearTimeout(this.mouseEventTimer);
- this.mouseEventTimer = setTimeout(() => { callback(); }, 500);
+ this.mouseEventTimer = setTimeout(() => { callback(); }, 100);
--- End diff --
Was this change intentional?
---
[GitHub] metron pull request #787: METRON-1232: Alert status changes are not reflecte...
Posted by merrimanr <gi...@git.apache.org>.
Github user merrimanr commented on a diff in the pull request:
https://github.com/apache/metron/pull/787#discussion_r144306688
--- Diff: metron-interface/metron-alerts/src/app/service/update.service.ts ---
@@ -32,13 +33,31 @@ export class UpdateService {
defaultHeaders = {'Content-Type': 'application/json', 'X-Requested-With': 'XMLHttpRequest'};
+ alertChangedSource = new Subject<PatchRequest>();
+ alertChanged$ = this.alertChangedSource.asObservable();
constructor(private http: Http) { }
public patch(patchRequest: PatchRequest): Observable<{}> {
let url = '/api/v1/update/patch';
- return this.http.patch(url, patchRequest, new RequestOptions({headers: new Headers(this.defaultHeaders)}))
- .catch(HttpUtil.handleError);
+ let observable = Observable.create((observer => {
--- End diff --
I'm not suggesting we move the alertChangedSource call to all the subscribing components. Instead you can move that call to a map function similar to:
```
this.http.patch(url, patchRequest, new RequestOptions({headers: new Headers(this.defaultHeaders)}))
.catch(HttpUtil.handleError)
.map(res => {
this.alertChangedSource.next(patchRequest);
return res;
}
.subscribe(result => reqCompleted(result));
```
---
[GitHub] metron issue #787: METRON-1232: Alert status changes are not reflected in li...
Posted by james-sirota <gi...@git.apache.org>.
Github user james-sirota commented on the issue:
https://github.com/apache/metron/pull/787
+ 1 from me as well pending the completion of the Travis build
---
[GitHub] metron pull request #787: METRON-1232: Alert status changes are not reflecte...
Posted by iraghumitra <gi...@git.apache.org>.
Github user iraghumitra commented on a diff in the pull request:
https://github.com/apache/metron/pull/787#discussion_r143772168
--- Diff: metron-interface/metron-alerts/src/app/service/update.service.ts ---
@@ -32,13 +33,31 @@ export class UpdateService {
defaultHeaders = {'Content-Type': 'application/json', 'X-Requested-With': 'XMLHttpRequest'};
+ alertChangedSource = new Subject<PatchRequest>();
+ alertChanged$ = this.alertChangedSource.asObservable();
constructor(private http: Http) { }
public patch(patchRequest: PatchRequest): Observable<{}> {
let url = '/api/v1/update/patch';
- return this.http.patch(url, patchRequest, new RequestOptions({headers: new Headers(this.defaultHeaders)}))
- .catch(HttpUtil.handleError);
+ let observable = Observable.create((observer => {
--- End diff --
@merrimanr This is not an anti-pattern as such, we can trigger the event from the component that is trying to patch, but it has to be done at all places wherever we are patching. In this way there is no such need and list view will definitely get intimated of all changes.
If you are not comfortable we can change it :)
---
[GitHub] metron pull request #787: METRON-1232: Alert status changes are not reflecte...
Posted by nickwallen <gi...@git.apache.org>.
Github user nickwallen commented on a diff in the pull request:
https://github.com/apache/metron/pull/787#discussion_r143733430
--- Diff: metron-interface/metron-alerts/src/app/shared/directives/alert-search.directive.ts ---
@@ -130,7 +130,7 @@ export class AlertSearchDirective implements AfterViewInit, OnChanges {
private handleMouseEvent (callback: Function) {
clearTimeout(this.mouseEventTimer);
- this.mouseEventTimer = setTimeout(() => { callback(); }, 500);
+ this.mouseEventTimer = setTimeout(() => { callback(); }, 100);
--- End diff --
hey @iraghumitra - this slipped my mind earlier. can you point me to the tests for this functionality? I don't want this merged unless we have good tests.
---
[GitHub] metron pull request #787: METRON-1232: Alert status changes are not reflecte...
Posted by mmiklavc <gi...@git.apache.org>.
Github user mmiklavc commented on a diff in the pull request:
https://github.com/apache/metron/pull/787#discussion_r143541485
--- Diff: metron-interface/metron-alerts/e2e/alerts-list/alerts-list.po.ts ---
@@ -231,10 +231,12 @@ export class MetronAlertsPage {
}
clickRemoveSearchChip() {
- let aceLine = element.all(by.css('.ace_keyword')).get(0);
- browser.actions().mouseMove(aceLine).perform().then(() => {
- this.waitForElementPresence(element(by.css('.ace_value i'))).then(() => {
- element.all(by.css('.ace_value i')).get(0).click();
+ element(by.css('app-alerts-list .ace_text-input')).sendKeys('').then(() => {
--- End diff --
I'd like to see a couple things with this. Can you add some code comments along with perhaps splitting this up into more descriptive functions? There's a lot of chaining/lambda/closures going on here.
---
[GitHub] metron pull request #787: METRON-1232: Alert status changes are not reflecte...
Posted by merrimanr <gi...@git.apache.org>.
Github user merrimanr commented on a diff in the pull request:
https://github.com/apache/metron/pull/787#discussion_r143735130
--- Diff: metron-interface/metron-alerts/src/app/service/update.service.ts ---
@@ -32,13 +33,31 @@ export class UpdateService {
defaultHeaders = {'Content-Type': 'application/json', 'X-Requested-With': 'XMLHttpRequest'};
+ alertChangedSource = new Subject<PatchRequest>();
+ alertChanged$ = this.alertChangedSource.asObservable();
constructor(private http: Http) { }
public patch(patchRequest: PatchRequest): Observable<{}> {
let url = '/api/v1/update/patch';
- return this.http.patch(url, patchRequest, new RequestOptions({headers: new Headers(this.defaultHeaders)}))
- .catch(HttpUtil.handleError);
+ let observable = Observable.create((observer => {
--- End diff --
Would the alertChangedSource call be more appropriate in a map function? This seems like an awkward way to achieve this. Or am I missing something?
---
[GitHub] metron issue #787: METRON-1232: Alert status changes are not reflected in li...
Posted by nickwallen <gi...@git.apache.org>.
Github user nickwallen commented on the issue:
https://github.com/apache/metron/pull/787
+1 (again, even!) Pending Travis and resolving feedback from @mmiklavc and @merrimanr
I was able to run the e2e tests successfully and confirmed they do sufficiently test the change.
---