From b1ffcd306215b3662e38278ee6a45bff61c296c2 Mon Sep 17 00:00:00 2001 From: Christophe Nouguier Date: Wed, 10 Feb 2021 15:38:39 +0100 Subject: [PATCH] wip: Refactor the layout using new KDK capabilities #154 --- config/default.js | 12 ++++++++++++ src/components/GlobeActivity.vue | 14 ++------------ src/components/MapActivity.vue | 13 +------------ 3 files changed, 15 insertions(+), 24 deletions(-) diff --git a/config/default.js b/config/default.js index c0147b82..85de7b4f 100644 --- a/config/default.js +++ b/config/default.js @@ -237,6 +237,12 @@ const globeEngine = { } } +const widgets = [ + { id: 'information-box', icon: 'las la-digital-tachograph', component: 'widget/KInformationBox', bind: '$data.selection' }, + { id: 'time-series', icon: 'las la-chart-line', component: 'widget/KTimeSeries', bind: '$data' }, + { id: 'mapillary-viewer', icon: 'img:statics/mapillary-icon.svg', component: 'widget/KMapillaryViewer' } +] + module.exports = { // Special alias to host loopback interface in cordova // domain: 'http://10.0.2.2:8081', @@ -365,6 +371,9 @@ module.exports = { { component: 'KTimeline' } ] }, + window: { + widgets: widgets + }, fab: { actions: [ { id: 'create-layer', icon: 'las la-plus', label: 'mixins.activity.CREATE_LAYER', handler: { name: 'onCreateLayer' } }, @@ -421,6 +430,9 @@ module.exports = { { component: 'KTimeline' } ] }, + window: { + widget: widgets + }, fab: { actions: [ { id: 'probe-location', icon: 'las la-eye-dropper', tooltip: 'mixins.activity.PROBE', handler: { name: 'onProbeLocation' } } diff --git a/src/components/GlobeActivity.vue b/src/components/GlobeActivity.vue index 419fe306..44fd308a 100644 --- a/src/components/GlobeActivity.vue +++ b/src/components/GlobeActivity.vue @@ -63,23 +63,13 @@ export default { }, methods: { async refreshActivity () { - this.clearActivity() + this.condifureActivity() const token = this.$store.get('capabilities.api.cesium.token') // Not yet ready wait for capabilities to be there if (!token) return // Wait until viewer is ready await this.initializeGlobe(token) - // Setup the panes - this.configureTopPane() - this.configureBottomPane() - this.configureRightPane() - this.configureFab() - const widgets = [ - { name: 'information-box', icon: 'las la-digital-tachograph', component: 'widget/KInformationBox', props: this.selection }, - { name: 'time-series', icon: 'las la-chart-line', component: 'widget/KTimeSeries', props: this.$data } - ] - if (this.mapillaryClientID) widgets.push({ name: 'mapillary-viewer', icon: 'img:statics/mapillary-icon.svg', component: 'widget/KMapillaryViewer' }) - this.setWindow(widgets) + // Notifie the listener utils.sendEmbedEvent('globe-ready') }, getViewKey () { diff --git a/src/components/MapActivity.vue b/src/components/MapActivity.vue index 52514a92..598e84da 100644 --- a/src/components/MapActivity.vue +++ b/src/components/MapActivity.vue @@ -85,20 +85,9 @@ export default { }, methods: { async refreshActivity () { - this.clearActivity() + this.configureActivity() // Wait until map is ready await this.initializeMap() - // Setup the panes - this.configureTopPane() - this.configureBottomPane() - this.configureRightPane() - this.configureFab() - const widgets = [ - { name: 'information-box', icon: 'las la-digital-tachograph', component: 'widget/KInformationBox', props: this.selection }, - { name: 'time-series', icon: 'las la-chart-line', component: 'widget/KTimeSeries', props: this.$data } - ] - if (this.mapillaryClientID) widgets.push({ name: 'mapillary-viewer', icon: 'img:statics/mapillary-icon.svg', component: 'widget/KMapillaryViewer' }) - this.setWindow(widgets) // Notifie the listener utils.sendEmbedEvent('map-ready') },