@kalisio/kdk 1.4.2 → 1.5.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/.nyc_output/{2e74ca23-8cf0-4161-9536-f71c2a1a74bb.json → 058fc679-d60a-4501-ac04-71171e5200b8.json} +0 -0
- package/.nyc_output/2226bcce-9d22-4dad-b9fa-46564b5565c7.json +1 -0
- package/.nyc_output/{2c5b7c8e-81db-4d2c-a7a4-02dc640d301f.json → 6dc4b140-1a8a-4d69-b91c-89c557883d6e.json} +1 -1
- package/.nyc_output/{81d21e46-766a-46bc-b1b7-143ca577347a.json → 8b1830fa-932e-4a61-9837-4a5b18f83ea9.json} +0 -0
- package/.nyc_output/{aaf3ebbb-f895-4d7b-9255-bc5dee832570.json → afd2d144-3570-4858-b94a-b523dbd023dd.json} +0 -0
- package/.nyc_output/processinfo/058fc679-d60a-4501-ac04-71171e5200b8.json +1 -0
- package/.nyc_output/processinfo/{a762cb58-70dc-4d39-ab69-928635affa98.json → 2226bcce-9d22-4dad-b9fa-46564b5565c7.json} +1 -1
- package/.nyc_output/processinfo/{2c5b7c8e-81db-4d2c-a7a4-02dc640d301f.json → 6dc4b140-1a8a-4d69-b91c-89c557883d6e.json} +1 -1
- package/.nyc_output/processinfo/8b1830fa-932e-4a61-9837-4a5b18f83ea9.json +1 -0
- package/.nyc_output/processinfo/afd2d144-3570-4858-b94a-b523dbd023dd.json +1 -0
- package/.nyc_output/processinfo/index.json +1 -1
- package/CHANGELOG.md +21 -8
- package/coverage/core/api/application.js.html +455 -455
- package/coverage/core/api/authentication.js.html +119 -119
- package/coverage/core/api/db.js.html +201 -201
- package/coverage/core/api/hooks/hooks.account.js.html +45 -45
- package/coverage/core/api/hooks/hooks.authentication.js.html +71 -71
- package/coverage/core/api/hooks/hooks.authorisations.js.html +353 -353
- package/coverage/core/api/hooks/hooks.devices.js.html +49 -49
- package/coverage/core/api/hooks/hooks.groups.js.html +37 -37
- package/coverage/core/api/hooks/hooks.logger.js.html +27 -27
- package/coverage/core/api/hooks/hooks.model.js.html +269 -269
- package/coverage/core/api/hooks/hooks.organisations.js.html +190 -190
- package/coverage/core/api/hooks/hooks.pusher.js.html +114 -114
- package/coverage/core/api/hooks/hooks.query.js.html +200 -200
- package/coverage/core/api/hooks/hooks.service.js.html +82 -82
- package/coverage/core/api/hooks/hooks.storage.js.html +121 -121
- package/coverage/core/api/hooks/hooks.tags.js.html +232 -232
- package/coverage/core/api/hooks/hooks.users.js.html +263 -263
- package/coverage/core/api/hooks/index.html +172 -172
- package/coverage/core/api/hooks/index.js.html +24 -24
- package/coverage/core/api/index.html +75 -75
- package/coverage/core/api/index.js.html +26 -26
- package/coverage/core/api/marshall.js.html +57 -57
- package/coverage/core/api/models/groups.model.mongodb.js.html +20 -20
- package/coverage/core/api/models/index.html +50 -50
- package/coverage/core/api/models/organisations.model.mongodb.js.html +12 -12
- package/coverage/core/api/models/tags.model.mongodb.js.html +22 -22
- package/coverage/core/api/models/users.model.mongodb.js.html +20 -20
- package/coverage/core/api/oauth2-handler.js.html +18 -18
- package/coverage/core/api/oauth2-verifier.js.html +38 -38
- package/coverage/core/api/services/account/account.hooks.js.html +16 -16
- package/coverage/core/api/services/account/account.service.js.html +104 -104
- package/coverage/core/api/services/account/index.html +32 -32
- package/coverage/core/api/services/authorisations/authorisations.hooks.js.html +9 -9
- package/coverage/core/api/services/authorisations/authorisations.service.js.html +132 -132
- package/coverage/core/api/services/authorisations/index.html +28 -28
- package/coverage/core/api/services/databases/databases.hooks.js.html +9 -9
- package/coverage/core/api/services/databases/databases.service.js.html +12 -12
- package/coverage/core/api/services/databases/index.html +24 -24
- package/coverage/core/api/services/devices/devices.hooks.js.html +9 -9
- package/coverage/core/api/services/devices/devices.service.js.html +121 -121
- package/coverage/core/api/services/devices/index.html +28 -28
- package/coverage/core/api/services/groups/groups.hooks.js.html +9 -9
- package/coverage/core/api/services/groups/index.html +13 -13
- package/coverage/core/api/services/index.html +21 -21
- package/coverage/core/api/services/index.js.html +137 -137
- package/coverage/core/api/services/mailer/index.html +24 -24
- package/coverage/core/api/services/mailer/mailer.hooks.js.html +9 -9
- package/coverage/core/api/services/mailer/mailer.service.js.html +19 -19
- package/coverage/core/api/services/organisations/index.html +24 -24
- package/coverage/core/api/services/organisations/organisations.hooks.js.html +8 -8
- package/coverage/core/api/services/organisations/organisations.service.js.html +67 -67
- package/coverage/core/api/services/pusher/index.html +34 -34
- package/coverage/core/api/services/pusher/pusher.channels.js.html +8 -8
- package/coverage/core/api/services/pusher/pusher.hooks.js.html +10 -10
- package/coverage/core/api/services/pusher/pusher.service.js.html +414 -414
- package/coverage/core/api/services/storage/index.html +21 -21
- package/coverage/core/api/services/storage/storage.hooks.js.html +35 -35
- package/coverage/core/api/services/tags/index.html +21 -21
- package/coverage/core/api/services/tags/tags.hooks.js.html +25 -25
- package/coverage/core/api/services/users/index.html +21 -21
- package/coverage/core/api/services/users/users.hooks.js.html +33 -33
- package/coverage/core/common/errors.js.html +1 -1
- package/coverage/core/common/index.html +42 -27
- package/coverage/core/common/index.js.html +16 -16
- package/coverage/core/common/permissions.js.html +274 -274
- package/coverage/index.html +178 -178
- package/coverage/lcov-report/core/api/application.js.html +455 -455
- package/coverage/lcov-report/core/api/authentication.js.html +119 -119
- package/coverage/lcov-report/core/api/db.js.html +201 -201
- package/coverage/lcov-report/core/api/hooks/hooks.account.js.html +45 -45
- package/coverage/lcov-report/core/api/hooks/hooks.authentication.js.html +71 -71
- package/coverage/lcov-report/core/api/hooks/hooks.authorisations.js.html +353 -353
- package/coverage/lcov-report/core/api/hooks/hooks.devices.js.html +49 -49
- package/coverage/lcov-report/core/api/hooks/hooks.groups.js.html +37 -37
- package/coverage/lcov-report/core/api/hooks/hooks.logger.js.html +27 -27
- package/coverage/lcov-report/core/api/hooks/hooks.model.js.html +269 -269
- package/coverage/lcov-report/core/api/hooks/hooks.organisations.js.html +190 -190
- package/coverage/lcov-report/core/api/hooks/hooks.pusher.js.html +114 -114
- package/coverage/lcov-report/core/api/hooks/hooks.query.js.html +200 -200
- package/coverage/lcov-report/core/api/hooks/hooks.service.js.html +82 -82
- package/coverage/lcov-report/core/api/hooks/hooks.storage.js.html +121 -121
- package/coverage/lcov-report/core/api/hooks/hooks.tags.js.html +232 -232
- package/coverage/lcov-report/core/api/hooks/hooks.users.js.html +263 -263
- package/coverage/lcov-report/core/api/hooks/index.html +172 -172
- package/coverage/lcov-report/core/api/hooks/index.js.html +24 -24
- package/coverage/lcov-report/core/api/index.html +75 -75
- package/coverage/lcov-report/core/api/index.js.html +26 -26
- package/coverage/lcov-report/core/api/marshall.js.html +57 -57
- package/coverage/lcov-report/core/api/models/groups.model.mongodb.js.html +20 -20
- package/coverage/lcov-report/core/api/models/index.html +50 -50
- package/coverage/lcov-report/core/api/models/organisations.model.mongodb.js.html +12 -12
- package/coverage/lcov-report/core/api/models/tags.model.mongodb.js.html +22 -22
- package/coverage/lcov-report/core/api/models/users.model.mongodb.js.html +20 -20
- package/coverage/lcov-report/core/api/oauth2-handler.js.html +18 -18
- package/coverage/lcov-report/core/api/oauth2-verifier.js.html +38 -38
- package/coverage/lcov-report/core/api/services/account/account.hooks.js.html +16 -16
- package/coverage/lcov-report/core/api/services/account/account.service.js.html +104 -104
- package/coverage/lcov-report/core/api/services/account/index.html +32 -32
- package/coverage/lcov-report/core/api/services/authorisations/authorisations.hooks.js.html +9 -9
- package/coverage/lcov-report/core/api/services/authorisations/authorisations.service.js.html +132 -132
- package/coverage/lcov-report/core/api/services/authorisations/index.html +28 -28
- package/coverage/lcov-report/core/api/services/databases/databases.hooks.js.html +9 -9
- package/coverage/lcov-report/core/api/services/databases/databases.service.js.html +12 -12
- package/coverage/lcov-report/core/api/services/databases/index.html +24 -24
- package/coverage/lcov-report/core/api/services/devices/devices.hooks.js.html +9 -9
- package/coverage/lcov-report/core/api/services/devices/devices.service.js.html +121 -121
- package/coverage/lcov-report/core/api/services/devices/index.html +28 -28
- package/coverage/lcov-report/core/api/services/groups/groups.hooks.js.html +9 -9
- package/coverage/lcov-report/core/api/services/groups/index.html +13 -13
- package/coverage/lcov-report/core/api/services/index.html +21 -21
- package/coverage/lcov-report/core/api/services/index.js.html +137 -137
- package/coverage/lcov-report/core/api/services/mailer/index.html +24 -24
- package/coverage/lcov-report/core/api/services/mailer/mailer.hooks.js.html +9 -9
- package/coverage/lcov-report/core/api/services/mailer/mailer.service.js.html +19 -19
- package/coverage/lcov-report/core/api/services/organisations/index.html +24 -24
- package/coverage/lcov-report/core/api/services/organisations/organisations.hooks.js.html +8 -8
- package/coverage/lcov-report/core/api/services/organisations/organisations.service.js.html +67 -67
- package/coverage/lcov-report/core/api/services/pusher/index.html +34 -34
- package/coverage/lcov-report/core/api/services/pusher/pusher.channels.js.html +8 -8
- package/coverage/lcov-report/core/api/services/pusher/pusher.hooks.js.html +10 -10
- package/coverage/lcov-report/core/api/services/pusher/pusher.service.js.html +414 -414
- package/coverage/lcov-report/core/api/services/storage/index.html +21 -21
- package/coverage/lcov-report/core/api/services/storage/storage.hooks.js.html +35 -35
- package/coverage/lcov-report/core/api/services/tags/index.html +21 -21
- package/coverage/lcov-report/core/api/services/tags/tags.hooks.js.html +25 -25
- package/coverage/lcov-report/core/api/services/users/index.html +21 -21
- package/coverage/lcov-report/core/api/services/users/users.hooks.js.html +33 -33
- package/coverage/lcov-report/core/common/errors.js.html +1 -1
- package/coverage/lcov-report/core/common/index.html +42 -27
- package/coverage/lcov-report/core/common/index.js.html +16 -16
- package/coverage/lcov-report/core/common/permissions.js.html +274 -274
- package/coverage/lcov-report/index.html +178 -178
- package/coverage/lcov-report/map/api/hooks/hooks.catalog.js.html +1 -1
- package/coverage/lcov-report/map/api/hooks/hooks.query.js.html +25 -7
- package/coverage/lcov-report/map/api/hooks/index.html +7 -7
- package/coverage/lcov-report/map/api/hooks/index.js.html +1 -1
- package/coverage/lcov-report/map/api/index.html +1 -1
- package/coverage/lcov-report/map/api/index.js.html +1 -1
- package/coverage/lcov-report/map/api/marshall.js.html +1 -1
- package/coverage/lcov-report/map/api/models/alerts.model.mongodb.js.html +1 -1
- package/coverage/lcov-report/map/api/models/catalog.model.mongodb.js.html +1 -1
- package/coverage/lcov-report/map/api/models/features.model.mongodb.js.html +1 -1
- package/coverage/lcov-report/map/api/models/index.html +1 -1
- package/coverage/lcov-report/map/api/services/alerts/alerts.hooks.js.html +1 -1
- package/coverage/lcov-report/map/api/services/alerts/alerts.service.js.html +1 -1
- package/coverage/lcov-report/map/api/services/alerts/index.html +1 -1
- package/coverage/lcov-report/map/api/services/catalog/catalog.hooks.js.html +1 -1
- package/coverage/lcov-report/map/api/services/catalog/index.html +1 -1
- package/coverage/lcov-report/map/api/services/daptiles/daptiles.service.js.html +1 -1
- package/coverage/lcov-report/map/api/services/daptiles/index.html +1 -1
- package/coverage/lcov-report/map/api/services/features/features.hooks.js.html +1 -1
- package/coverage/lcov-report/map/api/services/features/index.html +1 -1
- package/coverage/lcov-report/map/api/services/geocoder/geocoder.hooks.js.html +1 -1
- package/coverage/lcov-report/map/api/services/geocoder/geocoder.service.js.html +1 -1
- package/coverage/lcov-report/map/api/services/geocoder/index.html +1 -1
- package/coverage/lcov-report/map/api/services/index.html +1 -1
- package/coverage/lcov-report/map/api/services/index.js.html +1 -1
- package/coverage/lcov-report/map/common/dynamic-grid-source.js.html +1 -1
- package/coverage/lcov-report/map/common/errors.js.html +1 -1
- package/coverage/lcov-report/map/common/geotiff-grid-source.js.html +1 -1
- package/coverage/lcov-report/map/common/grid.js.html +1 -1
- package/coverage/lcov-report/map/common/index.html +1 -1
- package/coverage/lcov-report/map/common/index.js.html +1 -1
- package/coverage/lcov-report/map/common/meteo-model-grid-source.js.html +1 -1
- package/coverage/lcov-report/map/common/moment-utils.js.html +1 -1
- package/coverage/lcov-report/map/common/opendap-grid-source.js.html +1 -1
- package/coverage/lcov-report/map/common/opendap-utils.js.html +1 -1
- package/coverage/lcov-report/map/common/permissions.js.html +1 -1
- package/coverage/lcov-report/map/common/time-based-grid-source.js.html +1 -1
- package/coverage/lcov-report/map/common/tms-utils.js.html +1 -1
- package/coverage/lcov-report/map/common/wcs-grid-source.js.html +1 -1
- package/coverage/lcov-report/map/common/wcs-utils.js.html +1 -1
- package/coverage/lcov-report/map/common/weacast-grid-source.js.html +1 -1
- package/coverage/lcov-report/map/common/wfs-utils.js.html +1 -1
- package/coverage/lcov-report/map/common/wms-utils.js.html +1 -1
- package/coverage/lcov-report/map/common/wmts-utils.js.html +1 -1
- package/coverage/lcov.info +3403 -3724
- package/coverage/map/api/hooks/hooks.catalog.js.html +1 -1
- package/coverage/map/api/hooks/hooks.query.js.html +25 -7
- package/coverage/map/api/hooks/index.html +7 -7
- package/coverage/map/api/hooks/index.js.html +1 -1
- package/coverage/map/api/index.html +1 -1
- package/coverage/map/api/index.js.html +1 -1
- package/coverage/map/api/marshall.js.html +1 -1
- package/coverage/map/api/models/alerts.model.mongodb.js.html +1 -1
- package/coverage/map/api/models/catalog.model.mongodb.js.html +1 -1
- package/coverage/map/api/models/features.model.mongodb.js.html +1 -1
- package/coverage/map/api/models/index.html +1 -1
- package/coverage/map/api/services/alerts/alerts.hooks.js.html +1 -1
- package/coverage/map/api/services/alerts/alerts.service.js.html +1 -1
- package/coverage/map/api/services/alerts/index.html +1 -1
- package/coverage/map/api/services/catalog/catalog.hooks.js.html +1 -1
- package/coverage/map/api/services/catalog/index.html +1 -1
- package/coverage/map/api/services/daptiles/daptiles.service.js.html +1 -1
- package/coverage/map/api/services/daptiles/index.html +1 -1
- package/coverage/map/api/services/features/features.hooks.js.html +1 -1
- package/coverage/map/api/services/features/index.html +1 -1
- package/coverage/map/api/services/geocoder/geocoder.hooks.js.html +1 -1
- package/coverage/map/api/services/geocoder/geocoder.service.js.html +1 -1
- package/coverage/map/api/services/geocoder/index.html +1 -1
- package/coverage/map/api/services/index.html +1 -1
- package/coverage/map/api/services/index.js.html +1 -1
- package/coverage/map/common/dynamic-grid-source.js.html +1 -1
- package/coverage/map/common/errors.js.html +1 -1
- package/coverage/map/common/geotiff-grid-source.js.html +1 -1
- package/coverage/map/common/grid.js.html +1 -1
- package/coverage/map/common/index.html +1 -1
- package/coverage/map/common/index.js.html +1 -1
- package/coverage/map/common/meteo-model-grid-source.js.html +1 -1
- package/coverage/map/common/moment-utils.js.html +1 -1
- package/coverage/map/common/opendap-grid-source.js.html +1 -1
- package/coverage/map/common/opendap-utils.js.html +1 -1
- package/coverage/map/common/permissions.js.html +1 -1
- package/coverage/map/common/time-based-grid-source.js.html +1 -1
- package/coverage/map/common/tms-utils.js.html +1 -1
- package/coverage/map/common/wcs-grid-source.js.html +1 -1
- package/coverage/map/common/wcs-utils.js.html +1 -1
- package/coverage/map/common/weacast-grid-source.js.html +1 -1
- package/coverage/map/common/wfs-utils.js.html +1 -1
- package/coverage/map/common/wms-utils.js.html +1 -1
- package/coverage/map/common/wmts-utils.js.html +1 -1
- package/lib/core/client/components/form/KFileField.vue +11 -40
- package/lib/core/client/components/input/KOptionsChooser.vue +2 -2
- package/lib/core/client/i18n/core_en.json +6 -1
- package/lib/core/client/i18n/core_fr.json +6 -1
- package/lib/core/client/index.js +18 -0
- package/lib/core/client/index.js.map +1 -1
- package/lib/core/client/layout.js +8 -1
- package/lib/core/client/layout.js.map +1 -1
- package/lib/core/client/reader.js +54 -0
- package/lib/core/client/reader.js.map +1 -0
- package/lib/core/client/readers/index.js +30 -0
- package/lib/core/client/readers/index.js.map +1 -0
- package/lib/core/client/readers/reader.csv.js +43 -0
- package/lib/core/client/readers/reader.csv.js.map +1 -0
- package/lib/core/client/readers/reader.json.js +38 -0
- package/lib/core/client/readers/reader.json.js.map +1 -0
- package/lib/map/api/hooks/hooks.query.js +7 -2
- package/lib/map/api/hooks/hooks.query.js.map +1 -1
- package/lib/map/client/components/KCaptureToolbar.vue +156 -0
- package/lib/map/client/components/KFeaturesFilter.vue +3 -1
- package/lib/map/client/components/KLayerEditionToolbar.vue +19 -11
- package/lib/map/client/components/KLayerStyleEditor.vue +2 -1
- package/lib/map/client/components/KLayerStyleForm.vue +34 -23
- package/lib/map/client/components/KMeasureTool.vue +340 -0
- package/lib/map/client/components/KTimeline.vue +0 -1
- package/lib/map/client/components/catalog/KImportLayer.vue +8 -35
- package/lib/map/client/components/catalog/KLayersSelector.vue +5 -3
- package/lib/map/client/components/widget/KTimeSeries.vue +81 -3
- package/lib/map/client/i18n/map_en.json +41 -4
- package/lib/map/client/i18n/map_fr.json +41 -4
- package/lib/map/client/init.js +6 -1
- package/lib/map/client/init.js.map +1 -1
- package/lib/map/client/leaflet/MaskLayer.js +9 -0
- package/lib/map/client/leaflet/MaskLayer.js.map +1 -1
- package/lib/map/client/mixins/globe/mixin.base-globe.js +3 -5
- package/lib/map/client/mixins/globe/mixin.base-globe.js.map +1 -1
- package/lib/map/client/mixins/globe/mixin.popup.js +4 -0
- package/lib/map/client/mixins/globe/mixin.popup.js.map +1 -1
- package/lib/map/client/mixins/globe/mixin.tooltip.js +4 -0
- package/lib/map/client/mixins/globe/mixin.tooltip.js.map +1 -1
- package/lib/map/client/mixins/map/mixin.base-map.js +45 -6
- package/lib/map/client/mixins/map/mixin.base-map.js.map +1 -1
- package/lib/map/client/mixins/map/mixin.canvas-layers.js +2 -0
- package/lib/map/client/mixins/map/mixin.canvas-layers.js.map +1 -1
- package/lib/map/client/mixins/map/mixin.file-layers.js +47 -101
- package/lib/map/client/mixins/map/mixin.file-layers.js.map +1 -1
- package/lib/map/client/mixins/map/mixin.geojson-layers.js +4 -1
- package/lib/map/client/mixins/map/mixin.geojson-layers.js.map +1 -1
- package/lib/map/client/mixins/map/mixin.popup.js +4 -0
- package/lib/map/client/mixins/map/mixin.popup.js.map +1 -1
- package/lib/map/client/mixins/map/mixin.tooltip.js +4 -0
- package/lib/map/client/mixins/map/mixin.tooltip.js.map +1 -1
- package/lib/map/client/mixins/mixin.activity.js +2 -0
- package/lib/map/client/mixins/mixin.activity.js.map +1 -1
- package/lib/map/client/mixins/mixin.context.js +26 -3
- package/lib/map/client/mixins/mixin.context.js.map +1 -1
- package/lib/map/client/mixins/mixin.feature-service.js +2 -2
- package/lib/map/client/mixins/mixin.feature-service.js.map +1 -1
- package/lib/map/client/mixins/mixin.infobox.js +4 -0
- package/lib/map/client/mixins/mixin.infobox.js.map +1 -1
- package/lib/map/client/readers/index.js +42 -0
- package/lib/map/client/readers/index.js.map +1 -0
- package/lib/map/client/readers/reader.geojson.js +59 -0
- package/lib/map/client/readers/reader.geojson.js.map +1 -0
- package/lib/map/client/readers/reader.gpx.js +41 -0
- package/lib/map/client/readers/reader.gpx.js.map +1 -0
- package/lib/map/client/readers/reader.kml.js +41 -0
- package/lib/map/client/readers/reader.kml.js.map +1 -0
- package/lib/map/client/utils.js +2 -1
- package/lib/map/client/utils.js.map +1 -1
- package/lib/test/client/core/runner.js +1 -2
- package/lib/test/client/core/runner.js.map +1 -1
- package/lib/test/client/core/utils.js +2 -2
- package/lib/test/client/core/utils.js.map +1 -1
- package/lib/test/client/map/catalog.js +50 -49
- package/lib/test/client/map/catalog.js.map +1 -1
- package/package.json +3 -2
- package/.nyc_output/a762cb58-70dc-4d39-ab69-928635affa98.json +0 -1
- package/.nyc_output/dbeb2602-0ac2-4e66-978b-0d29548359ca.json +0 -1
- package/.nyc_output/e47d1e4c-2fff-4dcb-908f-d3081162547c.json +0 -1
- package/.nyc_output/processinfo/2e74ca23-8cf0-4161-9536-f71c2a1a74bb.json +0 -1
- package/.nyc_output/processinfo/81d21e46-766a-46bc-b1b7-143ca577347a.json +0 -1
- package/.nyc_output/processinfo/aaf3ebbb-f895-4d7b-9255-bc5dee832570.json +0 -1
- package/.nyc_output/processinfo/dbeb2602-0ac2-4e66-978b-0d29548359ca.json +0 -1
- package/.nyc_output/processinfo/e47d1e4c-2fff-4dcb-908f-d3081162547c.json +0 -1
- package/extras/testcafe/Dockerfile +0 -48
- package/extras/testcafe/docker-entrypoint.sh +0 -27
- package/extras/testcafe/page-models/core/account.js +0 -75
- package/extras/testcafe/page-models/core/base-collection.js +0 -41
- package/extras/testcafe/page-models/core/base-page.js +0 -25
- package/extras/testcafe/page-models/core/groups.js +0 -36
- package/extras/testcafe/page-models/core/index.js +0 -140
- package/extras/testcafe/page-models/core/layout.js +0 -145
- package/extras/testcafe/page-models/core/members.js +0 -98
- package/extras/testcafe/page-models/core/organisations.js +0 -76
- package/extras/testcafe/page-models/core/screens.js +0 -99
- package/extras/testcafe/page-models/core/tags.js +0 -21
- package/extras/testcafe/page-models/map/add-layer.js +0 -51
- package/extras/testcafe/page-models/map/catalog.js +0 -132
- package/extras/testcafe/page-models/map/index.js +0 -36
- package/extras/testcafe/page-models/map/map-activity.js +0 -42
- package/extras/testcafe/page-models/map/timeline.js +0 -67
|
@@ -526,7 +526,7 @@ export function <span class="fstat-no" title="function not covered" >buildLeafle
|
|
|
526
526
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
527
527
|
Code coverage generated by
|
|
528
528
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
529
|
-
at
|
|
529
|
+
at Fri Jan 07 2022 19:29:56 GMT+0100 (GMT+01:00)
|
|
530
530
|
</div>
|
|
531
531
|
</div>
|
|
532
532
|
<script src="../../prettify.js"></script>
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
import _ from 'lodash'
|
|
29
29
|
import { QFile } from 'quasar'
|
|
30
30
|
import mixins from '../../mixins'
|
|
31
|
-
import
|
|
31
|
+
import { Reader } from '../../reader'
|
|
32
32
|
|
|
33
33
|
export default {
|
|
34
34
|
name: 'k-file-field',
|
|
@@ -52,46 +52,17 @@ export default {
|
|
|
52
52
|
this.error = ''
|
|
53
53
|
this.model = this.emptyModel()
|
|
54
54
|
},
|
|
55
|
-
onFileChanged () {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
} catch (error) {
|
|
65
|
-
this.error = 'KFileField.INVALID_JSON_FILE'
|
|
66
|
-
this.model = this.emptyModel()
|
|
67
|
-
return
|
|
68
|
-
}
|
|
55
|
+
async onFileChanged () {
|
|
56
|
+
if (this.file) {
|
|
57
|
+
try {
|
|
58
|
+
const content = await Reader.read(this.file)
|
|
59
|
+
this.model = { name: this.file.name, content }
|
|
60
|
+
this.onChanged()
|
|
61
|
+
} catch (error) {
|
|
62
|
+
this.error = error
|
|
63
|
+
this.model = this.emptyModel()
|
|
69
64
|
}
|
|
70
|
-
|
|
71
|
-
const type = _.get(content, 'type')
|
|
72
|
-
if (type !== 'Feature' && type !== 'FeatureCollection') {
|
|
73
|
-
this.error = 'KFileField.INVALID_GEOJSON_FILE'
|
|
74
|
-
this.model = this.emptyModel()
|
|
75
|
-
return
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
if (this.getAcceptedTypes().split(',').includes('text/csv')) {
|
|
79
|
-
const result = Papa.parse(content, { skipEmptyLines: true })
|
|
80
|
-
if (result.errors.length > 0) {
|
|
81
|
-
this.error = 'KFileField.INVALID_CSV_FILE'
|
|
82
|
-
this.model = this.emptyModel()
|
|
83
|
-
return
|
|
84
|
-
}
|
|
85
|
-
content = result.data
|
|
86
|
-
}
|
|
87
|
-
this.model = { name: this.file.name, content }
|
|
88
|
-
this.onChanged()
|
|
89
|
-
})
|
|
90
|
-
reader.addEventListener('error', () => {
|
|
91
|
-
this.error = 'KFileField.ERROR_WHILE_LOADING_THE_FILE'
|
|
92
|
-
this.model = this.emptyModel()
|
|
93
|
-
})
|
|
94
|
-
if (this.file) reader.readAsText(this.file)
|
|
65
|
+
}
|
|
95
66
|
},
|
|
96
67
|
onFileRejected (file) {
|
|
97
68
|
this.error = 'KFileField.INVALID_FILE_TYPE'
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
<q-item-section v-if="option.icon">
|
|
21
21
|
<q-icon :name="option.icon" size="1.5rem" />
|
|
22
22
|
</q-item-section>
|
|
23
|
-
<q-item-section v-if="option.badge">
|
|
24
|
-
{{ option.badge }}
|
|
23
|
+
<q-item-section v-if="option.badge || option.label">
|
|
24
|
+
{{ option.badge || option.label }}
|
|
25
25
|
</q-item-section>
|
|
26
26
|
</q-item>
|
|
27
27
|
</q-list>
|
|
@@ -64,7 +64,12 @@
|
|
|
64
64
|
"OAUTH2_PROVIDER": "You cannot update your account because it is managed by {{provider}}, in order to switch to a local account reset your password first",
|
|
65
65
|
"EMAIL_ALREADY_TAKEN": "A user with this email address seems to be already registered",
|
|
66
66
|
"OBJECT_ID_ALREADY_TAKEN": "An item with this identifier seems to already exist. Please try again with another value.",
|
|
67
|
-
"DUPLICATED_FILE": "The file {{file}} is already added"
|
|
67
|
+
"DUPLICATED_FILE": "The file {{file}} is already added",
|
|
68
|
+
"UNSUPPORTED_FILE_FORMAT": "The {{file}} file format is not supported",
|
|
69
|
+
"CANNOT_READ_FILE": "Unable to read the file {{file}}",
|
|
70
|
+
"INVALID_JSON_FILE": "{{file}} is not a valid JSON file",
|
|
71
|
+
"INVALID_CSV_FILE": "{{file}} is not a valid CSV file",
|
|
72
|
+
"NETWORK_ERROR": "Network error occured"
|
|
68
73
|
},
|
|
69
74
|
"mixins": {
|
|
70
75
|
"baseItem": {
|
|
@@ -64,7 +64,12 @@
|
|
|
64
64
|
"OAUTH2_PROVIDER": "Vous ne pouvez modifier votre compte car il est géré par {{provider}}, pour utiliser un compte local réinitialisez tout d'abord votre mot de passe",
|
|
65
65
|
"OBJECT_ID_ALREADY_TAKEN": "Un élément semble déjà enregistré avec cet identifiant. Merci de réessayer avec une autre valeur.",
|
|
66
66
|
"EMAIL_ALREADY_TAKEN": "Un utilisateur semble déjà enregistré avec cette adresse mail",
|
|
67
|
-
"DUPLICATED_FILE": "Le fichier {{file}} a déjà été ajouté"
|
|
67
|
+
"DUPLICATED_FILE": "Le fichier {{file}} a déjà été ajouté",
|
|
68
|
+
"UNSUPPORTED_FILE_FORMAT": "Le format du fichier {{file}} n'est pas supporté",
|
|
69
|
+
"CANNOT_READ_FILE": "Impossible de lire le fichier {{file}}",
|
|
70
|
+
"INVALID_JSON_FILE": "{{file}} n'est pas un fichier JSON valide",
|
|
71
|
+
"INVALID_CSV_FILE": "{{file}} n'est pas un fichier CSV valide",
|
|
72
|
+
"NETWORK_ERROR": "Une erreur réseau s'est produite"
|
|
68
73
|
},
|
|
69
74
|
"mixins": {
|
|
70
75
|
"baseItem": {
|
package/lib/core/client/index.js
CHANGED
|
@@ -101,6 +101,18 @@ Object.keys(_filter).forEach(function (key) {
|
|
|
101
101
|
});
|
|
102
102
|
});
|
|
103
103
|
|
|
104
|
+
var _reader = require('./reader');
|
|
105
|
+
|
|
106
|
+
Object.keys(_reader).forEach(function (key) {
|
|
107
|
+
if (key === "default" || key === "__esModule") return;
|
|
108
|
+
Object.defineProperty(exports, key, {
|
|
109
|
+
enumerable: true,
|
|
110
|
+
get: function () {
|
|
111
|
+
return _reader[key];
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
|
|
104
116
|
var _sorter = require('./sorter');
|
|
105
117
|
|
|
106
118
|
Object.keys(_sorter).forEach(function (key) {
|
|
@@ -170,6 +182,8 @@ var _hooks = require('./hooks');
|
|
|
170
182
|
|
|
171
183
|
var hooks = _interopRequireWildcard(_hooks);
|
|
172
184
|
|
|
185
|
+
var _readers = require('./readers');
|
|
186
|
+
|
|
173
187
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
|
174
188
|
|
|
175
189
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -218,6 +232,10 @@ function init() {
|
|
|
218
232
|
}
|
|
219
233
|
});
|
|
220
234
|
|
|
235
|
+
// Register default readers
|
|
236
|
+
_reader.Reader.register('.json', _readers.readJSON);
|
|
237
|
+
_reader.Reader.register('.csv', _readers.readCSV);
|
|
238
|
+
|
|
221
239
|
// -----------------------------------------------------------------------
|
|
222
240
|
// | After this we should only have specific cordova initialisation code |
|
|
223
241
|
// -----------------------------------------------------------------------
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../core/client/index.js"],"names":["init","utils","mixins","hooks","api","logger","debug","Time","initialize","configure","services","Layout","Filter","Sorter","Search","Store","set","content","mode","undefined","filter","visible","current","widgets","actions","users","getService","on","user","_id","get","patch","Platform","is","cordova","document","addEventListener","_","window","device","error","notifier","PushNotification","android","vibrate","sound","forceShow","ios","alert","badge","windows","data","registrationId","devicesService","update","uuid","toast","message","timeout","response"],"mappings":";;;;;;;;;AAoBA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAbA;;AAcA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AApBA;;AAqBA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AApBA;;AAqBA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AArBA;;AAsBA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AArBA;;AAsBA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AArBA;;AAsBA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AArBA;;AAsBA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;kBAKwBA,I;;AApCxB;;;;AACA;;;;AAQA;;IAAYC,K;;AACZ;;IAAYC,M;;AACZ;;IAAYC,K;;;;;;;;AAEZ;AACA;AACA;;AAEA;AACA;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IAAK,wBAAuBhB,OAAOa,cAAe,EAAhF;AACD;AACF,OAXD;;AAAA;AAAA;AAAA;AAAA;AAYAX,aAASd,EAAT,CAAY,cAAZ,EAA6BwB,IAAD,IAAU;AACpC;AACA;AACA;AACA;AACA;AACA;AACD,KAPD;AAQAV,aAASd,EAAT,CAAY,OAAZ,EAAsBa,KAAD,IAAW;AAC9BnC,yBAAOmC,KAAP,CAAaA,KAAb;AACAvC,YAAMuD,KAAN,CAAY;AACVC,iBAASjB,MAAMiB,OADL;AAEVC,iBAAS;AAFC,OAAZ;AAID,KAND;AAOAtD,QAAIuB,EAAJ,CAAO,eAAP;AAAA,oCAAwB,WAAMgC,QAAN,EAAkB;AACxC,cAAMN,iBAAiBjD,IAAIsB,UAAJ,CAAe,SAAf,CAAvB;AACA;AACA,YAAIY,OAAOC,MAAP,IAAiBD,OAAOC,MAAP,CAAca,cAAnC,EAAmD;AACjD,gBAAMb,SAAS,MAAMc,eAAeC,MAAf,CAAsBhB,OAAOC,MAAP,CAAca,cAApC,EAAoDd,OAAOC,MAA3D,CAArB;AACAlC,6BAAOC,KAAP,CAAc,UAASiC,OAAOgB,IAAK,2BAA0BhB,OAAOa,cAAe,EAAnF;AACD;AACF,OAPD;;AAAA;AAAA;AAAA;AAAA;AAQD,GAjDD,EAiDG,KAjDH;AAkDD","file":"index.js","sourcesContent":["import logger from 'loglevel'\r\nimport { Platform } from 'quasar'\r\nimport { Store } from './store'\r\nimport { Layout } from './layout'\r\nimport { Time } from './time'\r\nimport { Filter } from './filter'\r\nimport { Sorter } from './sorter'\r\nimport { Search } from './search'\r\nimport services from './services'\r\nimport * as utils from './utils'\r\nimport * as mixins from './mixins'\r\nimport * as hooks from './hooks'\r\n\r\n// We faced a bug in babel so that transform-runtime with export * from 'x' generates import statements in transpiled code\r\n// Tracked here : https://github.com/babel/babel/issues/2877\r\n// We tested the workaround given here https://github.com/babel/babel/issues/2877#issuecomment-270700000 with success so far\r\n\r\n// FIXME: we don't build vue component anymore, they are processed by webpack in the application template\r\n// export * from './components'\r\n\r\nexport * from './events'\r\nexport * from './api'\r\nexport * from './services'\r\nexport * from './store'\r\nexport * from './layout'\r\nexport * from './theme'\r\nexport * from './time'\r\nexport * from './filter'\r\nexport * from './sorter'\r\nexport * from './search'\r\nexport * from './guards'\r\nexport * from '../common'\r\nexport { utils }\r\nexport { mixins }\r\nexport { hooks }\r\n\r\nexport default function init () {\r\n const api = this\r\n\r\n logger.debug('Initializing core')\r\n // Initialize singletons that might be used globally first\r\n Time.initialize()\r\n // Then services\r\n api.configure(services)\r\n // Last, create the models listened by the main layout/pages components\r\n // You must use the patch method on the store to update those models\r\n // It is generally done by activity based componentq or through a local settings service\r\n Layout.initialize()\r\n Filter.initialize(api)\r\n Sorter.initialize()\r\n Search.initialize(api)\r\n Store.set('topPane', { content: null, mode: undefined, filter: {}, visible: false })\r\n Store.set('leftPane', { content: null, mode: undefined, filter: {}, visible: false })\r\n Store.set('rightPane', { content: null, mode: undefined, filter: {}, visible: false })\r\n Store.set('bottomPane', { content: null, mode: undefined, filter: {}, visible: false })\r\n Store.set('page', { content: null, mode: undefined, filter: {} })\r\n Store.set('window', { current: '', widgets: [], filter: {} })\r\n Store.set('fab', { actions: [], filter: {} })\r\n\r\n // Listen to the 'patched' event on the users\r\n const users = api.getService('users')\r\n users.on('patched', user => {\r\n // Check whether we need to update the current user\r\n if (user._id === Store.get('user._id')) {\r\n Store.patch('user', user)\r\n }\r\n })\r\n\r\n // -----------------------------------------------------------------------\r\n // | After this we should only have specific cordova initialisation code |\r\n // -----------------------------------------------------------------------\r\n if (!Platform.is.cordova) return\r\n\r\n /* NOT SURE IF THIS IS REQUIRED\r\n let permissionsPlugin = cordova.plugins.permissions\r\n const notificationPermissions = [\r\n permissionsPlugin.INTERNET,\r\n permissionsPlugin.ACCESS_NETWORK_STATE,\r\n permissionsPlugin.WAKE_LOCK,\r\n permissionsPlugin.VIBRATE\r\n ]\r\n\r\n function permissionsError() {\r\n const message = 'Required permissions for push notifications are missing or have been rejected, the application will not work as expected'\r\n logger.error(message)\r\n utils.toast({\r\n message,\r\n timeout: 10000\r\n })\r\n }\r\n function permissionsCheckSuccess(status) {\r\n // Request again if not given\r\n if (!status.hasPermission) {\r\n permissionsPlugin.requestPermissions(notificationPermissions, status => { if (!status.hasPermission) permissionsError() }, permissionsError)\r\n }\r\n }\r\n */\r\n\r\n document.addEventListener('deviceready', _ => {\r\n // Check for permissions, will launch permission request on failure\r\n // NOT SURE IF THIS IS REQUIRED\r\n // permissionsPlugin.hasPermission(notificationPermissions, permissionsCheckSuccess, null)\r\n if (!window.device) {\r\n logger.error('Unable to reach device information')\r\n return\r\n }\r\n\r\n const notifier = window.PushNotification.init({\r\n android: { vibrate: true, sound: true, forceShow: true },\r\n ios: { alert: true, badge: true, sound: true },\r\n windows: { }\r\n })\r\n notifier.on('registration', async (data) => {\r\n logger.debug('Push registrationID changed: ' + data.registrationId)\r\n // Store the registrationId\r\n window.device.registrationId = data.registrationId\r\n // update the user device\r\n const user = Store.get('user')\r\n if (user && window.device && window.device.registrationId) {\r\n const devicesService = api.getService('devices')\r\n const device = await devicesService.update(window.device.registrationId, window.device)\r\n logger.debug(`device ${device.uuid} updated with the id ${device.registrationId}`)\r\n }\r\n })\r\n notifier.on('notification', (data) => {\r\n // data.message,\r\n // data.title,\r\n // data.count,\r\n // data.sound,\r\n // data.image,\r\n // data.additionalData\r\n })\r\n notifier.on('error', (error) => {\r\n logger.error(error)\r\n utils.toast({\r\n message: error.message,\r\n timeout: 10000\r\n })\r\n })\r\n api.on('authenticated', async response => {\r\n const devicesService = api.getService('devices')\r\n // Only possible if registration ID already retrieved\r\n if (window.device && window.device.registrationId) {\r\n const device = await devicesService.update(window.device.registrationId, window.device)\r\n logger.debug(`device ${device.uuid} registered with the id ${device.registrationId}`)\r\n }\r\n })\r\n }, false)\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../core/client/index.js"],"names":["init","utils","mixins","hooks","api","logger","debug","Time","initialize","configure","services","Layout","Filter","Sorter","Search","Store","set","content","mode","undefined","filter","visible","current","widgets","actions","users","getService","on","user","_id","get","patch","Reader","register","readJSON","readCSV","Platform","is","cordova","document","addEventListener","_","window","device","error","notifier","PushNotification","android","vibrate","sound","forceShow","ios","alert","badge","windows","data","registrationId","devicesService","update","uuid","toast","message","timeout","response"],"mappings":";;;;;;;;;AAsBA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAdA;;AAeA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAtBA;;AAuBA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAtBA;;AAuBA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAvBA;;AAwBA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAtBA;;AAuBA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAxBA;;AAyBA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAvBA;;AAwBA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAvBA;;AAwBA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;kBAKwBA,I;;AAvCxB;;;;AACA;;;;AASA;;IAAYC,K;;AACZ;;IAAYC,M;;AACZ;;IAAYC,K;;AACZ;;;;;;;;AAEA;AACA;AACA;;AAEA;AACA;;QAeSF,K,GAAAA,K;QACAC,M,GAAAA,M;QACAC,K,GAAAA,K;AAEM,SAASH,IAAT,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C,6BAAOC,KAAP,CAAc,UAASqC,OAAOgB,IAAK,wBAAuBhB,OAAOa,cAAe,EAAhF;AACD;AACF,OAXD;;AAAA;AAAA;AAAA;AAAA;AAYAX,aAASlB,EAAT,CAAY,cAAZ,EAA6B4B,IAAD,IAAU;AACpC;AACA;AACA;AACA;AACA;AACA;AACD,KAPD;AAQAV,aAASlB,EAAT,CAAY,OAAZ,EAAsBiB,KAAD,IAAW;AAC9BvC,yBAAOuC,KAAP,CAAaA,KAAb;AACA3C,YAAM2D,KAAN,CAAY;AACVC,iBAASjB,MAAMiB,OADL;AAEVC,iBAAS;AAFC,OAAZ;AAID,KAND;AAOA1D,QAAIuB,EAAJ,CAAO,eAAP;AAAA,oCAAwB,WAAMoC,QAAN,EAAkB;AACxC,cAAMN,iBAAiBrD,IAAIsB,UAAJ,CAAe,SAAf,CAAvB;AACA;AACA,YAAIgB,OAAOC,MAAP,IAAiBD,OAAOC,MAAP,CAAca,cAAnC,EAAmD;AACjD,gBAAMb,SAAS,MAAMc,eAAeC,MAAf,CAAsBhB,OAAOC,MAAP,CAAca,cAApC,EAAoDd,OAAOC,MAA3D,CAArB;AACAtC,6BAAOC,KAAP,CAAc,UAASqC,OAAOgB,IAAK,2BAA0BhB,OAAOa,cAAe,EAAnF;AACD;AACF,OAPD;;AAAA;AAAA;AAAA;AAAA;AAQD,GAjDD,EAiDG,KAjDH;AAkDD","file":"index.js","sourcesContent":["import logger from 'loglevel'\r\nimport { Platform } from 'quasar'\r\nimport { Store } from './store'\r\nimport { Layout } from './layout'\r\nimport { Time } from './time'\r\nimport { Reader } from './reader'\r\nimport { Filter } from './filter'\r\nimport { Sorter } from './sorter'\r\nimport { Search } from './search'\r\nimport services from './services'\r\nimport * as utils from './utils'\r\nimport * as mixins from './mixins'\r\nimport * as hooks from './hooks'\r\nimport { readJSON, readCSV } from './readers'\r\n\r\n// We faced a bug in babel so that transform-runtime with export * from 'x' generates import statements in transpiled code\r\n// Tracked here : https://github.com/babel/babel/issues/2877\r\n// We tested the workaround given here https://github.com/babel/babel/issues/2877#issuecomment-270700000 with success so far\r\n\r\n// FIXME: we don't build vue component anymore, they are processed by webpack in the application template\r\n// export * from './components'\r\n\r\nexport * from './events'\r\nexport * from './api'\r\nexport * from './services'\r\nexport * from './store'\r\nexport * from './layout'\r\nexport * from './theme'\r\nexport * from './time'\r\nexport * from './filter'\r\nexport * from './reader'\r\nexport * from './sorter'\r\nexport * from './search'\r\nexport * from './guards'\r\nexport * from '../common'\r\nexport { utils }\r\nexport { mixins }\r\nexport { hooks }\r\n\r\nexport default function init () {\r\n const api = this\r\n\r\n logger.debug('Initializing core')\r\n // Initialize singletons that might be used globally first\r\n Time.initialize()\r\n // Then services\r\n api.configure(services)\r\n // Last, create the models listened by the main layout/pages components\r\n // You must use the patch method on the store to update those models\r\n // It is generally done by activity based componentq or through a local settings service\r\n Layout.initialize()\r\n Filter.initialize(api)\r\n Sorter.initialize()\r\n Search.initialize(api)\r\n Store.set('topPane', { content: null, mode: undefined, filter: {}, visible: false })\r\n Store.set('leftPane', { content: null, mode: undefined, filter: {}, visible: false })\r\n Store.set('rightPane', { content: null, mode: undefined, filter: {}, visible: false })\r\n Store.set('bottomPane', { content: null, mode: undefined, filter: {}, visible: false })\r\n Store.set('page', { content: null, mode: undefined, filter: {} })\r\n Store.set('window', { current: '', widgets: [], filter: {} })\r\n Store.set('fab', { actions: [], filter: {} })\r\n\r\n // Listen to the 'patched' event on the users\r\n const users = api.getService('users')\r\n users.on('patched', user => {\r\n // Check whether we need to update the current user\r\n if (user._id === Store.get('user._id')) {\r\n Store.patch('user', user)\r\n }\r\n })\r\n\r\n // Register default readers\r\n Reader.register('.json', readJSON)\r\n Reader.register('.csv', readCSV)\r\n\r\n // -----------------------------------------------------------------------\r\n // | After this we should only have specific cordova initialisation code |\r\n // -----------------------------------------------------------------------\r\n if (!Platform.is.cordova) return\r\n\r\n /* NOT SURE IF THIS IS REQUIRED\r\n let permissionsPlugin = cordova.plugins.permissions\r\n const notificationPermissions = [\r\n permissionsPlugin.INTERNET,\r\n permissionsPlugin.ACCESS_NETWORK_STATE,\r\n permissionsPlugin.WAKE_LOCK,\r\n permissionsPlugin.VIBRATE\r\n ]\r\n\r\n function permissionsError() {\r\n const message = 'Required permissions for push notifications are missing or have been rejected, the application will not work as expected'\r\n logger.error(message)\r\n utils.toast({\r\n message,\r\n timeout: 10000\r\n })\r\n }\r\n function permissionsCheckSuccess(status) {\r\n // Request again if not given\r\n if (!status.hasPermission) {\r\n permissionsPlugin.requestPermissions(notificationPermissions, status => { if (!status.hasPermission) permissionsError() }, permissionsError)\r\n }\r\n }\r\n */\r\n\r\n document.addEventListener('deviceready', _ => {\r\n // Check for permissions, will launch permission request on failure\r\n // NOT SURE IF THIS IS REQUIRED\r\n // permissionsPlugin.hasPermission(notificationPermissions, permissionsCheckSuccess, null)\r\n if (!window.device) {\r\n logger.error('Unable to reach device information')\r\n return\r\n }\r\n\r\n const notifier = window.PushNotification.init({\r\n android: { vibrate: true, sound: true, forceShow: true },\r\n ios: { alert: true, badge: true, sound: true },\r\n windows: { }\r\n })\r\n notifier.on('registration', async (data) => {\r\n logger.debug('Push registrationID changed: ' + data.registrationId)\r\n // Store the registrationId\r\n window.device.registrationId = data.registrationId\r\n // update the user device\r\n const user = Store.get('user')\r\n if (user && window.device && window.device.registrationId) {\r\n const devicesService = api.getService('devices')\r\n const device = await devicesService.update(window.device.registrationId, window.device)\r\n logger.debug(`device ${device.uuid} updated with the id ${device.registrationId}`)\r\n }\r\n })\r\n notifier.on('notification', (data) => {\r\n // data.message,\r\n // data.title,\r\n // data.count,\r\n // data.sound,\r\n // data.image,\r\n // data.additionalData\r\n })\r\n notifier.on('error', (error) => {\r\n logger.error(error)\r\n utils.toast({\r\n message: error.message,\r\n timeout: 10000\r\n })\r\n })\r\n api.on('authenticated', async response => {\r\n const devicesService = api.getService('devices')\r\n // Only possible if registration ID already retrieved\r\n if (window.device && window.device.registrationId) {\r\n const device = await devicesService.update(window.device.registrationId, window.device)\r\n logger.debug(`device ${device.uuid} registered with the id ${device.registrationId}`)\r\n }\r\n })\r\n }, false)\r\n}\r\n"]}
|
|
@@ -78,8 +78,8 @@ const Layout = exports.Layout = {
|
|
|
78
78
|
const isArray = Array.isArray(content);
|
|
79
79
|
const modes = _lodash2.default.keys(content);
|
|
80
80
|
let filteredContent = content;
|
|
81
|
-
// Recurse ?
|
|
82
81
|
if (!isArray) {
|
|
82
|
+
// Recurse ?
|
|
83
83
|
if (filteredContent.content) {
|
|
84
84
|
filteredContent.content = this.filterContent(filteredContent.content, filter);
|
|
85
85
|
} else {
|
|
@@ -89,6 +89,13 @@ const Layout = exports.Layout = {
|
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
91
|
filteredContent = [filteredContent];
|
|
92
|
+
} else {
|
|
93
|
+
filteredContent.forEach(item => {
|
|
94
|
+
// Recurse ?
|
|
95
|
+
if (item.content) {
|
|
96
|
+
item.content = this.filterContent(item.content, filter);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
92
99
|
}
|
|
93
100
|
// Apply filtering
|
|
94
101
|
filteredContent = filteredContent.filter((0, _sift2.default)(filter));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../core/client/layout.js"],"names":["components","handlers","Layout","initialize","forEach","component","Store","set","content","mode","undefined","filter","visible","getHeader","get","setHeader","patch","setHeaderMode","setHeaderVisible","clearHeader","getFooter","setFooter","setFooterMode","setFooterVisible","clearFooter","validateMode","modes","_","keys","isEmpty","includes","filterContent","isArray","Array","filteredContent","contentForMode","getComponents","context","processedComponents","isVisible","componentName","componentKey","kebabCase","path","basename","uid","push","bindParam","param","startsWith","substring","bindParams","params","isNil","map","mapValues","value","key","generateHandler","name","isNot","args","result","handler","bindHandler","h","reduce","logger","debug","bindProperties","item","i","length","forOwn","bindContent","flatMapDeep","binding","bind","props"],"mappings":";;;;;;;AAAA;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;AACA;;;;AAEA,MAAMA,aAA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AACnC;AACAJ,eAASG,OAAT,CAAiB2D,WAAW,KAAKC,WAAL,CAAiB3D,SAAjB,EAA4B0D,OAA5B,EAAqC1B,OAArC,CAA5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAMuC,UAAUvE,UAAUwE,IAAV,GAAiBxE,UAAUwE,IAA3B,GAAkC,IAAlD;AACA,UAAID,OAAJ,EAAavE,UAAUyE,KAAV,GAAkBnD,iBAAEb,GAAF,CAAMuB,OAAN,EAAeuC,OAAf,CAAlB;AACb;AACA,UAAIvE,UAAUG,OAAd,EAAuB,KAAKkE,WAAL,CAAiBrE,UAAUG,OAA3B,EAAoC6B,OAApC;AACxB,KAbD;AAcA,WAAO7B,OAAP;AACD;AA1LmB,CAAf","file":"layout.js","sourcesContent":["import _ from 'lodash'\r\nimport path from 'path'\r\nimport logger from 'loglevel'\r\nimport sift from 'sift'\r\nimport { uid } from 'quasar'\r\nimport { Store } from './store'\r\n\r\nconst components = ['header', 'footer']\r\nconst handlers = ['handler', 'visible', 'on.listener']\r\n\r\n// Export singleton\r\nexport const Layout = {\r\n initialize () {\r\n components.forEach(component => {\r\n Store.set(component, { content: null, mode: undefined, filter: {}, visible: false })\r\n })\r\n },\r\n getHeader () {\r\n return Store.get(components[0])\r\n },\r\n setHeader (content, mode, filter, visible) {\r\n Store.patch(components[0], { content, mode, filter, visible })\r\n },\r\n setHeaderMode (mode) {\r\n Store.patch(components[0], { mode })\r\n },\r\n setHeaderVisible (visible) {\r\n Store.patch(components[0], { visible })\r\n },\r\n clearHeader () {\r\n Store.patch(components[0], { content: null, mode: undefined, visible: false })\r\n },\r\n getFooter () {\r\n return Store.get(components[1])\r\n },\r\n setFooter (content, mode, filter, visible) {\r\n Store.patch(components[1], { content, mode, filter, visible })\r\n },\r\n setFooterMode (mode) {\r\n Store.patch(components[1], { mode })\r\n },\r\n setFooterVisible (visible) {\r\n Store.patch(components[1], { visible })\r\n },\r\n clearFooter () {\r\n Store.patch(components[1], { content: null, mode: undefined, visible: false })\r\n },\r\n validateMode (content, mode) {\r\n const modes = _.keys(content)\r\n if (_.isEmpty(modes)) return undefined\r\n if (modes.includes(mode)) return mode\r\n return modes[0]\r\n },\r\n filterContent (content, filter) {\r\n // Handle array and object case\r\n const isArray = Array.isArray(content)\r\n const modes = _.keys(content)\r\n let filteredContent = content\r\n // Recurse ?\r\n if (!isArray) {\r\n if (filteredContent.content) {\r\n filteredContent.content = this.filterContent(filteredContent.content, filter)\r\n } else {\r\n modes.forEach(mode => {\r\n const contentForMode = filteredContent[mode]\r\n filteredContent[mode] = this.filterContent(contentForMode, filter)\r\n })\r\n }\r\n filteredContent = [filteredContent]\r\n }\r\n // Apply filtering\r\n filteredContent = filteredContent.filter(sift(filter))\r\n return (isArray ? filteredContent : filteredContent[0])\r\n },\r\n getComponents (content, mode, context) {\r\n let components = []\r\n\r\n // Get component config for given mode if any\r\n if (Array.isArray(content)) {\r\n components = content\r\n } else {\r\n mode = this.validateMode(content, mode)\r\n components = _.get(content, mode)\r\n }\r\n // Apply filtering\r\n // components = this.filterContent(components, filter)\r\n const processedComponents = []\r\n // Then create component objects\r\n _.forEach(components, (component) => {\r\n let isVisible = _.get(component, 'visible', true)\r\n // Can be a functional call\r\n if (typeof isVisible === 'function') {\r\n isVisible = isVisible(context)\r\n }\r\n // If not a functional call the target property can be a reactive one\r\n // so that we \"bind\" it to the component instead of \"filter\" the component here\r\n component.isVisible = isVisible\r\n // Define the component key\r\n const componentName = _.get(component, 'component', 'frame/KAction')\r\n const componentKey = _.kebabCase(path.basename(componentName))\r\n // Clone the component and add the required props\r\n component.componentName = componentName\r\n component.componentKey = componentKey\r\n component.uid = uid()\r\n processedComponents.push(component)\r\n })\r\n return processedComponents\r\n },\r\n bindParam (param, context) {\r\n return (typeof param === 'string') ? (param.startsWith(':') ? _.get(context, param.substring(1)) : param) : param\r\n },\r\n bindParams (params, context) {\r\n // A parameter like :xxx means xxx is a property of the component, not a static value\r\n // In that case remove trailing : and get property value dynamically\r\n if (_.isNil(params)) {\r\n return params\r\n } else if (Array.isArray(params)) {\r\n return params.map(param => this.bindParams(param, context))\r\n } else if (typeof params === 'object') {\r\n return _.mapValues(params, (value, key) => this.bindParams(value, context))\r\n } else {\r\n return this.bindParam(params, context)\r\n }\r\n },\r\n generateHandler (context, name, params) {\r\n // When the handler can be a simple getter, eg is visible use case,\r\n // we allow a property value instead of a function and a logical NOT\r\n const isNot = name.startsWith('!')\r\n if (isNot) name = name.substring(1)\r\n return (...args) => {\r\n let result\r\n const handler = _.get(context, name)\r\n // Function call or property value read ?\r\n if (typeof handler === 'function') {\r\n // Provided parameters or simply forward arguments ?\r\n result = (params ? handler(...this.bindParams(params, context)) : handler(...args))\r\n } else {\r\n result = handler\r\n }\r\n // Logical NOT to be performed ?\r\n return (isNot ? !result : result)\r\n }\r\n },\r\n bindHandler (component, path, context) {\r\n const handler = _.get(component, path)\r\n // Could be an array if multiple handlers to be called\r\n if (Array.isArray(handler)) {\r\n // Process all array elements, manage the case where the handler is simply a function/property name\r\n const handlers = handler.map(h => this.generateHandler(context, h.name || h, h.params))\r\n // In that specific case the result is a boolean AND operation\r\n _.set(component, path, (...args) => handlers.reduce((result, h) => result && h(...args), true))\r\n } else if (handler && typeof handler === 'object') {\r\n // Could be a structure with name and possibly params specified\r\n if (handler.name) {\r\n _.set(component, path, this.generateHandler(context, handler.name, handler.params))\r\n } else {\r\n logger.debug(`Invalid handler binding for ${handler}: you must provide the name to the function to be called`)\r\n }\r\n } else if (typeof handler === 'string') { // Or only name if no params are specified\r\n _.set(component, path, this.generateHandler(context, handler))\r\n }\r\n // Get back processed handler function\r\n return _.get(component, path)\r\n },\r\n bindProperties (item, context) {\r\n if (typeof item === 'string') {\r\n if (item.startsWith(':')) return _.get(context, item.substring(1))\r\n } else if (Array.isArray(item)) {\r\n for (let i = 0; i < item.length; i++) {\r\n item[i] = this.bindProperties(item[i], context)\r\n }\r\n } else if (typeof item === 'object') {\r\n _.forOwn(item, (value, key) => {\r\n // Skip 'reserved' property\r\n if ((key !== 'content') && (key !== 'bind')) item[key] = this.bindProperties(value, context)\r\n })\r\n }\r\n return item\r\n },\r\n // Perform binding between a configuration object and a given context object\r\n bindContent (content, context) {\r\n const components = _.flatMapDeep(content)\r\n _.forEach(components, (component) => {\r\n // Process component handlers\r\n handlers.forEach(handler => this.bindHandler(component, handler, context))\r\n // Then process component props\r\n // FIXME: don't know why but this generic binding function does not seem to work\r\n // It should allow to wrote any property like { label: ':xxx' } and bind it\r\n // to a component property from the context like we do for handler\r\n // this.bindProperties(component, context)\r\n // The only way to make it work is to add props at the root level\r\n const binding = component.bind ? component.bind : null\r\n if (binding) component.props = _.get(context, binding)\r\n // Recursively bind the props/handlers on the sub content object\r\n if (component.content) this.bindContent(component.content, context)\r\n })\r\n return content\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../core/client/layout.js"],"names":["components","handlers","Layout","initialize","forEach","component","Store","set","content","mode","undefined","filter","visible","getHeader","get","setHeader","patch","setHeaderMode","setHeaderVisible","clearHeader","getFooter","setFooter","setFooterMode","setFooterVisible","clearFooter","validateMode","modes","_","keys","isEmpty","includes","filterContent","isArray","Array","filteredContent","contentForMode","item","getComponents","context","processedComponents","isVisible","componentName","componentKey","kebabCase","path","basename","uid","push","bindParam","param","startsWith","substring","bindParams","params","isNil","map","mapValues","value","key","generateHandler","name","isNot","args","result","handler","bindHandler","h","reduce","logger","debug","bindProperties","i","length","forOwn","bindContent","flatMapDeep","binding","bind","props"],"mappings":";;;;;;;AAAA;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;AACA;;;;AAEA,MAAMA,aAAa,CAAC,QAAD,EAAW,QAAX,CAAnB;AACA,MAAMC,WAAW,CAAC,SAAD,EAAY,SAAZ,EAAuB,aAAvB,CAAjB;;AAEA;AACO,MAAMC,0BAAS;AACpBC,eAAc;AACZH,eAAWI,OAAX,CAAmBC,aAAa;AAC9BC,mBAAMC,GAAN,CAAUF,SAAV,EAAqB,EAAEG,SAAS,I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CAAiB4D,WAAW,KAAKC,WAAL,CAAiB5D,SAAjB,EAA4B2D,OAA5B,EAAqC1B,OAArC,CAA5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAMsC,UAAUvE,UAAUwE,IAAV,GAAiBxE,UAAUwE,IAA3B,GAAkC,IAAlD;AACA,UAAID,OAAJ,EAAavE,UAAUyE,KAAV,GAAkBnD,iBAAEb,GAAF,CAAMwB,OAAN,EAAesC,OAAf,CAAlB;AACb;AACA,UAAIvE,UAAUG,OAAd,EAAuB,KAAKkE,WAAL,CAAiBrE,UAAUG,OAA3B,EAAoC8B,OAApC;AACxB,KAbD;AAcA,WAAO9B,OAAP;AACD;AAjMmB,CAAf","file":"layout.js","sourcesContent":["import _ from 'lodash'\r\nimport path from 'path'\r\nimport logger from 'loglevel'\r\nimport sift from 'sift'\r\nimport { uid } from 'quasar'\r\nimport { Store } from './store'\r\n\r\nconst components = ['header', 'footer']\r\nconst handlers = ['handler', 'visible', 'on.listener']\r\n\r\n// Export singleton\r\nexport const Layout = {\r\n initialize () {\r\n components.forEach(component => {\r\n Store.set(component, { content: null, mode: undefined, filter: {}, visible: false })\r\n })\r\n },\r\n getHeader () {\r\n return Store.get(components[0])\r\n },\r\n setHeader (content, mode, filter, visible) {\r\n Store.patch(components[0], { content, mode, filter, visible })\r\n },\r\n setHeaderMode (mode) {\r\n Store.patch(components[0], { mode })\r\n },\r\n setHeaderVisible (visible) {\r\n Store.patch(components[0], { visible })\r\n },\r\n clearHeader () {\r\n Store.patch(components[0], { content: null, mode: undefined, visible: false })\r\n },\r\n getFooter () {\r\n return Store.get(components[1])\r\n },\r\n setFooter (content, mode, filter, visible) {\r\n Store.patch(components[1], { content, mode, filter, visible })\r\n },\r\n setFooterMode (mode) {\r\n Store.patch(components[1], { mode })\r\n },\r\n setFooterVisible (visible) {\r\n Store.patch(components[1], { visible })\r\n },\r\n clearFooter () {\r\n Store.patch(components[1], { content: null, mode: undefined, visible: false })\r\n },\r\n validateMode (content, mode) {\r\n const modes = _.keys(content)\r\n if (_.isEmpty(modes)) return undefined\r\n if (modes.includes(mode)) return mode\r\n return modes[0]\r\n },\r\n filterContent (content, filter) {\r\n // Handle array and object case\r\n const isArray = Array.isArray(content)\r\n const modes = _.keys(content)\r\n let filteredContent = content\r\n if (!isArray) {\r\n // Recurse ?\r\n if (filteredContent.content) {\r\n filteredContent.content = this.filterContent(filteredContent.content, filter)\r\n } else {\r\n modes.forEach(mode => {\r\n const contentForMode = filteredContent[mode]\r\n filteredContent[mode] = this.filterContent(contentForMode, filter)\r\n })\r\n }\r\n filteredContent = [filteredContent]\r\n } else {\r\n filteredContent.forEach(item => {\r\n // Recurse ?\r\n if (item.content) {\r\n item.content = this.filterContent(item.content, filter)\r\n }\r\n })\r\n }\r\n // Apply filtering\r\n filteredContent = filteredContent.filter(sift(filter))\r\n return (isArray ? filteredContent : filteredContent[0])\r\n },\r\n getComponents (content, mode, context) {\r\n let components = []\r\n\r\n // Get component config for given mode if any\r\n if (Array.isArray(content)) {\r\n components = content\r\n } else {\r\n mode = this.validateMode(content, mode)\r\n components = _.get(content, mode)\r\n }\r\n // Apply filtering\r\n // components = this.filterContent(components, filter)\r\n const processedComponents = []\r\n // Then create component objects\r\n _.forEach(components, (component) => {\r\n let isVisible = _.get(component, 'visible', true)\r\n // Can be a functional call\r\n if (typeof isVisible === 'function') {\r\n isVisible = isVisible(context)\r\n }\r\n // If not a functional call the target property can be a reactive one\r\n // so that we \"bind\" it to the component instead of \"filter\" the component here\r\n component.isVisible = isVisible\r\n // Define the component key\r\n const componentName = _.get(component, 'component', 'frame/KAction')\r\n const componentKey = _.kebabCase(path.basename(componentName))\r\n // Clone the component and add the required props\r\n component.componentName = componentName\r\n component.componentKey = componentKey\r\n component.uid = uid()\r\n processedComponents.push(component)\r\n })\r\n return processedComponents\r\n },\r\n bindParam (param, context) {\r\n return (typeof param === 'string') ? (param.startsWith(':') ? _.get(context, param.substring(1)) : param) : param\r\n },\r\n bindParams (params, context) {\r\n // A parameter like :xxx means xxx is a property of the component, not a static value\r\n // In that case remove trailing : and get property value dynamically\r\n if (_.isNil(params)) {\r\n return params\r\n } else if (Array.isArray(params)) {\r\n return params.map(param => this.bindParams(param, context))\r\n } else if (typeof params === 'object') {\r\n return _.mapValues(params, (value, key) => this.bindParams(value, context))\r\n } else {\r\n return this.bindParam(params, context)\r\n }\r\n },\r\n generateHandler (context, name, params) {\r\n // When the handler can be a simple getter, eg is visible use case,\r\n // we allow a property value instead of a function and a logical NOT\r\n const isNot = name.startsWith('!')\r\n if (isNot) name = name.substring(1)\r\n return (...args) => {\r\n let result\r\n const handler = _.get(context, name)\r\n // Function call or property value read ?\r\n if (typeof handler === 'function') {\r\n // Provided parameters or simply forward arguments ?\r\n result = (params ? handler(...this.bindParams(params, context)) : handler(...args))\r\n } else {\r\n result = handler\r\n }\r\n // Logical NOT to be performed ?\r\n return (isNot ? !result : result)\r\n }\r\n },\r\n bindHandler (component, path, context) {\r\n const handler = _.get(component, path)\r\n // Could be an array if multiple handlers to be called\r\n if (Array.isArray(handler)) {\r\n // Process all array elements, manage the case where the handler is simply a function/property name\r\n const handlers = handler.map(h => this.generateHandler(context, h.name || h, h.params))\r\n // In that specific case the result is a boolean AND operation\r\n _.set(component, path, (...args) => handlers.reduce((result, h) => result && h(...args), true))\r\n } else if (handler && typeof handler === 'object') {\r\n // Could be a structure with name and possibly params specified\r\n if (handler.name) {\r\n _.set(component, path, this.generateHandler(context, handler.name, handler.params))\r\n } else {\r\n logger.debug(`Invalid handler binding for ${handler}: you must provide the name to the function to be called`)\r\n }\r\n } else if (typeof handler === 'string') { // Or only name if no params are specified\r\n _.set(component, path, this.generateHandler(context, handler))\r\n }\r\n // Get back processed handler function\r\n return _.get(component, path)\r\n },\r\n bindProperties (item, context) {\r\n if (typeof item === 'string') {\r\n if (item.startsWith(':')) return _.get(context, item.substring(1))\r\n } else if (Array.isArray(item)) {\r\n for (let i = 0; i < item.length; i++) {\r\n item[i] = this.bindProperties(item[i], context)\r\n }\r\n } else if (typeof item === 'object') {\r\n _.forOwn(item, (value, key) => {\r\n // Skip 'reserved' property\r\n if ((key !== 'content') && (key !== 'bind')) item[key] = this.bindProperties(value, context)\r\n })\r\n }\r\n return item\r\n },\r\n // Perform binding between a configuration object and a given context object\r\n bindContent (content, context) {\r\n const components = _.flatMapDeep(content)\r\n _.forEach(components, (component) => {\r\n // Process component handlers\r\n handlers.forEach(handler => this.bindHandler(component, handler, context))\r\n // Then process component props\r\n // FIXME: don't know why but this generic binding function does not seem to work\r\n // It should allow to wrote any property like { label: ':xxx' } and bind it\r\n // to a component property from the context like we do for handler\r\n // this.bindProperties(component, context)\r\n // The only way to make it work is to add props at the root level\r\n const binding = component.bind ? component.bind : null\r\n if (binding) component.props = _.get(context, binding)\r\n // Recursively bind the props/handlers on the sub content object\r\n if (component.content) this.bindContent(component.content, context)\r\n })\r\n return content\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Reader = undefined;
|
|
7
|
+
|
|
8
|
+
var _path = require('path');
|
|
9
|
+
|
|
10
|
+
var _path2 = _interopRequireDefault(_path);
|
|
11
|
+
|
|
12
|
+
var _i18next = require('i18next');
|
|
13
|
+
|
|
14
|
+
var _i18next2 = _interopRequireDefault(_i18next);
|
|
15
|
+
|
|
16
|
+
var _events = require('./events');
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
|
|
20
|
+
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
|
|
21
|
+
|
|
22
|
+
// Export singleton
|
|
23
|
+
const Reader = exports.Reader = {
|
|
24
|
+
readers: {},
|
|
25
|
+
register(mimeType, reader) {
|
|
26
|
+
this.readers[mimeType] = reader;
|
|
27
|
+
},
|
|
28
|
+
read(file, options) {
|
|
29
|
+
var _this = this;
|
|
30
|
+
|
|
31
|
+
return _asyncToGenerator(function* () {
|
|
32
|
+
const fileExtension = _path2.default.extname(file.name);
|
|
33
|
+
const reader = _this.readers[fileExtension];
|
|
34
|
+
if (reader) {
|
|
35
|
+
try {
|
|
36
|
+
const content = yield reader(file, options);
|
|
37
|
+
return content;
|
|
38
|
+
} catch (error) {
|
|
39
|
+
_events.Events.$emit('error', error);
|
|
40
|
+
throw error;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const error = {
|
|
44
|
+
message: _i18next2.default.t('errors.UNSUPPORTED_FILE_FORMAT', { file: file.name })
|
|
45
|
+
};
|
|
46
|
+
_events.Events.$emit('error', error);
|
|
47
|
+
throw new Error(error);
|
|
48
|
+
})();
|
|
49
|
+
},
|
|
50
|
+
getSupportedFormats() {
|
|
51
|
+
return Object.keys(this.readers);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=reader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../core/client/reader.js"],"names":["Reader","readers","register","mimeType","reader","read","file","options","fileExtension","path","extname","name","content","error","Events","$emit","message","i18next","t","Error","getSupportedFormats","Object","keys"],"mappings":";;;;;;;AAAA;;;;AACA;;;;AACA;;;;;;AAEA;AACO,MAAMA,0BAAS;AACpBC,WAAS,EADW;AAEpBC,WAAUC,QAAV,EAAoBC,MAApB,EAA4B;AAC1B,SAAKH,OAAL,CAAaE,QAAb,IAAyBC,MAAzB;AACD,GAJmB;AAKdC,MAAN,CAAYC,IAAZ,EAAkBC,OAAlB,EAA2B;AAAA;;AAAA;AACzB,YAAMC,gBAAgBC,eAAKC,OAAL,CAAaJ,KAAKK,IAAlB,CAAtB;AACA,YAAMP,SAAS,MAAKH,OAAL,CAAaO,aAAb,CAAf;AACA,UAAIJ,MAAJ,EAAY;AACV,YAAI;AACF,gBAAMQ,UAAU,MAAMR,OAAOE,IAAP,EAAaC,OAAb,CAAtB;AACA,iBAAOK,OAAP;AACD,SAHD,CAGE,OAAOC,KAAP,EAAc;AACdC,yBAAOC,KAAP,CAAa,OAAb,EAAsBF,KAAtB;AACA,gBAAMA,KAAN;AACD;AACF;AACD,YAAMA,QAAQ;AACZG,iBAASC,kBAAQC,CAAR,CAAU,gCAAV,EAA4C,EAAEZ,MAAMA,KAAKK,IAAb,EAA5C;AADG,OAAd;AAGAG,qBAAOC,KAAP,CAAa,OAAb,EAAsBF,KAAtB;AACA,YAAM,IAAIM,KAAJ,CAAUN,KAAV,CAAN;AAhByB;AAiB1B,GAtBmB;AAuBpBO,wBAAuB;AACrB,WAAOC,OAAOC,IAAP,CAAY,KAAKrB,OAAjB,CAAP;AACD;AAzBmB,CAAf","file":"reader.js","sourcesContent":["import path from 'path'\r\nimport i18next from 'i18next'\r\nimport { Events } from './events'\r\n\r\n// Export singleton\r\nexport const Reader = {\r\n readers: {},\r\n register (mimeType, reader) {\r\n this.readers[mimeType] = reader\r\n },\r\n async read (file, options) {\r\n const fileExtension = path.extname(file.name)\r\n const reader = this.readers[fileExtension]\r\n if (reader) {\r\n try {\r\n const content = await reader(file, options)\r\n return content\r\n } catch (error) {\r\n Events.$emit('error', error)\r\n throw error\r\n }\r\n }\r\n const error = {\r\n message: i18next.t('errors.UNSUPPORTED_FILE_FORMAT', { file: file.name })\r\n }\r\n Events.$emit('error', error)\r\n throw new Error(error)\r\n },\r\n getSupportedFormats () {\r\n return Object.keys(this.readers)\r\n }\r\n}\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _reader = require('./reader.json');
|
|
8
|
+
|
|
9
|
+
Object.keys(_reader).forEach(function (key) {
|
|
10
|
+
if (key === "default" || key === "__esModule") return;
|
|
11
|
+
Object.defineProperty(exports, key, {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () {
|
|
14
|
+
return _reader[key];
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
var _reader2 = require('./reader.csv');
|
|
20
|
+
|
|
21
|
+
Object.keys(_reader2).forEach(function (key) {
|
|
22
|
+
if (key === "default" || key === "__esModule") return;
|
|
23
|
+
Object.defineProperty(exports, key, {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function () {
|
|
26
|
+
return _reader2[key];
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../core/client/readers/index.js"],"names":[],"mappings":";;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","file":"index.js","sourcesContent":["export * from './reader.json'\r\nexport * from './reader.csv'\r\n"]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.readCSV = readCSV;
|
|
7
|
+
|
|
8
|
+
var _loglevel = require('loglevel');
|
|
9
|
+
|
|
10
|
+
var _loglevel2 = _interopRequireDefault(_loglevel);
|
|
11
|
+
|
|
12
|
+
var _i18next = require('i18next');
|
|
13
|
+
|
|
14
|
+
var _i18next2 = _interopRequireDefault(_i18next);
|
|
15
|
+
|
|
16
|
+
var _papaparse = require('papaparse');
|
|
17
|
+
|
|
18
|
+
var _papaparse2 = _interopRequireDefault(_papaparse);
|
|
19
|
+
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
+
|
|
22
|
+
function readCSV(file, options) {
|
|
23
|
+
return new Promise((resolve, reject) => {
|
|
24
|
+
const reader = new FileReader();
|
|
25
|
+
reader.onloadend = () => {
|
|
26
|
+
let content = reader.result;
|
|
27
|
+
const papaParseOptions = Object.assign({ skipEmptyLines: true }, options);
|
|
28
|
+
content = _papaparse2.default.parse(content, papaParseOptions);
|
|
29
|
+
if (content.errors.length > 0) {
|
|
30
|
+
_loglevel2.default.debug(content.errors);
|
|
31
|
+
reject(new Error(_i18next2.default.t('errors.INVALID_CSV_FILE', { file: file.name }), { errors: content.errors }));
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
resolve(content);
|
|
35
|
+
};
|
|
36
|
+
reader.onerror = error => {
|
|
37
|
+
_loglevel2.default.debug(error);
|
|
38
|
+
reject(new Error(_i18next2.default.t('errors.CANNOT_READ_FILE', { file: file.name }), { errors: error }));
|
|
39
|
+
};
|
|
40
|
+
reader.readAsText(file);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=reader.csv.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../core/client/readers/reader.csv.js"],"names":["readCSV","file","options","Promise","resolve","reject","reader","FileReader","onloadend","content","result","papaParseOptions","Object","assign","skipEmptyLines","Papa","parse","errors","length","logger","debug","Error","i18next","t","name","onerror","error","readAsText"],"mappings":";;;;;QAIgBA,O,GAAAA,O;;AAJhB;;;;AACA;;;;AACA;;;;;;AAEO,SAASA,OAAT,CAAkBC,IAAlB,EAAwBC,OAAxB,EAAiC;AACtC,SAAO,IAAIC,OAAJ,CAAY,CAACC,OAAD,EAAUC,MAAV,KAAqB;AACtC,UAAMC,SAAS,IAAIC,UAAJ,EAAf;AACAD,WAAOE,SAAP,GAAmB,MAAM;AACvB,UAAIC,UAAUH,OAAOI,MAArB;AACA,YAAMC,mBAAmBC,OAAOC,MAAP,CAAc,EAAEC,gBAAgB,IAAlB,EAAd,EAAwCZ,OAAxC,CAAzB;AACAO,gBAAUM,oBAAKC,KAAL,CAAWP,OAAX,EAAoBE,gBAApB,CAAV;AACA,UAAIF,QAAQQ,MAAR,CAAeC,MAAf,GAAwB,CAA5B,EAA+B;AAC7BC,2BAAOC,KAAP,CAAaX,QAAQQ,MAArB;AACAZ,eAAO,IAAIgB,KAAJ,CAAUC,kBAAQC,CAAR,CAAU,yBAAV,EAAqC,EAAEtB,MAAMA,KAAKuB,IAAb,EAArC,CAAV,EAAqE,EAAEP,QAAQR,QAAQQ,MAAlB,EAArE,CAAP;AACA;AACD;AACDb,cAAQK,OAAR;AACD,KAVD;AAWAH,WAAOmB,OAAP,GAAkBC,KAAD,IAAW;AAC1BP,yBAAOC,KAAP,CAAaM,KAAb;AACArB,aAAO,IAAIgB,KAAJ,CAAUC,kBAAQC,CAAR,CAAU,yBAAV,EAAqC,EAAEtB,MAAMA,KAAKuB,IAAb,EAArC,CAAV,EAAqE,EAAEP,QAAQS,KAAV,EAArE,CAAP;AACD,KAHD;AAIApB,WAAOqB,UAAP,CAAkB1B,IAAlB;AACD,GAlBM,CAAP;AAmBD","file":"reader.csv.js","sourcesContent":["import logger from 'loglevel'\r\nimport i18next from 'i18next'\r\nimport Papa from 'papaparse'\r\n\r\nexport function readCSV (file, options) {\r\n return new Promise((resolve, reject) => {\r\n const reader = new FileReader()\r\n reader.onloadend = () => {\r\n let content = reader.result\r\n const papaParseOptions = Object.assign({ skipEmptyLines: true }, options)\r\n content = Papa.parse(content, papaParseOptions)\r\n if (content.errors.length > 0) {\r\n logger.debug(content.errors)\r\n reject(new Error(i18next.t('errors.INVALID_CSV_FILE', { file: file.name }), { errors: content.errors }))\r\n return\r\n }\r\n resolve(content)\r\n }\r\n reader.onerror = (error) => {\r\n logger.debug(error)\r\n reject(new Error(i18next.t('errors.CANNOT_READ_FILE', { file: file.name }), { errors: error }))\n }\r\n reader.readAsText(file)\r\n })\r\n}\r\n"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.readJSON = readJSON;
|
|
7
|
+
|
|
8
|
+
var _loglevel = require('loglevel');
|
|
9
|
+
|
|
10
|
+
var _loglevel2 = _interopRequireDefault(_loglevel);
|
|
11
|
+
|
|
12
|
+
var _i18next = require('i18next');
|
|
13
|
+
|
|
14
|
+
var _i18next2 = _interopRequireDefault(_i18next);
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
function readJSON(file, options) {
|
|
19
|
+
return new Promise((resolve, reject) => {
|
|
20
|
+
const reader = new FileReader();
|
|
21
|
+
reader.onloadend = () => {
|
|
22
|
+
let content = reader.result;
|
|
23
|
+
try {
|
|
24
|
+
content = JSON.parse(content);
|
|
25
|
+
} catch (error) {
|
|
26
|
+
_loglevel2.default.debug(error);
|
|
27
|
+
reject(new Error(_i18next2.default.t('errors.INVALID_JSON_FILE', { file }), { errors: error }));
|
|
28
|
+
}
|
|
29
|
+
resolve(content);
|
|
30
|
+
};
|
|
31
|
+
reader.onerror = error => {
|
|
32
|
+
_loglevel2.default.debug(error);
|
|
33
|
+
reject(new Error(_i18next2.default.t('errors.CANNOT_READ_FILE', { file }), { errors: error }));
|
|
34
|
+
};
|
|
35
|
+
reader.readAsText(file);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=reader.json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../core/client/readers/reader.json.js"],"names":["readJSON","file","options","Promise","resolve","reject","reader","FileReader","onloadend","content","result","JSON","parse","error","logger","debug","Error","i18next","t","errors","onerror","readAsText"],"mappings":";;;;;QAGgBA,Q,GAAAA,Q;;AAHhB;;;;AACA;;;;;;AAEO,SAASA,QAAT,CAAmBC,IAAnB,EAAyBC,OAAzB,EAAkC;AACvC,SAAO,IAAIC,OAAJ,CAAY,CAACC,OAAD,EAAUC,MAAV,KAAqB;AACtC,UAAMC,SAAS,IAAIC,UAAJ,EAAf;AACAD,WAAOE,SAAP,GAAmB,MAAM;AACvB,UAAIC,UAAUH,OAAOI,MAArB;AACA,UAAI;AACFD,kBAAUE,KAAKC,KAAL,CAAWH,OAAX,CAAV;AACD,OAFD,CAEE,OAAOI,KAAP,EAAc;AACdC,2BAAOC,KAAP,CAAaF,KAAb;AACAR,eAAO,IAAIW,KAAJ,CAAUC,kBAAQC,CAAR,CAAU,0BAAV,EAAsC,EAAEjB,IAAF,EAAtC,CAAV,EAA2D,EAAEkB,QAAQN,KAAV,EAA3D,CAAP;AACD;AACDT,cAAQK,OAAR;AACD,KATD;AAUAH,WAAOc,OAAP,GAAkBP,KAAD,IAAW;AAC1BC,yBAAOC,KAAP,CAAaF,KAAb;AACAR,aAAO,IAAIW,KAAJ,CAAUC,kBAAQC,CAAR,CAAU,yBAAV,EAAqC,EAAEjB,IAAF,EAArC,CAAV,EAA0D,EAAEkB,QAAQN,KAAV,EAA1D,CAAP;AACD,KAHD;AAIAP,WAAOe,UAAP,CAAkBpB,IAAlB;AACD,GAjBM,CAAP;AAkBD","file":"reader.json.js","sourcesContent":["import logger from 'loglevel'\r\nimport i18next from 'i18next'\r\n\r\nexport function readJSON (file, options) {\r\n return new Promise((resolve, reject) => {\r\n const reader = new FileReader()\r\n reader.onloadend = () => {\r\n let content = reader.result\r\n try {\r\n content = JSON.parse(content)\r\n } catch (error) {\r\n logger.debug(error)\r\n reject(new Error(i18next.t('errors.INVALID_JSON_FILE', { file }), { errors: error }))\r\n }\r\n resolve(content)\r\n }\r\n reader.onerror = (error) => {\r\n logger.debug(error)\r\n reject(new Error(i18next.t('errors.CANNOT_READ_FILE', { file }), { errors: error }))\r\n }\r\n reader.readAsText(file)\r\n })\r\n}\r\n"]}
|
|
@@ -38,6 +38,7 @@ let aggregateFeaturesQuery = exports.aggregateFeaturesQuery = (() => {
|
|
|
38
38
|
} else {
|
|
39
39
|
Object.assign(groupBy, {
|
|
40
40
|
time: { $push: '$time' }, // Keep track of all times
|
|
41
|
+
runTime: { $push: '$runTime' }, // Keep track of all run times
|
|
41
42
|
type: { $last: '$type' }, // type is assumed similar for all results, keep last
|
|
42
43
|
properties: { $last: '$properties' // non-aggregated properties are assumed similar for all results, keep last
|
|
43
44
|
} });
|
|
@@ -73,8 +74,8 @@ let aggregateFeaturesQuery = exports.aggregateFeaturesQuery = (() => {
|
|
|
73
74
|
}
|
|
74
75
|
// Find matching features only
|
|
75
76
|
pipeline.push({ $match: Object.assign({ [prefix + element]: { $exists: true } }, match) });
|
|
76
|
-
// Ensure they are ordered by increasing time by default
|
|
77
|
-
pipeline.push({ $sort:
|
|
77
|
+
// Ensure they are ordered by increasing time by default and most recent forecast first
|
|
78
|
+
pipeline.push({ $sort: Object.assign({ time: 1, runTime: -1 }, query.$sort) });
|
|
78
79
|
// Keep track of all feature values
|
|
79
80
|
if (singleTime) {
|
|
80
81
|
pipeline.push({ $group: groupBy });
|
|
@@ -93,6 +94,7 @@ let aggregateFeaturesQuery = exports.aggregateFeaturesQuery = (() => {
|
|
|
93
94
|
// Rearrange data so that we get ordered arrays indexed by element
|
|
94
95
|
elementResults.forEach(function (result) {
|
|
95
96
|
result.time = { [element]: result.time };
|
|
97
|
+
if (result.runTime) result.runTime = { [element]: result.runTime };
|
|
96
98
|
if (!singleTime && !isGeometry) {
|
|
97
99
|
// Set back the element values as properties because we aggregated in an accumulator
|
|
98
100
|
// to avoid conflict with non-aggregated feature properties
|
|
@@ -114,6 +116,9 @@ let aggregateFeaturesQuery = exports.aggregateFeaturesQuery = (() => {
|
|
|
114
116
|
// Merge with previous matching feature if any
|
|
115
117
|
if (previousResult) {
|
|
116
118
|
Object.assign(previousResult.time, result.time);
|
|
119
|
+
if (result.runTime) {
|
|
120
|
+
if (previousResult.runTime) Object.assign(previousResult.runTime, result.runTime);else previousResult.runTime = { [element]: result.runTime };
|
|
121
|
+
}
|
|
117
122
|
_lodash2.default.set(previousResult, prefix + element, _lodash2.default.get(result, prefix + element));
|
|
118
123
|
} else {
|
|
119
124
|
aggregatedResults.push(result);
|