-
Notifications
You must be signed in to change notification settings - Fork 0
Documentation
Server: Our backend server
Provider : Provider's server (google, github etc)
- Client makes a call to the server to start the auth flow
- Server Makes a call to the provider's backend
- User selects the account to be used for OAUTH (from the provider's domain)
- After selection, the provider generates (IdToken, AccessToken and RefreshToken) among things mentioned in the scope
- With these data, the provider makes a call to the server's callback url
- The server does its things with the data (like validation etc.), saves the RefreshToken in its database and return JWT to the Client
- On Getting the response from the server, the user is authenticated
Frontend OAUTH Explicit Flow
- Client opens a new window, with the URL of the server (to initiate the process)
- The client keeps a reference of the original window and adds an event Listener for any message events
- The domain is changed to the provider's and all things are on the more secure back channel
- The user selects an account and the server redirects to the client's expected callback url
- The newly opened window's last url contains the JWT token and other details
- The client extracts the data from the token and makes a postMessage to the original window
- The newly opened window is now closed
- On getting the data, the eventListener runs and sets the JWT token in the browser's localStorage
- The client then makes a call to the backend to get the user info
- On getting the user info, the client logs the user in by setting the app's local state
User Story
- Dashboard is a container for widgets
- Widget can be charts or kpis
- Dashboards are shown on the home screen as different tabs [shows only active dashboards]
- Charts and KPIs are different
- Charts show a certain graph (pie, bar, area etc.)
- KPIs show a single number (current state) and maybe increase or decrease from previous
- First the user creates an empty dashboard
- Then user creates widgets in it
- On the dashboard design screen, user can drag and drop widgets to rearrange
Q. How to create a Chart/KPI ?
- On the dashboard design page, click on the add item button
- Modal opens, select type (Chart or KPI)
- then fill the options for datalabels for widget
- Created
Developer Story
KPIs
- Kpi needs
model
, andaggregation_type
-
aggregation_type
have the following options- sum
- count
- max
- min
- mean
- median
- mode
The platform exposes two kinds of exports (as of now)
- CSV
- Excel
- Create forms
- Delete forms
- Edit form details (everything except form body)
- Preview forms
- Export list of forms (as CSV or Excel)
- Fill Forms (with or without login)
- Export Form responses (as CSV or Excel)
- Analytics of form responses
Create Forms
-
The left sidebar contains the components that can be added to the form
-
The middle area is the form editor area
-
The right sidebar shows properties of the selected element in the form editor or the overall form settings
-
The form overall settings include
- Form Title
- Form Description
- Cancel Text
- Submit Text
- Whether to allow anonymous responses
- Whether to allow multiple responses
- Whether to allow users to edit responses
- Whether to send email notifications on form submission
-
Form input components include
- Input (Text, Number, Email, Phone, Date, Time, URL etc.)
- Toggle Input (Yes/No)
- Text Area Input
- Rich Text Input
- Phone number Input
- Single Select Input (select one from the given options)
- Radio Input (select one from the given options)
-
Other components which can be used to describe form or add extra information
- Headings (h1, h2, h3, h4, h5, h6)
- Paragraph
- Code Block
- Image
- Link
-
The right sidebar contains the properties (props) of the selected element in the form editor
-
If no component is selected, the right sidebar contains the form overall settings
-
After updating any parameter in the right sidebar, the changes can be saved by clicking on the save button in the bottom section of the right sidebar
-
The form designer in the editor area has two views
- Designer mode (to create/design the form)
- Preview mode (to see how the form will look like)
-
Each component can be
- added to the form by clicking on them
- re-arranged by dragging and dropping in the editor area
- deleted by double clicking on the delete icon on the component
- selected by double clicking on it
- edited by changing the attributes in the right sidebar
-
By clicking on the lowest container (the component with the submit & reset buttons), the form overall settings can be edited
-
Forms are soft deleted, which means that they are not deleted from the database. The
deleted
field is just marked as true for that given record
Preview forms
- Forms in preview mode cannot be submitted or reset
Fill Forms (with or without login)
- The following markers are checked
- If form is active
- If the form can be filled by the user
- If anonymous, the form can be filled by anyone
- else if the user is logged in, let her fill the form, else deny
Analytics of form responses Form analytics are made for the following fields
- Toggle Input
- Single Select Input
- Radio Input
The Push model:
- The server pushes the notifications to the client via some connection like WebSockets, Long Polling etc.
- It suffers from certain problems like thundering herd where the server is overwhelmed by a hotspot notification and has to send this to a lot of users all at once.
- This doesn't scale well
The pull model
- The server creates a notification object (maybe saved in a database) and the client makes a call to get any new notifications.
- The client can implement a short polling strategy to get the notifications in a near-real time.
- In case of hotspot notification, the server is not overloaded because the client ask for it and the server can remain stateless in this regard.
We are using the pull model
- The client short polls the server at a regular interval to get it's notifications
- The server returns the notifications as a paginated list