Skip to content

DX26-io/flair-notifications

 
 

Repository files navigation

Build Status

Flair-Reporting-Engine

Application expose an api to schedule a job in cron fashion. At scheduled time, it will call grpc server and get data, render chart of that data. Type of chart depend on the request body. After that it will create a image of that chart and store in file system and then send mail to user defined in request body including that image inside html.

api end point:

curl http://localhost:8080/api/jobSchedule/

request body:

{
            "userId":"testuser",
            "cronExp":"* * * * *",
            "report": {
              "connectionName": "Postgres-connection",
              "mailBody": "This is a test email to check api functionality",
              "subject": "API Testing",
              "reportName": "report_x8",
              "sourceId":"1715917d-fff8-44a1-af02-ee2cd41a3609",
              "titleName":"Clustered Vertical Bar Chart"
            },
            "reportLineItem": {
              "query_name": "test query",
              "fields": ["state","price"],
              "group_by": ["col1"],
              "order_by": [],
              "where": "",
              "limit": 5,
              "table": "Transactions",
              "visualization": "pie"
            },
            "assignReport": {
              "channels": "Email",
              "slackAPIToken":"xxxxxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxx-xxxxxxxxxxxxxxxxx",
              "channelid":"C9ZK2705U",
              "strideAPIToken":"xxxxxx-xxxxxx",
              "stridecloudid":"xxxxxxxxx",
              "strideconversationid":"xxxxxxxxxxxxx",
              "email_list":["example@gmail.com"],
              "condition": "test"
            },
            "schedule": {
              "timezone": "Asia/Kolkata",
              "startDate":"2019-02-04 08:25:00",
              "endDate":"2019-02-15 12:50:00"
              }
          }

#Getting started Requirements:

  • NodeJS
  • NPM
  • Docker

Clone the repository with command

git clone https://github.com/viz-centric/flair-notifications.git

Navigate to directory

cd  flair-notifications

Install dependencies

npm i

Start the database

cd deploy
docker-compose up -d
cd ..
npx sequelize-cli db:migrate

Start the Server

npm start

Enabling SSL

To enable SSL between flair notifications and flair bi, please follow the guide below.

Enable SSL between flair notifications and flair bi

To generate SSL certs, run this command:

cd certs
./generate.sh

Make sure you open that bash file and check SERVER_CN and CLIENT_CN variables there. If you plan to run in docker environment, then keep these values as is. If you plan to deploy to a real production environment, then change these values to contain real hostnames of the services.

After that, copy the whole contents from certs/* to flair-bi projects to the same location

cp certs ../flair-bi/src/main/resources/ssl/notificationscertsgen

Development

Build docker image

To build docker image, run this command

docker build -t dx26io/flair-notifications:v3.10.1 .

change 3.10.1 to any version of your choice.

About

Open source Business Intelligence (BI) & Analytics platform

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 96.7%
  • Shell 1.4%
  • Other 1.9%