@kalisio/kdk 2.0.1 → 2.1.1
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/.codeclimate.yml +0 -1
- package/.travis.test.sh +3 -0
- package/core/api/application.js +13 -9
- package/core/api/db.js +34 -30
- package/core/api/hooks/hooks.authentication.js +11 -0
- package/core/api/hooks/hooks.authorisations.js +7 -3
- package/core/api/hooks/hooks.model.js +32 -43
- package/core/api/hooks/hooks.organisations.js +26 -116
- package/core/api/hooks/hooks.push.js +56 -0
- package/core/api/hooks/hooks.query.js +0 -5
- package/core/api/hooks/hooks.schemas.js +23 -3
- package/core/api/hooks/hooks.users.js +15 -22
- package/core/api/hooks/index.js +1 -4
- package/core/api/services/account/account.hooks.js +3 -3
- package/core/api/services/account/account.service.js +6 -7
- package/core/api/services/groups/groups.hooks.js +2 -4
- package/core/api/services/index.js +11 -16
- package/core/api/services/{devices/devices.hooks.js → push/push.hooks.js} +5 -5
- package/core/api/services/push/push.service.js +12 -0
- package/core/api/services/tags/tags.hooks.js +6 -20
- package/core/api/services/users/users.hooks.js +12 -13
- package/core/api/utils.js +11 -0
- package/core/client/api.js +6 -0
- package/core/client/capabilities.js +8 -12
- package/core/client/components/KAction.vue +10 -3
- package/core/client/components/KAvatar.vue +31 -35
- package/core/client/components/KChipsPane.vue +23 -0
- package/core/client/components/account/KAccount.vue +68 -0
- package/core/client/components/account/KDeleteAccountManager.vue +62 -0
- package/core/client/components/account/KEmailManager.vue +128 -0
- package/core/client/components/account/KPasswordManager.vue +90 -0
- package/core/client/components/account/KProfile.vue +109 -0
- package/core/client/components/account/KResetPassword.vue +100 -111
- package/core/client/components/account/KSendResetPassword.vue +71 -87
- package/core/client/components/account/KSubscription.vue +71 -0
- package/core/client/components/account/KSubscriptionsManager.vue +46 -0
- package/core/client/components/account/KVerifyEmailManager.vue +105 -0
- package/core/client/components/account/index.js +4 -2
- package/core/client/components/app/KAbout.vue +27 -14
- package/core/client/components/app/KPlatform.vue +2 -2
- package/core/client/components/app/KWelcome.vue +71 -45
- package/core/client/components/collection/KBoard.vue +50 -40
- package/core/client/components/collection/KCard.vue +16 -7
- package/core/client/components/collection/KColumn.vue +146 -111
- package/core/client/components/collection/KGrid.vue +77 -58
- package/core/client/components/collection/KHistory.vue +19 -3
- package/core/client/components/collection/KItem.vue +5 -1
- package/core/client/components/collection/KList.vue +80 -56
- package/core/client/components/collection/KTable.vue +181 -142
- package/core/client/components/editor/KEditor.vue +10 -3
- package/core/client/components/form/KFileField.vue +22 -8
- package/core/client/components/form/KForm.vue +27 -14
- package/core/client/components/form/KItemField.vue +2 -2
- package/core/client/components/form/KOptionsField.vue +11 -2
- package/core/client/components/form/KSelectField.vue +12 -3
- package/core/client/components/form/KTextField.vue +6 -0
- package/core/client/components/form/KTokenField.vue +80 -0
- package/core/client/components/layout/KOpener.vue +8 -8
- package/core/client/components/layout/KPage.vue +8 -4
- package/core/client/components/layout/KWindow.vue +172 -141
- package/core/client/components/media/KMediaBrowser.vue +28 -12
- package/core/client/components/media/KShape.vue +58 -56
- package/core/client/components/menu/KMenu.vue +22 -13
- package/core/client/components/menu/KRadialFab.vue +83 -56
- package/core/client/components/menu/KRadialFabItem.vue +39 -19
- package/core/client/components/screen/KLoginScreen.vue +0 -17
- package/core/client/components/screen/KScreen.vue +3 -3
- package/core/client/components/screen/KScreenFooter.vue +0 -3
- package/core/client/components/team/KAddMember.vue +1 -1
- package/core/client/components/team/KAddTag.vue +121 -0
- package/core/client/components/team/KMemberCard.vue +42 -13
- package/core/client/components/team/KMembersActivity.vue +9 -3
- package/core/client/components/team/KTagCard.vue +16 -1
- package/core/client/composables/collection.js +181 -0
- package/core/client/composables/index.js +2 -0
- package/core/client/composables/pwa.js +71 -0
- package/core/client/composables/session.js +6 -9
- package/core/client/composables/version.js +1 -22
- package/core/client/i18n/core_en.json +124 -153
- package/core/client/i18n/core_fr.json +124 -155
- package/core/client/index.js +37 -110
- package/core/client/layout.js +37 -14
- package/core/client/local-storage.js +4 -3
- package/core/client/mixins/mixin.account.js +9 -5
- package/core/client/mixins/mixin.base-editor.js +19 -3
- package/core/client/mixins/mixin.base-item.js +3 -3
- package/core/client/mixins/mixin.base-viewer.js +14 -0
- package/core/client/mixins/mixin.object-proxy.js +2 -21
- package/core/client/services/index.js +0 -1
- package/core/client/storage.js +19 -16
- package/core/client/theme.js +11 -5
- package/core/client/utils/index.js +5 -13
- package/core/client/utils/utils.account.js +47 -0
- package/core/client/utils/utils.colors.js +6 -2
- package/core/client/utils/utils.content.js +7 -5
- package/core/client/utils/utils.platform.js +1 -20
- package/core/client/utils/utils.push.js +53 -0
- package/core/client/utils/utils.pwa.js +63 -0
- package/core/client/utils/utils.session.js +27 -12
- package/core/common/permissions.js +12 -4
- package/core/common/schemas/tags.create.json +35 -0
- package/core/common/schemas/users.update-profile.json +1 -1
- package/coverage/base.css +224 -0
- package/coverage/block-navigation.js +87 -0
- package/coverage/core/api/application.js.html +1849 -0
- package/coverage/core/api/authentication.js.html +694 -0
- package/coverage/core/api/db.js.html +763 -0
- package/coverage/core/api/hooks/hooks.account.js.html +169 -0
- package/coverage/core/api/hooks/hooks.authentication.js.html +274 -0
- package/coverage/core/api/hooks/hooks.authorisations.js.html +1213 -0
- package/coverage/core/api/hooks/hooks.groups.js.html +229 -0
- package/coverage/core/api/hooks/hooks.logger.js.html +163 -0
- package/coverage/core/api/hooks/hooks.model.js.html +994 -0
- package/coverage/core/api/hooks/hooks.organisations.js.html +553 -0
- package/coverage/core/api/hooks/hooks.push.js.html +232 -0
- package/coverage/core/api/hooks/hooks.query.js.html +838 -0
- package/coverage/core/api/hooks/hooks.schemas.js.html +304 -0
- package/coverage/core/api/hooks/hooks.service.js.html +319 -0
- package/coverage/core/api/hooks/hooks.storage.js.html +193 -0
- package/coverage/core/api/hooks/hooks.tags.js.html +850 -0
- package/coverage/core/api/hooks/hooks.users.js.html +826 -0
- package/coverage/core/api/hooks/index.html +296 -0
- package/coverage/core/api/hooks/index.js.html +121 -0
- package/coverage/core/api/index.html +191 -0
- package/coverage/core/api/index.js.html +148 -0
- package/coverage/core/api/marshall.js.html +355 -0
- package/coverage/core/api/models/groups.model.mongodb.js.html +109 -0
- package/coverage/core/api/models/index.html +161 -0
- package/coverage/core/api/models/organisations.model.mongodb.js.html +94 -0
- package/coverage/core/api/models/tags.model.mongodb.js.html +115 -0
- package/coverage/core/api/models/users.model.mongodb.js.html +115 -0
- package/coverage/core/api/services/account/account.hooks.js.html +196 -0
- package/coverage/core/api/services/account/account.service.js.html +445 -0
- package/coverage/core/api/services/account/index.html +131 -0
- package/coverage/core/api/services/authorisations/authorisations.hooks.js.html +184 -0
- package/coverage/core/api/services/authorisations/authorisations.service.js.html +502 -0
- package/coverage/core/api/services/authorisations/index.html +131 -0
- package/coverage/core/api/services/databases/databases.hooks.js.html +193 -0
- package/coverage/core/api/services/databases/databases.service.js.html +100 -0
- package/coverage/core/api/services/databases/index.html +131 -0
- package/coverage/core/api/services/groups/groups.hooks.js.html +178 -0
- package/coverage/core/api/services/groups/index.html +116 -0
- package/coverage/core/api/services/index.html +116 -0
- package/coverage/core/api/services/index.js.html +475 -0
- package/coverage/core/api/services/mailer/index.html +131 -0
- package/coverage/core/api/services/mailer/mailer.hooks.js.html +190 -0
- package/coverage/core/api/services/mailer/mailer.service.js.html +118 -0
- package/coverage/core/api/services/organisations/index.html +131 -0
- package/coverage/core/api/services/organisations/organisations.hooks.js.html +178 -0
- package/coverage/core/api/services/organisations/organisations.service.js.html +343 -0
- package/coverage/core/api/services/push/index.html +131 -0
- package/coverage/core/api/services/push/push.hooks.js.html +193 -0
- package/coverage/core/api/services/push/push.service.js.html +121 -0
- package/coverage/core/api/services/storage/index.html +131 -0
- package/coverage/core/api/services/storage/storage.hooks.js.html +190 -0
- package/coverage/core/api/services/storage/storage.service.js.html +172 -0
- package/coverage/core/api/services/tags/index.html +116 -0
- package/coverage/core/api/services/tags/tags.hooks.js.html +178 -0
- package/coverage/core/api/services/users/index.html +116 -0
- package/coverage/core/api/services/users/users.hooks.js.html +313 -0
- package/coverage/core/api/utils.js.html +118 -0
- package/coverage/core/common/errors.js.html +88 -0
- package/coverage/core/common/index.html +176 -0
- package/coverage/core/common/index.js.html +115 -0
- package/coverage/core/common/permissions.js.html +1039 -0
- package/coverage/core/common/schema.js.html +190 -0
- package/coverage/core/common/utils.js.html +220 -0
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +476 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/core/api/application.js.html +1849 -0
- package/coverage/lcov-report/core/api/authentication.js.html +694 -0
- package/coverage/lcov-report/core/api/db.js.html +763 -0
- package/coverage/lcov-report/core/api/hooks/hooks.account.js.html +169 -0
- package/coverage/lcov-report/core/api/hooks/hooks.authentication.js.html +274 -0
- package/coverage/lcov-report/core/api/hooks/hooks.authorisations.js.html +1213 -0
- package/coverage/lcov-report/core/api/hooks/hooks.groups.js.html +229 -0
- package/coverage/lcov-report/core/api/hooks/hooks.logger.js.html +163 -0
- package/coverage/lcov-report/core/api/hooks/hooks.model.js.html +994 -0
- package/coverage/lcov-report/core/api/hooks/hooks.organisations.js.html +553 -0
- package/coverage/lcov-report/core/api/hooks/hooks.push.js.html +232 -0
- package/coverage/lcov-report/core/api/hooks/hooks.query.js.html +838 -0
- package/coverage/lcov-report/core/api/hooks/hooks.schemas.js.html +304 -0
- package/coverage/lcov-report/core/api/hooks/hooks.service.js.html +319 -0
- package/coverage/lcov-report/core/api/hooks/hooks.storage.js.html +193 -0
- package/coverage/lcov-report/core/api/hooks/hooks.tags.js.html +850 -0
- package/coverage/lcov-report/core/api/hooks/hooks.users.js.html +826 -0
- package/coverage/lcov-report/core/api/hooks/index.html +296 -0
- package/coverage/lcov-report/core/api/hooks/index.js.html +121 -0
- package/coverage/lcov-report/core/api/index.html +191 -0
- package/coverage/lcov-report/core/api/index.js.html +148 -0
- package/coverage/lcov-report/core/api/marshall.js.html +355 -0
- package/coverage/lcov-report/core/api/models/groups.model.mongodb.js.html +109 -0
- package/coverage/lcov-report/core/api/models/index.html +161 -0
- package/coverage/lcov-report/core/api/models/organisations.model.mongodb.js.html +94 -0
- package/coverage/lcov-report/core/api/models/tags.model.mongodb.js.html +115 -0
- package/coverage/lcov-report/core/api/models/users.model.mongodb.js.html +115 -0
- package/coverage/lcov-report/core/api/services/account/account.hooks.js.html +196 -0
- package/coverage/lcov-report/core/api/services/account/account.service.js.html +445 -0
- package/coverage/lcov-report/core/api/services/account/index.html +131 -0
- package/coverage/lcov-report/core/api/services/authorisations/authorisations.hooks.js.html +184 -0
- package/coverage/lcov-report/core/api/services/authorisations/authorisations.service.js.html +502 -0
- package/coverage/lcov-report/core/api/services/authorisations/index.html +131 -0
- package/coverage/lcov-report/core/api/services/databases/databases.hooks.js.html +193 -0
- package/coverage/lcov-report/core/api/services/databases/databases.service.js.html +100 -0
- package/coverage/lcov-report/core/api/services/databases/index.html +131 -0
- package/coverage/lcov-report/core/api/services/groups/groups.hooks.js.html +178 -0
- package/coverage/lcov-report/core/api/services/groups/index.html +116 -0
- package/coverage/lcov-report/core/api/services/index.html +116 -0
- package/coverage/lcov-report/core/api/services/index.js.html +475 -0
- package/coverage/lcov-report/core/api/services/mailer/index.html +131 -0
- package/coverage/lcov-report/core/api/services/mailer/mailer.hooks.js.html +190 -0
- package/coverage/lcov-report/core/api/services/mailer/mailer.service.js.html +118 -0
- package/coverage/lcov-report/core/api/services/organisations/index.html +131 -0
- package/coverage/lcov-report/core/api/services/organisations/organisations.hooks.js.html +178 -0
- package/coverage/lcov-report/core/api/services/organisations/organisations.service.js.html +343 -0
- package/coverage/lcov-report/core/api/services/push/index.html +131 -0
- package/coverage/lcov-report/core/api/services/push/push.hooks.js.html +193 -0
- package/coverage/lcov-report/core/api/services/push/push.service.js.html +121 -0
- package/coverage/lcov-report/core/api/services/storage/index.html +131 -0
- package/coverage/lcov-report/core/api/services/storage/storage.hooks.js.html +190 -0
- package/coverage/lcov-report/core/api/services/storage/storage.service.js.html +172 -0
- package/coverage/lcov-report/core/api/services/tags/index.html +116 -0
- package/coverage/lcov-report/core/api/services/tags/tags.hooks.js.html +178 -0
- package/coverage/lcov-report/core/api/services/users/index.html +116 -0
- package/coverage/lcov-report/core/api/services/users/users.hooks.js.html +313 -0
- package/coverage/lcov-report/core/api/utils.js.html +118 -0
- package/coverage/lcov-report/core/common/errors.js.html +88 -0
- package/coverage/lcov-report/core/common/index.html +176 -0
- package/coverage/lcov-report/core/common/index.js.html +115 -0
- package/coverage/lcov-report/core/common/permissions.js.html +1039 -0
- package/coverage/lcov-report/core/common/schema.js.html +190 -0
- package/coverage/lcov-report/core/common/utils.js.html +220 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +476 -0
- package/coverage/lcov-report/map/api/hooks/hooks.catalog.js.html +340 -0
- package/coverage/lcov-report/map/api/hooks/hooks.features.js.html +337 -0
- package/coverage/lcov-report/map/api/hooks/hooks.query.js.html +1168 -0
- package/coverage/lcov-report/map/api/hooks/index.html +161 -0
- package/coverage/lcov-report/map/api/hooks/index.js.html +94 -0
- package/coverage/lcov-report/map/api/index.html +131 -0
- package/coverage/lcov-report/map/api/index.js.html +139 -0
- package/coverage/lcov-report/map/api/marshall.js.html +178 -0
- package/coverage/lcov-report/map/api/models/alerts.model.mongodb.js.html +106 -0
- package/coverage/lcov-report/map/api/models/catalog.model.mongodb.js.html +127 -0
- package/coverage/lcov-report/map/api/models/features.model.mongodb.js.html +196 -0
- package/coverage/lcov-report/map/api/models/index.html +146 -0
- package/coverage/lcov-report/map/api/services/alerts/alerts.hooks.js.html +274 -0
- package/coverage/lcov-report/map/api/services/alerts/alerts.service.js.html +610 -0
- package/coverage/lcov-report/map/api/services/alerts/index.html +131 -0
- package/coverage/lcov-report/map/api/services/catalog/catalog.hooks.js.html +313 -0
- package/coverage/lcov-report/map/api/services/catalog/index.html +116 -0
- package/coverage/lcov-report/map/api/services/daptiles/daptiles.service.js.html +1510 -0
- package/coverage/lcov-report/map/api/services/daptiles/index.html +116 -0
- package/coverage/lcov-report/map/api/services/features/features.hooks.js.html +205 -0
- package/coverage/lcov-report/map/api/services/features/features.service.js.html +241 -0
- package/coverage/lcov-report/map/api/services/features/index.html +131 -0
- package/coverage/lcov-report/map/api/services/geocoder/geocoder.hooks.js.html +178 -0
- package/coverage/lcov-report/map/api/services/geocoder/geocoder.service.js.html +322 -0
- package/coverage/lcov-report/map/api/services/geocoder/index.html +131 -0
- package/coverage/lcov-report/map/api/services/index.html +116 -0
- package/coverage/lcov-report/map/api/services/index.js.html +769 -0
- package/coverage/lcov-report/map/common/dynamic-grid-source.js.html +466 -0
- package/coverage/lcov-report/map/common/errors.js.html +94 -0
- package/coverage/lcov-report/map/common/geotiff-grid-source.js.html +535 -0
- package/coverage/lcov-report/map/common/grid.js.html +1612 -0
- package/coverage/lcov-report/map/common/index.html +371 -0
- package/coverage/lcov-report/map/common/index.js.html +172 -0
- package/coverage/lcov-report/map/common/meteo-model-grid-source.js.html +556 -0
- package/coverage/lcov-report/map/common/moment-utils.js.html +157 -0
- package/coverage/lcov-report/map/common/opendap-grid-source.js.html +868 -0
- package/coverage/lcov-report/map/common/opendap-utils.js.html +826 -0
- package/coverage/lcov-report/map/common/permissions.js.html +118 -0
- package/coverage/lcov-report/map/common/time-based-grid-source.js.html +418 -0
- package/coverage/lcov-report/map/common/tms-utils.js.html +274 -0
- package/coverage/lcov-report/map/common/wcs-grid-source.js.html +364 -0
- package/coverage/lcov-report/map/common/wcs-utils.js.html +586 -0
- package/coverage/lcov-report/map/common/weacast-grid-source.js.html +1033 -0
- package/coverage/lcov-report/map/common/wfs-utils.js.html +574 -0
- package/coverage/lcov-report/map/common/wms-utils.js.html +436 -0
- package/coverage/lcov-report/map/common/wmts-utils.js.html +547 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +196 -0
- package/coverage/lcov.info +10742 -0
- package/coverage/map/api/hooks/hooks.catalog.js.html +340 -0
- package/coverage/map/api/hooks/hooks.features.js.html +337 -0
- package/coverage/map/api/hooks/hooks.query.js.html +1168 -0
- package/coverage/map/api/hooks/index.html +161 -0
- package/coverage/map/api/hooks/index.js.html +94 -0
- package/coverage/map/api/index.html +131 -0
- package/coverage/map/api/index.js.html +139 -0
- package/coverage/map/api/marshall.js.html +178 -0
- package/coverage/map/api/models/alerts.model.mongodb.js.html +106 -0
- package/coverage/map/api/models/catalog.model.mongodb.js.html +127 -0
- package/coverage/map/api/models/features.model.mongodb.js.html +196 -0
- package/coverage/map/api/models/index.html +146 -0
- package/coverage/map/api/services/alerts/alerts.hooks.js.html +274 -0
- package/coverage/map/api/services/alerts/alerts.service.js.html +610 -0
- package/coverage/map/api/services/alerts/index.html +131 -0
- package/coverage/map/api/services/catalog/catalog.hooks.js.html +313 -0
- package/coverage/map/api/services/catalog/index.html +116 -0
- package/coverage/map/api/services/daptiles/daptiles.service.js.html +1510 -0
- package/coverage/map/api/services/daptiles/index.html +116 -0
- package/coverage/map/api/services/features/features.hooks.js.html +205 -0
- package/coverage/map/api/services/features/features.service.js.html +241 -0
- package/coverage/map/api/services/features/index.html +131 -0
- package/coverage/map/api/services/geocoder/geocoder.hooks.js.html +178 -0
- package/coverage/map/api/services/geocoder/geocoder.service.js.html +322 -0
- package/coverage/map/api/services/geocoder/index.html +131 -0
- package/coverage/map/api/services/index.html +116 -0
- package/coverage/map/api/services/index.js.html +769 -0
- package/coverage/map/common/dynamic-grid-source.js.html +466 -0
- package/coverage/map/common/errors.js.html +94 -0
- package/coverage/map/common/geotiff-grid-source.js.html +535 -0
- package/coverage/map/common/grid.js.html +1612 -0
- package/coverage/map/common/index.html +371 -0
- package/coverage/map/common/index.js.html +172 -0
- package/coverage/map/common/meteo-model-grid-source.js.html +556 -0
- package/coverage/map/common/moment-utils.js.html +157 -0
- package/coverage/map/common/opendap-grid-source.js.html +868 -0
- package/coverage/map/common/opendap-utils.js.html +826 -0
- package/coverage/map/common/permissions.js.html +118 -0
- package/coverage/map/common/time-based-grid-source.js.html +418 -0
- package/coverage/map/common/tms-utils.js.html +274 -0
- package/coverage/map/common/wcs-grid-source.js.html +364 -0
- package/coverage/map/common/wcs-utils.js.html +586 -0
- package/coverage/map/common/weacast-grid-source.js.html +1033 -0
- package/coverage/map/common/wfs-utils.js.html +574 -0
- package/coverage/map/common/wms-utils.js.html +436 -0
- package/coverage/map/common/wmts-utils.js.html +547 -0
- package/coverage/prettify.css +1 -0
- package/coverage/prettify.js +2 -0
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +196 -0
- package/coverage/tmp/coverage-59096-1692631696256-0.json +1 -0
- package/coverage/tmp/coverage-59108-1692631696233-0.json +1 -0
- package/coverage/tmp/coverage-59119-1692631696222-0.json +1 -0
- package/coverage/tmp/coverage-59131-1692631696200-0.json +1 -0
- package/coverage/tmp/coverage-59138-1692631696175-0.json +1 -0
- package/extras/css/core.variables.scss +5 -1
- package/extras/tours/core/account-profile.js +14 -31
- package/extras/tours/core/account.js +143 -0
- package/extras/tours/core/add-member.js +7 -6
- package/extras/tours/core/add-tag.js +13 -0
- package/extras/tours/core/create-tag.js +26 -0
- package/extras/tours/core/edit-member-role.js +13 -0
- package/extras/tours/core/join-group.js +0 -12
- package/extras/tours/core/login.js +0 -7
- package/extras/tours/core/members.js +13 -26
- package/extras/tours/core/send-reset-password.js +1 -1
- package/extras/tours/core/tags.js +17 -4
- package/extras/tours/map/navigation-bar.js +1 -1
- package/extras/tours/map/side-nav.js +3 -2
- package/map/api/hooks/hooks.query.js +5 -3
- package/map/client/cesium/utils.js +68 -0
- package/map/client/components/KFeatureActionButton.vue +27 -27
- package/map/client/components/KFeaturesChart.vue +1 -1
- package/map/client/components/KFeaturesTable.vue +2 -2
- package/map/client/components/KLayerEditionToolbar.vue +1 -0
- package/map/client/components/KPositionIndicator.vue +1 -1
- package/map/client/components/catalog/KViewSelector.vue +1 -2
- package/map/client/components/catalog/KViewsPanel.vue +17 -15
- package/map/client/components/form/KDirectionField.vue +0 -1
- package/map/client/components/form/KLocationField.vue +16 -29
- package/map/client/components/legend/KSymbolsLegend.vue +2 -1
- package/map/client/components/location/KLocationCardSection.vue +61 -0
- package/map/client/components/location/KLocationMap.vue +24 -13
- package/map/client/components/location/KLocationSearch.vue +144 -0
- package/map/client/components/location/KLocationTip.vue +29 -0
- package/map/client/components/tools/KGeolocateTool.vue +46 -0
- package/map/client/components/tools/KSearchTool.vue +93 -0
- package/map/client/components/widget/KElevationProfile.vue +2 -2
- package/map/client/components/widget/KInformationBox.vue +3 -3
- package/map/client/composables/location.js +35 -43
- package/map/client/geolocation.js +65 -8
- package/map/client/i18n/map_en.json +15 -13
- package/map/client/i18n/map_fr.json +15 -13
- package/map/client/init.js +10 -18
- package/map/client/leaflet/GradientPath.js +2 -1
- package/map/client/leaflet/utils.js +61 -0
- package/map/client/mixins/globe/mixin.base-globe.js +6 -5
- package/map/client/mixins/globe/mixin.popup.js +3 -0
- package/map/client/mixins/globe/mixin.style.js +9 -64
- package/map/client/mixins/globe/mixin.tooltip.js +3 -0
- package/map/client/mixins/index.js +0 -1
- package/map/client/mixins/map/mixin.base-map.js +13 -9
- package/map/client/mixins/map/mixin.edit-layers.js +82 -15
- package/map/client/mixins/map/mixin.geojson-layers.js +8 -1
- package/map/client/mixins/map/mixin.style.js +8 -56
- package/map/client/mixins/mixin.activity.js +20 -12
- package/map/client/mixins/mixin.feature-service.js +34 -1
- package/map/client/readers/reader.geojson.js +1 -1
- package/map/client/utils/utils.location.js +45 -0
- package/package.json +13 -14
- package/test/api/core/account.test.js +162 -153
- package/test/api/core/config/default.cjs +7 -11
- package/test/api/core/config/email-templates/confirmInvitation/html.ejs +1 -1
- package/test/api/core/config/email-templates/identityChange/html.ejs +6 -4
- package/test/api/core/config/email-templates/newDevice/html.ejs +1 -1
- package/test/api/core/config/email-templates/newSubscription/html.ejs +7 -0
- package/test/api/core/config/email-templates/passwordChange/html.ejs +1 -1
- package/test/api/core/config/email-templates/resendVerifySignup/html.ejs +6 -4
- package/test/api/core/config/email-templates/resetPwd/html.ejs +1 -1
- package/test/api/core/config/email-templates/sendResetPwd/html.ejs +8 -4
- package/test/api/core/hooks.test.js +166 -18
- package/test/api/core/index.test.js +32 -70
- package/test/api/core/push.test.js +197 -0
- package/test/api/core/team.test.js +38 -32
- package/test/api/core/test-log-2023-07-04.log +0 -0
- package/test/api/core/test-log-2023-07-10.log +2 -0
- package/test/api/core/test-log-2023-07-12.log +0 -0
- package/test/api/core/test-log-2023-07-18.log +78 -0
- package/test/api/core/test-log-2023-07-19.log +44 -0
- package/test/api/core/test-log-2023-08-01.log +162 -0
- package/test/api/core/test-log-2023-08-21.log +66 -0
- package/test/api/core/test-log-2023-08-22.log +96 -0
- package/test/api/core/test-log-2023-08-23.log +22 -0
- package/test/api/core/test-log-2023-09-20.log +22 -0
- package/test/api/core/test-log-2023-09-21.log +105 -0
- package/test/api/core/utils.js +11 -2
- package/test/api/map/alerts.test.js +1 -1
- package/test/api/map/test-log-2023-07-18.log +62 -0
- package/test/api/map/test-log-2023-07-19.log +13 -0
- package/test/api/map/test-log-2023-08-21.log +65 -0
- package/test/api/map/test-log-2023-09-20.log +60 -0
- package/test/api/map/test-log-2023-09-21.log +12 -0
- package/test/client/core/account.js +15 -32
- package/test/client/core/api.js +99 -44
- package/test/client/core/layout.js +4 -0
- package/test/client/core/runner.js +66 -14
- package/test/client/core/time.js +1 -1
- package/test/client/map/controls.js +17 -3
- package/core/api/hooks/hooks.account.js +0 -28
- package/core/api/hooks/hooks.devices.js +0 -42
- package/core/api/hooks/hooks.pusher.js +0 -215
- package/core/api/hooks/hooks.tags.js +0 -255
- package/core/api/services/devices/devices.service.js +0 -99
- package/core/api/services/pusher/pusher.channels.js +0 -3
- package/core/api/services/pusher/pusher.hooks.js +0 -36
- package/core/api/services/pusher/pusher.service.js +0 -449
- package/core/client/components/KInstallApp.vue +0 -43
- package/core/client/components/account/KAccountActivity.vue +0 -58
- package/core/client/components/account/KAccountDZ.vue +0 -66
- package/core/client/components/account/KAccountDevices.vue +0 -56
- package/core/client/components/account/KAccountSecurity.vue +0 -87
- package/core/client/components/account/KChangeIdentity.vue +0 -102
- package/core/client/components/account/KChangePassword.vue +0 -132
- package/core/client/components/account/KDeviceCard.vue +0 -75
- package/core/client/components/account/KIdentityPanel.vue +0 -34
- package/core/client/components/account/KResendVerifySignup.vue +0 -108
- package/core/client/components/account/KSendChangeIdentity.vue +0 -115
- package/core/client/components/account/KSignupAlert.vue +0 -63
- package/core/client/components/account/KVerifySignup.vue +0 -102
- package/core/client/components/form/KTagField.vue +0 -148
- package/core/common/schemas/members.update.json +0 -18
- package/extras/tours/core/account-dz.js +0 -37
- package/extras/tours/core/account-security.js +0 -52
- package/extras/tours/core/change-password.js +0 -34
- package/extras/tours/core/edit-member-tags.js +0 -18
- package/extras/tours/core/send-change-identity.js +0 -28
- package/map/client/components/KLocateUser.vue +0 -36
- package/map/client/components/KLocationInput.vue +0 -217
- package/map/client/components/KLocationMap.vue +0 -301
- package/map/client/components/KSearchLocation.vue +0 -88
- package/map/client/components/input/KPlaceChooser.vue +0 -78
- package/map/client/components/location/KLocation.vue +0 -24
- package/map/client/mixins/mixin.navigator.js +0 -36
- package/test/api/core/notifications.test.js +0 -502
|
@@ -4,12 +4,14 @@
|
|
|
4
4
|
:header="header"
|
|
5
5
|
:actions="itemActions"
|
|
6
6
|
:bind-actions="false"
|
|
7
|
-
:dense="dense"
|
|
7
|
+
:dense="dense"
|
|
8
|
+
:options="{ nameField: 'profile.name', descriptionField: 'profile.description' }">
|
|
8
9
|
<!--
|
|
9
|
-
Card
|
|
10
|
+
Card avatar
|
|
10
11
|
-->
|
|
11
12
|
<template v-slot:card-avatar>
|
|
12
|
-
<KAvatar :
|
|
13
|
+
<KAvatar :subject="item" size="3.2rem"
|
|
14
|
+
:options="{ nameField: 'profile.name', avatarField: 'profile.avatar' }"/>
|
|
13
15
|
</template>
|
|
14
16
|
<!--
|
|
15
17
|
Card descriptions
|
|
@@ -29,8 +31,8 @@
|
|
|
29
31
|
:actions="tagsActions"
|
|
30
32
|
:context="$props"
|
|
31
33
|
:dense="dense">
|
|
32
|
-
<div v-if="hasTags">
|
|
33
|
-
<KChipsPane id="tags-pane" class="q-pa-sm" :chips="tags" />
|
|
34
|
+
<div v-if="hasTags" id="tags-section">
|
|
35
|
+
<KChipsPane id="tags-pane" class="q-pa-sm" :remove="true" @chip-removed="onRemoveTag" :chips="tags" />
|
|
34
36
|
</div>
|
|
35
37
|
<div v-else>
|
|
36
38
|
{{ $t('KMemberCard.NO_TAGS_LABEL')}}
|
|
@@ -43,7 +45,7 @@
|
|
|
43
45
|
:context="$props"
|
|
44
46
|
:dense="dense"
|
|
45
47
|
>
|
|
46
|
-
<div v-if="hasGroups" class="row justify-start items-center">
|
|
48
|
+
<div v-if="hasGroups" id="groups-section" class="row justify-start items-center">
|
|
47
49
|
<template v-for="(group, index) in groups" :key="groupKey(group)">
|
|
48
50
|
<q-btn :id="groupButtonId(group)" flat small round color="primary">
|
|
49
51
|
<q-avatar color="primary" text-color="white" size="2rem">{{ groupInitials(group) }}</q-avatar>
|
|
@@ -102,8 +104,15 @@ export default {
|
|
|
102
104
|
computed: {
|
|
103
105
|
header () {
|
|
104
106
|
const components = _.filter(this.itemActions, { scope: 'header' })
|
|
105
|
-
|
|
107
|
+
const roleLabel = this.roleLabel(this.role)
|
|
108
|
+
// It appears that due to reactivity role might not be available anymore when removing a member
|
|
109
|
+
components.splice(0, 0, {
|
|
110
|
+
id: 'role-badge', component: 'QBadge', label: (roleLabel ? this.$t(roleLabel) : ''), color: 'grey-7'
|
|
111
|
+
}, { component: 'QSpace' })
|
|
106
112
|
return components
|
|
113
|
+
},
|
|
114
|
+
avatar () {
|
|
115
|
+
|
|
107
116
|
},
|
|
108
117
|
role () {
|
|
109
118
|
const role = getRoleForOrganisation(this.item, this.contextId)
|
|
@@ -118,7 +127,7 @@ export default {
|
|
|
118
127
|
},
|
|
119
128
|
tags () {
|
|
120
129
|
// Check for custom tags field
|
|
121
|
-
let tags =
|
|
130
|
+
let tags = _.get(this.item, this.options.tagsField || 'tags', [])
|
|
122
131
|
// Filter tags from current context
|
|
123
132
|
tags = _.filter(tags, { context: this.$store.get('context._id') })
|
|
124
133
|
// Then process icons
|
|
@@ -147,8 +156,8 @@ export default {
|
|
|
147
156
|
methods: {
|
|
148
157
|
resendInvitation () {
|
|
149
158
|
Dialog.create({
|
|
150
|
-
title: this.$t('KMemberCard.RESEND_INVITATION_DIALOG_TITLE', { member: this.item.name }),
|
|
151
|
-
message: this.$t('KMemberCard.RESEND_INVITATION_DIALOG_MESSAGE', { member: this.item.name }),
|
|
159
|
+
title: this.$t('KMemberCard.RESEND_INVITATION_DIALOG_TITLE', { member: _.get(this.item, 'profile.name') }),
|
|
160
|
+
message: this.$t('KMemberCard.RESEND_INVITATION_DIALOG_MESSAGE', { member: _.get(this.item, 'profile.name') }),
|
|
152
161
|
html: true,
|
|
153
162
|
prompt: {
|
|
154
163
|
model: this.item.email,
|
|
@@ -182,8 +191,8 @@ export default {
|
|
|
182
191
|
},
|
|
183
192
|
removeMember () {
|
|
184
193
|
Dialog.create({
|
|
185
|
-
title: this.$t('KMemberCard.REMOVE_DIALOG_TITLE', { member: this.item.name }),
|
|
186
|
-
message: this.$t('KMemberCard.REMOVE_DIALOG_MESSAGE', { member: this.item.name }),
|
|
194
|
+
title: this.$t('KMemberCard.REMOVE_DIALOG_TITLE', { member: _.get(this.item, 'profile.name') }),
|
|
195
|
+
message: this.$t('KMemberCard.REMOVE_DIALOG_MESSAGE', { member: _.get(this.item, 'profile.name') }),
|
|
187
196
|
html: true,
|
|
188
197
|
ok: {
|
|
189
198
|
label: this.$t('OK'),
|
|
@@ -205,6 +214,26 @@ export default {
|
|
|
205
214
|
})
|
|
206
215
|
})
|
|
207
216
|
},
|
|
217
|
+
onRemoveTag (removedTag) {
|
|
218
|
+
Dialog.create({
|
|
219
|
+
title: this.$t('KMemberCard.REMOVE_TAG_DIALOG_TITLE', { tag: removedTag.value }),
|
|
220
|
+
message: this.$t('KMemberCard.REMOVE_TAG_DIALOG_MESSAGE', { tag: removedTag.value, member: _.get(this.item, 'profile.name') }),
|
|
221
|
+
html: true,
|
|
222
|
+
ok: {
|
|
223
|
+
label: this.$t('OK'),
|
|
224
|
+
flat: true
|
|
225
|
+
},
|
|
226
|
+
cancel: {
|
|
227
|
+
label: this.$t('CANCEL'),
|
|
228
|
+
flat: true
|
|
229
|
+
}
|
|
230
|
+
}).onOk(() => {
|
|
231
|
+
const membersService = this.$api.getService('members', this.contextId)
|
|
232
|
+
const tags = _.get(this.item, this.options.tagsField || 'tags', [])
|
|
233
|
+
_.remove(tags, tag => tag._id === removedTag._id)
|
|
234
|
+
membersService.patch(this.item._id, { tags })
|
|
235
|
+
})
|
|
236
|
+
},
|
|
208
237
|
groupKey (group) {
|
|
209
238
|
return this.item._id + group._id
|
|
210
239
|
},
|
|
@@ -267,7 +296,7 @@ export default {
|
|
|
267
296
|
onLeaveGroup (group) {
|
|
268
297
|
Dialog.create({
|
|
269
298
|
title: this.$t('KMemberCard.LEAVE_GROUP_DIALOG_TITLE', { group: group.name }),
|
|
270
|
-
message: this.$t('KMemberCard.LEAVE_GROUP_DIALOG_MESSAGE', { group: group.name, member: this.item.name }),
|
|
299
|
+
message: this.$t('KMemberCard.LEAVE_GROUP_DIALOG_MESSAGE', { group: group.name, member: _.get(this.item, 'profile.name') }),
|
|
271
300
|
html: true,
|
|
272
301
|
ok: {
|
|
273
302
|
label: this.$t('OK'),
|
|
@@ -96,13 +96,16 @@ export default {
|
|
|
96
96
|
// Remove previous listener if any
|
|
97
97
|
this.unsubscribeUsers()
|
|
98
98
|
const usersService = this.$api.getService('users')
|
|
99
|
-
|
|
99
|
+
// Members service is only a filter on users but it will not trigger
|
|
100
|
+
// any remove operation when adding/removing permissions,
|
|
101
|
+
// thus it will not update the member list automatically
|
|
102
|
+
usersService.on('patched', this.refresh)
|
|
100
103
|
},
|
|
101
104
|
unsubscribeUsers () {
|
|
102
105
|
const usersService = this.$api.getService('users')
|
|
103
|
-
usersService.off('patched', this.
|
|
106
|
+
usersService.off('patched', this.refresh)
|
|
104
107
|
},
|
|
105
|
-
|
|
108
|
+
refresh (user) {
|
|
106
109
|
const grid = this.$refs.membersGrid
|
|
107
110
|
if (grid) {
|
|
108
111
|
const member = _.find(grid.items, { _id: user._id })
|
|
@@ -110,6 +113,9 @@ export default {
|
|
|
110
113
|
// If the user has a role in this organisation and
|
|
111
114
|
// was not in our list he might have been added so refresh
|
|
112
115
|
if (role && !member) this.$refs.membersGrid.refreshCollection()
|
|
116
|
+
// If the user has not a role in this organisation and
|
|
117
|
+
// was in our list he might have been removed so refresh
|
|
118
|
+
else if (!role && member) this.$refs.membersGrid.refreshCollection()
|
|
113
119
|
}
|
|
114
120
|
}
|
|
115
121
|
},
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
<KAction
|
|
15
15
|
id="list-members"
|
|
16
16
|
icon="las la-user-friends"
|
|
17
|
-
:label="$t('KTagCard.MEMBERS_LABEL', { count:
|
|
17
|
+
:label="$t('KTagCard.MEMBERS_LABEL', { count: membersCount })"
|
|
18
18
|
:tooltip="$t('KTagCard.VIEW_MEMBERS_LABEL')"
|
|
19
19
|
@triggered="onListMembers"
|
|
20
20
|
/>
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
<script>
|
|
27
27
|
import { baseItem } from '../../mixins'
|
|
28
|
+
import { countMembersWithTag } from '../../../common/permissions'
|
|
28
29
|
import { KCard, KCardSection } from '../collection'
|
|
29
30
|
import KAction from '../KAction.vue'
|
|
30
31
|
|
|
@@ -36,12 +37,22 @@ export default {
|
|
|
36
37
|
KAction
|
|
37
38
|
},
|
|
38
39
|
mixins: [baseItem],
|
|
40
|
+
data () {
|
|
41
|
+
return {
|
|
42
|
+
membersCount: 0
|
|
43
|
+
}
|
|
44
|
+
},
|
|
39
45
|
computed: {
|
|
40
46
|
dense () {
|
|
41
47
|
return this.$q.screen.lt.sm
|
|
42
48
|
}
|
|
43
49
|
},
|
|
44
50
|
methods: {
|
|
51
|
+
async refreshStats () {
|
|
52
|
+
const membersService = this.$api.getService('members', this.contextId)
|
|
53
|
+
const members = await countMembersWithTag(membersService, this.item._id)
|
|
54
|
+
this.membersCount = members.total
|
|
55
|
+
},
|
|
45
56
|
onListMembers () {
|
|
46
57
|
// Setup filter accordingly
|
|
47
58
|
this.$store.patch('filter', {
|
|
@@ -52,6 +63,10 @@ export default {
|
|
|
52
63
|
})
|
|
53
64
|
this.$router.push({ name: 'members-activity', params: { contextId: this.contextId, mode: 'filter' } })
|
|
54
65
|
}
|
|
66
|
+
},
|
|
67
|
+
created () {
|
|
68
|
+
// Compute the count of members having the tag
|
|
69
|
+
this.refreshStats()
|
|
55
70
|
}
|
|
56
71
|
}
|
|
57
72
|
</script>
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import _ from 'lodash'
|
|
2
|
+
import logger from 'loglevel'
|
|
3
|
+
import { ref, computed, watch, onBeforeMount, onBeforeUnmount } from 'vue'
|
|
4
|
+
import { api } from '../api.js'
|
|
5
|
+
import { getLocale } from '../utils/utils.locale.js'
|
|
6
|
+
|
|
7
|
+
export function useCollection (options) {
|
|
8
|
+
_.defaults(options, {
|
|
9
|
+
// This value can be overriden in activities if they want to manage pagination by themselves
|
|
10
|
+
// nbItemsPerPage = 0 means that the client does not handle pagination and server defaults will be used
|
|
11
|
+
nbItemsPerPage: ref(12),
|
|
12
|
+
// This value indicate if items of each page replace or are appended to previous ones
|
|
13
|
+
appendItems: ref(false),
|
|
14
|
+
// Only invoke refresh at most once per every refreshThrottle milliseconds
|
|
15
|
+
refreshThrottle: ref(500),
|
|
16
|
+
// Refresh strategy to be used
|
|
17
|
+
listStrategy: ref('smart'),
|
|
18
|
+
// Item processor to be used
|
|
19
|
+
processor: ref()
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
// Data
|
|
23
|
+
const items = ref([])
|
|
24
|
+
const nbTotalItems = ref(0)
|
|
25
|
+
const currentPage = ref(1)
|
|
26
|
+
let itemListener = null
|
|
27
|
+
|
|
28
|
+
// Computed
|
|
29
|
+
const nbPages = computed(() => {
|
|
30
|
+
return options.nbItemsPerPage.value > 0
|
|
31
|
+
? Math.ceil(nbTotalItems.value / options.nbItemsPerPage.value)
|
|
32
|
+
: 1
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
// Functions
|
|
36
|
+
function getService () {
|
|
37
|
+
const service = api.getService(options.service.value, options.contextId ? options.contextId.value : null)
|
|
38
|
+
if (!service) {
|
|
39
|
+
throw new Error('Cannot retrieve target service ' + options.service.value)
|
|
40
|
+
}
|
|
41
|
+
return service
|
|
42
|
+
}
|
|
43
|
+
function getCollectionBaseQuery () {
|
|
44
|
+
// This method should be overriden in collections
|
|
45
|
+
return options.baseQuery ? options.baseQuery.value : {}
|
|
46
|
+
}
|
|
47
|
+
function getCollectionFilterQuery () {
|
|
48
|
+
// This method should be overriden in collections
|
|
49
|
+
return options.filterQuery ? options.filterQuery.value : {}
|
|
50
|
+
}
|
|
51
|
+
function getCollectionPaginationQuery () {
|
|
52
|
+
// This method should be overriden in collections
|
|
53
|
+
return (options.nbItemsPerPage.value > 0
|
|
54
|
+
? {
|
|
55
|
+
$limit: options.nbItemsPerPage.value,
|
|
56
|
+
$skip: (currentPage.value - 1) * options.nbItemsPerPage.value
|
|
57
|
+
}
|
|
58
|
+
: {})
|
|
59
|
+
}
|
|
60
|
+
function setCollectionItems (newItems) {
|
|
61
|
+
// Item processor defined ?
|
|
62
|
+
if (typeof options.processor.value === 'function') {
|
|
63
|
+
newItems = options.processor.value(newItems)
|
|
64
|
+
}
|
|
65
|
+
items.value = newItems
|
|
66
|
+
}
|
|
67
|
+
function subscribe (query) {
|
|
68
|
+
// Remove previous listener if any
|
|
69
|
+
unsubscribe()
|
|
70
|
+
itemListener = getService().watch({ listStrategy: options.listStrategy.value })
|
|
71
|
+
.find({ query })
|
|
72
|
+
.subscribe(response => {
|
|
73
|
+
// Manage GeoJson features collection as well
|
|
74
|
+
if (response.type === 'FeatureCollection') {
|
|
75
|
+
setCollectionItems(response.features)
|
|
76
|
+
} else if (options.appendItems.value) {
|
|
77
|
+
// Append the response ensuring there is no duplicates
|
|
78
|
+
setCollectionItems(_.unionBy(response.data, items.value, '_id'))
|
|
79
|
+
// We keep order from the updated list as depending on the sorting criteria a new item might have to be pushed on top of current items
|
|
80
|
+
const sortQuery = _.get(getCollectionBaseQuery(), '$sort')
|
|
81
|
+
if (sortQuery) {
|
|
82
|
+
// By default orderBy is case sensitive while using collation we want to perform case insensitive sort
|
|
83
|
+
setCollectionItems(_.orderBy(items.value,
|
|
84
|
+
// Sort function for each sort property
|
|
85
|
+
_.map(_.keys(sortQuery), property => {
|
|
86
|
+
return item => {
|
|
87
|
+
const value = _.get(item, property)
|
|
88
|
+
return (typeof value === 'string' ? value.toLowerCase() : value)
|
|
89
|
+
}
|
|
90
|
+
}),
|
|
91
|
+
// Sort order for each sort property
|
|
92
|
+
_.map(_.values(sortQuery), value => { return value > 0 ? 'asc' : 'desc' })))
|
|
93
|
+
}
|
|
94
|
+
} else {
|
|
95
|
+
setCollectionItems(response.data)
|
|
96
|
+
}
|
|
97
|
+
nbTotalItems.value = response.total
|
|
98
|
+
}, error => {
|
|
99
|
+
logger.error(error)
|
|
100
|
+
})
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function unsubscribe () {
|
|
104
|
+
if (itemListener) {
|
|
105
|
+
itemListener.unsubscribe()
|
|
106
|
+
itemListener = null
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const refreshCollection = _.throttle(() => {
|
|
111
|
+
const fullQuery = {
|
|
112
|
+
$locale: getLocale(),
|
|
113
|
+
...getCollectionBaseQuery(),
|
|
114
|
+
...getCollectionFilterQuery(),
|
|
115
|
+
...getCollectionPaginationQuery()
|
|
116
|
+
}
|
|
117
|
+
subscribe(fullQuery)
|
|
118
|
+
}, options.refreshThrottle.value, { leading: false })
|
|
119
|
+
|
|
120
|
+
function resetCollection () {
|
|
121
|
+
// Reset pagination and start again refreshing the collection
|
|
122
|
+
setCollectionItems([])
|
|
123
|
+
currentPage.value = 1
|
|
124
|
+
refreshCollection()
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function onItemsUpdated (updatedItems) {
|
|
128
|
+
// When we append items some items of the previous pages might have been updated.
|
|
129
|
+
// In this case we need to reset the full collection as Rx only tracks changes on the current page
|
|
130
|
+
updatedItems = (Array.isArray(updatedItems) ? updatedItems : [updatedItems])
|
|
131
|
+
// We keep order from the updated list as depending on the sorting criteria a new item might have to be pushed on top of current items
|
|
132
|
+
updatedItems = _.intersectionWith(items.value, updatedItems, (item1, item2) => (item1._id.toString() === item2._id.toString()))
|
|
133
|
+
if (updatedItems.length > 0) resetCollection()
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Lifecycle hooks
|
|
137
|
+
watch(options.service, resetCollection)
|
|
138
|
+
watch(options.listStrategy, resetCollection)
|
|
139
|
+
watch(options.nbItemsPerPage, resetCollection)
|
|
140
|
+
watch(options.appendItems, resetCollection)
|
|
141
|
+
// Some are not mandatory or initialized by default
|
|
142
|
+
if (options.contextId) watch(options.contextId, resetCollection)
|
|
143
|
+
if (options.baseQuery) watch(options.baseQuery, resetCollection)
|
|
144
|
+
if (options.filterQuery) watch(options.filterQuery, resetCollection)
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
onBeforeMount(() => {
|
|
148
|
+
if (options.appendItems.value) {
|
|
149
|
+
const service = getService()
|
|
150
|
+
service.on('patched', onItemsUpdated)
|
|
151
|
+
service.on('updated', onItemsUpdated)
|
|
152
|
+
service.on('removed', onItemsUpdated)
|
|
153
|
+
}
|
|
154
|
+
})
|
|
155
|
+
|
|
156
|
+
// Cleanup for appendItems
|
|
157
|
+
onBeforeUnmount(() => {
|
|
158
|
+
unsubscribe()
|
|
159
|
+
if (options.appendItems.value) {
|
|
160
|
+
const service = getService()
|
|
161
|
+
service.off('patched', onItemsUpdated)
|
|
162
|
+
service.off('updated', onItemsUpdated)
|
|
163
|
+
service.off('removed', onItemsUpdated)
|
|
164
|
+
}
|
|
165
|
+
})
|
|
166
|
+
|
|
167
|
+
return {
|
|
168
|
+
items,
|
|
169
|
+
nbTotalItems,
|
|
170
|
+
currentPage,
|
|
171
|
+
nbPages,
|
|
172
|
+
setCollectionItems,
|
|
173
|
+
subscribe,
|
|
174
|
+
unsubscribe,
|
|
175
|
+
getCollectionBaseQuery,
|
|
176
|
+
getCollectionFilterQuery,
|
|
177
|
+
getCollectionPaginationQuery,
|
|
178
|
+
resetCollection,
|
|
179
|
+
refreshCollection
|
|
180
|
+
}
|
|
181
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import _ from 'lodash'
|
|
2
|
+
import logger from 'loglevel'
|
|
3
|
+
import config from 'config'
|
|
4
|
+
import { onMounted, onBeforeUnmount } from 'vue'
|
|
5
|
+
import { useQuasar } from 'quasar'
|
|
6
|
+
import { Events } from '../events.js'
|
|
7
|
+
import { i18n } from '../i18n.js'
|
|
8
|
+
import { LocalStorage } from '../local-storage.js'
|
|
9
|
+
import { InstallPwaPrompt, installFFDesktopPrompt, installSafariPrompt, installDefaultPrompt } from '../utils/utils.pwa.js'
|
|
10
|
+
|
|
11
|
+
export function usePwa () {
|
|
12
|
+
// Data
|
|
13
|
+
const $q = useQuasar()
|
|
14
|
+
const installKey = 'install'
|
|
15
|
+
const changelogKey = 'appChangelog'
|
|
16
|
+
|
|
17
|
+
// Functions
|
|
18
|
+
function install () {
|
|
19
|
+
if (window.matchMedia('(display-mode: standalone)').matches) return
|
|
20
|
+
// Install prompt can be avoided, eg in tests
|
|
21
|
+
if (!LocalStorage.get(installKey, true)) return
|
|
22
|
+
// Take care of install prompt
|
|
23
|
+
if (InstallPwaPrompt) installDefaultPrompt()
|
|
24
|
+
// Take care of iOS
|
|
25
|
+
if ($q.platform.is.ios) installSafariPrompt()
|
|
26
|
+
// Take care of Firefox desktop
|
|
27
|
+
if ($q.platform.is.firefox && $q.platform.is.desktop) installFFDesktopPrompt()
|
|
28
|
+
}
|
|
29
|
+
function update (registration) {
|
|
30
|
+
// Refresh the page once the update has been applied
|
|
31
|
+
registration.waiting.addEventListener('statechange', (event) => {
|
|
32
|
+
if (event.target.state === 'activated') {
|
|
33
|
+
window.location.reload()
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
const changelog = _.get(config, changelogKey)
|
|
37
|
+
$q.dialog({
|
|
38
|
+
title: i18n.t('composables.pwa.UPDATE_TITLE'),
|
|
39
|
+
message: changelog ? i18n.t('composables.pwa.UPDATE_MESSAGE', { changelog }) : undefined,
|
|
40
|
+
html: true,
|
|
41
|
+
cancel: {
|
|
42
|
+
id: 'ignore-button',
|
|
43
|
+
label: i18n.t('composables.pwa.IGNORE'),
|
|
44
|
+
color: 'primary',
|
|
45
|
+
outline: true
|
|
46
|
+
},
|
|
47
|
+
ok: {
|
|
48
|
+
id: 'update-button',
|
|
49
|
+
label: i18n.t('composables.pwa.UPDATE'),
|
|
50
|
+
color: 'primary'
|
|
51
|
+
},
|
|
52
|
+
persistent: true,
|
|
53
|
+
position: 'bottom'
|
|
54
|
+
}).onOk(() => {
|
|
55
|
+
registration.waiting.postMessage({ type: 'SKIP_WAITING' })
|
|
56
|
+
})
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Hooks
|
|
60
|
+
onMounted(() => {
|
|
61
|
+
Events.on('pwa-updated', update)
|
|
62
|
+
})
|
|
63
|
+
onBeforeUnmount(() => {
|
|
64
|
+
Events.off('pwa-updated', update)
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
// Expose
|
|
68
|
+
return {
|
|
69
|
+
installPwa: install
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -5,11 +5,12 @@ import { useRouter, useRoute } from 'vue-router'
|
|
|
5
5
|
import { useQuasar, Loading } from 'quasar'
|
|
6
6
|
import { api } from '../api.js'
|
|
7
7
|
import { i18n } from '../i18n.js'
|
|
8
|
+
import { Events } from '../events.js'
|
|
8
9
|
import { Store } from '../store.js'
|
|
9
10
|
import { beforeGuard } from '../guards.js'
|
|
10
11
|
import { LocalStorage } from '../local-storage.js'
|
|
11
12
|
import { useVersion } from '../composables/version.js'
|
|
12
|
-
import {
|
|
13
|
+
import { restoreSession } from '../utils/utils.session.js'
|
|
13
14
|
|
|
14
15
|
export function useSession (options = {}) {
|
|
15
16
|
// Data
|
|
@@ -21,8 +22,7 @@ export function useSession (options = {}) {
|
|
|
21
22
|
const isInitialized = ref(false)
|
|
22
23
|
let pendingReconnection = null
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
const User = computed(() => Store.get('user'))
|
|
25
|
+
const User = Store.getRef('user')
|
|
26
26
|
|
|
27
27
|
// Functions
|
|
28
28
|
function getRedirectKey () {
|
|
@@ -107,12 +107,6 @@ export function useSession (options = {}) {
|
|
|
107
107
|
}).onOk(() => window.location.reload())
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
// Watch
|
|
111
|
-
watch(User, async () => {
|
|
112
|
-
await updateAbilities()
|
|
113
|
-
await redirect()
|
|
114
|
-
})
|
|
115
|
-
|
|
116
110
|
// Hooks
|
|
117
111
|
onMounted(async () => {
|
|
118
112
|
// Handle socket connexion
|
|
@@ -125,6 +119,8 @@ export function useSession (options = {}) {
|
|
|
125
119
|
// Display error message if we have been banned from the server
|
|
126
120
|
api.socket.on('rate-limit', onRateLimit)
|
|
127
121
|
}
|
|
122
|
+
// Then redirection
|
|
123
|
+
Events.on('user-abilities-changed', redirect)
|
|
128
124
|
|
|
129
125
|
try {
|
|
130
126
|
await restoreSession()
|
|
@@ -139,6 +135,7 @@ export function useSession (options = {}) {
|
|
|
139
135
|
api.socket.off('reconnect', onReconnect)
|
|
140
136
|
api.socket.off('rate-limit', onRateLimit)
|
|
141
137
|
}
|
|
138
|
+
Events.off('user-abilities-changed', redirect)
|
|
142
139
|
})
|
|
143
140
|
|
|
144
141
|
// Expose
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import _ from 'lodash'
|
|
2
|
-
import logger from 'loglevel'
|
|
3
2
|
import config from 'config'
|
|
4
3
|
import { ref, computed, readonly } from 'vue'
|
|
5
|
-
import { Capabilities
|
|
6
|
-
import { Notify } from 'quasar'
|
|
7
|
-
import { getPlatform } from '../utils/utils.platform.js'
|
|
4
|
+
import { Capabilities } from '../index.js'
|
|
8
5
|
|
|
9
6
|
const Version = ref({
|
|
10
7
|
client: {
|
|
@@ -18,7 +15,6 @@ const Version = ref({
|
|
|
18
15
|
flavor: _.get(config, 'flavor')
|
|
19
16
|
})
|
|
20
17
|
let isInitialized = false
|
|
21
|
-
const Platform = getPlatform()
|
|
22
18
|
|
|
23
19
|
export function useVersion () {
|
|
24
20
|
// Computed
|
|
@@ -38,10 +34,8 @@ export function useVersion () {
|
|
|
38
34
|
// Immediate
|
|
39
35
|
if (!isInitialized) {
|
|
40
36
|
isInitialized = true
|
|
41
|
-
logger.debug('Setting API version from capabilities')
|
|
42
37
|
Version.value.api.number = Capabilities.get('version')
|
|
43
38
|
Version.value.api.buildNumber = Capabilities.get('buildNumber')
|
|
44
|
-
if (Platform.cordova) checkVersion()
|
|
45
39
|
}
|
|
46
40
|
|
|
47
41
|
// Expose
|
|
@@ -51,18 +45,3 @@ export function useVersion () {
|
|
|
51
45
|
apiVersionName
|
|
52
46
|
}
|
|
53
47
|
}
|
|
54
|
-
|
|
55
|
-
export async function checkVersion () {
|
|
56
|
-
const api = Store.capabilities.api
|
|
57
|
-
// FIXME: we should elaborate a more complex check between compatible versions
|
|
58
|
-
if (api.version === config.version) {
|
|
59
|
-
if (config.flavor === 'prod') return
|
|
60
|
-
// Local dev has not the concept of build number
|
|
61
|
-
else if (!api.buildNumber) return
|
|
62
|
-
// On staging check it because we do not increase version number on each change
|
|
63
|
-
// and would like to know if the mobile client is up-to-date
|
|
64
|
-
else if (api.buildNumber === config.buildNumber) return
|
|
65
|
-
}
|
|
66
|
-
// Notify when a new version is available
|
|
67
|
-
Notify.create({ type: 'warning', message: i18n.t('composables.VERSION_MISMATCH') })
|
|
68
|
-
}
|