Skip to content

Commit 8fc83a3

Browse files
authored
fix: concatenate search terms with AND (if no search operators are used) (#119)
* fix: concatenate search terms with AND (if no search operators are used) * fix: replace 'Unknown' API status with 'checking' and a spinning wheel
1 parent 0f68f7f commit 8fc83a3

File tree

4 files changed

+37
-17
lines changed

4 files changed

+37
-17
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ dependencies = [
99
]
1010

1111
[tool.uv.sources]
12-
stac-fastapi-collection-discovery = { git = "https://github.com/developmentseed/stac-fastapi-collection-discovery", rev = "v0.2.2" }
12+
stac-fastapi-collection-discovery = { git = "https://github.com/developmentseed/stac-fastapi-collection-discovery", rev = "v0.2.3" }
1313

1414
[dependency-groups]
1515
dev = [

src/api/search.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,18 @@ function buildQuery(params: SearchParams, stacApis?: string[]): string {
113113
),
114114
);
115115

116+
if (filteredParams.q) {
117+
const query = filteredParams.q.trim();
118+
const hasOperators = /AND|OR|[+"()\-]/.test(query);
119+
120+
if (!hasOperators) {
121+
const words = query.split(/\s+/).filter((word) => word.length > 0);
122+
if (words.length > 0) {
123+
filteredParams.q = words.join(" AND ");
124+
}
125+
}
126+
}
127+
116128
const urlParams = new URLSearchParams(filteredParams);
117129

118130
// Add apis parameter if provided

src/components/ApiConfigPanel.tsx

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,16 @@ const ApiConfigPanel: React.FC<ApiConfigPanelProps> = ({
139139

140140
// Calculate overall status
141141
const getOverallStatus = () => {
142-
if (healthLoading || stacApis.length === 0) {
143-
return { color: "gray", status: "Unknown", hasIssues: false };
142+
if (healthLoading) {
143+
return { color: "gray", status: "Checking", isLoading: true, hasIssues: false };
144+
}
145+
146+
if (stacApis.length === 0) {
147+
return { color: "gray", status: "Unknown", isLoading: false, hasIssues: false };
144148
}
145149

146150
if (!healthData) {
147-
return { color: "red", status: "Error", hasIssues: true };
151+
return { color: "red", status: "Error", isLoading: false, hasIssues: true };
148152
}
149153

150154
const isHealthy = healthData.status === "UP";
@@ -158,17 +162,17 @@ const ApiConfigPanel: React.FC<ApiConfigPanelProps> = ({
158162
);
159163

160164
if (!isHealthy || apisLackingCollectionSearch.length > 0) {
161-
return { color: "red", status: "Issues", hasIssues: true };
165+
return { color: "red", status: "Issues", isLoading: false, hasIssues: true };
162166
}
163167

164168
if (apisLackingFreeText.length > 0) {
165-
return { color: "orange", status: "Limited", hasIssues: true };
169+
return { color: "orange", status: "Limited", isLoading: false, hasIssues: true };
166170
}
167171

168-
return { color: "green", status: "Healthy", hasIssues: false };
172+
return { color: "green", status: "Healthy", isLoading: false, hasIssues: false };
169173
};
170174

171-
const { color, status, hasIssues } = getOverallStatus();
175+
const { color, status, isLoading, hasIssues } = getOverallStatus();
172176

173177
// API management functions
174178
const validateUrl = (url: string): boolean => {
@@ -271,12 +275,16 @@ const ApiConfigPanel: React.FC<ApiConfigPanelProps> = ({
271275
border="1px solid"
272276
borderColor="gray.200"
273277
>
274-
<Box
275-
width="12px"
276-
height="12px"
277-
bg={`${color}.500`}
278-
borderRadius="50%"
279-
/>
278+
{isLoading ? (
279+
<Spinner size="sm" color={`${color}.500`} />
280+
) : (
281+
<Box
282+
width="12px"
283+
height="12px"
284+
bg={`${color}.500`}
285+
borderRadius="50%"
286+
/>
287+
)}
280288
<Text fontWeight="medium" flex={1}>
281289
{stacApis.length} API{stacApis.length !== 1 ? "s" : ""} configured •{" "}
282290
{status}

uv.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)