[ https://issues.apache.org/jira/browse/METRON-1830?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16653682#comment-16653682 ]
ASF GitHub Bot commented on METRON-1830: ---------------------------------------- GitHub user sardell opened a pull request: https://github.com/apache/metron/pull/1240 METRON-1830: Re-implement Alerts dialog box without jQuery ## Contributor Comments [Link to METRON-1830 on ASF JIRA](https://issues.apache.org/jira/browse/METRON-1830) Previously, the dialog box class in both UIs directly manipulated the DOM with jQuery. This is problematic when using a framework like Angular because it causes a disconnect with how Angular handles and tracks DOM changes. We also don't take advantage of Angular's rendering engine this way. In this PR, I created a dialog component and service. When a component in the application needs to launch a dialog modal, they simply call a method on the singleton dialog service which determines if the dialog component should show/hide, what message to display and what type of message it is (ie Confirmation, Error, etc). ### Changes Included * Create a dialog component. * Create a singleton service so that we aren't creating a new instance every time we include a dialog in a component. * Add unit tests for both the service and component. * Replace all MetronDialogBox class references with the DialogService. * Remove the old MetronDialogBox. ### Testing You can test and see the dialog menu in the following areas of the application: * Creating a meta alert from a group in the tree view. * Adding/removing an alert from a meta alert in the table view. * Saving a search. * Adding a comment to an alert. To look at the test coverage, run `ng test --code-coverage`, navigate to the new `coverage` directory inside the project, and inside the folder open the index.html file. From there you can find the reports for the dialog service and component. Screenshots below for reference. ![screen shot 2018-10-17 at 4 54 44 pm](https://user-images.githubusercontent.com/7304869/47095390-78644a80-d22d-11e8-9eef-6c914e31ccd0.png) ![screen shot 2018-10-17 at 4 55 13 pm](https://user-images.githubusercontent.com/7304869/47095407-7c906800-d22d-11e8-95f5-12709873df72.png) ### Other Considerations If necessary, this section is used to explain future optimizations or propose changes related to this Pull Request. ## 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: - [ ] 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). - [ ] 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. - [ ] Has your PR been rebased against the latest commit within the target branch (typically master)? ### For code changes: - [ ] Have you included steps to reproduce the behavior or problem that is being changed or addressed? - [ ] Have you included steps or a guide to how the change may be verified and tested manually? - [ ] 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 ``` - [ ] Have you written or updated unit tests and or integration tests to verify your changes? - [ ] 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)? - [ ] 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: - [ ] 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/sardell/metron METRON-1830 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/metron/pull/1240.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 #1240 ---- commit 04776b6f21cc1e13a1d1ddd5582276ab45a38b49 Author: Shane Ardell <sardell@...> Date: 2018-10-11T10:21:00Z move dialog functionality into component and service commit 788c3884fbdc200ef40dbfccc150a447a5f751dd Author: Shane Ardell <sardell@...> Date: 2018-10-11T10:22:58Z remove unnecessary quotes to match tslint config commit f7b03fb79cd577c0b775dfe8b6c8d5472a56b6fd Author: Shane Ardell <sardell@...> Date: 2018-10-11T10:23:53Z swap modal out in tree view commit 14b5c7570cc3d67e0a0360e6e24d0c44788bf816 Author: Shane Ardell <sardell@...> Date: 2018-10-11T10:29:52Z update searchGroup to use dialog service commit 59879cf42d1d29d816c4f1a23a7f3c6b92853c4a Author: Shane Ardell <sardell@...> Date: 2018-10-11T10:30:19Z remove commented code commit c640957b64f74a5a1f2d220f454941bb97ccd81e Author: Shane Ardell <sardell@...> Date: 2018-10-13T14:09:34Z replace old dialog class method calls with new service method calls commit 912a6f073cd57bb904f223163b28f2a0708f59ee Author: Shane Ardell <sardell@...> Date: 2018-10-13T14:22:52Z remove unnecessary asObservable properties commit bdaec95981c9884fc32d9ad5509c9d56f61d8c7b Author: Shane Ardell <sardell@...> Date: 2018-10-13T14:27:50Z Merge branch 'master' into angularify-confirmation-modal commit f33a7bdf5de0ec9aa84c650a8bc630a819649a83 Author: Shane Ardell <sardell@...> Date: 2018-10-17T09:44:09Z add unit tests for dialog component commit bc62b6c5f90d6dd9d2bf0ac6ae242d5bc5dcd94b Author: Shane Ardell <sardell@...> Date: 2018-10-17T10:02:26Z remove focus from unit tests commit 2d3e23625bc521e56ee1f512258076324ebfe7ce Author: Shane Ardell <sardell@...> Date: 2018-10-17T11:48:04Z fix failing unit tests from dialog box changes commit 84f0a92af089df566b4ca35d2d1b31f42e254f90 Author: Shane Ardell <sardell@...> Date: 2018-10-17T11:52:01Z remove commented code commit c382c090e43c504baee900157dd46bf7823cf685 Author: Shane Ardell <sardell@...> Date: 2018-10-17T12:09:41Z add return type to confim method commit 08c06c3ffacb5e9f4db09caa233acca6141b21f6 Author: Shane Ardell <sardell@...> Date: 2018-10-17T13:23:40Z move enums into model dir commit c1102fb8e4344a96ec627cc4830965a04b22e587 Author: Shane Ardell <sardell@...> Date: 2018-10-17T13:30:42Z add license headers commit 8f89401ee4960fb5f211ead3e18f96e3689b7c66 Author: Shane Ardell <sardell@...> Date: 2018-10-17T13:32:01Z Merge branch 'master' into METRON-1830 commit 51be322062a2acab3cf6ea6b96eedadba557302a Author: Shane Ardell <sardell@...> Date: 2018-10-17T14:12:45Z replace dialog class with dialog service commit 026c7e2882c04ef6f637eeffdca6dad3aa6d372f Author: Shane Ardell <sardell@...> Date: 2018-10-17T14:35:38Z remove old dialog box class ---- > Re-implement Alerts dialog box without jQuery > --------------------------------------------- > > Key: METRON-1830 > URL: https://issues.apache.org/jira/browse/METRON-1830 > Project: Metron > Issue Type: Bug > Reporter: Shane Ardell > Assignee: Shane Ardell > Priority: Minor > > Currently, the dialog box class in both UIs directly manipulates the DOM with > jQuery. This is problematic when using a framework like Angular because it > causes a disconnect with how Angular handles and tracks DOM changes. We also > don't take advantage of Angular's rendering engine. > The dialog box can and should be implemented as a component and a singleton > service (since we would never want to launch more than one modal at a time). -- This message was sent by Atlassian JIRA (v7.6.3#76005)