Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

#213 Update msupply-dashboard-app plugin with excel-report-email-scheduler plugin #214

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions custom-plugins/excel_report_email_scheduler/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

## 1.0.0 (Unreleased)

Initial release.
57 changes: 57 additions & 0 deletions custom-plugins/excel_report_email_scheduler/MANIFEST.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

{
"manifestVersion": "2.0.0",
"signatureType": "private",
"signedByOrg": "msupplyfoundation",
"signedByOrgName": "msupplyfoundation",
"rootUrls": [
"https://demo-board.msupply.org:3000/",
"https://png.msupply.org:3000/",
"https://ci.msupply.org:3000/",
"https://liberia.msupply.org:3000/",
"https://tonga-vax.msupply.org:3000/",
"https://timor.msupply.org:3000/",
"http://localhost:3000/",
"https://vanuatu-vax.msupply.org:3000/",
"https://tokelau.msupply.org:3000/",
"https://tonga.msupply.org:3000/",
"https://who-demo.msupply.org:3000/",
"https://msupply.health.gov.ws:3000/",
"https://fijimoh.msupply.org:3000/"
],
"plugin": "msupplyfoundation-datasource",
"version": "2.1.1",
"time": 1663332823487,
"keyId": "7e4d0c6a708866e7",
"files": {
"gpx_excel_report_email_scheduler_darwin_amd64": "922de6a3205ac938241d11dcf9d199e29444c9348d10bab573cc7f12d17f259c",
"gpx_excel_report_email_scheduler_linux_arm": "beb3c0c30189ef899480780902400940533644bf63052b9ea5fdd6deb69de33f",
"gpx_excel_report_email_scheduler_linux_amd64": "eea39e3d0433dcfa7818c87efbdc1cb8d4a6ea467a826703fee2e781abcc5e22",
"locales/en.json": "026c96637f6d20d8c8890833355e61bfa63aac987d7efd17b8b8671019805f78",
"LICENSE": "b40930bbcf80744c86c46a12bc9da056641d722716c378f5659b9e555ef833e1",
"CHANGELOG.md": "aaa78be4710ef41d56ddab1edbd180ef9f9adfea2f293109aae925dc33a1b9b3",
"module.js.LICENSE.txt": "d4a7e197c25f0eb9176e26557c5f18e8cfc11a3fbd9a01106e79bae11fb7d0b8",
"module.js.map": "fa55d2021effcafe4b12cb1dca16be0beb3fe3a8c4bf41df1959e8817a064a21",
"plugin.json": "7927607f26ce48dd4dfa7831d2cab7b36c333f886a7541c794c43580a9926854",
"README.md": "9cd4dd25cee303062ec4ff6d90eec32ed3893351ae1646d5dc77c27801bc6d8b",
"img/msupply_light_icon.svg": "b4b32af01d584ecc186d19d73977c6f8262dcb18ac011e5ea11d4b915b6e1eb2",
"gpx_excel_report_email_scheduler_linux_arm64": "baf4071df0aff28f09b9f5438fec4c19e2755f97d0a3445e9d340a6478758161",
"module.js": "f38ac6a569bded89bcd05d5da6835313daae77b65cb27660c61f39b5a632c9a3",
"gpx_excel_report_email_scheduler_darwin_arm64": "64f83e17fa0b7453662c813f15b516a1f1d5b5ead5b92a5b7d95d3494d5deff8",
"gpx_excel_report_email_scheduler_windows_amd64.exe": "ea2fc954fd4c6e703010fb8ad4f118434d6ee6513f76840a106e9355d17d8e03"
}
}
-----BEGIN PGP SIGNATURE-----
Version: OpenPGP.js v4.10.10
Comment: https://openpgpjs.org

wrcEARMKAAYFAmMkcdcAIQkQfk0ManCIZucWIQTzOyW2kQdOhGNlcPN+TQxq
cIhm5161AgY9P5LTZvpXcamVkUym8ZOhquqaF0ay8K/57YrhypOWxcZ2Fo3K
unk0snfuWJEnwOso9iQgA3E416ubI09LnB6qkAII27gX0rE5TOOog2ufJQPA
gW8D0kLvA18JLGf0pOm1Sdy5crTcOTWUSaJ7G2E1qxCLJ7mI9upK5IknwJCz
YSiRSr4=
=RTQR
-----END PGP SIGNATURE-----
66 changes: 66 additions & 0 deletions custom-plugins/excel_report_email_scheduler/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# mSupply Dashboard: Excel report e-mail scheduler

The Open mSupply Dashboard Excel report e-mail scheduler plugin which takes data from panels of mSupply dashboard to generate excel reports.

The reports are then emailed to a custom user report group, this report group is curated from the list of mSupply users, pulled from mSupply Dashboard's datasource.

The timing of the scheduler can be set in the plugin.

The app plugin is built with Golang as backend and react as frontend.

## How it works

The plugin has three main pages

- [Configuration](./docs/configuration.md)
- [Report Groups](./docs/report-groups.md)
- [Schedules](./docs/schedule.md)

Once a schedule is created it will run automatically on the date and time specified in the schedule options on the interval specified.

## Requirements

- Golang version 1.16 or above
- [Mage build tool](https://magefile.org/)
- Node.JS version 16 or above
- Grafana version 8 (Not required if you are using Docker, it will install this for you in a container)
- Yarn
- If you are using Docker for development the files are moved automatically, just have to rename the `msupply_example.db` file.
- You must have `msupply.db` database in the designated grafana `plugins/data` folder. We have included an empty `msupply_example.db` file in the `plugins/data` folder in this repo. Rename it to `msupply.db` and add it to your Grafana installation's `plugins/data` folder. Please do not skip this as the plugin would not work without this database file.
- You must have `template.xlsx` file in the designated grafana `plugins/data` folder. We have included a `template.xlsx` file in the `plugins/data` folder in this repo, add it to your Grafana installation's `plugins/data` folder. Please do not skip this as the plugin would not work without this template file.

## Installation instructions

### Development

If you want to develop and change this plugin's file, you can install the plugin in your system through one if the two routes explained below.

The Docker route need docker installed in your system along with Node.js, Golang and yarn but it gives you fresh grafana install. It will also auto-setup grafana for you (to some extent) so it is the recommended path.

- [Docker development installation (recommended)](./docs/developers-docker-recommended-build.md)
- [Normal development installation](./docs/normal-installation.md)

## Build for Production

- Do everything instructed in the Development section above.
- Now it's time to build for Production
- Do `mage clean` to delete the dist folder. A fresh start.
- Do `mage -v` to build for all platforms
- Do `mage build:windows` if you want to build for Windows only
- Do `mage build:linuxARM64` if you want to build for Linux only
- Do `yarn build:frontend` to build the Javascript parts
- Do `yarn sign` to sign the plugin.
- Note: You would need a GRAFANA_API_KEY to sing the plugin.
- Also you would need to add the url of the site you are deploying to, in the sites in `sign` script, in package.json before building.
- Once you have signed the plugin you cannot change the content of the plugin folder (dist). Any add, edit or deletion of files in the folder would render the plugin invalid and it would not work in Grafana.
- If you want to use the signed plugin in development mode but you have not been abled to, there is manifest file that gets generated when the plugin is singed. That file must be deleted if you want to use the plugin unsigned for development.
- Alternatively, if you do `yarn build`, it will run all of the above commands for you. (I just wanted to explain what this will do to you.)

## Migrating from v1

- The plugin expect Grafana v8 to be installed in your system.
- Please make sure you have created the mSupply dashboard datasource, without it this plugin would not work.
- Please make sure the mSupply.db SQLite database and Template.xlsx files is in the expected path `plugins/data`
- The Settings have changed slightly so you might have to re-enter them for the plugin to work. If you see errors, make sure you have reentered the plugin settings.
- If you are using legacy `mSupply.db`, please update the data type of `ReportContent.lookback` field to `TEXT`. Previously it was `INTEGER`. If you are using older content, you might have to re-select Lookups from Panel variables form fields, in Scheduler edit page.
- The remain data stays unchanged so you can use the legacy database with newer version of the plugin.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@
"monthly": "Monthly",
"quarterly": "Quarterly",
"yearly": "Yearly",
"monday": "Monday",
"tuesday": "Tuesday",
"wednesday": "Wednesday",
"thursday": "Thursday",
"friday": "Friday",
"saturday": "Saturday",
"sunday": "Sunday",
"report_group": "Report group",
"report_interval": "Report interval",
"report_interval_description": "The interval frequency for emails to be sent",
Expand Down
3 changes: 3 additions & 0 deletions custom-plugins/excel_report_email_scheduler/module.js

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions custom-plugins/excel_report_email_scheduler/module.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*!
* cookie
* Copyright(c) 2012-2014 Roman Shtylman
* Copyright(c) 2015 Douglas Christopher Wilson
* MIT Licensed
*/

/*!
* escape-html
* Copyright(c) 2012-2013 TJ Holowaychuk
* Copyright(c) 2015 Andreas Lubbe
* Copyright(c) 2015 Tiancheng "Timothy" Gu
* MIT Licensed
*/
1 change: 1 addition & 0 deletions custom-plugins/excel_report_email_scheduler/module.js.map

Large diffs are not rendered by default.

69 changes: 69 additions & 0 deletions custom-plugins/excel_report_email_scheduler/plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"$schema": "https://raw.githubusercontent.com/grafana/grafana/master/docs/sources/developers/plugins/plugin.schema.json",
"type": "app",
"name": "Excel report e-mail scheduler",
"id": "msupplyfoundation-datasource",
"backend": true,
"alerting": false,
"metrics": false,
"annotations": false,
"executable": "gpx_excel_report_email_scheduler",
"info": {
"description": "Grafana plugin for mSupply Dashboard application. The plugin takes data from panels of mSupply dashboard to generate excel reports. The reports are then emailed to a custom user group created with mSupply users pulled from mSupply Dashboard's datasource. The timing of the scheduler can be set in the plugin.",
"author": {
"name": "mSupply Foundation",
"url": "https://msupply.foundation/"
},
"keywords": ["grafana-plugin", "mSupply-foundation", "mSupply-dashboard", "datasource", "panel"],
"logos": {
"small": "img/msupply_light_icon.svg",
"large": "img/msupply_light_icon.svg"
},
"links": [
{
"name": "Website",
"url": "https://github.com/openmsupply/msupply-dashboard-app"
},
{
"name": "License",
"url": "https://github.com/openmsupply/msupply-dashboard-app/blob/master/LICENSE"
}
],
"screenshots": [],
"version": "2.1.1",
"updated": "2022-09-16"
},
"includes": [
{
"type": "page",
"name": "Report Groups",
"icon": "fa fa-group",
"path": "/a/msupplyfoundation-datasource",
"role": "Admin",
"addToNav": true,
"defaultNav": true
},
{
"type": "page",
"name": "Schedules",
"icon": "fa fa-calendar",
"path": "/a/msupplyfoundation-datasource/schedules",
"role": "Admin",
"addToNav": true
},

{
"type": "page",
"icon": "fa fa-cog",
"name": "Configuration",
"path": "/plugins/msupplyfoundation-datasource",
"role": "Admin",
"addToNav": true
}
],
"dependencies": {
"grafanaDependency": ">=8.0.0",
"grafanaVersion": "8.0.0",
"plugins": []
}
}
45 changes: 0 additions & 45 deletions custom-plugins/msupply-dashboard-app/backend/MANIFEST.txt

This file was deleted.

9 changes: 0 additions & 9 deletions custom-plugins/msupply-dashboard-app/backend/README.md

This file was deleted.

2 changes: 0 additions & 2 deletions custom-plugins/msupply-dashboard-app/backend/module.js

This file was deleted.

1 change: 0 additions & 1 deletion custom-plugins/msupply-dashboard-app/backend/module.js.map

This file was deleted.

37 changes: 0 additions & 37 deletions custom-plugins/msupply-dashboard-app/backend/plugin.json

This file was deleted.

42 changes: 0 additions & 42 deletions custom-plugins/msupply-dashboard-app/frontend/MANIFEST.txt

This file was deleted.

3 changes: 0 additions & 3 deletions custom-plugins/msupply-dashboard-app/frontend/README.md

This file was deleted.

3 changes: 0 additions & 3 deletions custom-plugins/msupply-dashboard-app/frontend/module.js

This file was deleted.

Loading