Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunato committed Feb 16, 2023
2 parents d39ccac + cfa3a8c commit 8ea57dc
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 14 deletions.
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Release history

## 3.3.1 (2023-02-16)

- Fixes generated code formatting [(#109)](https://github.com/CS-SI/eodag-labextension/pull/109)
- Prevents not-ready kernel error [(#109)](https://github.com/CS-SI/eodag-labextension/pull/109)
- Updates dependencies and developement tools versions [(#111)](https://github.com/CS-SI/eodag-labextension/pull/111)

## 3.3.0 (2023-01-18)

- Layout update and new button to directly generate search code [(#95)](https://github.com/CS-SI/eodag-labextension/pull/95)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eodag-labextension",
"version": "3.3.0",
"version": "3.3.1",
"description": "Searching remote sensed imagery from various image providers",
"keywords": [
"jupyter",
Expand Down
25 changes: 15 additions & 10 deletions src/CodeGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ const formatCode = (
) => {
const start = startDate ? formatDate(startDate) : undefined;
const end = endDate ? formatDate(endDate) : undefined;

const tab = ' '.repeat(4);
const geometryIsOk = geometry?.type && geometry?.coordinates;

const replacedCellIntro =
'# Code generated by eodag-labextension, will be automatically replaced if a new search is performed';
const standardMessage = `from eodag import EODataAccessGateway, setup_logging
setup_logging(1) # 0: nothing, 1: only progress bars, 2: INFO, 3: DEBUG
setup_logging(1) # 0: nothing, 1: only progress bars, 2: INFO, 3: DEBUG
dag = EODataAccessGateway()`;

Expand All @@ -45,36 +45,41 @@ geometry = "${geojsonToWKT(geometry)}"`;
}
code += `
search_results, total_count = dag.search(
productType = "${productType}",`;
productType="${productType}",`;
if (geometryIsOk) {
code += `
geom = geometry,`;
geom=geometry,`;
}
if (start) {
code += `
start = "${start}",`;
start="${start}",`;
}
if (end) {
code += `
end = "${end}",`;
end="${end}",`;
}
if (cloud !== 100) {
code += `
cloudCover = ${cloud},`;
cloudCover=${cloud},`;
}
if (additionnalParameters[0].name && additionnalParameters[0].value) {
code +=
'\n' +
tab +
'**{\n' +
additionnalParameters
.filter(
({ name, value }) => name && value && name !== '' && value !== ''
)
.filter(({ name, value }) => name !== '' && value !== '')
.map(({ name, value }) => ` ${name} = "${value}", `)
.map(
({ name, value }) =>
`${tab + tab}"${name.trim()}": "${value.trim()}",`
)
.join('\n');
code += '\n' + `${tab}}`;
}
code += `
)`;
code += '\n)';

return code;
};
Expand Down
4 changes: 4 additions & 0 deletions src/browser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ export class EodagBrowser extends React.Component<IProps, IState> {
const notebook = this.props.tracker.currentWidget.content;
const model = notebook.model;

while (!model.defaultKernelLanguage) {
await new Promise(resolve => setTimeout(resolve, 100));
}

if (model.defaultKernelLanguage !== 'python') {
showErrorMessage(
'Active notebook uses wrong kernel language. Only python is supported',
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3890,9 +3890,9 @@ htmlparser2@^6.0.0:
entities "^2.0.0"

http-cache-semantics@^4.0.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz#49e91c5cbf36c9b94bcfcd71c23d5249ec74e390"
integrity sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==
version "4.1.1"
resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz#abe02fcb2985460bf0323be664436ec3476a6d5a"
integrity sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==

[email protected]:
version "2.0.0"
Expand Down

0 comments on commit 8ea57dc

Please sign in to comment.