@mxtommy/kip 1.2.3 → 2.0.0
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/CHANGELOG.md +180 -135
- package/CONTRIBUTORS.md +16 -16
- package/KipGaugeSample3-1024x508.png +0 -0
- package/LICENSE +21 -0
- package/README.md +140 -102
- package/package.json +93 -84
- package/public/3rdpartylicenses.txt +68 -139
- package/public/assets/NoSleep.min.js +2 -2
- package/public/assets/fontawesome6/css/all.min.css +6 -0
- package/public/assets/fontawesome6/webfonts/fa-brands-400.ttf +0 -0
- package/public/assets/fontawesome6/webfonts/fa-brands-400.woff2 +0 -0
- package/public/assets/fontawesome6/webfonts/fa-regular-400.ttf +0 -0
- package/public/assets/fontawesome6/webfonts/fa-regular-400.woff2 +0 -0
- package/public/assets/fontawesome6/webfonts/fa-solid-900.ttf +0 -0
- package/public/assets/fontawesome6/webfonts/fa-solid-900.woff2 +0 -0
- package/public/assets/fontawesome6/webfonts/fa-v4compatibility.ttf +0 -0
- package/public/assets/fontawesome6/webfonts/fa-v4compatibility.woff2 +0 -0
- package/public/assets/icon-192x192.png +0 -0
- package/public/assets/icon-256x256.png +0 -0
- package/public/assets/icon-384x384.png +0 -0
- package/public/assets/icon-512x512.png +0 -0
- package/public/assets/icon-64x64.png +0 -0
- package/public/assets/steelseries-min.js +25 -25
- package/public/assets/steelseries-min.js.map +8 -8
- package/public/assets/steelseries.js +15834 -15834
- package/public/assets/svg-autopilot-inkscape-plain.svg +983 -983
- package/public/assets/svg-wind-inkscape.svg +1358 -1358
- package/public/assets/tween.js +381 -381
- package/public/index.html +19 -20
- package/public/main.9dba30de44eed02b.js +1 -0
- package/public/manifest.json +38 -0
- package/public/polyfills.d1da7d2e907c253a.js +1 -0
- package/public/runtime.e75056c32c37f59d.js +1 -0
- package/public/styles.6b1c2c92be18a2cc.css +1 -0
- package/.angulardoc.json +0 -4
- package/angular.json +0 -153
- package/e2e/app.e2e-spec.ts +0 -14
- package/e2e/app.po.ts +0 -11
- package/e2e/tsconfig.e2e.json +0 -14
- package/karma.conf.js +0 -31
- package/public/assets/font-awesome/HELP-US-OUT.txt +0 -7
- package/public/assets/font-awesome/css/font-awesome.css +0 -2337
- package/public/assets/font-awesome/css/font-awesome.min.css +0 -4
- package/public/assets/font-awesome/desktop.ini +0 -4
- package/public/assets/font-awesome/fonts/FontAwesome.otf +0 -0
- package/public/assets/font-awesome/fonts/fontawesome-webfont.eot +0 -0
- package/public/assets/font-awesome/fonts/fontawesome-webfont.svg +0 -2671
- package/public/assets/font-awesome/fonts/fontawesome-webfont.ttf +0 -0
- package/public/assets/font-awesome/fonts/fontawesome-webfont.woff +0 -0
- package/public/assets/font-awesome/fonts/fontawesome-webfont.woff2 +0 -0
- package/public/assets/font-awesome/less/animated.less +0 -34
- package/public/assets/font-awesome/less/bordered-pulled.less +0 -25
- package/public/assets/font-awesome/less/core.less +0 -12
- package/public/assets/font-awesome/less/fixed-width.less +0 -6
- package/public/assets/font-awesome/less/font-awesome.less +0 -18
- package/public/assets/font-awesome/less/icons.less +0 -789
- package/public/assets/font-awesome/less/larger.less +0 -13
- package/public/assets/font-awesome/less/list.less +0 -19
- package/public/assets/font-awesome/less/mixins.less +0 -60
- package/public/assets/font-awesome/less/path.less +0 -15
- package/public/assets/font-awesome/less/rotated-flipped.less +0 -20
- package/public/assets/font-awesome/less/screen-reader.less +0 -5
- package/public/assets/font-awesome/less/stacked.less +0 -20
- package/public/assets/font-awesome/less/variables.less +0 -800
- package/public/assets/font-awesome/scss/_animated.scss +0 -34
- package/public/assets/font-awesome/scss/_bordered-pulled.scss +0 -25
- package/public/assets/font-awesome/scss/_core.scss +0 -12
- package/public/assets/font-awesome/scss/_fixed-width.scss +0 -6
- package/public/assets/font-awesome/scss/_icons.scss +0 -789
- package/public/assets/font-awesome/scss/_larger.scss +0 -13
- package/public/assets/font-awesome/scss/_list.scss +0 -19
- package/public/assets/font-awesome/scss/_mixins.scss +0 -60
- package/public/assets/font-awesome/scss/_path.scss +0 -15
- package/public/assets/font-awesome/scss/_rotated-flipped.scss +0 -20
- package/public/assets/font-awesome/scss/_screen-reader.scss +0 -5
- package/public/assets/font-awesome/scss/_stacked.scss +0 -20
- package/public/assets/font-awesome/scss/_variables.scss +0 -800
- package/public/assets/font-awesome/scss/font-awesome.scss +0 -18
- package/public/main-es2018.ab0adc5af3ab3e70c849.js +0 -1
- package/public/main-es5.ab0adc5af3ab3e70c849.js +0 -1
- package/public/polyfills-es2018.713f95af1f028e444854.js +0 -1
- package/public/polyfills-es5.c78877945523541d2597.js +0 -1
- package/public/runtime-es2018.a4dadbc03350107420a4.js +0 -1
- package/public/runtime-es5.a4dadbc03350107420a4.js +0 -1
- package/public/styles.71bb0d04cad96b5efbe1.css +0 -19
- package/src/app/alarm-menu/alarm-menu.component.html +0 -55
- package/src/app/alarm-menu/alarm-menu.component.scss +0 -53
- package/src/app/alarm-menu/alarm-menu.component.spec.ts +0 -25
- package/src/app/alarm-menu/alarm-menu.component.ts +0 -186
- package/src/app/app-help/app-help.component.css +0 -4
- package/src/app/app-help/app-help.component.html +0 -135
- package/src/app/app-help/app-help.component.ts +0 -45
- package/src/app/app-settings.service.spec.ts +0 -15
- package/src/app/app-settings.service.ts +0 -478
- package/src/app/app.component.css +0 -39
- package/src/app/app.component.html +0 -93
- package/src/app/app.component.scss +0 -79
- package/src/app/app.component.spec.ts +0 -32
- package/src/app/app.component.ts +0 -192
- package/src/app/app.module.ts +0 -200
- package/src/app/config.blank.const.ts +0 -52
- package/src/app/config.blank.notification.const.ts +0 -19
- package/src/app/config.blank.units.const.ts +0 -23
- package/src/app/config.demo.const.ts +0 -384
- package/src/app/data-browser/data-browser.component.css +0 -29
- package/src/app/data-browser/data-browser.component.html +0 -44
- package/src/app/data-browser/data-browser.component.spec.ts +0 -25
- package/src/app/data-browser/data-browser.component.ts +0 -91
- package/src/app/data-browser-row/data-browser-row-unit-modal.html +0 -17
- package/src/app/data-browser-row/data-browser-row.component.css +0 -10
- package/src/app/data-browser-row/data-browser-row.component.html +0 -5
- package/src/app/data-browser-row/data-browser-row.component.ts +0 -79
- package/src/app/data-set.service.spec.ts +0 -15
- package/src/app/data-set.service.ts +0 -273
- package/src/app/dynamic-widget.directive.spec.ts +0 -8
- package/src/app/dynamic-widget.directive.ts +0 -11
- package/src/app/filter-self.pipe.spec.ts +0 -8
- package/src/app/filter-self.pipe.ts +0 -14
- package/src/app/fit-text.directive.spec.ts +0 -8
- package/src/app/fit-text.directive.ts +0 -61
- package/src/app/gauge-steel/gauge-steel.component.css +0 -5
- package/src/app/gauge-steel/gauge-steel.component.html +0 -4
- package/src/app/gauge-steel/gauge-steel.component.spec.ts +0 -25
- package/src/app/gauge-steel/gauge-steel.component.ts +0 -282
- package/src/app/gauges-module/base-gauge.ts +0 -301
- package/src/app/gauges-module/gauges.module.ts +0 -17
- package/src/app/gauges-module/linear-gauge.ts +0 -50
- package/src/app/gauges-module/radial-gauge.ts +0 -48
- package/src/app/layout-split/layout-split.component.html +0 -30
- package/src/app/layout-split/layout-split.component.scss +0 -33
- package/src/app/layout-split/layout-split.component.spec.ts +0 -25
- package/src/app/layout-split/layout-split.component.ts +0 -59
- package/src/app/layout-splits.service.spec.ts +0 -15
- package/src/app/layout-splits.service.ts +0 -284
- package/src/app/modal-path-selector/modal-path-selector.component.html +0 -62
- package/src/app/modal-path-selector/modal-path-selector.component.scss +0 -39
- package/src/app/modal-path-selector/modal-path-selector.component.spec.ts +0 -25
- package/src/app/modal-path-selector/modal-path-selector.component.ts +0 -132
- package/src/app/modal-widget/modal-widget.component.css +0 -33
- package/src/app/modal-widget/modal-widget.component.html +0 -341
- package/src/app/modal-widget/modal-widget.component.spec.ts +0 -25
- package/src/app/modal-widget/modal-widget.component.ts +0 -84
- package/src/app/notifications.service.spec.ts +0 -12
- package/src/app/notifications.service.ts +0 -392
- package/src/app/object-keys.pipe.spec.ts +0 -8
- package/src/app/object-keys.pipe.ts +0 -13
- package/src/app/reset-config/reset-config.component.css +0 -0
- package/src/app/reset-config/reset-config.component.html +0 -3
- package/src/app/reset-config/reset-config.component.spec.ts +0 -25
- package/src/app/reset-config/reset-config.component.ts +0 -31
- package/src/app/root-display/root-display.component.css +0 -0
- package/src/app/root-display/root-display.component.html +0 -4
- package/src/app/root-display/root-display.component.spec.ts +0 -25
- package/src/app/root-display/root-display.component.ts +0 -57
- package/src/app/safe.pipe.ts +0 -16
- package/src/app/settings/settings.component.css +0 -9
- package/src/app/settings/settings.component.html +0 -25
- package/src/app/settings/settings.component.spec.ts +0 -25
- package/src/app/settings/settings.component.ts +0 -22
- package/src/app/settings-config/settings-config.component.css +0 -39
- package/src/app/settings-config/settings-config.component.html +0 -118
- package/src/app/settings-config/settings-config.component.spec.ts +0 -25
- package/src/app/settings-config/settings-config.component.ts +0 -161
- package/src/app/settings-datasets/settings-datasets.component.html +0 -43
- package/src/app/settings-datasets/settings-datasets.component.scss +0 -39
- package/src/app/settings-datasets/settings-datasets.component.spec.ts +0 -25
- package/src/app/settings-datasets/settings-datasets.component.ts +0 -98
- package/src/app/settings-datasets/settings-datasets.modal.html +0 -54
- package/src/app/settings-notifications/settings-notifications.component.css +0 -0
- package/src/app/settings-notifications/settings-notifications.component.html +0 -65
- package/src/app/settings-notifications/settings-notifications.component.spec.ts +0 -25
- package/src/app/settings-notifications/settings-notifications.component.ts +0 -29
- package/src/app/settings-signalk/settings-signalk.component.css +0 -3
- package/src/app/settings-signalk/settings-signalk.component.html +0 -89
- package/src/app/settings-signalk/settings-signalk.component.spec.ts +0 -25
- package/src/app/settings-signalk/settings-signalk.component.ts +0 -174
- package/src/app/settings-units/settings-units.component.css +0 -4
- package/src/app/settings-units/settings-units.component.html +0 -19
- package/src/app/settings-units/settings-units.component.spec.ts +0 -25
- package/src/app/settings-units/settings-units.component.ts +0 -62
- package/src/app/settings-zones/settings-zones.component.css +0 -22
- package/src/app/settings-zones/settings-zones.component.html +0 -70
- package/src/app/settings-zones/settings-zones.component.ts +0 -154
- package/src/app/settings-zones/settings-zones.modal.css +0 -14
- package/src/app/settings-zones/settings-zones.modal.html +0 -39
- package/src/app/signalk-connection.service.ts +0 -344
- package/src/app/signalk-delta.service.spec.ts +0 -15
- package/src/app/signalk-delta.service.ts +0 -97
- package/src/app/signalk-full.service.spec.ts +0 -15
- package/src/app/signalk-full.service.ts +0 -99
- package/src/app/signalk-interfaces.ts +0 -129
- package/src/app/signalk-requests.service.spec.ts +0 -12
- package/src/app/signalk-requests.service.ts +0 -180
- package/src/app/signalk.service.spec.ts +0 -15
- package/src/app/signalk.service.ts +0 -428
- package/src/app/svg-autopilot/svg-autopilot.component.html +0 -1036
- package/src/app/svg-autopilot/svg-autopilot.component.spec.ts +0 -25
- package/src/app/svg-autopilot/svg-autopilot.component.ts +0 -174
- package/src/app/svg-simple-linear-gauge/svg-simple-linear-gauge.component.html +0 -119
- package/src/app/svg-simple-linear-gauge/svg-simple-linear-gauge.component.scss +0 -0
- package/src/app/svg-simple-linear-gauge/svg-simple-linear-gauge.component.spec.ts +0 -25
- package/src/app/svg-simple-linear-gauge/svg-simple-linear-gauge.component.ts +0 -49
- package/src/app/svg-wind/svg-wind.component.css +0 -0
- package/src/app/svg-wind/svg-wind.component.html +0 -969
- package/src/app/svg-wind/svg-wind.component.scss +0 -76
- package/src/app/svg-wind/svg-wind.component.spec.ts +0 -25
- package/src/app/svg-wind/svg-wind.component.ts +0 -280
- package/src/app/unit-window/unit-window.component.css +0 -37
- package/src/app/unit-window/unit-window.component.html +0 -8
- package/src/app/unit-window/unit-window.component.spec.ts +0 -25
- package/src/app/unit-window/unit-window.component.ts +0 -134
- package/src/app/unit-window/unit-window.modal.html +0 -25
- package/src/app/units.service.ts +0 -300
- package/src/app/widget-autopilot/widget-autopilot.component.html +0 -85
- package/src/app/widget-autopilot/widget-autopilot.component.scss +0 -191
- package/src/app/widget-autopilot/widget-autopilot.component.spec.ts +0 -25
- package/src/app/widget-autopilot/widget-autopilot.component.ts +0 -781
- package/src/app/widget-blank/widget-blank.component.html +0 -5
- package/src/app/widget-blank/widget-blank.component.scss +0 -22
- package/src/app/widget-blank/widget-blank.component.spec.ts +0 -25
- package/src/app/widget-blank/widget-blank.component.ts +0 -17
- package/src/app/widget-gauge/widget-gauge.component.css +0 -26
- package/src/app/widget-gauge/widget-gauge.component.html +0 -29
- package/src/app/widget-gauge/widget-gauge.component.spec.ts +0 -25
- package/src/app/widget-gauge/widget-gauge.component.ts +0 -120
- package/src/app/widget-gauge-ng-linear/widget-gauge-ng-linear.component.html +0 -126
- package/src/app/widget-gauge-ng-linear/widget-gauge-ng-linear.component.scss +0 -93
- package/src/app/widget-gauge-ng-linear/widget-gauge-ng-linear.component.spec.ts +0 -25
- package/src/app/widget-gauge-ng-linear/widget-gauge-ng-linear.component.ts +0 -424
- package/src/app/widget-gauge-ng-radial/widget-gauge-ng-radial.component.html +0 -122
- package/src/app/widget-gauge-ng-radial/widget-gauge-ng-radial.component.scss +0 -69
- package/src/app/widget-gauge-ng-radial/widget-gauge-ng-radial.component.spec.ts +0 -25
- package/src/app/widget-gauge-ng-radial/widget-gauge-ng-radial.component.ts +0 -553
- package/src/app/widget-historical/widget-historical.component.css +0 -31
- package/src/app/widget-historical/widget-historical.component.html +0 -14
- package/src/app/widget-historical/widget-historical.component.scss +0 -0
- package/src/app/widget-historical/widget-historical.component.spec.ts +0 -25
- package/src/app/widget-historical/widget-historical.component.ts +0 -306
- package/src/app/widget-iframe/widget-iframe.component.css +0 -12
- package/src/app/widget-iframe/widget-iframe.component.html +0 -21
- package/src/app/widget-iframe/widget-iframe.component.spec.ts +0 -25
- package/src/app/widget-iframe/widget-iframe.component.ts +0 -63
- package/src/app/widget-list.service.spec.ts +0 -15
- package/src/app/widget-list.service.ts +0 -135
- package/src/app/widget-manager.service.spec.ts +0 -15
- package/src/app/widget-manager.service.ts +0 -141
- package/src/app/widget-numeric/widget-numeric.component.html +0 -13
- package/src/app/widget-numeric/widget-numeric.component.scss +0 -52
- package/src/app/widget-numeric/widget-numeric.component.spec.ts +0 -25
- package/src/app/widget-numeric/widget-numeric.component.ts +0 -457
- package/src/app/widget-simple-linear/widget-simple-linear.component.html +0 -28
- package/src/app/widget-simple-linear/widget-simple-linear.component.scss +0 -64
- package/src/app/widget-simple-linear/widget-simple-linear.component.spec.ts +0 -25
- package/src/app/widget-simple-linear/widget-simple-linear.component.ts +0 -199
- package/src/app/widget-state/widget-state.component.html +0 -27
- package/src/app/widget-state/widget-state.component.scss +0 -68
- package/src/app/widget-state/widget-state.component.spec.ts +0 -25
- package/src/app/widget-state/widget-state.component.ts +0 -178
- package/src/app/widget-switch/widget-switch.component.css +0 -70
- package/src/app/widget-switch/widget-switch.component.html +0 -17
- package/src/app/widget-switch/widget-switch.component.spec.ts +0 -25
- package/src/app/widget-switch/widget-switch.component.ts +0 -134
- package/src/app/widget-text-generic/widget-text-generic.component.css +0 -55
- package/src/app/widget-text-generic/widget-text-generic.component.html +0 -9
- package/src/app/widget-text-generic/widget-text-generic.component.spec.ts +0 -25
- package/src/app/widget-text-generic/widget-text-generic.component.ts +0 -253
- package/src/app/widget-tutorial/widget-tutorial.component.css +0 -0
- package/src/app/widget-tutorial/widget-tutorial.component.html +0 -34
- package/src/app/widget-tutorial/widget-tutorial.component.spec.ts +0 -25
- package/src/app/widget-tutorial/widget-tutorial.component.ts +0 -18
- package/src/app/widget-unknown/widget-unknown.component.css +0 -0
- package/src/app/widget-unknown/widget-unknown.component.html +0 -3
- package/src/app/widget-unknown/widget-unknown.component.spec.ts +0 -25
- package/src/app/widget-unknown/widget-unknown.component.ts +0 -15
- package/src/app/widget-wind/widget-wind.component.css +0 -24
- package/src/app/widget-wind/widget-wind.component.html +0 -20
- package/src/app/widget-wind/widget-wind.component.spec.ts +0 -25
- package/src/app/widget-wind/widget-wind.component.ts +0 -369
- package/src/assets/.gitkeep +0 -0
- package/src/assets/NoSleep.min.js +0 -2
- package/src/assets/alarm.mp3 +0 -0
- package/src/assets/alert.mp3 +0 -0
- package/src/assets/alertl.old.mp3 +0 -0
- package/src/assets/emergency.mp3 +0 -0
- package/src/assets/font-awesome/HELP-US-OUT.txt +0 -7
- package/src/assets/font-awesome/css/font-awesome.css +0 -2337
- package/src/assets/font-awesome/css/font-awesome.min.css +0 -4
- package/src/assets/font-awesome/desktop.ini +0 -4
- package/src/assets/font-awesome/fonts/FontAwesome.otf +0 -0
- package/src/assets/font-awesome/fonts/fontawesome-webfont.eot +0 -0
- package/src/assets/font-awesome/fonts/fontawesome-webfont.svg +0 -2671
- package/src/assets/font-awesome/fonts/fontawesome-webfont.ttf +0 -0
- package/src/assets/font-awesome/fonts/fontawesome-webfont.woff +0 -0
- package/src/assets/font-awesome/fonts/fontawesome-webfont.woff2 +0 -0
- package/src/assets/font-awesome/less/animated.less +0 -34
- package/src/assets/font-awesome/less/bordered-pulled.less +0 -25
- package/src/assets/font-awesome/less/core.less +0 -12
- package/src/assets/font-awesome/less/fixed-width.less +0 -6
- package/src/assets/font-awesome/less/font-awesome.less +0 -18
- package/src/assets/font-awesome/less/icons.less +0 -789
- package/src/assets/font-awesome/less/larger.less +0 -13
- package/src/assets/font-awesome/less/list.less +0 -19
- package/src/assets/font-awesome/less/mixins.less +0 -60
- package/src/assets/font-awesome/less/path.less +0 -15
- package/src/assets/font-awesome/less/rotated-flipped.less +0 -20
- package/src/assets/font-awesome/less/screen-reader.less +0 -5
- package/src/assets/font-awesome/less/stacked.less +0 -20
- package/src/assets/font-awesome/less/variables.less +0 -800
- package/src/assets/font-awesome/scss/_animated.scss +0 -34
- package/src/assets/font-awesome/scss/_bordered-pulled.scss +0 -25
- package/src/assets/font-awesome/scss/_core.scss +0 -12
- package/src/assets/font-awesome/scss/_fixed-width.scss +0 -6
- package/src/assets/font-awesome/scss/_icons.scss +0 -789
- package/src/assets/font-awesome/scss/_larger.scss +0 -13
- package/src/assets/font-awesome/scss/_list.scss +0 -19
- package/src/assets/font-awesome/scss/_mixins.scss +0 -60
- package/src/assets/font-awesome/scss/_path.scss +0 -15
- package/src/assets/font-awesome/scss/_rotated-flipped.scss +0 -20
- package/src/assets/font-awesome/scss/_screen-reader.scss +0 -5
- package/src/assets/font-awesome/scss/_stacked.scss +0 -20
- package/src/assets/font-awesome/scss/_variables.scss +0 -800
- package/src/assets/font-awesome/scss/font-awesome.scss +0 -18
- package/src/assets/notification.mp3 +0 -0
- package/src/assets/steelseries-min.js +0 -25
- package/src/assets/steelseries-min.js.map +0 -8
- package/src/assets/steelseries.js +0 -15834
- package/src/assets/svg-autopilot-inkscape-plain.svg +0 -983
- package/src/assets/svg-wind-inkscape.svg +0 -1358
- package/src/assets/tween-min.js +0 -1
- package/src/assets/tween.js +0 -381
- package/src/assets/warn.mp3 +0 -0
- package/src/environments/environment.prod.ts +0 -3
- package/src/environments/environment.ts +0 -8
- package/src/favicon.ico +0 -0
- package/src/index.html +0 -20
- package/src/main.ts +0 -11
- package/src/polyfills.ts +0 -76
- package/src/styles.css +0 -47
- package/src/styles.scss +0 -157
- package/src/test.ts +0 -32
- package/src/themes/darkBlueTheme.scss +0 -116
- package/src/themes/defaultTheme.scss +0 -49
- package/src/themes/highContrastTheme.scss +0 -46
- package/src/themes/modernTheme.scss +0 -142
- package/src/themes/nightMode.scss +0 -184
- package/src/themes/platypusTheme.scss +0 -79
- package/src/themes/signalkTheme.scss +0 -111
- package/src/tsconfig.app.json +0 -15
- package/src/tsconfig.spec.json +0 -20
- package/src/typings.d.ts +0 -5
- package/tsconfig.json +0 -24
- package/tslint.json +0 -143
- /package/{KipGaugeSample-1-1024x545.png → KipGaugeSample1-1024x545.png} +0 -0
- /package/{KipMonitor-1024x488.png → KipGaugeSample2-1024x488.png} +0 -0
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import { Component, OnInit, Inject, Input, ViewChild, ChangeDetectorRef, AfterViewInit } from '@angular/core';
|
|
2
|
-
import { FormGroup, FormControl, Validators } from '@angular/forms';
|
|
3
|
-
import { MatTableDataSource } from '@angular/material/table';
|
|
4
|
-
import { Subscription, Observable } from 'rxjs';
|
|
5
|
-
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
|
6
|
-
import { MatPaginator } from '@angular/material/paginator';
|
|
7
|
-
import { MatSort } from '@angular/material/sort';
|
|
8
|
-
|
|
9
|
-
import { AppSettingsService, IZone, ZoneState } from '../app-settings.service';
|
|
10
|
-
import { IPathAndMetaObjects } from "../signalk-interfaces";
|
|
11
|
-
|
|
12
|
-
@Component({
|
|
13
|
-
selector: 'app-settings-zones',
|
|
14
|
-
templateUrl: './settings-zones.component.html',
|
|
15
|
-
styleUrls: ['./settings-zones.component.css']
|
|
16
|
-
})
|
|
17
|
-
export class SettingsZonesComponent implements OnInit, AfterViewInit {
|
|
18
|
-
|
|
19
|
-
@ViewChild(MatPaginator) paginator: MatPaginator;
|
|
20
|
-
@ViewChild(MatSort) sort: MatSort;
|
|
21
|
-
|
|
22
|
-
tableData = new MatTableDataSource([]);
|
|
23
|
-
|
|
24
|
-
displayedColumns: string[] = ['path', 'unit', 'lower', 'upper', 'state', "actions"];
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
zonesSub: Subscription;
|
|
29
|
-
|
|
30
|
-
constructor(
|
|
31
|
-
private appSettingsService: AppSettingsService,
|
|
32
|
-
public dialog: MatDialog,
|
|
33
|
-
private cdRef: ChangeDetectorRef,
|
|
34
|
-
) { }
|
|
35
|
-
|
|
36
|
-
ngOnInit() {
|
|
37
|
-
this.zonesSub = this.appSettingsService.getZonesAsO().subscribe(zones => {
|
|
38
|
-
this.tableData.data = zones;
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
ngAfterViewInit() {
|
|
43
|
-
this.tableData.paginator = this.paginator;
|
|
44
|
-
this.tableData.sort = this.sort;
|
|
45
|
-
this.tableData.filter = "";
|
|
46
|
-
this.cdRef.detectChanges();
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
private newUuid() {
|
|
50
|
-
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
|
|
51
|
-
var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
|
|
52
|
-
return v.toString(16);
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
delZone(uuid: string) {
|
|
57
|
-
let zones = this.appSettingsService.getZones();
|
|
58
|
-
//find index
|
|
59
|
-
let index = zones.findIndex(zone => (zone.uuid == uuid));
|
|
60
|
-
if (index >= 0) {
|
|
61
|
-
zones.splice(index,1);
|
|
62
|
-
this.appSettingsService.saveZones(zones);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
trackByUuid(index: number, item: IZone): string {
|
|
67
|
-
return `${item.uuid}`;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
applyFilter(event: Event) {
|
|
71
|
-
const filterValue = (event.target as HTMLInputElement).value;
|
|
72
|
-
this.tableData.filter = filterValue.trim().toLowerCase();
|
|
73
|
-
|
|
74
|
-
if (this.tableData.paginator) {
|
|
75
|
-
this.tableData.paginator.firstPage();
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
openDialog(): void {
|
|
80
|
-
const dialogRef = this.dialog.open(DialogNewZone, {
|
|
81
|
-
width: '80%',
|
|
82
|
-
data: {}
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
dialogRef.afterClosed().subscribe(result => {
|
|
86
|
-
if (result) {
|
|
87
|
-
console.log(result);
|
|
88
|
-
let zones = this.appSettingsService.getZones();
|
|
89
|
-
zones.push({
|
|
90
|
-
uuid: this.newUuid(),
|
|
91
|
-
upper: result.upper,
|
|
92
|
-
lower: result.lower,
|
|
93
|
-
path: result.path.path,
|
|
94
|
-
unit: result.path.convertUnitTo,
|
|
95
|
-
state: parseInt(result.state)
|
|
96
|
-
});
|
|
97
|
-
console.log(zones);
|
|
98
|
-
this.appSettingsService.saveZones(zones);
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
@Component({
|
|
109
|
-
selector: 'dialog-new-zone',
|
|
110
|
-
templateUrl: 'settings-zones.modal.html',
|
|
111
|
-
styleUrls: ['./settings-zones.modal.css']
|
|
112
|
-
})
|
|
113
|
-
export class DialogNewZone {
|
|
114
|
-
|
|
115
|
-
newZoneForm: FormGroup = new FormGroup({
|
|
116
|
-
upper: new FormControl(null),
|
|
117
|
-
lower: new FormControl(null),
|
|
118
|
-
state: new FormControl('0', Validators.required),
|
|
119
|
-
filterSelfPaths: new FormControl(true),
|
|
120
|
-
path: new FormGroup({
|
|
121
|
-
description: new FormControl("Numeric Data"),
|
|
122
|
-
path: new FormControl(null),
|
|
123
|
-
isPathConfigurable: new FormControl(true),
|
|
124
|
-
convertUnitTo: new FormControl("unitless"),
|
|
125
|
-
pathType: new FormControl("number"),
|
|
126
|
-
source: new FormControl(null)
|
|
127
|
-
})
|
|
128
|
-
}, this.rangeValidationFunction);
|
|
129
|
-
|
|
130
|
-
@Input() filterSelfPaths: boolean;
|
|
131
|
-
availablePaths: IPathAndMetaObjects[];
|
|
132
|
-
filteredPaths: Observable<IPathAndMetaObjects[]> = new Observable;
|
|
133
|
-
|
|
134
|
-
selectedUnit = null;
|
|
135
|
-
|
|
136
|
-
constructor(
|
|
137
|
-
public dialogRef: MatDialogRef<DialogNewZone>,
|
|
138
|
-
@Inject(MAT_DIALOG_DATA) public data) {
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
rangeValidationFunction(formGroup: FormGroup): any {
|
|
143
|
-
let upper = formGroup.get('upper').value;
|
|
144
|
-
let lower = formGroup.get('lower').value;
|
|
145
|
-
return ((upper === null) && (lower === null)) ? { needUpperLower: true } : null;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
onNoClick(): void {
|
|
149
|
-
this.dialogRef.close();
|
|
150
|
-
}
|
|
151
|
-
submitConfig() {
|
|
152
|
-
this.dialogRef.close(this.newZoneForm.value);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
<form (ngSubmit)="submitConfig()" [formGroup]="newZoneForm">
|
|
2
|
-
<div mat-dialog-content >
|
|
3
|
-
<mat-checkbox name="filterSelfPaths" formControlName="filterSelfPaths">Restrict to own vessel</mat-checkbox>
|
|
4
|
-
<modal-path-selector class="full-width"
|
|
5
|
-
[formGroup]="newZoneForm.controls.path"
|
|
6
|
-
[filterSelfPaths]="newZoneForm.value.filterSelfPaths">
|
|
7
|
-
</modal-path-selector>
|
|
8
|
-
|
|
9
|
-
<mat-form-field class="leftThirdField" appearance="outline" floatLabel="always">
|
|
10
|
-
<mat-label>Lower value</mat-label>
|
|
11
|
-
<input type="number" matInput placeholder="Enter or select number..." name="lower" formControlName="lower">
|
|
12
|
-
</mat-form-field>
|
|
13
|
-
|
|
14
|
-
<mat-form-field class="leftThirdField" appearance="outline" floatLabel="always">
|
|
15
|
-
<mat-label>Upper value</mat-label>
|
|
16
|
-
<input type="number" matInput placeholder="Enter or select number..." name="upper" formControlName="upper">
|
|
17
|
-
</mat-form-field>
|
|
18
|
-
|
|
19
|
-
<mat-form-field class="rightThirdField" appearance="outline" floatLabel="always">
|
|
20
|
-
<mat-label>State</mat-label>
|
|
21
|
-
<mat-select
|
|
22
|
-
placeholder="Value State"
|
|
23
|
-
formControlName="state"
|
|
24
|
-
name="state">
|
|
25
|
-
<mat-option value='0'>Normal</mat-option>
|
|
26
|
-
<mat-option value='1'>Warning</mat-option>
|
|
27
|
-
<mat-option value='2'>Alarm</mat-option>
|
|
28
|
-
</mat-select>
|
|
29
|
-
</mat-form-field>
|
|
30
|
-
</div>
|
|
31
|
-
<mat-error *ngIf="newZoneForm.hasError('needUpperLower')">
|
|
32
|
-
At least one value is required (lower / upper)
|
|
33
|
-
</mat-error>
|
|
34
|
-
<div mat-dialog-actions>
|
|
35
|
-
<button mat-raised-button mat-dialog-close>Cancel</button>
|
|
36
|
-
<button mat-raised-button color="accent" type="submit" [disabled]="!newZoneForm.valid">Add</button>
|
|
37
|
-
</div>
|
|
38
|
-
|
|
39
|
-
</form>
|
|
@@ -1,344 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@angular/core';
|
|
2
|
-
import { of , Observable , BehaviorSubject } from 'rxjs';
|
|
3
|
-
import { catchError, tap } from 'rxjs/operators';
|
|
4
|
-
import { HttpClient, HttpErrorResponse, HttpHeaders } from '@angular/common/http';
|
|
5
|
-
|
|
6
|
-
import { AppSettingsService, SignalKToken, SignalKUrl } from './app-settings.service';
|
|
7
|
-
import { SignalKService } from './signalk.service';
|
|
8
|
-
import { SignalKDeltaService } from './signalk-delta.service';
|
|
9
|
-
import { SignalKFullService } from './signalk-full.service';
|
|
10
|
-
import { NotificationsService } from './notifications.service';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
interface SignalKEndpointResponse {
|
|
14
|
-
endpoints: {
|
|
15
|
-
v1: {
|
|
16
|
-
version: string;
|
|
17
|
-
"signalk-http"?: string;
|
|
18
|
-
"signalk-ws"?: string;
|
|
19
|
-
"signalk-tcp"?: string;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
server: {
|
|
23
|
-
id: string;
|
|
24
|
-
version: string;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Represent SignalK connection's statuses.
|
|
30
|
-
* @usageNotes `operation` field describes the type of operation being
|
|
31
|
-
* performed on the connections.
|
|
32
|
-
* `0 = Never Stated` (app just started),
|
|
33
|
-
* `1 = Connecting to server`,
|
|
34
|
-
* `2 = Active connection being reset` (issues on client, server killing client connection or network issue),
|
|
35
|
-
* `3 = App URL Changed` - reconnecting,
|
|
36
|
-
* `4 = adding R/W authorization token to WebSock`
|
|
37
|
-
*/
|
|
38
|
-
export interface SignalKStatus {
|
|
39
|
-
server: {
|
|
40
|
-
version: string;
|
|
41
|
-
},
|
|
42
|
-
endpoint: {
|
|
43
|
-
status: boolean;
|
|
44
|
-
message: string;
|
|
45
|
-
},
|
|
46
|
-
rest: {
|
|
47
|
-
status: boolean;
|
|
48
|
-
message: string;
|
|
49
|
-
},
|
|
50
|
-
websocket: {
|
|
51
|
-
status: boolean;
|
|
52
|
-
message: string;
|
|
53
|
-
},
|
|
54
|
-
operation: number;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
@Injectable()
|
|
58
|
-
export class SignalKConnectionService {
|
|
59
|
-
|
|
60
|
-
// Main URL Variables
|
|
61
|
-
signalKURL: SignalKUrl;
|
|
62
|
-
signalKToken: SignalKToken;
|
|
63
|
-
endpointREST: string;
|
|
64
|
-
endpointWS: string;
|
|
65
|
-
|
|
66
|
-
// Websocket
|
|
67
|
-
webSocket: WebSocket = null;
|
|
68
|
-
|
|
69
|
-
// SignalK connections current status initialization
|
|
70
|
-
currentSkStatus: SignalKStatus = {
|
|
71
|
-
server: {
|
|
72
|
-
version: "",
|
|
73
|
-
},
|
|
74
|
-
endpoint: {
|
|
75
|
-
status: false,
|
|
76
|
-
message: 'Not yet connected'
|
|
77
|
-
},
|
|
78
|
-
rest: {
|
|
79
|
-
status: false,
|
|
80
|
-
message: 'Not yet connected'
|
|
81
|
-
},
|
|
82
|
-
websocket: {
|
|
83
|
-
status: false,
|
|
84
|
-
message: 'Not yet connected'
|
|
85
|
-
},
|
|
86
|
-
operation: 0
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
signalKStatus: BehaviorSubject<SignalKStatus> = new BehaviorSubject<SignalKStatus>(this.currentSkStatus);
|
|
90
|
-
|
|
91
|
-
//////////////////////////////////////////////////////////////////////////////////////////////////
|
|
92
|
-
//// constructor, mostly sub to stuff for changes.
|
|
93
|
-
constructor(
|
|
94
|
-
private signalKService: SignalKService,
|
|
95
|
-
private signalKDeltaService: SignalKDeltaService,
|
|
96
|
-
private SignalKFullService: SignalKFullService,
|
|
97
|
-
private appSettingsService: AppSettingsService,
|
|
98
|
-
private notificationsService: NotificationsService,
|
|
99
|
-
private http: HttpClient)
|
|
100
|
-
{
|
|
101
|
-
// when signalKUrl changes, do stuff
|
|
102
|
-
this.appSettingsService.getSignalKURLAsO().subscribe(
|
|
103
|
-
newURL => {
|
|
104
|
-
this.signalKURL = newURL;
|
|
105
|
-
|
|
106
|
-
if (this.signalKURL.new) {
|
|
107
|
-
this.currentSkStatus.operation = 3; // URL Changed
|
|
108
|
-
this.resetSignalK();
|
|
109
|
-
} else {
|
|
110
|
-
this.currentSkStatus.operation = 1; // Startup connection
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
);
|
|
114
|
-
// when token changes, do stuff
|
|
115
|
-
this.appSettingsService.getSignalKTokenAsO().subscribe(
|
|
116
|
-
newToken => {
|
|
117
|
-
this.signalKToken = newToken;
|
|
118
|
-
|
|
119
|
-
if (this.signalKToken.new) {
|
|
120
|
-
this.currentSkStatus.operation = 4; // Token update
|
|
121
|
-
this.resetSignalK();
|
|
122
|
-
} else {
|
|
123
|
-
this.currentSkStatus.operation = 1; // Token update
|
|
124
|
-
this.resetSignalK();
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
resetSignalK() {
|
|
131
|
-
// TODO close current connections/reset data, check api version... assuming v1
|
|
132
|
-
console.debug("Resetting URL: " + this.signalKURL.url);
|
|
133
|
-
|
|
134
|
-
// clean close if open
|
|
135
|
-
if (this.webSocket != null && this.webSocket.readyState < 2) { // 0 = connecting, 1 = open, 2 = closing, 3 = closed
|
|
136
|
-
console.debug("Closing existing WS Connection")
|
|
137
|
-
this.webSocket.close();
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
this.currentSkStatus.endpoint.message = "Connecting...";
|
|
141
|
-
this.currentSkStatus.endpoint.status = false;
|
|
142
|
-
this.currentSkStatus.rest.message = "Connecting...";
|
|
143
|
-
this.currentSkStatus.rest.status = false;
|
|
144
|
-
this.currentSkStatus.websocket.message = "Connecting...";
|
|
145
|
-
this.currentSkStatus.websocket.status = false;
|
|
146
|
-
this.signalKStatus.next(this.currentSkStatus);
|
|
147
|
-
|
|
148
|
-
this.notificationsService.resetAlarms();
|
|
149
|
-
|
|
150
|
-
let fullURL = this.signalKURL.url;
|
|
151
|
-
let re = new RegExp("signalk/?$");
|
|
152
|
-
if (!re.test(fullURL)) {
|
|
153
|
-
fullURL = fullURL + "/signalk/";
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
// this.signalKDeltaService.resetSignalKData(); // can't find this in our code.
|
|
157
|
-
this.endpointREST = null;
|
|
158
|
-
this.endpointWS = null;
|
|
159
|
-
|
|
160
|
-
this.http.get<SignalKEndpointResponse>(fullURL, {observe: 'response'}).subscribe(
|
|
161
|
-
// when we go ok, this runs
|
|
162
|
-
response => {
|
|
163
|
-
this.endpointREST = response.body.endpoints.v1["signalk-http"];
|
|
164
|
-
this.endpointWS = response.body.endpoints.v1["signalk-ws"];
|
|
165
|
-
|
|
166
|
-
this.currentSkStatus.endpoint.status = true;
|
|
167
|
-
this.currentSkStatus.endpoint.message = response.status.toString();
|
|
168
|
-
this.currentSkStatus.server.version = response.body.server.id + " " + response.body.server.version;
|
|
169
|
-
|
|
170
|
-
this.callREST();
|
|
171
|
-
this.connectEndpointWS();
|
|
172
|
-
|
|
173
|
-
this.signalKStatus.next(this.currentSkStatus);
|
|
174
|
-
},
|
|
175
|
-
// When not ok, this runs...
|
|
176
|
-
(err: HttpErrorResponse) => {
|
|
177
|
-
if (err.error instanceof Error) {
|
|
178
|
-
// A client-side or network error occurred. Handle it accordingly.
|
|
179
|
-
console.log('An HTTP connection error occurred:', err.error.message);
|
|
180
|
-
} else {
|
|
181
|
-
// The backend returned an unsuccessful response code.
|
|
182
|
-
// The response body may contain clues as to what went wrong,
|
|
183
|
-
console.log(err);
|
|
184
|
-
}
|
|
185
|
-
this.currentSkStatus.endpoint.status = false;
|
|
186
|
-
this.currentSkStatus.endpoint.message = err.message;
|
|
187
|
-
this.signalKStatus.next(this.currentSkStatus);
|
|
188
|
-
}
|
|
189
|
-
);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
callREST() {
|
|
193
|
-
this.http.get(this.endpointREST, {observe: 'response'}).subscribe(
|
|
194
|
-
// when we go ok, this runs
|
|
195
|
-
response => {
|
|
196
|
-
this.currentSkStatus.rest.status = true;
|
|
197
|
-
this.currentSkStatus.rest.message = response.status.toString();
|
|
198
|
-
this.SignalKFullService.processFullUpdate(response.body);
|
|
199
|
-
},
|
|
200
|
-
// When not ok, this runs...
|
|
201
|
-
(err: HttpErrorResponse) => {
|
|
202
|
-
if (err.error instanceof Error) {
|
|
203
|
-
// A client-side or network error occurred. Handle it accordingly.
|
|
204
|
-
this.currentSkStatus.rest.message = err.error.message;
|
|
205
|
-
console.log('A REST error occurred:', err.error.message);
|
|
206
|
-
} else {
|
|
207
|
-
// The backend returned an unsuccessful response code.
|
|
208
|
-
// The response body may contain clues as to what went wrong,
|
|
209
|
-
this.currentSkStatus.rest.message = "Unspecified REST error";
|
|
210
|
-
console.log(err);
|
|
211
|
-
}
|
|
212
|
-
this.currentSkStatus.rest.status = false;
|
|
213
|
-
}
|
|
214
|
-
);
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
connectEndpointWS() {
|
|
218
|
-
if (this.endpointWS === null) {
|
|
219
|
-
//no endpoint, try again later....
|
|
220
|
-
setTimeout(()=>{ this.connectEndpointWS();}, 3000);
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
// don't reopen an existing connection
|
|
225
|
-
if (this.webSocket != null && this.webSocket.readyState < 2) { // 0 = connecting, 1 = open, 2 = closing, 3 = closed
|
|
226
|
-
return;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
let endpointArgs = "?subscribe=all";
|
|
230
|
-
|
|
231
|
-
if ((this.signalKToken.token !== null)&&(this.signalKToken.token != "")) {
|
|
232
|
-
endpointArgs += "&token="+this.signalKToken.token;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
this.webSocket = new WebSocket(this.endpointWS+endpointArgs);
|
|
236
|
-
this.webSocket.onopen = function (event){
|
|
237
|
-
this.currentSkStatus.websocket.message = "Connected";
|
|
238
|
-
this.currentSkStatus.websocket.status = true;
|
|
239
|
-
}.bind(this);
|
|
240
|
-
|
|
241
|
-
this.webSocket.onerror = function (event) {
|
|
242
|
-
this.currentSkStatus.websocket.message = "Unspecified WebSocket error";
|
|
243
|
-
this.currentSkStatus.websocket.status = false;
|
|
244
|
-
setTimeout(()=>{ this.connectEndpointWS();}, 3000);
|
|
245
|
-
}.bind(this);
|
|
246
|
-
|
|
247
|
-
this.webSocket.onclose = function (event) {
|
|
248
|
-
this.currentSkStatus.websocket.message = "WebSocket closed";
|
|
249
|
-
this.currentSkStatus.websocket.status = false;
|
|
250
|
-
setTimeout(()=>{ this.connectEndpointWS();}, 3000);
|
|
251
|
-
}.bind(this);
|
|
252
|
-
|
|
253
|
-
this.webSocket.onmessage = function(message) {
|
|
254
|
-
this.signalKDeltaService.processWebsocketMessage(JSON.parse(message.data));
|
|
255
|
-
}.bind(this);
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
publishDelta(message: string) {
|
|
259
|
-
|
|
260
|
-
if (!this.currentSkStatus.websocket.status) {
|
|
261
|
-
console.log("Tried to publish delta while not connected to Websocket");
|
|
262
|
-
return;
|
|
263
|
-
}
|
|
264
|
-
console.log(message);
|
|
265
|
-
this.webSocket.send(message);
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
postApplicationData(scope: string, configName: string, data: Object): Observable<string[]> {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
let url = this.endpointREST.substring(0,this.endpointREST.length - 4); // this removes 'api/' from the end
|
|
272
|
-
url += "applicationData/" + scope +"/kip/1.0/"+ configName;
|
|
273
|
-
|
|
274
|
-
let options = {};
|
|
275
|
-
|
|
276
|
-
if ((this.signalKToken.token !== null)&&(this.signalKToken.token != "")) {
|
|
277
|
-
options['headers'] = new HttpHeaders().set("authorization", "JWT "+this.signalKToken.token);
|
|
278
|
-
}
|
|
279
|
-
return this.http.post<any>(url, data, options).pipe(
|
|
280
|
-
catchError(this.handleError<string[]>('postApplicationData', []))
|
|
281
|
-
);
|
|
282
|
-
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
getApplicationDataKeys(scope: string): Observable<string[]> {
|
|
286
|
-
let url = this.endpointREST.substring(0,this.endpointREST.length - 4); // this removes 'api/' from the end
|
|
287
|
-
url += "applicationData/" + scope +"/kip/1.0/?keys=true";
|
|
288
|
-
|
|
289
|
-
let options = {};
|
|
290
|
-
|
|
291
|
-
if ((this.signalKToken.token !== null)&&(this.signalKToken.token != "")) {
|
|
292
|
-
options['headers'] = new HttpHeaders().set("authorization", "JWT "+this.signalKToken.token);
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
return this.http.get<string[]>(url, options).pipe(
|
|
296
|
-
tap(_ => {
|
|
297
|
-
console.log("Server Stored Configs for "+ scope +": "); console.log(_)
|
|
298
|
-
}),
|
|
299
|
-
catchError(this.handleError<string[]>('getApplicationDataKeys', []))
|
|
300
|
-
);
|
|
301
|
-
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
getApplicationData(scope: string, configName: string): Observable<any>{
|
|
305
|
-
let url = this.endpointREST.substring(0,this.endpointREST.length - 4); // this removes 'api/' from the end
|
|
306
|
-
url += "applicationData/" + scope +"/kip/1.0/" + configName;
|
|
307
|
-
let options = {};
|
|
308
|
-
|
|
309
|
-
if ((this.signalKToken.token !== null) && (this.signalKToken.token != "")) {
|
|
310
|
-
options['headers'] = new HttpHeaders().set("authorization", "JWT "+this.signalKToken.token);
|
|
311
|
-
}
|
|
312
|
-
return this.http.get<any>(url, options).pipe(
|
|
313
|
-
tap(_ => {
|
|
314
|
-
console.log("Fetched Stored Configs for "+ scope +" / "+ configName);
|
|
315
|
-
}),
|
|
316
|
-
catchError(this.handleError<any>('getApplicationData'))
|
|
317
|
-
);
|
|
318
|
-
}
|
|
319
|
-
/**
|
|
320
|
-
* Handle Http operation that failed.
|
|
321
|
-
* Let the app continue.
|
|
322
|
-
* @param operation - name of the operation that failed
|
|
323
|
-
* @param result - optional value to return as the observable result
|
|
324
|
-
*/
|
|
325
|
-
private handleError<T>(operation = 'operation', result?: T) {
|
|
326
|
-
return (error: any): Observable<T> => {
|
|
327
|
-
|
|
328
|
-
// TODO: send the error to remote logging infrastructure
|
|
329
|
-
console.error(error); // log to console instead
|
|
330
|
-
|
|
331
|
-
// TODO: better job of transforming error for user consumption
|
|
332
|
-
console.log(`${operation} failed: ${error.message}`);
|
|
333
|
-
|
|
334
|
-
// Let the app keep running by returning an empty result.
|
|
335
|
-
return of(result as T);
|
|
336
|
-
};
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
// SignalK Connections Status observable
|
|
340
|
-
getSignalKConnectionsStatus() {
|
|
341
|
-
return this.signalKStatus.asObservable();
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { TestBed, inject } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { SignalKDeltaService } from './signalk-delta.service';
|
|
4
|
-
|
|
5
|
-
describe('SignalkDeltaService', () => {
|
|
6
|
-
beforeEach(() => {
|
|
7
|
-
TestBed.configureTestingModule({
|
|
8
|
-
providers: [SignalKDeltaService]
|
|
9
|
-
});
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
it('should be created', inject([SignalKDeltaService], (service: SignalKDeltaService) => {
|
|
13
|
-
expect(service).toBeTruthy();
|
|
14
|
-
}));
|
|
15
|
-
});
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@angular/core';
|
|
2
|
-
import { Observable , Subject, Subscription } from 'rxjs';
|
|
3
|
-
import { SignalKService } from './signalk.service';
|
|
4
|
-
import { IDeltaMessage } from './signalk-interfaces';
|
|
5
|
-
import { NotificationsService } from './notifications.service';
|
|
6
|
-
import { AppSettingsService } from "./app-settings.service";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
@Injectable()
|
|
10
|
-
export class SignalKDeltaService {
|
|
11
|
-
|
|
12
|
-
signalKRequests = new Subject<IDeltaMessage>(); // requests service subs to this (avoids circular dependency in services)
|
|
13
|
-
|
|
14
|
-
constructor(
|
|
15
|
-
private SignalKService: SignalKService,
|
|
16
|
-
private notificationsService: NotificationsService,
|
|
17
|
-
) { }
|
|
18
|
-
|
|
19
|
-
processWebsocketMessage(message: IDeltaMessage) {
|
|
20
|
-
// Read raw message and route to appropriate sub
|
|
21
|
-
if (typeof(message.self) != 'undefined') { // is Hello message
|
|
22
|
-
this.SignalKService.setSelf(message.self);
|
|
23
|
-
this.SignalKService.setServerVersion(message.version);
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
if (typeof(message.updates) != 'undefined') {
|
|
29
|
-
this.processUpdateDelta(message); // is Data Update process further
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (typeof(message.requestId) != 'undefined') {
|
|
33
|
-
this.signalKRequests.next(message); // is a Request, send to signalk-request service.
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
public processUpdateDelta(message:IDeltaMessage) {
|
|
39
|
-
let context: string;
|
|
40
|
-
if (typeof(message.context) == 'undefined') {
|
|
41
|
-
context = 'self'; //default if not defined
|
|
42
|
-
} else {
|
|
43
|
-
context = message.context;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// process message Updates
|
|
47
|
-
for (let update of message.updates) {
|
|
48
|
-
// get source identifier. 'src' is nmea2k and 'talker' is nmea0183
|
|
49
|
-
let source = '';
|
|
50
|
-
if ((update.source !== undefined) && (update.source.type !== undefined) && update.source.label !== undefined) {
|
|
51
|
-
if (update.source.type == 'NMEA2000') {
|
|
52
|
-
source = update.source.label + '.' + update.source.src;
|
|
53
|
-
} else if (update.source.type == 'NMEA0183') {
|
|
54
|
-
source = update.source.label + '.' + update.source.talker;
|
|
55
|
-
} else {
|
|
56
|
-
// donno what it is...
|
|
57
|
-
source = update.source.label;
|
|
58
|
-
}
|
|
59
|
-
} else if (update['$source'] !== undefined) {
|
|
60
|
-
source = update['$source'];
|
|
61
|
-
} else if ((update.source !== undefined) && (update.source.src !== undefined) && (update.source.label !== undefined)) {
|
|
62
|
-
source = update.source.label + '.' + update.source.src;
|
|
63
|
-
} else if (update.source.label !== undefined) {
|
|
64
|
-
source = update.source.label;
|
|
65
|
-
} else {
|
|
66
|
-
source = "unknown";
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// process message values
|
|
70
|
-
let timestamp = Date.parse(update.timestamp); //TODO, supposedly not reliable
|
|
71
|
-
for (let value of update.values) {
|
|
72
|
-
if (/^notifications./.test(value.path)) { // is a notification message, pass to notification service
|
|
73
|
-
this.notificationsService.processNotificationDelta(value.path, value.value);
|
|
74
|
-
} else {
|
|
75
|
-
// it's a data update. Update local tree
|
|
76
|
-
let fullPath = context + '.' + value.path;
|
|
77
|
-
if (value.path == '') { fullPath = context; } // if path is empty we shouldn't have a . at the end
|
|
78
|
-
if ( (typeof(value.value) == 'object') && (value.value !== null)) {
|
|
79
|
-
// compound data
|
|
80
|
-
let keys = Object.keys(value.value);
|
|
81
|
-
for (let i = 0; i < keys.length; i++) {
|
|
82
|
-
this.SignalKService.updatePathData(fullPath + '.' + keys[i], source, timestamp, value.value[keys[i]]);
|
|
83
|
-
}
|
|
84
|
-
} else {
|
|
85
|
-
// simple data
|
|
86
|
-
this.SignalKService.updatePathData(fullPath, source, timestamp, value.value);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
public subscribeRequest(): Observable<IDeltaMessage> {
|
|
94
|
-
return this.signalKRequests.asObservable();
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { TestBed, inject } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { SignalkFullService } from './signalk-full.service';
|
|
4
|
-
|
|
5
|
-
describe('SignalkFullService', () => {
|
|
6
|
-
beforeEach(() => {
|
|
7
|
-
TestBed.configureTestingModule({
|
|
8
|
-
providers: [SignalkFullService]
|
|
9
|
-
});
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
it('should be created', inject([SignalkFullService], (service: SignalkFullService) => {
|
|
13
|
-
expect(service).toBeTruthy();
|
|
14
|
-
}));
|
|
15
|
-
});
|