Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info

Valid from Datafari 3.

...

2

Datafari provides a way to create, consult and modify alerts.

The creation of an alert is now implemented by a widget embedded in the searchView. The widget javascript file is WebContent/js/AjaxFranceLabs/widgets/CreateAlert.widget.js and it is instantiated in WebContent/js/search.js and imported as a script file in WebContent/searchView.jsp.
A 'div' element with the id 'create_alert' has been added to the searchView.jsp file to be the container of the widget but is only added when an authenticated user is detected.
The widget adds a 'Create alert' button to the UI which displays, when the user click on it, a text field to enter an e-mail address and a 'select' element to choose the frequency of the alert. Once the user validate theses parameters, the widget sends them as a POST request, in addition with the search query parameters, to the "/admin/Alerts" servlet (code located in src/main/java/com/francelabs/datafari/servlets/admin/Alerts.java).
Then the servlet insert everything in the "alerts" table of the Datafari database in Cassandra.

The management of the alerts is now implemented in the 'parameters' page and the javascript code is located in WebContent/js/parameters.js in the createAlertContent() method.
The goal of this javascript code is to provide a table displaying all the alerts created by the authenticated user and provide a 'modify' button for each of them to change the frequency (for now you cannot change the e-mail address), and a 'Delete' button.
Modify an alert will result in a POST request to the "admin/Alerts" servlet with the new frequency and all the other alert parameters as POST data. Therefore, the behavior is the same than the CreateAlert widget.
Delete an alert will result in a POST request to the "admin/Alerts" servlet with only the alert id as POST data. The servlet detects that only an id has been provide so it has to delete the corresponding entry in the database.