[GitHub] metron pull request #1156: METRON-1702: Reload a running job in the UI

2018-08-10 Thread merrimanr
Github user merrimanr closed the pull request at:

https://github.com/apache/metron/pull/1156


---


[GitHub] metron pull request #1156: METRON-1702: Reload a running job in the UI

2018-08-09 Thread ruffle1986
Github user ruffle1986 commented on a diff in the pull request:

https://github.com/apache/metron/pull/1156#discussion_r208968690
  
--- Diff: 
metron-interface/metron-alerts/src/app/pcap/pcap-panel/pcap-panel.component.ts 
---
@@ -15,22 +15,22 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import { Component, Input } from '@angular/core';
+import { Component, OnInit, Input } from '@angular/core';
 
 import { PcapService } from '../service/pcap.service';
 import { PcapStatusResponse } from '../model/pcap-status-response';
 import { PcapRequest } from '../model/pcap.request';
 import { Pdml } from '../model/pdml';
 import { Subscription } from 'rxjs/Rx';
 import { PcapPagination } from '../model/pcap-pagination';
-import {RestError} from "../../model/rest-error";
+import { RestError } from "../../model/rest-error";
 
 @Component({
   selector: 'app-pcap-panel',
   templateUrl: './pcap-panel.component.html',
   styleUrls: ['./pcap-panel.component.scss']
 })
-export class PcapPanelComponent {
+export class PcapPanelComponent implements OnInit {
--- End diff --

I've already done it here in this commit: 
https://github.com/apache/metron/commit/14dcb2d90581835d8206c65918c24e8cb04bfd06
It's already merged back into the feature branch and it implements the 
destroy interface and I also refactored it a bit to make it more maintainable. 
We both touched the same lines so these conflicts have to be resolved before 
merging it back.


---


[GitHub] metron pull request #1156: METRON-1702: Reload a running job in the UI

2018-08-09 Thread ruffle1986
Github user ruffle1986 commented on a diff in the pull request:

https://github.com/apache/metron/pull/1156#discussion_r208946955
  
--- Diff: 
metron-interface/metron-alerts/src/app/pcap/pcap-panel/pcap-panel.component.ts 
---
@@ -15,22 +15,22 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import { Component, Input } from '@angular/core';
+import { Component, OnInit, Input } from '@angular/core';
 
 import { PcapService } from '../service/pcap.service';
 import { PcapStatusResponse } from '../model/pcap-status-response';
 import { PcapRequest } from '../model/pcap.request';
 import { Pdml } from '../model/pdml';
 import { Subscription } from 'rxjs/Rx';
 import { PcapPagination } from '../model/pcap-pagination';
-import {RestError} from "../../model/rest-error";
+import { RestError } from "../../model/rest-error";
 
 @Component({
   selector: 'app-pcap-panel',
   templateUrl: './pcap-panel.component.html',
   styleUrls: ['./pcap-panel.component.scss']
 })
-export class PcapPanelComponent {
+export class PcapPanelComponent implements OnInit {
--- End diff --

@merrimanr You should also implement the OnDestroy interface and 
unsubscribe from all the observables in the `ngOnDestroy` method. Especially 
from the polling observable. By doing this, you can make sure that the 
component won't continue the polling for the job's status when the user 
navigates somewhere else from the pcap tab. If you unsubscribe in the 
destructor method, it'll stop the pending http requests immediately as well 
when the route changes. Not to mention freeing up the memory when the component 
is not rendered anymore.


---


[GitHub] metron pull request #1156: METRON-1702: Reload a running job in the UI

2018-08-09 Thread tiborm
Github user tiborm commented on a diff in the pull request:

https://github.com/apache/metron/pull/1156#discussion_r208919679
  
--- Diff: 
metron-interface/metron-alerts/src/app/pcap/pcap-panel/pcap-panel.component.ts 
---
@@ -44,7 +44,23 @@ export class PcapPanelComponent {
   savedPcapRequest: {};
   errorMsg: string;
 
-  constructor(private pcapService: PcapService) { }
+  constructor(private pcapService: PcapService ) { }
--- End diff --

There is an extra space after the type. Is it intentional?


---


[GitHub] metron pull request #1156: METRON-1702: Reload a running job in the UI

2018-08-08 Thread merrimanr
GitHub user merrimanr opened a pull request:

https://github.com/apache/metron/pull/1156

METRON-1702: Reload a running job in the UI

## Contributor Comments
This PR update the Pcap query panel so that a currently running query for a 
user is loaded when a page is refreshed.

### Changes Included

- Updated pcap-panel.component.ts to query for a running job, and if found, 
update the current status and start polling
- Refactored pcap-panel.component.ts by moving updating status and start 
polling into separate functions.  This should make the class more readable and 
is needed to update status after querying for a running job.
- Updated pcap-filters.component.ts to accept a PcapRequest as input and 
update filters to match the request made for the currently running job
- Added functions to pcap.service.ts to get the currently running job and 
the pcap request for that job
-  Fixed a bug in PcapServiceImpl.java where the wrong types were being 
used for some fields (also adjust unit tests to catch these errors in the 
future)
- Added tests for new code

### Testing
This has been tested in full dev. 

1. Navigate to the Pcap panel in the Alerts UI
2. Submit a query with filters and wait for progress to be > 0
3. Refresh the page
4. The page should look exactly the same (filters and all) and polling 
should continue until the job is complete

## 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- where  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 && 
dev-utilities/build-utils/verify_licenses.sh 
  ```

- [x] 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/merrimanr/incubator-metron METRON-1702

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/metron/pull/1156.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 #1156


commit 872d1b1ee13e358c18956945d71d3667d19fca8a
Author: merrimanr 
Date:   2018-04-12T14:57:48Z

Merge branch 'pcap-front' of https://github.com/simonellistonball/metron 
into pcaprest

Conflicts:
metron-interface/metron-alerts/src/app/app.module.ts

commit b1b6a7dabea1a1d0d132482c8d97af29c0ac2683
Author: merrimanr 
Date:   2018-04-13T15:00:15Z