Skip to content

Commit

Permalink
fix: info and search button with empty second empty query input
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickskowronekdkfz committed Oct 28, 2024
1 parent f66d47e commit 61433ff
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 22 deletions.
2 changes: 1 addition & 1 deletion packages/demo/public/options-ccp-demo.json
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@
{
"name": "DKTK",
"backendMeasures": "DKTK_STRAT_DEF_IN_INITIAL_POPULATION",
"url": "https://backend.demo.lens.samply.de/prod/",
"url": "http://localhost:8100/",
"sites": [
"dktk-test",
"dktk-datashield-test",
Expand Down
4 changes: 2 additions & 2 deletions packages/demo/src/AppCCP.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@
<main>
<div class="search">
<div class="search-wrapper">
<lens-search-bar
<lens-search-bar-multiple
noMatchesFoundMessage={"keine Ergebnisse gefunden"}
/>
></lens-search-bar-multiple>
<lens-info-button
noQueryMessage="Leere Suchanfrage: Sucht nach allen Ergebnissen."
showQuery={true}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,16 @@
};
const displayQueryInfo = (e: MouseEvent, queryItem?: QueryItem): void => {
console.log("Test");
console.log(queryItem);
const target: HTMLElement = e.target as HTMLElement;
console.log("target=?");
if (showQuery) {
console.log("show Query?" + showQuery);
console.log(onlyChildInfo);
if (onlyChildInfo && queryItem !== undefined) {
console.log("Why I'm here?");
console.log(onlyChildInfo);
let childMessage = buildHumanReadableRecursively(
returnNestedValues(queryItem) as AstElement,
"",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@
const ast = buildAstFromQuery($queryStore);
if (ast.children.includes(null)) {
alert(
"No query entered in one of the queries. You can enter a query or remove the query fields.",
);
return;
}
options?.spots?.forEach((spot: SpotOption) => {
const name = spot.name;
const measureItem: MeasureOption | undefined = $measureStore.find(
Expand Down
40 changes: 21 additions & 19 deletions packages/lib/src/stores/negotiate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,28 +53,30 @@ export const buildHumanReadableRecursively = (
}

queryLayer.children.forEach((child: AstElement, index: number): void => {
if ("type" in child && "value" in child && "key" in child) {
if (typeof child.value === "string") {
humanReadableQuery += `(${child.key} ${child.type} ${child.value})`;
if (child !== null) {
if ("type" in child && "value" in child && "key" in child) {
if (typeof child.value === "string") {
humanReadableQuery += `(${child.key} ${child.type} ${child.value})`;
}
if (
typeof child.value === "object" &&
"min" in child.value &&
"max" in child.value
) {
humanReadableQuery += `(${child.key} ${child.type} ${child.value.min} and ${child.value.max})`;
}
}
if (
typeof child.value === "object" &&
"min" in child.value &&
"max" in child.value
) {
humanReadableQuery += `(${child.key} ${child.type} ${child.value.min} and ${child.value.max})`;
}
}

humanReadableQuery = buildHumanReadableRecursively(
child,
humanReadableQuery,
);
humanReadableQuery = buildHumanReadableRecursively(
child,
humanReadableQuery,
);

if (index === queryLayer.children.length - 1) {
}
if (index < queryLayer.children.length - 1) {
humanReadableQuery += ` ${queryLayer.operand} `;
if (index === queryLayer.children.length - 1) {
}
if (index < queryLayer.children.length - 1) {
humanReadableQuery += ` ${queryLayer.operand} `;
}
}
});

Expand Down

0 comments on commit 61433ff

Please sign in to comment.