@eodash/eodash 5.0.0-alpha.2.1 → 5.0.0-alpha.2.11

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 (138) hide show
  1. package/README.md +36 -3
  2. package/core/client/App.vue +26 -0
  3. package/core/client/SuspensedDashboard.ce.vue +105 -0
  4. package/core/client/asWebComponent.d.ts +23 -0
  5. package/core/client/asWebComponent.js +12 -0
  6. package/core/client/components/DashboardLayout.vue +77 -0
  7. package/core/client/components/DynamicWebComponent.vue +68 -0
  8. package/core/client/components/ErrorAlert.vue +36 -0
  9. package/core/{components → client/components}/Footer.vue +34 -15
  10. package/core/client/components/Header.vue +19 -0
  11. package/core/client/components/IframeWrapper.vue +11 -0
  12. package/core/client/components/Loading.vue +37 -0
  13. package/core/client/components/MobileLayout.vue +109 -0
  14. package/core/client/composables/DefineEodash.js +67 -0
  15. package/core/client/composables/DefineWidgets.js +161 -0
  16. package/core/client/composables/index.js +155 -0
  17. package/core/client/eodash.js +129 -0
  18. package/core/client/main.js +2 -0
  19. package/core/client/plugins/index.js +20 -0
  20. package/core/client/plugins/vuetify.js +35 -0
  21. package/core/client/render.js +12 -0
  22. package/core/client/store/Actions.js +38 -0
  23. package/core/client/store/States.js +24 -0
  24. package/core/client/store/index.js +20 -0
  25. package/core/client/store/stac.js +81 -0
  26. package/core/client/types.d.ts +287 -0
  27. package/core/client/utils/createLayers.js +131 -0
  28. package/core/client/utils/eodashSTAC.js +259 -0
  29. package/core/client/utils/helpers.js +152 -0
  30. package/core/client/utils/index.js +51 -0
  31. package/core/{utils → client/utils}/keys.js +2 -2
  32. package/core/client/views/Dashboard.vue +116 -0
  33. package/core/client/vite-env.d.ts +39 -0
  34. package/dist/client/DashboardLayout-D5c2wAGC.js +156 -0
  35. package/dist/{DynamicWebComponent-BrHVTesn.js → client/DynamicWebComponent-CBuMCUIj.js} +11 -11
  36. package/dist/client/EodashDatePicker-D0qdMMTE.js +252 -0
  37. package/dist/client/EodashItemFilter-CTRnGRRS.js +10067 -0
  38. package/dist/client/EodashLayerControl-Bpm0BwcW.js +31499 -0
  39. package/dist/client/EodashMap-DaMtQefq.js +114367 -0
  40. package/dist/client/EodashMapBtns-B5z8h8mr.js +50 -0
  41. package/dist/client/ExportState-Bp3n6gba.js +558 -0
  42. package/dist/client/Footer-BROOTKhV.js +115 -0
  43. package/dist/client/Header-C_fKVTsg.js +350 -0
  44. package/dist/{IframeWrapper-Dd9zrX9s.js → client/IframeWrapper-32Q3DBYr.js} +4 -4
  45. package/dist/client/MobileLayout-TVGrYpNT.js +945 -0
  46. package/dist/client/PopUp-BJzmeeKG.js +300 -0
  47. package/dist/client/VImg-BT4Vb0UT.js +291 -0
  48. package/dist/client/VMain-BDVUXNEk.js +39 -0
  49. package/dist/client/VOverlay-Ck_4Lxcb.js +972 -0
  50. package/dist/{WidgetsContainer-DxfCu0I3.js → client/WidgetsContainer-DjjX_n1U.js} +25 -18
  51. package/dist/client/asWebComponent-wn9bbgx9.js +20404 -0
  52. package/dist/{basedecoder-Qm25PwVp-CHo5Pomv.js → client/basedecoder-DHcBySSe-BmCFNFnw.js} +5 -6
  53. package/dist/{decoder-kAoyGIq9-BBR5CgzS.js → client/decoder-Cth6J7EK-CLlwAswr.js} +1 -1
  54. package/dist/client/deflate-BXt-9JA_-CWfClgpK.js +10 -0
  55. package/dist/client/eo-dash.js +6 -0
  56. package/dist/client/eox-stacinfo-l7ALSV90.js +13969 -0
  57. package/dist/client/forwardRefs--PLRH8zp.js +185 -0
  58. package/dist/client/helpers-CoqJPYdE.js +1391 -0
  59. package/dist/{index-DTkOfh2g.js → client/index-Dt0NRXIq.js} +21 -20
  60. package/dist/{jpeg-DNfUpLwy-Fjan-04T.js → client/jpeg-BAgeD1d3-oeHbFPUL.js} +5 -6
  61. package/dist/{lerc-C9VL9kri-cIdbW0sg.js → client/lerc-BgbQqdFI-CCpDWUne.js} +37 -39
  62. package/dist/{lzw-BOMhmEDy-Dboc93VO.js → client/lzw-LAGDNbSC-DkP96qO9.js} +1 -1
  63. package/dist/{packbits-DaUD6MLm-Bu1PoTGa.js → client/packbits-BlDR4Kj5-C66n1-zr.js} +1 -1
  64. package/dist/{pako.esm-C3kYPGGQ-BMki8cQY.js → client/pako.esm-CB1uQYY0-DB0PYm1P.js} +6 -12
  65. package/dist/{raw-CcGKjn8q-DFOt-i8n.js → client/raw-CMGvRjfu-BRi6E4i1.js} +1 -1
  66. package/dist/{ssrBoot-D-b4-M19.js → client/ssrBoot-DjZDIkG_.js} +1 -1
  67. package/dist/client/style.css +5 -0
  68. package/dist/client/transition-C8OQt_kp.js +34 -0
  69. package/dist/{webfontloader-CyOFAuFB.js → client/webfontloader-qotgY98I.js} +56 -92
  70. package/dist/{webimage-D2c098k3-DLj1LQxB.js → client/webimage-BM_pbLN3-L2cGWK5l.js} +1 -1
  71. package/dist/node/cli.js +20 -0
  72. package/dist/node/main.js +2 -0
  73. package/dist/node/types.d.ts +47 -0
  74. package/package.json +57 -51
  75. package/widgets/EodashDatePicker.vue +146 -40
  76. package/widgets/EodashItemFilter.vue +81 -41
  77. package/widgets/EodashLayerControl.vue +16 -0
  78. package/widgets/EodashMap.vue +186 -42
  79. package/widgets/EodashMapBtns.vue +50 -0
  80. package/widgets/ExportState.vue +112 -0
  81. package/widgets/PopUp.vue +40 -0
  82. package/widgets/WidgetsContainer.vue +47 -27
  83. package/bin/app.js +0 -22
  84. package/bin/cli.js +0 -62
  85. package/bin/main.js +0 -9
  86. package/bin/serverConfig.js +0 -165
  87. package/bin/types.d.ts +0 -52
  88. package/bin/utils.js +0 -103
  89. package/core/App.vue +0 -19
  90. package/core/SuspensedDashboard.ce.vue +0 -65
  91. package/core/asWebComponent.d.ts +0 -18
  92. package/core/asWebComponent.js +0 -12
  93. package/core/components/DashboardLayout.vue +0 -44
  94. package/core/components/DynamicWebComponent.vue +0 -68
  95. package/core/components/Header.vue +0 -14
  96. package/core/components/IframeWrapper.vue +0 -11
  97. package/core/components/Loading.vue +0 -27
  98. package/core/components/MobileLayout.vue +0 -49
  99. package/core/composables/DefineEodash.js +0 -57
  100. package/core/composables/DefineWidgets.js +0 -129
  101. package/core/composables/index.js +0 -219
  102. package/core/eodash.js +0 -100
  103. package/core/main.js +0 -2
  104. package/core/plugins/index.js +0 -18
  105. package/core/plugins/vuetify.js +0 -30
  106. package/core/render.js +0 -13
  107. package/core/store/Actions.js +0 -0
  108. package/core/store/States.js +0 -21
  109. package/core/store/index.js +0 -17
  110. package/core/store/stac.js +0 -63
  111. package/core/types.d.ts +0 -356
  112. package/core/utils/eodashSTAC.js +0 -164
  113. package/core/utils/helpers.js +0 -40
  114. package/core/utils/index.js +0 -28
  115. package/core/views/Dashboard.vue +0 -59
  116. package/core/vite-env.d.ts +0 -31
  117. package/dist/DashboardLayout-Dp8AnYD9.js +0 -141
  118. package/dist/EodashDatePicker-D_udZ26j.js +0 -1645
  119. package/dist/EodashItemFilter-BLAGx2UD.js +0 -51
  120. package/dist/EodashMap-Bxl_aqY2.js +0 -53405
  121. package/dist/Footer-AohCH8U7.js +0 -118
  122. package/dist/Header-DC50S6GR.js +0 -609
  123. package/dist/MobileLayout-CgToA7Gp.js +0 -523
  124. package/dist/VBtn-Bz7ruRUg.js +0 -1106
  125. package/dist/VMain-BHfWJU2j.js +0 -35
  126. package/dist/asWebComponent-C8rb3b1D.js +0 -11323
  127. package/dist/color-DpYEub1f.js +0 -115
  128. package/dist/deflate-Be2Arps5-hDqMz3RA.js +0 -10
  129. package/dist/dimensions-CJaGeSrj.js +0 -53
  130. package/dist/eo-dash.js +0 -6
  131. package/dist/eox-itemfilter-DcQkRD2l.js +0 -7537
  132. package/dist/eox-map-BJ9SIixs.js +0 -36205
  133. package/dist/eox-stacinfo-B-YrT7Ug.js +0 -13698
  134. package/dist/forwardRefs-Bxeu9Obx.js +0 -142
  135. package/dist/index-Sa2Vg_gx.js +0 -65
  136. package/dist/style.css +0 -5
  137. /package/dist/{.gitkeep → client/.gitkeep} +0 -0
  138. /package/dist/{_commonjsHelpers-DaMA6jEr.js → client/_commonjsHelpers-DaMA6jEr.js} +0 -0
@@ -1,219 +0,0 @@
1
- // functions of this folder can only be consumed inside setup stores,
2
- // setup functions or vue composition api components
3
-
4
- import { reactive } from "vue";
5
- import { currentUrl, indicator, mapPosition } from "@/store/States";
6
- import eodash from "@/eodash";
7
- import { useTheme } from "vuetify/lib/framework.mjs";
8
- import { onMounted, watch } from "vue";
9
-
10
- /**
11
- * Creates an absolute URL from a relative link and assignes it to `currentUrl`
12
- * @param {string} [rel = '']
13
- * @param {string} [base = eodash.stacEndpoint] - base URL, default value is the root stac catalog
14
- * @returns {import('vue').Ref<string>} - returns `currentUrl`
15
- * @see {@link '@/store/States.js'}
16
- */
17
- export const useAbsoluteUrl = (rel = "", base = eodash.stacEndpoint) => {
18
- if (!rel || rel.includes("http")) {
19
- currentUrl.value = base;
20
- return currentUrl;
21
- }
22
-
23
- const st = base.split("/");
24
- const arr = rel.split("/");
25
- st.pop();
26
-
27
- for (let i = 0; i < arr.length; i++) {
28
- if (arr[i] == ".") continue;
29
- if (arr[i] == "..") st.pop();
30
- else st.push(arr[i]);
31
- }
32
-
33
- currentUrl.value = st.join("/");
34
- return currentUrl;
35
- };
36
-
37
- /**
38
- * Adds slide in and out functionality to Elements
39
- * @param {import('vue').Ref<HTMLElement[]|null>} elements - elements to add the functionality to
40
- * @param {import("@/types").Widget[]} configs
41
- */
42
- export const useSlidePanels = (elements, configs) => {
43
- /**
44
- * Sliding direction
45
- */
46
- const slideDirs = configs.map((m) =>
47
- m.layout.x == 0
48
- ? "left"
49
- : m.layout.x == 12 - m.layout.w
50
- ? "right"
51
- : m.layout.y < 6
52
- ? "up"
53
- : "down"
54
- );
55
-
56
- /**
57
- * Array of sliding button's style and icons
58
- */
59
- const slideBtns = slideDirs.map((dir, idx) => {
60
- const btn = reactive({
61
- style: {},
62
- icon: { in: "", out: "" },
63
- active: false,
64
- enabled: true,
65
- });
66
- if (configs[idx].slidable === false) {
67
- btn.enabled = false;
68
- return btn;
69
- }
70
-
71
- switch (dir) {
72
- case "left":
73
- btn.style = { top: "50%", right: "-11%" };
74
- btn.icon.in = "mdi-chevron-double-right";
75
- btn.icon.out = "mdi-chevron-double-left";
76
-
77
- break;
78
- case "right":
79
- btn.style = { top: "50%", left: "-11%" };
80
- btn.icon.in = "mdi-chevron-double-left";
81
- btn.icon.out = "mdi-chevron-double-right";
82
-
83
- break;
84
- case "up":
85
- btn.style = { right: "50%", bottom: "-17%" };
86
- btn.icon.in = "mdi-chevron-double-down";
87
- btn.icon.out = "mdi-chevron-double-up";
88
-
89
- break;
90
- case "down":
91
- btn.style = { right: "50%", top: "-17%" };
92
- btn.icon.in = "mdi-chevron-double-up";
93
- btn.icon.out = "mdi-chevron-double-down";
94
- break;
95
-
96
- default:
97
- console.error("sliding error");
98
- break;
99
- }
100
- return btn;
101
- });
102
-
103
- /**
104
- * Transforms the element's position based on the direction
105
- * @param {number} idx - index of the pressed element
106
- */
107
- const slideInOut = (idx) => {
108
- const parentStyle = /** @type {CSSStyleDeclaration} */ (
109
- elements.value?.[idx].style
110
- );
111
- if (parentStyle?.transform.length) {
112
- slideBtns[idx].active = false;
113
- parentStyle.transform = "";
114
- } else {
115
- slideBtns[idx].active = true;
116
- parentStyle.transition = "transform 0.3s ease-in-out";
117
- switch (slideDirs[idx]) {
118
- case "left":
119
- parentStyle.transform = "translateX(-100%)";
120
- break;
121
- case "right":
122
- parentStyle.transform = "translateX(100%)";
123
- break;
124
- case "up":
125
- parentStyle.transform = `translateY(-${(configs[idx].layout.y / configs[idx].layout.h) * 100 + 100
126
- }%)`;
127
- break;
128
- case "down":
129
- parentStyle.transform = `translateY(${(Math.max(0, 12 - configs[idx].layout.y - configs[idx].layout.h) /
130
- configs[idx].layout.h) *
131
- 100 +
132
- 100
133
- }%)`;
134
- break;
135
-
136
- default:
137
- console.error("sliding error");
138
- break;
139
- }
140
- }
141
- };
142
- return { slideBtns, slideInOut };
143
- };
144
-
145
- /**
146
- * Updates an existing Vuetify theme.
147
- * updates only the values provided in the `ThemeDefinition`
148
- * @param {string} themeName - Name of the theme to be updated
149
- * @param {import('vuetify').ThemeDefinition} [themeDefinition = {}] - New defintion to be updated to
150
- * @returns {import('vuetify').ThemeInstance}
151
- */
152
- export const useUpdateTheme = (themeName, themeDefinition = {}) => {
153
- const theme = useTheme();
154
-
155
- /** @type {Array<keyof import('vuetify').ThemeDefinition>} */ (
156
- Object.keys(themeDefinition)
157
- ).forEach((key) => {
158
- if (key === "dark") {
159
- theme.themes.value[themeName][key] = /** @type {Boolean} */ (
160
- themeDefinition[key]
161
- );
162
- } else {
163
- //@ts-expect-error
164
- theme.themes.value[themeName][key] = {
165
- ...theme.themes.value[themeName][key],
166
- ...themeDefinition[key],
167
- };
168
- }
169
- });
170
- return theme;
171
- };
172
-
173
- /**
174
- * Composable that syncs store and URLSearchParameters
175
- */
176
-
177
- export const useURLSearchParametersSync = () => {
178
- onMounted(() => {
179
- // Analyze currently set url params when first loaded and set them in the store
180
- if ('URLSearchParams' in window) {
181
- const searchParams = new URLSearchParams(window.location.search);
182
- let x, y, z;
183
- searchParams.forEach((value, key) => {
184
- if (key === "indicator") {
185
- indicator.value = value;
186
- }
187
- if (key === "x") {
188
- x = value;
189
- }
190
- if (key === "y") {
191
- y = value;
192
- }
193
- if (key === "z") {
194
- z = value;
195
- }
196
- })
197
- if (x !== undefined && y !== undefined && z !== undefined) {
198
- mapPosition.value = [x, y, z];
199
- }
200
- }
201
- watch(
202
- [indicator, mapPosition],
203
- ([updatedIndicator, updatedMapPosition]) => {
204
- if ('URLSearchParams' in window) {
205
- const searchParams = new URLSearchParams(window.location.search);
206
- if (updatedIndicator !== "") {
207
- searchParams.set("indicator", updatedIndicator);
208
- }
209
- if (updatedMapPosition && updatedMapPosition.length === 3) {
210
- searchParams.set("x", updatedMapPosition[0]?.toFixed(4) ?? '');
211
- searchParams.set("y", updatedMapPosition[1]?.toFixed(4) ?? '');
212
- searchParams.set("z", updatedMapPosition[2]?.toFixed(4) ?? '');
213
- }
214
- const newRelativePathQuery = window.location.pathname + '?' + searchParams.toString();
215
- history.pushState(null, '', newRelativePathQuery);
216
- }
217
- })
218
- });
219
- };
package/core/eodash.js DELETED
@@ -1,100 +0,0 @@
1
- import { reactive } from "vue";
2
- import { currentUrl } from "./store/States";
3
-
4
- /**
5
- * Reactive Edoash Instance Object. provided globally in the app,
6
- * and used as an intermediate object to make user defined instances config reactive.
7
- * @type {import("./types").Eodash}
8
- */
9
- export const eodash = reactive({
10
- id: "demo",
11
- stacEndpoint: "https://esa-eodash.github.io/RACE-catalog/RACE/catalog.json",
12
- brand: {
13
- noLayout: true,
14
- name: "Demo",
15
- font: {
16
- family: "Roboto",
17
- },
18
- theme: {
19
- colors: {
20
- primary: "#fff",
21
- secondary: "#fff",
22
- surface: "#fff",
23
- },
24
- },
25
- footerText: "Demo configuration of eodash client",
26
- },
27
- template: {
28
- loading: {
29
- id: Symbol(),
30
- type: "web-component",
31
- widget: {
32
- // https://uiball.com/ldrs/
33
- link: "https://cdn.jsdelivr.net/npm/ldrs/dist/auto/mirage.js",
34
- tagName: "l-mirage",
35
- properties: {
36
- class: "align-self-center justify-self-center",
37
- size: "120",
38
- speed: "2.5",
39
- color: "#004170"
40
- }
41
- }
42
- },
43
- background: {
44
- id: Symbol(),
45
- type: "internal",
46
- widget: {
47
- name: "EodashMap",
48
- },
49
- },
50
- widgets: [
51
- {
52
- id: Symbol(),
53
- type: "internal",
54
- title: "itemfilter",
55
- layout: { x: 0, y: 0, w: 3, h: 12 },
56
- slidable: false,
57
- widget: {
58
- name: "EodashItemFilter",
59
- },
60
- },
61
- {
62
- id: Symbol(),
63
- type: "internal",
64
- title: "datepicker",
65
- layout: { x: 5, y: 11, w: 2, h: 1 },
66
- slidable: false,
67
- widget: {
68
- name: "EodashDatePicker",
69
- properties: {
70
- inline: true,
71
- },
72
- },
73
- },
74
- {
75
- id: Symbol(),
76
- title: "Information",
77
- layout: { x: 9, y: 0, w: 3, h: 12 },
78
- widget: {
79
- link: async () => await import("@eox/stacinfo"),
80
- properties: {
81
- for: currentUrl,
82
- allowHtml: "true",
83
- styleOverride:
84
- "#properties li > .value {font-weight: normal !important;}",
85
- header: "[]",
86
-
87
- subheader: "[]",
88
- properties: '["description"]',
89
- featured: "[]",
90
- footer: "[]",
91
- },
92
- tagName: "eox-stacinfo",
93
- },
94
- type: "web-component",
95
- },
96
- ],
97
- },
98
- });
99
-
100
- export default eodash;
package/core/main.js DELETED
@@ -1,2 +0,0 @@
1
- export { createEodash } from '@/composables/DefineEodash';
2
- export { default as store } from "@/store"
@@ -1,18 +0,0 @@
1
- import vuetify from './vuetify';
2
- import { createPinia } from 'pinia';
3
- import eodash from '@/eodash';
4
- import { eodashKey } from '@/utils/keys';
5
- import store from '../store';
6
-
7
- export const pinia = createPinia();
8
-
9
- /**
10
- * @param {import('vue').App} app
11
- */
12
- export function registerPlugins(app) {
13
- window.eodashStore = store;
14
-
15
- app.use(vuetify)
16
- .use(pinia)
17
- .provide(eodashKey, eodash);
18
- }
@@ -1,30 +0,0 @@
1
- /**
2
- * plugins/vuetify.ts
3
- *
4
- * Framework documentation: https://vuetifyjs.com`
5
- */
6
-
7
- // Styles
8
- import '@mdi/font/css/materialdesignicons.css';
9
- import 'vuetify/styles';
10
-
11
-
12
- import { createVuetify } from 'vuetify';
13
- // import {} from "vuetify"
14
-
15
- // https://vuetifyjs.com/en/introduction/why-vuetify/#feature-guides
16
- const vuetify = createVuetify({
17
- theme: {
18
- themes: {
19
- dashboardTheme: {},
20
- light: {
21
- colors: {
22
- primary: '#1867C0',
23
- secondary: '#5CBBF6',
24
- },
25
- },
26
- },
27
- },
28
- })
29
-
30
- export default vuetify
package/core/render.js DELETED
@@ -1,13 +0,0 @@
1
- import { registerPlugins } from '@/plugins';
2
- // Components
3
- import App from './App.vue';
4
-
5
- // Composables
6
- import { createApp } from 'vue';
7
-
8
-
9
- const app = createApp(App);
10
-
11
- registerPlugins(app);
12
-
13
- app.mount('#app');
File without changes
@@ -1,21 +0,0 @@
1
- import { ref } from "vue";
2
-
3
- /**
4
- * currently selected STAC endpoint
5
- */
6
- export const currentUrl = ref('');
7
- /**
8
- * currently selected datetime
9
- */
10
- export const datetime = ref(new Date().toISOString());
11
-
12
- /**
13
- * Currently selected indicator
14
- */
15
- export const indicator = ref("")
16
-
17
- /**
18
- * Current map position
19
- * @type {import("vue").Ref<(number|undefined)[]>}
20
- */
21
- export const mapPosition = ref([])
@@ -1,17 +0,0 @@
1
- //export all actions, states, and pinia stores
2
-
3
- const storesImport = import.meta.glob('../store/**.js', { eager: true })
4
-
5
- const store = /** @type {import("@/types").EodashStore} */((() => {
6
- const stores = {}
7
- for (const [filePath, importedstore] of Object.entries(storesImport)) {
8
- const storeType = filePath.split('/').at(-1)?.slice(0, -3).toLowerCase() ?? ''
9
- if (!['keys'].includes(storeType)) {
10
- //@ts-expect-error
11
- stores[storeType] = importedstore;
12
- }
13
- }
14
- return stores;
15
- })());
16
-
17
- export default store;
@@ -1,63 +0,0 @@
1
- import { defineStore } from 'pinia';
2
- import { inject, ref } from 'vue';
3
- import axios from 'axios';
4
- import { useAbsoluteUrl } from '@/composables/index';
5
- import { eodashKey } from '@/utils/keys';
6
- import { indicator } from '@/store/States';
7
-
8
- export const useSTAcStore = defineStore('stac', () => {
9
- /**
10
- * links of the root STAC catalog
11
- * @type {import("vue").Ref<import('stac-ts').StacLink[]|null>}
12
- */
13
- const stac = ref(null);
14
-
15
- /**
16
- * selected STAC object.
17
- * @type {import('vue').Ref<import('stac-ts').StacCatalog |
18
- * import('stac-ts').StacCollection |import('stac-ts').StacItem
19
- * | null>}
20
- */
21
- const selectedStac = ref(null);
22
-
23
-
24
- const eodash = /** @type {import("@/types").Eodash} */(inject(eodashKey));
25
-
26
- /**
27
- * fetches root stac catalog and assign it to `stac`
28
- * @async
29
- * @param {import("@/types").StacEndpoint} [url = eodash.stacEndpoint]
30
- * @returns {Promise<void>}
31
- * @see {@link stac}
32
- */
33
- async function loadSTAC(url = eodash.stacEndpoint) {
34
- await axios.get(url).then(resp => {
35
- const links = /** @type {import('stac-ts').StacCatalog} */(resp.data).links.map(link => {
36
- if (!link.title) {
37
- link.title = `${link.rel} ${link.href}`
38
- }
39
- return link
40
- })
41
- stac.value = links;
42
- }).catch(err => console.error(err));
43
- }
44
-
45
- /**
46
- * fetches selected stac object and assign it to `selectedStac`
47
- * @async
48
- * @param {string} relativePath - stac link href
49
- * @returns {Promise<void>}
50
- * @see {@link selectedStac}
51
- */
52
- async function loadSelectedSTAC(relativePath = '') {
53
-
54
- const absoluteUrl = useAbsoluteUrl(relativePath);
55
-
56
- await axios.get(absoluteUrl.value).then(resp => {
57
- selectedStac.value = resp.data;
58
- indicator.value = selectedStac.value?.id ?? "";
59
- }).catch(err => console.error(err));
60
- }
61
-
62
- return { stac, loadSTAC, loadSelectedSTAC, selectedStac };
63
- });