Skip to content

Commit 4e657c5

Browse files
authored
feat: make entity select searchable in events browser (Merge pull request #1148)
1 parent 66e9a85 commit 4e657c5

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

webapps/console/components/DataView/EventsBrowser.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import { ConnectionTitle, ProfileBuilderTitle } from "../../pages/[workspaceId]/
2929
import { StreamTitle } from "../../pages/[workspaceId]/streams";
3030
import { trimMiddle } from "../../lib/shared/strings";
3131
import { countries } from "../../lib/shared/countries";
32+
import type { RefSelectProps } from "antd/es/select";
3233

3334
import zlib from "zlib";
3435
import {
@@ -247,6 +248,14 @@ const EventsBrowser0 = ({
247248
destination={entity[1].destination}
248249
/>
249250
),
251+
search: (entity[1].type === "stream"
252+
? [entity[1].name]
253+
: entity[1].type === "profile-builder"
254+
? [entity[1].name, entity[1].destination?.name]
255+
: [entity[1].stream?.name, entity[1].service?.name, entity[1].destination?.name]
256+
)
257+
.filter(s => s !== undefined)
258+
.map(s => s.toLowerCase()),
250259
}));
251260
} else {
252261
return [];
@@ -285,6 +294,8 @@ const EventsBrowser0 = ({
285294

286295
const eventsLogApi = useEventsLogApi();
287296

297+
const entitySelectRef = React.createRef<RefSelectProps>();
298+
288299
useEffect(() => {
289300
if (!actorId || !entitiesMap[actorId]) {
290301
if (entities.length > 0) {
@@ -465,6 +476,7 @@ const EventsBrowser0 = ({
465476
<div>
466477
<span>{entityType == "stream" ? "Site: " : "Connection: "}</span>
467478
<Select
479+
ref={entitySelectRef}
468480
popupMatchSelectWidth={false}
469481
notFoundContent={
470482
entityType === "stream" ? (
@@ -493,6 +505,9 @@ const EventsBrowser0 = ({
493505
}}
494506
value={actorId}
495507
options={entitiesSelectOptions}
508+
showSearch={true}
509+
filterOption={(input, option) => option?.search.some(s => s.includes(input.toLowerCase())) || false}
510+
onDropdownVisibleChange={o => !o && entitySelectRef.current?.blur()}
496511
/>
497512
</div>
498513
<div>

webapps/console/styles/globals.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ body {
4141
width: 100vw;
4242
overflow-x: auto;
4343
overflow-y: auto;
44+
45+
.ant-select-single.ant-select-open .ant-select-selection-item {
46+
opacity: 0.25;
47+
color: inherit;
48+
}
4449
}
4550

4651
.debug-border {

0 commit comments

Comments
 (0)