@eodash/eodash 5.0.0-alpha.2.9 → 5.0.0-processing

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.
Files changed (137) hide show
  1. package/README.md +1 -1
  2. package/core/client/App.vue +13 -1
  3. package/core/client/asWebComponent.js +13 -3
  4. package/core/client/components/DashboardLayout.vue +6 -2
  5. package/core/client/composables/DefineEodash.js +1 -1
  6. package/core/client/composables/EodashMap.js +349 -0
  7. package/core/client/composables/EodashProcess.js +575 -0
  8. package/core/client/composables/index.js +107 -24
  9. package/core/client/eodash.js +83 -10
  10. package/core/client/plugins/axios.js +8 -0
  11. package/core/client/plugins/index.js +2 -1
  12. package/core/client/store/Actions.js +63 -12
  13. package/core/client/store/States.js +19 -0
  14. package/core/client/store/stac.js +98 -8
  15. package/core/client/types.d.ts +25 -18
  16. package/core/client/utils/createLayers.js +313 -0
  17. package/core/client/utils/eodashSTAC.js +320 -170
  18. package/core/client/utils/helpers.js +369 -9
  19. package/core/client/utils/keys.js +2 -0
  20. package/core/client/utils/states.js +17 -0
  21. package/core/client/views/Dashboard.vue +17 -46
  22. package/core/client/vite-env.d.ts +1 -9
  23. package/dist/client/DashboardLayout-CVMJ4l8M.js +87 -0
  24. package/dist/client/DynamicWebComponent-Cv8n457T.js +88 -0
  25. package/dist/client/EodashDatePicker-VVkiPmpc.js +394 -0
  26. package/dist/client/EodashItemFilter-CugWNQ86.js +194 -0
  27. package/dist/client/EodashLayerControl-53WghA8G.js +110 -0
  28. package/dist/client/EodashMap-CQnOePpy.js +486 -0
  29. package/dist/client/EodashMapBtns-uaRwFtfB.js +66 -0
  30. package/dist/client/EodashProcess-cF0unIy8.js +1477 -0
  31. package/dist/client/ExportState-BT8MLAW7.js +644 -0
  32. package/dist/client/Footer-C6GUG84G.js +141 -0
  33. package/dist/client/Header-D2dtCWp8.js +437 -0
  34. package/dist/client/IframeWrapper-BgM9aU8f.js +28 -0
  35. package/dist/client/MobileLayout-BAo8Wr8T.js +1210 -0
  36. package/dist/client/PopUp-Bm01q7Ko.js +389 -0
  37. package/dist/client/VImg-B8AbetCE.js +384 -0
  38. package/dist/client/VMain-DnGlQUyr.js +43 -0
  39. package/dist/client/VOverlay-B8Qj7LRG.js +1453 -0
  40. package/dist/client/WidgetsContainer-CwXRRLS1.js +83 -0
  41. package/dist/client/asWebComponent-DUUoR7MZ.js +11621 -0
  42. package/dist/client/eo-dash.js +2 -6
  43. package/dist/client/forwardRefs-CZJhEAKW.js +245 -0
  44. package/dist/client/index-DlIO7sJ3.js +199 -0
  45. package/dist/client/ssrBoot-BP7SYRyC.js +22 -0
  46. package/dist/client/style.css +2 -2
  47. package/dist/client/transition-BiR8wMn1.js +37 -0
  48. package/dist/node/cli.js +4 -4
  49. package/dist/node/types.d.ts +2 -0
  50. package/dist/types/core/client/App.vue.d.ts +7 -0
  51. package/dist/types/core/client/asWebComponent.d.ts +9 -0
  52. package/dist/types/core/client/components/DashboardLayout.vue.d.ts +2 -0
  53. package/dist/types/core/client/components/DynamicWebComponent.vue.d.ts +18 -0
  54. package/dist/types/core/client/components/ErrorAlert.vue.d.ts +2 -0
  55. package/dist/types/core/client/components/Footer.vue.d.ts +2 -0
  56. package/dist/types/core/client/components/Header.vue.d.ts +2 -0
  57. package/dist/types/core/client/components/IframeWrapper.vue.d.ts +7 -0
  58. package/dist/types/core/client/components/Loading.vue.d.ts +2 -0
  59. package/dist/types/core/client/components/MobileLayout.vue.d.ts +2 -0
  60. package/dist/types/core/client/composables/DefineEodash.d.ts +2 -0
  61. package/dist/types/core/client/composables/DefineTemplate.d.ts +15 -0
  62. package/dist/types/core/client/composables/DefineWidgets.d.ts +14 -0
  63. package/dist/types/core/client/composables/EodashMap.d.ts +5 -0
  64. package/dist/types/core/client/composables/index.d.ts +30 -0
  65. package/dist/types/core/client/eodash.d.ts +8 -0
  66. package/dist/types/core/client/main.d.ts +2 -0
  67. package/dist/types/core/client/plugins/axios.d.ts +2 -0
  68. package/dist/types/core/client/plugins/index.d.ts +3 -0
  69. package/dist/types/core/client/plugins/vuetify.d.ts +82 -0
  70. package/dist/types/core/client/render.d.ts +1 -0
  71. package/dist/types/core/client/store/Actions.d.ts +12 -0
  72. package/dist/types/core/client/store/States.d.ts +22 -0
  73. package/dist/types/core/client/store/index.d.ts +2 -0
  74. package/dist/types/core/client/store/stac.d.ts +25 -0
  75. package/dist/types/core/client/types.d.ts +279 -0
  76. package/dist/types/core/client/utils/createLayers.d.ts +45 -0
  77. package/dist/types/core/client/utils/eodashSTAC.d.ts +82 -0
  78. package/dist/types/core/client/utils/helpers.d.ts +84 -0
  79. package/dist/types/core/client/utils/index.d.ts +2 -0
  80. package/dist/types/core/client/utils/keys.d.ts +6 -0
  81. package/dist/types/core/client/utils/states.d.ts +14 -0
  82. package/dist/types/core/client/views/Dashboard.vue.d.ts +9 -0
  83. package/dist/types/widgets/EodashDatePicker.vue.d.ts +7 -0
  84. package/dist/types/widgets/EodashItemFilter.vue.d.ts +42 -0
  85. package/dist/types/widgets/EodashLayerControl.vue.d.ts +11 -0
  86. package/dist/types/widgets/EodashLayoutSwitcher.vue.d.ts +9 -0
  87. package/dist/types/widgets/EodashMap.vue.d.ts +7 -0
  88. package/dist/types/widgets/EodashMapBtns.vue.d.ts +11 -0
  89. package/dist/types/widgets/EodashStacInfo.vue.d.ts +21 -0
  90. package/dist/types/widgets/EodashTools.vue.d.ts +15 -0
  91. package/dist/types/widgets/ExportState.vue.d.ts +7 -0
  92. package/dist/types/widgets/PopUp.vue.d.ts +22 -0
  93. package/dist/types/widgets/WidgetsContainer.vue.d.ts +7 -0
  94. package/package.json +58 -37
  95. package/widgets/EodashDatePicker.vue +128 -100
  96. package/widgets/EodashItemFilter.vue +100 -14
  97. package/widgets/EodashLayerControl.vue +98 -0
  98. package/widgets/EodashMap.vue +98 -122
  99. package/widgets/EodashMapBtns.vue +24 -7
  100. package/widgets/EodashProcess.vue +151 -0
  101. package/widgets/ExportState.vue +15 -11
  102. package/core/client/SuspensedDashboard.ce.vue +0 -105
  103. package/dist/client/DashboardLayout-D0ZF6V2S.js +0 -156
  104. package/dist/client/DynamicWebComponent-CPsMSBHi.js +0 -57
  105. package/dist/client/EodashDatePicker-CBQP7u2X.js +0 -252
  106. package/dist/client/EodashItemFilter-DL2ScI-5.js +0 -7671
  107. package/dist/client/EodashMap-CkKoQlmR.js +0 -86917
  108. package/dist/client/EodashMapBtns-yuO2QmiR.js +0 -36
  109. package/dist/client/ExportState-CCzOhppU.js +0 -558
  110. package/dist/client/Footer-BPAND0yG.js +0 -115
  111. package/dist/client/Header-DLhebNvG.js +0 -350
  112. package/dist/client/IframeWrapper-1GEMHlsW.js +0 -19
  113. package/dist/client/MobileLayout-mGkOYRhu.js +0 -945
  114. package/dist/client/PopUp-1d2bBFjw.js +0 -300
  115. package/dist/client/VImg-DxHcztfM.js +0 -291
  116. package/dist/client/VMain-BLX5vRRn.js +0 -39
  117. package/dist/client/VOverlay-CvrYEmLu.js +0 -967
  118. package/dist/client/WidgetsContainer-CmYjvGm7.js +0 -129
  119. package/dist/client/_commonjsHelpers-DaMA6jEr.js +0 -8
  120. package/dist/client/asWebComponent-B91uK0U7.js +0 -20361
  121. package/dist/client/basedecoder-DHcBySSe-BmCFNFnw.js +0 -88
  122. package/dist/client/decoder-CP4lv0Kb-B6yqkcfC.js +0 -10
  123. package/dist/client/deflate-BXt-9JA_-CWfClgpK.js +0 -10
  124. package/dist/client/eodashSTAC-DBjqe_Ho.js +0 -2788
  125. package/dist/client/eox-stacinfo-l7ALSV90.js +0 -13969
  126. package/dist/client/forwardRefs-BJJiadQP.js +0 -185
  127. package/dist/client/index-Q-bHLjxx.js +0 -153
  128. package/dist/client/jpeg-BAgeD1d3-oeHbFPUL.js +0 -514
  129. package/dist/client/lerc-DzVumYtB-P-KXC0TO.js +0 -1027
  130. package/dist/client/lzw-LAGDNbSC-DkP96qO9.js +0 -84
  131. package/dist/client/packbits-BlDR4Kj5-C66n1-zr.js +0 -24
  132. package/dist/client/pako.esm-CB1uQYY0-DB0PYm1P.js +0 -1081
  133. package/dist/client/raw-CMGvRjfu-BRi6E4i1.js +0 -9
  134. package/dist/client/ssrBoot-yo11mybw.js +0 -17
  135. package/dist/client/transition-CSJhuYGK.js +0 -34
  136. package/dist/client/webfontloader-qotgY98I.js +0 -435
  137. package/dist/client/webimage-BM_pbLN3-L2cGWK5l.js +0 -19
@@ -0,0 +1,98 @@
1
+ <template>
2
+ <span class="d-flex flex-column fill-height overflow-auto">
3
+ <eox-layercontrol
4
+ v-if="showControls"
5
+ :for="mapElement"
6
+ .tools="['datetime', 'info', 'config', 'legend', 'opacity']"
7
+ @datetime:updated="debouncedHandleDateTime"
8
+ class="fill-height"
9
+ toolsAsList="true"
10
+ ref="eoxLayercontrol"
11
+ />
12
+ </span>
13
+ </template>
14
+ <script setup>
15
+ import "@eox/layercontrol";
16
+ import "@eox/jsonform";
17
+ import "@eox/timecontrol";
18
+ import "color-legend-element";
19
+
20
+ import { computed, ref } from "vue";
21
+ import { mapEl, mapCompareEl } from "@/store/States";
22
+ import { getColFromLayer } from "@/utils/helpers";
23
+ import { eodashCollections, eodashCompareCollections } from "@/utils/states";
24
+ import { storeToRefs } from "pinia";
25
+ import { useSTAcStore } from "@/store/stac";
26
+
27
+ const props = defineProps({
28
+ map: {
29
+ type: String,
30
+ default: "first",
31
+ },
32
+ });
33
+
34
+ const { selectedCompareStac, selectedStac } = storeToRefs(useSTAcStore());
35
+
36
+ const showControls = computed(() => {
37
+ if (props.map === "second") {
38
+ return mapCompareEl.value !== null && selectedCompareStac.value !== null;
39
+ }
40
+ return mapEl.value !== null && selectedStac.value !== null;
41
+ });
42
+
43
+ const eodashCols =
44
+ props.map === "second" ? eodashCompareCollections : eodashCollections;
45
+ const mapElement = props.map === "second" ? mapCompareEl : mapEl;
46
+
47
+ /** @type { import("vue").Ref<HTMLElement & Record<string,any> | null>} */
48
+ const eoxLayercontrol = ref(null);
49
+
50
+ /** @param {CustomEvent<{layer:import('ol/layer').Layer; datetime:string;}>} evt */
51
+ const handleDatetimeUpdate = async (evt) => {
52
+ const { layer, datetime } = evt.detail;
53
+
54
+ const ec = await getColFromLayer(eodashCols, layer);
55
+
56
+ /** @type {Record<string,any>[] | undefined} */
57
+ let updatedLayers = [];
58
+
59
+ if (ec) {
60
+ await ec.fetchCollection();
61
+ updatedLayers = await ec.updateLayerJson(
62
+ datetime,
63
+ layer.get("id"),
64
+ props.map,
65
+ );
66
+ }
67
+ /** @type {Record<String,any>[] | undefined} */
68
+ const dataLayers = updatedLayers?.find(
69
+ (l) => l?.properties?.id === "AnalysisGroup",
70
+ )?.layers;
71
+
72
+ if (dataLayers?.length) {
73
+ // Add expand to all analysis layers
74
+ dataLayers?.forEach((dl) => {
75
+ dl.properties.layerControlExpand = true;
76
+ dl.properties.layerControlToolsExpand = true;
77
+ });
78
+ // assign layers to the map
79
+ /** @type {HTMLElement & Record<string,any>} */
80
+ (mapElement.value).layers = updatedLayers;
81
+ }
82
+ };
83
+
84
+ // ----- debounce logic
85
+ /** @type {NodeJS.Timeout | undefined} */
86
+ let timeout;
87
+
88
+ /**
89
+ * @param {CustomEvent<{layer:import('ol/layer').Layer; datetime:string;}>} evt
90
+ **/
91
+ const debouncedHandleDateTime = (evt) => {
92
+ clearTimeout(timeout);
93
+ timeout = setTimeout(() => {
94
+ handleDatetimeUpdate(evt);
95
+ }, 500);
96
+ };
97
+ // ------
98
+ </script>
@@ -1,55 +1,85 @@
1
1
  <template>
2
- <eox-map
2
+ <eox-map-compare
3
3
  class="fill-height fill-width overflow-none"
4
- ref="eoxMap"
5
- :config="eoxMapConfig"
6
- />
4
+ .enabled="showCompare"
5
+ >
6
+ <eox-map
7
+ class="fill-height fill-width overflow-none"
8
+ slot="first"
9
+ ref="eoxMap"
10
+ .config="eoxMapConfig"
11
+ id="main"
12
+ .layers="eoxMapLayers"
13
+ />
14
+ <eox-map
15
+ class="fill-height fill-width overflow-none"
16
+ id="compare"
17
+ slot="second"
18
+ ref="compareMap"
19
+ .config="eoxCompareMapConfig"
20
+ .layers="eoxMapCompareLayers"
21
+ />
22
+ </eox-map-compare>
7
23
  </template>
8
24
  <script setup>
9
- import { inject, onMounted, onUnmounted, reactive, ref, watch } from "vue";
10
- import { toAbsolute } from "stac-js/src/http.js";
11
- import { EodashCollection, extractCollectionUrls } from "@/utils/eodashSTAC";
12
- import { eodashKey } from "@/utils/keys";
13
- import { datetime, mapPosition } from "@/store/States";
25
+ import "@eox/map";
26
+ import "@eox/map/src/plugins/advancedLayersAndSources";
27
+ import { computed, onMounted, ref } from "vue";
28
+ import { datetime, mapEl, mapPosition, mapCompareEl } from "@/store/States";
14
29
  import { storeToRefs } from "pinia";
15
30
  import { useSTAcStore } from "@/store/stac";
16
- import "@eox/map";
17
- import "@eox/map/dist/eox-map-advanced-layers-and-sources.js";
31
+ import { eodashCollections, eodashCompareCollections } from "@/utils/states";
32
+ import { useHandleMapMoveEnd, useInitMap } from "@/composables/EodashMap";
18
33
 
19
- const eodashConfig = /** @type {import("@/types").Eodash} */ (
20
- inject(eodashKey)
21
- );
34
+ const props = defineProps({
35
+ enableCompare: {
36
+ type: Boolean,
37
+ default: false,
38
+ },
39
+ });
40
+
41
+ /** @type {import("vue").Ref<Record<string,any>[]>} */
42
+ const eoxMapLayers = ref([
43
+ {
44
+ type: "Tile",
45
+ source: { type: "OSM" },
46
+ properties: {
47
+ id: "osm",
48
+ title: "Background",
49
+ },
50
+ },
51
+ ]);
52
+
53
+ /** @type {import("vue").Ref<Record<string,any>[]>} */
54
+ const eoxMapCompareLayers = ref([
55
+ {
56
+ type: "Tile",
57
+ source: { type: "OSM" },
58
+ properties: {
59
+ id: "osm",
60
+ title: "Background",
61
+ },
62
+ },
63
+ ]);
22
64
 
23
- /** @type {import("vue").Ref<(HTMLElement & Record<string,unknown>) | null>} */
65
+ /** @type {import("vue").Ref<(HTMLElement & Record<string,any> & { map:import("ol").Map }) | null>} */
24
66
  const eoxMap = ref(null);
67
+ /** @type {import("vue").Ref<(HTMLElement & Record<string,any> & { map:import("ol").Map }) | null>} */
68
+ const compareMap = ref(null);
25
69
 
26
- const eoxMapConfig = reactive({
70
+ const eoxMapConfig = {
27
71
  /** @type {(number|undefined)[] | undefined} */
28
72
  center: [15, 48],
29
73
  /** @type {number | undefined} */
30
74
  zoom: 4,
31
- // TODO: we should probably introduce some way of defining
32
- layers: [
33
- {
34
- type: "Vector",
35
- source: {
36
- type: "Vector",
37
- url: "https://openlayers.org/data/vector/ecoregions.json",
38
- format: "GeoJSON",
39
- },
40
- },
41
- {
42
- type: "Tile",
43
- properties: {
44
- id: "osm",
45
- title: "Background",
46
- },
47
- source: {
48
- type: "OSM",
49
- },
50
- },
51
- ],
52
- });
75
+ };
76
+
77
+ const eoxCompareMapConfig = {
78
+ /** @type {(number|undefined)[] | undefined} */
79
+ center: [15, 48],
80
+ /** @type {number | undefined} */
81
+ zoom: 4,
82
+ };
53
83
 
54
84
  // Check if selected indicator was already set in store
55
85
  if (mapPosition && mapPosition.value && mapPosition.value.length === 3) {
@@ -58,96 +88,42 @@ if (mapPosition && mapPosition.value && mapPosition.value.length === 3) {
58
88
  eoxMapConfig.center = [mapPosition.value?.[0], mapPosition.value[1]];
59
89
  eoxMapConfig.zoom = mapPosition.value[2];
60
90
  }
91
+ const { selectedCompareStac } = storeToRefs(useSTAcStore());
92
+ const showCompare = computed(() =>
93
+ props.enableCompare && !!selectedCompareStac.value ? "" : "first",
94
+ );
61
95
 
62
- /** @type {import("openlayers").EventsListenerFunctionType} */
63
- const handleMoveEnd = (evt) => {
64
- const map = /** @type {import("openlayers").Map | undefined} */ (
65
- /** @type {any} */ (evt).map
66
- );
67
- /*
68
- const currentProj = map?.getView().getProjection();
69
- const transFunc = getTransform(currentProj?.getCode(), 'EPSG:4326');
70
- const [x, y] = transFunc(map?.getView().getCenter() ?? [0, 0], undefined, undefined);
71
- */
72
- const [x, y] = map?.getView().getCenter() ?? [0, 0];
73
- const z = map?.getView().getZoom();
74
- if (!Number.isNaN(x) && !Number.isNaN(y) && !Number.isNaN(z)) {
75
- mapPosition.value = [x, y, z];
76
- }
77
- };
78
-
79
- const store = useSTAcStore();
96
+ useHandleMapMoveEnd(eoxMap, mapPosition);
80
97
 
81
98
  onMounted(() => {
82
- /** @type {import('ol/Map').default} */
83
- (eoxMap.value?.map)?.on("moveend", handleMoveEnd);
84
-
85
- const { selectedStac } = storeToRefs(store);
99
+ const { selectedCompareStac, selectedStac } = storeToRefs(useSTAcStore());
100
+ // assign map Element state to eox map
101
+ mapEl.value = eoxMap.value;
86
102
 
87
- watch(
88
- [selectedStac, datetime],
89
- async ([updatedStac, updatedTime]) => {
90
- if (updatedStac) {
91
- const parentCollUrl = toAbsolute(
92
- `./${updatedStac.id}/collection.json`,
93
- eodashConfig.stacEndpoint,
94
- );
95
- const collectionUrls = extractCollectionUrls(
96
- selectedStac.value,
97
- parentCollUrl,
98
- );
99
- /** @type {import("@/utils/eodashSTAC").EodashCollection[]} */
100
- const eodashCollections = [];
101
- collectionUrls.forEach((cu) => {
102
- eodashCollections.push(new EodashCollection(cu));
103
- });
104
- const layersCollection = [];
105
- for (let idx = 0; idx < eodashCollections.length; idx++) {
106
- const ec = eodashCollections[idx];
107
- let layers;
108
- if (updatedTime) {
109
- layers = await ec.createLayersJson(new Date(updatedTime));
110
- } else {
111
- layers = await ec.createLayersJson();
112
- }
113
- if (layers) {
114
- layersCollection.push(...layers);
115
- }
116
- }
117
- // TODO: add base layers and overlays as defined in the top collection / indicator
118
- // Probably best also to introduce background and overlay groups
119
- // For now adding OSM as background
120
- layersCollection.push({
121
- type: "Tile",
122
- properties: {
123
- id: "osm",
124
- title: "Background",
125
- },
126
- source: {
127
- type: "OSM",
128
- },
129
- });
103
+ if (props.enableCompare) {
104
+ mapCompareEl.value = compareMap.value;
105
+ }
130
106
 
131
- // TODO: we can check if the collection / indicator has a specific
132
- // projection it wants to be displayed in the map we can register
133
- // and set the attribute here, e.g. like following
134
- /*
135
- (el)?.registerProjection(
136
- 'EPSG:3031','+proj=stere +lat_0=-90 +lat_ts=-71 +lon_0=0 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs +type=crs'
137
- );
138
- (el)?.projection = "EPSG:3031";
139
- */
107
+ if (props.enableCompare) {
108
+ useInitMap(
109
+ compareMap,
110
+ //@ts-expect-error todo selectedStac as collection
111
+ selectedCompareStac,
112
+ eodashCompareCollections,
113
+ datetime,
114
+ eoxMapCompareLayers,
115
+ eoxMap,
116
+ );
117
+ }
140
118
 
141
- /** @type {any} */
142
- (eoxMap.value).layers = layersCollection;
143
- }
144
- },
145
- { immediate: true },
119
+ useInitMap(
120
+ eoxMap,
121
+ //@ts-expect-error todo selectedStac as collection
122
+ selectedStac,
123
+ eodashCollections,
124
+ datetime,
125
+ eoxMapLayers,
126
+ compareMap,
146
127
  );
147
128
  });
148
-
149
- onUnmounted(() => {
150
- /** @type {import('ol/Map').default} */
151
- (eoxMap.value?.map)?.un("moveend", handleMoveEnd);
152
- });
153
129
  </script>
@@ -1,22 +1,38 @@
1
1
  <template>
2
- <div ref="rootRef" class="d-flex align-end justify-end my-3 pa-2">
2
+ <div ref="rootRef" class="d-flex flex-column align-end justify-end my-3 pa-2">
3
3
  <v-btn
4
+ v-if="exportMap"
4
5
  class="map-btn"
5
6
  :icon="[mdiMapPlus]"
6
7
  @click="showMapState = !showMapState"
7
8
  />
8
- <ExportState :header="header" :code="code" v-model="showMapState" />
9
+ <ExportState v-if="exportMap" v-model="showMapState" />
10
+ <v-btn
11
+ class="map-btn"
12
+ :icon="[mdiEarthBox]"
13
+ v-if="changeProjection && !!availableMapProjection"
14
+ @click="changeMapProjection(availableMapProjection)"
15
+ />
9
16
  </div>
10
17
  </template>
11
18
  <script setup>
12
19
  import { makePanelTransparent } from "@/composables";
13
- import { mdiMapPlus } from "@mdi/js";
20
+ import { changeMapProjection } from "@/store/Actions";
21
+ import { availableMapProjection } from "@/store/States";
22
+ import { mdiEarthBox, mdiMapPlus } from "@mdi/js";
14
23
  import ExportState from "^/ExportState.vue";
15
24
  import { ref } from "vue";
16
- const header = "Export Map";
17
- const code = `<h2>
18
- code example
19
- </h2>`;
25
+
26
+ defineProps({
27
+ exportMap: {
28
+ type: Boolean,
29
+ default: true,
30
+ },
31
+ changeProjection: {
32
+ type: Boolean,
33
+ default: true,
34
+ },
35
+ });
20
36
 
21
37
  const showMapState = ref(false);
22
38
 
@@ -29,5 +45,6 @@ makePanelTransparent(rootRef);
29
45
  width: 36px;
30
46
  height: 36px;
31
47
  border-radius: 25%;
48
+ margin: 4px;
32
49
  }
33
50
  </style>
@@ -0,0 +1,151 @@
1
+ <template>
2
+ <div class="process-container">
3
+ <eox-jsonform
4
+ v-if="jsonformSchema"
5
+ ref="jsonformEl"
6
+ .schema="jsonformSchema"
7
+ ></eox-jsonform>
8
+ <eox-chart
9
+ class="chart"
10
+ v-if="isProcessed && chartSpec"
11
+ .spec="toRaw(chartSpec)"
12
+ .dataValues="toRaw(chartData)"
13
+ />
14
+ <span>
15
+ <v-btn
16
+ v-if="!autoExec"
17
+ :loading="loading"
18
+ style="float: right; margin-right: 20px"
19
+ @click="startProcess"
20
+ color="primary"
21
+ >
22
+ Execute
23
+ </v-btn>
24
+ </span>
25
+ </div>
26
+ </template>
27
+ <script setup>
28
+ import "@eox/chart";
29
+ import "@eox/drawtools";
30
+ import "@eox/jsonform";
31
+
32
+ import { onMounted, ref, toRaw } from "vue";
33
+ import { useSTAcStore } from "@/store/stac";
34
+ import { storeToRefs } from "pinia";
35
+ import { mapEl } from "@/store/States";
36
+ import { useOnLayersUpdate } from "@/composables";
37
+ import { useEventBus } from "@vueuse/core";
38
+ import { eoxLayersKey } from "@/utils/keys";
39
+ import {
40
+ handleProcesses,
41
+ initProcess,
42
+ useAutoExec,
43
+ } from "@/composables/EodashProcess";
44
+
45
+ const layersEvents = useEventBus(eoxLayersKey);
46
+ const { selectedStac } = storeToRefs(useSTAcStore());
47
+
48
+ /** @type {import("vue").Ref<import("vega").Spec|null>} */
49
+ const chartSpec = ref(null);
50
+
51
+ /** @type {import("vue").Ref<Record<string,any>|null>} */
52
+ const chartData = ref(null);
53
+ const isProcessed = ref(false);
54
+
55
+ /** @type {import("vue").Ref<Record<string,any>|null>} */
56
+ const jsonformSchema = ref(null);
57
+
58
+ /** @type {import("vue").Ref<import("@eox/jsonform").EOxJSONForm | null>} */
59
+ const jsonformEl = ref(null);
60
+ const loading = ref(false);
61
+
62
+ const autoExec = ref(false);
63
+
64
+ const isPolling = ref(false);
65
+
66
+ onMounted(async () => {
67
+ // wait for the layers to be rendered
68
+ if (mapEl.value?.layers.length <= 1) {
69
+ layersEvents.once(async () => {
70
+ await initProcess({
71
+ //@ts-expect-error TODO
72
+ selectedStac,
73
+ jsonformEl,
74
+ jsonformSchema,
75
+ chartSpec,
76
+ isProcessed,
77
+ loading,
78
+ isPolling,
79
+ });
80
+ });
81
+ } else {
82
+ await initProcess({
83
+ //@ts-expect-error TODO
84
+ selectedStac,
85
+ jsonformEl,
86
+ jsonformSchema,
87
+ chartSpec,
88
+ isProcessed,
89
+ loading,
90
+ isPolling,
91
+ });
92
+ }
93
+ });
94
+
95
+ useOnLayersUpdate(
96
+ async () =>
97
+ await initProcess({
98
+ //@ts-expect-error TODO
99
+ selectedStac,
100
+ jsonformEl,
101
+ jsonformSchema,
102
+ chartSpec,
103
+ isProcessed,
104
+ loading,
105
+ isPolling,
106
+ }),
107
+ );
108
+
109
+ const startProcess = async () => {
110
+ const errors = jsonformEl.value?.editor.validate();
111
+ if (errors?.length) {
112
+ console.warn("[eodash] Form validation failed", errors);
113
+ return;
114
+ }
115
+ await handleProcesses({
116
+ jsonformEl,
117
+ jsonformSchema,
118
+ chartSpec,
119
+ chartData,
120
+ loading,
121
+ //@ts-expect-error TODO
122
+ selectedStac,
123
+ isProcessed,
124
+ isPolling,
125
+ });
126
+ isProcessed.value = true;
127
+ };
128
+ useAutoExec(autoExec, jsonformEl, jsonformSchema, isProcessed, startProcess);
129
+ </script>
130
+ <style>
131
+ .chart {
132
+ height: 400px;
133
+ width: 100%;
134
+ }
135
+
136
+ .process-container {
137
+ height: 100%;
138
+ overflow-y: auto;
139
+ }
140
+
141
+ .slide-enter-active,
142
+ .slide-leave-active {
143
+ transition: all 0.2s;
144
+ max-height: 30px;
145
+ }
146
+
147
+ .slide-enter,
148
+ .slide-leave-to {
149
+ max-height: 0px;
150
+ }
151
+ </style>
@@ -1,17 +1,17 @@
1
1
  <template>
2
2
  <PopUp v-model="dialog">
3
- <v-card>
4
- <v-card-title class="bg-primary">
3
+ <v-card style="max-height: 498px">
4
+ <v-card-title class="bg-primary" style="max-height: 49px">
5
5
  <h5 class="text-h5">Storytelling map configuration</h5>
6
6
  </v-card-title>
7
7
 
8
- <v-card-text class="py-5">
8
+ <v-card-text class="py-5 overflow-auto" style="height: 400px">
9
9
  <p class="text-body-2">
10
- Copy and paste this code into the map layers field of the storytelling
11
- editor:
10
+ Copy and paste this code into the map <b>layers field</b> of the
11
+ storytelling editor:
12
12
  </p>
13
13
  <div class="pa-3 code-block">
14
- {{ getLayers() }}
14
+ {{ removeUnneededProperties(getLayers()) }}
15
15
  </div>
16
16
 
17
17
  <div style="position: absolute; bottom: 15px">
@@ -41,7 +41,7 @@
41
41
 
42
42
  <v-divider></v-divider>
43
43
 
44
- <v-card-actions>
44
+ <v-card-actions style="max-height: 49px">
45
45
  <v-spacer></v-spacer>
46
46
  <v-btn variant="text" @click="dialog = !dialog"> Close </v-btn>
47
47
  </v-card-actions>
@@ -55,6 +55,7 @@ import { copyToClipBoard } from "@/utils";
55
55
  import { computed, ref } from "vue";
56
56
  import { getLayers as getLayerAction } from "@/store/Actions";
57
57
  import { mapPosition } from "@/store/States";
58
+ import { removeUnneededProperties } from "@/utils/helpers";
58
59
 
59
60
  const dialog = defineModel({ type: Boolean, required: true, default: false });
60
61
 
@@ -88,19 +89,20 @@ const copyBtns = [
88
89
 
89
90
  const mapStepCode = computed(() => {
90
91
  const [x, y, z] = mapPosition.value;
91
- const preTag = "### <!--{ layers=";
92
+ const preTag = "### <!" + "--{ layers=";
92
93
  const endTag = `zoom="${z}" center=[${[x, y]}] animationOptions={duration:500}}-->
93
94
  #### Tour step title
94
95
  Text describing the current step of the tour and why it is interesting what the map shows currently
95
96
  `;
96
- return `${preTag}'${JSON.stringify(props.getLayers())}' ${endTag}`;
97
+ return `${preTag}'${JSON.stringify(removeUnneededProperties(props.getLayers()))}' ${endTag}`;
97
98
  });
98
99
  const mapEntryCode = computed(() => {
99
100
  const [x, y, z] = mapPosition.value;
100
101
  const preTag =
101
- '## Map Example <!--{as="eox-map" style="width: 100%; height: 500px;" layers=';
102
+ "## Map Example <!" +
103
+ '--{as="eox-map" style="width: 100%; height: 500px;" layers=';
102
104
  const endTag = `zoom="${z}" center=[${[x, y]}] }-->`;
103
- return `${preTag}'${JSON.stringify(props.getLayers())}' ${endTag}`;
105
+ return `${preTag}'${JSON.stringify(removeUnneededProperties(props.getLayers()))}' ${endTag}`;
104
106
  });
105
107
  </script>
106
108
  <style scoped>
@@ -108,5 +110,7 @@ const mapEntryCode = computed(() => {
108
110
  background-color: #ddd;
109
111
  font-family: monospace;
110
112
  font-size: small;
113
+ max-height: 200px;
114
+ overflow-y: auto;
111
115
  }
112
116
  </style>