@kalisio/kdk 2.1.9 → 2.2.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/.travis.test.sh +42 -10
- package/README.md +2 -2
- package/core/api/application.js +6 -1
- package/core/api/authentication.js +17 -1
- package/core/api/db.js +7 -2
- package/core/api/hooks/hooks.authentication.js +4 -2
- package/core/api/hooks/hooks.authorisations.js +12 -2
- package/core/api/hooks/hooks.model.js +5 -5
- package/core/api/hooks/hooks.organisations.js +0 -4
- package/core/api/services/account/account.hooks.js +10 -6
- package/core/api/services/account/account.service.js +1 -1
- package/{map/api/services/geocoder/geocoder.hooks.js → core/api/services/import-export/import-export.hooks.js} +7 -5
- package/core/api/services/import-export/import-export.service.js +11 -0
- package/core/api/services/index.js +13 -1
- package/core/api/services/users/users.hooks.js +2 -3
- package/core/client/api.js +16 -14
- package/core/client/capabilities.js +6 -2
- package/core/client/components/KContent.vue +11 -1
- package/core/client/components/KDialog.vue +17 -15
- package/core/client/components/KSponsor.vue +1 -1
- package/core/client/components/KTextArea.vue +5 -1
- package/core/client/components/app/KAbout.vue +1 -2
- package/core/client/components/app/KWelcome.vue +3 -5
- package/core/client/components/chart/KTimeSeriesChart.vue +24 -37
- package/core/client/components/collection/KColumn.vue +20 -17
- package/core/client/components/editor/KModalEditor.vue +0 -2
- package/core/client/components/form/KChipsField.vue +12 -2
- package/core/client/components/form/KColorField.vue +12 -2
- package/core/client/components/form/KColorScaleField.vue +12 -2
- package/core/client/components/form/KDateTimeRangeField.vue +12 -2
- package/core/client/components/form/KDatetimeField.vue +12 -2
- package/core/client/components/form/KEmailField.vue +12 -2
- package/core/client/components/form/KFileField.vue +12 -2
- package/core/client/components/form/KForm.vue +43 -9
- package/core/client/components/form/KIconField.vue +12 -2
- package/core/client/components/form/KItemField.vue +25 -4
- package/core/client/components/form/KNumberField.vue +12 -2
- package/core/client/components/form/KOptionsField.vue +12 -2
- package/core/client/components/form/KPasswordField.vue +12 -2
- package/core/client/components/form/KPhoneField.vue +13 -3
- package/core/client/components/form/KPropertyItemField.vue +12 -2
- package/core/client/components/form/KResolutionField.vue +126 -0
- package/core/client/components/form/KRoleField.vue +12 -2
- package/core/client/components/form/KSelectField.vue +14 -4
- package/core/client/components/form/KTextField.vue +12 -2
- package/core/client/components/form/KTextareaField.vue +13 -3
- package/core/client/components/form/KToggleField.vue +12 -2
- package/core/client/components/form/KTokenField.vue +12 -2
- package/core/client/components/form/KUnitField.vue +12 -2
- package/core/client/components/form/KUrlField.vue +12 -2
- package/core/client/components/input/KIconChooser.vue +10 -12
- package/core/client/components/input/KPalette.vue +2 -1
- package/core/client/components/layout/KPage.vue +5 -4
- package/core/client/components/layout/KWindow.vue +10 -10
- package/core/client/components/media/KColorScale.vue +26 -20
- package/core/client/components/media/KImageViewer.vue +57 -33
- package/core/client/components/media/KShape.vue +14 -103
- package/core/client/components/screen/KRegisterScreen.vue +0 -1
- package/core/client/components/screen/KScreenFooter.vue +0 -18
- package/core/client/components/team/KAddMember.vue +16 -22
- package/core/client/components/team/KGroupsActivity.vue +14 -0
- package/core/client/components/team/KMembersActivity.vue +12 -0
- package/core/client/components/team/KTagsActivity.vue +14 -0
- package/core/client/components/time/KDateTime.vue +23 -7
- package/core/client/components/time/KTimeControl.vue +142 -0
- package/core/client/components/tool/KExportTool.vue +57 -0
- package/core/client/composables/collection.js +0 -1
- package/core/client/composables/pwa.js +0 -1
- package/core/client/composables/schema.js +1 -1
- package/core/client/composables/session.js +30 -6
- package/core/client/exporter.js +141 -0
- package/core/client/i18n/core_en.json +91 -23
- package/core/client/i18n/core_fr.json +92 -23
- package/core/client/index.js +3 -0
- package/core/client/layout.js +34 -14
- package/core/client/local-storage.js +8 -6
- package/core/client/mixins/index.js +0 -1
- package/core/client/mixins/mixin.base-field.js +24 -2
- package/core/client/mixins/mixin.object-proxy.js +0 -1
- package/core/client/search.js +2 -1
- package/core/client/services/index.js +2 -1
- package/core/client/services/local-settings.service.js +4 -4
- package/core/client/theme.js +3 -3
- package/core/client/time.js +4 -0
- package/core/client/units.js +149 -4
- package/core/client/utils/index.js +13 -6
- package/core/client/utils/utils.account.js +1 -1
- package/core/client/utils/utils.colors.js +43 -0
- package/core/client/utils/utils.platform.js +0 -1
- package/core/client/utils/utils.pwa.js +14 -14
- package/core/client/utils/utils.session.js +1 -1
- package/core/client/utils/utils.shapes.js +270 -0
- package/core/client/utils/utils.time.js +37 -0
- package/core/common/permissions.js +3 -0
- package/core/common/schemas/settings.update.json +50 -29
- package/extras/css/core.variables.scss +3 -1
- package/extras/tours/map/navigation-bar.js +17 -15
- package/extras/tours/map/timeline.js +33 -33
- package/map/api/config/categories.cjs +4 -1
- package/map/api/hooks/hooks.catalog.js +39 -0
- package/map/api/hooks/hooks.features.js +23 -3
- package/map/api/hooks/hooks.query.js +31 -10
- package/map/api/models/projects.model.mongodb.js +8 -0
- package/map/api/services/catalog/catalog.hooks.js +5 -3
- package/map/api/services/features/features.hooks.js +18 -6
- package/map/api/services/index.js +22 -6
- package/map/api/services/projects/projects.hooks.js +118 -0
- package/map/client/capture.js +16 -0
- package/map/client/cesium/utils/index.js +3 -0
- package/map/client/cesium/utils/utils.events.js +30 -0
- package/map/client/cesium/utils/utils.popup.js +17 -0
- package/map/client/cesium/{utils.js → utils/utils.style.js} +53 -49
- package/map/client/components/KCapture.vue +50 -0
- package/map/client/components/KCaptureTextArea.vue +53 -0
- package/map/client/components/KCompass.vue +2 -2
- package/map/client/components/KFeaturesChart.vue +1 -1
- package/map/client/components/KFeaturesFilter.vue +2 -2
- package/map/client/components/KLayerStyleForm.vue +256 -430
- package/map/client/components/KLevelSlider.vue +1 -1
- package/map/client/components/KNorth.vue +31 -0
- package/map/client/components/KProjectMenu.vue +88 -0
- package/map/client/components/KTimezoneMap.vue +36 -23
- package/map/client/components/catalog/KAddLayer.vue +3 -4
- package/map/client/components/catalog/KConnectLayer.vue +16 -4
- package/map/client/components/catalog/KCreateLayer.vue +1 -2
- package/map/client/components/catalog/KCreateProject.vue +100 -0
- package/map/client/components/catalog/KCreateView.vue +25 -2
- package/map/client/components/catalog/KLayersPanel.vue +24 -27
- package/map/client/components/catalog/KLayersSelector.vue +1 -1
- package/map/client/components/catalog/KProjectEditor.vue +91 -0
- package/map/client/components/catalog/KProjectManager.vue +60 -0
- package/map/client/components/catalog/KProjectSelector.vue +38 -0
- package/map/client/components/catalog/KProjectsPanel.vue +153 -0
- package/map/client/components/catalog/KSelectLayers.vue +96 -0
- package/map/client/components/catalog/KSelectViews.vue +96 -0
- package/map/client/components/catalog/KViewsPanel.vue +66 -30
- package/map/client/components/form/KDirectionField.vue +24 -5
- package/map/client/components/form/KLayerCategoryField.vue +12 -2
- package/map/client/components/form/KLocationField.vue +20 -5
- package/map/client/components/form/KOwsLayerField.vue +12 -2
- package/map/client/components/form/KOwsServiceField.vue +12 -2
- package/map/client/components/form/KSelectLayersField.vue +159 -0
- package/map/client/components/form/KSelectViewsField.vue +121 -0
- package/map/client/components/form/KTimezoneField.vue +24 -17
- package/map/client/components/legend/KColorScaleLegend.vue +1 -1
- package/map/client/components/legend/KLayerLegend.vue +61 -0
- package/map/client/components/legend/KLegend.vue +45 -44
- package/map/client/components/legend/KLegendRenderer.vue +5 -3
- package/map/client/components/legend/KSymbolsLegend.vue +12 -10
- package/map/client/components/legend/KVariablesLegend.vue +78 -0
- package/map/client/components/location/KGeocodersFilter.vue +2 -4
- package/map/client/components/location/KLocationMap.vue +48 -17
- package/map/client/components/location/KLocationSearch.vue +13 -3
- package/map/client/components/tools/KSearchTool.vue +17 -12
- package/map/client/components/widget/KElevationProfile.vue +16 -19
- package/map/client/components/widget/KMapillaryViewer.vue +21 -22
- package/map/client/components/widget/KTimeSeries.vue +35 -23
- package/map/client/composables/activity.js +15 -2
- package/map/client/composables/catalog.js +66 -0
- package/map/client/composables/highlight.js +56 -20
- package/map/client/composables/index.js +2 -0
- package/map/client/composables/location.js +25 -18
- package/map/client/composables/project.js +122 -0
- package/map/client/geolocation.js +1 -1
- package/map/client/globe.js +2 -0
- package/map/client/i18n/map_en.json +123 -76
- package/map/client/i18n/map_fr.json +124 -72
- package/map/client/index.js +3 -0
- package/map/client/init.js +17 -0
- package/map/client/leaflet/GSMaPLayer.js +16 -17
- package/map/client/leaflet/ShapeMarker.js +40 -0
- package/map/client/leaflet/TiledFeatureLayer.js +1 -1
- package/map/client/leaflet/TiledMeshLayer.js +11 -15
- package/map/client/leaflet/TiledWindLayer.js +6 -10
- package/map/client/leaflet/utils/index.js +4 -0
- package/map/client/leaflet/utils/utils.events.js +41 -0
- package/map/client/leaflet/utils/utils.popup.js +21 -0
- package/map/client/leaflet/utils/utils.style.js +191 -0
- package/map/client/leaflet/utils/utils.tiles.js +87 -0
- package/map/client/map.js +2 -0
- package/map/client/mixins/globe/mixin.base-globe.js +29 -21
- package/map/client/mixins/globe/mixin.geojson-layers.js +132 -69
- package/map/client/mixins/globe/mixin.popup.js +2 -1
- package/map/client/mixins/globe/mixin.style.js +6 -4
- package/map/client/mixins/globe/mixin.tooltip.js +8 -3
- package/map/client/mixins/map/mixin.base-map.js +13 -11
- package/map/client/mixins/map/mixin.edit-layers.js +15 -15
- package/map/client/mixins/map/mixin.forecast-layers.js +3 -1
- package/map/client/mixins/map/mixin.geojson-layers.js +56 -20
- package/map/client/mixins/map/mixin.georaster-layers.js +4 -11
- package/map/client/mixins/map/mixin.heatmap-layers.js +1 -1
- package/map/client/mixins/map/mixin.popup.js +2 -1
- package/map/client/mixins/map/mixin.style.js +4 -67
- package/map/client/mixins/map/mixin.tiled-mesh-layers.js +2 -1
- package/map/client/mixins/map/mixin.tiled-wind-layers.js +4 -2
- package/map/client/mixins/map/mixin.tooltip.js +2 -1
- package/map/client/mixins/mixin.activity.js +66 -191
- package/map/client/mixins/mixin.catalog-panel.js +6 -6
- package/map/client/mixins/mixin.context.js +12 -9
- package/map/client/mixins/mixin.feature-service.js +29 -300
- package/map/client/mixins/mixin.weacast.js +11 -17
- package/map/client/pixi-utils.js +1 -1
- package/map/client/planets.js +58 -0
- package/map/client/utils/index.js +6 -0
- package/map/client/utils/utils.capture.js +176 -0
- package/map/client/utils/utils.catalog.js +149 -0
- package/map/client/utils/utils.features.js +364 -0
- package/map/client/utils/utils.js +0 -151
- package/map/client/utils/utils.layers.js +174 -0
- package/map/client/utils/utils.location.js +91 -23
- package/map/client/utils/utils.project.js +8 -0
- package/map/client/utils/utils.schema.js +0 -1
- package/map/client/utils/utils.style.js +297 -0
- package/map/client/utils.all.js +2 -2
- package/map/client/utils.globe.js +1 -1
- package/map/client/utils.map.js +1 -1
- package/map/common/permissions.js +2 -0
- package/map/common/schemas/capture.create.json +132 -0
- package/map/common/schemas/projects.create.json +52 -0
- package/map/common/schemas/projects.update.json +52 -0
- package/package.json +6 -5
- package/test/api/core/account.test.js +20 -0
- package/test/api/core/config/default.cjs +16 -3
- package/test/api/core/import-export.test.js +86 -0
- package/test/api/core/test-log-2024-01-04.log +14 -0
- package/test/api/map/catalog.test.js +164 -0
- package/test/api/map/index.test.js +25 -61
- package/test/api/map/test-log-2024-01-04.log +2 -0
- package/test/api/map/test-log-2024-01-11.log +1 -0
- package/test/api/map/test-log-2024-01-25.log +19 -0
- package/test/client/core/layout.js +25 -5
- package/test/client/core/utils.js +7 -0
- package/test/client/map/catalog.js +78 -1
- package/test/client/map/time.js +2 -1
- package/core/client/components/screen/KEndpointScreen.vue +0 -80
- package/core/client/mixins/mixin.account.js +0 -61
- package/extras/icons/kdk.png +0 -0
- package/map/api/services/geocoder/geocoder.service.js +0 -79
- package/map/client/components/KCaptureToolbar.vue +0 -155
- package/map/client/components/KColorLegend.vue +0 -349
- package/map/client/components/KTimeline.vue +0 -293
- package/map/client/components/KUrlLegend.vue +0 -122
- package/map/client/leaflet/utils.js +0 -246
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<KScreen title="KEndpointScreen.TITLE" :actions="actions">
|
|
3
|
-
<div class="column items-center q-gutter-y-md">
|
|
4
|
-
<KForm
|
|
5
|
-
ref="refForm"
|
|
6
|
-
class="full-width"
|
|
7
|
-
:schema="getFormSchema()"
|
|
8
|
-
@form-ready="onFormReady"
|
|
9
|
-
/>
|
|
10
|
-
<div class="row full-width justify-around q-gutter-x-md">
|
|
11
|
-
<KAction
|
|
12
|
-
id="cancel-button"
|
|
13
|
-
label="KEndpointScreen.RESET_LABEL"
|
|
14
|
-
renderer="form-button"
|
|
15
|
-
:handler="onReset"
|
|
16
|
-
/>
|
|
17
|
-
<KAction
|
|
18
|
-
id="apply-button"
|
|
19
|
-
label="KEndpointScreen.APPLY_LABEL"
|
|
20
|
-
renderer="form-button"
|
|
21
|
-
:handler="onApplied"
|
|
22
|
-
/>
|
|
23
|
-
</div>
|
|
24
|
-
</div>
|
|
25
|
-
</KScreen>
|
|
26
|
-
</template>
|
|
27
|
-
|
|
28
|
-
<script setup>
|
|
29
|
-
import _ from 'lodash'
|
|
30
|
-
import config from 'config'
|
|
31
|
-
import { ref } from 'vue'
|
|
32
|
-
import { useRouter } from 'vue-router'
|
|
33
|
-
import { api } from '../../api.js'
|
|
34
|
-
import KScreen from './KScreen.vue'
|
|
35
|
-
import KForm from '../form/KForm.vue'
|
|
36
|
-
import KAction from '../KAction.vue'
|
|
37
|
-
|
|
38
|
-
// Data
|
|
39
|
-
const router = useRouter()
|
|
40
|
-
const refForm = ref()
|
|
41
|
-
const actions = ref(_.get(config, 'screens.endpoint.actions', []))
|
|
42
|
-
|
|
43
|
-
// Functions
|
|
44
|
-
function getFormSchema () {
|
|
45
|
-
return {
|
|
46
|
-
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
47
|
-
$id: 'http://kalisio.xyz/schemas/change-endpoint.json#',
|
|
48
|
-
title: 'Change Endpoint form',
|
|
49
|
-
description: 'Change remote service URL form',
|
|
50
|
-
type: 'object',
|
|
51
|
-
properties: {
|
|
52
|
-
baseUrl: {
|
|
53
|
-
type: 'string',
|
|
54
|
-
format: 'uri',
|
|
55
|
-
field: {
|
|
56
|
-
component: 'form/KTextField',
|
|
57
|
-
label: 'KEndpointScreen.BASE_URL_FIELD_LABEL'
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
function onReset () {
|
|
64
|
-
api.setBaseUrl('')
|
|
65
|
-
router.push({ name: 'login' })
|
|
66
|
-
window.location.reload()
|
|
67
|
-
}
|
|
68
|
-
function onApplied (data) {
|
|
69
|
-
const result = refForm.value.validate()
|
|
70
|
-
if (result.isValid) {
|
|
71
|
-
api.setBaseUrl(result.values.baseUrl)
|
|
72
|
-
window.location.reload()
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
function onFormReady (form) {
|
|
76
|
-
refForm.value.fill({
|
|
77
|
-
baseUrl: api.getBaseUrl()
|
|
78
|
-
})
|
|
79
|
-
}
|
|
80
|
-
</script>
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
export const account = {
|
|
2
|
-
methods: {
|
|
3
|
-
resendVerifySignup (email) {
|
|
4
|
-
return this.accountService.create({
|
|
5
|
-
action: 'resendVerifySignup',
|
|
6
|
-
value: { email }
|
|
7
|
-
})
|
|
8
|
-
},
|
|
9
|
-
verifySignup (token, email) {
|
|
10
|
-
return this.accountService.create({
|
|
11
|
-
action: 'verifySignupShort',
|
|
12
|
-
value: {
|
|
13
|
-
user: { email },
|
|
14
|
-
token
|
|
15
|
-
}
|
|
16
|
-
})
|
|
17
|
-
},
|
|
18
|
-
sendResetPassword (email) {
|
|
19
|
-
return this.accountService.create({
|
|
20
|
-
action: 'sendResetPwd',
|
|
21
|
-
value: { email }
|
|
22
|
-
})
|
|
23
|
-
},
|
|
24
|
-
resetPassword (email, token, password) {
|
|
25
|
-
return this.accountService.create({
|
|
26
|
-
action: 'resetPwdShort',
|
|
27
|
-
value: {
|
|
28
|
-
user: { email },
|
|
29
|
-
token,
|
|
30
|
-
password
|
|
31
|
-
}
|
|
32
|
-
})
|
|
33
|
-
},
|
|
34
|
-
changePassword (email, oldPassword, password) {
|
|
35
|
-
return this.accountService.create({
|
|
36
|
-
action: 'passwordChange',
|
|
37
|
-
value: {
|
|
38
|
-
user: { email },
|
|
39
|
-
oldPassword,
|
|
40
|
-
password
|
|
41
|
-
}
|
|
42
|
-
})
|
|
43
|
-
},
|
|
44
|
-
sendChangeIdentity (oldEmail, email, password) {
|
|
45
|
-
return this.accountService.create({
|
|
46
|
-
action: 'identityChange',
|
|
47
|
-
value: {
|
|
48
|
-
user: { email: oldEmail },
|
|
49
|
-
changes: { email },
|
|
50
|
-
password
|
|
51
|
-
}
|
|
52
|
-
})
|
|
53
|
-
},
|
|
54
|
-
changeIdentity (token) {
|
|
55
|
-
return this.verifySignup(token)
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
created () {
|
|
59
|
-
this.accountService = this.$api.getService('account')
|
|
60
|
-
}
|
|
61
|
-
}
|
package/extras/icons/kdk.png
DELETED
|
Binary file
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import _ from 'lodash'
|
|
2
|
-
import NodeGeocoder from 'node-geocoder'
|
|
3
|
-
import makeDebug from 'debug'
|
|
4
|
-
|
|
5
|
-
const debug = makeDebug('kdk:map:geocoder:service')
|
|
6
|
-
|
|
7
|
-
export default function (name, app, options) {
|
|
8
|
-
// Keep track of config
|
|
9
|
-
Object.assign(options, app.get('geocoder'))
|
|
10
|
-
debug('geocoder created with config ', options)
|
|
11
|
-
let geocoders = []
|
|
12
|
-
// Single provider ?
|
|
13
|
-
if (options.providers) {
|
|
14
|
-
geocoders = options.providers.map(geocoderOptions => NodeGeocoder(geocoderOptions))
|
|
15
|
-
} else {
|
|
16
|
-
geocoders.push(NodeGeocoder(options))
|
|
17
|
-
}
|
|
18
|
-
return {
|
|
19
|
-
async geocode (geocoder, address) {
|
|
20
|
-
let results = []
|
|
21
|
-
try {
|
|
22
|
-
results = await geocoder.geocode(address)
|
|
23
|
-
} catch (error) {
|
|
24
|
-
app.logger.error(error)
|
|
25
|
-
}
|
|
26
|
-
return results
|
|
27
|
-
},
|
|
28
|
-
async reverse (geocoder, lon, lat) {
|
|
29
|
-
let results = []
|
|
30
|
-
try {
|
|
31
|
-
results = await geocoder.reverse({ lat, lon })
|
|
32
|
-
} catch (error) {
|
|
33
|
-
app.logger.error(error)
|
|
34
|
-
}
|
|
35
|
-
return results
|
|
36
|
-
},
|
|
37
|
-
async create (data, params) {
|
|
38
|
-
// We limit results to the N best ones from the different providers
|
|
39
|
-
const nbResults = _.get(this, 'paginate.default', 10)
|
|
40
|
-
debug('geocoder service called for create', data)
|
|
41
|
-
const aggregatedResults = await Promise.all(geocoders.map(async geocoder => {
|
|
42
|
-
// We want to wait for all responses ever if some fail
|
|
43
|
-
// FIXME: when definitely available in JS spec should be replaced by Promise.allSettled
|
|
44
|
-
try {
|
|
45
|
-
let results = []
|
|
46
|
-
if (data.address) {
|
|
47
|
-
results = await this.geocode(geocoder, data.address)
|
|
48
|
-
} else if (geocoder.reverse) { // All geocoders cannot do reverse geocoding
|
|
49
|
-
// We support GeoJson feature for reverse geocoding
|
|
50
|
-
const lon = _.get(data, 'lon', _.get(data, 'longitude', _.get(data, 'geometry.coordinates[0]')))
|
|
51
|
-
const lat = _.get(data, 'lat', _.get(data, 'latitude', _.get(data, 'geometry.coordinates[1]')))
|
|
52
|
-
results = await this.reverse(geocoder, lon, lat)
|
|
53
|
-
}
|
|
54
|
-
return { results }
|
|
55
|
-
} catch (error) {
|
|
56
|
-
return { error }
|
|
57
|
-
}
|
|
58
|
-
}))
|
|
59
|
-
const results = []
|
|
60
|
-
let processing = true
|
|
61
|
-
// Iterate to take best results for each provider in same order
|
|
62
|
-
while (processing) {
|
|
63
|
-
const previousCount = results.length
|
|
64
|
-
aggregatedResults.forEach(provider => {
|
|
65
|
-
if (provider.error) {
|
|
66
|
-
app.logger.error(provider.error)
|
|
67
|
-
} else {
|
|
68
|
-
// Take current best result if any
|
|
69
|
-
const bestResultForProvider = provider.results.shift()
|
|
70
|
-
if (bestResultForProvider) results.push(bestResultForProvider)
|
|
71
|
-
}
|
|
72
|
-
})
|
|
73
|
-
// Stop when no more results to be added or pagination exceeded
|
|
74
|
-
if ((previousCount === results.length) || (nbResults <= results.length)) processing = false
|
|
75
|
-
}
|
|
76
|
-
return results.splice(0, nbResults)
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="q-pl-sm q-pr-xs row justify-center items-center no-wrap q-gutter-x-xs">
|
|
3
|
-
<q-select
|
|
4
|
-
v-model="resolution"
|
|
5
|
-
:options="getResolutions()"
|
|
6
|
-
dense
|
|
7
|
-
borderless>
|
|
8
|
-
<template v-slot:option="scope">
|
|
9
|
-
<q-item v-bind="scope.itemProps">
|
|
10
|
-
<q-item-section>
|
|
11
|
-
<q-item-label v-html="scope.opt.label" />
|
|
12
|
-
</q-item-section>
|
|
13
|
-
<q-item-section side>
|
|
14
|
-
<q-item-label caption>{{ scope.opt.description }}</q-item-label>
|
|
15
|
-
</q-item-section>
|
|
16
|
-
</q-item>
|
|
17
|
-
</template>
|
|
18
|
-
</q-select>
|
|
19
|
-
<q-input
|
|
20
|
-
v-model.number="width"
|
|
21
|
-
type="number"
|
|
22
|
-
min="256" max="4000"
|
|
23
|
-
mask="(#)###"
|
|
24
|
-
borderless
|
|
25
|
-
dense
|
|
26
|
-
input-class="text-center"
|
|
27
|
-
style="max-width: 54px"
|
|
28
|
-
/>
|
|
29
|
-
<span>x</span>
|
|
30
|
-
<q-input
|
|
31
|
-
v-model.number="height"
|
|
32
|
-
type="number"
|
|
33
|
-
min="256" max="4000"
|
|
34
|
-
mask="(#)###"
|
|
35
|
-
borderless
|
|
36
|
-
dense
|
|
37
|
-
input-class="text-center"
|
|
38
|
-
style="max-width: 54px"
|
|
39
|
-
/>
|
|
40
|
-
<k-action
|
|
41
|
-
id="capture-button"
|
|
42
|
-
icon="las la-camera"
|
|
43
|
-
tooltip="KCaptureToolbar.CAPTURE_ACTION"
|
|
44
|
-
:handler="() => this.capture()"
|
|
45
|
-
/>
|
|
46
|
-
</div>
|
|
47
|
-
</template>
|
|
48
|
-
|
|
49
|
-
<script>
|
|
50
|
-
import _ from 'lodash'
|
|
51
|
-
import KAction from '../../../core/client/components/KAction.vue'
|
|
52
|
-
import { Events, Time } from '../../../core/client'
|
|
53
|
-
import { exportFile } from 'quasar'
|
|
54
|
-
|
|
55
|
-
export default {
|
|
56
|
-
name: 'k-capture-toolbar',
|
|
57
|
-
components: {
|
|
58
|
-
KAction
|
|
59
|
-
},
|
|
60
|
-
inject: ['kActivity'],
|
|
61
|
-
data () {
|
|
62
|
-
return {
|
|
63
|
-
width: 1280,
|
|
64
|
-
height: 720,
|
|
65
|
-
resolution: undefined
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
watch: {
|
|
69
|
-
resolution: {
|
|
70
|
-
immediate: true,
|
|
71
|
-
handler (value) {
|
|
72
|
-
if (!value) this.resolution = this.getResolutions()[1]
|
|
73
|
-
else {
|
|
74
|
-
const size = _.split(this.resolution.value, 'x')
|
|
75
|
-
this.width = size[0]
|
|
76
|
-
this.height = size[1]
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
width: {
|
|
81
|
-
handler (value) {
|
|
82
|
-
if (value < 256) this.width = 256
|
|
83
|
-
if (value > 4000) this.width = 4000
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
height: {
|
|
87
|
-
handler (value) {
|
|
88
|
-
if (value < 256) this.height = 256
|
|
89
|
-
if (value > 4000) this.height = 4000
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
methods: {
|
|
94
|
-
getResolutions () {
|
|
95
|
-
return [
|
|
96
|
-
{ label: this.$t('KCaptureToolbar.SD_LABEL'), description: this.$t('KCaptureToolbar.SD_DESCRIPTION'), value: '640x480' },
|
|
97
|
-
{ label: this.$t('KCaptureToolbar.HD_LABEL'), description: this.$t('KCaptureToolbar.HD_DESCRIPTION'), value: '1280x720' },
|
|
98
|
-
{ label: this.$t('KCaptureToolbar.FHD_LABEL'), description: this.$t('KCaptureToolbar.FHD_DESCRIPTION'), value: '1920x1080' },
|
|
99
|
-
{ label: this.$t('KCaptureToolbar.QHD_LABEL'), description: this.$t('KCaptureToolbar.QHD_DESCRIPTION'), value: '2560x1440' },
|
|
100
|
-
{ label: this.$t('KCaptureToolbar.2K_LABEL'), description: this.$t('KCaptureToolbar.2K_DESCRIPTION'), value: '2048x1080' },
|
|
101
|
-
{ label: this.$t('KCaptureToolbar.4K_LABEL'), description: this.$t('KCaptureToolbar.4K_DESCRIPTION'), value: '3840x2160' }
|
|
102
|
-
]
|
|
103
|
-
},
|
|
104
|
-
async capture () {
|
|
105
|
-
// Retrieve the layers
|
|
106
|
-
const layers = this.kActivity.getContextParameters('layers').layers
|
|
107
|
-
// Retrieve the extension
|
|
108
|
-
const bbox = this.kActivity.getContextParameters('view')
|
|
109
|
-
// Setup the request url options
|
|
110
|
-
const endpoint = this.$store.get('capabilities.api.gateway') + '/capture'
|
|
111
|
-
const options = {
|
|
112
|
-
method: 'POST',
|
|
113
|
-
mode: 'cors',
|
|
114
|
-
body: JSON.stringify({
|
|
115
|
-
activity: this.kActivity.is3D() ? 'globe' : 'map',
|
|
116
|
-
layers,
|
|
117
|
-
bbox: [bbox.west, bbox.south, bbox.east, bbox.north],
|
|
118
|
-
size: { width: +this.width, height: +this.height },
|
|
119
|
-
time: Time.getCurrentTime().toISOString()
|
|
120
|
-
}),
|
|
121
|
-
headers: {
|
|
122
|
-
'Content-Type': 'application/json'
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
// Add the Authorization header if jwt is defined
|
|
126
|
-
const jwt = await this.$api.get('storage').getItem(this.$config('gatewayJwt'))
|
|
127
|
-
if (jwt) options.headers.Authorization = 'Bearer ' + jwt
|
|
128
|
-
// Perform the request
|
|
129
|
-
let dismiss = null
|
|
130
|
-
try {
|
|
131
|
-
dismiss = this.$q.notify({
|
|
132
|
-
group: 'capture',
|
|
133
|
-
icon: 'las la-hourglass-half',
|
|
134
|
-
message: this.$t('KCaptureToolbar.CAPTURING_VIEW'),
|
|
135
|
-
color: 'primary',
|
|
136
|
-
timeout: 0,
|
|
137
|
-
spinner: true
|
|
138
|
-
})
|
|
139
|
-
const response = await fetch(endpoint, options)
|
|
140
|
-
dismiss()
|
|
141
|
-
if (response.ok) {
|
|
142
|
-
const arrayBuffer = await response.arrayBuffer()
|
|
143
|
-
exportFile('capture.png', new Uint8Array(arrayBuffer))
|
|
144
|
-
} else {
|
|
145
|
-
Events.emit('error', { message: this.$t('errors.' + response.status) })
|
|
146
|
-
}
|
|
147
|
-
} catch (error) {
|
|
148
|
-
// Network error
|
|
149
|
-
dismiss()
|
|
150
|
-
Events.emit('error', { message: this.$t('errors.NETWORK_ERROR') })
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
</script>
|