@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,959 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Project manager: read, write, add, remove, ... and save
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
'use strict';
|
|
6
|
+
|
|
7
|
+
const fs = require('fs');
|
|
8
|
+
const path = require('path');
|
|
9
|
+
const async = require('async');
|
|
10
|
+
|
|
11
|
+
var events = require('../events');
|
|
12
|
+
var utils = require('../utils');
|
|
13
|
+
const prjstorage = require('./prjstorage');
|
|
14
|
+
const DeviceType = require('../devices/device').DeviceType;
|
|
15
|
+
|
|
16
|
+
const version = '1.02';
|
|
17
|
+
var settings; // Application settings
|
|
18
|
+
var logger; // Application logger
|
|
19
|
+
|
|
20
|
+
var data = {}; // Project data
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Init Project resource and update project
|
|
24
|
+
* @param {*} _settings
|
|
25
|
+
* @param {*} log
|
|
26
|
+
*/
|
|
27
|
+
function init(_settings, log) {
|
|
28
|
+
settings = _settings;
|
|
29
|
+
logger = log;
|
|
30
|
+
|
|
31
|
+
// Init Project database
|
|
32
|
+
return new Promise(function (resolve, reject) {
|
|
33
|
+
prjstorage.init(settings, logger).then(result => {
|
|
34
|
+
logger.info('project.prjstorage-init-successful!', true);
|
|
35
|
+
if (result) {
|
|
36
|
+
resolve();
|
|
37
|
+
} else {
|
|
38
|
+
prjstorage.setDefault().then(result => {
|
|
39
|
+
logger.info('project.prjstorage-set-default-successful!', true);
|
|
40
|
+
resolve();
|
|
41
|
+
}).catch(function (err) {
|
|
42
|
+
logger.error(`project.prjstorage-set-default failed! ${err}`);
|
|
43
|
+
resolve();
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}).catch(function (err) {
|
|
47
|
+
logger.error(`project.prjstorage-failed-to-init! ${err}`);
|
|
48
|
+
reject(err);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Load project resource in a local data
|
|
55
|
+
* Read all storaged sections and fill in local data
|
|
56
|
+
*/
|
|
57
|
+
function load() {
|
|
58
|
+
return new Promise(function (resolve, reject) {
|
|
59
|
+
data = { devices: {}, hmi: { views: [] }, texts: [], alarms: [] };
|
|
60
|
+
// load general data
|
|
61
|
+
prjstorage.getSection(prjstorage.TableType.GENERAL).then(grows => {
|
|
62
|
+
for (var ig = 0; ig < grows.length; ig++) {
|
|
63
|
+
if (grows[ig].name === ProjectDataCmdType.HmiLayout) {
|
|
64
|
+
data.hmi[grows[ig].name] = JSON.parse(grows[ig].value);
|
|
65
|
+
} else {
|
|
66
|
+
data[grows[ig].name] = JSON.parse(grows[ig].value);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
// load views
|
|
70
|
+
prjstorage.getSection(prjstorage.TableType.VIEWS).then(vrows => {
|
|
71
|
+
for (var iv = 0; iv < vrows.length; iv++) {
|
|
72
|
+
data.hmi.views.push(JSON.parse(vrows[iv].value));
|
|
73
|
+
}
|
|
74
|
+
// load devices
|
|
75
|
+
prjstorage.getSection(prjstorage.TableType.DEVICES).then(drows => {
|
|
76
|
+
for (var id = 0; id < drows.length; id++) {
|
|
77
|
+
if (drows[id].name === 'server') {
|
|
78
|
+
data[drows[id].name] = JSON.parse(drows[id].value);
|
|
79
|
+
} else {
|
|
80
|
+
data.devices[drows[id].name] = JSON.parse(drows[id].value);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
async.series([
|
|
84
|
+
// step 1 get texts
|
|
85
|
+
function (callback) {
|
|
86
|
+
getTexts().then(texts => {
|
|
87
|
+
data.texts = texts;
|
|
88
|
+
callback();
|
|
89
|
+
}).catch(function (err) {
|
|
90
|
+
logger.error(`project.prjstorage-failed-to-load! '${prjstorage.TableType.TEXTS}' ${err}`);
|
|
91
|
+
callback(err);
|
|
92
|
+
});
|
|
93
|
+
},
|
|
94
|
+
// step 2 get alarms
|
|
95
|
+
function (callback) {
|
|
96
|
+
getAlarms().then(alarms => {
|
|
97
|
+
data.alarms = alarms;
|
|
98
|
+
callback();
|
|
99
|
+
}).catch(function (err) {
|
|
100
|
+
logger.error(`project.prjstorage-failed-to-load! '${prjstorage.TableType.ALARMS}' ${err}`);
|
|
101
|
+
callback(err);
|
|
102
|
+
});
|
|
103
|
+
},
|
|
104
|
+
// step 3 get notifications
|
|
105
|
+
function (callback) {
|
|
106
|
+
getNotifications().then(notifications => {
|
|
107
|
+
data.notifications = notifications;
|
|
108
|
+
callback();
|
|
109
|
+
}).catch(function (err) {
|
|
110
|
+
logger.error(`project.prjstorage-failed-to-load! '${prjstorage.TableType.NOTIFICATIONS}' ${err}`);
|
|
111
|
+
callback(err);
|
|
112
|
+
});
|
|
113
|
+
},
|
|
114
|
+
// step 4 get scripts
|
|
115
|
+
function (callback) {
|
|
116
|
+
getScripts().then(scripts => {
|
|
117
|
+
data.scripts = scripts;
|
|
118
|
+
callback();
|
|
119
|
+
}).catch(function (err) {
|
|
120
|
+
logger.error(`project.prjstorage-failed-to-load! '${prjstorage.TableType.SCRIPTS}' ${err}`);
|
|
121
|
+
callback(err);
|
|
122
|
+
});
|
|
123
|
+
},
|
|
124
|
+
// step 5 get reports
|
|
125
|
+
function (callback) {
|
|
126
|
+
getReports().then(reports => {
|
|
127
|
+
data.reports = reports;
|
|
128
|
+
callback();
|
|
129
|
+
}).catch(function (err) {
|
|
130
|
+
logger.error(`project.prjstorage-failed-to-load! '${prjstorage.TableType.REPORTS}' ${err}`);
|
|
131
|
+
callback(err);
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
],
|
|
135
|
+
async function (err) {
|
|
136
|
+
if (err) {
|
|
137
|
+
reject(err);
|
|
138
|
+
} else {
|
|
139
|
+
await _mergeDefaultConfig();
|
|
140
|
+
resolve();
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
}).catch(function (err) {
|
|
144
|
+
logger.error(`project.prjstorage-failed-to-load! '${prjstorage.TableType.DEVICES}' ${err}`);
|
|
145
|
+
reject(err);
|
|
146
|
+
});
|
|
147
|
+
}).catch(function (err) {
|
|
148
|
+
logger.error(`project.prjstorage-failed-to-load! '${prjstorage.TableType.VIEWS}' ${err}`);
|
|
149
|
+
reject(err);
|
|
150
|
+
});
|
|
151
|
+
}).catch(function (err) {
|
|
152
|
+
logger.error(`project.prjstorage-failed-to-load! '${prjstorage.TableType.GENERAL}' ${err}`);
|
|
153
|
+
reject(err);
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Save the value in project storage
|
|
160
|
+
* First set the value in local data, then save in storage
|
|
161
|
+
* @param {*} cmd
|
|
162
|
+
* @param {*} data
|
|
163
|
+
*/
|
|
164
|
+
function setProjectData(cmd, value) {
|
|
165
|
+
return new Promise(function (resolve, reject) {
|
|
166
|
+
try {
|
|
167
|
+
var toremove = false;
|
|
168
|
+
var section = { table: '', name: '', value: value };
|
|
169
|
+
if (cmd === ProjectDataCmdType.SetView) {
|
|
170
|
+
section.table = prjstorage.TableType.VIEWS;
|
|
171
|
+
section.name = value.id;
|
|
172
|
+
setView(value);
|
|
173
|
+
} else if (cmd === ProjectDataCmdType.DelView) {
|
|
174
|
+
section.table = prjstorage.TableType.VIEWS;
|
|
175
|
+
section.name = value.id;
|
|
176
|
+
toremove = removeView(value);
|
|
177
|
+
} else if (cmd === ProjectDataCmdType.HmiLayout) {
|
|
178
|
+
section.table = prjstorage.TableType.GENERAL;
|
|
179
|
+
section.name = cmd;
|
|
180
|
+
setHmiLayout(value);
|
|
181
|
+
} else if (cmd === ProjectDataCmdType.SetDevice) {
|
|
182
|
+
section.table = prjstorage.TableType.DEVICES;
|
|
183
|
+
section.name = value.id;
|
|
184
|
+
setDevice(value);
|
|
185
|
+
} else if (cmd === ProjectDataCmdType.DelDevice) {
|
|
186
|
+
section.table = prjstorage.TableType.DEVICES;
|
|
187
|
+
section.name = value.id;
|
|
188
|
+
toremove = removeDevice(value);
|
|
189
|
+
} else if (cmd === ProjectDataCmdType.Charts) {
|
|
190
|
+
section.table = prjstorage.TableType.GENERAL;
|
|
191
|
+
section.name = cmd;
|
|
192
|
+
setCharts(value);
|
|
193
|
+
} else if (cmd === ProjectDataCmdType.Graphs) {
|
|
194
|
+
section.table = prjstorage.TableType.GENERAL;
|
|
195
|
+
section.name = cmd;
|
|
196
|
+
setGraphs(value);
|
|
197
|
+
} else if (cmd === ProjectDataCmdType.SetText) {
|
|
198
|
+
section.table = prjstorage.TableType.TEXTS;
|
|
199
|
+
section.name = value.name;
|
|
200
|
+
setText(value);
|
|
201
|
+
} else if (cmd === ProjectDataCmdType.DelText) {
|
|
202
|
+
section.table = prjstorage.TableType.TEXTS;
|
|
203
|
+
section.name = value.name;
|
|
204
|
+
toremove = removeText(value);
|
|
205
|
+
} else if (cmd === ProjectDataCmdType.SetAlarm) {
|
|
206
|
+
section.table = prjstorage.TableType.ALARMS;
|
|
207
|
+
section.name = value.name;
|
|
208
|
+
setAlarm(value);
|
|
209
|
+
} else if (cmd === ProjectDataCmdType.DelAlarm) {
|
|
210
|
+
section.table = prjstorage.TableType.ALARMS;
|
|
211
|
+
section.name = value.name;
|
|
212
|
+
toremove = removeAlarm(value);
|
|
213
|
+
} else if (cmd === ProjectDataCmdType.SetNotification) {
|
|
214
|
+
section.table = prjstorage.TableType.NOTIFICATIONS;
|
|
215
|
+
section.name = value.id;
|
|
216
|
+
setNotification(value);
|
|
217
|
+
} else if (cmd === ProjectDataCmdType.DelNotification) {
|
|
218
|
+
section.table = prjstorage.TableType.NOTIFICATIONS;
|
|
219
|
+
section.name = value.id;
|
|
220
|
+
toremove = removeNotification(value);
|
|
221
|
+
} else if (cmd === ProjectDataCmdType.SetScript) {
|
|
222
|
+
section.table = prjstorage.TableType.SCRIPTS;
|
|
223
|
+
section.name = value.id;
|
|
224
|
+
setScript(value);
|
|
225
|
+
} else if (cmd === ProjectDataCmdType.DelScript) {
|
|
226
|
+
section.table = prjstorage.TableType.SCRIPTS;
|
|
227
|
+
section.name = value.id;
|
|
228
|
+
toremove = removeScript(value);
|
|
229
|
+
} else if (cmd === ProjectDataCmdType.SetReport) {
|
|
230
|
+
section.table = prjstorage.TableType.REPORTS;
|
|
231
|
+
section.name = value.id;
|
|
232
|
+
setReport(value);
|
|
233
|
+
} else if (cmd === ProjectDataCmdType.DelReport) {
|
|
234
|
+
section.table = prjstorage.TableType.REPORTS;
|
|
235
|
+
section.name = value.id;
|
|
236
|
+
toremove = removeReport(value);
|
|
237
|
+
} else {
|
|
238
|
+
logger.error(`prjstorage.setdata failed! '${section.table}'`);
|
|
239
|
+
reject('prjstorage.failed-to-setdata: Command not found!');
|
|
240
|
+
}
|
|
241
|
+
if (toremove) {
|
|
242
|
+
prjstorage.deleteSection(section).then(result => {
|
|
243
|
+
resolve(true);
|
|
244
|
+
}).catch(function (err) {
|
|
245
|
+
logger.error(`prjstorage.deletedata failed! '${section.table}'`);
|
|
246
|
+
reject(err);
|
|
247
|
+
});
|
|
248
|
+
} else {
|
|
249
|
+
prjstorage.setSection(section).then(result => {
|
|
250
|
+
resolve(true);
|
|
251
|
+
}).catch(function (err) {
|
|
252
|
+
logger.error(`prjstorage.setdata failed! '${section.table}'`);
|
|
253
|
+
reject(err);
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
} catch (err) {
|
|
257
|
+
reject(err);
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Set or add if not exist (check with view.id) the View in Project
|
|
264
|
+
* @param {*} view
|
|
265
|
+
*/
|
|
266
|
+
function setView(view) {
|
|
267
|
+
var pos = -1;
|
|
268
|
+
for (var i = 0; i < data.hmi.views.length; i++) {
|
|
269
|
+
if (data.hmi.views[i].id === view.id) {
|
|
270
|
+
pos = i;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
if (pos >= 0) {
|
|
274
|
+
data.hmi.views[pos] = view;
|
|
275
|
+
} else {
|
|
276
|
+
data.hmi.views.push(view);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Remove the View from Project
|
|
282
|
+
* @param {*} view
|
|
283
|
+
*/
|
|
284
|
+
function removeView(view) {
|
|
285
|
+
var pos = -1;
|
|
286
|
+
for (var i = 0; i < data.hmi.views.length; i++) {
|
|
287
|
+
if (data.hmi.views[i].id === view.id) {
|
|
288
|
+
data.hmi.views.splice(i, 1);
|
|
289
|
+
return true;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
return false;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Set Device to local data
|
|
297
|
+
* @param {*} device
|
|
298
|
+
* @param {*} merge merge with exist (tags)
|
|
299
|
+
*/
|
|
300
|
+
function setDevice(device, merge) {
|
|
301
|
+
if (merge && data.devices[device.id]) {
|
|
302
|
+
device.enabled = data.devices[device.id].enabled;
|
|
303
|
+
data.devices[device.id] = {...data.devices[device.id], ...device};
|
|
304
|
+
} else {
|
|
305
|
+
data.devices[device.id] = device;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Remove Device from local data
|
|
311
|
+
* @param {*} device
|
|
312
|
+
*/
|
|
313
|
+
function removeDevice(device) {
|
|
314
|
+
delete data.devices[device.id];
|
|
315
|
+
return true;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Set HMI Layout to local data
|
|
320
|
+
* @param {*} layout
|
|
321
|
+
*/
|
|
322
|
+
function setHmiLayout(layout) {
|
|
323
|
+
data.hmi.layout = layout;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Set Charts
|
|
328
|
+
* @param {*} charts
|
|
329
|
+
*/
|
|
330
|
+
function setCharts(charts) {
|
|
331
|
+
data.charts = charts;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Set Graphs
|
|
336
|
+
* @param {*} graphs
|
|
337
|
+
*/
|
|
338
|
+
function setGraphs(graphs) {
|
|
339
|
+
data.graphs = graphs;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Set or add if not exist (check with taxt.name) the Text in Project
|
|
344
|
+
* @param {*} text
|
|
345
|
+
*/
|
|
346
|
+
function setText(text) {
|
|
347
|
+
if (!data.texts) {
|
|
348
|
+
data.texts = [];
|
|
349
|
+
}
|
|
350
|
+
var pos = -1;
|
|
351
|
+
for (var i = 0; i < data.texts.length; i++) {
|
|
352
|
+
if (data.texts[i].name === text.name) {
|
|
353
|
+
pos = i;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
if (pos >= 0) {
|
|
357
|
+
data.texts[pos] = text;
|
|
358
|
+
} else {
|
|
359
|
+
data.texts.push(text);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* Remove the Text from Project
|
|
365
|
+
* @param {*} text
|
|
366
|
+
*/
|
|
367
|
+
function removeText(text) {
|
|
368
|
+
if (data.texts) {
|
|
369
|
+
var pos = -1;
|
|
370
|
+
for (var i = 0; i < data.texts.length; i++) {
|
|
371
|
+
if (data.texts[i].name === text.name) {
|
|
372
|
+
data.texts.splice(i, 1);
|
|
373
|
+
return true;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
return false;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Set or add if not exist (check with alarm.name) the Alarm in Project
|
|
382
|
+
* @param {*} alarm
|
|
383
|
+
*/
|
|
384
|
+
function setAlarm(alarm) {
|
|
385
|
+
if (!data.alarms) {
|
|
386
|
+
data.alarms = [];
|
|
387
|
+
}
|
|
388
|
+
var pos = -1;
|
|
389
|
+
for (var i = 0; i < data.alarms.length; i++) {
|
|
390
|
+
if (data.alarms[i].name === alarm.name) {
|
|
391
|
+
pos = i;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
if (pos >= 0) {
|
|
395
|
+
data.alarms[pos] = alarm;
|
|
396
|
+
} else {
|
|
397
|
+
data.alarms.push(alarm);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* Remove the Alarm from Project
|
|
403
|
+
* @param {*} alarm
|
|
404
|
+
*/
|
|
405
|
+
function removeAlarm(alarm) {
|
|
406
|
+
if (data.alarms) {
|
|
407
|
+
var pos = -1;
|
|
408
|
+
for (var i = 0; i < data.alarms.length; i++) {
|
|
409
|
+
if (data.alarms[i].name === alarm.name) {
|
|
410
|
+
data.alarms.splice(i, 1);
|
|
411
|
+
return true;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
return false;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* Set or add if not exist (check with notification.id) the Notification in Project
|
|
420
|
+
* @param {*} notification
|
|
421
|
+
*/
|
|
422
|
+
function setNotification(notification) {
|
|
423
|
+
if (!data.notifications) {
|
|
424
|
+
data.notifications = [];
|
|
425
|
+
}
|
|
426
|
+
var pos = -1;
|
|
427
|
+
for (var i = 0; i < data.notifications.length; i++) {
|
|
428
|
+
if (data.notifications[i].id === notification.id) {
|
|
429
|
+
pos = i;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
if (pos >= 0) {
|
|
433
|
+
data.notifications[pos] = notification;
|
|
434
|
+
} else {
|
|
435
|
+
data.notifications.push(notification);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* Remove the Notification from Project
|
|
441
|
+
* @param {*} notification
|
|
442
|
+
*/
|
|
443
|
+
function removeNotification(notification) {
|
|
444
|
+
if (data.notifications) {
|
|
445
|
+
var pos = -1;
|
|
446
|
+
for (var i = 0; i < data.notifications.length; i++) {
|
|
447
|
+
if (data.notifications[i].id === notification.id) {
|
|
448
|
+
data.notifications.splice(i, 1);
|
|
449
|
+
return true;
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
return false;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
/**
|
|
457
|
+
* Set or add if not exist (check with script.id) the Script in Project
|
|
458
|
+
* @param {*} script
|
|
459
|
+
*/
|
|
460
|
+
function setScript(script) {
|
|
461
|
+
if (!data.scripts) {
|
|
462
|
+
data.scripts = [];
|
|
463
|
+
}
|
|
464
|
+
var pos = -1;
|
|
465
|
+
for (var i = 0; i < data.scripts.length; i++) {
|
|
466
|
+
if (data.scripts[i].id === script.id) {
|
|
467
|
+
pos = i;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
if (pos >= 0) {
|
|
471
|
+
data.scripts[pos] = script;
|
|
472
|
+
} else {
|
|
473
|
+
data.scripts.push(script);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* Remove the Script from Project
|
|
479
|
+
* @param {*} script
|
|
480
|
+
*/
|
|
481
|
+
function removeScript(script) {
|
|
482
|
+
if (data.scripts) {
|
|
483
|
+
var pos = -1;
|
|
484
|
+
for (var i = 0; i < data.scripts.length; i++) {
|
|
485
|
+
if (data.scripts[i].id === script.id) {
|
|
486
|
+
data.scripts.splice(i, 1);
|
|
487
|
+
return true;
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
return false;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* Set or add if not exist (check with report.id) the Report in Project
|
|
496
|
+
* @param {*} report
|
|
497
|
+
*/
|
|
498
|
+
function setReport(report) {
|
|
499
|
+
if (!data.reports) {
|
|
500
|
+
data.reports = [];
|
|
501
|
+
}
|
|
502
|
+
var pos = -1;
|
|
503
|
+
for (var i = 0; i < data.reports.length; i++) {
|
|
504
|
+
if (data.reports[i].id === report.id) {
|
|
505
|
+
pos = i;
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
if (pos >= 0) {
|
|
509
|
+
data.reports[pos] = report;
|
|
510
|
+
} else {
|
|
511
|
+
data.reports.push(report);
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* Remove the Report from Project
|
|
517
|
+
* @param {*} script
|
|
518
|
+
*/
|
|
519
|
+
function removeReport(report) {
|
|
520
|
+
if (data.reports) {
|
|
521
|
+
var pos = -1;
|
|
522
|
+
for (var i = 0; i < data.reports.length; i++) {
|
|
523
|
+
if (data.reports[i].id === report.id) {
|
|
524
|
+
data.reports.splice(i, 1);
|
|
525
|
+
return true;
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
return false;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
/**
|
|
533
|
+
* Get the project data in accordance with autorization
|
|
534
|
+
*/
|
|
535
|
+
function getProject(userId, userGroups) {
|
|
536
|
+
return new Promise(function (resolve, reject) {
|
|
537
|
+
const pdata = _filterProjectGroups(userGroups);
|
|
538
|
+
resolve(pdata);
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* Set the new Project, clear all from database and add the new content
|
|
544
|
+
* @param {*} prjcontent
|
|
545
|
+
*/
|
|
546
|
+
function setProject(prjcontent) {
|
|
547
|
+
return new Promise(function (resolve, reject) {
|
|
548
|
+
try {
|
|
549
|
+
prjstorage.clearAll().then(result => {
|
|
550
|
+
var scs = [];
|
|
551
|
+
Object.keys(prjcontent).forEach((key) => {
|
|
552
|
+
if (key === 'devices') {
|
|
553
|
+
// devices
|
|
554
|
+
var devices = prjcontent[key];
|
|
555
|
+
if (devices) {
|
|
556
|
+
Object.values(prjcontent[key]).forEach((device) => {
|
|
557
|
+
scs.push({ table: prjstorage.TableType.DEVICES, name: device.id, value: device });
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
} else if (key === 'hmi') {
|
|
561
|
+
// hmi
|
|
562
|
+
var hmi = prjcontent[key];
|
|
563
|
+
if (hmi) {
|
|
564
|
+
Object.keys(hmi).forEach((hk) => {
|
|
565
|
+
if (hk === 'views') {
|
|
566
|
+
// views
|
|
567
|
+
if (hmi[hk] && hmi[hk].length > 0) {
|
|
568
|
+
for (var i = 0; i < hmi[hk].length; i++) {
|
|
569
|
+
var view = hmi[hk][i];
|
|
570
|
+
scs.push({ table: prjstorage.TableType.VIEWS, name: view.id, value: view });
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
} else {
|
|
574
|
+
// layout
|
|
575
|
+
scs.push({ table: prjstorage.TableType.GENERAL, name: hk, value: hmi[hk] });
|
|
576
|
+
}
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
} else if (key === 'server') {
|
|
580
|
+
// server
|
|
581
|
+
scs.push({ table: prjstorage.TableType.DEVICES, name: key, value: prjcontent[key] });
|
|
582
|
+
} else if (key === 'texts') {
|
|
583
|
+
// texts
|
|
584
|
+
var texts = prjcontent[key];
|
|
585
|
+
if (texts && texts.length) {
|
|
586
|
+
for (var i = 0; i < texts.length; i++) {
|
|
587
|
+
scs.push({ table: prjstorage.TableType.TEXTS, name: texts[i].name, value: texts[i] });
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
} else if (key === 'alarms') {
|
|
591
|
+
// alarms
|
|
592
|
+
var alarms = prjcontent[key];
|
|
593
|
+
if (alarms && alarms.length) {
|
|
594
|
+
for (var i = 0; i < alarms.length; i++) {
|
|
595
|
+
scs.push({ table: prjstorage.TableType.ALARMS, name: alarms[i].name, value: alarms[i] });
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
} else if (key === 'notifications') {
|
|
599
|
+
// notifications
|
|
600
|
+
var notifications = prjcontent[key];
|
|
601
|
+
if (notifications && notifications.length) {
|
|
602
|
+
for (var i = 0; i < notifications.length; i++) {
|
|
603
|
+
scs.push({ table: prjstorage.TableType.NOTIFICATIONS, name: notifications[i].id, value: notifications[i] });
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
} else if (key === 'scripts') {
|
|
607
|
+
// scripts
|
|
608
|
+
var scripts = prjcontent[key];
|
|
609
|
+
if (scripts && scripts.length) {
|
|
610
|
+
for (var i = 0; i < scripts.length; i++) {
|
|
611
|
+
scs.push({ table: prjstorage.TableType.SCRIPTS, name: scripts[i].id, value: scripts[i] });
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
} else if (key === 'reports') {
|
|
615
|
+
// reports
|
|
616
|
+
var reports = prjcontent[key];
|
|
617
|
+
if (reports && reports.length) {
|
|
618
|
+
for (var i = 0; i < reports.length; i++) {
|
|
619
|
+
scs.push({ table: prjstorage.TableType.REPORTS, name: reports[i].id, value: reports[i] });
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
} else {
|
|
623
|
+
// charts, graphs, version
|
|
624
|
+
scs.push({ table: prjstorage.TableType.GENERAL, name: key, value: prjcontent[key] });
|
|
625
|
+
}
|
|
626
|
+
});
|
|
627
|
+
prjstorage.setSections(scs).then(() => {
|
|
628
|
+
logger.info(`project.prjstorage.set-project successfull!`, true);
|
|
629
|
+
resolve(true);
|
|
630
|
+
}).catch(function (err) {
|
|
631
|
+
reject(err);
|
|
632
|
+
});
|
|
633
|
+
}).catch(function (err) {
|
|
634
|
+
logger.error(`project.prjstorage.clear failed! '${err}'`);
|
|
635
|
+
reject(err);
|
|
636
|
+
});
|
|
637
|
+
} catch (err) {
|
|
638
|
+
reject();
|
|
639
|
+
}
|
|
640
|
+
});
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
/**
|
|
644
|
+
* Return Devices list
|
|
645
|
+
*/
|
|
646
|
+
function getDevices() {
|
|
647
|
+
return data.devices;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
/**
|
|
651
|
+
* Return Device from name
|
|
652
|
+
*/
|
|
653
|
+
function getDevice(name) {
|
|
654
|
+
return Object.values(data.devices).find(device => device.name === name);
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
/**
|
|
658
|
+
* Get the device property
|
|
659
|
+
*/
|
|
660
|
+
function getDeviceProperty(query) {
|
|
661
|
+
return new Promise(function (resolve, reject) {
|
|
662
|
+
if (query.query === 'security') {
|
|
663
|
+
prjstorage.getSection(prjstorage.TableType.DEVICESSECURITY, query.name).then(drows => {
|
|
664
|
+
if (drows.length > 0) {
|
|
665
|
+
resolve(drows[0]);
|
|
666
|
+
} else {
|
|
667
|
+
resolve();
|
|
668
|
+
}
|
|
669
|
+
}).catch(function (err) {
|
|
670
|
+
logger.error(`project.prjstorage.getdevice-property failed! '${prjstorage.TableType.DEVICESSECURITY} ${err}'`);
|
|
671
|
+
reject(err);
|
|
672
|
+
});
|
|
673
|
+
} else {
|
|
674
|
+
reject();
|
|
675
|
+
}
|
|
676
|
+
});
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
/**
|
|
680
|
+
* Get the texts
|
|
681
|
+
*/
|
|
682
|
+
function getTexts() {
|
|
683
|
+
return new Promise(function (resolve, reject) {
|
|
684
|
+
prjstorage.getSection(prjstorage.TableType.TEXTS).then(drows => {
|
|
685
|
+
if (drows.length > 0) {
|
|
686
|
+
var texts = [];
|
|
687
|
+
for (var id = 0; id < drows.length; id++) {
|
|
688
|
+
texts.push(JSON.parse(drows[id].value));
|
|
689
|
+
}
|
|
690
|
+
resolve(texts);
|
|
691
|
+
} else {
|
|
692
|
+
resolve();
|
|
693
|
+
}
|
|
694
|
+
}).catch(function (err) {
|
|
695
|
+
logger.error(`project.prjstorage.get-texts failed! '${prjstorage.TableType.TEXTS} ${err}'`);
|
|
696
|
+
reject(err);
|
|
697
|
+
});
|
|
698
|
+
});
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
/**
|
|
702
|
+
* Get the alarms
|
|
703
|
+
*/
|
|
704
|
+
function getAlarms() {
|
|
705
|
+
return new Promise(function (resolve, reject) {
|
|
706
|
+
prjstorage.getSection(prjstorage.TableType.ALARMS).then(drows => {
|
|
707
|
+
if (drows.length > 0) {
|
|
708
|
+
var alarms = [];
|
|
709
|
+
for (var id = 0; id < drows.length; id++) {
|
|
710
|
+
alarms.push(JSON.parse(drows[id].value));
|
|
711
|
+
}
|
|
712
|
+
resolve(alarms);
|
|
713
|
+
} else {
|
|
714
|
+
resolve();
|
|
715
|
+
}
|
|
716
|
+
}).catch(function (err) {
|
|
717
|
+
logger.error(`project.prjstorage.get-alarms failed! '${prjstorage.TableType.ALARMS} ${err}'`);
|
|
718
|
+
reject(err);
|
|
719
|
+
});
|
|
720
|
+
});
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
/**
|
|
724
|
+
* Get the notifications
|
|
725
|
+
*/
|
|
726
|
+
function getNotifications() {
|
|
727
|
+
return new Promise(function (resolve, reject) {
|
|
728
|
+
prjstorage.getSection(prjstorage.TableType.NOTIFICATIONS).then(drows => {
|
|
729
|
+
if (drows.length > 0) {
|
|
730
|
+
var notifications = [];
|
|
731
|
+
for (var id = 0; id < drows.length; id++) {
|
|
732
|
+
notifications.push(JSON.parse(drows[id].value));
|
|
733
|
+
}
|
|
734
|
+
resolve(notifications);
|
|
735
|
+
} else {
|
|
736
|
+
resolve();
|
|
737
|
+
}
|
|
738
|
+
}).catch(function (err) {
|
|
739
|
+
logger.error(`project.prjstorage.get-notifications failed! '${prjstorage.TableType.NOTIFICATIONS} ${err}'`);
|
|
740
|
+
reject(err);
|
|
741
|
+
});
|
|
742
|
+
});
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
/**
|
|
746
|
+
* Get the scripts
|
|
747
|
+
*/
|
|
748
|
+
function getScripts() {
|
|
749
|
+
return new Promise(function (resolve, reject) {
|
|
750
|
+
prjstorage.getSection(prjstorage.TableType.SCRIPTS).then(drows => {
|
|
751
|
+
if (drows.length > 0) {
|
|
752
|
+
var scripts = [];
|
|
753
|
+
for (var id = 0; id < drows.length; id++) {
|
|
754
|
+
scripts.push(JSON.parse(drows[id].value));
|
|
755
|
+
}
|
|
756
|
+
resolve(scripts);
|
|
757
|
+
} else {
|
|
758
|
+
resolve();
|
|
759
|
+
}
|
|
760
|
+
}).catch(function (err) {
|
|
761
|
+
logger.error(`project.prjstorage.get-scripts failed! '${prjstorage.TableType.SCRIPTS} ${err}'`);
|
|
762
|
+
reject(err);
|
|
763
|
+
});
|
|
764
|
+
});
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
/**
|
|
768
|
+
* Get the reports
|
|
769
|
+
*/
|
|
770
|
+
function getReports() {
|
|
771
|
+
return new Promise(function (resolve, reject) {
|
|
772
|
+
prjstorage.getSection(prjstorage.TableType.REPORTS).then(drows => {
|
|
773
|
+
if (drows.length > 0) {
|
|
774
|
+
var reports = [];
|
|
775
|
+
for (var id = 0; id < drows.length; id++) {
|
|
776
|
+
reports.push(JSON.parse(drows[id].value));
|
|
777
|
+
}
|
|
778
|
+
resolve(reports);
|
|
779
|
+
} else {
|
|
780
|
+
resolve();
|
|
781
|
+
}
|
|
782
|
+
}).catch(function (err) {
|
|
783
|
+
logger.error(`project.prjstorage.get-reports failed! '${prjstorage.TableType.REPORTS} ${err}'`);
|
|
784
|
+
reject(err);
|
|
785
|
+
});
|
|
786
|
+
});
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
/**
|
|
790
|
+
* Set the device property
|
|
791
|
+
*/
|
|
792
|
+
function setDeviceProperty(query) {
|
|
793
|
+
return new Promise(function (resolve, reject) {
|
|
794
|
+
if (query.query === 'security') {
|
|
795
|
+
if (!query.value) {
|
|
796
|
+
resolve();
|
|
797
|
+
return;
|
|
798
|
+
}
|
|
799
|
+
prjstorage.setSection({ table: prjstorage.TableType.DEVICESSECURITY, name: query.name, value: query.value }).then(() => {
|
|
800
|
+
resolve();
|
|
801
|
+
}).catch(function (err) {
|
|
802
|
+
logger.error(`project.prjstorage.setdevice-property failed! '${prjstorage.TableType.DEVICESSECURITY} ${err}'`);
|
|
803
|
+
reject(err);
|
|
804
|
+
});
|
|
805
|
+
} else {
|
|
806
|
+
reject();
|
|
807
|
+
}
|
|
808
|
+
});
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
/**
|
|
812
|
+
* Return Project demo from file
|
|
813
|
+
*/
|
|
814
|
+
function getProjectDemo() {
|
|
815
|
+
var demoProject = path.join(settings.appDir, 'project.demo.fuxap');
|
|
816
|
+
return JSON.parse(fs.readFileSync(demoProject, 'utf8'));;
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
function _filterProjectGroups(groups) {
|
|
820
|
+
var result = JSON.parse(JSON.stringify(data));// = { devices: {}, hmi: { views: [] } };
|
|
821
|
+
var admin = (groups === -1 || groups === 255) ? true : false;
|
|
822
|
+
if (!admin) {
|
|
823
|
+
// from device remove the not used (no permission)
|
|
824
|
+
// delete result.devices;
|
|
825
|
+
delete result.server;
|
|
826
|
+
// check navigation permission
|
|
827
|
+
if (result.hmi.layout && result.hmi.layout.navigation.items) {
|
|
828
|
+
for (var i = result.hmi.layout.navigation.items.length - 1; i >= 0; i--) {
|
|
829
|
+
var permission = result.hmi.layout.navigation.items[i].permission;
|
|
830
|
+
if (permission && !(permission & groups)) {
|
|
831
|
+
result.hmi.layout.navigation.items.splice(i, 1);
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
// check view item permission show / enabled
|
|
836
|
+
for (var i = 0; i < result.hmi.views.length; i++) {
|
|
837
|
+
if (result.hmi.views[i].items) {
|
|
838
|
+
Object.values(result.hmi.views[i].items).forEach((item) => {
|
|
839
|
+
if (item.property && item.property.permission) {
|
|
840
|
+
var view = result.hmi.views[i];
|
|
841
|
+
var mask = (item.property.permission >> 8);
|
|
842
|
+
var show = (mask) ? mask & groups : 1;
|
|
843
|
+
mask = (item.property.permission & 255);
|
|
844
|
+
var enabled = (mask) ? mask & groups : 1;
|
|
845
|
+
if (!show) {
|
|
846
|
+
var position = view.svgcontent.indexOf(item.id);
|
|
847
|
+
if (position >= 0) {
|
|
848
|
+
position += item.id.length + 1;
|
|
849
|
+
var hidetext = ' visibility="hidden" ';
|
|
850
|
+
view.svgcontent = view.svgcontent.slice(0, position) + hidetext + view.svgcontent.slice(position);
|
|
851
|
+
}
|
|
852
|
+
} else if (!enabled) {
|
|
853
|
+
item.property.events = [];
|
|
854
|
+
// disable the html controls (select, input, button)
|
|
855
|
+
var splitted = utils.domStringSplitter(view.svgcontent, 'foreignobject', view.svgcontent.indexOf(item.id));
|
|
856
|
+
if (splitted.tagcontent && splitted.tagcontent.length) {
|
|
857
|
+
var disabled = utils.domStringSetAttribute(splitted.tagcontent, ['select', 'input', 'button'], 'disabled');
|
|
858
|
+
view.svgcontent = splitted.before + disabled + splitted.after;
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
});
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
return result;
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
function _mergeDefaultConfig() {
|
|
870
|
+
return new Promise(async function (resolve, reject) {
|
|
871
|
+
try {
|
|
872
|
+
if (process.env.DEVICES && typeof process.env.DEVICES === 'string') {
|
|
873
|
+
try {
|
|
874
|
+
logger.info('project.merge-config: in progress!');
|
|
875
|
+
var devices = JSON.parse(process.env.DEVICES);
|
|
876
|
+
devices.forEach(device => {
|
|
877
|
+
try {
|
|
878
|
+
// check device required
|
|
879
|
+
if (!device || !device.id || !device.name || !device.type || !device.configs) {
|
|
880
|
+
logger.error(`project.merge-config: DEVICES${JSON.stringify(device)} missing property!`);
|
|
881
|
+
} else {
|
|
882
|
+
var existDevice = data.devices[device.id];
|
|
883
|
+
var deviceToAdd = new Device(device);
|
|
884
|
+
if (existDevice) {
|
|
885
|
+
deviceToAdd.tags = existDevice.tags;
|
|
886
|
+
}
|
|
887
|
+
setDevice(deviceToAdd, true);
|
|
888
|
+
logger.info(`project.merge-config: Device ${deviceToAdd.name} added!`);
|
|
889
|
+
}
|
|
890
|
+
} catch (err) {
|
|
891
|
+
logger.error(`project.merge-config: DEVICES${JSON.stringify(device)} failed! ${err}`);
|
|
892
|
+
reject();
|
|
893
|
+
}
|
|
894
|
+
});
|
|
895
|
+
} catch (err) {
|
|
896
|
+
logger.error(`project.merge-config: DEVICES failed! ${err}`);
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
resolve();
|
|
900
|
+
} catch (err) {
|
|
901
|
+
logger.error(`project.merge-config: failed! ${err}`);
|
|
902
|
+
reject();
|
|
903
|
+
}
|
|
904
|
+
});
|
|
905
|
+
|
|
906
|
+
function Device(device, tags) {
|
|
907
|
+
this.id = device.id;
|
|
908
|
+
this.name = device.name;
|
|
909
|
+
this.enabled = true;
|
|
910
|
+
this.type = device.type;
|
|
911
|
+
this.polling = 1000 || device.configs.requestIntervalMs;
|
|
912
|
+
this.tags = tags || {};
|
|
913
|
+
this.property = device.configs;
|
|
914
|
+
|
|
915
|
+
var a = Object.values(DeviceType);
|
|
916
|
+
if (Object.values(DeviceType).indexOf(device.type) === -1) {
|
|
917
|
+
throw new Error('DeviceType unknow');
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
const ProjectDataCmdType = {
|
|
923
|
+
SetDevice: 'set-device',
|
|
924
|
+
DelDevice: 'del-device',
|
|
925
|
+
SetView: 'set-view',
|
|
926
|
+
DelView: 'del-view',
|
|
927
|
+
HmiLayout: 'layout',
|
|
928
|
+
Charts: 'charts',
|
|
929
|
+
Graphs: 'graphs',
|
|
930
|
+
SetText: 'set-text',
|
|
931
|
+
SetText: 'set-text',
|
|
932
|
+
DelText: 'del-text',
|
|
933
|
+
SetAlarm: 'set-alarm',
|
|
934
|
+
DelAlarm: 'del-alarm',
|
|
935
|
+
SetNotification: 'set-notification',
|
|
936
|
+
DelNotification: 'del-notification',
|
|
937
|
+
SetScript: 'set-script',
|
|
938
|
+
DelScript: 'del-script',
|
|
939
|
+
SetReport: 'set-report',
|
|
940
|
+
DelReport: 'del-report',
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
module.exports = {
|
|
944
|
+
init: init,
|
|
945
|
+
load: load,
|
|
946
|
+
getDevices: getDevices,
|
|
947
|
+
getDevice: getDevice,
|
|
948
|
+
getAlarms: getAlarms,
|
|
949
|
+
getNotifications: getNotifications,
|
|
950
|
+
getScripts: getScripts,
|
|
951
|
+
getReports: getReports,
|
|
952
|
+
getDeviceProperty: getDeviceProperty,
|
|
953
|
+
setDeviceProperty: setDeviceProperty,
|
|
954
|
+
setProjectData: setProjectData,
|
|
955
|
+
getProject: getProject,
|
|
956
|
+
setProject: setProject,
|
|
957
|
+
getProjectDemo: getProjectDemo,
|
|
958
|
+
ProjectDataCmdType, ProjectDataCmdType,
|
|
959
|
+
};
|