Skip to content

Commit 3b1cf7b

Browse files
committed
Merge branch 'develop'
2 parents 95ed046 + d913e07 commit 3b1cf7b

File tree

12 files changed

+62
-16
lines changed

12 files changed

+62
-16
lines changed

CHANGES.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# Release history
22

3+
## v5.2.0 (2025-07-16)
4+
5+
### Features
6+
7+
- **settings**: Search count disabled by default
8+
([#247](https://github.com/CS-SI/eodag-labextension/pull/247),
9+
[`883cb41`](https://github.com/CS-SI/eodag-labextension/commit/883cb41b4f95e11efba7174701f1a9b60554e456))
10+
11+
### Bug Fixes
12+
13+
- **settings**: Info fetch url ([#246](https://github.com/CS-SI/eodag-labextension/pull/246),
14+
[`87894ab`](https://github.com/CS-SI/eodag-labextension/commit/87894ab85b3c7cf33cd879c33d3a7de2403a59e6))
15+
316
## v5.1.0 (2025-06-24)
417

518
### Features

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ You will be enable to:
121121
- Configure Labextension through its settings:
122122

123123
- choose whether newly inserted code should replace existing search code or not;
124+
- enable search count, which would significantly slow down search requests for some providers, and might be
125+
unavailable for some others;
124126
- configure the default map settings.
125127

126128
- Edit [EODAG user configuration file](https://eodag.readthedocs.io/en/stable/getting_started_guide/configure.html#yaml-user-configuration-file),

eodag_labextension/handlers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ async def post(self, product_type):
406406
if int(page) == DEFAULT_PAGE:
407407
# first search
408408
results_iterator = await current_loop.run_in_executor(
409-
None, partial(dag.search_iter_page, productType=product_type, count=True, **arguments)
409+
None, partial(dag.search_iter_page, productType=product_type, **arguments)
410410
)
411411
if results_iterator is None:
412412
raise ValidationError(
-3.45 KB
Loading

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eodag-labextension",
3-
"version": "5.1.0",
3+
"version": "5.2.0",
44
"description": "Searching remote sensed imagery from various image providers",
55
"keywords": [
66
"jupyter",
@@ -14,7 +14,7 @@
1414
"license": "Apache-2.0",
1515
"author": {
1616
"name": "CS Group",
17-
"email": "admin@geostorm.eu"
17+
"email": "eodag@csgroup.space"
1818
},
1919
"files": [
2020
"lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}",

schema/plugin.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
"type": "boolean",
1111
"default": false
1212
},
13+
"searchCount": {
14+
"title": "Search count enable",
15+
"description": "Enabling count will significantly slow down search requests for some providers, and might be unavailable for some others.",
16+
"type": "boolean",
17+
"default": false
18+
},
1319
"map": {
1420
"title": "Map settings",
1521
"description": "Settings for editing the center and zoom of the map",

src/components/browser.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ export const EodagBrowser: React.FC<IEodagBrowserProps> = ({
119119
const idParam = params.find(p => p.key === 'id');
120120
const idValue = idParam?.value?.id;
121121

122-
const replaceCode = await getEodagSettings();
122+
const settings = await getEodagSettings();
123+
const replaceCode = settings.replaceCode;
123124
let input: IFormInput;
124125
if (isUndefined(formValues)) {
125126
input = {
@@ -145,7 +146,12 @@ export const EodagBrowser: React.FC<IEodagBrowserProps> = ({
145146
input = formValues as IFormInput;
146147
}
147148
}
148-
insertCode(notebook, model, codeGenerator(input, replaceCode), replaceCode);
149+
insertCode(
150+
notebook,
151+
model,
152+
await codeGenerator(input, replaceCode),
153+
replaceCode
154+
);
149155
};
150156

151157
return (

src/hooks/useEodagSettings.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ export const useEodagSettings = () => {
2020
return res.json();
2121
})
2222
.then(data => {
23-
const { replaceCode } = data.settings;
24-
return replaceCode;
23+
return data.settings;
2524
});
2625
};
2726

src/hooks/useEodagVersions.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
import { useEffect, useState } from 'react';
2+
import { URLExt } from '@jupyterlab/coreutils';
3+
import { ServerConnection } from '@jupyterlab/services';
4+
import { EODAG_SERVER_ADDRESS } from '../config/config';
25
import { IMapSettings } from '../components/browser';
36
import { ICustomError } from '../types';
47
import { showCustomErrorDialog } from '../components/customErrorDialog/customErrorDialog';
@@ -15,7 +18,12 @@ export const useEodagVersions = () => {
1518
useEffect(() => {
1619
const fetchInfo = async () => {
1720
try {
18-
const res = await fetch('/eodag/info', {
21+
const serverSettings = ServerConnection.makeSettings();
22+
const eodagServer = URLExt.join(
23+
serverSettings.baseUrl,
24+
EODAG_SERVER_ADDRESS
25+
);
26+
const res = await fetch(URLExt.join(eodagServer, 'info'), {
1927
credentials: 'same-origin'
2028
});
2129

@@ -32,9 +40,7 @@ export const useEodagVersions = () => {
3240
if (!res.ok) {
3341
throw {
3442
name: '',
35-
title:
36-
data?.error ||
37-
'Erreur lors de la récupération des informations EODAG.',
43+
title: data?.error || 'Error while fetching EODAG information',
3844
details: data?.details || ''
3945
};
4046
}
@@ -58,8 +64,7 @@ export const useEodagVersions = () => {
5864
} catch (error: any) {
5965
const customError: ICustomError = {
6066
name: '',
61-
title:
62-
error?.error || 'Erreur lors de la récupération des informations.',
67+
title: error?.error || 'Error while fetching information.',
6368
details: error?.details || ''
6469
};
6570
await showCustomErrorDialog(

src/utils/codeGenerator.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ import { geojsonToWKT } from '@terraformer/wkt';
99

1010
import { IFormInput } from '../types';
1111
import { isUndefined } from 'lodash';
12+
import { useEodagSettings } from '../hooks/useEodagSettings';
1213

1314
const formatDate = (date: Date): string => {
1415
const local = new Date(date);
1516
local.setMinutes(date.getMinutes() - date.getTimezoneOffset());
1617
return local.toJSON().slice(0, 10);
1718
};
1819

19-
export const codeGenerator = (
20+
export const codeGenerator = async (
2021
{
2122
startDate,
2223
endDate,
@@ -29,6 +30,10 @@ export const codeGenerator = (
2930
}: IFormInput,
3031
replaceCode: boolean
3132
) => {
33+
const { getEodagSettings } = useEodagSettings();
34+
const settings = await getEodagSettings();
35+
const searchCount = settings.searchCount;
36+
3237
const start = startDate ? formatDate(startDate) : undefined;
3338
const end = endDate ? formatDate(endDate) : undefined;
3439
const tab = ' '.repeat(4);
@@ -75,6 +80,10 @@ search_results = dag.search(`;
7580
code += `
7681
id="${id}",`;
7782
}
83+
if (searchCount === true) {
84+
code += `
85+
count=True,`;
86+
}
7887
let filteredParameters: { name: string; value: string }[] = [];
7988
if (!isUndefined(additionalParameters)) {
8089
filteredParameters = additionalParameters.filter(

0 commit comments

Comments
 (0)