@frangoteam/fuxa-min 1.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +41 -0
- package/_images/Pipes/P1.svg +39 -0
- package/_images/Tanks/Fl.svg +7 -0
- package/api/alarms/index.js +132 -0
- package/api/auth/index.js +71 -0
- package/api/command/index.js +187 -0
- package/api/daq/index.js +79 -0
- package/api/diagnose/index.js +163 -0
- package/api/index.js +181 -0
- package/api/jwt-helper.js +106 -0
- package/api/plugins/index.js +109 -0
- package/api/projects/index.js +229 -0
- package/api/resources/index.js +118 -0
- package/api/scripts/index.js +82 -0
- package/api/users/index.js +109 -0
- package/dist/3rdpartylicenses.txt +1477 -0
- package/dist/Quicksand-Bold.071154c292aef0b8.woff +0 -0
- package/dist/Quicksand-Bold.6383d6475ed5c40f.woff2 +0 -0
- package/dist/Quicksand-Bold.f07d467887f9cfab.ttf +0 -0
- package/dist/Quicksand-Medium.0982a651e8d4315f.woff +0 -0
- package/dist/Quicksand-Medium.9d2733fbfb9b1be8.ttf +0 -0
- package/dist/Quicksand-Medium.b09302365c586eb2.woff2 +0 -0
- package/dist/Quicksand-Regular.16adf9eecd267273.woff +0 -0
- package/dist/Quicksand-Regular.78819724f6aeff59.woff2 +0 -0
- package/dist/Quicksand-Regular.8829564f0e14bf76.ttf +0 -0
- package/dist/assets/fonts/icomoon.eot +0 -0
- package/dist/assets/fonts/icomoon.svg +19 -0
- package/dist/assets/fonts/icomoon.ttf +0 -0
- package/dist/assets/fonts/icomoon.woff +0 -0
- package/dist/assets/fonts/myicons.eot +0 -0
- package/dist/assets/fonts/myicons.svg +19 -0
- package/dist/assets/fonts/myicons.ttf +0 -0
- package/dist/assets/fonts/myicons.woff +0 -0
- package/dist/assets/fonts/quicksand-bold/Quicksand-Bold.ttf +0 -0
- package/dist/assets/fonts/quicksand-bold/Quicksand-Bold.woff +0 -0
- package/dist/assets/fonts/quicksand-bold/Quicksand-Bold.woff2 +0 -0
- package/dist/assets/fonts/quicksand-medium/Quicksand-Medium.ttf +0 -0
- package/dist/assets/fonts/quicksand-medium/Quicksand-Medium.woff +0 -0
- package/dist/assets/fonts/quicksand-medium/Quicksand-Medium.woff2 +0 -0
- package/dist/assets/fonts/quicksand-regular/Quicksand-Regular.ttf +0 -0
- package/dist/assets/fonts/quicksand-regular/Quicksand-Regular.woff +0 -0
- package/dist/assets/fonts/quicksand-regular/Quicksand-Regular.woff2 +0 -0
- package/dist/assets/fonts/roboto-bold/roboto-bold-webfont.svg +10486 -0
- package/dist/assets/fonts/roboto-bold/roboto-bold-webfont.ttf +0 -0
- package/dist/assets/fonts/roboto-bold/roboto-bold-webfont.woff +0 -0
- package/dist/assets/fonts/roboto-bold/roboto-bold-webfont.woff2 +0 -0
- package/dist/assets/fonts/roboto-light/roboto-light-webfont.svg +9998 -0
- package/dist/assets/fonts/roboto-light/roboto-light-webfont.ttf +0 -0
- package/dist/assets/fonts/roboto-light/roboto-light-webfont.woff +0 -0
- package/dist/assets/fonts/roboto-light/roboto-light-webfont.woff2 +0 -0
- package/dist/assets/fonts/roboto-medium/roboto-medium-webfont.svg +10487 -0
- package/dist/assets/fonts/roboto-medium/roboto-medium-webfont.ttf +0 -0
- package/dist/assets/fonts/roboto-medium/roboto-medium-webfont.woff +0 -0
- package/dist/assets/fonts/roboto-medium/roboto-medium-webfont.woff2 +0 -0
- package/dist/assets/fonts/roboto-regular/roboto-regular-webfont.svg +10004 -0
- package/dist/assets/fonts/roboto-regular/roboto-regular-webfont.ttf +0 -0
- package/dist/assets/fonts/roboto-regular/roboto-regular-webfont.woff +0 -0
- package/dist/assets/fonts/roboto-regular/roboto-regular-webfont.woff2 +0 -0
- package/dist/assets/fonts/roboto-thin/roboto-thin-webfont.svg +10012 -0
- package/dist/assets/fonts/roboto-thin/roboto-thin-webfont.ttf +0 -0
- package/dist/assets/fonts/roboto-thin/roboto-thin-webfont.woff +0 -0
- package/dist/assets/fonts/roboto-thin/roboto-thin-webfont.woff2 +0 -0
- package/dist/assets/i18n/de.json +1308 -0
- package/dist/assets/i18n/en.json +1438 -0
- package/dist/assets/i18n/es.json +777 -0
- package/dist/assets/i18n/fr.json +1129 -0
- package/dist/assets/i18n/ko.json +774 -0
- package/dist/assets/i18n/pt.json +657 -0
- package/dist/assets/i18n/ru.json +1228 -0
- package/dist/assets/i18n/tr.json +673 -0
- package/dist/assets/i18n/ua.json +614 -0
- package/dist/assets/i18n/zh-cn.json +1252 -0
- package/dist/assets/images/align-bottom.svg +88 -0
- package/dist/assets/images/align-center.svg +86 -0
- package/dist/assets/images/align-left.svg +86 -0
- package/dist/assets/images/align-middle.svg +88 -0
- package/dist/assets/images/align-right.svg +88 -0
- package/dist/assets/images/align-top.svg +88 -0
- package/dist/assets/images/bag.svg +115 -0
- package/dist/assets/images/button.svg +22 -0
- package/dist/assets/images/chart.svg +17 -0
- package/dist/assets/images/circle.svg +84 -0
- package/dist/assets/images/compressor-a.svg +2 -0
- package/dist/assets/images/editvalue.svg +14 -0
- package/dist/assets/images/ellipse.svg +84 -0
- package/dist/assets/images/flip-orizontal.svg +86 -0
- package/dist/assets/images/flip-vertical.svg +82 -0
- package/dist/assets/images/gauge-donut.png +0 -0
- package/dist/assets/images/gauge-mat.png +0 -0
- package/dist/assets/images/gauge-zone.png +0 -0
- package/dist/assets/images/graphbar.svg +18 -0
- package/dist/assets/images/group.svg +91 -0
- package/dist/assets/images/iframe.svg +54 -0
- package/dist/assets/images/image.svg +95 -0
- package/dist/assets/images/led-circle.svg +77 -0
- package/dist/assets/images/line.svg +86 -0
- package/dist/assets/images/linecap-butt.svg +77 -0
- package/dist/assets/images/linecap-round.svg +77 -0
- package/dist/assets/images/linecap-square.svg +82 -0
- package/dist/assets/images/linejoin-bevel.svg +77 -0
- package/dist/assets/images/linejoin-miter.svg +77 -0
- package/dist/assets/images/linejoin-round.svg +77 -0
- package/dist/assets/images/logo.svg +18 -0
- package/dist/assets/images/path.svg +100 -0
- package/dist/assets/images/pencil.svg +98 -0
- package/dist/assets/images/pipe.svg +15 -0
- package/dist/assets/images/progress-v.svg +79 -0
- package/dist/assets/images/rect.svg +84 -0
- package/dist/assets/images/select-pointer.svg +93 -0
- package/dist/assets/images/selectvalue.svg +14 -0
- package/dist/assets/images/semaphore.svg +19 -0
- package/dist/assets/images/slider.svg +17 -0
- package/dist/assets/images/switch.svg +15 -0
- package/dist/assets/images/table.svg +55 -0
- package/dist/assets/images/text.svg +294 -0
- package/dist/assets/images/to-bottom.svg +163 -0
- package/dist/assets/images/to-path.svg +94 -0
- package/dist/assets/images/to-top.svg +163 -0
- package/dist/assets/images/to_top.svg +88 -0
- package/dist/assets/images/todelete.svg +13 -0
- package/dist/assets/images/ungroup.svg +108 -0
- package/dist/assets/images/value.svg +81 -0
- package/dist/assets/images/valve-a.svg +2 -0
- package/dist/assets/images/webcam.svg +16 -0
- package/dist/assets/lib/ext-styles.css +28 -0
- package/dist/assets/lib/gauge/gauge.js +988 -0
- package/dist/assets/lib/gauge/gauge.min.js +1 -0
- package/dist/assets/lib/nouislider/nouislider.min.css +1 -0
- package/dist/assets/lib/nouislider/nouislider.min.js +1 -0
- package/dist/assets/lib/numeral/locales.min.js +7 -0
- package/dist/assets/lib/numeral/numeral.min.js +8 -0
- package/dist/assets/lib/pdfkit-table/index.js +967 -0
- package/dist/assets/lib/svg/raphael.min.js +1 -0
- package/dist/assets/lib/svg/svg.js +5573 -0
- package/dist/assets/lib/svg/svg.min.js +13 -0
- package/dist/assets/lib/svgeditor/extensions/ext-bundle.min.js +1 -0
- package/dist/assets/lib/svgeditor/extensions/ext-html_button.min.css +1 -0
- package/dist/assets/lib/svgeditor/fuxa-editor.min.js +23 -0
- package/dist/assets/lib/svgeditor/jquery-plugin.min.css +2 -0
- package/dist/assets/lib/svgeditor/jquery-plugin.min.js +52 -0
- package/dist/assets/lib/svgeditor/jquery-ui-1.8.17.custom.min.js +54 -0
- package/dist/assets/lib/svgeditor/jquery.min.js +4 -0
- package/dist/assets/lib/svgeditor/shapes/ape-shapes.js +39 -0
- package/dist/assets/lib/svgeditor/shapes/img/agitator-disc.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/agitator-paddle.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/agitator-prop.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/agitator-turbo.svg +19 -0
- package/dist/assets/lib/svgeditor/shapes/img/anim-eli.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/anim-piston.svg +14 -0
- package/dist/assets/lib/svgeditor/shapes/img/centrifugal.svg +68 -0
- package/dist/assets/lib/svgeditor/shapes/img/centrifugal1.svg +67 -0
- package/dist/assets/lib/svgeditor/shapes/img/centrifuge1.svg +67 -0
- package/dist/assets/lib/svgeditor/shapes/img/centrifuge2.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/centrifuge3.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/centrifuge4.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/compair.svg +92 -0
- package/dist/assets/lib/svgeditor/shapes/img/compdiaph.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/compejector.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/compreci.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/compreci2.svg +68 -0
- package/dist/assets/lib/svgeditor/shapes/img/compressor-fan.svg +18 -0
- package/dist/assets/lib/svgeditor/shapes/img/compressor-piston.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/compressor-void.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/compring.svg +72 -0
- package/dist/assets/lib/svgeditor/shapes/img/compring2.svg +72 -0
- package/dist/assets/lib/svgeditor/shapes/img/comprotary.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/comprotary2.svg +18 -0
- package/dist/assets/lib/svgeditor/shapes/img/compscrew.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/compsilence.svg +20 -0
- package/dist/assets/lib/svgeditor/shapes/img/compturbo.svg +72 -0
- package/dist/assets/lib/svgeditor/shapes/img/crusher1.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/crusher2.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/crusher3.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/crusher4.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/crusher5.svg +18 -0
- package/dist/assets/lib/svgeditor/shapes/img/crusher6.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/crusher7.svg +21 -0
- package/dist/assets/lib/svgeditor/shapes/img/diaph.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/drier1.svg +63 -0
- package/dist/assets/lib/svgeditor/shapes/img/drier2.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/drier3.svg +23 -0
- package/dist/assets/lib/svgeditor/shapes/img/drier4.svg +18 -0
- package/dist/assets/lib/svgeditor/shapes/img/drier5.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger-filter.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger-heat.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger-tube.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger1.svg +67 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger2.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger3.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger4.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger5.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger6.svg +71 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger7.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger8.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger9.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/feeder.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/feeder2.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/feeder3.svg +63 -0
- package/dist/assets/lib/svgeditor/shapes/img/filter2.svg +68 -0
- package/dist/assets/lib/svgeditor/shapes/img/filter3.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting1.svg +67 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting10.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting11.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting12.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting13.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting2.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting3.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting4.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting5.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting6.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting7.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting8.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting9.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/misc1.svg +75 -0
- package/dist/assets/lib/svgeditor/shapes/img/misc2.svg +71 -0
- package/dist/assets/lib/svgeditor/shapes/img/misc3.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/misc4.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/misc5.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/misc6.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/misc7.svg +64 -0
- package/dist/assets/lib/svgeditor/shapes/img/misc8.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/motor-simb.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/nozzle.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/nozzle2.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/pipi1.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/pipi2.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/pipi3.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/pipi4.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/pipi5.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/pipi6.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/pipi7.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpblower.svg +76 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpcentri1.svg +64 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpcentri2.svg +64 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpfeed.svg +64 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpgear.svg +18 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpgear2.svg +19 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumphidra.svg +68 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumphorizo.svg +68 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpjet.svg +68 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpperis.svg +20 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpscreew.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpscreew2.svg +72 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpturbi.svg +64 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpvacuum.svg +72 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-arrow.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-circle.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-circleindi.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-cloud.svg +63 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-cone.svg +71 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-corner.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-cross.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-cylinder.svg +71 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-delay.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-diamond.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-display.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-docu.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-doublearrow.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-drop.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-halfcircle.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-heart.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-looplimit.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-maninput.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-nosymbol.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-octagon.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-offpage.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-or.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-or2.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-parallelogram.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-pentagon.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-poval.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-prepara.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-rectangle.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-rectindi.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-star4.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-switch.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-tape.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-tee.svg +63 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-ticket.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-trape.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-triangle.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-vor.svg +14 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank1.svg +63 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank2.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank3.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank4.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank5.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank6.svg +68 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank7.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank8.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank9.svg +21 -0
- package/dist/assets/lib/svgeditor/shapes/img/valve-ax.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/valve-bx.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/valve-cx.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/webcam.svg +6 -0
- package/dist/assets/lib/svgeditor/shapes/my-shapes.js +178 -0
- package/dist/assets/lib/svgeditor/shapes/proc-comp-shapes.js +105 -0
- package/dist/assets/lib/svgeditor/shapes/proc-general-shapes.js +60 -0
- package/dist/assets/lib/svgeditor/shapes/proc-pumps-shapes.js +112 -0
- package/dist/assets/lib/svgeditor/shapes/proc-shapes.js +606 -0
- package/dist/assets/lib/svgeditor/shapes/shapes.js +30 -0
- package/dist/assets/lib/svgeditor/svg-editor.min.css +1 -0
- package/dist/assets/lib/uplot/placement.min.js +2 -0
- package/dist/assets/project.demo.fuxap +1 -0
- package/dist/favicon.ico +0 -0
- package/dist/icomoon.86abfb46e057ade8.eot +0 -0
- package/dist/icomoon.c1f8b59bad308d66.woff +0 -0
- package/dist/icomoon.ce427f75e21963af.ttf +0 -0
- package/dist/icomoon.dfb0a89feb346906.svg +19 -0
- package/dist/index.html +50 -0
- package/dist/logo.0e8e64e69250a450.svg +18 -0
- package/dist/main.a356f552d9838b9e.js +1 -0
- package/dist/material-icons-outlined.78a93b2079680a08.woff +0 -0
- package/dist/material-icons-outlined.f86cb7b0aa53f0fe.woff2 +0 -0
- package/dist/material-icons-round.92dc7ca2f4c591e7.woff +0 -0
- package/dist/material-icons-round.b10ec9db5b7fbc74.woff2 +0 -0
- package/dist/material-icons-sharp.3885863ee4746422.woff2 +0 -0
- package/dist/material-icons-sharp.a71cb2bf66c604de.woff +0 -0
- package/dist/material-icons-two-tone.588d63134de807a7.woff +0 -0
- package/dist/material-icons-two-tone.675bd578bd14533e.woff2 +0 -0
- package/dist/material-icons.4ad034d2c499d9b6.woff +0 -0
- package/dist/material-icons.59322316b3fd6063.woff2 +0 -0
- package/dist/polyfills.2696a6f9dc75535e.js +1 -0
- package/dist/roboto-bold-webfont.29ac6158e35aee95.woff +0 -0
- package/dist/roboto-bold-webfont.568ab1fa3f154a77.svg +10486 -0
- package/dist/roboto-bold-webfont.6bcfbdc216b3bc78.woff2 +0 -0
- package/dist/roboto-bold-webfont.7c22a4dfdee2ff33.ttf +0 -0
- package/dist/roboto-light-webfont.13492ec56771eeee.svg +9998 -0
- package/dist/roboto-light-webfont.61fa26c99b07ac83.woff2 +0 -0
- package/dist/roboto-light-webfont.95295ce84942d8ce.ttf +0 -0
- package/dist/roboto-light-webfont.ae19119a2889dfdf.woff +0 -0
- package/dist/roboto-medium-webfont.30344f0411888055.woff +0 -0
- package/dist/roboto-medium-webfont.57fb00cab0317d2d.woff2 +0 -0
- package/dist/roboto-medium-webfont.a40869e060a388c0.ttf +0 -0
- package/dist/roboto-medium-webfont.ea02241c29620c02.svg +10487 -0
- package/dist/roboto-regular-webfont.2b0501b72f5a94d5.ttf +0 -0
- package/dist/roboto-regular-webfont.2ce0ba9a06424965.svg +10004 -0
- package/dist/roboto-regular-webfont.ae47f6f1292d196f.woff2 +0 -0
- package/dist/roboto-regular-webfont.f58066a2d9061006.woff +0 -0
- package/dist/roboto-thin-webfont.0a64479870f676e8.ttf +0 -0
- package/dist/roboto-thin-webfont.0f7221f5c7e972ef.woff2 +0 -0
- package/dist/roboto-thin-webfont.51b221e22714b1fe.svg +10012 -0
- package/dist/roboto-thin-webfont.dac941649dd4eac0.woff +0 -0
- package/dist/runtime.8ef63094e52a66ba.js +1 -0
- package/dist/scripts.1c3385254ff4c93c.js +1 -0
- package/dist/styles.cf8e3cf50d039a5c.css +1 -0
- package/fuxa.js +39 -0
- package/main.js +381 -0
- package/package.json +68 -0
- package/paths.js +44 -0
- package/project.default.json +11 -0
- package/project.demo.fuxap +1 -0
- package/runtime/alarms/alarmstorage.js +205 -0
- package/runtime/alarms/index.js +678 -0
- package/runtime/devices/bacnet/index.js +730 -0
- package/runtime/devices/device-utils.js +95 -0
- package/runtime/devices/device.js +551 -0
- package/runtime/devices/ethernetip/index.js +381 -0
- package/runtime/devices/fuxaserver/index.js +310 -0
- package/runtime/devices/httprequest/index.js +495 -0
- package/runtime/devices/index.js +489 -0
- package/runtime/devices/modbus/datatypes.js +122 -0
- package/runtime/devices/modbus/index.js +730 -0
- package/runtime/devices/mqtt/index.js +618 -0
- package/runtime/devices/odbc/index.js +408 -0
- package/runtime/devices/opcua/index.js +817 -0
- package/runtime/devices/s7/datatypes.js +88 -0
- package/runtime/devices/s7/index.js +702 -0
- package/runtime/devices/template/index.js +141 -0
- package/runtime/events.js +33 -0
- package/runtime/index.js +559 -0
- package/runtime/jobs/cleaner.js +74 -0
- package/runtime/jobs/fonts/LICENSE.txt +202 -0
- package/runtime/jobs/fonts/Roboto-Black.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-BlackItalic.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-Bold.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-BoldItalic.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-Italic.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-Light.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-LightItalic.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-Medium.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-MediumItalic.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-Regular.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-Thin.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-ThinItalic.ttf +0 -0
- package/runtime/jobs/helper/image-generator.js +82 -0
- package/runtime/jobs/index.js +214 -0
- package/runtime/jobs/report.js +353 -0
- package/runtime/logger.js +113 -0
- package/runtime/notificator/index.js +383 -0
- package/runtime/notificator/notifystorage.js +179 -0
- package/runtime/plugins/index.js +255 -0
- package/runtime/project/index.js +959 -0
- package/runtime/project/prjstorage.js +222 -0
- package/runtime/scripts/index.js +313 -0
- package/runtime/scripts/msm.js +146 -0
- package/runtime/storage/calculator.js +227 -0
- package/runtime/storage/daqstorage.js +188 -0
- package/runtime/storage/influxdb/index.js +240 -0
- package/runtime/storage/sqlite/currentstorage.js +144 -0
- package/runtime/storage/sqlite/index.js +695 -0
- package/runtime/storage/tdengine/index.js +106 -0
- package/runtime/users/index.js +123 -0
- package/runtime/users/usrstorage.js +201 -0
- package/runtime/utils.js +284 -0
- package/screenshot/feature-action-move.gif +0 -0
- package/screenshot/fuxa-ani.gif +0 -0
- package/screenshot/fuxa-device.gif +0 -0
- package/screenshot/fuxa-editor.png +0 -0
- package/screenshot/fuxa-hmi.gif +0 -0
- package/screenshot/fuxa-home.png +0 -0
- package/screenshot/fuxa-test.gif +0 -0
- package/settings.default.js +65 -0
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Notificator manager: check, save, send mails to notificate alarms, events
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
'use strict';
|
|
6
|
+
const nodemailer = require('nodemailer');
|
|
7
|
+
// const notifystorage = require('./notifystorage');
|
|
8
|
+
|
|
9
|
+
var NOTIFY_CHECK_STATUS_INTERVAL = 1000 * 60;
|
|
10
|
+
var MILLI_MINUTE = 60000;
|
|
11
|
+
|
|
12
|
+
function NotificatorManager(_runtime) {
|
|
13
|
+
var runtime = _runtime;
|
|
14
|
+
var events = runtime.events; // Events to commit change to runtime
|
|
15
|
+
var settings = runtime.settings; // Settings
|
|
16
|
+
var logger = runtime.logger; // Logger
|
|
17
|
+
var notifyCheckStatus = null; // TimerInterval to check Notificator status
|
|
18
|
+
var working = false; // Working flag to manage overloading of check notificator status
|
|
19
|
+
var notificationsSubsctiption = {}; // Notifications matrix, grupped by subscriptions type
|
|
20
|
+
var status = NotifyStatusEnum.INIT; // Current status (StateMachine)
|
|
21
|
+
var clearNotifications = false; // Flag to clear current notifications from DB
|
|
22
|
+
var lastCheck = 0; // Timestamp to check intervall only in IDLE
|
|
23
|
+
var subscriptionStatus = {}; // Status of subscription, to check if there are some change
|
|
24
|
+
var notificationsFound = 0; // Notifications found to check
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Start TimerInterval to check Notifications
|
|
28
|
+
*/
|
|
29
|
+
this.start = function () {
|
|
30
|
+
return new Promise(function (resolve, reject) {
|
|
31
|
+
logger.info('notificator check start', true);
|
|
32
|
+
notifyCheckStatus = setInterval(function () {
|
|
33
|
+
_checkStatus(); // check in 20 seconds interval
|
|
34
|
+
}, 20000);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Stop StateMachine, break TimerInterval (_checkStatus)
|
|
40
|
+
*/
|
|
41
|
+
this.stop = function () {
|
|
42
|
+
return new Promise(function (resolve, reject) {
|
|
43
|
+
logger.info('notificator.stop-checkstatus!', true);
|
|
44
|
+
if (notifyCheckStatus) {
|
|
45
|
+
clearInterval(notifyCheckStatus);
|
|
46
|
+
notifyCheckStatus = null;
|
|
47
|
+
status = NotifyStatusEnum.INIT;
|
|
48
|
+
working = false;
|
|
49
|
+
}
|
|
50
|
+
resolve();
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
this.reset = function () {
|
|
55
|
+
this.clear();
|
|
56
|
+
status = NotifyStatusEnum.LOAD;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
this.clear = function () {
|
|
60
|
+
clearNotifications = true;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
this.clearNotifications = function (all) {
|
|
64
|
+
return new Promise(function (resolve, reject) {
|
|
65
|
+
resolve();
|
|
66
|
+
// notifystorage.clearNotifications(all).then((result) => {
|
|
67
|
+
// resolve(true);
|
|
68
|
+
// }).catch(function (err) {
|
|
69
|
+
// reject(err);
|
|
70
|
+
// });
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
this.forceCheck = function () {
|
|
75
|
+
lastCheck = 0;
|
|
76
|
+
_checkStatus();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Check the Notify state machine
|
|
81
|
+
*/
|
|
82
|
+
var _checkStatus = function () {
|
|
83
|
+
if (status === NotifyStatusEnum.INIT) {
|
|
84
|
+
if (_checkWorking(true)) {
|
|
85
|
+
_init().then(function () {
|
|
86
|
+
status = NotifyStatusEnum.LOAD;
|
|
87
|
+
_checkWorking(false);
|
|
88
|
+
}).catch(function (err) {
|
|
89
|
+
_checkWorking(false);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
} else if (status === NotifyStatusEnum.LOAD) {
|
|
93
|
+
if (_checkWorking(true)) {
|
|
94
|
+
_loadProperty().then(function () {
|
|
95
|
+
_loadNotifications().then(function () {
|
|
96
|
+
status = NotifyStatusEnum.IDLE;
|
|
97
|
+
_checkWorking(false);
|
|
98
|
+
}).catch(function (err) {
|
|
99
|
+
_checkWorking(false);
|
|
100
|
+
});
|
|
101
|
+
}).catch(function (err) {
|
|
102
|
+
_checkWorking(false);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
} else if (status === NotifyStatusEnum.IDLE) {
|
|
106
|
+
if (notificationsFound) {
|
|
107
|
+
var current = new Date().getTime();
|
|
108
|
+
if (current - lastCheck > NOTIFY_CHECK_STATUS_INTERVAL) {
|
|
109
|
+
lastCheck = current;
|
|
110
|
+
if (_checkWorking(true)) {
|
|
111
|
+
_checkNotifications().then(function () {
|
|
112
|
+
_checkWorking(false);
|
|
113
|
+
}).catch(function (err) {
|
|
114
|
+
_checkWorking(false);
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Init Notificator database
|
|
124
|
+
*/
|
|
125
|
+
var _init = function () {
|
|
126
|
+
return new Promise(function (resolve, reject) {
|
|
127
|
+
resolve();
|
|
128
|
+
// notifystorage.init(settings, logger).then(result => {
|
|
129
|
+
// logger.info('notificator.notifystorage-init-successful!', true);
|
|
130
|
+
// resolve();
|
|
131
|
+
// }).catch(function (err) {
|
|
132
|
+
// logger.error('notificator.notifystorage.failed-to-init: ' + err);
|
|
133
|
+
// reject(err);
|
|
134
|
+
// });
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
var _checkWorking = function (check) {
|
|
139
|
+
if (check && working) {
|
|
140
|
+
logger.warn('notificator working (check) overload!');
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
working = check;
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Load Notifications property in local for check
|
|
149
|
+
*/
|
|
150
|
+
var _loadProperty = function () {
|
|
151
|
+
return new Promise(function (resolve, reject) {
|
|
152
|
+
notificationsSubsctiption = {};
|
|
153
|
+
notificationsFound = 0;
|
|
154
|
+
runtime.project.getNotifications().then(function (result) {
|
|
155
|
+
if (result) {
|
|
156
|
+
result.forEach(notification => {
|
|
157
|
+
if (notification.enabled) {
|
|
158
|
+
Object.keys(notification.subscriptions).forEach(sub => {
|
|
159
|
+
if (notification.subscriptions[sub]) {
|
|
160
|
+
if (!notificationsSubsctiption[sub]) {
|
|
161
|
+
notificationsSubsctiption[sub] = [];
|
|
162
|
+
}
|
|
163
|
+
var temp = new Notification(notification.id, notification.name, notification.type);
|
|
164
|
+
temp.receiver = notification.receiver;
|
|
165
|
+
temp.delay = notification.delay;
|
|
166
|
+
temp.interval = notification.interval;
|
|
167
|
+
temp.enabled = notification.enabled;
|
|
168
|
+
temp.text = notification.text;
|
|
169
|
+
temp.subscriptions = notification.subscriptions;
|
|
170
|
+
temp.options = notification.options;
|
|
171
|
+
notificationsSubsctiption[sub].push(temp);
|
|
172
|
+
notificationsFound++;
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
resolve();
|
|
179
|
+
}).catch(function (err) {
|
|
180
|
+
reject(err);
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Load current Notifications and merge with loaded property
|
|
188
|
+
*/
|
|
189
|
+
var _loadNotifications = function () {
|
|
190
|
+
return new Promise(function (resolve, reject) {
|
|
191
|
+
resolve();
|
|
192
|
+
// if (clearNotifications) {
|
|
193
|
+
// notifystorage.clearNotifications().then(result => {
|
|
194
|
+
// resolve();
|
|
195
|
+
// clearNotifications = false;
|
|
196
|
+
// }).catch(function (err) {
|
|
197
|
+
// logger.error('notificator.clear-current.failed: ' + err);
|
|
198
|
+
// reject(err);
|
|
199
|
+
// });
|
|
200
|
+
// } else {
|
|
201
|
+
// notifystorage.getNotifications().then(result => {
|
|
202
|
+
// Object.keys(notificationsSubsctiption).forEach(subkey => {
|
|
203
|
+
// notificationsSubsctiption[subkey].forEach(notification => {
|
|
204
|
+
// var currentNotify = result.find(currentNotify => currentNotify.id === notification.id);
|
|
205
|
+
// if (currentNotify) {
|
|
206
|
+
// notification.ontime = currentNotify.ontime;
|
|
207
|
+
// notification.notifytime = currentNotify.notifytime;
|
|
208
|
+
// }
|
|
209
|
+
// });
|
|
210
|
+
// });
|
|
211
|
+
// resolve();
|
|
212
|
+
// }).catch(function (err) {
|
|
213
|
+
// logger.error('notificator.load-current.failed: ' + err);
|
|
214
|
+
// reject(err);
|
|
215
|
+
// });
|
|
216
|
+
// }
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Check Notifications status
|
|
222
|
+
*/
|
|
223
|
+
var _checkNotifications = function () {
|
|
224
|
+
return new Promise(function (resolve, reject) {
|
|
225
|
+
var time = new Date().getTime();
|
|
226
|
+
// check alarms categorie subscriptions
|
|
227
|
+
runtime.alarmsMgr.getAlarmsStatus().then(alarmsStatus => {
|
|
228
|
+
Object.keys(alarmsStatus).forEach(stkey => {
|
|
229
|
+
if (alarmsStatus[stkey]) {
|
|
230
|
+
if ((notificationsSubsctiption[stkey] && notificationsSubsctiption[stkey].length)) {
|
|
231
|
+
var statusChanged = !subscriptionStatus[stkey] || subscriptionStatus[stkey] < alarmsStatus[stkey];
|
|
232
|
+
for (var i = 0; i < notificationsSubsctiption[stkey].length; i++) {
|
|
233
|
+
var notification = notificationsSubsctiption[stkey][i];
|
|
234
|
+
if (notification.checkToNotify(time, statusChanged)) {
|
|
235
|
+
try {
|
|
236
|
+
// get alarms summary in text format
|
|
237
|
+
var alarmsSummary = runtime.alarmsMgr.getAlarmsString(stkey) || 'FUXA Alarms Error!';
|
|
238
|
+
var mail = new MailMessage(null, notification.receiver, notification.name, alarmsSummary);
|
|
239
|
+
runtime.notificatorMgr.sendMail(mail, null).then(function () {
|
|
240
|
+
notification.setNotify(time, stkey);
|
|
241
|
+
logger.info(`notificator.notify.successful: ${new Date()} ${notification.name} ${stkey} ${alarmsSummary}`);
|
|
242
|
+
}).catch(function (senderr) {
|
|
243
|
+
logger.error(`notificator.notify.send.failed: ${senderr}`);
|
|
244
|
+
});
|
|
245
|
+
} catch (e) {
|
|
246
|
+
logger.error(`notificator.notify.failed: ${err}`);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
} else if (subscriptionStatus[stkey]) {
|
|
252
|
+
// to reset
|
|
253
|
+
for (var i = 0; i < notificationsSubsctiption[stkey].length; i++) {
|
|
254
|
+
var notification = notificationsSubsctiption[stkey][i];
|
|
255
|
+
notification.reset();
|
|
256
|
+
logger.info(`notificator.notify.toreset: ${notification.name} ${stkey}`);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
subscriptionStatus[stkey] = alarmsStatus[stkey];
|
|
260
|
+
});
|
|
261
|
+
resolve(true);
|
|
262
|
+
}).catch(function (err) {
|
|
263
|
+
reject(err);
|
|
264
|
+
});
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Send mail
|
|
270
|
+
* @returns
|
|
271
|
+
*/
|
|
272
|
+
this.sendMail = function (msg, smtp) {
|
|
273
|
+
return new Promise(async function (resolve, reject) {
|
|
274
|
+
try {
|
|
275
|
+
var smtpServer = smtp || settings.smtp;
|
|
276
|
+
if (smtpServer && smtpServer.host && smtpServer.port && smtpServer.username && smtpServer.password) {
|
|
277
|
+
const transporter = nodemailer.createTransport({
|
|
278
|
+
host: smtpServer.host,
|
|
279
|
+
port: smtpServer.port,
|
|
280
|
+
secure: (smtpServer.port === 465) ? true : false, // true for 465, false for other ports
|
|
281
|
+
auth: {
|
|
282
|
+
user: smtpServer.username,
|
|
283
|
+
pass: smtpServer.password
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
if (!msg.from || smtpServer.mailsender) {
|
|
287
|
+
msg.from = smtpServer.mailsender || smtpServer.username;
|
|
288
|
+
}
|
|
289
|
+
let info = await transporter.sendMail(msg);
|
|
290
|
+
console.log(info.messageId);
|
|
291
|
+
resolve(`Message sent: ${info.messageId}`);
|
|
292
|
+
} else {
|
|
293
|
+
reject('SMTP data error!');
|
|
294
|
+
}
|
|
295
|
+
} catch (err) {
|
|
296
|
+
reject(err);
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
this.sendMailMessage = function (from, to, subj, text, html, attachments) {
|
|
302
|
+
let mail = new MailMessage(from, to, subj, text, html, attachments);
|
|
303
|
+
return this.sendMail(mail, null);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// check if alarms status chenaged
|
|
307
|
+
events.on('alarms-status:changed', this.forceCheck);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
module.exports = {
|
|
311
|
+
create: function (runtime) {
|
|
312
|
+
return new NotificatorManager(runtime);
|
|
313
|
+
},
|
|
314
|
+
createMessage: function(from, to, subj, text, html, attachments) {
|
|
315
|
+
return new MailMessage(from, to, subj, text, html, attachments);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* State of Notificator manager
|
|
321
|
+
*/
|
|
322
|
+
var NotifyStatusEnum = {
|
|
323
|
+
INIT: 'init',
|
|
324
|
+
LOAD: 'load',
|
|
325
|
+
IDLE: 'idle',
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
function Notification(id, name, type) {
|
|
329
|
+
this.id = id;
|
|
330
|
+
this.name = name;
|
|
331
|
+
this.type = type;
|
|
332
|
+
this.receiver;
|
|
333
|
+
this.delay = 1;
|
|
334
|
+
this.interval = 0;
|
|
335
|
+
this.ontime = 0;
|
|
336
|
+
this.notifytime = 0;
|
|
337
|
+
this.notifytype = '';
|
|
338
|
+
this.enabled = true;
|
|
339
|
+
this.text;
|
|
340
|
+
this.subscriptions = {};
|
|
341
|
+
this.options;
|
|
342
|
+
|
|
343
|
+
this.hasSubscriptions = function () {
|
|
344
|
+
return Object.keys(this.subscriptions).length ? true : false;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
this.checkToNotify = function (time, changed) {
|
|
348
|
+
if (!this.ontime) {
|
|
349
|
+
this.ontime = time;
|
|
350
|
+
return false;
|
|
351
|
+
}
|
|
352
|
+
var result = true;
|
|
353
|
+
if (this.ontime + (this.delay * MILLI_MINUTE) > time) {
|
|
354
|
+
result = false;
|
|
355
|
+
} else if (this.notifytime && (this.interval <= 0 || this.notifytime + (this.interval * MILLI_MINUTE) > time)) {
|
|
356
|
+
result = false;
|
|
357
|
+
} else if (changed) { // !this.notifytime
|
|
358
|
+
this.ontime = time;
|
|
359
|
+
result = true;
|
|
360
|
+
}
|
|
361
|
+
return result;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
this.setNotify = function (time, type) {
|
|
365
|
+
this.notifytime = time;
|
|
366
|
+
this.notifytype = type;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
this.reset = function () {
|
|
370
|
+
this.ontime = 0;
|
|
371
|
+
this.notifytime = 0;
|
|
372
|
+
this.notifytype = '';
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
function MailMessage(from, to, subj, text, html, attachments) {
|
|
377
|
+
this.from = from;
|
|
378
|
+
this.to = to;
|
|
379
|
+
this.subject = subj;
|
|
380
|
+
this.text = text;
|
|
381
|
+
this.html = html;
|
|
382
|
+
this.attachments = attachments;
|
|
383
|
+
}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Module to manage the notifications in a database
|
|
3
|
+
* Table: 'alarms', 'chronicle'
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
const fs = require('fs');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
var sqlite3 = require('sqlite3').verbose();
|
|
11
|
+
|
|
12
|
+
var settings // Application settings
|
|
13
|
+
var logger; // Application logger
|
|
14
|
+
var db_notifications; // Database of notifications
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Init and bind the database resource
|
|
18
|
+
* @param {*} _settings
|
|
19
|
+
* @param {*} _log
|
|
20
|
+
*/
|
|
21
|
+
function init(_settings, _log) {
|
|
22
|
+
settings = _settings;
|
|
23
|
+
logger = _log;
|
|
24
|
+
|
|
25
|
+
return _bind();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Bind the database resource by create the table if not exist
|
|
30
|
+
*/
|
|
31
|
+
function _bind() {
|
|
32
|
+
return new Promise(function (resolve, reject) {
|
|
33
|
+
var dbfile = path.join(settings.workDir, 'notifications.fuxap.db');
|
|
34
|
+
var dbfileExist = fs.existsSync(dbfile);
|
|
35
|
+
|
|
36
|
+
db_notifications = new sqlite3.Database(dbfile, function (err) {
|
|
37
|
+
if (err) {
|
|
38
|
+
logger.error('notifystorage.failed-to-bind: ' + err);
|
|
39
|
+
reject();
|
|
40
|
+
}
|
|
41
|
+
logger.info('notifystorage.connected-to ' + dbfile + ' database.', true);
|
|
42
|
+
});
|
|
43
|
+
// prepare query
|
|
44
|
+
// var sql = "CREATE TABLE if not exists notifications (id TEXT PRIMARY KEY, name TEXT, type TEXT, ontime INTEGER, notifytime INTEGER, notifytype TEXT, options TEXT);";
|
|
45
|
+
var sql = "CREATE TABLE if not exists chronicle (Sn INTEGER, id TEXT, name TEXT, type TEXT, receiver TEXT, text TEXT, notifytime INTEGER, notifytype TEXT, PRIMARY KEY(Sn AUTOINCREMENT));";
|
|
46
|
+
db_notifications.exec(sql, function (err) {
|
|
47
|
+
if (err) {
|
|
48
|
+
logger.error('notifystorage.failed-to-bind: ' + err);
|
|
49
|
+
reject();
|
|
50
|
+
} else {
|
|
51
|
+
resolve(dbfileExist);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Clear all Notifications from table
|
|
59
|
+
*/
|
|
60
|
+
function clearNotifications(all) {
|
|
61
|
+
return new Promise(function (resolve, reject) {
|
|
62
|
+
var sql = "DELETE FROM notifications;";
|
|
63
|
+
if (all) {
|
|
64
|
+
sql += "DELETE FROM chronicle;";
|
|
65
|
+
}
|
|
66
|
+
db_notifications.exec(sql, function (err, rows) {
|
|
67
|
+
if (err) {
|
|
68
|
+
reject(err);
|
|
69
|
+
} else {
|
|
70
|
+
resolve(rows);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Return the Notifications list
|
|
78
|
+
*/
|
|
79
|
+
function getNotifications() {
|
|
80
|
+
return new Promise(function (resolve, reject) {
|
|
81
|
+
if (!db_notifications) {
|
|
82
|
+
reject(false);
|
|
83
|
+
} else {
|
|
84
|
+
var sql = "SELECT * FROM notifications";
|
|
85
|
+
db_notifications.all(sql, function (err, rows) {
|
|
86
|
+
if (err) {
|
|
87
|
+
reject(err);
|
|
88
|
+
} else {
|
|
89
|
+
resolve(rows);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Return the Notifications history
|
|
98
|
+
*/
|
|
99
|
+
function getNotificationsHistory(from, to) {
|
|
100
|
+
return new Promise(function (resolve, reject) {
|
|
101
|
+
if (!db_notifications) {
|
|
102
|
+
reject(false);
|
|
103
|
+
} else {
|
|
104
|
+
// var sql = "SELECT * FROM history WHERE dt BETWEEN ? and ? ORDER BY dt ASC";
|
|
105
|
+
// db_notifications.all(sql, [from, to], function (err, rows) {
|
|
106
|
+
var sql = "SELECT * FROM chronicle ORDER BY ontime DESC";
|
|
107
|
+
db_notifications.all(sql, function (err, rows) {
|
|
108
|
+
if (err) {
|
|
109
|
+
reject(err);
|
|
110
|
+
} else {
|
|
111
|
+
resolve(rows);
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Set Notifications value in database
|
|
120
|
+
*/
|
|
121
|
+
function setNotification(notification) {
|
|
122
|
+
return new Promise(function (resolve, reject) {
|
|
123
|
+
// prepare query
|
|
124
|
+
if (notification) {
|
|
125
|
+
var sql = "";
|
|
126
|
+
//is notification is changed insert or update record
|
|
127
|
+
// sql += "INSERT OR REPLACE INTO notifications (id, name, type, ontime, notifytime, notifytype) VALUES('" + notification.id + "','" +
|
|
128
|
+
// notification.type + "','" + notification.name + "','" + notification.ontime + "','" + notification.notifytime + "','" + notification.notifytype + "');";
|
|
129
|
+
sql += "INSERT OR REPLACE INTO chronicle (id, name, type, receiver, text, notifytime, notifytype) VALUES('" +
|
|
130
|
+
notification.id + "','" + notification.name + "','" + notification.type + "','" + notification.receiver + "','" +
|
|
131
|
+
notification.text + "','" + notification.notifytime + "','" + notification.notifytype + "');";
|
|
132
|
+
db_notifications.exec(sql, function (err) {
|
|
133
|
+
if (err) {
|
|
134
|
+
logger.error('notifystorage.failed-to-set: ' + err);
|
|
135
|
+
reject();
|
|
136
|
+
} else {
|
|
137
|
+
resolve();
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Close the database
|
|
146
|
+
*/
|
|
147
|
+
function close() {
|
|
148
|
+
if (db_notifications) {
|
|
149
|
+
db_notifications.close();
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Remove Notification from database
|
|
155
|
+
*/
|
|
156
|
+
function removeNotification(notification) {
|
|
157
|
+
return new Promise(function (resolve, reject) {
|
|
158
|
+
// prepare query
|
|
159
|
+
var sql = "DELETE FROM notifications WHERE id = '" + notification.id + "'";
|
|
160
|
+
db_notifications.exec(sql, function (err) {
|
|
161
|
+
if (err) {
|
|
162
|
+
logger.error('notificationsstorage.failed-to-remove: ' + err);
|
|
163
|
+
reject();
|
|
164
|
+
} else {
|
|
165
|
+
resolve();
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
module.exports = {
|
|
172
|
+
init: init,
|
|
173
|
+
close: close,
|
|
174
|
+
getNotifications: getNotifications,
|
|
175
|
+
getNotificationsHistory: getNotificationsHistory,
|
|
176
|
+
setNotification: setNotification,
|
|
177
|
+
clearNotifications: clearNotifications,
|
|
178
|
+
removeNotification: removeNotification
|
|
179
|
+
};
|