@upstash/react-redis-browser 0.2.14 → 0.2.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +4 -0
- package/dist/index.js +234 -97
- package/dist/index.mjs +884 -747
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3466,57 +3466,65 @@ function Toaster() {
|
|
|
3466
3466
|
}
|
|
3467
3467
|
|
|
3468
3468
|
// src/components/databrowser/hooks/use-fetch-search-indexes.tsx
|
|
3469
|
-
import {
|
|
3469
|
+
import { useInfiniteQuery } from "@tanstack/react-query";
|
|
3470
3470
|
|
|
3471
|
-
// src/lib/
|
|
3472
|
-
async function
|
|
3471
|
+
// src/lib/list-search-indexes.ts
|
|
3472
|
+
async function listSearchIndexes(redis, {
|
|
3473
3473
|
match,
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
});
|
|
3486
|
-
result.push(...keys);
|
|
3487
|
-
if (limit && result.length >= limit) {
|
|
3488
|
-
return result.slice(0, limit);
|
|
3489
|
-
}
|
|
3490
|
-
if (newCursor === "0") break;
|
|
3491
|
-
cursor = newCursor;
|
|
3492
|
-
}
|
|
3493
|
-
return result;
|
|
3474
|
+
limit,
|
|
3475
|
+
offset = 0
|
|
3476
|
+
}) {
|
|
3477
|
+
const args = ["search.listindexes"];
|
|
3478
|
+
if (match) args.push("MATCH", match);
|
|
3479
|
+
args.push("LIMIT", String(limit), "OFFSET", String(offset));
|
|
3480
|
+
const result = await redis.exec(args);
|
|
3481
|
+
return parseListIndexesResponse(result);
|
|
3482
|
+
}
|
|
3483
|
+
function parseListIndexesResponse(result) {
|
|
3484
|
+
return result.map((entry) => entry[1]);
|
|
3494
3485
|
}
|
|
3495
3486
|
|
|
3496
3487
|
// src/components/databrowser/hooks/use-fetch-search-indexes.tsx
|
|
3497
3488
|
var FETCH_SEARCH_INDEXES_QUERY_KEY = "fetch-search-indexes";
|
|
3489
|
+
var PAGE_SIZE = 30;
|
|
3498
3490
|
var useFetchSearchIndexes = ({
|
|
3499
3491
|
match,
|
|
3500
3492
|
enabled
|
|
3501
3493
|
} = {}) => {
|
|
3502
3494
|
const { redisNoPipeline: redis } = useRedis();
|
|
3503
|
-
|
|
3504
|
-
queryKey: [FETCH_SEARCH_INDEXES_QUERY_KEY],
|
|
3495
|
+
const query = useInfiniteQuery({
|
|
3496
|
+
queryKey: [FETCH_SEARCH_INDEXES_QUERY_KEY, match],
|
|
3505
3497
|
enabled: enabled ?? true,
|
|
3506
|
-
|
|
3498
|
+
initialPageParam: 0,
|
|
3499
|
+
queryFn: async ({ pageParam: offset }) => {
|
|
3500
|
+
const names = await listSearchIndexes(redis, { match, limit: PAGE_SIZE, offset });
|
|
3501
|
+
return {
|
|
3502
|
+
names,
|
|
3503
|
+
nextOffset: names.length >= PAGE_SIZE ? offset + names.length : void 0
|
|
3504
|
+
};
|
|
3505
|
+
},
|
|
3506
|
+
getNextPageParam: (lastPage) => lastPage.nextOffset
|
|
3507
3507
|
});
|
|
3508
|
+
const indexes = query.data?.pages.flatMap((page) => page.names);
|
|
3509
|
+
return {
|
|
3510
|
+
data: indexes,
|
|
3511
|
+
isLoading: query.isLoading || query.isFetching && !query.isFetchingNextPage,
|
|
3512
|
+
hasNextPage: query.hasNextPage,
|
|
3513
|
+
fetchNextPage: query.fetchNextPage,
|
|
3514
|
+
isFetchingNextPage: query.isFetchingNextPage
|
|
3515
|
+
};
|
|
3508
3516
|
};
|
|
3509
3517
|
|
|
3510
3518
|
// src/components/databrowser/hooks/use-keys.tsx
|
|
3511
3519
|
import { createContext as createContext5, useContext as useContext5, useMemo as useMemo4 } from "react";
|
|
3512
|
-
import { useInfiniteQuery } from "@tanstack/react-query";
|
|
3520
|
+
import { useInfiniteQuery as useInfiniteQuery2 } from "@tanstack/react-query";
|
|
3513
3521
|
|
|
3514
3522
|
// src/components/databrowser/hooks/use-fetch-key-type.ts
|
|
3515
|
-
import { useQuery
|
|
3523
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3516
3524
|
var FETCH_KEY_TYPE_QUERY_KEY = "fetch-key-type";
|
|
3517
3525
|
var useFetchKeyType = (key) => {
|
|
3518
3526
|
const { redis } = useRedis();
|
|
3519
|
-
return
|
|
3527
|
+
return useQuery({
|
|
3520
3528
|
queryKey: [FETCH_KEY_TYPE_QUERY_KEY, key],
|
|
3521
3529
|
queryFn: async () => {
|
|
3522
3530
|
if (!key) return "none";
|
|
@@ -3526,11 +3534,11 @@ var useFetchKeyType = (key) => {
|
|
|
3526
3534
|
};
|
|
3527
3535
|
|
|
3528
3536
|
// src/components/databrowser/hooks/use-fetch-search-index.tsx
|
|
3529
|
-
import { useQuery as
|
|
3537
|
+
import { useQuery as useQuery2 } from "@tanstack/react-query";
|
|
3530
3538
|
var FETCH_SEARCH_INDEX_QUERY_KEY = "fetch-search-index";
|
|
3531
3539
|
var useFetchSearchIndex = (indexName, { enabled = true } = {}) => {
|
|
3532
3540
|
const { redisNoPipeline: redis } = useRedis();
|
|
3533
|
-
return
|
|
3541
|
+
return useQuery2({
|
|
3534
3542
|
queryKey: [FETCH_SEARCH_INDEX_QUERY_KEY, indexName],
|
|
3535
3543
|
queryFn: async () => {
|
|
3536
3544
|
if (!indexName) return;
|
|
@@ -3586,6 +3594,21 @@ var KeysProvider = ({ children }) => {
|
|
|
3586
3594
|
}
|
|
3587
3595
|
return { cursor: newCursor, keys: keys2 };
|
|
3588
3596
|
};
|
|
3597
|
+
const redisSearchIndexScan = async ({
|
|
3598
|
+
count: count2,
|
|
3599
|
+
cursor
|
|
3600
|
+
}) => {
|
|
3601
|
+
const offset = Number.parseInt(cursor, 10) || 0;
|
|
3602
|
+
const names = await listSearchIndexes(redis, {
|
|
3603
|
+
match: search.key || void 0,
|
|
3604
|
+
limit: count2,
|
|
3605
|
+
offset
|
|
3606
|
+
});
|
|
3607
|
+
const keys2 = names.map((name) => ({ key: name, type: "search" }));
|
|
3608
|
+
const hasMore = keys2.length >= count2;
|
|
3609
|
+
const nextCursor = hasMore ? String(offset + keys2.length) : "0";
|
|
3610
|
+
return { cursor: nextCursor, keys: keys2 };
|
|
3611
|
+
};
|
|
3589
3612
|
const redisValueScan = async ({
|
|
3590
3613
|
count: count2,
|
|
3591
3614
|
cursor
|
|
@@ -3611,7 +3634,7 @@ var KeysProvider = ({ children }) => {
|
|
|
3611
3634
|
return { cursor: nextCursor, keys: keys2 };
|
|
3612
3635
|
};
|
|
3613
3636
|
const performScan = async (count2, cursor) => {
|
|
3614
|
-
const scanFunction = isValuesSearchSelected ? redisValueScan : redisKeyScan;
|
|
3637
|
+
const scanFunction = isValuesSearchSelected ? redisValueScan : search.type === "search" ? redisSearchIndexScan : redisKeyScan;
|
|
3615
3638
|
const result = await scanFunction({ count: count2, cursor });
|
|
3616
3639
|
return [result.cursor, result.keys];
|
|
3617
3640
|
};
|
|
@@ -3626,7 +3649,7 @@ var KeysProvider = ({ children }) => {
|
|
|
3626
3649
|
}
|
|
3627
3650
|
}
|
|
3628
3651
|
};
|
|
3629
|
-
const query =
|
|
3652
|
+
const query = useInfiniteQuery2({
|
|
3630
3653
|
queryKey: [FETCH_KEYS_QUERY_KEY, search, valuesSearch, isValuesSearchSelected],
|
|
3631
3654
|
enabled: isQueryEnabled,
|
|
3632
3655
|
initialPageParam: "0",
|
|
@@ -4480,6 +4503,18 @@ var useAddKey = () => {
|
|
|
4480
4503
|
|
|
4481
4504
|
// src/components/databrowser/hooks/use-debounce.ts
|
|
4482
4505
|
import { useEffect as useEffect3, useState as useState3 } from "react";
|
|
4506
|
+
function useDebounce(value, delay) {
|
|
4507
|
+
const [debouncedValue, setDebouncedValue] = useState3(value);
|
|
4508
|
+
useEffect3(() => {
|
|
4509
|
+
const handler = setTimeout(() => {
|
|
4510
|
+
setDebouncedValue(value);
|
|
4511
|
+
}, delay);
|
|
4512
|
+
return () => {
|
|
4513
|
+
clearTimeout(handler);
|
|
4514
|
+
};
|
|
4515
|
+
}, [value, delay]);
|
|
4516
|
+
return debouncedValue;
|
|
4517
|
+
}
|
|
4483
4518
|
|
|
4484
4519
|
// src/components/databrowser/hooks/use-delete-key.ts
|
|
4485
4520
|
import { useMutation as useMutation3 } from "@tanstack/react-query";
|
|
@@ -4488,12 +4523,12 @@ import { useMutation as useMutation3 } from "@tanstack/react-query";
|
|
|
4488
4523
|
import { useCallback } from "react";
|
|
4489
4524
|
|
|
4490
4525
|
// src/components/databrowser/hooks/use-fetch-list-items.tsx
|
|
4491
|
-
import { useInfiniteQuery as
|
|
4526
|
+
import { useInfiniteQuery as useInfiniteQuery3 } from "@tanstack/react-query";
|
|
4492
4527
|
var LIST_DISPLAY_PAGE_SIZE = 50;
|
|
4493
4528
|
var FETCH_LIST_ITEMS_QUERY_KEY = "use-fetch-list-items";
|
|
4494
4529
|
var useFetchListItems = ({ dataKey, type }) => {
|
|
4495
4530
|
const { redisNoPipeline: redis } = useRedis();
|
|
4496
|
-
const setQuery =
|
|
4531
|
+
const setQuery = useInfiniteQuery3({
|
|
4497
4532
|
enabled: type === "set",
|
|
4498
4533
|
queryKey: [FETCH_LIST_ITEMS_QUERY_KEY, dataKey, "set"],
|
|
4499
4534
|
initialPageParam: "0",
|
|
@@ -4508,7 +4543,7 @@ var useFetchListItems = ({ dataKey, type }) => {
|
|
|
4508
4543
|
},
|
|
4509
4544
|
getNextPageParam: ({ cursor }) => cursor
|
|
4510
4545
|
});
|
|
4511
|
-
const zsetQuery =
|
|
4546
|
+
const zsetQuery = useInfiniteQuery3({
|
|
4512
4547
|
enabled: type === "zset",
|
|
4513
4548
|
queryKey: [FETCH_LIST_ITEMS_QUERY_KEY, dataKey, "zset"],
|
|
4514
4549
|
initialPageParam: 0,
|
|
@@ -4526,7 +4561,7 @@ var useFetchListItems = ({ dataKey, type }) => {
|
|
|
4526
4561
|
},
|
|
4527
4562
|
getNextPageParam: ({ cursor }) => cursor
|
|
4528
4563
|
});
|
|
4529
|
-
const hashQuery =
|
|
4564
|
+
const hashQuery = useInfiniteQuery3({
|
|
4530
4565
|
enabled: type === "hash",
|
|
4531
4566
|
queryKey: [FETCH_LIST_ITEMS_QUERY_KEY, dataKey, "hash"],
|
|
4532
4567
|
initialPageParam: "0",
|
|
@@ -4541,7 +4576,7 @@ var useFetchListItems = ({ dataKey, type }) => {
|
|
|
4541
4576
|
},
|
|
4542
4577
|
getNextPageParam: ({ cursor }) => cursor
|
|
4543
4578
|
});
|
|
4544
|
-
const listQuery =
|
|
4579
|
+
const listQuery = useInfiniteQuery3({
|
|
4545
4580
|
enabled: type === "list",
|
|
4546
4581
|
queryKey: [FETCH_LIST_ITEMS_QUERY_KEY, dataKey, "list"],
|
|
4547
4582
|
initialPageParam: 0,
|
|
@@ -4559,7 +4594,7 @@ var useFetchListItems = ({ dataKey, type }) => {
|
|
|
4559
4594
|
},
|
|
4560
4595
|
getNextPageParam: ({ cursor }) => cursor
|
|
4561
4596
|
});
|
|
4562
|
-
const streamQuery =
|
|
4597
|
+
const streamQuery = useInfiniteQuery3({
|
|
4563
4598
|
enabled: type === "stream",
|
|
4564
4599
|
queryKey: [FETCH_LIST_ITEMS_QUERY_KEY, dataKey, "stream"],
|
|
4565
4600
|
initialPageParam: "-",
|
|
@@ -4604,11 +4639,11 @@ function transformArray(inputArray) {
|
|
|
4604
4639
|
}
|
|
4605
4640
|
|
|
4606
4641
|
// src/components/databrowser/hooks/use-fetch-simple-key.tsx
|
|
4607
|
-
import { useQuery as
|
|
4642
|
+
import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
4608
4643
|
var FETCH_SIMPLE_KEY_QUERY_KEY = "fetch-simple-key";
|
|
4609
4644
|
var useFetchSimpleKey = (dataKey, type) => {
|
|
4610
4645
|
const { redisNoPipeline: redis } = useRedis();
|
|
4611
|
-
return
|
|
4646
|
+
return useQuery3({
|
|
4612
4647
|
queryKey: [FETCH_SIMPLE_KEY_QUERY_KEY, dataKey],
|
|
4613
4648
|
queryFn: async () => {
|
|
4614
4649
|
let result;
|
|
@@ -4746,7 +4781,7 @@ var useEditListItem = () => {
|
|
|
4746
4781
|
}
|
|
4747
4782
|
case "stream": {
|
|
4748
4783
|
if (!isNew || !newKey) throw new Error("Stream data type is not mutable");
|
|
4749
|
-
const opts = transformArray(newValue?.split("\n") ?? []).map(
|
|
4784
|
+
const opts = transformArray((newValue?.split("\n") ?? []).filter(Boolean)).map(
|
|
4750
4785
|
({ key, value }) => [key, value]
|
|
4751
4786
|
);
|
|
4752
4787
|
pipe.xadd(dataKey, newKey, Object.fromEntries(opts));
|
|
@@ -4768,7 +4803,7 @@ var useEditListItem = () => {
|
|
|
4768
4803
|
|
|
4769
4804
|
// src/components/databrowser/hooks/use-fetch-ttl.ts
|
|
4770
4805
|
import { useEffect as useEffect6 } from "react";
|
|
4771
|
-
import { useQuery as
|
|
4806
|
+
import { useQuery as useQuery4 } from "@tanstack/react-query";
|
|
4772
4807
|
|
|
4773
4808
|
// src/components/databrowser/components/display/ttl-badge.tsx
|
|
4774
4809
|
import { useEffect as useEffect5, useState as useState5 } from "react";
|
|
@@ -4939,7 +4974,7 @@ var TTLBadge = ({
|
|
|
4939
4974
|
var FETCH_TTL_QUERY_KEY = "fetch-ttl";
|
|
4940
4975
|
var useFetchTTL = (dataKey) => {
|
|
4941
4976
|
const { redis } = useRedis();
|
|
4942
|
-
const { isLoading, error, data } =
|
|
4977
|
+
const { isLoading, error, data } = useQuery4({
|
|
4943
4978
|
queryKey: [FETCH_TTL_QUERY_KEY, dataKey],
|
|
4944
4979
|
queryFn: async () => {
|
|
4945
4980
|
const ttl = await redis.ttl(dataKey);
|
|
@@ -5000,11 +5035,11 @@ var useSetTTL = () => {
|
|
|
5000
5035
|
};
|
|
5001
5036
|
|
|
5002
5037
|
// src/components/databrowser/hooks/use-fetch-key-length.ts
|
|
5003
|
-
import { useQuery as
|
|
5038
|
+
import { useQuery as useQuery5 } from "@tanstack/react-query";
|
|
5004
5039
|
var FETCH_KEY_LENGTH_QUERY_KEY = "fetch-key-length";
|
|
5005
5040
|
var useFetchKeyLength = ({ dataKey, type }) => {
|
|
5006
5041
|
const { redis } = useRedis();
|
|
5007
|
-
return
|
|
5042
|
+
return useQuery5({
|
|
5008
5043
|
queryKey: [FETCH_KEY_LENGTH_QUERY_KEY, dataKey],
|
|
5009
5044
|
queryFn: async () => {
|
|
5010
5045
|
switch (type) {
|
|
@@ -5033,11 +5068,11 @@ var useFetchKeyLength = ({ dataKey, type }) => {
|
|
|
5033
5068
|
};
|
|
5034
5069
|
|
|
5035
5070
|
// src/components/databrowser/hooks/use-fetch-key-size.ts
|
|
5036
|
-
import { useQuery as
|
|
5071
|
+
import { useQuery as useQuery6 } from "@tanstack/react-query";
|
|
5037
5072
|
var FETCH_KEY_SIZE_QUERY_KEY = "fetch-key-size";
|
|
5038
5073
|
var useFetchKeySize = (dataKey) => {
|
|
5039
5074
|
const { redis } = useRedis();
|
|
5040
|
-
return
|
|
5075
|
+
return useQuery6({
|
|
5041
5076
|
queryKey: [FETCH_KEY_SIZE_QUERY_KEY, dataKey],
|
|
5042
5077
|
queryFn: async () => {
|
|
5043
5078
|
return await redis.exec(["MEMORY", "USAGE", dataKey]);
|
|
@@ -5079,7 +5114,7 @@ var Badge = ({ children, label }) => /* @__PURE__ */ jsxs9("div", { className: "
|
|
|
5079
5114
|
/* @__PURE__ */ jsx22("span", { className: "font-medium", children })
|
|
5080
5115
|
] });
|
|
5081
5116
|
|
|
5082
|
-
// src/components/databrowser/components/display/
|
|
5117
|
+
// src/components/databrowser/components/display/item-actions.tsx
|
|
5083
5118
|
import { IconDotsVertical } from "@tabler/icons-react";
|
|
5084
5119
|
|
|
5085
5120
|
// src/components/ui/dropdown-menu.tsx
|
|
@@ -5331,7 +5366,7 @@ var Switch = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
|
|
|
5331
5366
|
Switch.displayName = SwitchPrimitives.Root.displayName;
|
|
5332
5367
|
|
|
5333
5368
|
// src/components/databrowser/components/delete-key-modal.tsx
|
|
5334
|
-
import { jsx as jsx26, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
5369
|
+
import { Fragment as Fragment3, jsx as jsx26, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
5335
5370
|
function DeleteKeyModal({
|
|
5336
5371
|
children,
|
|
5337
5372
|
onDeleteConfirm,
|
|
@@ -5339,7 +5374,9 @@ function DeleteKeyModal({
|
|
|
5339
5374
|
onOpenChange,
|
|
5340
5375
|
deletionType,
|
|
5341
5376
|
count: count2 = 1,
|
|
5342
|
-
showReindex
|
|
5377
|
+
showReindex,
|
|
5378
|
+
name,
|
|
5379
|
+
nameLabel
|
|
5343
5380
|
}) {
|
|
5344
5381
|
const isPlural = count2 > 1;
|
|
5345
5382
|
const itemLabel = deletionType === "item" ? "Item" : "Key";
|
|
@@ -5358,7 +5395,10 @@ function DeleteKeyModal({
|
|
|
5358
5395
|
/* @__PURE__ */ jsxs12(DialogDescription, { className: "mt-5", children: [
|
|
5359
5396
|
"Are you sure you want to delete",
|
|
5360
5397
|
" ",
|
|
5361
|
-
|
|
5398
|
+
name ? /* @__PURE__ */ jsxs12(Fragment3, { children: [
|
|
5399
|
+
`${nameLabel ?? deletionType} `,
|
|
5400
|
+
/* @__PURE__ */ jsx26("span", { className: "font-medium text-zinc-900 dark:text-zinc-100", children: nameLabel ? name : `"${name}"` })
|
|
5401
|
+
] }) : isPlural ? `these ${count2} ${deletionType}s` : `this ${deletionType}`,
|
|
5362
5402
|
"?",
|
|
5363
5403
|
/* @__PURE__ */ jsx26("br", {}),
|
|
5364
5404
|
"This action cannot be undone."
|
|
@@ -5409,8 +5449,51 @@ function DeleteKeyModal({
|
|
|
5409
5449
|
] });
|
|
5410
5450
|
}
|
|
5411
5451
|
|
|
5412
|
-
// src/components/databrowser/components/display/
|
|
5452
|
+
// src/components/databrowser/components/display/item-actions.tsx
|
|
5413
5453
|
import { jsx as jsx27, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
5454
|
+
function ItemActions({ dataKey, type }) {
|
|
5455
|
+
const { selectedListItem, setSelectedListItem } = useTab();
|
|
5456
|
+
const { mutateAsync: editItem } = useEditListItem();
|
|
5457
|
+
if (!selectedListItem) return;
|
|
5458
|
+
return /* @__PURE__ */ jsxs13(DropdownMenu, { modal: false, children: [
|
|
5459
|
+
/* @__PURE__ */ jsx27(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx27(Button, { size: "icon-sm", "aria-label": "Item actions", children: /* @__PURE__ */ jsx27(
|
|
5460
|
+
IconDotsVertical,
|
|
5461
|
+
{
|
|
5462
|
+
className: "size-4 text-zinc-500 dark:text-zinc-600",
|
|
5463
|
+
fill: "rgb(var(--color-zinc-500))"
|
|
5464
|
+
}
|
|
5465
|
+
) }) }),
|
|
5466
|
+
/* @__PURE__ */ jsx27(DropdownMenuContent, { align: "end", children: /* @__PURE__ */ jsx27(
|
|
5467
|
+
DeleteKeyModal,
|
|
5468
|
+
{
|
|
5469
|
+
deletionType: "item",
|
|
5470
|
+
name: selectedListItem.key,
|
|
5471
|
+
nameLabel: type === "list" ? "item at index" : void 0,
|
|
5472
|
+
onDeleteConfirm: async () => {
|
|
5473
|
+
await editItem({
|
|
5474
|
+
type,
|
|
5475
|
+
dataKey,
|
|
5476
|
+
itemKey: selectedListItem.key,
|
|
5477
|
+
newKey: void 0
|
|
5478
|
+
});
|
|
5479
|
+
setSelectedListItem(void 0);
|
|
5480
|
+
},
|
|
5481
|
+
children: /* @__PURE__ */ jsx27(
|
|
5482
|
+
DropdownMenuItem,
|
|
5483
|
+
{
|
|
5484
|
+
className: "text-red-500 focus:bg-red-500 focus:text-white",
|
|
5485
|
+
onSelect: (e) => e.preventDefault(),
|
|
5486
|
+
children: "Delete item"
|
|
5487
|
+
}
|
|
5488
|
+
)
|
|
5489
|
+
}
|
|
5490
|
+
) })
|
|
5491
|
+
] });
|
|
5492
|
+
}
|
|
5493
|
+
|
|
5494
|
+
// src/components/databrowser/components/display/key-actions.tsx
|
|
5495
|
+
import { IconDotsVertical as IconDotsVertical2 } from "@tabler/icons-react";
|
|
5496
|
+
import { jsx as jsx28, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
5414
5497
|
function KeyActions({
|
|
5415
5498
|
dataKey,
|
|
5416
5499
|
content,
|
|
@@ -5418,16 +5501,16 @@ function KeyActions({
|
|
|
5418
5501
|
}) {
|
|
5419
5502
|
const { mutateAsync: deleteKey } = useDeleteKey();
|
|
5420
5503
|
const { isValuesSearchSelected } = useTab();
|
|
5421
|
-
return /* @__PURE__ */
|
|
5422
|
-
/* @__PURE__ */
|
|
5423
|
-
|
|
5504
|
+
return /* @__PURE__ */ jsxs14(DropdownMenu, { modal: false, children: [
|
|
5505
|
+
/* @__PURE__ */ jsx28(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx28(Button, { size: "icon-sm", "aria-label": "Key actions", children: /* @__PURE__ */ jsx28(
|
|
5506
|
+
IconDotsVertical2,
|
|
5424
5507
|
{
|
|
5425
5508
|
className: "size-4 text-zinc-500 dark:text-zinc-600",
|
|
5426
5509
|
fill: "rgb(var(--color-zinc-500))"
|
|
5427
5510
|
}
|
|
5428
5511
|
) }) }),
|
|
5429
|
-
/* @__PURE__ */
|
|
5430
|
-
content && /* @__PURE__ */
|
|
5512
|
+
/* @__PURE__ */ jsxs14(DropdownMenuContent, { className: "", align: "end", children: [
|
|
5513
|
+
content && /* @__PURE__ */ jsx28(
|
|
5431
5514
|
DropdownMenuItem,
|
|
5432
5515
|
{
|
|
5433
5516
|
onClick: () => {
|
|
@@ -5439,7 +5522,7 @@ function KeyActions({
|
|
|
5439
5522
|
children: "Copy content"
|
|
5440
5523
|
}
|
|
5441
5524
|
),
|
|
5442
|
-
/* @__PURE__ */
|
|
5525
|
+
/* @__PURE__ */ jsx28(
|
|
5443
5526
|
DropdownMenuItem,
|
|
5444
5527
|
{
|
|
5445
5528
|
onClick: () => {
|
|
@@ -5448,15 +5531,16 @@ function KeyActions({
|
|
|
5448
5531
|
children: "Copy key"
|
|
5449
5532
|
}
|
|
5450
5533
|
),
|
|
5451
|
-
/* @__PURE__ */
|
|
5534
|
+
/* @__PURE__ */ jsx28(
|
|
5452
5535
|
DeleteKeyModal,
|
|
5453
5536
|
{
|
|
5454
5537
|
deletionType: "key",
|
|
5538
|
+
name: dataKey,
|
|
5455
5539
|
showReindex: isValuesSearchSelected && type !== "search",
|
|
5456
5540
|
onDeleteConfirm: async (_e, options) => {
|
|
5457
5541
|
await deleteKey({ keys: [dataKey], reindex: options?.reindex });
|
|
5458
5542
|
},
|
|
5459
|
-
children: /* @__PURE__ */
|
|
5543
|
+
children: /* @__PURE__ */ jsx28(
|
|
5460
5544
|
DropdownMenuItem,
|
|
5461
5545
|
{
|
|
5462
5546
|
className: "text-red-500 focus:bg-red-500 focus:text-white",
|
|
@@ -5471,45 +5555,47 @@ function KeyActions({
|
|
|
5471
5555
|
}
|
|
5472
5556
|
|
|
5473
5557
|
// src/components/databrowser/components/display/display-header.tsx
|
|
5474
|
-
import { jsx as
|
|
5558
|
+
import { jsx as jsx29, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
5475
5559
|
var DisplayHeader = ({
|
|
5476
5560
|
dataKey,
|
|
5477
5561
|
type,
|
|
5478
5562
|
content,
|
|
5479
5563
|
hideTypeTag
|
|
5480
5564
|
}) => {
|
|
5481
|
-
const { setSelectedListItem } = useTab();
|
|
5565
|
+
const { setSelectedListItem, selectedListItem } = useTab();
|
|
5566
|
+
const isListType = type !== "string" && type !== "json" && type !== "search" && type !== "stream";
|
|
5567
|
+
const showItemActions = isListType && Boolean(selectedListItem);
|
|
5482
5568
|
const handleAddItem = () => {
|
|
5483
5569
|
setSelectedListItem({ key: type === "stream" ? "*" : "", isNew: true });
|
|
5484
5570
|
};
|
|
5485
|
-
return /* @__PURE__ */
|
|
5486
|
-
/* @__PURE__ */
|
|
5487
|
-
/* @__PURE__ */
|
|
5488
|
-
/* @__PURE__ */
|
|
5489
|
-
type !== "string" && type !== "json" && type !== "search" && /* @__PURE__ */
|
|
5490
|
-
/* @__PURE__ */
|
|
5571
|
+
return /* @__PURE__ */ jsxs15("div", { className: "rounded-lg", children: [
|
|
5572
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex h-[26px] items-center justify-between gap-4", children: [
|
|
5573
|
+
/* @__PURE__ */ jsx29("h2", { className: "grow truncate text-sm", children: dataKey.trim() === "" ? /* @__PURE__ */ jsx29("span", { className: "ml-1 text-zinc-500", children: "(Empty Key)" }) : /* @__PURE__ */ jsx29("span", { className: "font-medium text-zinc-950", children: dataKey }) }),
|
|
5574
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-1", children: [
|
|
5575
|
+
type !== "string" && type !== "json" && type !== "search" && !showItemActions && /* @__PURE__ */ jsx29(SimpleTooltip, { content: "Add item", children: /* @__PURE__ */ jsx29(Button, { onClick: handleAddItem, size: "icon-sm", "aria-label": "Add item", children: /* @__PURE__ */ jsx29(IconPlus, { className: "size-4 text-zinc-500 dark:text-zinc-600" }) }) }),
|
|
5576
|
+
showItemActions ? /* @__PURE__ */ jsx29(ItemActions, { dataKey, type }) : selectedListItem ? void 0 : /* @__PURE__ */ jsx29(KeyActions, { dataKey, content, type })
|
|
5491
5577
|
] })
|
|
5492
5578
|
] }),
|
|
5493
|
-
type === "search" && hideTypeTag ? void 0 : /* @__PURE__ */
|
|
5494
|
-
!hideTypeTag && /* @__PURE__ */
|
|
5495
|
-
type !== "search" && /* @__PURE__ */
|
|
5496
|
-
type !== "search" && /* @__PURE__ */
|
|
5497
|
-
type !== "search" && /* @__PURE__ */
|
|
5579
|
+
type === "search" && hideTypeTag ? void 0 : /* @__PURE__ */ jsx29(ScrollArea, { orientation: "horizontal", className: "w-full whitespace-nowrap", children: /* @__PURE__ */ jsxs15("div", { className: "flex w-max items-center gap-1.5 pb-2 pt-1", children: [
|
|
5580
|
+
!hideTypeTag && /* @__PURE__ */ jsx29(TypeTag, { variant: type, type: "badge" }),
|
|
5581
|
+
type !== "search" && /* @__PURE__ */ jsx29(SizeBadge, { dataKey }),
|
|
5582
|
+
type !== "search" && /* @__PURE__ */ jsx29(LengthBadge, { dataKey, type, content }),
|
|
5583
|
+
type !== "search" && /* @__PURE__ */ jsx29(HeaderTTLBadge, { dataKey })
|
|
5498
5584
|
] }) })
|
|
5499
5585
|
] });
|
|
5500
5586
|
};
|
|
5501
5587
|
|
|
5502
5588
|
// src/components/databrowser/components/display/key-deleted.tsx
|
|
5503
|
-
import { jsx as
|
|
5589
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
5504
5590
|
var KeyDeleted = () => {
|
|
5505
|
-
return /* @__PURE__ */
|
|
5591
|
+
return /* @__PURE__ */ jsx30("div", { className: "flex h-full items-center justify-center rounded-md border border-dashed border-zinc-300", children: /* @__PURE__ */ jsx30("span", { className: "text-zinc-500", children: "This key has been deleted" }) });
|
|
5506
5592
|
};
|
|
5507
5593
|
|
|
5508
5594
|
// src/components/databrowser/components/docs-link.tsx
|
|
5509
5595
|
import { IconExternalLink } from "@tabler/icons-react";
|
|
5510
|
-
import { jsx as
|
|
5596
|
+
import { jsx as jsx31, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
5511
5597
|
var DocsLink = ({ href, className }) => {
|
|
5512
|
-
return /* @__PURE__ */
|
|
5598
|
+
return /* @__PURE__ */ jsxs16(
|
|
5513
5599
|
"a",
|
|
5514
5600
|
{
|
|
5515
5601
|
href,
|
|
@@ -5521,7 +5607,7 @@ var DocsLink = ({ href, className }) => {
|
|
|
5521
5607
|
),
|
|
5522
5608
|
children: [
|
|
5523
5609
|
"Docs",
|
|
5524
|
-
/* @__PURE__ */
|
|
5610
|
+
/* @__PURE__ */ jsx31(IconExternalLink, { size: 12 })
|
|
5525
5611
|
]
|
|
5526
5612
|
}
|
|
5527
5613
|
);
|
|
@@ -5533,8 +5619,8 @@ import { useEffect as useEffect7, useState as useState7 } from "react";
|
|
|
5533
5619
|
// src/components/ui/progress.tsx
|
|
5534
5620
|
import * as React13 from "react";
|
|
5535
5621
|
import * as ProgressPrimitive from "@radix-ui/react-progress";
|
|
5536
|
-
import { jsx as
|
|
5537
|
-
var Progress = React13.forwardRef(({ className, value, ...props }, ref) => /* @__PURE__ */
|
|
5622
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
5623
|
+
var Progress = React13.forwardRef(({ className, value, ...props }, ref) => /* @__PURE__ */ jsx32(
|
|
5538
5624
|
ProgressPrimitive.Root,
|
|
5539
5625
|
{
|
|
5540
5626
|
ref,
|
|
@@ -5543,7 +5629,7 @@ var Progress = React13.forwardRef(({ className, value, ...props }, ref) => /* @_
|
|
|
5543
5629
|
className
|
|
5544
5630
|
),
|
|
5545
5631
|
...props,
|
|
5546
|
-
children: /* @__PURE__ */
|
|
5632
|
+
children: /* @__PURE__ */ jsx32(
|
|
5547
5633
|
ProgressPrimitive.Indicator,
|
|
5548
5634
|
{
|
|
5549
5635
|
className: "h-full w-full flex-1 bg-neutral-900 transition-all dark:bg-neutral-50",
|
|
@@ -5555,7 +5641,7 @@ var Progress = React13.forwardRef(({ className, value, ...props }, ref) => /* @_
|
|
|
5555
5641
|
Progress.displayName = ProgressPrimitive.Root.displayName;
|
|
5556
5642
|
|
|
5557
5643
|
// src/components/databrowser/components/search/save-schema-modal.tsx
|
|
5558
|
-
import { Fragment as
|
|
5644
|
+
import { Fragment as Fragment4, jsx as jsx33, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
5559
5645
|
var SaveSchemaModal = ({
|
|
5560
5646
|
values,
|
|
5561
5647
|
onClose
|
|
@@ -5611,14 +5697,14 @@ var SaveSchemaModal = ({
|
|
|
5611
5697
|
}
|
|
5612
5698
|
};
|
|
5613
5699
|
const isRunning = status !== void 0;
|
|
5614
|
-
return /* @__PURE__ */
|
|
5700
|
+
return /* @__PURE__ */ jsx33(
|
|
5615
5701
|
Dialog,
|
|
5616
5702
|
{
|
|
5617
5703
|
open: values !== void 0,
|
|
5618
5704
|
onOpenChange: (open) => {
|
|
5619
5705
|
if (!open && !isRunning) onClose();
|
|
5620
5706
|
},
|
|
5621
|
-
children: /* @__PURE__ */
|
|
5707
|
+
children: /* @__PURE__ */ jsxs17(
|
|
5622
5708
|
DialogContent,
|
|
5623
5709
|
{
|
|
5624
5710
|
onInteractOutside: (e) => {
|
|
@@ -5628,26 +5714,26 @@ var SaveSchemaModal = ({
|
|
|
5628
5714
|
if (isRunning) e.preventDefault();
|
|
5629
5715
|
},
|
|
5630
5716
|
children: [
|
|
5631
|
-
/* @__PURE__ */
|
|
5632
|
-
/* @__PURE__ */
|
|
5633
|
-
!isRunning && !error && /* @__PURE__ */
|
|
5717
|
+
/* @__PURE__ */ jsxs17(DialogHeader, { children: [
|
|
5718
|
+
/* @__PURE__ */ jsx33(DialogTitle, { children: "Save Schema Changes" }),
|
|
5719
|
+
!isRunning && !error && /* @__PURE__ */ jsxs17(DialogDescription, { children: [
|
|
5634
5720
|
"Saving will drop and recreate the index. This will temporarily make the index unavailable.",
|
|
5635
|
-
/* @__PURE__ */
|
|
5636
|
-
/* @__PURE__ */
|
|
5721
|
+
/* @__PURE__ */ jsx33("br", {}),
|
|
5722
|
+
/* @__PURE__ */ jsx33("br", {}),
|
|
5637
5723
|
"Are you sure you want to continue?"
|
|
5638
5724
|
] })
|
|
5639
5725
|
] }),
|
|
5640
|
-
isRunning && /* @__PURE__ */
|
|
5641
|
-
/* @__PURE__ */
|
|
5642
|
-
/* @__PURE__ */
|
|
5726
|
+
isRunning && /* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-2 py-4", children: [
|
|
5727
|
+
/* @__PURE__ */ jsx33("p", { className: "text-sm text-zinc-500", children: status }),
|
|
5728
|
+
/* @__PURE__ */ jsx33(Progress, { value: progress })
|
|
5643
5729
|
] }),
|
|
5644
|
-
error && /* @__PURE__ */
|
|
5645
|
-
/* @__PURE__ */
|
|
5646
|
-
!isRunning && !error && /* @__PURE__ */
|
|
5647
|
-
/* @__PURE__ */
|
|
5648
|
-
/* @__PURE__ */
|
|
5730
|
+
error && /* @__PURE__ */ jsx33("div", { className: "w-full break-words text-sm text-red-500", children: formatUpstashErrorMessage(error) }),
|
|
5731
|
+
/* @__PURE__ */ jsxs17(DialogFooter, { children: [
|
|
5732
|
+
!isRunning && !error && /* @__PURE__ */ jsxs17(Fragment4, { children: [
|
|
5733
|
+
/* @__PURE__ */ jsx33(Button, { onClick: onClose, children: "Cancel" }),
|
|
5734
|
+
/* @__PURE__ */ jsx33(Button, { variant: "primary", onClick: handleConfirm, children: "Confirm" })
|
|
5649
5735
|
] }),
|
|
5650
|
-
error && /* @__PURE__ */
|
|
5736
|
+
error && /* @__PURE__ */ jsx33(Button, { onClick: onClose, children: "Close" })
|
|
5651
5737
|
] })
|
|
5652
5738
|
]
|
|
5653
5739
|
}
|
|
@@ -5662,11 +5748,11 @@ import { useMemo as useMemo6 } from "react";
|
|
|
5662
5748
|
// src/components/common/editor-with-types.tsx
|
|
5663
5749
|
import { useEffect as useEffect8, useRef as useRef2 } from "react";
|
|
5664
5750
|
import { Editor, useMonaco } from "@monaco-editor/react";
|
|
5665
|
-
import { jsx as
|
|
5751
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
5666
5752
|
var EditorWithTypes = (props) => {
|
|
5667
|
-
return isTest ? /* @__PURE__ */
|
|
5753
|
+
return isTest ? /* @__PURE__ */ jsx34(TestEditor, { ...props }) : /* @__PURE__ */ jsx34(MonacoEditorWithTypes, { ...props });
|
|
5668
5754
|
};
|
|
5669
|
-
var LoadingSpinner = () => /* @__PURE__ */
|
|
5755
|
+
var LoadingSpinner = () => /* @__PURE__ */ jsx34("div", { className: "flex h-full w-full items-center justify-center", children: /* @__PURE__ */ jsx34("div", { className: "h-4 w-4 animate-spin rounded-full border-2 border-zinc-300 border-t-zinc-600" }) });
|
|
5670
5756
|
var MonacoEditorWithTypes = ({
|
|
5671
5757
|
value,
|
|
5672
5758
|
onChange,
|
|
@@ -5719,16 +5805,16 @@ var MonacoEditorWithTypes = ({
|
|
|
5719
5805
|
useEffect8(() => {
|
|
5720
5806
|
if (!validateValue(value)) onChange(defaultValue);
|
|
5721
5807
|
}, [value, onChange, validateValue, defaultValue]);
|
|
5722
|
-
return /* @__PURE__ */
|
|
5808
|
+
return /* @__PURE__ */ jsx34(
|
|
5723
5809
|
"div",
|
|
5724
5810
|
{
|
|
5725
5811
|
className: cn("group/editor relative", height === void 0 && "h-full"),
|
|
5726
5812
|
style: { height },
|
|
5727
|
-
children: /* @__PURE__ */
|
|
5813
|
+
children: /* @__PURE__ */ jsx34(
|
|
5728
5814
|
Editor,
|
|
5729
5815
|
{
|
|
5730
5816
|
theme: theme === "dark" ? "vs-dark" : "light",
|
|
5731
|
-
loading: /* @__PURE__ */
|
|
5817
|
+
loading: /* @__PURE__ */ jsx34(LoadingSpinner, {}),
|
|
5732
5818
|
beforeMount: handleBeforeMount,
|
|
5733
5819
|
onMount: (editor) => {
|
|
5734
5820
|
editorRef.current = editor;
|
|
@@ -5819,12 +5905,12 @@ var handleBeforeMount = (monaco) => {
|
|
|
5819
5905
|
monaco.languages.typescript.typescriptDefaults.setEagerModelSync(true);
|
|
5820
5906
|
};
|
|
5821
5907
|
var TestEditor = ({ value, onChange, height, testLabel }) => {
|
|
5822
|
-
return /* @__PURE__ */
|
|
5908
|
+
return /* @__PURE__ */ jsx34(
|
|
5823
5909
|
"div",
|
|
5824
5910
|
{
|
|
5825
5911
|
className: cn("group/editor relative", height === void 0 && "h-full"),
|
|
5826
5912
|
style: { height },
|
|
5827
|
-
children: /* @__PURE__ */
|
|
5913
|
+
children: /* @__PURE__ */ jsx34(
|
|
5828
5914
|
"textarea",
|
|
5829
5915
|
{
|
|
5830
5916
|
"aria-label": testLabel,
|
|
@@ -6000,7 +6086,7 @@ type Schema = NestedIndexSchema | FlatIndexSchema;
|
|
|
6000
6086
|
};
|
|
6001
6087
|
|
|
6002
6088
|
// src/components/databrowser/components/search/schema-editor.tsx
|
|
6003
|
-
import { jsx as
|
|
6089
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
6004
6090
|
var SCHEMA_PREFIX = "const schema: Schema = s.object({";
|
|
6005
6091
|
var SCHEMA_SUFFIX = "})";
|
|
6006
6092
|
var SCHEMA_DEFAULT = "const schema: Schema = s.object({\n name: s.string(),\n})";
|
|
@@ -6009,7 +6095,7 @@ var isSchemaStringValid = (value) => {
|
|
|
6009
6095
|
};
|
|
6010
6096
|
var SchemaEditor = ({ value, onChange, height }) => {
|
|
6011
6097
|
const typeDefinitions = useMemo6(() => generateSchemaTypeDefinitions(), []);
|
|
6012
|
-
return /* @__PURE__ */
|
|
6098
|
+
return /* @__PURE__ */ jsx35(
|
|
6013
6099
|
EditorWithTypes,
|
|
6014
6100
|
{
|
|
6015
6101
|
value,
|
|
@@ -6143,7 +6229,7 @@ function fieldToBuilder(value) {
|
|
|
6143
6229
|
}
|
|
6144
6230
|
|
|
6145
6231
|
// src/components/databrowser/components/search/display-search.tsx
|
|
6146
|
-
import { jsx as
|
|
6232
|
+
import { jsx as jsx36, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
6147
6233
|
var SearchDisplay = ({
|
|
6148
6234
|
indexName,
|
|
6149
6235
|
isCreateModal,
|
|
@@ -6213,14 +6299,14 @@ var SearchDisplay = ({
|
|
|
6213
6299
|
reset();
|
|
6214
6300
|
};
|
|
6215
6301
|
if (!isCreateModal && !isLoading && (data === null || data === void 0)) {
|
|
6216
|
-
return /* @__PURE__ */
|
|
6217
|
-
}
|
|
6218
|
-
return /* @__PURE__ */
|
|
6219
|
-
!isCreateModal && /* @__PURE__ */
|
|
6220
|
-
/* @__PURE__ */
|
|
6221
|
-
isCreateModal && /* @__PURE__ */
|
|
6222
|
-
/* @__PURE__ */
|
|
6223
|
-
/* @__PURE__ */
|
|
6302
|
+
return /* @__PURE__ */ jsx36(KeyDeleted, {});
|
|
6303
|
+
}
|
|
6304
|
+
return /* @__PURE__ */ jsxs18("div", { className: "flex h-full min-h-0 w-full min-w-0 flex-col gap-2", children: [
|
|
6305
|
+
!isCreateModal && /* @__PURE__ */ jsx36(DisplayHeader, { dataKey: effectiveIndexName, type: "search", hideTypeTag: isEditModal }),
|
|
6306
|
+
/* @__PURE__ */ jsx36("div", { className: "flex min-h-0 min-w-0 grow flex-col gap-2 rounded-md", children: !isCreateModal && isLoading ? /* @__PURE__ */ jsx36(Spinner, { isLoadingText: "", isLoading: true }) : /* @__PURE__ */ jsxs18("div", { className: "flex min-h-0 w-full flex-1 flex-col gap-3", children: [
|
|
6307
|
+
isCreateModal && /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-1.5", children: [
|
|
6308
|
+
/* @__PURE__ */ jsx36(Label, { htmlFor: "index-name", children: "Index Key" }),
|
|
6309
|
+
/* @__PURE__ */ jsx36(
|
|
6224
6310
|
Input,
|
|
6225
6311
|
{
|
|
6226
6312
|
id: "index-name",
|
|
@@ -6228,42 +6314,42 @@ var SearchDisplay = ({
|
|
|
6228
6314
|
placeholder: "idx_users"
|
|
6229
6315
|
}
|
|
6230
6316
|
),
|
|
6231
|
-
errors.indexName && /* @__PURE__ */
|
|
6317
|
+
errors.indexName && /* @__PURE__ */ jsx36("p", { className: "text-xs text-red-500", children: errors.indexName.message })
|
|
6232
6318
|
] }),
|
|
6233
|
-
/* @__PURE__ */
|
|
6234
|
-
/* @__PURE__ */
|
|
6235
|
-
/* @__PURE__ */
|
|
6236
|
-
/* @__PURE__ */
|
|
6237
|
-
/* @__PURE__ */
|
|
6238
|
-
/* @__PURE__ */
|
|
6319
|
+
/* @__PURE__ */ jsxs18("div", { className: "shrink-0 rounded-md border border-zinc-300 bg-white p-3", children: [
|
|
6320
|
+
/* @__PURE__ */ jsx36("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsx36("h3", { className: "text-sm font-medium text-zinc-700", children: "Config" }) }),
|
|
6321
|
+
/* @__PURE__ */ jsxs18("div", { className: "mt-2 grid grid-cols-2 gap-4 text-sm lg:grid-cols-4", children: [
|
|
6322
|
+
/* @__PURE__ */ jsxs18("div", { children: [
|
|
6323
|
+
/* @__PURE__ */ jsx36("span", { className: "mb-1.5 block text-xs font-medium text-zinc-500", children: "Data Type" }),
|
|
6324
|
+
/* @__PURE__ */ jsx36(
|
|
6239
6325
|
Controller2,
|
|
6240
6326
|
{
|
|
6241
6327
|
name: "dataType",
|
|
6242
6328
|
control,
|
|
6243
|
-
render: ({ field }) => /* @__PURE__ */
|
|
6244
|
-
/* @__PURE__ */
|
|
6245
|
-
/* @__PURE__ */
|
|
6329
|
+
render: ({ field }) => /* @__PURE__ */ jsxs18(Select, { value: field.value, onValueChange: field.onChange, children: [
|
|
6330
|
+
/* @__PURE__ */ jsx36(SelectTrigger, { className: "h-8 w-auto pl-[3px] pr-8", children: /* @__PURE__ */ jsx36(SelectValue, { placeholder: "Select type" }) }),
|
|
6331
|
+
/* @__PURE__ */ jsx36(SelectContent, { children: ["string", "hash", "json"].map((type) => /* @__PURE__ */ jsx36(SelectItem, { value: type, children: /* @__PURE__ */ jsx36(TypeTag, { variant: type, type: "badge" }) }, type)) })
|
|
6246
6332
|
] })
|
|
6247
6333
|
}
|
|
6248
6334
|
)
|
|
6249
6335
|
] }),
|
|
6250
|
-
/* @__PURE__ */
|
|
6251
|
-
/* @__PURE__ */
|
|
6252
|
-
/* @__PURE__ */
|
|
6336
|
+
/* @__PURE__ */ jsxs18("div", { children: [
|
|
6337
|
+
/* @__PURE__ */ jsx36("span", { className: "mb-1.5 block text-xs font-medium text-zinc-500", children: "Language" }),
|
|
6338
|
+
/* @__PURE__ */ jsx36(
|
|
6253
6339
|
Controller2,
|
|
6254
6340
|
{
|
|
6255
6341
|
name: "language",
|
|
6256
6342
|
control,
|
|
6257
|
-
render: ({ field }) => /* @__PURE__ */
|
|
6258
|
-
/* @__PURE__ */
|
|
6259
|
-
/* @__PURE__ */
|
|
6343
|
+
render: ({ field }) => /* @__PURE__ */ jsxs18(Select, { value: field.value, onValueChange: field.onChange, children: [
|
|
6344
|
+
/* @__PURE__ */ jsx36(SelectTrigger, { className: "h-8", children: /* @__PURE__ */ jsx36(SelectValue, { placeholder: "Select language" }) }),
|
|
6345
|
+
/* @__PURE__ */ jsx36(SelectContent, { children: LANGUAGES.map((lang) => /* @__PURE__ */ jsx36(SelectItem, { value: lang, children: lang.charAt(0).toUpperCase() + lang.slice(1) }, lang)) })
|
|
6260
6346
|
] })
|
|
6261
6347
|
}
|
|
6262
6348
|
)
|
|
6263
6349
|
] }),
|
|
6264
|
-
/* @__PURE__ */
|
|
6265
|
-
/* @__PURE__ */
|
|
6266
|
-
/* @__PURE__ */
|
|
6350
|
+
/* @__PURE__ */ jsxs18("div", { className: "col-span-2", children: [
|
|
6351
|
+
/* @__PURE__ */ jsx36("span", { className: "mb-1.5 block text-xs font-medium text-zinc-500", children: "Prefixes" }),
|
|
6352
|
+
/* @__PURE__ */ jsx36(
|
|
6267
6353
|
Input,
|
|
6268
6354
|
{
|
|
6269
6355
|
...register("prefixes", { required: "Please enter at least one prefix" }),
|
|
@@ -6271,18 +6357,18 @@ var SearchDisplay = ({
|
|
|
6271
6357
|
placeholder: "user:, post:"
|
|
6272
6358
|
}
|
|
6273
6359
|
),
|
|
6274
|
-
errors.prefixes && /* @__PURE__ */
|
|
6360
|
+
errors.prefixes && /* @__PURE__ */ jsx36("p", { className: "mt-1 text-xs text-red-500", children: errors.prefixes.message })
|
|
6275
6361
|
] })
|
|
6276
6362
|
] })
|
|
6277
6363
|
] }),
|
|
6278
|
-
/* @__PURE__ */
|
|
6279
|
-
/* @__PURE__ */
|
|
6280
|
-
/* @__PURE__ */
|
|
6364
|
+
/* @__PURE__ */ jsxs18("div", { className: "relative flex min-h-0 flex-1 flex-col rounded-md border border-zinc-300 bg-white", children: [
|
|
6365
|
+
/* @__PURE__ */ jsx36("div", { className: "flex items-center justify-between border-b border-zinc-200 px-3 py-2", children: /* @__PURE__ */ jsx36("h3", { className: "text-sm font-medium text-zinc-700", children: "Schema" }) }),
|
|
6366
|
+
/* @__PURE__ */ jsx36("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ jsx36("div", { className: "h-full px-1", children: /* @__PURE__ */ jsx36(
|
|
6281
6367
|
Controller2,
|
|
6282
6368
|
{
|
|
6283
6369
|
name: "editorValue",
|
|
6284
6370
|
control,
|
|
6285
|
-
render: ({ field }) => /* @__PURE__ */
|
|
6371
|
+
render: ({ field }) => /* @__PURE__ */ jsx36(
|
|
6286
6372
|
SchemaEditor,
|
|
6287
6373
|
{
|
|
6288
6374
|
value: field.value,
|
|
@@ -6292,7 +6378,7 @@ var SearchDisplay = ({
|
|
|
6292
6378
|
)
|
|
6293
6379
|
}
|
|
6294
6380
|
) }) }),
|
|
6295
|
-
/* @__PURE__ */
|
|
6381
|
+
/* @__PURE__ */ jsx36(
|
|
6296
6382
|
DocsLink,
|
|
6297
6383
|
{
|
|
6298
6384
|
className: "absolute bottom-2 right-2 text-sm",
|
|
@@ -6300,10 +6386,10 @@ var SearchDisplay = ({
|
|
|
6300
6386
|
}
|
|
6301
6387
|
)
|
|
6302
6388
|
] }),
|
|
6303
|
-
isCreateModal && createSchema.error && /* @__PURE__ */
|
|
6304
|
-
parseError && /* @__PURE__ */
|
|
6305
|
-
/* @__PURE__ */
|
|
6306
|
-
(isDirty || isCreateModal || isEditModal) && /* @__PURE__ */
|
|
6389
|
+
isCreateModal && createSchema.error && /* @__PURE__ */ jsx36("div", { className: "w-full break-words text-xs text-red-500", children: createSchema.error.message.startsWith("ERR syntax error") ? "Invalid schema" : formatUpstashErrorMessage(createSchema.error) }),
|
|
6390
|
+
parseError && /* @__PURE__ */ jsx36("div", { className: "w-full break-words text-xs text-red-500", children: parseError }),
|
|
6391
|
+
/* @__PURE__ */ jsx36("div", { className: "flex shrink-0 items-center gap-2", children: /* @__PURE__ */ jsxs18("div", { className: "ml-auto flex gap-2", children: [
|
|
6392
|
+
(isDirty || isCreateModal || isEditModal) && /* @__PURE__ */ jsx36(
|
|
6307
6393
|
Button,
|
|
6308
6394
|
{
|
|
6309
6395
|
onClick: () => {
|
|
@@ -6316,9 +6402,9 @@ var SearchDisplay = ({
|
|
|
6316
6402
|
children: "Cancel"
|
|
6317
6403
|
}
|
|
6318
6404
|
),
|
|
6319
|
-
/* @__PURE__ */
|
|
6405
|
+
/* @__PURE__ */ jsx36(Button, { variant: "primary", onClick: handleSubmit(onSubmit), disabled: !isDirty, children: /* @__PURE__ */ jsx36(Spinner, { isLoading: createSchema.isPending, isLoadingText: "Saving", children: isCreateModal ? "Create" : "Save..." }) })
|
|
6320
6406
|
] }) }),
|
|
6321
|
-
/* @__PURE__ */
|
|
6407
|
+
/* @__PURE__ */ jsx36(
|
|
6322
6408
|
SaveSchemaModal,
|
|
6323
6409
|
{
|
|
6324
6410
|
values: pendingFormValues,
|
|
@@ -6359,7 +6445,7 @@ import { IconTrash as IconTrash2 } from "@tabler/icons-react";
|
|
|
6359
6445
|
// src/components/common/infinite-scroll.tsx
|
|
6360
6446
|
import { useEffect as useEffect10, useRef as useRef3 } from "react";
|
|
6361
6447
|
import { IconLoader2 } from "@tabler/icons-react";
|
|
6362
|
-
import { jsx as
|
|
6448
|
+
import { jsx as jsx37, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
6363
6449
|
var InfiniteScroll = ({
|
|
6364
6450
|
query,
|
|
6365
6451
|
children,
|
|
@@ -6391,7 +6477,7 @@ var InfiniteScroll = ({
|
|
|
6391
6477
|
const timer = setTimeout(checkAndFetchMore, 100);
|
|
6392
6478
|
return () => clearTimeout(timer);
|
|
6393
6479
|
}, [active, query.data]);
|
|
6394
|
-
return /* @__PURE__ */
|
|
6480
|
+
return /* @__PURE__ */ jsx37(
|
|
6395
6481
|
ScrollArea,
|
|
6396
6482
|
{
|
|
6397
6483
|
type: "always",
|
|
@@ -6399,9 +6485,9 @@ var InfiniteScroll = ({
|
|
|
6399
6485
|
...props,
|
|
6400
6486
|
className: cn("block h-full min-h-0 w-full overflow-hidden transition-all", props.className),
|
|
6401
6487
|
ref: scrollRef,
|
|
6402
|
-
children: /* @__PURE__ */
|
|
6488
|
+
children: /* @__PURE__ */ jsxs19("div", { ref: contentRef, children: [
|
|
6403
6489
|
children,
|
|
6404
|
-
/* @__PURE__ */
|
|
6490
|
+
/* @__PURE__ */ jsx37("div", { className: "flex h-[100px] justify-center py-2 text-zinc-300", children: query.isFetching && /* @__PURE__ */ jsx37(IconLoader2, { className: "animate-spin", size: 16 }) })
|
|
6405
6491
|
] })
|
|
6406
6492
|
}
|
|
6407
6493
|
);
|
|
@@ -6416,10 +6502,10 @@ import { IconCopy, IconExternalLink as IconExternalLink2, IconTrash } from "@tab
|
|
|
6416
6502
|
import * as React14 from "react";
|
|
6417
6503
|
import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
|
|
6418
6504
|
import { IconCheck as IconCheck2, IconChevronRight as IconChevronRight2, IconCircleFilled as IconCircleFilled2 } from "@tabler/icons-react";
|
|
6419
|
-
import { jsx as
|
|
6505
|
+
import { jsx as jsx38, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
6420
6506
|
var ContextMenu = ContextMenuPrimitive.Root;
|
|
6421
6507
|
var ContextMenuTrigger = ContextMenuPrimitive.Trigger;
|
|
6422
|
-
var ContextMenuSubTrigger = React14.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */
|
|
6508
|
+
var ContextMenuSubTrigger = React14.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs20(
|
|
6423
6509
|
ContextMenuPrimitive.SubTrigger,
|
|
6424
6510
|
{
|
|
6425
6511
|
ref,
|
|
@@ -6431,12 +6517,12 @@ var ContextMenuSubTrigger = React14.forwardRef(({ className, inset, children, ..
|
|
|
6431
6517
|
...props,
|
|
6432
6518
|
children: [
|
|
6433
6519
|
children,
|
|
6434
|
-
/* @__PURE__ */
|
|
6520
|
+
/* @__PURE__ */ jsx38(IconChevronRight2, { className: "ml-auto h-4 w-4" })
|
|
6435
6521
|
]
|
|
6436
6522
|
}
|
|
6437
6523
|
));
|
|
6438
6524
|
ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;
|
|
6439
|
-
var ContextMenuSubContent = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
6525
|
+
var ContextMenuSubContent = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx38(
|
|
6440
6526
|
ContextMenuPrimitive.SubContent,
|
|
6441
6527
|
{
|
|
6442
6528
|
ref,
|
|
@@ -6448,7 +6534,7 @@ var ContextMenuSubContent = React14.forwardRef(({ className, ...props }, ref) =>
|
|
|
6448
6534
|
}
|
|
6449
6535
|
));
|
|
6450
6536
|
ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName;
|
|
6451
|
-
var ContextMenuContent = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
6537
|
+
var ContextMenuContent = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx38(ContextMenuPrimitive.Portal, { container: portalRoot, children: /* @__PURE__ */ jsx38(
|
|
6452
6538
|
ContextMenuPrimitive.Content,
|
|
6453
6539
|
{
|
|
6454
6540
|
ref,
|
|
@@ -6460,7 +6546,7 @@ var ContextMenuContent = React14.forwardRef(({ className, ...props }, ref) => /*
|
|
|
6460
6546
|
}
|
|
6461
6547
|
) }));
|
|
6462
6548
|
ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;
|
|
6463
|
-
var ContextMenuItem = React14.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */
|
|
6549
|
+
var ContextMenuItem = React14.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx38(
|
|
6464
6550
|
ContextMenuPrimitive.Item,
|
|
6465
6551
|
{
|
|
6466
6552
|
ref,
|
|
@@ -6473,7 +6559,7 @@ var ContextMenuItem = React14.forwardRef(({ className, inset, ...props }, ref) =
|
|
|
6473
6559
|
}
|
|
6474
6560
|
));
|
|
6475
6561
|
ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;
|
|
6476
|
-
var ContextMenuCheckboxItem = React14.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */
|
|
6562
|
+
var ContextMenuCheckboxItem = React14.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ jsxs20(
|
|
6477
6563
|
ContextMenuPrimitive.CheckboxItem,
|
|
6478
6564
|
{
|
|
6479
6565
|
ref,
|
|
@@ -6484,13 +6570,13 @@ var ContextMenuCheckboxItem = React14.forwardRef(({ className, children, checked
|
|
|
6484
6570
|
checked,
|
|
6485
6571
|
...props,
|
|
6486
6572
|
children: [
|
|
6487
|
-
/* @__PURE__ */
|
|
6573
|
+
/* @__PURE__ */ jsx38("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx38(ContextMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx38(IconCheck2, { className: "h-4 w-4" }) }) }),
|
|
6488
6574
|
children
|
|
6489
6575
|
]
|
|
6490
6576
|
}
|
|
6491
6577
|
));
|
|
6492
6578
|
ContextMenuCheckboxItem.displayName = ContextMenuPrimitive.CheckboxItem.displayName;
|
|
6493
|
-
var ContextMenuRadioItem = React14.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */
|
|
6579
|
+
var ContextMenuRadioItem = React14.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs20(
|
|
6494
6580
|
ContextMenuPrimitive.RadioItem,
|
|
6495
6581
|
{
|
|
6496
6582
|
ref,
|
|
@@ -6500,13 +6586,13 @@ var ContextMenuRadioItem = React14.forwardRef(({ className, children, ...props }
|
|
|
6500
6586
|
),
|
|
6501
6587
|
...props,
|
|
6502
6588
|
children: [
|
|
6503
|
-
/* @__PURE__ */
|
|
6589
|
+
/* @__PURE__ */ jsx38("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx38(ContextMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx38(IconCircleFilled2, { className: "h-4 w-4" }) }) }),
|
|
6504
6590
|
children
|
|
6505
6591
|
]
|
|
6506
6592
|
}
|
|
6507
6593
|
));
|
|
6508
6594
|
ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName;
|
|
6509
|
-
var ContextMenuLabel = React14.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */
|
|
6595
|
+
var ContextMenuLabel = React14.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx38(
|
|
6510
6596
|
ContextMenuPrimitive.Label,
|
|
6511
6597
|
{
|
|
6512
6598
|
ref,
|
|
@@ -6515,7 +6601,7 @@ var ContextMenuLabel = React14.forwardRef(({ className, inset, ...props }, ref)
|
|
|
6515
6601
|
}
|
|
6516
6602
|
));
|
|
6517
6603
|
ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName;
|
|
6518
|
-
var ContextMenuSeparator = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
6604
|
+
var ContextMenuSeparator = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx38(
|
|
6519
6605
|
ContextMenuPrimitive.Separator,
|
|
6520
6606
|
{
|
|
6521
6607
|
ref,
|
|
@@ -6525,12 +6611,12 @@ var ContextMenuSeparator = React14.forwardRef(({ className, ...props }, ref) =>
|
|
|
6525
6611
|
));
|
|
6526
6612
|
ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName;
|
|
6527
6613
|
var ContextMenuShortcut = ({ className, ...props }) => {
|
|
6528
|
-
return /* @__PURE__ */
|
|
6614
|
+
return /* @__PURE__ */ jsx38("span", { className: cn("ml-auto text-xs tracking-widest text-zinc-500", className), ...props });
|
|
6529
6615
|
};
|
|
6530
6616
|
ContextMenuShortcut.displayName = "ContextMenuShortcut";
|
|
6531
6617
|
|
|
6532
6618
|
// src/components/databrowser/components/item-context-menu.tsx
|
|
6533
|
-
import { Fragment as
|
|
6619
|
+
import { Fragment as Fragment5, jsx as jsx39, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
6534
6620
|
var ItemContextMenu = ({
|
|
6535
6621
|
children,
|
|
6536
6622
|
dataKey,
|
|
@@ -6540,8 +6626,8 @@ var ItemContextMenu = ({
|
|
|
6540
6626
|
const [isAlertOpen, setAlertOpen] = useState9(false);
|
|
6541
6627
|
const [data, setData] = useState9();
|
|
6542
6628
|
const { addTab, setSelectedKey, selectTab, setSelectedListItem } = useDatabrowserStore();
|
|
6543
|
-
return /* @__PURE__ */
|
|
6544
|
-
/* @__PURE__ */
|
|
6629
|
+
return /* @__PURE__ */ jsxs21(Fragment5, { children: [
|
|
6630
|
+
/* @__PURE__ */ jsx39(
|
|
6545
6631
|
DeleteKeyModal,
|
|
6546
6632
|
{
|
|
6547
6633
|
deletionType: "item",
|
|
@@ -6562,8 +6648,8 @@ var ItemContextMenu = ({
|
|
|
6562
6648
|
}
|
|
6563
6649
|
}
|
|
6564
6650
|
),
|
|
6565
|
-
/* @__PURE__ */
|
|
6566
|
-
/* @__PURE__ */
|
|
6651
|
+
/* @__PURE__ */ jsxs21(ContextMenu, { modal: false, children: [
|
|
6652
|
+
/* @__PURE__ */ jsx39(
|
|
6567
6653
|
ContextMenuTrigger,
|
|
6568
6654
|
{
|
|
6569
6655
|
asChild: true,
|
|
@@ -6582,8 +6668,8 @@ var ItemContextMenu = ({
|
|
|
6582
6668
|
children
|
|
6583
6669
|
}
|
|
6584
6670
|
),
|
|
6585
|
-
/* @__PURE__ */
|
|
6586
|
-
/* @__PURE__ */
|
|
6671
|
+
/* @__PURE__ */ jsxs21(ContextMenuContent, { children: [
|
|
6672
|
+
/* @__PURE__ */ jsxs21(
|
|
6587
6673
|
ContextMenuItem,
|
|
6588
6674
|
{
|
|
6589
6675
|
onClick: () => {
|
|
@@ -6595,12 +6681,12 @@ var ItemContextMenu = ({
|
|
|
6595
6681
|
},
|
|
6596
6682
|
className: "gap-2",
|
|
6597
6683
|
children: [
|
|
6598
|
-
/* @__PURE__ */
|
|
6684
|
+
/* @__PURE__ */ jsx39(IconCopy, { size: 16 }),
|
|
6599
6685
|
"Copy key"
|
|
6600
6686
|
]
|
|
6601
6687
|
}
|
|
6602
6688
|
),
|
|
6603
|
-
data?.value && /* @__PURE__ */
|
|
6689
|
+
data?.value && /* @__PURE__ */ jsxs21(
|
|
6604
6690
|
ContextMenuItem,
|
|
6605
6691
|
{
|
|
6606
6692
|
onClick: () => {
|
|
@@ -6611,12 +6697,12 @@ var ItemContextMenu = ({
|
|
|
6611
6697
|
},
|
|
6612
6698
|
className: "gap-2",
|
|
6613
6699
|
children: [
|
|
6614
|
-
/* @__PURE__ */
|
|
6700
|
+
/* @__PURE__ */ jsx39(IconCopy, { size: 16 }),
|
|
6615
6701
|
"Copy value"
|
|
6616
6702
|
]
|
|
6617
6703
|
}
|
|
6618
6704
|
),
|
|
6619
|
-
/* @__PURE__ */
|
|
6705
|
+
/* @__PURE__ */ jsxs21(
|
|
6620
6706
|
ContextMenuItem,
|
|
6621
6707
|
{
|
|
6622
6708
|
onClick: () => {
|
|
@@ -6630,20 +6716,20 @@ var ItemContextMenu = ({
|
|
|
6630
6716
|
},
|
|
6631
6717
|
className: "gap-2",
|
|
6632
6718
|
children: [
|
|
6633
|
-
/* @__PURE__ */
|
|
6719
|
+
/* @__PURE__ */ jsx39(IconExternalLink2, { size: 16 }),
|
|
6634
6720
|
"Open in new tab"
|
|
6635
6721
|
]
|
|
6636
6722
|
}
|
|
6637
6723
|
),
|
|
6638
|
-
/* @__PURE__ */
|
|
6639
|
-
/* @__PURE__ */
|
|
6724
|
+
/* @__PURE__ */ jsx39(ContextMenuSeparator2, {}),
|
|
6725
|
+
/* @__PURE__ */ jsxs21(
|
|
6640
6726
|
ContextMenuItem,
|
|
6641
6727
|
{
|
|
6642
6728
|
disabled: type === "stream",
|
|
6643
6729
|
onClick: () => setAlertOpen(true),
|
|
6644
6730
|
className: "gap-2",
|
|
6645
6731
|
children: [
|
|
6646
|
-
/* @__PURE__ */
|
|
6732
|
+
/* @__PURE__ */ jsx39(IconTrash, { size: 16 }),
|
|
6647
6733
|
"Delete item"
|
|
6648
6734
|
]
|
|
6649
6735
|
}
|
|
@@ -6657,14 +6743,14 @@ var ItemContextMenu = ({
|
|
|
6657
6743
|
import { Controller as Controller3, FormProvider, useForm as useForm3, useFormContext } from "react-hook-form";
|
|
6658
6744
|
|
|
6659
6745
|
// src/components/databrowser/hooks/use-fetch-hash-ttl.ts
|
|
6660
|
-
import { useQuery as
|
|
6746
|
+
import { useQuery as useQuery7 } from "@tanstack/react-query";
|
|
6661
6747
|
var FETCH_HASH_FIELD_TTLS_QUERY_KEY = "fetch-hash-field-ttls";
|
|
6662
6748
|
var useFetchHashFieldExpires = ({
|
|
6663
6749
|
dataKey,
|
|
6664
6750
|
fields
|
|
6665
6751
|
}) => {
|
|
6666
6752
|
const { redis } = useRedis();
|
|
6667
|
-
return
|
|
6753
|
+
return useQuery7({
|
|
6668
6754
|
queryKey: [FETCH_HASH_FIELD_TTLS_QUERY_KEY, dataKey, fields],
|
|
6669
6755
|
queryFn: async () => {
|
|
6670
6756
|
const cachedExpires = /* @__PURE__ */ new Map();
|
|
@@ -6712,12 +6798,12 @@ var useSetHashTTL = () => {
|
|
|
6712
6798
|
};
|
|
6713
6799
|
|
|
6714
6800
|
// src/components/databrowser/components/display/hash/hash-field-ttl-badge.tsx
|
|
6715
|
-
import { jsx as
|
|
6801
|
+
import { jsx as jsx40 } from "react/jsx-runtime";
|
|
6716
6802
|
var HashFieldTTLBadge = ({ dataKey, field }) => {
|
|
6717
6803
|
const { data } = useFetchHashFieldExpires({ dataKey, fields: [field] });
|
|
6718
6804
|
const { mutate: setTTL, isPending } = useSetHashTTL();
|
|
6719
6805
|
const expireAt = data?.[field];
|
|
6720
|
-
return /* @__PURE__ */
|
|
6806
|
+
return /* @__PURE__ */ jsx40(
|
|
6721
6807
|
TTLBadge,
|
|
6722
6808
|
{
|
|
6723
6809
|
label: "Field TTL:",
|
|
@@ -6734,18 +6820,18 @@ import { useController } from "react-hook-form";
|
|
|
6734
6820
|
|
|
6735
6821
|
// src/components/databrowser/components/display/input/content-type-select.tsx
|
|
6736
6822
|
import { useMemo as useMemo7 } from "react";
|
|
6737
|
-
import { jsx as
|
|
6823
|
+
import { jsx as jsx41, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
6738
6824
|
var ContentTypeSelect = ({
|
|
6739
6825
|
value,
|
|
6740
6826
|
onChange,
|
|
6741
6827
|
data
|
|
6742
6828
|
}) => {
|
|
6743
6829
|
const isValidJSON = useMemo7(() => checkIsValidJSON(data), [data]);
|
|
6744
|
-
return /* @__PURE__ */
|
|
6745
|
-
/* @__PURE__ */
|
|
6746
|
-
/* @__PURE__ */
|
|
6747
|
-
/* @__PURE__ */
|
|
6748
|
-
/* @__PURE__ */
|
|
6830
|
+
return /* @__PURE__ */ jsxs22(Select, { value, onValueChange: onChange, children: [
|
|
6831
|
+
/* @__PURE__ */ jsx41(SelectTrigger, { className: "h-6 w-auto border-none bg-transparent pl-0 pr-6 text-xs text-zinc-500", children: /* @__PURE__ */ jsx41(SelectValue, { placeholder: "Text" }) }),
|
|
6832
|
+
/* @__PURE__ */ jsx41(SelectContent, { children: /* @__PURE__ */ jsxs22(SelectGroup, { children: [
|
|
6833
|
+
/* @__PURE__ */ jsx41(SelectItem, { value: "Text", children: "Text" }),
|
|
6834
|
+
/* @__PURE__ */ jsx41(SelectItem, { disabled: !isValidJSON, value: "JSON", children: "JSON" })
|
|
6749
6835
|
] }) })
|
|
6750
6836
|
] });
|
|
6751
6837
|
};
|
|
@@ -6757,10 +6843,10 @@ import { Editor as Editor2, useMonaco as useMonaco2 } from "@monaco-editor/react
|
|
|
6757
6843
|
// src/components/common/copy-button.tsx
|
|
6758
6844
|
import { useState as useState10 } from "react";
|
|
6759
6845
|
import { IconCheck as IconCheck3, IconCopy as IconCopy2 } from "@tabler/icons-react";
|
|
6760
|
-
import { jsx as
|
|
6846
|
+
import { jsx as jsx42 } from "react/jsx-runtime";
|
|
6761
6847
|
function CopyButton({ value, ...props }) {
|
|
6762
6848
|
const [copied, setCopied] = useState10(false);
|
|
6763
|
-
return /* @__PURE__ */
|
|
6849
|
+
return /* @__PURE__ */ jsx42(
|
|
6764
6850
|
Button,
|
|
6765
6851
|
{
|
|
6766
6852
|
onClick: (e) => {
|
|
@@ -6777,7 +6863,7 @@ function CopyButton({ value, ...props }) {
|
|
|
6777
6863
|
variant: "secondary",
|
|
6778
6864
|
size: "icon-sm",
|
|
6779
6865
|
...props,
|
|
6780
|
-
children: copied ? /* @__PURE__ */
|
|
6866
|
+
children: copied ? /* @__PURE__ */ jsx42(IconCheck3, { className: "size-4 text-green-500" }) : /* @__PURE__ */ jsx42(IconCopy2, { className: "size-4 text-zinc-500" })
|
|
6781
6867
|
}
|
|
6782
6868
|
);
|
|
6783
6869
|
}
|
|
@@ -6790,12 +6876,12 @@ var handleCopyClick = async (textToCopy) => {
|
|
|
6790
6876
|
};
|
|
6791
6877
|
|
|
6792
6878
|
// src/components/databrowser/components/display/input/custom-editor.tsx
|
|
6793
|
-
import { jsx as
|
|
6879
|
+
import { jsx as jsx43, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
6794
6880
|
var CustomEditor = (props) => {
|
|
6795
6881
|
if (isTest) {
|
|
6796
|
-
return /* @__PURE__ */
|
|
6882
|
+
return /* @__PURE__ */ jsx43(TestEditor2, { ...props });
|
|
6797
6883
|
}
|
|
6798
|
-
return /* @__PURE__ */
|
|
6884
|
+
return /* @__PURE__ */ jsx43(MonacoEditor, { ...props });
|
|
6799
6885
|
};
|
|
6800
6886
|
var MonacoEditor = ({
|
|
6801
6887
|
language,
|
|
@@ -6815,7 +6901,7 @@ var MonacoEditor = ({
|
|
|
6815
6901
|
}
|
|
6816
6902
|
monaco?.editor.setModelLanguage(editorRef.current.getModel(), language);
|
|
6817
6903
|
}, [monaco, language, active]);
|
|
6818
|
-
const editor = /* @__PURE__ */
|
|
6904
|
+
const editor = /* @__PURE__ */ jsx43(
|
|
6819
6905
|
Editor2,
|
|
6820
6906
|
{
|
|
6821
6907
|
theme: theme === "dark" ? "vs-dark" : "light",
|
|
@@ -6860,14 +6946,14 @@ var MonacoEditor = ({
|
|
|
6860
6946
|
className: "[&_.monaco-editor-background]:!bg-transparent [&_.monaco-editor]:!bg-transparent"
|
|
6861
6947
|
}
|
|
6862
6948
|
);
|
|
6863
|
-
return /* @__PURE__ */
|
|
6949
|
+
return /* @__PURE__ */ jsxs23(
|
|
6864
6950
|
"div",
|
|
6865
6951
|
{
|
|
6866
6952
|
className: cn("group/editor relative", height === void 0 && "h-full"),
|
|
6867
6953
|
style: { height },
|
|
6868
6954
|
children: [
|
|
6869
6955
|
editor,
|
|
6870
|
-
showCopyButton && /* @__PURE__ */
|
|
6956
|
+
showCopyButton && /* @__PURE__ */ jsx43(
|
|
6871
6957
|
CopyButton,
|
|
6872
6958
|
{
|
|
6873
6959
|
value,
|
|
@@ -6879,14 +6965,14 @@ var MonacoEditor = ({
|
|
|
6879
6965
|
);
|
|
6880
6966
|
};
|
|
6881
6967
|
var TestEditor2 = ({ value, onChange, height, showCopyButton }) => {
|
|
6882
|
-
return /* @__PURE__ */
|
|
6968
|
+
return /* @__PURE__ */ jsxs23(
|
|
6883
6969
|
"div",
|
|
6884
6970
|
{
|
|
6885
6971
|
className: cn("group/editor relative", height === void 0 && "h-full"),
|
|
6886
6972
|
style: { height },
|
|
6887
6973
|
children: [
|
|
6888
|
-
/* @__PURE__ */
|
|
6889
|
-
showCopyButton && /* @__PURE__ */
|
|
6974
|
+
/* @__PURE__ */ jsx43("input", { "aria-label": "editor", value, onChange: (e) => onChange(e.target.value) }),
|
|
6975
|
+
showCopyButton && /* @__PURE__ */ jsx43(
|
|
6890
6976
|
CopyButton,
|
|
6891
6977
|
{
|
|
6892
6978
|
value,
|
|
@@ -6899,7 +6985,7 @@ var TestEditor2 = ({ value, onChange, height, showCopyButton }) => {
|
|
|
6899
6985
|
};
|
|
6900
6986
|
|
|
6901
6987
|
// src/components/databrowser/components/display/input/use-field.tsx
|
|
6902
|
-
import { Fragment as
|
|
6988
|
+
import { Fragment as Fragment6, jsx as jsx44 } from "react/jsx-runtime";
|
|
6903
6989
|
var useField = ({
|
|
6904
6990
|
name,
|
|
6905
6991
|
form,
|
|
@@ -6946,8 +7032,8 @@ var useField = ({
|
|
|
6946
7032
|
}
|
|
6947
7033
|
}, [data, fieldState.isDirty]);
|
|
6948
7034
|
return {
|
|
6949
|
-
selector: /* @__PURE__ */
|
|
6950
|
-
editor: /* @__PURE__ */
|
|
7035
|
+
selector: /* @__PURE__ */ jsx44(ContentTypeSelect, { value: contentType, onChange: handleTypeChange, data: field.value }),
|
|
7036
|
+
editor: /* @__PURE__ */ jsx44(Fragment6, { children: /* @__PURE__ */ jsx44(
|
|
6951
7037
|
CustomEditor,
|
|
6952
7038
|
{
|
|
6953
7039
|
language: contentType === "JSON" ? "json" : "plaintext",
|
|
@@ -6971,13 +7057,13 @@ var checkIsValidJSON = (value) => {
|
|
|
6971
7057
|
};
|
|
6972
7058
|
|
|
6973
7059
|
// src/components/databrowser/components/display/display-list-edit.tsx
|
|
6974
|
-
import { jsx as
|
|
7060
|
+
import { jsx as jsx45, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
6975
7061
|
var ListEditDisplay = ({
|
|
6976
7062
|
dataKey,
|
|
6977
7063
|
type,
|
|
6978
7064
|
item
|
|
6979
7065
|
}) => {
|
|
6980
|
-
return /* @__PURE__ */
|
|
7066
|
+
return /* @__PURE__ */ jsx45("div", { className: "min-h-0 grow rounded-md", children: /* @__PURE__ */ jsx45(ListEditForm, { item, type, dataKey }, item.key) });
|
|
6981
7067
|
};
|
|
6982
7068
|
var ListEditForm = ({
|
|
6983
7069
|
type,
|
|
@@ -7016,21 +7102,29 @@ var ListEditForm = ({
|
|
|
7016
7102
|
});
|
|
7017
7103
|
setSelectedListItem(void 0);
|
|
7018
7104
|
});
|
|
7019
|
-
return /* @__PURE__ */
|
|
7020
|
-
/* @__PURE__ */
|
|
7021
|
-
type === "zset" && /* @__PURE__ */
|
|
7022
|
-
type !== "list" && /* @__PURE__ */
|
|
7023
|
-
|
|
7105
|
+
return /* @__PURE__ */ jsx45(FormProvider, { ...form, children: /* @__PURE__ */ jsxs24("form", { onSubmit, className: "flex h-full min-h-0 flex-col gap-2", children: [
|
|
7106
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex min-h-0 grow flex-col gap-2", children: [
|
|
7107
|
+
type === "zset" && /* @__PURE__ */ jsx45(NumberFormItem, { name: "value", label: valueLabel }),
|
|
7108
|
+
type !== "list" && /* @__PURE__ */ jsx45(
|
|
7109
|
+
FormItem,
|
|
7110
|
+
{
|
|
7111
|
+
readOnly: type === "stream" && !isNew,
|
|
7112
|
+
name: "key",
|
|
7113
|
+
label: keyLabel,
|
|
7114
|
+
data: itemKey
|
|
7115
|
+
}
|
|
7116
|
+
),
|
|
7117
|
+
type !== "set" && type !== "zset" && /* @__PURE__ */ jsx45(
|
|
7024
7118
|
FormItem,
|
|
7025
7119
|
{
|
|
7026
|
-
readOnly: type === "stream",
|
|
7120
|
+
readOnly: type === "stream" && !isNew,
|
|
7027
7121
|
name: "value",
|
|
7028
7122
|
label: valueLabel,
|
|
7029
7123
|
data: itemValue ?? ""
|
|
7030
7124
|
}
|
|
7031
7125
|
)
|
|
7032
7126
|
] }),
|
|
7033
|
-
/* @__PURE__ */
|
|
7127
|
+
/* @__PURE__ */ jsxs24(
|
|
7034
7128
|
"div",
|
|
7035
7129
|
{
|
|
7036
7130
|
className: cn(
|
|
@@ -7038,9 +7132,9 @@ var ListEditForm = ({
|
|
|
7038
7132
|
type === "hash" && itemKey !== "" ? "justify-between" : "justify-end"
|
|
7039
7133
|
),
|
|
7040
7134
|
children: [
|
|
7041
|
-
type === "hash" && itemKey !== "" && /* @__PURE__ */
|
|
7042
|
-
/* @__PURE__ */
|
|
7043
|
-
/* @__PURE__ */
|
|
7135
|
+
type === "hash" && itemKey !== "" && /* @__PURE__ */ jsx45(HashFieldTTLBadge, { dataKey, field: itemKey }),
|
|
7136
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex gap-2", children: [
|
|
7137
|
+
/* @__PURE__ */ jsx45(
|
|
7044
7138
|
Button,
|
|
7045
7139
|
{
|
|
7046
7140
|
type: "button",
|
|
@@ -7050,17 +7144,17 @@ var ListEditForm = ({
|
|
|
7050
7144
|
children: "Cancel"
|
|
7051
7145
|
}
|
|
7052
7146
|
),
|
|
7053
|
-
/* @__PURE__ */
|
|
7147
|
+
/* @__PURE__ */ jsx45(
|
|
7054
7148
|
SimpleTooltip,
|
|
7055
7149
|
{
|
|
7056
7150
|
content: type === "stream" && !isNew ? "Streams are not mutable" : void 0,
|
|
7057
|
-
children: /* @__PURE__ */
|
|
7151
|
+
children: /* @__PURE__ */ jsx45(
|
|
7058
7152
|
Button,
|
|
7059
7153
|
{
|
|
7060
7154
|
variant: "primary",
|
|
7061
7155
|
type: "submit",
|
|
7062
7156
|
disabled: !form.formState.isValid || !form.formState.isDirty || type === "stream" && !isNew,
|
|
7063
|
-
children: /* @__PURE__ */
|
|
7157
|
+
children: /* @__PURE__ */ jsx45(Spinner, { isLoading: isPending, isLoadingText: isNew ? "Adding" : "Saving", children: isNew ? "Add Item" : "Save" })
|
|
7064
7158
|
}
|
|
7065
7159
|
)
|
|
7066
7160
|
}
|
|
@@ -7072,13 +7166,13 @@ var ListEditForm = ({
|
|
|
7072
7166
|
] }) });
|
|
7073
7167
|
};
|
|
7074
7168
|
var NumberFormItem = ({ name, label }) => {
|
|
7075
|
-
return /* @__PURE__ */
|
|
7076
|
-
/* @__PURE__ */
|
|
7077
|
-
/* @__PURE__ */
|
|
7169
|
+
return /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-1", children: [
|
|
7170
|
+
/* @__PURE__ */ jsx45("div", { className: "flex", children: /* @__PURE__ */ jsx45("span", { className: "text-xs font-medium text-zinc-700", children: label }) }),
|
|
7171
|
+
/* @__PURE__ */ jsx45(
|
|
7078
7172
|
Controller3,
|
|
7079
7173
|
{
|
|
7080
7174
|
name,
|
|
7081
|
-
render: ({ field }) => /* @__PURE__ */
|
|
7175
|
+
render: ({ field }) => /* @__PURE__ */ jsx45(
|
|
7082
7176
|
"input",
|
|
7083
7177
|
{
|
|
7084
7178
|
className: "plain-input rounded-md border border-zinc-300 bg-white px-3 py-1 shadow-sm [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none",
|
|
@@ -7106,14 +7200,14 @@ var FormItem = ({
|
|
|
7106
7200
|
readOnly,
|
|
7107
7201
|
data
|
|
7108
7202
|
});
|
|
7109
|
-
return /* @__PURE__ */
|
|
7110
|
-
/* @__PURE__ */
|
|
7111
|
-
/* @__PURE__ */
|
|
7203
|
+
return /* @__PURE__ */ jsxs24("div", { className: cn("flex flex-col gap-1", !height && "h-full min-h-0"), children: [
|
|
7204
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-1 text-xs", children: [
|
|
7205
|
+
/* @__PURE__ */ jsx45("span", { className: "font-medium text-zinc-700", children: label }),
|
|
7112
7206
|
" ",
|
|
7113
|
-
/* @__PURE__ */
|
|
7207
|
+
/* @__PURE__ */ jsx45("span", { className: "text-zinc-300", children: "/" }),
|
|
7114
7208
|
selector
|
|
7115
7209
|
] }),
|
|
7116
|
-
/* @__PURE__ */
|
|
7210
|
+
/* @__PURE__ */ jsx45(
|
|
7117
7211
|
"div",
|
|
7118
7212
|
{
|
|
7119
7213
|
className: cn(
|
|
@@ -7128,7 +7222,7 @@ var FormItem = ({
|
|
|
7128
7222
|
|
|
7129
7223
|
// src/components/databrowser/components/display/hash/hash-field-ttl-info.tsx
|
|
7130
7224
|
import { useEffect as useEffect13, useState as useState12 } from "react";
|
|
7131
|
-
import { jsx as
|
|
7225
|
+
import { jsx as jsx46 } from "react/jsx-runtime";
|
|
7132
7226
|
var HashFieldTTLInfo = ({
|
|
7133
7227
|
dataKey,
|
|
7134
7228
|
field,
|
|
@@ -7145,11 +7239,11 @@ var HashFieldTTLInfo = ({
|
|
|
7145
7239
|
return () => clearInterval(interval);
|
|
7146
7240
|
}, [expireAt]);
|
|
7147
7241
|
if (!expireAt || expireAt === TTL_NOT_FOUND || expireAt === TTL_INFINITE) return;
|
|
7148
|
-
return /* @__PURE__ */
|
|
7242
|
+
return /* @__PURE__ */ jsx46("span", { className: "block min-w-[30px] whitespace-nowrap text-right text-red-600", children: formatTime(ttl ?? 0) });
|
|
7149
7243
|
};
|
|
7150
7244
|
|
|
7151
7245
|
// src/components/databrowser/components/display/display-list.tsx
|
|
7152
|
-
import { Fragment as
|
|
7246
|
+
import { Fragment as Fragment7, jsx as jsx47, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
7153
7247
|
var headerLabels = {
|
|
7154
7248
|
list: ["Index", "Content"],
|
|
7155
7249
|
hash: ["Field", "Value"],
|
|
@@ -7162,12 +7256,12 @@ var ListDisplay = ({ dataKey, type }) => {
|
|
|
7162
7256
|
const query = useFetchListItems({ dataKey, type });
|
|
7163
7257
|
const isEmpty = query.isFetched && query.data?.pages.every((page) => page.keys.length === 0);
|
|
7164
7258
|
if (isEmpty) {
|
|
7165
|
-
return /* @__PURE__ */
|
|
7259
|
+
return /* @__PURE__ */ jsx47(KeyDeleted, {});
|
|
7166
7260
|
}
|
|
7167
|
-
return /* @__PURE__ */
|
|
7168
|
-
/* @__PURE__ */
|
|
7169
|
-
selectedListItem && /* @__PURE__ */
|
|
7170
|
-
/* @__PURE__ */
|
|
7261
|
+
return /* @__PURE__ */ jsxs25("div", { className: "flex h-full min-h-0 flex-col gap-2 overflow-hidden", children: [
|
|
7262
|
+
/* @__PURE__ */ jsx47(DisplayHeader, { dataKey, type }),
|
|
7263
|
+
selectedListItem && /* @__PURE__ */ jsx47(ListEditDisplay, { dataKey, type, item: selectedListItem }),
|
|
7264
|
+
/* @__PURE__ */ jsx47("div", { className: cn("min-h-0 grow", selectedListItem && "hidden"), children: /* @__PURE__ */ jsx47(InfiniteScroll, { query, className: "rounded-lg border border-zinc-200 bg-white", children: /* @__PURE__ */ jsx47("table", { className: "w-full", children: /* @__PURE__ */ jsx47(ItemContextMenu, { dataKey, type, children: /* @__PURE__ */ jsx47("tbody", { children: /* @__PURE__ */ jsx47(ListItems, { dataKey, type, query }) }) }) }) }) })
|
|
7171
7265
|
] });
|
|
7172
7266
|
};
|
|
7173
7267
|
var ListItems = ({
|
|
@@ -7179,7 +7273,7 @@ var ListItems = ({
|
|
|
7179
7273
|
const keys = useMemo8(() => query.data?.pages.flatMap((page) => page.keys) ?? [], [query.data]);
|
|
7180
7274
|
const fields = useMemo8(() => keys.map((key) => key.key), [keys]);
|
|
7181
7275
|
const { mutate: editItem } = useEditListItem();
|
|
7182
|
-
return /* @__PURE__ */
|
|
7276
|
+
return /* @__PURE__ */ jsx47(Fragment7, { children: keys.map(({ key, value }, i) => /* @__PURE__ */ jsxs25(
|
|
7183
7277
|
"tr",
|
|
7184
7278
|
{
|
|
7185
7279
|
"data-item-key": key,
|
|
@@ -7191,7 +7285,7 @@ var ListItems = ({
|
|
|
7191
7285
|
"h-9 border-b border-b-zinc-100 transition-colors hover:bg-zinc-100 dark:border-b-zinc-200 dark:hover:bg-zinc-200"
|
|
7192
7286
|
),
|
|
7193
7287
|
children: [
|
|
7194
|
-
/* @__PURE__ */
|
|
7288
|
+
/* @__PURE__ */ jsx47(
|
|
7195
7289
|
"td",
|
|
7196
7290
|
{
|
|
7197
7291
|
className: cn(
|
|
@@ -7201,23 +7295,23 @@ var ListItems = ({
|
|
|
7201
7295
|
children: key
|
|
7202
7296
|
}
|
|
7203
7297
|
),
|
|
7204
|
-
value !== void 0 && /* @__PURE__ */
|
|
7298
|
+
value !== void 0 && /* @__PURE__ */ jsx47(
|
|
7205
7299
|
"td",
|
|
7206
7300
|
{
|
|
7207
7301
|
className: cn("cursor-pointer truncate px-3", type === "zset" ? "w-24" : "max-w-0"),
|
|
7208
7302
|
children: value
|
|
7209
7303
|
}
|
|
7210
7304
|
),
|
|
7211
|
-
type !== "stream" && /* @__PURE__ */
|
|
7305
|
+
type !== "stream" && /* @__PURE__ */ jsx47(
|
|
7212
7306
|
"td",
|
|
7213
7307
|
{
|
|
7214
7308
|
className: "w-0 min-w-0 p-0 pr-2",
|
|
7215
7309
|
onClick: (e) => {
|
|
7216
7310
|
e.stopPropagation();
|
|
7217
7311
|
},
|
|
7218
|
-
children: /* @__PURE__ */
|
|
7219
|
-
type === "hash" && /* @__PURE__ */
|
|
7220
|
-
/* @__PURE__ */
|
|
7312
|
+
children: /* @__PURE__ */ jsxs25("div", { className: "flex items-center justify-end gap-2 pr-2", children: [
|
|
7313
|
+
type === "hash" && /* @__PURE__ */ jsx47(HashFieldTTLInfo, { dataKey, field: key, fields }),
|
|
7314
|
+
/* @__PURE__ */ jsx47(
|
|
7221
7315
|
DeleteKeyModal,
|
|
7222
7316
|
{
|
|
7223
7317
|
deletionType: "item",
|
|
@@ -7231,14 +7325,14 @@ var ListItems = ({
|
|
|
7231
7325
|
newKey: void 0
|
|
7232
7326
|
});
|
|
7233
7327
|
},
|
|
7234
|
-
children: /* @__PURE__ */
|
|
7328
|
+
children: /* @__PURE__ */ jsx47(
|
|
7235
7329
|
Button,
|
|
7236
7330
|
{
|
|
7237
7331
|
className: "",
|
|
7238
7332
|
size: "icon-sm",
|
|
7239
7333
|
variant: "secondary",
|
|
7240
7334
|
onClick: (e) => e.stopPropagation(),
|
|
7241
|
-
children: /* @__PURE__ */
|
|
7335
|
+
children: /* @__PURE__ */ jsx47(IconTrash2, { className: "size-4 text-zinc-500" })
|
|
7242
7336
|
}
|
|
7243
7337
|
)
|
|
7244
7338
|
}
|
|
@@ -7255,15 +7349,15 @@ var ListItems = ({
|
|
|
7255
7349
|
// src/components/databrowser/components/display/display-simple.tsx
|
|
7256
7350
|
import { useEffect as useEffect14 } from "react";
|
|
7257
7351
|
import { useForm as useForm4 } from "react-hook-form";
|
|
7258
|
-
import { Fragment as
|
|
7352
|
+
import { Fragment as Fragment8, jsx as jsx48, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
7259
7353
|
var EditorDisplay = ({ dataKey, type }) => {
|
|
7260
7354
|
const { data } = useFetchSimpleKey(dataKey, type);
|
|
7261
7355
|
if (data === null) {
|
|
7262
|
-
return /* @__PURE__ */
|
|
7356
|
+
return /* @__PURE__ */ jsx48(KeyDeleted, {});
|
|
7263
7357
|
}
|
|
7264
|
-
return /* @__PURE__ */
|
|
7265
|
-
/* @__PURE__ */
|
|
7266
|
-
/* @__PURE__ */
|
|
7358
|
+
return /* @__PURE__ */ jsxs26("div", { className: "flex h-full min-h-0 w-full flex-col gap-2 overflow-hidden", children: [
|
|
7359
|
+
/* @__PURE__ */ jsx48(DisplayHeader, { dataKey, type, content: data ?? void 0 }),
|
|
7360
|
+
/* @__PURE__ */ jsx48("div", { className: "flex min-h-0 grow flex-col gap-2 rounded-md", children: data === void 0 ? /* @__PURE__ */ jsx48(Spinner, { isLoadingText: "", isLoading: true }) : /* @__PURE__ */ jsx48(EditorDisplayForm, { dataKey, type, data }, dataKey) })
|
|
7267
7361
|
] });
|
|
7268
7362
|
};
|
|
7269
7363
|
var EditorDisplayForm = ({
|
|
@@ -7282,14 +7376,14 @@ var EditorDisplayForm = ({
|
|
|
7282
7376
|
const handleCancel = () => {
|
|
7283
7377
|
form.reset();
|
|
7284
7378
|
};
|
|
7285
|
-
return /* @__PURE__ */
|
|
7286
|
-
/* @__PURE__ */
|
|
7287
|
-
/* @__PURE__ */
|
|
7288
|
-
/* @__PURE__ */
|
|
7379
|
+
return /* @__PURE__ */ jsxs26(Fragment8, { children: [
|
|
7380
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex min-h-0 grow flex-col gap-1", children: [
|
|
7381
|
+
/* @__PURE__ */ jsx48("div", { className: "flex shrink-0 items-center gap-2", children: type === "json" ? /* @__PURE__ */ jsx48("div", {}) : selector }),
|
|
7382
|
+
/* @__PURE__ */ jsx48("div", { className: "min-h-0 grow rounded-md border border-zinc-300 bg-white p-2", children: editor })
|
|
7289
7383
|
] }),
|
|
7290
|
-
/* @__PURE__ */
|
|
7291
|
-
form.formState.isDirty && /* @__PURE__ */
|
|
7292
|
-
/* @__PURE__ */
|
|
7384
|
+
/* @__PURE__ */ jsx48("div", { className: "flex shrink-0 items-center gap-2", children: /* @__PURE__ */ jsxs26("div", { className: "ml-auto flex gap-2", children: [
|
|
7385
|
+
form.formState.isDirty && /* @__PURE__ */ jsx48(Button, { onClick: handleCancel, children: "Cancel" }),
|
|
7386
|
+
/* @__PURE__ */ jsx48(
|
|
7293
7387
|
Button,
|
|
7294
7388
|
{
|
|
7295
7389
|
variant: "primary",
|
|
@@ -7297,7 +7391,7 @@ var EditorDisplayForm = ({
|
|
|
7297
7391
|
await setKey(value);
|
|
7298
7392
|
}),
|
|
7299
7393
|
disabled: !form.formState.isValid || !form.formState.isDirty,
|
|
7300
|
-
children: /* @__PURE__ */
|
|
7394
|
+
children: /* @__PURE__ */ jsx48(Spinner, { isLoading: isSettingKey, isLoadingText: "Saving", children: "Save" })
|
|
7301
7395
|
}
|
|
7302
7396
|
)
|
|
7303
7397
|
] }) })
|
|
@@ -7305,15 +7399,15 @@ var EditorDisplayForm = ({
|
|
|
7305
7399
|
};
|
|
7306
7400
|
|
|
7307
7401
|
// src/components/databrowser/components/display/index.tsx
|
|
7308
|
-
import { Fragment as
|
|
7402
|
+
import { Fragment as Fragment9, jsx as jsx49, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
7309
7403
|
var DataDisplay = () => {
|
|
7310
7404
|
const { selectedKey } = useTab();
|
|
7311
7405
|
const { query } = useKeys();
|
|
7312
7406
|
const type = useKeyType(selectedKey);
|
|
7313
|
-
return /* @__PURE__ */
|
|
7407
|
+
return /* @__PURE__ */ jsx49("div", { className: "h-full rounded-xl bg-zinc-100 p-5 dark:bg-zinc-200", children: !selectedKey ? /* @__PURE__ */ jsx49("div", {}) : !type ? query.isLoading ? /* @__PURE__ */ jsx49("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsx49("span", { className: "text-zinc-500", children: "Loading..." }) }) : /* @__PURE__ */ jsx49("div", {}) : !DATA_TYPES.includes(type) ? /* @__PURE__ */ jsx49("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsxs27("span", { className: "text-zinc-500", children: [
|
|
7314
7408
|
"Unrecognized key type: ",
|
|
7315
7409
|
type
|
|
7316
|
-
] }) }) : /* @__PURE__ */
|
|
7410
|
+
] }) }) : /* @__PURE__ */ jsx49(Fragment9, { children: SIMPLE_DATA_TYPES.includes(type) ? /* @__PURE__ */ jsx49(EditorDisplay, { dataKey: selectedKey, type }) : type === "search" ? /* @__PURE__ */ jsx49(SearchDisplay, { indexName: selectedKey }) : /* @__PURE__ */ jsx49(ListDisplay, { dataKey: selectedKey, type }) }) });
|
|
7317
7411
|
};
|
|
7318
7412
|
|
|
7319
7413
|
// src/components/databrowser/components/header/index.tsx
|
|
@@ -7322,6 +7416,7 @@ import {
|
|
|
7322
7416
|
IconChevronDown as IconChevronDown2,
|
|
7323
7417
|
IconCircleCheck,
|
|
7324
7418
|
IconCirclePlus,
|
|
7419
|
+
IconLoader2 as IconLoader23,
|
|
7325
7420
|
IconPlus as IconPlus3,
|
|
7326
7421
|
IconSearch as IconSearch2,
|
|
7327
7422
|
IconSparkles
|
|
@@ -7332,7 +7427,7 @@ import { useState as useState13 } from "react";
|
|
|
7332
7427
|
import { DialogDescription as DialogDescription2 } from "@radix-ui/react-dialog";
|
|
7333
7428
|
import { IconPlus as IconPlus2 } from "@tabler/icons-react";
|
|
7334
7429
|
import { Controller as Controller4, useForm as useForm5 } from "react-hook-form";
|
|
7335
|
-
import { jsx as
|
|
7430
|
+
import { jsx as jsx50, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
7336
7431
|
function AddKeyModal() {
|
|
7337
7432
|
const { setSelectedKey } = useTab();
|
|
7338
7433
|
const [open, setOpen] = useState13(false);
|
|
@@ -7355,7 +7450,7 @@ function AddKeyModal() {
|
|
|
7355
7450
|
});
|
|
7356
7451
|
}, 100);
|
|
7357
7452
|
});
|
|
7358
|
-
return /* @__PURE__ */
|
|
7453
|
+
return /* @__PURE__ */ jsxs28(
|
|
7359
7454
|
Dialog,
|
|
7360
7455
|
{
|
|
7361
7456
|
open,
|
|
@@ -7364,35 +7459,35 @@ function AddKeyModal() {
|
|
|
7364
7459
|
setOpen(open2);
|
|
7365
7460
|
},
|
|
7366
7461
|
children: [
|
|
7367
|
-
/* @__PURE__ */
|
|
7462
|
+
/* @__PURE__ */ jsx50(SimpleTooltip, { content: "Add key", children: /* @__PURE__ */ jsx50(DialogTrigger, { asChild: true, children: /* @__PURE__ */ jsxs28(
|
|
7368
7463
|
Button,
|
|
7369
7464
|
{
|
|
7370
7465
|
variant: "primary",
|
|
7371
7466
|
"data-testid": "add-key-button",
|
|
7372
7467
|
className: "flex h-8 select-none items-center gap-1 rounded-lg pl-2 pr-3 text-sm font-medium",
|
|
7373
7468
|
children: [
|
|
7374
|
-
/* @__PURE__ */
|
|
7469
|
+
/* @__PURE__ */ jsx50(IconPlus2, { className: "size-5" }),
|
|
7375
7470
|
"Key"
|
|
7376
7471
|
]
|
|
7377
7472
|
}
|
|
7378
7473
|
) }) }),
|
|
7379
|
-
/* @__PURE__ */
|
|
7380
|
-
/* @__PURE__ */
|
|
7381
|
-
/* @__PURE__ */
|
|
7382
|
-
/* @__PURE__ */
|
|
7383
|
-
/* @__PURE__ */
|
|
7384
|
-
/* @__PURE__ */
|
|
7474
|
+
/* @__PURE__ */ jsxs28(DialogContent, { className: "max-w-[400px]", children: [
|
|
7475
|
+
/* @__PURE__ */ jsx50(DialogHeader, { children: /* @__PURE__ */ jsx50(DialogTitle, { children: "Create new key" }) }),
|
|
7476
|
+
/* @__PURE__ */ jsx50("div", { className: "sr-only", children: /* @__PURE__ */ jsx50(DialogDescription2, { children: "Create new key" }) }),
|
|
7477
|
+
/* @__PURE__ */ jsxs28("form", { className: "mt-4", onSubmit, children: [
|
|
7478
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex gap-1", children: [
|
|
7479
|
+
/* @__PURE__ */ jsx50(
|
|
7385
7480
|
Controller4,
|
|
7386
7481
|
{
|
|
7387
7482
|
control,
|
|
7388
7483
|
name: "type",
|
|
7389
|
-
render: ({ field }) => /* @__PURE__ */
|
|
7390
|
-
/* @__PURE__ */
|
|
7391
|
-
/* @__PURE__ */
|
|
7484
|
+
render: ({ field }) => /* @__PURE__ */ jsxs28(Select, { value: field.value, onValueChange: field.onChange, children: [
|
|
7485
|
+
/* @__PURE__ */ jsx50(SelectTrigger, { className: "h-8 w-auto pl-[3px] pr-8", children: /* @__PURE__ */ jsx50(SelectValue, {}) }),
|
|
7486
|
+
/* @__PURE__ */ jsx50(SelectContent, { children: /* @__PURE__ */ jsx50(SelectGroup, { children: DATA_TYPES.filter((t) => t !== "search").map((type) => /* @__PURE__ */ jsx50(SelectItem, { value: type, children: /* @__PURE__ */ jsx50(TypeTag, { variant: type, type: "badge" }) }, type)) }) })
|
|
7392
7487
|
] })
|
|
7393
7488
|
}
|
|
7394
7489
|
),
|
|
7395
|
-
/* @__PURE__ */
|
|
7490
|
+
/* @__PURE__ */ jsx50(
|
|
7396
7491
|
Controller4,
|
|
7397
7492
|
{
|
|
7398
7493
|
rules: {
|
|
@@ -7400,14 +7495,14 @@ function AddKeyModal() {
|
|
|
7400
7495
|
},
|
|
7401
7496
|
control,
|
|
7402
7497
|
name: "key",
|
|
7403
|
-
render: ({ field }) => /* @__PURE__ */
|
|
7498
|
+
render: ({ field }) => /* @__PURE__ */ jsx50(Input, { placeholder: "mykey", ...field, className: "h-8 grow" })
|
|
7404
7499
|
}
|
|
7405
7500
|
)
|
|
7406
7501
|
] }),
|
|
7407
|
-
formState.errors.key && /* @__PURE__ */
|
|
7408
|
-
/* @__PURE__ */
|
|
7409
|
-
/* @__PURE__ */
|
|
7410
|
-
/* @__PURE__ */
|
|
7502
|
+
formState.errors.key && /* @__PURE__ */ jsx50("p", { className: "mb-3 mt-2 text-xs text-red-500", children: formState.errors.key?.message }),
|
|
7503
|
+
/* @__PURE__ */ jsx50("p", { className: "mt-2 text-xs text-zinc-500", children: "After creating the key, you can edit the value" }),
|
|
7504
|
+
/* @__PURE__ */ jsxs28("div", { className: "mt-6 flex justify-end gap-2", children: [
|
|
7505
|
+
/* @__PURE__ */ jsx50(
|
|
7411
7506
|
Button,
|
|
7412
7507
|
{
|
|
7413
7508
|
type: "button",
|
|
@@ -7418,7 +7513,7 @@ function AddKeyModal() {
|
|
|
7418
7513
|
children: "Cancel"
|
|
7419
7514
|
}
|
|
7420
7515
|
),
|
|
7421
|
-
/* @__PURE__ */
|
|
7516
|
+
/* @__PURE__ */ jsx50(Button, { variant: "primary", type: "submit", children: /* @__PURE__ */ jsx50(Spinner, { isLoading: isPending, isLoadingText: "Creating", children: "Create" }) })
|
|
7422
7517
|
] })
|
|
7423
7518
|
] })
|
|
7424
7519
|
] })
|
|
@@ -7432,37 +7527,62 @@ import { useState as useState14 } from "react";
|
|
|
7432
7527
|
import { IconChevronRight as IconChevronRight3 } from "@tabler/icons-react";
|
|
7433
7528
|
import { useMutation as useMutation9 } from "@tanstack/react-query";
|
|
7434
7529
|
|
|
7530
|
+
// src/lib/scan-keys.ts
|
|
7531
|
+
async function scanKeys(redis, {
|
|
7532
|
+
match,
|
|
7533
|
+
type,
|
|
7534
|
+
count: count2 = 100,
|
|
7535
|
+
limit
|
|
7536
|
+
} = {}) {
|
|
7537
|
+
let cursor = "0";
|
|
7538
|
+
const result = [];
|
|
7539
|
+
while (true) {
|
|
7540
|
+
const [newCursor, keys] = await redis.scan(cursor, {
|
|
7541
|
+
count: count2,
|
|
7542
|
+
type,
|
|
7543
|
+
match
|
|
7544
|
+
});
|
|
7545
|
+
result.push(...keys);
|
|
7546
|
+
if (limit && result.length >= limit) {
|
|
7547
|
+
return result.slice(0, limit);
|
|
7548
|
+
}
|
|
7549
|
+
if (newCursor === "0") break;
|
|
7550
|
+
cursor = newCursor;
|
|
7551
|
+
}
|
|
7552
|
+
return result;
|
|
7553
|
+
}
|
|
7554
|
+
|
|
7435
7555
|
// src/components/databrowser/components/query-wizard/consent-prompt.tsx
|
|
7436
7556
|
import { IconAlertCircleFilled } from "@tabler/icons-react";
|
|
7437
|
-
import { jsx as
|
|
7557
|
+
import { jsx as jsx51, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
7438
7558
|
var ConsentPrompt = ({ onClose }) => {
|
|
7439
7559
|
const store = useDatabrowserStore();
|
|
7440
7560
|
const handleContinue = () => {
|
|
7441
7561
|
store.setAiDataSharingConsent(true);
|
|
7442
7562
|
};
|
|
7443
|
-
return /* @__PURE__ */
|
|
7444
|
-
/* @__PURE__ */
|
|
7445
|
-
/* @__PURE__ */
|
|
7446
|
-
/* @__PURE__ */
|
|
7563
|
+
return /* @__PURE__ */ jsxs29("div", { className: "flex max-w-[500px] flex-col gap-6 rounded-2xl p-6 shadow-lg", children: [
|
|
7564
|
+
/* @__PURE__ */ jsxs29("div", { className: "flex items-center gap-2", children: [
|
|
7565
|
+
/* @__PURE__ */ jsx51("h3", { className: "text-base font-semibold text-zinc-950", children: "AI Query Builder" }),
|
|
7566
|
+
/* @__PURE__ */ jsx51("div", { className: "flex items-center justify-center rounded-md bg-purple-100 px-1.5 py-0.5", children: /* @__PURE__ */ jsx51("span", { className: "text-sm font-medium text-purple-700", children: "BETA" }) })
|
|
7447
7567
|
] }),
|
|
7448
|
-
/* @__PURE__ */
|
|
7449
|
-
/* @__PURE__ */
|
|
7450
|
-
/* @__PURE__ */
|
|
7451
|
-
/* @__PURE__ */
|
|
7452
|
-
/* @__PURE__ */
|
|
7568
|
+
/* @__PURE__ */ jsxs29("div", { className: "flex gap-3 rounded-xl border border-yellow-300 bg-yellow-50 p-5", children: [
|
|
7569
|
+
/* @__PURE__ */ jsx51(IconAlertCircleFilled, { className: "size-5 shrink-0 text-yellow-800" }),
|
|
7570
|
+
/* @__PURE__ */ jsxs29("div", { className: "flex flex-col gap-1.5", children: [
|
|
7571
|
+
/* @__PURE__ */ jsx51("p", { className: "text-sm font-semibold text-yellow-800", children: "AI Query Builder requires data sharing" }),
|
|
7572
|
+
/* @__PURE__ */ jsxs29("p", { className: "text-sm text-yellow-800", children: [
|
|
7453
7573
|
"To generate accurate queries, we'll send your",
|
|
7454
7574
|
" ",
|
|
7455
|
-
/* @__PURE__ */
|
|
7575
|
+
/* @__PURE__ */ jsx51("span", { className: "font-semibold", children: "index schema" }),
|
|
7456
7576
|
" and a",
|
|
7457
7577
|
" ",
|
|
7458
|
-
/* @__PURE__ */
|
|
7578
|
+
/* @__PURE__ */ jsx51("span", { className: "font-semibold", children: "small sample of your data" }),
|
|
7459
7579
|
" to AI models. This may include field names and example values."
|
|
7460
7580
|
] }),
|
|
7461
|
-
/* @__PURE__ */
|
|
7581
|
+
/* @__PURE__ */ jsx51("p", { className: "text-sm text-yellow-800", children: "Only used to generate the query you request." })
|
|
7462
7582
|
] })
|
|
7463
7583
|
] }),
|
|
7464
|
-
/* @__PURE__ */
|
|
7465
|
-
/* @__PURE__ */
|
|
7584
|
+
/* @__PURE__ */ jsxs29("div", { className: "flex items-center justify-end gap-2", children: [
|
|
7585
|
+
/* @__PURE__ */ jsx51(
|
|
7466
7586
|
"button",
|
|
7467
7587
|
{
|
|
7468
7588
|
onClick: onClose,
|
|
@@ -7470,7 +7590,7 @@ var ConsentPrompt = ({ onClose }) => {
|
|
|
7470
7590
|
children: "Cancel"
|
|
7471
7591
|
}
|
|
7472
7592
|
),
|
|
7473
|
-
/* @__PURE__ */
|
|
7593
|
+
/* @__PURE__ */ jsx51(
|
|
7474
7594
|
"button",
|
|
7475
7595
|
{
|
|
7476
7596
|
onClick: handleContinue,
|
|
@@ -8404,7 +8524,7 @@ var useGenerateQuery = () => {
|
|
|
8404
8524
|
};
|
|
8405
8525
|
|
|
8406
8526
|
// src/components/databrowser/components/query-wizard/query-wizard-popover.tsx
|
|
8407
|
-
import { Fragment as
|
|
8527
|
+
import { Fragment as Fragment10, jsx as jsx52, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
8408
8528
|
var QueryWizardPopover = ({ onClose }) => {
|
|
8409
8529
|
const { valuesSearch, setValuesSearchQuery, setQueryBuilderMode } = useTab();
|
|
8410
8530
|
const { redisNoPipeline: redis } = useRedis();
|
|
@@ -8464,47 +8584,47 @@ var QueryWizardPopover = ({ onClose }) => {
|
|
|
8464
8584
|
}
|
|
8465
8585
|
};
|
|
8466
8586
|
if (isLoadingIndex) {
|
|
8467
|
-
return /* @__PURE__ */
|
|
8587
|
+
return /* @__PURE__ */ jsx52("div", { className: "flex h-[100px] w-[340px] items-center justify-center rounded-2xl bg-white", children: /* @__PURE__ */ jsx52(Spinner, { isLoading: true, isLoadingText: "Loading index..." }) });
|
|
8468
8588
|
}
|
|
8469
8589
|
if (!valuesSearch.index) {
|
|
8470
|
-
return /* @__PURE__ */
|
|
8471
|
-
/* @__PURE__ */
|
|
8472
|
-
/* @__PURE__ */
|
|
8590
|
+
return /* @__PURE__ */ jsxs30("div", { className: "flex w-[340px] flex-col items-center gap-2 rounded-2xl bg-white p-8", children: [
|
|
8591
|
+
/* @__PURE__ */ jsx52("p", { className: "text-sm font-medium text-zinc-700", children: "No index selected" }),
|
|
8592
|
+
/* @__PURE__ */ jsx52("p", { className: "text-center text-xs text-zinc-500", children: "Create a new index to use the Query Wizard." })
|
|
8473
8593
|
] });
|
|
8474
8594
|
}
|
|
8475
8595
|
if (aiDataSharingConsent === false) {
|
|
8476
|
-
return /* @__PURE__ */
|
|
8596
|
+
return /* @__PURE__ */ jsx52(ConsentPrompt, { onClose });
|
|
8477
8597
|
}
|
|
8478
|
-
return /* @__PURE__ */
|
|
8479
|
-
/* @__PURE__ */
|
|
8480
|
-
/* @__PURE__ */
|
|
8481
|
-
/* @__PURE__ */
|
|
8598
|
+
return /* @__PURE__ */ jsxs30("div", { className: "flex w-[500px] flex-col gap-6 rounded-2xl bg-white p-6", children: [
|
|
8599
|
+
/* @__PURE__ */ jsxs30("div", { className: "flex items-center gap-2", children: [
|
|
8600
|
+
/* @__PURE__ */ jsx52("h3", { className: "text-base font-semibold text-zinc-950", children: "AI Query Builder" }),
|
|
8601
|
+
/* @__PURE__ */ jsx52("div", { className: "flex items-center justify-center rounded-md bg-purple-100 px-1.5 py-0.5", children: /* @__PURE__ */ jsx52("span", { className: "!text-sm font-medium text-purple-700", children: "BETA" }) })
|
|
8482
8602
|
] }),
|
|
8483
|
-
generateQuery.error && /* @__PURE__ */
|
|
8484
|
-
/* @__PURE__ */
|
|
8485
|
-
/* @__PURE__ */
|
|
8603
|
+
generateQuery.error && /* @__PURE__ */ jsxs30("div", { className: "mt-2 rounded-md border border-yellow-300 bg-yellow-50 p-4", children: [
|
|
8604
|
+
/* @__PURE__ */ jsx52("p", { className: "!text-sm font-medium !text-yellow-800", children: generateQuery.error.name }),
|
|
8605
|
+
/* @__PURE__ */ jsx52("p", { className: "mt-0.5 !text-sm !text-yellow-800 opacity-90", children: generateQuery.error.message })
|
|
8486
8606
|
] }),
|
|
8487
|
-
/* @__PURE__ */
|
|
8488
|
-
/* @__PURE__ */
|
|
8607
|
+
/* @__PURE__ */ jsxs30("div", { className: "flex flex-col gap-5", children: [
|
|
8608
|
+
/* @__PURE__ */ jsxs30(
|
|
8489
8609
|
"button",
|
|
8490
8610
|
{
|
|
8491
8611
|
onClick: () => setShowIndexFields(!showIndexFields),
|
|
8492
8612
|
className: "flex h-8 items-center gap-1.5 rounded-md border border-zinc-300 bg-zinc-50 px-3 hover:bg-zinc-100",
|
|
8493
8613
|
children: [
|
|
8494
|
-
/* @__PURE__ */
|
|
8614
|
+
/* @__PURE__ */ jsx52(
|
|
8495
8615
|
IconChevronRight3,
|
|
8496
8616
|
{
|
|
8497
8617
|
className: `size-5 text-zinc-700 transition-transform ${showIndexFields ? "rotate-90" : ""}`
|
|
8498
8618
|
}
|
|
8499
8619
|
),
|
|
8500
|
-
/* @__PURE__ */
|
|
8620
|
+
/* @__PURE__ */ jsx52("span", { className: "text-sm font-medium text-zinc-700", children: "Show Index fields" })
|
|
8501
8621
|
]
|
|
8502
8622
|
}
|
|
8503
8623
|
),
|
|
8504
|
-
showIndexFields && indexData && /* @__PURE__ */
|
|
8505
|
-
/* @__PURE__ */
|
|
8506
|
-
/* @__PURE__ */
|
|
8507
|
-
/* @__PURE__ */
|
|
8624
|
+
showIndexFields && indexData && /* @__PURE__ */ jsx52("div", { className: "rounded-md border border-zinc-200 bg-zinc-50 p-3", children: /* @__PURE__ */ jsx52("pre", { className: "max-h-40 overflow-auto text-xs text-zinc-700", children: JSON.stringify(indexData.schema, null, 2) }) }),
|
|
8625
|
+
/* @__PURE__ */ jsxs30("div", { className: "flex flex-col gap-1", children: [
|
|
8626
|
+
/* @__PURE__ */ jsx52(Label, { htmlFor: "query-input", className: "text-sm font-medium text-zinc-950", children: "Describe" }),
|
|
8627
|
+
/* @__PURE__ */ jsx52(
|
|
8508
8628
|
"textarea",
|
|
8509
8629
|
{
|
|
8510
8630
|
id: "query-input",
|
|
@@ -8516,14 +8636,14 @@ var QueryWizardPopover = ({ onClose }) => {
|
|
|
8516
8636
|
autoFocus: true
|
|
8517
8637
|
}
|
|
8518
8638
|
),
|
|
8519
|
-
/* @__PURE__ */
|
|
8520
|
-
/* @__PURE__ */
|
|
8521
|
-
/* @__PURE__ */
|
|
8639
|
+
/* @__PURE__ */ jsxs30("div", { children: [
|
|
8640
|
+
/* @__PURE__ */ jsx52("span", { className: "text-xs text-zinc-500", children: 'Example: Find people named "John", boost if older than 20.' }),
|
|
8641
|
+
/* @__PURE__ */ jsx52(DocsLink, { href: "https://upstash-search.mintlify.app/redis/search/query-operators/boolean-operators/overview" })
|
|
8522
8642
|
] })
|
|
8523
8643
|
] })
|
|
8524
8644
|
] }),
|
|
8525
|
-
/* @__PURE__ */
|
|
8526
|
-
/* @__PURE__ */
|
|
8645
|
+
/* @__PURE__ */ jsxs30("div", { className: "flex items-center justify-end gap-2", children: [
|
|
8646
|
+
/* @__PURE__ */ jsx52(
|
|
8527
8647
|
"button",
|
|
8528
8648
|
{
|
|
8529
8649
|
onClick: onClose,
|
|
@@ -8532,17 +8652,17 @@ var QueryWizardPopover = ({ onClose }) => {
|
|
|
8532
8652
|
children: "Cancel"
|
|
8533
8653
|
}
|
|
8534
8654
|
),
|
|
8535
|
-
/* @__PURE__ */
|
|
8655
|
+
/* @__PURE__ */ jsx52(
|
|
8536
8656
|
"button",
|
|
8537
8657
|
{
|
|
8538
8658
|
onClick: handleGenerate,
|
|
8539
8659
|
disabled: !input.trim() || generateQuery.isPending || fetchSampleKeys.isPending,
|
|
8540
8660
|
className: "flex h-8 items-center justify-center gap-2 rounded-md bg-purple-500 px-4 text-sm text-white shadow-[0_1px_1px_rgba(0,0,0,0.05)] hover:bg-purple-600 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-purple-500",
|
|
8541
|
-
children: fetchSampleKeys.isPending ? /* @__PURE__ */
|
|
8542
|
-
/* @__PURE__ */
|
|
8661
|
+
children: fetchSampleKeys.isPending ? /* @__PURE__ */ jsxs30(Fragment10, { children: [
|
|
8662
|
+
/* @__PURE__ */ jsx52(Spinner, { isLoading: true }),
|
|
8543
8663
|
"Sampling keys..."
|
|
8544
|
-
] }) : generateQuery.isPending ? /* @__PURE__ */
|
|
8545
|
-
/* @__PURE__ */
|
|
8664
|
+
] }) : generateQuery.isPending ? /* @__PURE__ */ jsxs30(Fragment10, { children: [
|
|
8665
|
+
/* @__PURE__ */ jsx52(Spinner, { isLoading: true }),
|
|
8546
8666
|
"Generating..."
|
|
8547
8667
|
] }) : "Generate Query"
|
|
8548
8668
|
}
|
|
@@ -8552,12 +8672,12 @@ var QueryWizardPopover = ({ onClose }) => {
|
|
|
8552
8672
|
};
|
|
8553
8673
|
|
|
8554
8674
|
// src/components/databrowser/components/search/create-index-modal.tsx
|
|
8555
|
-
import { jsx as
|
|
8675
|
+
import { jsx as jsx53, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
8556
8676
|
var CreateIndexModal = ({
|
|
8557
8677
|
open,
|
|
8558
8678
|
onOpenChange
|
|
8559
8679
|
}) => {
|
|
8560
|
-
return /* @__PURE__ */
|
|
8680
|
+
return /* @__PURE__ */ jsx53(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs31(
|
|
8561
8681
|
DialogContent,
|
|
8562
8682
|
{
|
|
8563
8683
|
className: "max-w-2xl",
|
|
@@ -8568,9 +8688,9 @@ var CreateIndexModal = ({
|
|
|
8568
8688
|
}
|
|
8569
8689
|
},
|
|
8570
8690
|
children: [
|
|
8571
|
-
/* @__PURE__ */
|
|
8572
|
-
/* @__PURE__ */
|
|
8573
|
-
/* @__PURE__ */
|
|
8691
|
+
/* @__PURE__ */ jsx53(DialogHeader, { children: /* @__PURE__ */ jsx53(DialogTitle, { children: "Create new Index" }) }),
|
|
8692
|
+
/* @__PURE__ */ jsx53("div", { className: "sr-only", children: /* @__PURE__ */ jsx53(DialogDescription, { children: "Create new search index" }) }),
|
|
8693
|
+
/* @__PURE__ */ jsx53(SearchDisplay, { isCreateModal: true, onClose: () => onOpenChange(false) })
|
|
8574
8694
|
]
|
|
8575
8695
|
}
|
|
8576
8696
|
) });
|
|
@@ -8578,7 +8698,7 @@ var CreateIndexModal = ({
|
|
|
8578
8698
|
|
|
8579
8699
|
// src/components/databrowser/components/search/edit-index-modal.tsx
|
|
8580
8700
|
import { useEffect as useEffect15 } from "react";
|
|
8581
|
-
import { jsx as
|
|
8701
|
+
import { jsx as jsx54, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
8582
8702
|
var EditIndexModal = ({
|
|
8583
8703
|
open,
|
|
8584
8704
|
onOpenChange,
|
|
@@ -8592,7 +8712,7 @@ var EditIndexModal = ({
|
|
|
8592
8712
|
onOpenChange(false);
|
|
8593
8713
|
}
|
|
8594
8714
|
}, [indexData, onOpenChange, isIndexLoading, open]);
|
|
8595
|
-
return /* @__PURE__ */
|
|
8715
|
+
return /* @__PURE__ */ jsx54(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs32(
|
|
8596
8716
|
DialogContent,
|
|
8597
8717
|
{
|
|
8598
8718
|
className: "min-h-[500px] max-w-2xl",
|
|
@@ -8603,9 +8723,9 @@ var EditIndexModal = ({
|
|
|
8603
8723
|
}
|
|
8604
8724
|
},
|
|
8605
8725
|
children: [
|
|
8606
|
-
/* @__PURE__ */
|
|
8607
|
-
/* @__PURE__ */
|
|
8608
|
-
indexName && /* @__PURE__ */
|
|
8726
|
+
/* @__PURE__ */ jsx54(DialogHeader, { children: /* @__PURE__ */ jsx54(DialogTitle, { children: "Edit Index" }) }),
|
|
8727
|
+
/* @__PURE__ */ jsx54("div", { className: "sr-only", children: /* @__PURE__ */ jsx54(DialogDescription, { children: "Edit search index schema" }) }),
|
|
8728
|
+
indexName && /* @__PURE__ */ jsx54(SearchDisplay, { indexName, isEditModal: true, onClose: () => onOpenChange(false) })
|
|
8609
8729
|
]
|
|
8610
8730
|
}
|
|
8611
8731
|
) });
|
|
@@ -8617,7 +8737,7 @@ import { useMutation as useMutation10 } from "@tanstack/react-query";
|
|
|
8617
8737
|
// src/components/common/reload-button.tsx
|
|
8618
8738
|
import { useState as useState15 } from "react";
|
|
8619
8739
|
import { IconLoader2 as IconLoader22, IconRefresh } from "@tabler/icons-react";
|
|
8620
|
-
import { jsx as
|
|
8740
|
+
import { jsx as jsx55 } from "react/jsx-runtime";
|
|
8621
8741
|
var ReloadButton = ({
|
|
8622
8742
|
onClick,
|
|
8623
8743
|
isLoading: isLoadingProp,
|
|
@@ -8631,20 +8751,20 @@ var ReloadButton = ({
|
|
|
8631
8751
|
setIsLoading(false);
|
|
8632
8752
|
}, 350);
|
|
8633
8753
|
};
|
|
8634
|
-
return /* @__PURE__ */
|
|
8754
|
+
return /* @__PURE__ */ jsx55("div", { children: /* @__PURE__ */ jsx55(SimpleTooltip, { content: tooltip, children: /* @__PURE__ */ jsx55(
|
|
8635
8755
|
Button,
|
|
8636
8756
|
{
|
|
8637
8757
|
variant: "outline",
|
|
8638
8758
|
size: "icon",
|
|
8639
8759
|
onClick: handleClick,
|
|
8640
8760
|
disabled: isLoading || isLoadingProp,
|
|
8641
|
-
children: isLoading ? /* @__PURE__ */
|
|
8761
|
+
children: isLoading ? /* @__PURE__ */ jsx55(IconLoader22, { className: "size-5 animate-spin text-zinc-500" }) : /* @__PURE__ */ jsx55(IconRefresh, { className: "size-5 text-zinc-500 dark:text-zinc-600" })
|
|
8642
8762
|
}
|
|
8643
8763
|
) }) });
|
|
8644
8764
|
};
|
|
8645
8765
|
|
|
8646
8766
|
// src/components/databrowser/components/header/refresh-button.tsx
|
|
8647
|
-
import { jsx as
|
|
8767
|
+
import { jsx as jsx56 } from "react/jsx-runtime";
|
|
8648
8768
|
var invalidateAll = () => {
|
|
8649
8769
|
queryClient.invalidateQueries({ queryKey: [FETCH_KEYS_QUERY_KEY] });
|
|
8650
8770
|
queryClient.invalidateQueries({ queryKey: [FETCH_LIST_ITEMS_QUERY_KEY] });
|
|
@@ -8663,7 +8783,7 @@ var RefreshButton = () => {
|
|
|
8663
8783
|
},
|
|
8664
8784
|
onSettled: invalidateAll
|
|
8665
8785
|
});
|
|
8666
|
-
return /* @__PURE__ */
|
|
8786
|
+
return /* @__PURE__ */ jsx56(
|
|
8667
8787
|
ReloadButton,
|
|
8668
8788
|
{
|
|
8669
8789
|
onClick: () => reindex.mutate(),
|
|
@@ -8676,7 +8796,7 @@ var RefreshButton = () => {
|
|
|
8676
8796
|
// src/components/databrowser/components/header/search-input.tsx
|
|
8677
8797
|
import { useEffect as useEffect16, useRef as useRef5, useState as useState16 } from "react";
|
|
8678
8798
|
import { IconX as IconX2 } from "@tabler/icons-react";
|
|
8679
|
-
import { jsx as
|
|
8799
|
+
import { jsx as jsx57, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
8680
8800
|
var dedupeSearchHistory = (history) => {
|
|
8681
8801
|
const seen = /* @__PURE__ */ new Set();
|
|
8682
8802
|
return history.filter((item) => {
|
|
@@ -8732,9 +8852,9 @@ var SearchInput = () => {
|
|
|
8732
8852
|
}
|
|
8733
8853
|
}
|
|
8734
8854
|
};
|
|
8735
|
-
return /* @__PURE__ */
|
|
8736
|
-
/* @__PURE__ */
|
|
8737
|
-
/* @__PURE__ */
|
|
8855
|
+
return /* @__PURE__ */ jsxs33("div", { className: "relative grow", children: [
|
|
8856
|
+
/* @__PURE__ */ jsxs33(Popover, { open: isFocus && filteredHistory.length > 0, children: [
|
|
8857
|
+
/* @__PURE__ */ jsx57(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx57("div", { className: "h-8 rounded-md border border-zinc-300 font-normal", children: /* @__PURE__ */ jsx57(
|
|
8738
8858
|
Input,
|
|
8739
8859
|
{
|
|
8740
8860
|
ref: inputRef,
|
|
@@ -8753,7 +8873,7 @@ var SearchInput = () => {
|
|
|
8753
8873
|
onBlur: () => setIsFocus(false)
|
|
8754
8874
|
}
|
|
8755
8875
|
) }) }),
|
|
8756
|
-
/* @__PURE__ */
|
|
8876
|
+
/* @__PURE__ */ jsx57(
|
|
8757
8877
|
PopoverContent,
|
|
8758
8878
|
{
|
|
8759
8879
|
className: "w-[--radix-popover-trigger-width] divide-y px-3 py-2 text-[13px] text-zinc-900",
|
|
@@ -8762,7 +8882,7 @@ var SearchInput = () => {
|
|
|
8762
8882
|
e.preventDefault();
|
|
8763
8883
|
e.stopPropagation();
|
|
8764
8884
|
},
|
|
8765
|
-
children: filteredHistory.map((item, index) => /* @__PURE__ */
|
|
8885
|
+
children: filteredHistory.map((item, index) => /* @__PURE__ */ jsx57("div", { className: "w-full py-[3px]", children: /* @__PURE__ */ jsx57(
|
|
8766
8886
|
"button",
|
|
8767
8887
|
{
|
|
8768
8888
|
ref: (el) => {
|
|
@@ -8777,7 +8897,7 @@ var SearchInput = () => {
|
|
|
8777
8897
|
}
|
|
8778
8898
|
)
|
|
8779
8899
|
] }),
|
|
8780
|
-
state && /* @__PURE__ */
|
|
8900
|
+
state && /* @__PURE__ */ jsxs33(
|
|
8781
8901
|
Button,
|
|
8782
8902
|
{
|
|
8783
8903
|
type: "button",
|
|
@@ -8789,8 +8909,8 @@ var SearchInput = () => {
|
|
|
8789
8909
|
setState("");
|
|
8790
8910
|
},
|
|
8791
8911
|
children: [
|
|
8792
|
-
/* @__PURE__ */
|
|
8793
|
-
/* @__PURE__ */
|
|
8912
|
+
/* @__PURE__ */ jsx57(IconX2, { size: 16 }),
|
|
8913
|
+
/* @__PURE__ */ jsx57("span", { className: "sr-only", children: "Clear" })
|
|
8794
8914
|
]
|
|
8795
8915
|
}
|
|
8796
8916
|
),
|
|
@@ -8799,7 +8919,7 @@ var SearchInput = () => {
|
|
|
8799
8919
|
};
|
|
8800
8920
|
|
|
8801
8921
|
// src/components/databrowser/components/header/type-selector.tsx
|
|
8802
|
-
import { jsx as
|
|
8922
|
+
import { jsx as jsx58, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
8803
8923
|
var ALL_TYPES_KEY = "all";
|
|
8804
8924
|
function DataTypeSelector({ allowSearch }) {
|
|
8805
8925
|
const { search, setSearchType } = useTab();
|
|
@@ -8807,7 +8927,7 @@ function DataTypeSelector({ allowSearch }) {
|
|
|
8807
8927
|
[ALL_TYPES_KEY, "All Types"],
|
|
8808
8928
|
...Object.entries(DATA_TYPE_NAMES).filter(([key]) => allowSearch || key !== "search")
|
|
8809
8929
|
];
|
|
8810
|
-
return /* @__PURE__ */
|
|
8930
|
+
return /* @__PURE__ */ jsxs34(
|
|
8811
8931
|
Select,
|
|
8812
8932
|
{
|
|
8813
8933
|
onValueChange: (type) => {
|
|
@@ -8819,20 +8939,20 @@ function DataTypeSelector({ allowSearch }) {
|
|
|
8819
8939
|
},
|
|
8820
8940
|
value: search.type === void 0 ? ALL_TYPES_KEY : search.type,
|
|
8821
8941
|
children: [
|
|
8822
|
-
/* @__PURE__ */
|
|
8823
|
-
/* @__PURE__ */
|
|
8942
|
+
/* @__PURE__ */ jsx58(SelectTrigger, { className: "!w-auto shrink-0 select-none whitespace-nowrap border-zinc-300 pr-8", children: /* @__PURE__ */ jsx58(SelectValue, {}) }),
|
|
8943
|
+
/* @__PURE__ */ jsx58(SelectContent, { children: /* @__PURE__ */ jsx58(SelectGroup, { children: entries.map(([key, value]) => /* @__PURE__ */ jsx58(SelectItem, { value: key, children: value }, key)) }) })
|
|
8824
8944
|
]
|
|
8825
8945
|
}
|
|
8826
8946
|
);
|
|
8827
8947
|
}
|
|
8828
8948
|
|
|
8829
8949
|
// src/components/databrowser/components/header/index.tsx
|
|
8830
|
-
import { Fragment as
|
|
8950
|
+
import { Fragment as Fragment11, jsx as jsx59, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
8831
8951
|
var Header = ({ tabType, allowSearch }) => {
|
|
8832
8952
|
const { isValuesSearchSelected, setIsValuesSearchSelected } = useTab();
|
|
8833
|
-
return /* @__PURE__ */
|
|
8834
|
-
/* @__PURE__ */
|
|
8835
|
-
tabType === "all" && /* @__PURE__ */
|
|
8953
|
+
return /* @__PURE__ */ jsxs35("div", { className: "flex items-center justify-between gap-1.5", children: [
|
|
8954
|
+
/* @__PURE__ */ jsxs35("div", { className: "flex grow items-center gap-1.5", children: [
|
|
8955
|
+
tabType === "all" && /* @__PURE__ */ jsx59(
|
|
8836
8956
|
Segmented,
|
|
8837
8957
|
{
|
|
8838
8958
|
options: [
|
|
@@ -8842,9 +8962,9 @@ var Header = ({ tabType, allowSearch }) => {
|
|
|
8842
8962
|
},
|
|
8843
8963
|
{
|
|
8844
8964
|
key: "values",
|
|
8845
|
-
label: /* @__PURE__ */
|
|
8965
|
+
label: /* @__PURE__ */ jsxs35("div", { className: "flex items-center gap-1", children: [
|
|
8846
8966
|
"Search",
|
|
8847
|
-
/* @__PURE__ */
|
|
8967
|
+
/* @__PURE__ */ jsx59("div", { className: "flex h-[18px] items-center rounded-md bg-emerald-100 px-[5px] text-[11px] text-emerald-700", children: "NEW" })
|
|
8848
8968
|
] })
|
|
8849
8969
|
}
|
|
8850
8970
|
],
|
|
@@ -8857,15 +8977,15 @@ var Header = ({ tabType, allowSearch }) => {
|
|
|
8857
8977
|
selectedClassName: "bg-emerald-50 text-emerald-800"
|
|
8858
8978
|
}
|
|
8859
8979
|
),
|
|
8860
|
-
isValuesSearchSelected ? /* @__PURE__ */
|
|
8861
|
-
/* @__PURE__ */
|
|
8862
|
-
/* @__PURE__ */
|
|
8980
|
+
isValuesSearchSelected ? /* @__PURE__ */ jsx59(IndexSelector, {}) : /* @__PURE__ */ jsxs35(Fragment11, { children: [
|
|
8981
|
+
/* @__PURE__ */ jsx59(DataTypeSelector, { allowSearch }),
|
|
8982
|
+
/* @__PURE__ */ jsx59(SearchInput, {})
|
|
8863
8983
|
] })
|
|
8864
8984
|
] }),
|
|
8865
|
-
/* @__PURE__ */
|
|
8866
|
-
isValuesSearchSelected && /* @__PURE__ */
|
|
8867
|
-
/* @__PURE__ */
|
|
8868
|
-
isValuesSearchSelected ? /* @__PURE__ */
|
|
8985
|
+
/* @__PURE__ */ jsxs35("div", { className: "flex items-center gap-1.5", children: [
|
|
8986
|
+
isValuesSearchSelected && /* @__PURE__ */ jsx59(WizardButton, {}),
|
|
8987
|
+
/* @__PURE__ */ jsx59(RefreshButton, {}),
|
|
8988
|
+
isValuesSearchSelected ? /* @__PURE__ */ jsx59(AddIndexButton, {}) : /* @__PURE__ */ jsx59(AddKeyModal, {})
|
|
8869
8989
|
] })
|
|
8870
8990
|
] });
|
|
8871
8991
|
};
|
|
@@ -8874,26 +8994,33 @@ var IndexSelector = () => {
|
|
|
8874
8994
|
valuesSearch: { index },
|
|
8875
8995
|
setValuesSearchIndex
|
|
8876
8996
|
} = useTab();
|
|
8877
|
-
const { data: indexes, isLoading } = useFetchSearchIndexes();
|
|
8878
8997
|
const [open, setOpen] = useState17(false);
|
|
8998
|
+
const [search, setSearch] = useState17("");
|
|
8999
|
+
const debouncedSearch = useDebounce(search, 150);
|
|
9000
|
+
const match = debouncedSearch ? `${debouncedSearch}*` : void 0;
|
|
9001
|
+
const {
|
|
9002
|
+
data: indexes,
|
|
9003
|
+
isLoading,
|
|
9004
|
+
hasNextPage,
|
|
9005
|
+
fetchNextPage,
|
|
9006
|
+
isFetchingNextPage
|
|
9007
|
+
} = useFetchSearchIndexes({ match });
|
|
9008
|
+
const [editingIndex, setEditingIndex] = useState17();
|
|
8879
9009
|
useEffect17(() => {
|
|
8880
|
-
if (!indexes || isLoading) return;
|
|
9010
|
+
if (!indexes || isLoading || debouncedSearch) return;
|
|
8881
9011
|
if (index && !indexes.includes(index)) {
|
|
8882
9012
|
setValuesSearchIndex("");
|
|
8883
9013
|
} else if (!index && indexes.length > 0) {
|
|
8884
9014
|
setValuesSearchIndex(indexes[0]);
|
|
8885
9015
|
}
|
|
8886
|
-
}, [indexes, index, isLoading, setValuesSearchIndex]);
|
|
8887
|
-
const [search, setSearch] = useState17("");
|
|
8888
|
-
const [editingIndex, setEditingIndex] = useState17();
|
|
8889
|
-
const filteredIndexes = indexes?.filter((idx) => idx.toLowerCase().includes(search.toLowerCase()));
|
|
9016
|
+
}, [indexes, index, isLoading, setValuesSearchIndex, debouncedSearch]);
|
|
8890
9017
|
const handleEditIndex = (indexName) => {
|
|
8891
9018
|
setOpen(false);
|
|
8892
9019
|
setEditingIndex(indexName);
|
|
8893
9020
|
};
|
|
8894
|
-
return /* @__PURE__ */
|
|
8895
|
-
/* @__PURE__ */
|
|
8896
|
-
/* @__PURE__ */
|
|
9021
|
+
return /* @__PURE__ */ jsxs35("div", { className: "flex", children: [
|
|
9022
|
+
/* @__PURE__ */ jsx59("div", { className: "flex items-center rounded-l-lg border border-r-0 border-zinc-300 bg-white px-3 text-sm text-zinc-700", children: "Index" }),
|
|
9023
|
+
/* @__PURE__ */ jsxs35(
|
|
8897
9024
|
Popover,
|
|
8898
9025
|
{
|
|
8899
9026
|
open,
|
|
@@ -8903,16 +9030,16 @@ var IndexSelector = () => {
|
|
|
8903
9030
|
},
|
|
8904
9031
|
modal: false,
|
|
8905
9032
|
children: [
|
|
8906
|
-
/* @__PURE__ */
|
|
8907
|
-
/* @__PURE__ */
|
|
8908
|
-
/* @__PURE__ */
|
|
9033
|
+
/* @__PURE__ */ jsx59(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs35("button", { className: "flex min-w-[140px] items-center justify-between gap-2 rounded-r-lg border border-zinc-300 bg-emerald-50 px-3 py-[5px] text-sm font-medium text-emerald-800 transition-colors hover:bg-emerald-100", children: [
|
|
9034
|
+
/* @__PURE__ */ jsx59("span", { className: "truncate", children: index || "Select an index" }),
|
|
9035
|
+
/* @__PURE__ */ jsx59(IconChevronDown2, { className: "size-4 shrink-0 opacity-50" })
|
|
8909
9036
|
] }) }),
|
|
8910
|
-
/* @__PURE__ */
|
|
8911
|
-
/* @__PURE__ */
|
|
8912
|
-
/* @__PURE__ */
|
|
8913
|
-
/* @__PURE__ */
|
|
8914
|
-
/* @__PURE__ */
|
|
8915
|
-
/* @__PURE__ */
|
|
9037
|
+
/* @__PURE__ */ jsx59(PopoverContent, { className: "p-2", align: "center", children: /* @__PURE__ */ jsxs35("div", { className: "flex flex-col gap-2", children: [
|
|
9038
|
+
/* @__PURE__ */ jsx59(CreateIndexButton, {}),
|
|
9039
|
+
/* @__PURE__ */ jsx59("div", { className: "h-px bg-zinc-100" }),
|
|
9040
|
+
/* @__PURE__ */ jsxs35("div", { className: "flex h-9 items-center rounded-md border border-zinc-300 px-2", children: [
|
|
9041
|
+
/* @__PURE__ */ jsx59(IconSearch2, { className: "size-5 text-zinc-400" }),
|
|
9042
|
+
/* @__PURE__ */ jsx59(
|
|
8916
9043
|
"input",
|
|
8917
9044
|
{
|
|
8918
9045
|
value: search,
|
|
@@ -8922,14 +9049,15 @@ var IndexSelector = () => {
|
|
|
8922
9049
|
}
|
|
8923
9050
|
)
|
|
8924
9051
|
] }),
|
|
8925
|
-
/* @__PURE__ */
|
|
8926
|
-
|
|
8927
|
-
|
|
9052
|
+
/* @__PURE__ */ jsxs35("div", { className: "max-h-[200px] overflow-y-auto", children: [
|
|
9053
|
+
isLoading && !indexes && /* @__PURE__ */ jsx59("div", { className: "flex items-center justify-center py-4", children: /* @__PURE__ */ jsx59(IconLoader23, { className: "size-4 animate-spin text-zinc-400" }) }),
|
|
9054
|
+
!isLoading && indexes?.length === 0 && /* @__PURE__ */ jsx59("div", { className: "py-4 text-center text-sm text-zinc-500", children: "No indexes found" }),
|
|
9055
|
+
indexes?.map((idx) => /* @__PURE__ */ jsxs35(
|
|
8928
9056
|
"div",
|
|
8929
9057
|
{
|
|
8930
9058
|
className: "flex h-9 items-center rounded-md px-2 transition-colors hover:bg-zinc-100 dark:hover:bg-zinc-200",
|
|
8931
9059
|
children: [
|
|
8932
|
-
/* @__PURE__ */
|
|
9060
|
+
/* @__PURE__ */ jsxs35(
|
|
8933
9061
|
"button",
|
|
8934
9062
|
{
|
|
8935
9063
|
onClick: () => {
|
|
@@ -8938,21 +9066,21 @@ var IndexSelector = () => {
|
|
|
8938
9066
|
},
|
|
8939
9067
|
className: "flex flex-1 items-center gap-2 text-left text-sm",
|
|
8940
9068
|
children: [
|
|
8941
|
-
/* @__PURE__ */
|
|
9069
|
+
/* @__PURE__ */ jsx59(
|
|
8942
9070
|
"span",
|
|
8943
9071
|
{
|
|
8944
9072
|
className: cn(
|
|
8945
9073
|
"flex size-5 items-center justify-center",
|
|
8946
9074
|
idx === index ? "text-emerald-600" : "text-transparent"
|
|
8947
9075
|
),
|
|
8948
|
-
children: /* @__PURE__ */
|
|
9076
|
+
children: /* @__PURE__ */ jsx59(IconCircleCheck, { className: "size-5" })
|
|
8949
9077
|
}
|
|
8950
9078
|
),
|
|
8951
|
-
/* @__PURE__ */
|
|
9079
|
+
/* @__PURE__ */ jsx59("span", { className: "truncate", children: idx })
|
|
8952
9080
|
]
|
|
8953
9081
|
}
|
|
8954
9082
|
),
|
|
8955
|
-
/* @__PURE__ */
|
|
9083
|
+
/* @__PURE__ */ jsx59(
|
|
8956
9084
|
"button",
|
|
8957
9085
|
{
|
|
8958
9086
|
onClick: (event) => {
|
|
@@ -8967,13 +9095,22 @@ var IndexSelector = () => {
|
|
|
8967
9095
|
]
|
|
8968
9096
|
},
|
|
8969
9097
|
idx
|
|
8970
|
-
))
|
|
9098
|
+
)),
|
|
9099
|
+
hasNextPage && /* @__PURE__ */ jsx59(
|
|
9100
|
+
"button",
|
|
9101
|
+
{
|
|
9102
|
+
onClick: () => fetchNextPage(),
|
|
9103
|
+
disabled: isFetchingNextPage,
|
|
9104
|
+
className: "flex h-9 w-full items-center justify-center rounded-md text-sm text-emerald-600 transition-colors hover:bg-zinc-100 disabled:opacity-50",
|
|
9105
|
+
children: isFetchingNextPage ? "Loading..." : "Load more"
|
|
9106
|
+
}
|
|
9107
|
+
)
|
|
8971
9108
|
] })
|
|
8972
9109
|
] }) })
|
|
8973
9110
|
]
|
|
8974
9111
|
}
|
|
8975
9112
|
),
|
|
8976
|
-
/* @__PURE__ */
|
|
9113
|
+
/* @__PURE__ */ jsx59(
|
|
8977
9114
|
EditIndexModal,
|
|
8978
9115
|
{
|
|
8979
9116
|
open: Boolean(editingIndex),
|
|
@@ -8985,8 +9122,8 @@ var IndexSelector = () => {
|
|
|
8985
9122
|
};
|
|
8986
9123
|
var CreateIndexButton = () => {
|
|
8987
9124
|
const [open, setOpen] = useState17(false);
|
|
8988
|
-
return /* @__PURE__ */
|
|
8989
|
-
/* @__PURE__ */
|
|
9125
|
+
return /* @__PURE__ */ jsxs35(Fragment11, { children: [
|
|
9126
|
+
/* @__PURE__ */ jsxs35(
|
|
8990
9127
|
"button",
|
|
8991
9128
|
{
|
|
8992
9129
|
onClick: (e) => {
|
|
@@ -8995,39 +9132,39 @@ var CreateIndexButton = () => {
|
|
|
8995
9132
|
},
|
|
8996
9133
|
className: "flex h-9 w-full items-center gap-2 rounded-md px-2 text-sm text-emerald-600 transition-colors hover:bg-zinc-100 dark:hover:bg-zinc-200",
|
|
8997
9134
|
children: [
|
|
8998
|
-
/* @__PURE__ */
|
|
8999
|
-
/* @__PURE__ */
|
|
9135
|
+
/* @__PURE__ */ jsx59(IconCirclePlus, { className: "size-5" }),
|
|
9136
|
+
/* @__PURE__ */ jsx59("span", { className: "underline", children: "Create a new Index" })
|
|
9000
9137
|
]
|
|
9001
9138
|
}
|
|
9002
9139
|
),
|
|
9003
|
-
/* @__PURE__ */
|
|
9140
|
+
/* @__PURE__ */ jsx59(CreateIndexModal, { open, onOpenChange: setOpen })
|
|
9004
9141
|
] });
|
|
9005
9142
|
};
|
|
9006
9143
|
var AddIndexButton = () => {
|
|
9007
9144
|
const [open, setOpen] = useState17(false);
|
|
9008
|
-
return /* @__PURE__ */
|
|
9009
|
-
/* @__PURE__ */
|
|
9145
|
+
return /* @__PURE__ */ jsxs35(Fragment11, { children: [
|
|
9146
|
+
/* @__PURE__ */ jsx59(SimpleTooltip, { content: "Create new Index", children: /* @__PURE__ */ jsxs35(
|
|
9010
9147
|
Button,
|
|
9011
9148
|
{
|
|
9012
9149
|
variant: "primary",
|
|
9013
9150
|
onClick: () => setOpen(true),
|
|
9014
9151
|
className: "flex h-8 select-none items-center gap-1 rounded-lg pl-2 pr-3 text-sm font-medium",
|
|
9015
9152
|
children: [
|
|
9016
|
-
/* @__PURE__ */
|
|
9153
|
+
/* @__PURE__ */ jsx59(IconPlus3, { className: "size-5" }),
|
|
9017
9154
|
"Index"
|
|
9018
9155
|
]
|
|
9019
9156
|
}
|
|
9020
9157
|
) }),
|
|
9021
|
-
/* @__PURE__ */
|
|
9158
|
+
/* @__PURE__ */ jsx59(CreateIndexModal, { open, onOpenChange: setOpen })
|
|
9022
9159
|
] });
|
|
9023
9160
|
};
|
|
9024
9161
|
var WizardButton = () => {
|
|
9025
9162
|
const queryWizard = useQueryWizardFn();
|
|
9026
9163
|
const [open, setOpen] = useState17(false);
|
|
9027
9164
|
if (!queryWizard) return null;
|
|
9028
|
-
return /* @__PURE__ */
|
|
9029
|
-
/* @__PURE__ */
|
|
9030
|
-
/* @__PURE__ */
|
|
9165
|
+
return /* @__PURE__ */ jsxs35(Popover, { open, onOpenChange: setOpen, modal: false, children: [
|
|
9166
|
+
/* @__PURE__ */ jsx59(SimpleTooltip, { content: "Query Wizard", children: /* @__PURE__ */ jsx59(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx59(Button, { size: "icon", "aria-label": "Query Wizard", children: /* @__PURE__ */ jsx59(IconSparkles, { className: "size-4 text-zinc-500" }) }) }) }),
|
|
9167
|
+
/* @__PURE__ */ jsx59(
|
|
9031
9168
|
PopoverContent,
|
|
9032
9169
|
{
|
|
9033
9170
|
side: "bottom",
|
|
@@ -9035,18 +9172,18 @@ var WizardButton = () => {
|
|
|
9035
9172
|
alignOffset: -124,
|
|
9036
9173
|
avoidCollisions: false,
|
|
9037
9174
|
className: "w-auto p-0",
|
|
9038
|
-
children: /* @__PURE__ */
|
|
9175
|
+
children: /* @__PURE__ */ jsx59(QueryWizardPopover, { onClose: () => setOpen(false) })
|
|
9039
9176
|
}
|
|
9040
9177
|
)
|
|
9041
9178
|
] });
|
|
9042
9179
|
};
|
|
9043
9180
|
|
|
9044
9181
|
// src/components/databrowser/components/header-error.tsx
|
|
9045
|
-
import { jsx as
|
|
9182
|
+
import { jsx as jsx60 } from "react/jsx-runtime";
|
|
9046
9183
|
var HeaderError = () => {
|
|
9047
9184
|
const { query } = useKeys();
|
|
9048
9185
|
if (!query.error) return null;
|
|
9049
|
-
return /* @__PURE__ */
|
|
9186
|
+
return /* @__PURE__ */ jsx60("p", { className: "text-sm text-red-600 dark:text-red-400", children: formatUpstashErrorMessage(query.error) });
|
|
9050
9187
|
};
|
|
9051
9188
|
|
|
9052
9189
|
// src/components/databrowser/components/search/query-editor.tsx
|
|
@@ -9109,7 +9246,7 @@ type Query = RootQueryFilter<SchemaFields>;
|
|
|
9109
9246
|
};
|
|
9110
9247
|
|
|
9111
9248
|
// src/components/databrowser/components/search/query-editor.tsx
|
|
9112
|
-
import { jsx as
|
|
9249
|
+
import { jsx as jsx61 } from "react/jsx-runtime";
|
|
9113
9250
|
var QUERY_PREFIX = "const query: Query = {";
|
|
9114
9251
|
var QUERY_DEFAULT = "const query: Query = {}";
|
|
9115
9252
|
var isQueryStringValid = (value) => {
|
|
@@ -9117,7 +9254,7 @@ var isQueryStringValid = (value) => {
|
|
|
9117
9254
|
};
|
|
9118
9255
|
var QueryEditor = ({ value, onChange, height, schema }) => {
|
|
9119
9256
|
const typeDefinitions = useMemo9(() => generateTypeDefinitions(schema), [schema]);
|
|
9120
|
-
return /* @__PURE__ */
|
|
9257
|
+
return /* @__PURE__ */ jsx61(
|
|
9121
9258
|
EditorWithTypes,
|
|
9122
9259
|
{
|
|
9123
9260
|
value,
|
|
@@ -9133,13 +9270,13 @@ var QueryEditor = ({ value, onChange, height, schema }) => {
|
|
|
9133
9270
|
};
|
|
9134
9271
|
|
|
9135
9272
|
// src/components/databrowser/components/query-builder.tsx
|
|
9136
|
-
import { jsx as
|
|
9273
|
+
import { jsx as jsx62 } from "react/jsx-runtime";
|
|
9137
9274
|
var QueryBuilder = () => {
|
|
9138
9275
|
const { valuesSearch, setValuesSearchQuery } = useTab();
|
|
9139
9276
|
const { data: indexDetails } = useFetchSearchIndex(valuesSearch.index);
|
|
9140
9277
|
const editorValue = PREFIX + (valuesSearch.query || "{}");
|
|
9141
9278
|
if (!indexDetails) return;
|
|
9142
|
-
return /* @__PURE__ */
|
|
9279
|
+
return /* @__PURE__ */ jsx62("div", { className: "flex h-full flex-col rounded-lg border border-zinc-300 bg-white px-[6px]", children: /* @__PURE__ */ jsx62("div", { className: "relative min-h-0 flex-1", children: /* @__PURE__ */ jsx62("div", { className: "absolute inset-0", children: /* @__PURE__ */ jsx62(
|
|
9143
9280
|
QueryEditor,
|
|
9144
9281
|
{
|
|
9145
9282
|
value: editorValue,
|
|
@@ -9154,7 +9291,7 @@ var QueryBuilder = () => {
|
|
|
9154
9291
|
|
|
9155
9292
|
// src/components/databrowser/components/query-builder-error.tsx
|
|
9156
9293
|
import { useEffect as useEffect18, useState as useState18 } from "react";
|
|
9157
|
-
import { jsx as
|
|
9294
|
+
import { jsx as jsx63 } from "react/jsx-runtime";
|
|
9158
9295
|
var ERROR_TIMEOUT = 5e3;
|
|
9159
9296
|
var QueryBuilderError = ({
|
|
9160
9297
|
error,
|
|
@@ -9176,7 +9313,7 @@ var QueryBuilderError = ({
|
|
|
9176
9313
|
return () => clearTimeout(timeout);
|
|
9177
9314
|
}, [error, autoHide]);
|
|
9178
9315
|
if (!displayedError) return;
|
|
9179
|
-
return /* @__PURE__ */
|
|
9316
|
+
return /* @__PURE__ */ jsx63(
|
|
9180
9317
|
"p",
|
|
9181
9318
|
{
|
|
9182
9319
|
className: cn(
|
|
@@ -9197,7 +9334,7 @@ import { IconCode, IconDatabase, IconSearch as IconSearch3, IconSparkles as Icon
|
|
|
9197
9334
|
|
|
9198
9335
|
// src/components/databrowser/components/import-sample-dataset-modal.tsx
|
|
9199
9336
|
import { useEffect as useEffect19, useState as useState19 } from "react";
|
|
9200
|
-
import { Fragment as
|
|
9337
|
+
import { Fragment as Fragment12, jsx as jsx64, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
9201
9338
|
var INDEX_NAME = "users-index";
|
|
9202
9339
|
var USER_COUNT = 100;
|
|
9203
9340
|
var firstNames = [
|
|
@@ -9392,14 +9529,14 @@ var ImportSampleDatasetModal = ({
|
|
|
9392
9529
|
}
|
|
9393
9530
|
};
|
|
9394
9531
|
const isRunning = status !== void 0;
|
|
9395
|
-
return /* @__PURE__ */
|
|
9532
|
+
return /* @__PURE__ */ jsx64(
|
|
9396
9533
|
Dialog,
|
|
9397
9534
|
{
|
|
9398
9535
|
open,
|
|
9399
9536
|
onOpenChange: (isOpen) => {
|
|
9400
9537
|
if (!isRunning) onOpenChange(isOpen);
|
|
9401
9538
|
},
|
|
9402
|
-
children: /* @__PURE__ */
|
|
9539
|
+
children: /* @__PURE__ */ jsxs36(
|
|
9403
9540
|
DialogContent,
|
|
9404
9541
|
{
|
|
9405
9542
|
onInteractOutside: (e) => {
|
|
@@ -9409,28 +9546,28 @@ var ImportSampleDatasetModal = ({
|
|
|
9409
9546
|
if (isRunning) e.preventDefault();
|
|
9410
9547
|
},
|
|
9411
9548
|
children: [
|
|
9412
|
-
/* @__PURE__ */
|
|
9413
|
-
/* @__PURE__ */
|
|
9414
|
-
!isRunning && !error && /* @__PURE__ */
|
|
9549
|
+
/* @__PURE__ */ jsxs36(DialogHeader, { children: [
|
|
9550
|
+
/* @__PURE__ */ jsx64(DialogTitle, { children: "Import Sample Dataset" }),
|
|
9551
|
+
!isRunning && !error && /* @__PURE__ */ jsxs36(DialogDescription, { children: [
|
|
9415
9552
|
"This will create a ",
|
|
9416
|
-
/* @__PURE__ */
|
|
9553
|
+
/* @__PURE__ */ jsx64("strong", { children: "users-index" }),
|
|
9417
9554
|
" with 100 sample user records.",
|
|
9418
|
-
/* @__PURE__ */
|
|
9419
|
-
/* @__PURE__ */
|
|
9555
|
+
/* @__PURE__ */ jsx64("br", {}),
|
|
9556
|
+
/* @__PURE__ */ jsx64("br", {}),
|
|
9420
9557
|
"Each user has name, age, gender, student/employment status, and contact information."
|
|
9421
9558
|
] })
|
|
9422
9559
|
] }),
|
|
9423
|
-
isRunning && /* @__PURE__ */
|
|
9424
|
-
/* @__PURE__ */
|
|
9425
|
-
/* @__PURE__ */
|
|
9560
|
+
isRunning && /* @__PURE__ */ jsxs36("div", { className: "flex flex-col gap-2 py-4", children: [
|
|
9561
|
+
/* @__PURE__ */ jsx64("p", { className: "text-sm text-zinc-500", children: status }),
|
|
9562
|
+
/* @__PURE__ */ jsx64(Progress, { value: progress })
|
|
9426
9563
|
] }),
|
|
9427
|
-
error && /* @__PURE__ */
|
|
9428
|
-
/* @__PURE__ */
|
|
9429
|
-
!isRunning && !error && /* @__PURE__ */
|
|
9430
|
-
/* @__PURE__ */
|
|
9431
|
-
/* @__PURE__ */
|
|
9564
|
+
error && /* @__PURE__ */ jsx64("div", { className: "w-full break-words text-sm text-red-500", children: formatUpstashErrorMessage(error) }),
|
|
9565
|
+
/* @__PURE__ */ jsxs36(DialogFooter, { children: [
|
|
9566
|
+
!isRunning && !error && /* @__PURE__ */ jsxs36(Fragment12, { children: [
|
|
9567
|
+
/* @__PURE__ */ jsx64(Button, { onClick: () => onOpenChange(false), children: "Cancel" }),
|
|
9568
|
+
/* @__PURE__ */ jsx64(Button, { variant: "primary", onClick: handleImport, children: "Import" })
|
|
9432
9569
|
] }),
|
|
9433
|
-
error && /* @__PURE__ */
|
|
9570
|
+
error && /* @__PURE__ */ jsx64(Button, { onClick: () => onOpenChange(false), children: "Close" })
|
|
9434
9571
|
] })
|
|
9435
9572
|
]
|
|
9436
9573
|
}
|
|
@@ -9440,41 +9577,41 @@ var ImportSampleDatasetModal = ({
|
|
|
9440
9577
|
};
|
|
9441
9578
|
|
|
9442
9579
|
// src/components/databrowser/components/search-empty-state.tsx
|
|
9443
|
-
import { jsx as
|
|
9580
|
+
import { jsx as jsx65, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
9444
9581
|
var SearchEmptyState = () => {
|
|
9445
9582
|
const [importModalOpen, setImportModalOpen] = useState20(false);
|
|
9446
|
-
return /* @__PURE__ */
|
|
9447
|
-
/* @__PURE__ */
|
|
9448
|
-
/* @__PURE__ */
|
|
9449
|
-
/* @__PURE__ */
|
|
9450
|
-
/* @__PURE__ */
|
|
9451
|
-
/* @__PURE__ */
|
|
9452
|
-
/* @__PURE__ */
|
|
9453
|
-
/* @__PURE__ */
|
|
9454
|
-
/* @__PURE__ */
|
|
9455
|
-
/* @__PURE__ */
|
|
9456
|
-
/* @__PURE__ */
|
|
9457
|
-
/* @__PURE__ */
|
|
9458
|
-
/* @__PURE__ */
|
|
9583
|
+
return /* @__PURE__ */ jsxs37("div", { className: "mx-auto flex h-full w-full gap-8 rounded-xl border border-zinc-200 bg-gradient-to-b from-zinc-50 to-white p-8", children: [
|
|
9584
|
+
/* @__PURE__ */ jsx65(ImportSampleDatasetModal, { open: importModalOpen, onOpenChange: setImportModalOpen }),
|
|
9585
|
+
/* @__PURE__ */ jsxs37("div", { className: "flex-1", children: [
|
|
9586
|
+
/* @__PURE__ */ jsx65("h2", { className: "mb-2 text-lg font-semibold text-zinc-900", children: "Redis Search" }),
|
|
9587
|
+
/* @__PURE__ */ jsx65("p", { className: "mb-6 max-w-md text-sm leading-relaxed text-zinc-600", children: "Redis Search allows you to create indexes on your existing keys and perform fast, full-text searches across your data." }),
|
|
9588
|
+
/* @__PURE__ */ jsxs37("div", { className: "space-y-3", children: [
|
|
9589
|
+
/* @__PURE__ */ jsx65("h3", { className: "text-xs font-medium uppercase tracking-wider text-zinc-400", children: "How it works" }),
|
|
9590
|
+
/* @__PURE__ */ jsxs37("div", { className: "space-y-2.5", children: [
|
|
9591
|
+
/* @__PURE__ */ jsxs37("div", { className: "flex items-start gap-3", children: [
|
|
9592
|
+
/* @__PURE__ */ jsx65("div", { className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-emerald-100 text-emerald-600", children: /* @__PURE__ */ jsx65(IconDatabase, { size: 16 }) }),
|
|
9593
|
+
/* @__PURE__ */ jsxs37("div", { children: [
|
|
9594
|
+
/* @__PURE__ */ jsx65("h4", { className: "text-sm font-medium text-zinc-900", children: "Store your data" }),
|
|
9595
|
+
/* @__PURE__ */ jsx65("p", { className: "text-sm text-zinc-500", children: "Add documents as JSON, Hash, or String keys (string content must be valid JSON)." })
|
|
9459
9596
|
] })
|
|
9460
9597
|
] }),
|
|
9461
|
-
/* @__PURE__ */
|
|
9462
|
-
/* @__PURE__ */
|
|
9463
|
-
/* @__PURE__ */
|
|
9464
|
-
/* @__PURE__ */
|
|
9465
|
-
/* @__PURE__ */
|
|
9598
|
+
/* @__PURE__ */ jsxs37("div", { className: "flex items-start gap-3", children: [
|
|
9599
|
+
/* @__PURE__ */ jsx65("div", { className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-emerald-100 text-emerald-600", children: /* @__PURE__ */ jsx65(IconCode, { size: 16 }) }),
|
|
9600
|
+
/* @__PURE__ */ jsxs37("div", { children: [
|
|
9601
|
+
/* @__PURE__ */ jsx65("h4", { className: "text-sm font-medium text-zinc-900", children: "Create an index" }),
|
|
9602
|
+
/* @__PURE__ */ jsx65("p", { className: "text-sm text-zinc-500", children: "Define a search index specifying which fields to search on." })
|
|
9466
9603
|
] })
|
|
9467
9604
|
] }),
|
|
9468
|
-
/* @__PURE__ */
|
|
9469
|
-
/* @__PURE__ */
|
|
9470
|
-
/* @__PURE__ */
|
|
9471
|
-
/* @__PURE__ */
|
|
9472
|
-
/* @__PURE__ */
|
|
9605
|
+
/* @__PURE__ */ jsxs37("div", { className: "flex items-start gap-3", children: [
|
|
9606
|
+
/* @__PURE__ */ jsx65("div", { className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-emerald-100 text-emerald-600", children: /* @__PURE__ */ jsx65(IconSearch3, { size: 16 }) }),
|
|
9607
|
+
/* @__PURE__ */ jsxs37("div", { children: [
|
|
9608
|
+
/* @__PURE__ */ jsx65("h4", { className: "text-sm font-medium text-zinc-900", children: "Search your data" }),
|
|
9609
|
+
/* @__PURE__ */ jsx65("p", { className: "text-sm text-zinc-500", children: "Query with filters, full-text search, and sorted results." })
|
|
9473
9610
|
] })
|
|
9474
9611
|
] })
|
|
9475
9612
|
] })
|
|
9476
9613
|
] }),
|
|
9477
|
-
/* @__PURE__ */
|
|
9614
|
+
/* @__PURE__ */ jsx65(
|
|
9478
9615
|
"a",
|
|
9479
9616
|
{
|
|
9480
9617
|
href: "https://upstash-search.mintlify.app/redis/search/introduction",
|
|
@@ -9485,11 +9622,11 @@ var SearchEmptyState = () => {
|
|
|
9485
9622
|
}
|
|
9486
9623
|
)
|
|
9487
9624
|
] }),
|
|
9488
|
-
/* @__PURE__ */
|
|
9489
|
-
/* @__PURE__ */
|
|
9490
|
-
/* @__PURE__ */
|
|
9491
|
-
/* @__PURE__ */
|
|
9492
|
-
/* @__PURE__ */
|
|
9625
|
+
/* @__PURE__ */ jsxs37("div", { className: "flex w-[350px] flex-col items-center justify-center rounded-lg border bg-gradient-to-b from-zinc-50 to-white p-6 shadow-sm", children: [
|
|
9626
|
+
/* @__PURE__ */ jsx65("div", { className: "mb-4 flex h-12 w-12 items-center justify-center rounded-xl bg-emerald-100 text-emerald-600", children: /* @__PURE__ */ jsx65(IconSparkles2, { size: 24 }) }),
|
|
9627
|
+
/* @__PURE__ */ jsx65("h3", { className: "mb-1 text-sm font-medium text-zinc-900", children: "Try it out" }),
|
|
9628
|
+
/* @__PURE__ */ jsx65("p", { className: "mb-4 text-center text-xs text-zinc-500", children: "Load a sample dataset to explore Redis Search" }),
|
|
9629
|
+
/* @__PURE__ */ jsx65(
|
|
9493
9630
|
"button",
|
|
9494
9631
|
{
|
|
9495
9632
|
onClick: () => setImportModalOpen(true),
|
|
@@ -9502,23 +9639,23 @@ var SearchEmptyState = () => {
|
|
|
9502
9639
|
};
|
|
9503
9640
|
|
|
9504
9641
|
// src/components/databrowser/components/sidebar/empty.tsx
|
|
9505
|
-
import { jsx as
|
|
9642
|
+
import { jsx as jsx66, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
9506
9643
|
var Empty = () => {
|
|
9507
|
-
return /* @__PURE__ */
|
|
9508
|
-
/* @__PURE__ */
|
|
9509
|
-
/* @__PURE__ */
|
|
9644
|
+
return /* @__PURE__ */ jsx66("div", { className: "flex h-full w-full items-center justify-center rounded-md border bg-white px-4 py-6 text-center", children: /* @__PURE__ */ jsxs38("div", { className: "space-y-5", children: [
|
|
9645
|
+
/* @__PURE__ */ jsx66("p", { className: "text-md font-medium", children: "Data on a break" }),
|
|
9646
|
+
/* @__PURE__ */ jsx66("p", { className: "text-balance text-center", children: '"Quick, lure it back with some CLI magic!"' })
|
|
9510
9647
|
] }) });
|
|
9511
9648
|
};
|
|
9512
9649
|
|
|
9513
9650
|
// src/components/databrowser/components/sidebar/keys-list.tsx
|
|
9514
|
-
import { Fragment as
|
|
9651
|
+
import { Fragment as Fragment14, useRef as useRef6 } from "react";
|
|
9515
9652
|
import { IconChevronRight as IconChevronRight4 } from "@tabler/icons-react";
|
|
9516
9653
|
|
|
9517
9654
|
// src/components/databrowser/components/sidebar-context-menu.tsx
|
|
9518
9655
|
import { useState as useState21 } from "react";
|
|
9519
9656
|
import { ContextMenuSeparator as ContextMenuSeparator3 } from "@radix-ui/react-context-menu";
|
|
9520
9657
|
import { IconCopy as IconCopy3, IconExternalLink as IconExternalLink3, IconTrash as IconTrash3 } from "@tabler/icons-react";
|
|
9521
|
-
import { Fragment as
|
|
9658
|
+
import { Fragment as Fragment13, jsx as jsx67, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
9522
9659
|
var SidebarContextMenu = ({ children }) => {
|
|
9523
9660
|
const { mutateAsync: deleteKey } = useDeleteKey();
|
|
9524
9661
|
const [isAlertOpen, setAlertOpen] = useState21(false);
|
|
@@ -9530,8 +9667,8 @@ var SidebarContextMenu = ({ children }) => {
|
|
|
9530
9667
|
setSearch
|
|
9531
9668
|
} = useDatabrowserStore();
|
|
9532
9669
|
const { search: currentSearch, selectedKeys, isValuesSearchSelected } = useTab();
|
|
9533
|
-
return /* @__PURE__ */
|
|
9534
|
-
/* @__PURE__ */
|
|
9670
|
+
return /* @__PURE__ */ jsxs39(Fragment13, { children: [
|
|
9671
|
+
/* @__PURE__ */ jsx67(
|
|
9535
9672
|
DeleteKeyModal,
|
|
9536
9673
|
{
|
|
9537
9674
|
deletionType: "key",
|
|
@@ -9546,8 +9683,8 @@ var SidebarContextMenu = ({ children }) => {
|
|
|
9546
9683
|
}
|
|
9547
9684
|
}
|
|
9548
9685
|
),
|
|
9549
|
-
/* @__PURE__ */
|
|
9550
|
-
/* @__PURE__ */
|
|
9686
|
+
/* @__PURE__ */ jsxs39(ContextMenu, { modal: false, children: [
|
|
9687
|
+
/* @__PURE__ */ jsx67(
|
|
9551
9688
|
ContextMenuTrigger,
|
|
9552
9689
|
{
|
|
9553
9690
|
onContextMenu: (e) => {
|
|
@@ -9567,8 +9704,8 @@ var SidebarContextMenu = ({ children }) => {
|
|
|
9567
9704
|
children
|
|
9568
9705
|
}
|
|
9569
9706
|
),
|
|
9570
|
-
/* @__PURE__ */
|
|
9571
|
-
/* @__PURE__ */
|
|
9707
|
+
/* @__PURE__ */ jsxs39(ContextMenuContent, { children: [
|
|
9708
|
+
/* @__PURE__ */ jsxs39(
|
|
9572
9709
|
ContextMenuItem,
|
|
9573
9710
|
{
|
|
9574
9711
|
onClick: () => {
|
|
@@ -9580,12 +9717,12 @@ var SidebarContextMenu = ({ children }) => {
|
|
|
9580
9717
|
className: "gap-2",
|
|
9581
9718
|
disabled: contextKeys.length !== 1,
|
|
9582
9719
|
children: [
|
|
9583
|
-
/* @__PURE__ */
|
|
9720
|
+
/* @__PURE__ */ jsx67(IconCopy3, { size: 16 }),
|
|
9584
9721
|
"Copy key"
|
|
9585
9722
|
]
|
|
9586
9723
|
}
|
|
9587
9724
|
),
|
|
9588
|
-
/* @__PURE__ */
|
|
9725
|
+
/* @__PURE__ */ jsxs39(
|
|
9589
9726
|
ContextMenuItem,
|
|
9590
9727
|
{
|
|
9591
9728
|
onClick: () => {
|
|
@@ -9597,14 +9734,14 @@ var SidebarContextMenu = ({ children }) => {
|
|
|
9597
9734
|
className: "gap-2",
|
|
9598
9735
|
disabled: contextKeys.length !== 1,
|
|
9599
9736
|
children: [
|
|
9600
|
-
/* @__PURE__ */
|
|
9737
|
+
/* @__PURE__ */ jsx67(IconExternalLink3, { size: 16 }),
|
|
9601
9738
|
"Open in new tab"
|
|
9602
9739
|
]
|
|
9603
9740
|
}
|
|
9604
9741
|
),
|
|
9605
|
-
/* @__PURE__ */
|
|
9606
|
-
/* @__PURE__ */
|
|
9607
|
-
/* @__PURE__ */
|
|
9742
|
+
/* @__PURE__ */ jsx67(ContextMenuSeparator3, {}),
|
|
9743
|
+
/* @__PURE__ */ jsxs39(ContextMenuItem, { onClick: () => setAlertOpen(true), className: "gap-2", children: [
|
|
9744
|
+
/* @__PURE__ */ jsx67(IconTrash3, { size: 16 }),
|
|
9608
9745
|
contextKeys.length > 1 ? `Delete ${contextKeys.length} keys` : "Delete key"
|
|
9609
9746
|
] })
|
|
9610
9747
|
] })
|
|
@@ -9613,14 +9750,14 @@ var SidebarContextMenu = ({ children }) => {
|
|
|
9613
9750
|
};
|
|
9614
9751
|
|
|
9615
9752
|
// src/components/databrowser/components/sidebar/keys-list.tsx
|
|
9616
|
-
import { Fragment as
|
|
9753
|
+
import { Fragment as Fragment15, jsx as jsx68, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
9617
9754
|
var KeysList = () => {
|
|
9618
9755
|
const { keys } = useKeys();
|
|
9619
9756
|
const lastClickedIndexRef = useRef6(null);
|
|
9620
|
-
return /* @__PURE__ */
|
|
9621
|
-
/* @__PURE__ */
|
|
9622
|
-
keys.map((data, i) => /* @__PURE__ */
|
|
9623
|
-
/* @__PURE__ */
|
|
9757
|
+
return /* @__PURE__ */ jsx68(SidebarContextMenu, { children: /* @__PURE__ */ jsxs40(Fragment15, { children: [
|
|
9758
|
+
/* @__PURE__ */ jsx68("div", { className: "h-px" }),
|
|
9759
|
+
keys.map((data, i) => /* @__PURE__ */ jsxs40(Fragment14, { children: [
|
|
9760
|
+
/* @__PURE__ */ jsx68(
|
|
9624
9761
|
KeyItem,
|
|
9625
9762
|
{
|
|
9626
9763
|
index: i,
|
|
@@ -9629,7 +9766,7 @@ var KeysList = () => {
|
|
|
9629
9766
|
lastClickedIndexRef
|
|
9630
9767
|
}
|
|
9631
9768
|
),
|
|
9632
|
-
i !== keys.length - 1 && /* @__PURE__ */
|
|
9769
|
+
i !== keys.length - 1 && /* @__PURE__ */ jsx68("div", { className: "-z-10 mx-[13px] h-px bg-zinc-200 dark:bg-zinc-300" })
|
|
9633
9770
|
] }, data[0]))
|
|
9634
9771
|
] }) });
|
|
9635
9772
|
};
|
|
@@ -9671,7 +9808,7 @@ var KeyItem = ({
|
|
|
9671
9808
|
lastClickedIndexRef.current = index;
|
|
9672
9809
|
}
|
|
9673
9810
|
};
|
|
9674
|
-
return /* @__PURE__ */
|
|
9811
|
+
return /* @__PURE__ */ jsxs40(
|
|
9675
9812
|
"button",
|
|
9676
9813
|
{
|
|
9677
9814
|
"data-key": dataKey,
|
|
@@ -9683,40 +9820,40 @@ var KeyItem = ({
|
|
|
9683
9820
|
),
|
|
9684
9821
|
onClick: handleClick,
|
|
9685
9822
|
children: [
|
|
9686
|
-
/* @__PURE__ */
|
|
9687
|
-
/* @__PURE__ */
|
|
9688
|
-
score !== void 0 && /* @__PURE__ */
|
|
9689
|
-
isKeySelected && /* @__PURE__ */
|
|
9823
|
+
/* @__PURE__ */ jsx68(TypeTag, { variant: dataType, type: "icon" }),
|
|
9824
|
+
/* @__PURE__ */ jsx68("p", { className: "grow truncate whitespace-nowrap", children: dataKey }),
|
|
9825
|
+
score !== void 0 && /* @__PURE__ */ jsx68("span", { className: "shrink-0 text-xs text-zinc-400", children: score.toFixed(2) }),
|
|
9826
|
+
isKeySelected && /* @__PURE__ */ jsx68(IconChevronRight4, { className: "shrink-0 text-zinc-500", size: 20 })
|
|
9690
9827
|
]
|
|
9691
9828
|
}
|
|
9692
9829
|
);
|
|
9693
9830
|
};
|
|
9694
9831
|
|
|
9695
9832
|
// src/components/databrowser/components/sidebar/skeleton-buttons.tsx
|
|
9696
|
-
import { jsx as
|
|
9833
|
+
import { jsx as jsx69, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
9697
9834
|
var DEFAULT_SKELETON_COUNT = 6;
|
|
9698
|
-
var LoadingSkeleton = () => /* @__PURE__ */
|
|
9699
|
-
/* @__PURE__ */
|
|
9700
|
-
/* @__PURE__ */
|
|
9835
|
+
var LoadingSkeleton = () => /* @__PURE__ */ jsx69("div", { className: "block h-full w-full rounded-lg bg-zinc-100 p-1 pr-3 transition-all", children: Array.from({ length: DEFAULT_SKELETON_COUNT }).fill(0).map((_, idx) => /* @__PURE__ */ jsxs41("div", { className: "flex h-10 items-center gap-2 px-3", children: [
|
|
9836
|
+
/* @__PURE__ */ jsx69(Skeleton, { className: "size-5 shrink-0 rounded" }),
|
|
9837
|
+
/* @__PURE__ */ jsx69(Skeleton, { className: "h-4 grow rounded" })
|
|
9701
9838
|
] }, idx)) });
|
|
9702
9839
|
|
|
9703
9840
|
// src/components/databrowser/components/sidebar/index.tsx
|
|
9704
|
-
import { jsx as
|
|
9841
|
+
import { jsx as jsx70 } from "react/jsx-runtime";
|
|
9705
9842
|
function Sidebar() {
|
|
9706
9843
|
const { keys, query } = useKeys();
|
|
9707
|
-
return /* @__PURE__ */
|
|
9844
|
+
return /* @__PURE__ */ jsx70("div", { className: "relative flex h-full flex-col gap-2", children: query.isLoading && keys.length === 0 ? /* @__PURE__ */ jsx70(LoadingSkeleton, {}) : keys.length > 0 ? (
|
|
9708
9845
|
// Infinite scroll already has a loader at the bottom
|
|
9709
|
-
/* @__PURE__ */
|
|
9846
|
+
/* @__PURE__ */ jsx70(
|
|
9710
9847
|
InfiniteScroll,
|
|
9711
9848
|
{
|
|
9712
9849
|
query,
|
|
9713
9850
|
disableRoundedInherit: true,
|
|
9714
9851
|
className: "h-full min-h-0 rounded-xl bg-zinc-100 px-2 py-5 pr-4 dark:bg-zinc-200",
|
|
9715
9852
|
scrollBarClassName: "py-5",
|
|
9716
|
-
children: /* @__PURE__ */
|
|
9853
|
+
children: /* @__PURE__ */ jsx70(KeysList, {})
|
|
9717
9854
|
}
|
|
9718
9855
|
)
|
|
9719
|
-
) : /* @__PURE__ */
|
|
9856
|
+
) : /* @__PURE__ */ jsx70(Empty, {}) });
|
|
9720
9857
|
}
|
|
9721
9858
|
|
|
9722
9859
|
// src/components/databrowser/components/ui-query-builder/ui-query-builder.tsx
|
|
@@ -10090,7 +10227,7 @@ var createInitialQueryState = () => ({
|
|
|
10090
10227
|
});
|
|
10091
10228
|
|
|
10092
10229
|
// src/components/databrowser/components/ui-query-builder/query-builder-context.tsx
|
|
10093
|
-
import { jsx as
|
|
10230
|
+
import { jsx as jsx71 } from "react/jsx-runtime";
|
|
10094
10231
|
var QueryBuilderUIContext = createContext7(null);
|
|
10095
10232
|
var QueryBuilderUIProvider = ({
|
|
10096
10233
|
children,
|
|
@@ -10146,7 +10283,7 @@ var QueryBuilderUIProvider = ({
|
|
|
10146
10283
|
}),
|
|
10147
10284
|
[fieldInfos, updateNode, deleteNode, addChildToGroup, moveNode]
|
|
10148
10285
|
);
|
|
10149
|
-
return /* @__PURE__ */
|
|
10286
|
+
return /* @__PURE__ */ jsx71(QueryBuilderUIContext.Provider, { value, children });
|
|
10150
10287
|
};
|
|
10151
10288
|
var useQueryBuilderUI = () => {
|
|
10152
10289
|
const context = useContext7(QueryBuilderUIContext);
|
|
@@ -10232,7 +10369,7 @@ import { useState as useState23 } from "react";
|
|
|
10232
10369
|
|
|
10233
10370
|
// src/components/databrowser/components/ui-query-builder/dynamic-width-input.tsx
|
|
10234
10371
|
import { useLayoutEffect as useLayoutEffect2, useRef as useRef7, useState as useState22 } from "react";
|
|
10235
|
-
import { jsx as
|
|
10372
|
+
import { jsx as jsx72 } from "react/jsx-runtime";
|
|
10236
10373
|
var measureContext = null;
|
|
10237
10374
|
var getTextWidth = (text, font) => {
|
|
10238
10375
|
if (!measureContext) {
|
|
@@ -10264,7 +10401,7 @@ var DynamicWidthInput = ({
|
|
|
10264
10401
|
setWidth(Math.max(Math.ceil(textWidth), minWidth));
|
|
10265
10402
|
}
|
|
10266
10403
|
}, [value, minWidth, placeholder]);
|
|
10267
|
-
return /* @__PURE__ */
|
|
10404
|
+
return /* @__PURE__ */ jsx72(
|
|
10268
10405
|
"input",
|
|
10269
10406
|
{
|
|
10270
10407
|
ref: inputRef,
|
|
@@ -10281,7 +10418,7 @@ var DynamicWidthInput = ({
|
|
|
10281
10418
|
};
|
|
10282
10419
|
|
|
10283
10420
|
// src/components/databrowser/components/ui-query-builder/boost-badge.tsx
|
|
10284
|
-
import { jsx as
|
|
10421
|
+
import { jsx as jsx73, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
10285
10422
|
var BoostBadge = ({
|
|
10286
10423
|
node,
|
|
10287
10424
|
static: isStatic
|
|
@@ -10310,15 +10447,15 @@ var BoostBadge = ({
|
|
|
10310
10447
|
const isNegative = (node.boost ?? 0) < 0;
|
|
10311
10448
|
const labelBg = isNegative ? "bg-red-50" : "bg-purple-50";
|
|
10312
10449
|
const textColor = isNegative ? "text-red-800" : "text-purple-800";
|
|
10313
|
-
return /* @__PURE__ */
|
|
10314
|
-
/* @__PURE__ */
|
|
10315
|
-
/* @__PURE__ */
|
|
10316
|
-
/* @__PURE__ */
|
|
10317
|
-
/* @__PURE__ */
|
|
10318
|
-
/* @__PURE__ */
|
|
10450
|
+
return /* @__PURE__ */ jsxs42("span", { className: "relative flex h-[26px] items-center overflow-hidden rounded-md border border-zinc-300 text-sm font-medium", children: [
|
|
10451
|
+
/* @__PURE__ */ jsxs42(Tooltip, { delayDuration: 200, children: [
|
|
10452
|
+
/* @__PURE__ */ jsx73(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx73("span", { className: `flex h-full cursor-default items-center px-2 ${labelBg} ${textColor}`, children: isNegative ? "Demote" : "Boost" }) }),
|
|
10453
|
+
/* @__PURE__ */ jsxs42(TooltipContent, { side: "bottom", className: "max-w-xs", children: [
|
|
10454
|
+
/* @__PURE__ */ jsx73("span", { children: isNegative ? `Multiplies this condition's score by ${node.boost ?? 0}, subtracting from the total.` : `Multiplies this condition's score by ${node.boost ?? 0}.` }),
|
|
10455
|
+
/* @__PURE__ */ jsx73(DocsLink, { href: "https://upstash-search.mintlify.app/redis/search/query-operators/boolean-operators/boost" })
|
|
10319
10456
|
] })
|
|
10320
10457
|
] }),
|
|
10321
|
-
isStatic ? /* @__PURE__ */
|
|
10458
|
+
isStatic ? /* @__PURE__ */ jsx73("span", { className: `px-2 ${textColor}`, children: node.boost }) : /* @__PURE__ */ jsx73("span", { className: "flex h-full items-center bg-white px-2", children: /* @__PURE__ */ jsx73(
|
|
10322
10459
|
DynamicWidthInput,
|
|
10323
10460
|
{
|
|
10324
10461
|
value: localValue,
|
|
@@ -10347,8 +10484,8 @@ import { DragOverlay as DndKitDragOverlay } from "@dnd-kit/core";
|
|
|
10347
10484
|
import { IconGripVertical as IconGripVertical2 } from "@tabler/icons-react";
|
|
10348
10485
|
|
|
10349
10486
|
// src/components/databrowser/components/ui-query-builder/not-badge.tsx
|
|
10350
|
-
import { jsx as
|
|
10351
|
-
var NotBadge = () => /* @__PURE__ */
|
|
10487
|
+
import { jsx as jsx74 } from "react/jsx-runtime";
|
|
10488
|
+
var NotBadge = () => /* @__PURE__ */ jsx74("span", { className: "flex h-[26px] items-center rounded-md border border-zinc-300 bg-amber-50 px-2 text-sm font-medium text-amber-800", children: "Not" });
|
|
10352
10489
|
|
|
10353
10490
|
// src/components/databrowser/components/ui-query-builder/query-condition.tsx
|
|
10354
10491
|
import { useEffect as useEffect20, useState as useState25 } from "react";
|
|
@@ -10357,7 +10494,7 @@ import { IconGripVertical, IconX as IconX3 } from "@tabler/icons-react";
|
|
|
10357
10494
|
// src/components/databrowser/components/ui-query-builder/node-actions-menu.tsx
|
|
10358
10495
|
import { useState as useState24 } from "react";
|
|
10359
10496
|
import { IconDots } from "@tabler/icons-react";
|
|
10360
|
-
import { jsx as
|
|
10497
|
+
import { jsx as jsx75, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
10361
10498
|
var NodeActionsMenu = ({ node }) => {
|
|
10362
10499
|
const { updateNode } = useQueryBuilderUI();
|
|
10363
10500
|
const [open, setOpen] = useState24(false);
|
|
@@ -10367,22 +10504,22 @@ var NodeActionsMenu = ({ node }) => {
|
|
|
10367
10504
|
const handleToggleNot = () => {
|
|
10368
10505
|
updateNode(node.id, { not: !node.not });
|
|
10369
10506
|
};
|
|
10370
|
-
return /* @__PURE__ */
|
|
10371
|
-
/* @__PURE__ */
|
|
10507
|
+
return /* @__PURE__ */ jsxs43(DropdownMenu, { open, onOpenChange: setOpen, children: [
|
|
10508
|
+
/* @__PURE__ */ jsx75(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx75(
|
|
10372
10509
|
"button",
|
|
10373
10510
|
{
|
|
10374
10511
|
type: "button",
|
|
10375
10512
|
className: "flex h-[26px] w-[26px] items-center justify-center rounded-md border border-zinc-300 text-zinc-500 transition-colors hover:text-zinc-700",
|
|
10376
|
-
children: /* @__PURE__ */
|
|
10513
|
+
children: /* @__PURE__ */ jsx75(IconDots, { size: 16 })
|
|
10377
10514
|
}
|
|
10378
10515
|
) }),
|
|
10379
|
-
/* @__PURE__ */
|
|
10380
|
-
/* @__PURE__ */
|
|
10381
|
-
/* @__PURE__ */
|
|
10516
|
+
/* @__PURE__ */ jsxs43(DropdownMenuContent, { align: "end", children: [
|
|
10517
|
+
/* @__PURE__ */ jsx75(DropdownMenuItem, { onClick: handleToggleBoost, children: /* @__PURE__ */ jsxs43("div", { className: "flex items-center gap-2", children: [
|
|
10518
|
+
/* @__PURE__ */ jsx75(
|
|
10382
10519
|
"div",
|
|
10383
10520
|
{
|
|
10384
10521
|
className: `h-4 w-8 rounded-full transition-colors ${node.boost === void 0 ? "bg-zinc-200" : "bg-emerald-500"}`,
|
|
10385
|
-
children: /* @__PURE__ */
|
|
10522
|
+
children: /* @__PURE__ */ jsx75(
|
|
10386
10523
|
"div",
|
|
10387
10524
|
{
|
|
10388
10525
|
className: `h-4 w-4 transform rounded-full bg-white shadow transition-transform ${node.boost === void 0 ? "translate-x-0" : "translate-x-4"}`
|
|
@@ -10390,14 +10527,14 @@ var NodeActionsMenu = ({ node }) => {
|
|
|
10390
10527
|
)
|
|
10391
10528
|
}
|
|
10392
10529
|
),
|
|
10393
|
-
/* @__PURE__ */
|
|
10530
|
+
/* @__PURE__ */ jsx75("span", { children: "Boost" })
|
|
10394
10531
|
] }) }),
|
|
10395
|
-
/* @__PURE__ */
|
|
10396
|
-
/* @__PURE__ */
|
|
10532
|
+
/* @__PURE__ */ jsx75(DropdownMenuItem, { onClick: handleToggleNot, children: /* @__PURE__ */ jsxs43("div", { className: "flex items-center gap-2", children: [
|
|
10533
|
+
/* @__PURE__ */ jsx75(
|
|
10397
10534
|
"div",
|
|
10398
10535
|
{
|
|
10399
10536
|
className: `h-4 w-8 rounded-full transition-colors ${node.not ? "bg-emerald-500" : "bg-zinc-200"}`,
|
|
10400
|
-
children: /* @__PURE__ */
|
|
10537
|
+
children: /* @__PURE__ */ jsx75(
|
|
10401
10538
|
"div",
|
|
10402
10539
|
{
|
|
10403
10540
|
className: `h-4 w-4 transform rounded-full bg-white shadow transition-transform ${node.not ? "translate-x-4" : "translate-x-0"}`
|
|
@@ -10405,14 +10542,14 @@ var NodeActionsMenu = ({ node }) => {
|
|
|
10405
10542
|
)
|
|
10406
10543
|
}
|
|
10407
10544
|
),
|
|
10408
|
-
/* @__PURE__ */
|
|
10545
|
+
/* @__PURE__ */ jsx75("span", { children: "Not" })
|
|
10409
10546
|
] }) })
|
|
10410
10547
|
] })
|
|
10411
10548
|
] });
|
|
10412
10549
|
};
|
|
10413
10550
|
|
|
10414
10551
|
// src/components/databrowser/components/ui-query-builder/query-condition.tsx
|
|
10415
|
-
import { Fragment as
|
|
10552
|
+
import { Fragment as Fragment16, jsx as jsx76, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
10416
10553
|
var formatValueForDisplay = (value) => {
|
|
10417
10554
|
if (Array.isArray(value)) {
|
|
10418
10555
|
return value.join(", ");
|
|
@@ -10633,48 +10770,48 @@ var QueryCondition = ({
|
|
|
10633
10770
|
const filteredOperators = OPERATOR_OPTIONS.filter((op) => allowedOperators.includes(op.value));
|
|
10634
10771
|
const isInvalidOperator = !isUnknownField && currentFieldType !== "unknown" && !allowedOperators.includes(condition.operator);
|
|
10635
10772
|
const operatorError = isInvalidOperator ? `"${condition.operator}" is not valid for ${currentFieldType} fields` : void 0;
|
|
10636
|
-
return /* @__PURE__ */
|
|
10637
|
-
/* @__PURE__ */
|
|
10773
|
+
return /* @__PURE__ */ jsxs44("div", { className: "group/condition flex items-center gap-1 px-1", children: [
|
|
10774
|
+
/* @__PURE__ */ jsx76(
|
|
10638
10775
|
"div",
|
|
10639
10776
|
{
|
|
10640
10777
|
ref: dragHandleProps?.ref,
|
|
10641
10778
|
className: "flex cursor-grab items-center px-1 text-zinc-400 hover:text-zinc-600",
|
|
10642
10779
|
...dragHandleProps?.attributes,
|
|
10643
10780
|
...dragHandleProps?.listeners,
|
|
10644
|
-
children: /* @__PURE__ */
|
|
10781
|
+
children: /* @__PURE__ */ jsx76(IconGripVertical, { size: 16 })
|
|
10645
10782
|
}
|
|
10646
10783
|
),
|
|
10647
|
-
/* @__PURE__ */
|
|
10648
|
-
/* @__PURE__ */
|
|
10649
|
-
/* @__PURE__ */
|
|
10784
|
+
/* @__PURE__ */ jsxs44("div", { className: "flex", children: [
|
|
10785
|
+
/* @__PURE__ */ jsxs44(Select, { value: condition.field, onValueChange: handleFieldChange, children: [
|
|
10786
|
+
/* @__PURE__ */ jsx76(
|
|
10650
10787
|
SimpleTooltip,
|
|
10651
10788
|
{
|
|
10652
10789
|
content: isUnknownField ? "This field is not defined in the schema" : void 0,
|
|
10653
10790
|
variant: "error",
|
|
10654
|
-
children: /* @__PURE__ */
|
|
10791
|
+
children: /* @__PURE__ */ jsx76(
|
|
10655
10792
|
SelectTrigger,
|
|
10656
10793
|
{
|
|
10657
10794
|
className: `h-[26px] w-32 gap-3 rounded-none rounded-l-md border-r-0 border-zinc-200 bg-white px-2 text-sm font-normal ${isUnknownField ? "text-red-500" : ""}`,
|
|
10658
|
-
children: /* @__PURE__ */
|
|
10795
|
+
children: /* @__PURE__ */ jsx76(SelectValue, { placeholder: "Select field" })
|
|
10659
10796
|
}
|
|
10660
10797
|
)
|
|
10661
10798
|
}
|
|
10662
10799
|
),
|
|
10663
|
-
/* @__PURE__ */
|
|
10664
|
-
isUnknownField && /* @__PURE__ */
|
|
10665
|
-
fieldNames.length > 0 ? fieldNames.map((field) => /* @__PURE__ */
|
|
10800
|
+
/* @__PURE__ */ jsxs44(SelectContent, { children: [
|
|
10801
|
+
isUnknownField && /* @__PURE__ */ jsx76(SelectItem, { value: condition.field, className: "text-red-500", children: condition.field }, condition.field),
|
|
10802
|
+
fieldNames.length > 0 ? fieldNames.map((field) => /* @__PURE__ */ jsx76(SelectItem, { value: field, children: field }, field)) : !isUnknownField && /* @__PURE__ */ jsx76("div", { className: "px-2 py-1.5 text-sm text-zinc-500", children: "No fields available" })
|
|
10666
10803
|
] })
|
|
10667
10804
|
] }),
|
|
10668
|
-
/* @__PURE__ */
|
|
10669
|
-
/* @__PURE__ */
|
|
10805
|
+
/* @__PURE__ */ jsxs44(Select, { value: condition.operator, onValueChange: handleOperatorChange, children: [
|
|
10806
|
+
/* @__PURE__ */ jsx76(SimpleTooltip, { content: operatorError || valueTypeError, variant: "error", children: /* @__PURE__ */ jsx76(
|
|
10670
10807
|
SelectTrigger,
|
|
10671
10808
|
{
|
|
10672
10809
|
className: `h-[26px] w-24 gap-3 rounded-none border-r-0 border-zinc-200 px-2 text-sm font-normal ${operatorError || valueTypeError ? "text-red-500" : ""}`,
|
|
10673
|
-
children: /* @__PURE__ */
|
|
10810
|
+
children: /* @__PURE__ */ jsx76(SelectValue, {})
|
|
10674
10811
|
}
|
|
10675
10812
|
) }),
|
|
10676
|
-
/* @__PURE__ */
|
|
10677
|
-
isInvalidOperator && /* @__PURE__ */
|
|
10813
|
+
/* @__PURE__ */ jsxs44(SelectContent, { children: [
|
|
10814
|
+
isInvalidOperator && /* @__PURE__ */ jsx76(
|
|
10678
10815
|
SelectItem,
|
|
10679
10816
|
{
|
|
10680
10817
|
value: condition.operator,
|
|
@@ -10683,7 +10820,7 @@ var QueryCondition = ({
|
|
|
10683
10820
|
},
|
|
10684
10821
|
condition.operator
|
|
10685
10822
|
),
|
|
10686
|
-
filteredOperators.map((op) => /* @__PURE__ */
|
|
10823
|
+
filteredOperators.map((op) => /* @__PURE__ */ jsx76(
|
|
10687
10824
|
SelectItem,
|
|
10688
10825
|
{
|
|
10689
10826
|
value: op.value,
|
|
@@ -10694,9 +10831,9 @@ var QueryCondition = ({
|
|
|
10694
10831
|
))
|
|
10695
10832
|
] })
|
|
10696
10833
|
] }),
|
|
10697
|
-
currentFieldType === "boolean" && condition.operator === "in" ? /* @__PURE__ */
|
|
10698
|
-
/* @__PURE__ */
|
|
10699
|
-
/* @__PURE__ */
|
|
10834
|
+
currentFieldType === "boolean" && condition.operator === "in" ? /* @__PURE__ */ jsxs44("div", { className: "flex h-[26px] items-center gap-2 rounded-none rounded-r-md border border-zinc-200 bg-white px-2 text-sm", children: [
|
|
10835
|
+
/* @__PURE__ */ jsxs44("label", { className: "flex items-center gap-1", children: [
|
|
10836
|
+
/* @__PURE__ */ jsx76(
|
|
10700
10837
|
"input",
|
|
10701
10838
|
{
|
|
10702
10839
|
type: "checkbox",
|
|
@@ -10712,10 +10849,10 @@ var QueryCondition = ({
|
|
|
10712
10849
|
className: "h-3 w-3"
|
|
10713
10850
|
}
|
|
10714
10851
|
),
|
|
10715
|
-
/* @__PURE__ */
|
|
10852
|
+
/* @__PURE__ */ jsx76("span", { children: "true" })
|
|
10716
10853
|
] }),
|
|
10717
|
-
/* @__PURE__ */
|
|
10718
|
-
/* @__PURE__ */
|
|
10854
|
+
/* @__PURE__ */ jsxs44("label", { className: "flex items-center gap-1", children: [
|
|
10855
|
+
/* @__PURE__ */ jsx76(
|
|
10719
10856
|
"input",
|
|
10720
10857
|
{
|
|
10721
10858
|
type: "checkbox",
|
|
@@ -10731,9 +10868,9 @@ var QueryCondition = ({
|
|
|
10731
10868
|
className: "h-3 w-3"
|
|
10732
10869
|
}
|
|
10733
10870
|
),
|
|
10734
|
-
/* @__PURE__ */
|
|
10871
|
+
/* @__PURE__ */ jsx76("span", { children: "false" })
|
|
10735
10872
|
] })
|
|
10736
|
-
] }) : currentFieldType === "boolean" ? /* @__PURE__ */
|
|
10873
|
+
] }) : currentFieldType === "boolean" ? /* @__PURE__ */ jsxs44(
|
|
10737
10874
|
Select,
|
|
10738
10875
|
{
|
|
10739
10876
|
value: condition.value === true || condition.value === "true" ? "true" : condition.value === false || condition.value === "false" ? "false" : "true",
|
|
@@ -10745,14 +10882,14 @@ var QueryCondition = ({
|
|
|
10745
10882
|
});
|
|
10746
10883
|
},
|
|
10747
10884
|
children: [
|
|
10748
|
-
/* @__PURE__ */
|
|
10749
|
-
/* @__PURE__ */
|
|
10750
|
-
/* @__PURE__ */
|
|
10751
|
-
/* @__PURE__ */
|
|
10885
|
+
/* @__PURE__ */ jsx76(SelectTrigger, { className: "h-[26px] w-20 gap-3 rounded-none rounded-r-md border border-zinc-200 bg-white px-2 text-sm font-normal", children: /* @__PURE__ */ jsx76(SelectValue, {}) }),
|
|
10886
|
+
/* @__PURE__ */ jsxs44(SelectContent, { children: [
|
|
10887
|
+
/* @__PURE__ */ jsx76(SelectItem, { value: "true", children: "true" }),
|
|
10888
|
+
/* @__PURE__ */ jsx76(SelectItem, { value: "false", children: "false" })
|
|
10752
10889
|
] })
|
|
10753
10890
|
]
|
|
10754
10891
|
}
|
|
10755
|
-
) : /* @__PURE__ */
|
|
10892
|
+
) : /* @__PURE__ */ jsx76(
|
|
10756
10893
|
"input",
|
|
10757
10894
|
{
|
|
10758
10895
|
type: "text",
|
|
@@ -10765,15 +10902,15 @@ var QueryCondition = ({
|
|
|
10765
10902
|
}
|
|
10766
10903
|
)
|
|
10767
10904
|
] }),
|
|
10768
|
-
condition.operator === "fuzzy" && /* @__PURE__ */
|
|
10905
|
+
condition.operator === "fuzzy" && /* @__PURE__ */ jsxs44(
|
|
10769
10906
|
Select,
|
|
10770
10907
|
{
|
|
10771
10908
|
value: String(condition.fuzzyDistance || 1),
|
|
10772
10909
|
onValueChange: handleFuzzyDistanceChange,
|
|
10773
10910
|
children: [
|
|
10774
|
-
/* @__PURE__ */
|
|
10775
|
-
/* @__PURE__ */
|
|
10776
|
-
/* @__PURE__ */
|
|
10911
|
+
/* @__PURE__ */ jsx76(SelectTrigger, { className: "h-[26px] w-16 gap-3 border-zinc-200 bg-white px-2 text-sm", children: /* @__PURE__ */ jsx76(SelectValue, {}) }),
|
|
10912
|
+
/* @__PURE__ */ jsxs44(SelectContent, { children: [
|
|
10913
|
+
/* @__PURE__ */ jsx76(
|
|
10777
10914
|
SelectItem,
|
|
10778
10915
|
{
|
|
10779
10916
|
value: "1",
|
|
@@ -10781,17 +10918,17 @@ var QueryCondition = ({
|
|
|
10781
10918
|
children: "1"
|
|
10782
10919
|
}
|
|
10783
10920
|
),
|
|
10784
|
-
/* @__PURE__ */
|
|
10921
|
+
/* @__PURE__ */ jsx76(SelectItem, { value: "2", description: "Matches words with up to 2 character edits", children: "2" })
|
|
10785
10922
|
] })
|
|
10786
10923
|
]
|
|
10787
10924
|
}
|
|
10788
10925
|
),
|
|
10789
|
-
condition.operator === "phrase" && /* @__PURE__ */
|
|
10790
|
-
/* @__PURE__ */
|
|
10791
|
-
/* @__PURE__ */
|
|
10792
|
-
/* @__PURE__ */
|
|
10793
|
-
/* @__PURE__ */
|
|
10794
|
-
/* @__PURE__ */
|
|
10926
|
+
condition.operator === "phrase" && /* @__PURE__ */ jsxs44(Fragment16, { children: [
|
|
10927
|
+
/* @__PURE__ */ jsxs44(Select, { value: phraseMode, onValueChange: handlePhraseModeChange, children: [
|
|
10928
|
+
/* @__PURE__ */ jsx76(SelectTrigger, { className: "h-[26px] w-20 gap-3 border-zinc-200 bg-white px-2 text-sm font-normal", children: /* @__PURE__ */ jsx76(SelectValue, {}) }),
|
|
10929
|
+
/* @__PURE__ */ jsxs44(SelectContent, { children: [
|
|
10930
|
+
/* @__PURE__ */ jsx76(SelectItem, { value: "exact", description: "Terms must appear adjacent to each other", children: "exact" }),
|
|
10931
|
+
/* @__PURE__ */ jsx76(
|
|
10795
10932
|
SelectItem,
|
|
10796
10933
|
{
|
|
10797
10934
|
value: "slop",
|
|
@@ -10799,7 +10936,7 @@ var QueryCondition = ({
|
|
|
10799
10936
|
children: "slop"
|
|
10800
10937
|
}
|
|
10801
10938
|
),
|
|
10802
|
-
/* @__PURE__ */
|
|
10939
|
+
/* @__PURE__ */ jsx76(
|
|
10803
10940
|
SelectItem,
|
|
10804
10941
|
{
|
|
10805
10942
|
value: "prefix",
|
|
@@ -10809,7 +10946,7 @@ var QueryCondition = ({
|
|
|
10809
10946
|
)
|
|
10810
10947
|
] })
|
|
10811
10948
|
] }),
|
|
10812
|
-
phraseMode === "slop" && /* @__PURE__ */
|
|
10949
|
+
phraseMode === "slop" && /* @__PURE__ */ jsx76(
|
|
10813
10950
|
"input",
|
|
10814
10951
|
{
|
|
10815
10952
|
type: "number",
|
|
@@ -10822,21 +10959,21 @@ var QueryCondition = ({
|
|
|
10822
10959
|
}
|
|
10823
10960
|
)
|
|
10824
10961
|
] }),
|
|
10825
|
-
node.not && /* @__PURE__ */
|
|
10826
|
-
node.boost !== void 0 && /* @__PURE__ */
|
|
10827
|
-
/* @__PURE__ */
|
|
10962
|
+
node.not && /* @__PURE__ */ jsx76(NotBadge, {}),
|
|
10963
|
+
node.boost !== void 0 && /* @__PURE__ */ jsx76(BoostBadge, { node }),
|
|
10964
|
+
/* @__PURE__ */ jsxs44(
|
|
10828
10965
|
"div",
|
|
10829
10966
|
{
|
|
10830
10967
|
className: `flex items-center gap-1 transition-all duration-100 ${isDragging ? "opacity-0" : "-translate-x-[2px] opacity-0 group-hover/condition:translate-x-0 group-hover/condition:opacity-100 has-[[data-state=open]]:translate-x-0 has-[[data-state=open]]:opacity-100"}`,
|
|
10831
10968
|
children: [
|
|
10832
|
-
/* @__PURE__ */
|
|
10833
|
-
/* @__PURE__ */
|
|
10969
|
+
/* @__PURE__ */ jsx76(NodeActionsMenu, { node }),
|
|
10970
|
+
/* @__PURE__ */ jsx76(
|
|
10834
10971
|
"button",
|
|
10835
10972
|
{
|
|
10836
10973
|
type: "button",
|
|
10837
10974
|
onClick: handleDelete,
|
|
10838
10975
|
className: "flex h-[26px] w-[26px] items-center justify-center rounded-md border border-zinc-300 text-zinc-500 transition-colors hover:text-red-500",
|
|
10839
|
-
children: /* @__PURE__ */
|
|
10976
|
+
children: /* @__PURE__ */ jsx76(IconX3, { size: 16 })
|
|
10840
10977
|
}
|
|
10841
10978
|
)
|
|
10842
10979
|
]
|
|
@@ -10846,12 +10983,12 @@ var QueryCondition = ({
|
|
|
10846
10983
|
};
|
|
10847
10984
|
|
|
10848
10985
|
// src/components/databrowser/components/ui-query-builder/drag-overlay.tsx
|
|
10849
|
-
import { jsx as
|
|
10986
|
+
import { jsx as jsx77, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
10850
10987
|
var QueryDragOverlay = ({
|
|
10851
10988
|
activeNode,
|
|
10852
10989
|
onDropAnimationComplete
|
|
10853
10990
|
}) => {
|
|
10854
|
-
return /* @__PURE__ */
|
|
10991
|
+
return /* @__PURE__ */ jsx77(
|
|
10855
10992
|
DndKitDragOverlay,
|
|
10856
10993
|
{
|
|
10857
10994
|
dropAnimation: {
|
|
@@ -10864,16 +11001,16 @@ var QueryDragOverlay = ({
|
|
|
10864
11001
|
};
|
|
10865
11002
|
}
|
|
10866
11003
|
},
|
|
10867
|
-
children: activeNode && activeNode.type === "condition" ? /* @__PURE__ */
|
|
10868
|
-
/* @__PURE__ */
|
|
10869
|
-
/* @__PURE__ */
|
|
10870
|
-
] }) : activeNode && activeNode.type === "group" ? /* @__PURE__ */
|
|
10871
|
-
/* @__PURE__ */
|
|
10872
|
-
/* @__PURE__ */
|
|
10873
|
-
/* @__PURE__ */
|
|
10874
|
-
/* @__PURE__ */
|
|
10875
|
-
/* @__PURE__ */
|
|
10876
|
-
/* @__PURE__ */
|
|
11004
|
+
children: activeNode && activeNode.type === "condition" ? /* @__PURE__ */ jsxs45("div", { className: "relative -mt-1", children: [
|
|
11005
|
+
/* @__PURE__ */ jsx77("div", { className: "drag-overlay-bg absolute -bottom-1 -top-1 left-0 right-0 rounded-md border border-zinc-300 bg-zinc-100/90 shadow-md" }),
|
|
11006
|
+
/* @__PURE__ */ jsx77("div", { className: "relative", children: /* @__PURE__ */ jsx77(QueryCondition, { node: activeNode, isDragging: true }) })
|
|
11007
|
+
] }) : activeNode && activeNode.type === "group" ? /* @__PURE__ */ jsxs45("div", { className: "relative", children: [
|
|
11008
|
+
/* @__PURE__ */ jsx77("div", { className: "drag-overlay-bg absolute -bottom-1 -top-1 left-0 right-0 rounded-md border border-zinc-300 bg-zinc-100/90 shadow-md" }),
|
|
11009
|
+
/* @__PURE__ */ jsxs45("div", { className: "relative flex items-center gap-1", children: [
|
|
11010
|
+
/* @__PURE__ */ jsx77("div", { className: "flex cursor-grab items-center text-zinc-400", children: /* @__PURE__ */ jsx77(IconGripVertical2, { size: 16 }) }),
|
|
11011
|
+
/* @__PURE__ */ jsxs45("div", { className: "flex h-[26px] w-16 items-center justify-between rounded-md border border-zinc-300 bg-blue-50 px-2 text-sm font-medium capitalize text-zinc-700", children: [
|
|
11012
|
+
/* @__PURE__ */ jsx77("span", { children: activeNode.groupOperator === "and" ? "And" : "Or" }),
|
|
11013
|
+
/* @__PURE__ */ jsx77(
|
|
10877
11014
|
"svg",
|
|
10878
11015
|
{
|
|
10879
11016
|
className: "text-zinc-400",
|
|
@@ -10882,7 +11019,7 @@ var QueryDragOverlay = ({
|
|
|
10882
11019
|
viewBox: "0 0 16 16",
|
|
10883
11020
|
fill: "none",
|
|
10884
11021
|
xmlns: "http://www.w3.org/2000/svg",
|
|
10885
|
-
children: /* @__PURE__ */
|
|
11022
|
+
children: /* @__PURE__ */ jsx77(
|
|
10886
11023
|
"path",
|
|
10887
11024
|
{
|
|
10888
11025
|
d: "M4 6L8 10L12 6",
|
|
@@ -10896,8 +11033,8 @@ var QueryDragOverlay = ({
|
|
|
10896
11033
|
}
|
|
10897
11034
|
)
|
|
10898
11035
|
] }),
|
|
10899
|
-
activeNode.boost !== void 0 && /* @__PURE__ */
|
|
10900
|
-
activeNode.not && /* @__PURE__ */
|
|
11036
|
+
activeNode.boost !== void 0 && /* @__PURE__ */ jsx77(BoostBadge, { node: activeNode, static: true }),
|
|
11037
|
+
activeNode.not && /* @__PURE__ */ jsx77(NotBadge, {})
|
|
10901
11038
|
] })
|
|
10902
11039
|
] }) : null
|
|
10903
11040
|
}
|
|
@@ -10905,7 +11042,7 @@ var QueryDragOverlay = ({
|
|
|
10905
11042
|
};
|
|
10906
11043
|
|
|
10907
11044
|
// src/components/databrowser/components/ui-query-builder/dnd-context.tsx
|
|
10908
|
-
import { jsx as
|
|
11045
|
+
import { jsx as jsx78, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
10909
11046
|
var QueryDndProvider = ({
|
|
10910
11047
|
children,
|
|
10911
11048
|
rootNode,
|
|
@@ -10977,7 +11114,7 @@ var QueryDndProvider = ({
|
|
|
10977
11114
|
moveNode(activeIdStr, targetGroupId, adjustedIndex);
|
|
10978
11115
|
};
|
|
10979
11116
|
const activeNode = activeId ? findNodeById(rootNode, String(activeId)) : null;
|
|
10980
|
-
return /* @__PURE__ */
|
|
11117
|
+
return /* @__PURE__ */ jsxs46(
|
|
10981
11118
|
DndContext,
|
|
10982
11119
|
{
|
|
10983
11120
|
sensors,
|
|
@@ -10987,7 +11124,7 @@ var QueryDndProvider = ({
|
|
|
10987
11124
|
onDragEnd: handleDragEnd,
|
|
10988
11125
|
children: [
|
|
10989
11126
|
children,
|
|
10990
|
-
/* @__PURE__ */
|
|
11127
|
+
/* @__PURE__ */ jsx78(
|
|
10991
11128
|
QueryDragOverlay,
|
|
10992
11129
|
{
|
|
10993
11130
|
activeNode,
|
|
@@ -11024,7 +11161,7 @@ var findParentGroup = (root2, targetId) => {
|
|
|
11024
11161
|
|
|
11025
11162
|
// src/components/databrowser/components/ui-query-builder/draggable-item.tsx
|
|
11026
11163
|
import { useDraggable } from "@dnd-kit/core";
|
|
11027
|
-
import { jsx as
|
|
11164
|
+
import { jsx as jsx79 } from "react/jsx-runtime";
|
|
11028
11165
|
var DraggableItem = ({
|
|
11029
11166
|
id,
|
|
11030
11167
|
children,
|
|
@@ -11035,7 +11172,7 @@ var DraggableItem = ({
|
|
|
11035
11172
|
});
|
|
11036
11173
|
const isDropAnimating = droppingId === id;
|
|
11037
11174
|
const childElement = children;
|
|
11038
|
-
const childWithDragHandle = typeof children === "object" && children !== null && "type" in childElement ? /* @__PURE__ */
|
|
11175
|
+
const childWithDragHandle = typeof children === "object" && children !== null && "type" in childElement ? /* @__PURE__ */ jsx79(
|
|
11039
11176
|
childElement.type,
|
|
11040
11177
|
{
|
|
11041
11178
|
...childElement.props,
|
|
@@ -11046,7 +11183,7 @@ var DraggableItem = ({
|
|
|
11046
11183
|
}
|
|
11047
11184
|
}
|
|
11048
11185
|
) : children;
|
|
11049
|
-
return /* @__PURE__ */
|
|
11186
|
+
return /* @__PURE__ */ jsx79(
|
|
11050
11187
|
"div",
|
|
11051
11188
|
{
|
|
11052
11189
|
ref: setNodeRef,
|
|
@@ -11059,10 +11196,10 @@ var DraggableItem = ({
|
|
|
11059
11196
|
// src/components/databrowser/components/ui-query-builder/drop-zone.tsx
|
|
11060
11197
|
import { useDroppable } from "@dnd-kit/core";
|
|
11061
11198
|
import { IconPlus as IconPlus4 } from "@tabler/icons-react";
|
|
11062
|
-
import { jsx as
|
|
11199
|
+
import { jsx as jsx80, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
11063
11200
|
var DropIndicator = ({ id, isOver }) => {
|
|
11064
11201
|
const { setNodeRef } = useDroppable({ id });
|
|
11065
|
-
return /* @__PURE__ */
|
|
11202
|
+
return /* @__PURE__ */ jsx80("div", { ref: setNodeRef, className: `relative flex h-2 items-center`, children: /* @__PURE__ */ jsx80(
|
|
11066
11203
|
"div",
|
|
11067
11204
|
{
|
|
11068
11205
|
className: cn(
|
|
@@ -11078,7 +11215,7 @@ var EmptyGroupDropZone = ({
|
|
|
11078
11215
|
onAddCondition
|
|
11079
11216
|
}) => {
|
|
11080
11217
|
const { setNodeRef } = useDroppable({ id: `drop-${groupId}-end` });
|
|
11081
|
-
return /* @__PURE__ */
|
|
11218
|
+
return /* @__PURE__ */ jsxs47(
|
|
11082
11219
|
"button",
|
|
11083
11220
|
{
|
|
11084
11221
|
type: "button",
|
|
@@ -11089,7 +11226,7 @@ var EmptyGroupDropZone = ({
|
|
|
11089
11226
|
isOver ? "border-blue-500 bg-blue-50 text-blue-600" : "border-zinc-300 text-zinc-400 hover:border-zinc-400 hover:bg-zinc-50 hover:text-zinc-500"
|
|
11090
11227
|
),
|
|
11091
11228
|
children: [
|
|
11092
|
-
/* @__PURE__ */
|
|
11229
|
+
/* @__PURE__ */ jsx80(IconPlus4, { size: 14 }),
|
|
11093
11230
|
"Add a condition"
|
|
11094
11231
|
]
|
|
11095
11232
|
}
|
|
@@ -11097,22 +11234,22 @@ var EmptyGroupDropZone = ({
|
|
|
11097
11234
|
};
|
|
11098
11235
|
|
|
11099
11236
|
// src/components/databrowser/components/ui-query-builder/query-group.tsx
|
|
11100
|
-
import { Fragment as
|
|
11237
|
+
import { Fragment as Fragment17, jsx as jsx81, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
11101
11238
|
var ChildRow = ({
|
|
11102
11239
|
groupId,
|
|
11103
11240
|
child,
|
|
11104
11241
|
depth,
|
|
11105
11242
|
activeOverId,
|
|
11106
11243
|
droppingId
|
|
11107
|
-
}) => /* @__PURE__ */
|
|
11108
|
-
/* @__PURE__ */
|
|
11244
|
+
}) => /* @__PURE__ */ jsxs48("div", { children: [
|
|
11245
|
+
/* @__PURE__ */ jsx81(
|
|
11109
11246
|
DropIndicator,
|
|
11110
11247
|
{
|
|
11111
11248
|
id: `drop-${groupId}-${child.id}`,
|
|
11112
11249
|
isOver: activeOverId === `drop-${groupId}-${child.id}`
|
|
11113
11250
|
}
|
|
11114
11251
|
),
|
|
11115
|
-
/* @__PURE__ */
|
|
11252
|
+
/* @__PURE__ */ jsx81(DraggableItem, { id: child.id, droppingId, children: child.type === "condition" ? /* @__PURE__ */ jsx81(QueryCondition, { node: child }) : /* @__PURE__ */ jsx81(
|
|
11116
11253
|
InnerGroup,
|
|
11117
11254
|
{
|
|
11118
11255
|
node: child,
|
|
@@ -11143,71 +11280,71 @@ var InnerGroup = ({
|
|
|
11143
11280
|
const handleDeleteGroup = () => {
|
|
11144
11281
|
deleteNode(node.id);
|
|
11145
11282
|
};
|
|
11146
|
-
return /* @__PURE__ */
|
|
11147
|
-
/* @__PURE__ */
|
|
11148
|
-
!isRoot && /* @__PURE__ */
|
|
11283
|
+
return /* @__PURE__ */ jsxs48("div", { children: [
|
|
11284
|
+
/* @__PURE__ */ jsxs48("div", { className: "group/group flex items-center gap-1 px-1", children: [
|
|
11285
|
+
!isRoot && /* @__PURE__ */ jsx81(
|
|
11149
11286
|
"div",
|
|
11150
11287
|
{
|
|
11151
11288
|
ref: dragHandleProps?.ref,
|
|
11152
11289
|
className: "flex cursor-grab items-center px-1 text-zinc-400",
|
|
11153
11290
|
...dragHandleProps?.attributes,
|
|
11154
11291
|
...dragHandleProps?.listeners,
|
|
11155
|
-
children: /* @__PURE__ */
|
|
11292
|
+
children: /* @__PURE__ */ jsx81(IconGripVertical3, { size: 16 })
|
|
11156
11293
|
}
|
|
11157
11294
|
),
|
|
11158
|
-
/* @__PURE__ */
|
|
11159
|
-
/* @__PURE__ */
|
|
11160
|
-
/* @__PURE__ */
|
|
11161
|
-
/* @__PURE__ */
|
|
11162
|
-
/* @__PURE__ */
|
|
11295
|
+
/* @__PURE__ */ jsxs48(Select, { value: node.groupOperator, onValueChange: handleOperatorChange, children: [
|
|
11296
|
+
/* @__PURE__ */ jsx81(SelectTrigger, { className: "h-[26px] w-16 gap-3 rounded-md border-zinc-300 bg-blue-50 px-2 text-sm font-medium capitalize text-zinc-700 [&>svg]:text-zinc-400", children: /* @__PURE__ */ jsx81(SelectValue, {}) }),
|
|
11297
|
+
/* @__PURE__ */ jsxs48(SelectContent, { children: [
|
|
11298
|
+
/* @__PURE__ */ jsx81(SelectItem, { value: "and", children: "And" }),
|
|
11299
|
+
/* @__PURE__ */ jsx81(SelectItem, { value: "or", children: "Or" })
|
|
11163
11300
|
] })
|
|
11164
11301
|
] }),
|
|
11165
|
-
/* @__PURE__ */
|
|
11166
|
-
/* @__PURE__ */
|
|
11302
|
+
/* @__PURE__ */ jsxs48(DropdownMenu, { children: [
|
|
11303
|
+
/* @__PURE__ */ jsx81(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx81(
|
|
11167
11304
|
"button",
|
|
11168
11305
|
{
|
|
11169
11306
|
type: "button",
|
|
11170
11307
|
disabled: fieldInfos.length === 0,
|
|
11171
11308
|
className: "flex h-[26px] w-[26px] items-center justify-center rounded-md border border-zinc-300 text-zinc-500 transition-colors hover:text-zinc-700 disabled:cursor-not-allowed disabled:opacity-50",
|
|
11172
|
-
children: /* @__PURE__ */
|
|
11309
|
+
children: /* @__PURE__ */ jsx81(IconPlus5, { size: 16 })
|
|
11173
11310
|
}
|
|
11174
11311
|
) }),
|
|
11175
|
-
/* @__PURE__ */
|
|
11176
|
-
/* @__PURE__ */
|
|
11177
|
-
/* @__PURE__ */
|
|
11312
|
+
/* @__PURE__ */ jsxs48(DropdownMenuContent, { align: "start", children: [
|
|
11313
|
+
/* @__PURE__ */ jsx81(DropdownMenuItem, { onClick: handleAddCondition, children: "Add Condition" }),
|
|
11314
|
+
/* @__PURE__ */ jsx81(DropdownMenuItem, { onClick: handleAddGroup, children: "Add Group" })
|
|
11178
11315
|
] })
|
|
11179
11316
|
] }),
|
|
11180
|
-
node.not && /* @__PURE__ */
|
|
11181
|
-
node.boost !== void 0 && /* @__PURE__ */
|
|
11182
|
-
!isRoot && /* @__PURE__ */
|
|
11317
|
+
node.not && /* @__PURE__ */ jsx81(NotBadge, {}),
|
|
11318
|
+
node.boost !== void 0 && /* @__PURE__ */ jsx81(BoostBadge, { node }),
|
|
11319
|
+
!isRoot && /* @__PURE__ */ jsxs48(
|
|
11183
11320
|
"div",
|
|
11184
11321
|
{
|
|
11185
11322
|
className: `flex -translate-x-[2px] items-center gap-1 opacity-0 transition-all duration-100 group-hover/group:translate-x-0 group-hover/group:opacity-100 has-[[data-state=open]]:translate-x-0 has-[[data-state=open]]:opacity-100`,
|
|
11186
11323
|
children: [
|
|
11187
|
-
/* @__PURE__ */
|
|
11188
|
-
/* @__PURE__ */
|
|
11324
|
+
/* @__PURE__ */ jsx81(NodeActionsMenu, { node }),
|
|
11325
|
+
/* @__PURE__ */ jsx81(
|
|
11189
11326
|
"button",
|
|
11190
11327
|
{
|
|
11191
11328
|
type: "button",
|
|
11192
11329
|
onClick: handleDeleteGroup,
|
|
11193
11330
|
className: `flex h-[26px] w-[26px] items-center justify-center rounded-md border border-zinc-300 text-zinc-500 transition-colors hover:text-red-500`,
|
|
11194
|
-
children: /* @__PURE__ */
|
|
11331
|
+
children: /* @__PURE__ */ jsx81(IconX4, { size: 16 })
|
|
11195
11332
|
}
|
|
11196
11333
|
)
|
|
11197
11334
|
]
|
|
11198
11335
|
}
|
|
11199
11336
|
)
|
|
11200
11337
|
] }),
|
|
11201
|
-
/* @__PURE__ */
|
|
11338
|
+
/* @__PURE__ */ jsx81("div", { className: `min-h-[20px] ${isRoot ? "" : "ml-[15px] border-l-2 border-zinc-200 pl-3"}`, children: node.children.length === 0 ? /* @__PURE__ */ jsx81(
|
|
11202
11339
|
EmptyGroupDropZone,
|
|
11203
11340
|
{
|
|
11204
11341
|
groupId: node.id,
|
|
11205
11342
|
isOver: activeOverId === `drop-${node.id}-end`,
|
|
11206
11343
|
onAddCondition: fieldInfos.length > 0 ? handleAddCondition : void 0
|
|
11207
11344
|
}
|
|
11208
|
-
) : /* @__PURE__ */
|
|
11345
|
+
) : /* @__PURE__ */ jsxs48(Fragment17, { children: [
|
|
11209
11346
|
node.children.map(
|
|
11210
|
-
(child) => !child.not && /* @__PURE__ */
|
|
11347
|
+
(child) => !child.not && /* @__PURE__ */ jsx81(
|
|
11211
11348
|
ChildRow,
|
|
11212
11349
|
{
|
|
11213
11350
|
groupId: node.id,
|
|
@@ -11219,15 +11356,15 @@ var InnerGroup = ({
|
|
|
11219
11356
|
child.id
|
|
11220
11357
|
)
|
|
11221
11358
|
),
|
|
11222
|
-
node.children.some((child) => child.not) && /* @__PURE__ */
|
|
11223
|
-
/* @__PURE__ */
|
|
11224
|
-
/* @__PURE__ */
|
|
11225
|
-
/* @__PURE__ */
|
|
11226
|
-
/* @__PURE__ */
|
|
11359
|
+
node.children.some((child) => child.not) && /* @__PURE__ */ jsxs48(Tooltip, { delayDuration: 200, children: [
|
|
11360
|
+
/* @__PURE__ */ jsx81(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx81("div", { className: "ml-2 mt-2 flex h-[26px] w-fit cursor-default select-none items-center rounded-md border border-zinc-300 bg-amber-50 px-2 text-sm font-medium capitalize text-amber-800", children: "Must Not" }) }),
|
|
11361
|
+
/* @__PURE__ */ jsxs48(TooltipContent, { side: "right", className: "max-w-xs", children: [
|
|
11362
|
+
/* @__PURE__ */ jsx81("span", { children: "Keys matching any of the conditions below are excluded from the results." }),
|
|
11363
|
+
/* @__PURE__ */ jsx81(DocsLink, { href: "https://upstash-search.mintlify.app/redis/search/query-operators/boolean-operators/must-not" })
|
|
11227
11364
|
] })
|
|
11228
11365
|
] }),
|
|
11229
11366
|
node.children.map(
|
|
11230
|
-
(child) => child.not && /* @__PURE__ */
|
|
11367
|
+
(child) => child.not && /* @__PURE__ */ jsx81(
|
|
11231
11368
|
ChildRow,
|
|
11232
11369
|
{
|
|
11233
11370
|
groupId: node.id,
|
|
@@ -11239,7 +11376,7 @@ var InnerGroup = ({
|
|
|
11239
11376
|
child.id
|
|
11240
11377
|
)
|
|
11241
11378
|
),
|
|
11242
|
-
/* @__PURE__ */
|
|
11379
|
+
/* @__PURE__ */ jsx81(
|
|
11243
11380
|
DropIndicator,
|
|
11244
11381
|
{
|
|
11245
11382
|
id: `drop-${node.id}-end`,
|
|
@@ -11254,7 +11391,7 @@ var QueryGroup = ({ node, isRoot = false, depth }) => {
|
|
|
11254
11391
|
const [droppingId, setDroppingId] = useState27(null);
|
|
11255
11392
|
if (node.type !== "group") return;
|
|
11256
11393
|
if (!isRoot) {
|
|
11257
|
-
return /* @__PURE__ */
|
|
11394
|
+
return /* @__PURE__ */ jsx81(
|
|
11258
11395
|
InnerGroup,
|
|
11259
11396
|
{
|
|
11260
11397
|
node,
|
|
@@ -11265,13 +11402,13 @@ var QueryGroup = ({ node, isRoot = false, depth }) => {
|
|
|
11265
11402
|
}
|
|
11266
11403
|
);
|
|
11267
11404
|
}
|
|
11268
|
-
return /* @__PURE__ */
|
|
11405
|
+
return /* @__PURE__ */ jsx81(
|
|
11269
11406
|
QueryDndProvider,
|
|
11270
11407
|
{
|
|
11271
11408
|
rootNode: node,
|
|
11272
11409
|
setActiveOverId,
|
|
11273
11410
|
setDroppingId,
|
|
11274
|
-
children: /* @__PURE__ */
|
|
11411
|
+
children: /* @__PURE__ */ jsx81(
|
|
11275
11412
|
InnerGroup,
|
|
11276
11413
|
{
|
|
11277
11414
|
node,
|
|
@@ -11495,7 +11632,7 @@ var useQueryStateSync = () => {
|
|
|
11495
11632
|
};
|
|
11496
11633
|
|
|
11497
11634
|
// src/components/databrowser/components/ui-query-builder/ui-query-builder.tsx
|
|
11498
|
-
import { jsx as
|
|
11635
|
+
import { jsx as jsx82, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
11499
11636
|
var UIQueryBuilder = () => {
|
|
11500
11637
|
const { valuesSearch } = useTab();
|
|
11501
11638
|
const { data: indexDetails } = useFetchSearchIndex(valuesSearch.index);
|
|
@@ -11529,27 +11666,27 @@ var UIQueryBuilder = () => {
|
|
|
11529
11666
|
obs.observe(el);
|
|
11530
11667
|
return () => obs.disconnect();
|
|
11531
11668
|
}, [recomputeShadows]);
|
|
11532
|
-
return /* @__PURE__ */
|
|
11533
|
-
/* @__PURE__ */
|
|
11669
|
+
return /* @__PURE__ */ jsx82(QueryBuilderUIProvider, { fieldInfos, setQueryState, children: /* @__PURE__ */ jsxs49("div", { className: "relative h-full min-h-0 rounded-lg bg-zinc-50 dark:bg-zinc-50/40", children: [
|
|
11670
|
+
/* @__PURE__ */ jsx82(
|
|
11534
11671
|
"div",
|
|
11535
11672
|
{
|
|
11536
11673
|
className: `scroll-shadow-top pointer-events-none absolute left-0 top-0 z-10 h-6 w-full rounded-t-lg transition-opacity duration-200 ${hasTopShadow ? "opacity-100" : "opacity-0"}`
|
|
11537
11674
|
}
|
|
11538
11675
|
),
|
|
11539
|
-
/* @__PURE__ */
|
|
11676
|
+
/* @__PURE__ */ jsx82(
|
|
11540
11677
|
"div",
|
|
11541
11678
|
{
|
|
11542
11679
|
className: `scroll-shadow-bottom pointer-events-none absolute bottom-0 left-0 z-10 h-6 w-full rounded-b-lg transition-opacity duration-200 ${hasBottomShadow ? "opacity-100" : "opacity-0"}`
|
|
11543
11680
|
}
|
|
11544
11681
|
),
|
|
11545
|
-
/* @__PURE__ */
|
|
11682
|
+
/* @__PURE__ */ jsx82(
|
|
11546
11683
|
ScrollArea,
|
|
11547
11684
|
{
|
|
11548
11685
|
ref: scrollAreaRef,
|
|
11549
11686
|
onScroll: recomputeShadows,
|
|
11550
11687
|
className: "h-full",
|
|
11551
11688
|
scrollBarClassName: "py-1",
|
|
11552
|
-
children: /* @__PURE__ */
|
|
11689
|
+
children: /* @__PURE__ */ jsx82("div", { className: "p-4", children: /* @__PURE__ */ jsx82(QueryGroup, { node: queryState.root, isRoot: true, depth: 0 }) })
|
|
11553
11690
|
}
|
|
11554
11691
|
)
|
|
11555
11692
|
] }) });
|
|
@@ -11622,7 +11759,7 @@ var extractFieldInfo = (schema) => {
|
|
|
11622
11759
|
};
|
|
11623
11760
|
|
|
11624
11761
|
// src/components/databrowser/components/databrowser-instance.tsx
|
|
11625
|
-
import { jsx as
|
|
11762
|
+
import { jsx as jsx83, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
11626
11763
|
var PREFIX = "const query: Query = ";
|
|
11627
11764
|
var QueryBuilderContent = () => {
|
|
11628
11765
|
const { valuesSearch, queryBuilderMode, setQueryBuilderMode } = useTab();
|
|
@@ -11644,8 +11781,8 @@ var QueryBuilderContent = () => {
|
|
|
11644
11781
|
setQueryBuilderMode(newMode);
|
|
11645
11782
|
};
|
|
11646
11783
|
const errorMessage = switchError ?? (query.error ? formatUpstashErrorMessage(query.error) : void 0);
|
|
11647
|
-
return /* @__PURE__ */
|
|
11648
|
-
/* @__PURE__ */
|
|
11784
|
+
return /* @__PURE__ */ jsxs50("div", { className: "relative flex h-full min-h-0 flex-col", children: [
|
|
11785
|
+
/* @__PURE__ */ jsx83("div", { className: "absolute right-4 top-4 z-[2]", children: /* @__PURE__ */ jsx83(
|
|
11649
11786
|
Segmented,
|
|
11650
11787
|
{
|
|
11651
11788
|
options: [
|
|
@@ -11657,9 +11794,9 @@ var QueryBuilderContent = () => {
|
|
|
11657
11794
|
buttonClassName: "h-6"
|
|
11658
11795
|
}
|
|
11659
11796
|
) }),
|
|
11660
|
-
queryBuilderMode === "ui" ? /* @__PURE__ */
|
|
11661
|
-
/* @__PURE__ */
|
|
11662
|
-
/* @__PURE__ */
|
|
11797
|
+
queryBuilderMode === "ui" ? /* @__PURE__ */ jsx83(UIQueryBuilder, {}) : /* @__PURE__ */ jsx83(QueryBuilder, {}),
|
|
11798
|
+
/* @__PURE__ */ jsx83(QueryBuilderError, { error: errorMessage, autoHide: Boolean(switchError) }),
|
|
11799
|
+
/* @__PURE__ */ jsx83(
|
|
11663
11800
|
DocsLink,
|
|
11664
11801
|
{
|
|
11665
11802
|
className: "absolute bottom-2 right-2 text-sm",
|
|
@@ -11674,8 +11811,8 @@ var SearchContent = () => {
|
|
|
11674
11811
|
return null;
|
|
11675
11812
|
}
|
|
11676
11813
|
const hasIndexes = indexes && indexes.length > 0;
|
|
11677
|
-
if (!hasIndexes) return /* @__PURE__ */
|
|
11678
|
-
return /* @__PURE__ */
|
|
11814
|
+
if (!hasIndexes) return /* @__PURE__ */ jsx83(SearchEmptyState, {});
|
|
11815
|
+
return /* @__PURE__ */ jsx83(QueryBuilderContent, {});
|
|
11679
11816
|
};
|
|
11680
11817
|
var DatabrowserInstance = ({
|
|
11681
11818
|
hidden,
|
|
@@ -11694,7 +11831,7 @@ var DatabrowserInstance = ({
|
|
|
11694
11831
|
}
|
|
11695
11832
|
}, [tabType, isValuesSearchSelected, setIsValuesSearchSelected]);
|
|
11696
11833
|
const showEmptyState = isValuesSearchSelected && !isLoading && (!indexes || indexes.length === 0);
|
|
11697
|
-
return /* @__PURE__ */
|
|
11834
|
+
return /* @__PURE__ */ jsx83(KeysProvider, { children: /* @__PURE__ */ jsxs50(
|
|
11698
11835
|
"div",
|
|
11699
11836
|
{
|
|
11700
11837
|
className: cn(
|
|
@@ -11702,49 +11839,49 @@ var DatabrowserInstance = ({
|
|
|
11702
11839
|
hidden && "hidden"
|
|
11703
11840
|
),
|
|
11704
11841
|
children: [
|
|
11705
|
-
/* @__PURE__ */
|
|
11706
|
-
/* @__PURE__ */
|
|
11707
|
-
!isValuesSearchSelected && /* @__PURE__ */
|
|
11842
|
+
/* @__PURE__ */ jsxs50("div", { className: "space-y-3 py-5", children: [
|
|
11843
|
+
/* @__PURE__ */ jsx83(Header, { tabType, allowSearch }),
|
|
11844
|
+
!isValuesSearchSelected && /* @__PURE__ */ jsx83(HeaderError, {})
|
|
11708
11845
|
] }),
|
|
11709
|
-
showEmptyState ? /* @__PURE__ */
|
|
11846
|
+
showEmptyState ? /* @__PURE__ */ jsx83(SearchEmptyState, {}) : isValuesSearchSelected ? /* @__PURE__ */ jsxs50(
|
|
11710
11847
|
PanelGroup,
|
|
11711
11848
|
{
|
|
11712
11849
|
autoSaveId: "search-layout",
|
|
11713
11850
|
direction: "vertical",
|
|
11714
11851
|
className: "h-full w-full !overflow-visible text-sm antialiased",
|
|
11715
11852
|
children: [
|
|
11716
|
-
/* @__PURE__ */
|
|
11853
|
+
/* @__PURE__ */ jsx83(
|
|
11717
11854
|
Panel,
|
|
11718
11855
|
{
|
|
11719
11856
|
defaultSize: 30,
|
|
11720
11857
|
minSize: 15,
|
|
11721
11858
|
maxSize: 60,
|
|
11722
11859
|
className: queryBuilderMode === "code" ? "!overflow-visible" : "",
|
|
11723
|
-
children: /* @__PURE__ */
|
|
11860
|
+
children: /* @__PURE__ */ jsx83(SearchContent, {})
|
|
11724
11861
|
}
|
|
11725
11862
|
),
|
|
11726
|
-
/* @__PURE__ */
|
|
11727
|
-
/* @__PURE__ */
|
|
11728
|
-
/* @__PURE__ */
|
|
11729
|
-
/* @__PURE__ */
|
|
11730
|
-
/* @__PURE__ */
|
|
11863
|
+
/* @__PURE__ */ jsx83(ResizeHandle, { direction: "vertical" }),
|
|
11864
|
+
/* @__PURE__ */ jsx83(Panel, { minSize: 30, children: /* @__PURE__ */ jsxs50(PanelGroup, { autoSaveId: "persistence", direction: "horizontal", className: "h-full w-full", children: [
|
|
11865
|
+
/* @__PURE__ */ jsx83(Panel, { defaultSize: 30, minSize: 30, children: /* @__PURE__ */ jsx83(Sidebar, {}) }),
|
|
11866
|
+
/* @__PURE__ */ jsx83(ResizeHandle, {}),
|
|
11867
|
+
/* @__PURE__ */ jsx83(Panel, { minSize: 40, children: /* @__PURE__ */ jsx83(DataDisplay, {}) })
|
|
11731
11868
|
] }) })
|
|
11732
11869
|
]
|
|
11733
11870
|
}
|
|
11734
|
-
) : /* @__PURE__ */
|
|
11871
|
+
) : /* @__PURE__ */ jsxs50(
|
|
11735
11872
|
PanelGroup,
|
|
11736
11873
|
{
|
|
11737
11874
|
autoSaveId: "persistence",
|
|
11738
11875
|
direction: "horizontal",
|
|
11739
11876
|
className: "h-full w-full text-sm antialiased",
|
|
11740
11877
|
children: [
|
|
11741
|
-
/* @__PURE__ */
|
|
11742
|
-
/* @__PURE__ */
|
|
11743
|
-
/* @__PURE__ */
|
|
11878
|
+
/* @__PURE__ */ jsx83(Panel, { defaultSize: 30, minSize: 30, children: /* @__PURE__ */ jsx83(Sidebar, {}) }),
|
|
11879
|
+
/* @__PURE__ */ jsx83(ResizeHandle, {}),
|
|
11880
|
+
/* @__PURE__ */ jsx83(Panel, { minSize: 40, children: /* @__PURE__ */ jsx83(DataDisplay, {}) })
|
|
11744
11881
|
]
|
|
11745
11882
|
}
|
|
11746
11883
|
),
|
|
11747
|
-
/* @__PURE__ */
|
|
11884
|
+
/* @__PURE__ */ jsx83(Toaster, {})
|
|
11748
11885
|
]
|
|
11749
11886
|
}
|
|
11750
11887
|
) });
|
|
@@ -11769,8 +11906,8 @@ import { IconChevronDown as IconChevronDown3, IconPlus as IconPlus6, IconWindowM
|
|
|
11769
11906
|
import * as React15 from "react";
|
|
11770
11907
|
import { IconSearch as IconSearch4 } from "@tabler/icons-react";
|
|
11771
11908
|
import { Command as CommandPrimitive } from "cmdk";
|
|
11772
|
-
import { jsx as
|
|
11773
|
-
var Command = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
11909
|
+
import { jsx as jsx84, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
11910
|
+
var Command = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx84(
|
|
11774
11911
|
CommandPrimitive,
|
|
11775
11912
|
{
|
|
11776
11913
|
ref,
|
|
@@ -11782,9 +11919,9 @@ var Command = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
11782
11919
|
}
|
|
11783
11920
|
));
|
|
11784
11921
|
Command.displayName = CommandPrimitive.displayName;
|
|
11785
|
-
var CommandInput = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
11786
|
-
/* @__PURE__ */
|
|
11787
|
-
/* @__PURE__ */
|
|
11922
|
+
var CommandInput = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs51("div", { className: "flex items-center border-b px-3", "cmdk-input-wrapper": "", children: [
|
|
11923
|
+
/* @__PURE__ */ jsx84(IconSearch4, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
|
|
11924
|
+
/* @__PURE__ */ jsx84(
|
|
11788
11925
|
CommandPrimitive.Input,
|
|
11789
11926
|
{
|
|
11790
11927
|
ref,
|
|
@@ -11797,7 +11934,7 @@ var CommandInput = React15.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
11797
11934
|
)
|
|
11798
11935
|
] }));
|
|
11799
11936
|
CommandInput.displayName = CommandPrimitive.Input.displayName;
|
|
11800
|
-
var CommandList = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
11937
|
+
var CommandList = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx84(
|
|
11801
11938
|
CommandPrimitive.List,
|
|
11802
11939
|
{
|
|
11803
11940
|
ref,
|
|
@@ -11806,9 +11943,9 @@ var CommandList = React15.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
11806
11943
|
}
|
|
11807
11944
|
));
|
|
11808
11945
|
CommandList.displayName = CommandPrimitive.List.displayName;
|
|
11809
|
-
var CommandEmpty = React15.forwardRef((props, ref) => /* @__PURE__ */
|
|
11946
|
+
var CommandEmpty = React15.forwardRef((props, ref) => /* @__PURE__ */ jsx84(CommandPrimitive.Empty, { ref, className: "py-6 text-center text-sm", ...props }));
|
|
11810
11947
|
CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
|
|
11811
|
-
var CommandGroup = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
11948
|
+
var CommandGroup = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx84(
|
|
11812
11949
|
CommandPrimitive.Group,
|
|
11813
11950
|
{
|
|
11814
11951
|
ref,
|
|
@@ -11820,7 +11957,7 @@ var CommandGroup = React15.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
11820
11957
|
}
|
|
11821
11958
|
));
|
|
11822
11959
|
CommandGroup.displayName = CommandPrimitive.Group.displayName;
|
|
11823
|
-
var CommandSeparator = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
11960
|
+
var CommandSeparator = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx84(
|
|
11824
11961
|
CommandPrimitive.Separator,
|
|
11825
11962
|
{
|
|
11826
11963
|
ref,
|
|
@@ -11829,7 +11966,7 @@ var CommandSeparator = React15.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
11829
11966
|
}
|
|
11830
11967
|
));
|
|
11831
11968
|
CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
|
|
11832
|
-
var CommandItem = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
11969
|
+
var CommandItem = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx84(
|
|
11833
11970
|
CommandPrimitive.Item,
|
|
11834
11971
|
{
|
|
11835
11972
|
ref,
|
|
@@ -11842,7 +11979,7 @@ var CommandItem = React15.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
11842
11979
|
));
|
|
11843
11980
|
CommandItem.displayName = CommandPrimitive.Item.displayName;
|
|
11844
11981
|
var CommandShortcut = ({ className, ...props }) => {
|
|
11845
|
-
return /* @__PURE__ */
|
|
11982
|
+
return /* @__PURE__ */ jsx84("span", { className: cn("ml-auto text-xs tracking-widest text-zinc-500", className), ...props });
|
|
11846
11983
|
};
|
|
11847
11984
|
CommandShortcut.displayName = "CommandShortcut";
|
|
11848
11985
|
|
|
@@ -11883,16 +12020,16 @@ var useOverflow = () => {
|
|
|
11883
12020
|
};
|
|
11884
12021
|
|
|
11885
12022
|
// src/components/databrowser/components/tab-type-icon.tsx
|
|
11886
|
-
import { jsx as
|
|
12023
|
+
import { jsx as jsx85 } from "react/jsx-runtime";
|
|
11887
12024
|
function TabTypeIcon({ selectedKey }) {
|
|
11888
12025
|
const { data: keyType, isLoading } = useFetchKeyType(selectedKey);
|
|
11889
|
-
if (isLoading) return /* @__PURE__ */
|
|
12026
|
+
if (isLoading) return /* @__PURE__ */ jsx85(Skeleton, { className: "h-5 w-5 rounded" });
|
|
11890
12027
|
if (!keyType || keyType === "none") return;
|
|
11891
|
-
return /* @__PURE__ */
|
|
12028
|
+
return /* @__PURE__ */ jsx85(TypeTag, { variant: keyType, type: "icon" });
|
|
11892
12029
|
}
|
|
11893
12030
|
|
|
11894
12031
|
// src/components/databrowser/components/tab.tsx
|
|
11895
|
-
import { jsx as
|
|
12032
|
+
import { jsx as jsx86, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
11896
12033
|
var Tab = ({ id, isList }) => {
|
|
11897
12034
|
const { active, search, selectedKey, valuesSearch, pinned, isValuesSearchSelected } = useTab();
|
|
11898
12035
|
const {
|
|
@@ -11908,8 +12045,8 @@ var Tab = ({ id, isList }) => {
|
|
|
11908
12045
|
const hasPinnedTabs = tabs.some(([, data]) => data.pinned);
|
|
11909
12046
|
const { ref, isOverflow } = useOverflow();
|
|
11910
12047
|
const label = isValuesSearchSelected ? valuesSearch.index : search.key || selectedKey;
|
|
11911
|
-
const iconNode = isValuesSearchSelected ? /* @__PURE__ */
|
|
11912
|
-
const tabNode = /* @__PURE__ */
|
|
12048
|
+
const iconNode = isValuesSearchSelected ? /* @__PURE__ */ jsx86("div", { className: "flex h-[20px] w-[20px] items-center justify-center rounded-md bg-emerald-200 text-emerald-800", children: /* @__PURE__ */ jsx86(IconSearch5, { size: 14 }) }) : search.key ? /* @__PURE__ */ jsx86("div", { className: "flex h-[20px] w-[20px] items-center justify-center rounded-md bg-zinc-100 text-zinc-600", children: /* @__PURE__ */ jsx86(IconSearch5, { size: 14 }) }) : selectedKey ? /* @__PURE__ */ jsx86(TabTypeIcon, { selectedKey }) : void 0;
|
|
12049
|
+
const tabNode = /* @__PURE__ */ jsxs52(
|
|
11913
12050
|
"div",
|
|
11914
12051
|
{
|
|
11915
12052
|
id: isList ? `list-tab-${id}` : `tab-${id}`,
|
|
@@ -11920,8 +12057,8 @@ var Tab = ({ id, isList }) => {
|
|
|
11920
12057
|
!isList && (active ? "bg-white text-zinc-950" : "bg-zinc-200 text-zinc-600 hover:bg-zinc-100")
|
|
11921
12058
|
),
|
|
11922
12059
|
children: [
|
|
11923
|
-
/* @__PURE__ */
|
|
11924
|
-
/* @__PURE__ */
|
|
12060
|
+
/* @__PURE__ */ jsx86("div", { className: cn(!active && "transition-colors"), children: iconNode }),
|
|
12061
|
+
/* @__PURE__ */ jsx86(
|
|
11925
12062
|
"span",
|
|
11926
12063
|
{
|
|
11927
12064
|
ref,
|
|
@@ -11929,8 +12066,8 @@ var Tab = ({ id, isList }) => {
|
|
|
11929
12066
|
children: label || "New Tab"
|
|
11930
12067
|
}
|
|
11931
12068
|
),
|
|
11932
|
-
pinned && /* @__PURE__ */
|
|
11933
|
-
tabs.length > 1 && !pinned && /* @__PURE__ */
|
|
12069
|
+
pinned && /* @__PURE__ */ jsx86(IconPin, { size: 14, className: "text-zinc-500" }),
|
|
12070
|
+
tabs.length > 1 && !pinned && /* @__PURE__ */ jsx86(
|
|
11934
12071
|
"button",
|
|
11935
12072
|
{
|
|
11936
12073
|
onClick: (e) => {
|
|
@@ -11938,46 +12075,46 @@ var Tab = ({ id, isList }) => {
|
|
|
11938
12075
|
removeTab(id);
|
|
11939
12076
|
},
|
|
11940
12077
|
className: "p-[2px] text-zinc-400 transition-colors hover:text-zinc-500",
|
|
11941
|
-
children: /* @__PURE__ */
|
|
12078
|
+
children: /* @__PURE__ */ jsx86(IconX5, { size: 16 })
|
|
11942
12079
|
}
|
|
11943
12080
|
)
|
|
11944
12081
|
]
|
|
11945
12082
|
}
|
|
11946
12083
|
);
|
|
11947
|
-
return /* @__PURE__ */
|
|
11948
|
-
/* @__PURE__ */
|
|
11949
|
-
/* @__PURE__ */
|
|
12084
|
+
return /* @__PURE__ */ jsxs52(ContextMenu, { children: [
|
|
12085
|
+
/* @__PURE__ */ jsx86(SimpleTooltip, { content: isOverflow ? label : void 0, children: /* @__PURE__ */ jsx86(ContextMenuTrigger, { asChild: true, children: tabNode }) }),
|
|
12086
|
+
/* @__PURE__ */ jsxs52(
|
|
11950
12087
|
ContextMenuContent,
|
|
11951
12088
|
{
|
|
11952
12089
|
onClick: (e) => {
|
|
11953
12090
|
e.stopPropagation();
|
|
11954
12091
|
},
|
|
11955
12092
|
children: [
|
|
11956
|
-
/* @__PURE__ */
|
|
11957
|
-
/* @__PURE__ */
|
|
12093
|
+
/* @__PURE__ */ jsxs52(ContextMenuItem, { onSelect: () => togglePinTab(id), className: "gap-2", children: [
|
|
12094
|
+
/* @__PURE__ */ jsx86(IconPin, { size: 16 }),
|
|
11958
12095
|
pinned ? "Unpin Tab" : "Pin Tab"
|
|
11959
12096
|
] }),
|
|
11960
|
-
/* @__PURE__ */
|
|
11961
|
-
/* @__PURE__ */
|
|
12097
|
+
/* @__PURE__ */ jsxs52(ContextMenuItem, { onSelect: () => duplicateTab(id), className: "gap-2", children: [
|
|
12098
|
+
/* @__PURE__ */ jsx86(IconCopyPlus, { size: 16 }),
|
|
11962
12099
|
"Duplicate Tab"
|
|
11963
12100
|
] }),
|
|
11964
|
-
/* @__PURE__ */
|
|
11965
|
-
/* @__PURE__ */
|
|
11966
|
-
/* @__PURE__ */
|
|
12101
|
+
/* @__PURE__ */ jsx86(ContextMenuSeparator, {}),
|
|
12102
|
+
/* @__PURE__ */ jsxs52(ContextMenuItem, { onSelect: () => forceRemoveTab(id), className: "gap-2", children: [
|
|
12103
|
+
/* @__PURE__ */ jsx86(IconX5, { size: 16 }),
|
|
11967
12104
|
"Close Tab"
|
|
11968
12105
|
] }),
|
|
11969
|
-
/* @__PURE__ */
|
|
11970
|
-
/* @__PURE__ */
|
|
12106
|
+
/* @__PURE__ */ jsxs52(ContextMenuItem, { onSelect: () => closeOtherTabs(id), className: "gap-2", children: [
|
|
12107
|
+
/* @__PURE__ */ jsx86(IconSquareX, { size: 16 }),
|
|
11971
12108
|
"Close Other Tabs"
|
|
11972
12109
|
] }),
|
|
11973
|
-
/* @__PURE__ */
|
|
12110
|
+
/* @__PURE__ */ jsxs52(
|
|
11974
12111
|
ContextMenuItem,
|
|
11975
12112
|
{
|
|
11976
12113
|
onSelect: () => closeAllButPinned(),
|
|
11977
12114
|
className: "gap-2",
|
|
11978
12115
|
disabled: !hasPinnedTabs,
|
|
11979
12116
|
children: [
|
|
11980
|
-
/* @__PURE__ */
|
|
12117
|
+
/* @__PURE__ */ jsx86(IconArrowsMinimize, { size: 16 }),
|
|
11981
12118
|
"Close All But Pinned"
|
|
11982
12119
|
]
|
|
11983
12120
|
}
|
|
@@ -11989,7 +12126,7 @@ var Tab = ({ id, isList }) => {
|
|
|
11989
12126
|
};
|
|
11990
12127
|
|
|
11991
12128
|
// src/components/databrowser/components/databrowser-tabs.tsx
|
|
11992
|
-
import { jsx as
|
|
12129
|
+
import { jsx as jsx87, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
11993
12130
|
var SortableTab = ({ id }) => {
|
|
11994
12131
|
const [originalWidth, setOriginalWidth] = useState32(null);
|
|
11995
12132
|
const textRef = useRef11(null);
|
|
@@ -12057,7 +12194,7 @@ var SortableTab = ({ id }) => {
|
|
|
12057
12194
|
minWidth: originalWidth ? `${originalWidth}px` : void 0
|
|
12058
12195
|
} : {}
|
|
12059
12196
|
};
|
|
12060
|
-
return /* @__PURE__ */
|
|
12197
|
+
return /* @__PURE__ */ jsx87(
|
|
12061
12198
|
"div",
|
|
12062
12199
|
{
|
|
12063
12200
|
ref: measureRef,
|
|
@@ -12065,7 +12202,7 @@ var SortableTab = ({ id }) => {
|
|
|
12065
12202
|
className: isDragging ? "cursor-grabbing" : isPinned ? "cursor-default" : "cursor-grab",
|
|
12066
12203
|
...attributes,
|
|
12067
12204
|
...isPinned ? {} : listeners2,
|
|
12068
|
-
children: /* @__PURE__ */
|
|
12205
|
+
children: /* @__PURE__ */ jsx87(TabIdProvider, { value: id, children: /* @__PURE__ */ jsx87(Tab, { id }) })
|
|
12069
12206
|
}
|
|
12070
12207
|
);
|
|
12071
12208
|
};
|
|
@@ -12140,28 +12277,28 @@ var DatabrowserTabs = ({ onFullScreenClick }) => {
|
|
|
12140
12277
|
reorderTabs(oldIndex, newIndex);
|
|
12141
12278
|
}
|
|
12142
12279
|
};
|
|
12143
|
-
return /* @__PURE__ */
|
|
12144
|
-
/* @__PURE__ */
|
|
12145
|
-
/* @__PURE__ */
|
|
12280
|
+
return /* @__PURE__ */ jsx87("div", { className: "relative shrink-0 overflow-hidden rounded-t-[10px] bg-zinc-300", children: /* @__PURE__ */ jsxs53("div", { className: "flex items-center gap-1", children: [
|
|
12281
|
+
/* @__PURE__ */ jsxs53("div", { className: "relative min-w-0 flex-1", children: [
|
|
12282
|
+
/* @__PURE__ */ jsx87(
|
|
12146
12283
|
"div",
|
|
12147
12284
|
{
|
|
12148
12285
|
className: `tabs-shadow-left pointer-events-none absolute left-0 top-0 z-10 h-full w-6 transition-opacity duration-200 ${hasLeftShadow ? "opacity-100" : "opacity-0"}`
|
|
12149
12286
|
}
|
|
12150
12287
|
),
|
|
12151
|
-
/* @__PURE__ */
|
|
12288
|
+
/* @__PURE__ */ jsx87(
|
|
12152
12289
|
"div",
|
|
12153
12290
|
{
|
|
12154
12291
|
className: `tabs-shadow-right pointer-events-none absolute right-0 top-0 z-10 h-full w-6 transition-opacity duration-200 ${hasRightShadow ? "opacity-100" : "opacity-0"}`
|
|
12155
12292
|
}
|
|
12156
12293
|
),
|
|
12157
|
-
/* @__PURE__ */
|
|
12294
|
+
/* @__PURE__ */ jsxs53(
|
|
12158
12295
|
"div",
|
|
12159
12296
|
{
|
|
12160
12297
|
ref: scrollRef,
|
|
12161
12298
|
onScroll: recomputeShadows,
|
|
12162
12299
|
className: "scrollbar-hide flex min-w-0 flex-1 items-center gap-1 overflow-x-auto [&::-webkit-scrollbar]:hidden",
|
|
12163
12300
|
children: [
|
|
12164
|
-
/* @__PURE__ */
|
|
12301
|
+
/* @__PURE__ */ jsx87(
|
|
12165
12302
|
DndContext2,
|
|
12166
12303
|
{
|
|
12167
12304
|
sensors,
|
|
@@ -12173,32 +12310,32 @@ var DatabrowserTabs = ({ onFullScreenClick }) => {
|
|
|
12173
12310
|
strategy: MeasuringStrategy.Always
|
|
12174
12311
|
}
|
|
12175
12312
|
},
|
|
12176
|
-
children: /* @__PURE__ */
|
|
12313
|
+
children: /* @__PURE__ */ jsx87(
|
|
12177
12314
|
SortableContext,
|
|
12178
12315
|
{
|
|
12179
12316
|
items: sortedTabs.map(([id]) => id),
|
|
12180
12317
|
strategy: horizontalListSortingStrategy,
|
|
12181
|
-
children: selectedTab && sortedTabs.map(([id]) => /* @__PURE__ */
|
|
12318
|
+
children: selectedTab && sortedTabs.map(([id]) => /* @__PURE__ */ jsx87(SortableTab, { id }, id))
|
|
12182
12319
|
}
|
|
12183
12320
|
)
|
|
12184
12321
|
}
|
|
12185
12322
|
),
|
|
12186
|
-
!isOverflow && /* @__PURE__ */
|
|
12323
|
+
!isOverflow && /* @__PURE__ */ jsx87("div", { className: "flex items-center gap-1 pl-1 pr-1", children: /* @__PURE__ */ jsx87(AddTabButton, {}) })
|
|
12187
12324
|
]
|
|
12188
12325
|
}
|
|
12189
12326
|
)
|
|
12190
12327
|
] }),
|
|
12191
|
-
/* @__PURE__ */
|
|
12192
|
-
isOverflow && /* @__PURE__ */
|
|
12193
|
-
tabs.length > 1 && /* @__PURE__ */
|
|
12194
|
-
onFullScreenClick && /* @__PURE__ */
|
|
12328
|
+
/* @__PURE__ */ jsxs53("div", { className: "flex items-center gap-1 px-1", children: [
|
|
12329
|
+
isOverflow && /* @__PURE__ */ jsx87(AddTabButton, {}),
|
|
12330
|
+
tabs.length > 1 && /* @__PURE__ */ jsx87(TabsListButton, { tabs, onSelectTab: selectTab }),
|
|
12331
|
+
onFullScreenClick && /* @__PURE__ */ jsx87(
|
|
12195
12332
|
Button,
|
|
12196
12333
|
{
|
|
12197
12334
|
"aria-label": "Toggle fullscreen",
|
|
12198
12335
|
variant: "secondary",
|
|
12199
12336
|
onClick: onFullScreenClick,
|
|
12200
12337
|
className: "h-[34px] w-[34px] flex-shrink-0 rounded-lg bg-white text-zinc-500 dark:bg-zinc-100",
|
|
12201
|
-
children: /* @__PURE__ */
|
|
12338
|
+
children: /* @__PURE__ */ jsx87(IconWindowMaximize, { size: 16 })
|
|
12202
12339
|
}
|
|
12203
12340
|
)
|
|
12204
12341
|
] })
|
|
@@ -12216,7 +12353,7 @@ function AddTabButton() {
|
|
|
12216
12353
|
tab.scrollIntoView({ behavior: "smooth" });
|
|
12217
12354
|
}, 20);
|
|
12218
12355
|
};
|
|
12219
|
-
return /* @__PURE__ */
|
|
12356
|
+
return /* @__PURE__ */ jsx87(
|
|
12220
12357
|
Button,
|
|
12221
12358
|
{
|
|
12222
12359
|
"aria-label": "Add new tab",
|
|
@@ -12224,7 +12361,7 @@ function AddTabButton() {
|
|
|
12224
12361
|
size: "icon-sm",
|
|
12225
12362
|
onClick: handleAddTab,
|
|
12226
12363
|
className: "flex-shrink-0 bg-zinc-200 ",
|
|
12227
|
-
children: /* @__PURE__ */
|
|
12364
|
+
children: /* @__PURE__ */ jsx87(IconPlus6, { className: "text-zinc-600", size: 16 })
|
|
12228
12365
|
}
|
|
12229
12366
|
);
|
|
12230
12367
|
}
|
|
@@ -12250,22 +12387,22 @@ function TabsListButton({
|
|
|
12250
12387
|
tab.scrollIntoView({ behavior: "smooth" });
|
|
12251
12388
|
}, 20);
|
|
12252
12389
|
};
|
|
12253
|
-
return /* @__PURE__ */
|
|
12254
|
-
/* @__PURE__ */
|
|
12390
|
+
return /* @__PURE__ */ jsxs53(Popover, { open, onOpenChange: setOpen, children: [
|
|
12391
|
+
/* @__PURE__ */ jsx87(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs53(
|
|
12255
12392
|
Button,
|
|
12256
12393
|
{
|
|
12257
12394
|
variant: "secondary",
|
|
12258
12395
|
className: "h-[34px] gap-1 rounded-lg bg-white px-2",
|
|
12259
12396
|
"aria-label": "Search in tabs",
|
|
12260
12397
|
children: [
|
|
12261
|
-
/* @__PURE__ */
|
|
12262
|
-
/* @__PURE__ */
|
|
12398
|
+
/* @__PURE__ */ jsx87("span", { className: "text-xs text-zinc-600", children: tabs.length }),
|
|
12399
|
+
/* @__PURE__ */ jsx87(IconChevronDown3, { className: "text-zinc-500", size: 16 })
|
|
12263
12400
|
]
|
|
12264
12401
|
}
|
|
12265
12402
|
) }),
|
|
12266
|
-
/* @__PURE__ */
|
|
12267
|
-
/* @__PURE__ */
|
|
12268
|
-
/* @__PURE__ */
|
|
12403
|
+
/* @__PURE__ */ jsx87(PopoverContent, { className: "w-96 p-0", align: "end", children: /* @__PURE__ */ jsx87(Command, { children: /* @__PURE__ */ jsxs53(CommandList, { children: [
|
|
12404
|
+
/* @__PURE__ */ jsx87(CommandEmpty, { children: "No tabs" }),
|
|
12405
|
+
/* @__PURE__ */ jsx87(CommandGroup, { children: sorted.map(([_id, item]) => /* @__PURE__ */ jsx87(
|
|
12269
12406
|
CommandItem,
|
|
12270
12407
|
{
|
|
12271
12408
|
style: {
|
|
@@ -12275,7 +12412,7 @@ function TabsListButton({
|
|
|
12275
12412
|
onSelect: () => {
|
|
12276
12413
|
handleSelectTab(item.id);
|
|
12277
12414
|
},
|
|
12278
|
-
children: /* @__PURE__ */
|
|
12415
|
+
children: /* @__PURE__ */ jsx87(TabIdProvider, { value: _id, children: /* @__PURE__ */ jsx87(Tab, { id: _id, isList: true }) })
|
|
12279
12416
|
},
|
|
12280
12417
|
item.id
|
|
12281
12418
|
)) })
|
|
@@ -12284,7 +12421,7 @@ function TabsListButton({
|
|
|
12284
12421
|
}
|
|
12285
12422
|
|
|
12286
12423
|
// src/components/databrowser/index.tsx
|
|
12287
|
-
import { jsx as
|
|
12424
|
+
import { jsx as jsx88, jsxs as jsxs54 } from "react/jsx-runtime";
|
|
12288
12425
|
var RedisBrowser = ({
|
|
12289
12426
|
url,
|
|
12290
12427
|
token,
|
|
@@ -12302,7 +12439,7 @@ var RedisBrowser = ({
|
|
|
12302
12439
|
useEffect26(() => {
|
|
12303
12440
|
queryClient.resetQueries();
|
|
12304
12441
|
}, [credentials.url]);
|
|
12305
|
-
return /* @__PURE__ */
|
|
12442
|
+
return /* @__PURE__ */ jsx88(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx88(RedisProvider, { redisCredentials: credentials, telemetry: !disableTelemetry, children: /* @__PURE__ */ jsx88(DarkModeProvider, { theme, children: /* @__PURE__ */ jsx88(DatabrowserProvider, { storage, rootRef, children: /* @__PURE__ */ jsx88(QueryWizardProvider, { value: useQueryWizard, children: /* @__PURE__ */ jsx88(TooltipProvider, { children: /* @__PURE__ */ jsx88(
|
|
12306
12443
|
RedisBrowserRoot,
|
|
12307
12444
|
{
|
|
12308
12445
|
allowSearch,
|
|
@@ -12327,15 +12464,15 @@ var RedisBrowserRoot = ({
|
|
|
12327
12464
|
}, [theme]);
|
|
12328
12465
|
return (
|
|
12329
12466
|
/* ups-db is the custom class used to prefix every style in the css bundle */
|
|
12330
|
-
/* @__PURE__ */
|
|
12467
|
+
/* @__PURE__ */ jsx88(
|
|
12331
12468
|
"div",
|
|
12332
12469
|
{
|
|
12333
12470
|
className: `ups-db ${theme === "dark" ? "dark" : ""}`,
|
|
12334
12471
|
style: { height: "100%" },
|
|
12335
12472
|
ref: rootRef,
|
|
12336
|
-
children: /* @__PURE__ */
|
|
12337
|
-
!hideTabs && /* @__PURE__ */
|
|
12338
|
-
/* @__PURE__ */
|
|
12473
|
+
children: /* @__PURE__ */ jsxs54("div", { className: "flex h-full flex-col rounded-[14px] border-[4px] border-zinc-300 text-zinc-700", children: [
|
|
12474
|
+
!hideTabs && /* @__PURE__ */ jsx88(DatabrowserTabs, { onFullScreenClick }),
|
|
12475
|
+
/* @__PURE__ */ jsx88(DatabrowserInstances, { tabType, allowSearch })
|
|
12339
12476
|
] })
|
|
12340
12477
|
}
|
|
12341
12478
|
)
|
|
@@ -12351,7 +12488,7 @@ var DatabrowserInstances = ({
|
|
|
12351
12488
|
else if (!selectedTab) selectTab(tabs[0][0]);
|
|
12352
12489
|
}, [tabs, selectedTab, addTab, selectTab]);
|
|
12353
12490
|
if (!selectedTab) return;
|
|
12354
|
-
return tabs.map(([id]) => /* @__PURE__ */
|
|
12491
|
+
return tabs.map(([id]) => /* @__PURE__ */ jsx88(TabIdProvider, { value: id, children: /* @__PURE__ */ jsx88(
|
|
12355
12492
|
DatabrowserInstance,
|
|
12356
12493
|
{
|
|
12357
12494
|
hidden: id !== selectedTab,
|