@upstash/react-redis-browser 0.2.14 → 0.2.16
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 +277 -110
- package/dist/index.mjs +924 -757
- 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",
|
|
@@ -4184,10 +4207,14 @@ function parseFieldBuilder(str, fieldName) {
|
|
|
4184
4207
|
};
|
|
4185
4208
|
}
|
|
4186
4209
|
if (str.startsWith("s.keyword()")) {
|
|
4187
|
-
|
|
4210
|
+
const fromValue = extractFromValue(str);
|
|
4211
|
+
if (fromValue === void 0) return "KEYWORD";
|
|
4212
|
+
return { type: "KEYWORD", from: fromValue };
|
|
4188
4213
|
}
|
|
4189
4214
|
if (str.startsWith("s.facet()")) {
|
|
4190
|
-
|
|
4215
|
+
const fromValue = extractFromValue(str);
|
|
4216
|
+
if (fromValue === void 0) return "FACET";
|
|
4217
|
+
return { type: "FACET", from: fromValue };
|
|
4191
4218
|
}
|
|
4192
4219
|
if (str.startsWith("s.")) {
|
|
4193
4220
|
const typeMatch = str.match(/^s\.(\w+)\(/);
|
|
@@ -4480,6 +4507,18 @@ var useAddKey = () => {
|
|
|
4480
4507
|
|
|
4481
4508
|
// src/components/databrowser/hooks/use-debounce.ts
|
|
4482
4509
|
import { useEffect as useEffect3, useState as useState3 } from "react";
|
|
4510
|
+
function useDebounce(value, delay) {
|
|
4511
|
+
const [debouncedValue, setDebouncedValue] = useState3(value);
|
|
4512
|
+
useEffect3(() => {
|
|
4513
|
+
const handler = setTimeout(() => {
|
|
4514
|
+
setDebouncedValue(value);
|
|
4515
|
+
}, delay);
|
|
4516
|
+
return () => {
|
|
4517
|
+
clearTimeout(handler);
|
|
4518
|
+
};
|
|
4519
|
+
}, [value, delay]);
|
|
4520
|
+
return debouncedValue;
|
|
4521
|
+
}
|
|
4483
4522
|
|
|
4484
4523
|
// src/components/databrowser/hooks/use-delete-key.ts
|
|
4485
4524
|
import { useMutation as useMutation3 } from "@tanstack/react-query";
|
|
@@ -4488,12 +4527,12 @@ import { useMutation as useMutation3 } from "@tanstack/react-query";
|
|
|
4488
4527
|
import { useCallback } from "react";
|
|
4489
4528
|
|
|
4490
4529
|
// src/components/databrowser/hooks/use-fetch-list-items.tsx
|
|
4491
|
-
import { useInfiniteQuery as
|
|
4530
|
+
import { useInfiniteQuery as useInfiniteQuery3 } from "@tanstack/react-query";
|
|
4492
4531
|
var LIST_DISPLAY_PAGE_SIZE = 50;
|
|
4493
4532
|
var FETCH_LIST_ITEMS_QUERY_KEY = "use-fetch-list-items";
|
|
4494
4533
|
var useFetchListItems = ({ dataKey, type }) => {
|
|
4495
4534
|
const { redisNoPipeline: redis } = useRedis();
|
|
4496
|
-
const setQuery =
|
|
4535
|
+
const setQuery = useInfiniteQuery3({
|
|
4497
4536
|
enabled: type === "set",
|
|
4498
4537
|
queryKey: [FETCH_LIST_ITEMS_QUERY_KEY, dataKey, "set"],
|
|
4499
4538
|
initialPageParam: "0",
|
|
@@ -4508,7 +4547,7 @@ var useFetchListItems = ({ dataKey, type }) => {
|
|
|
4508
4547
|
},
|
|
4509
4548
|
getNextPageParam: ({ cursor }) => cursor
|
|
4510
4549
|
});
|
|
4511
|
-
const zsetQuery =
|
|
4550
|
+
const zsetQuery = useInfiniteQuery3({
|
|
4512
4551
|
enabled: type === "zset",
|
|
4513
4552
|
queryKey: [FETCH_LIST_ITEMS_QUERY_KEY, dataKey, "zset"],
|
|
4514
4553
|
initialPageParam: 0,
|
|
@@ -4526,7 +4565,7 @@ var useFetchListItems = ({ dataKey, type }) => {
|
|
|
4526
4565
|
},
|
|
4527
4566
|
getNextPageParam: ({ cursor }) => cursor
|
|
4528
4567
|
});
|
|
4529
|
-
const hashQuery =
|
|
4568
|
+
const hashQuery = useInfiniteQuery3({
|
|
4530
4569
|
enabled: type === "hash",
|
|
4531
4570
|
queryKey: [FETCH_LIST_ITEMS_QUERY_KEY, dataKey, "hash"],
|
|
4532
4571
|
initialPageParam: "0",
|
|
@@ -4541,7 +4580,7 @@ var useFetchListItems = ({ dataKey, type }) => {
|
|
|
4541
4580
|
},
|
|
4542
4581
|
getNextPageParam: ({ cursor }) => cursor
|
|
4543
4582
|
});
|
|
4544
|
-
const listQuery =
|
|
4583
|
+
const listQuery = useInfiniteQuery3({
|
|
4545
4584
|
enabled: type === "list",
|
|
4546
4585
|
queryKey: [FETCH_LIST_ITEMS_QUERY_KEY, dataKey, "list"],
|
|
4547
4586
|
initialPageParam: 0,
|
|
@@ -4559,7 +4598,7 @@ var useFetchListItems = ({ dataKey, type }) => {
|
|
|
4559
4598
|
},
|
|
4560
4599
|
getNextPageParam: ({ cursor }) => cursor
|
|
4561
4600
|
});
|
|
4562
|
-
const streamQuery =
|
|
4601
|
+
const streamQuery = useInfiniteQuery3({
|
|
4563
4602
|
enabled: type === "stream",
|
|
4564
4603
|
queryKey: [FETCH_LIST_ITEMS_QUERY_KEY, dataKey, "stream"],
|
|
4565
4604
|
initialPageParam: "-",
|
|
@@ -4604,11 +4643,11 @@ function transformArray(inputArray) {
|
|
|
4604
4643
|
}
|
|
4605
4644
|
|
|
4606
4645
|
// src/components/databrowser/hooks/use-fetch-simple-key.tsx
|
|
4607
|
-
import { useQuery as
|
|
4646
|
+
import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
4608
4647
|
var FETCH_SIMPLE_KEY_QUERY_KEY = "fetch-simple-key";
|
|
4609
4648
|
var useFetchSimpleKey = (dataKey, type) => {
|
|
4610
4649
|
const { redisNoPipeline: redis } = useRedis();
|
|
4611
|
-
return
|
|
4650
|
+
return useQuery3({
|
|
4612
4651
|
queryKey: [FETCH_SIMPLE_KEY_QUERY_KEY, dataKey],
|
|
4613
4652
|
queryFn: async () => {
|
|
4614
4653
|
let result;
|
|
@@ -4746,7 +4785,7 @@ var useEditListItem = () => {
|
|
|
4746
4785
|
}
|
|
4747
4786
|
case "stream": {
|
|
4748
4787
|
if (!isNew || !newKey) throw new Error("Stream data type is not mutable");
|
|
4749
|
-
const opts = transformArray(newValue?.split("\n") ?? []).map(
|
|
4788
|
+
const opts = transformArray((newValue?.split("\n") ?? []).filter(Boolean)).map(
|
|
4750
4789
|
({ key, value }) => [key, value]
|
|
4751
4790
|
);
|
|
4752
4791
|
pipe.xadd(dataKey, newKey, Object.fromEntries(opts));
|
|
@@ -4768,7 +4807,7 @@ var useEditListItem = () => {
|
|
|
4768
4807
|
|
|
4769
4808
|
// src/components/databrowser/hooks/use-fetch-ttl.ts
|
|
4770
4809
|
import { useEffect as useEffect6 } from "react";
|
|
4771
|
-
import { useQuery as
|
|
4810
|
+
import { useQuery as useQuery4 } from "@tanstack/react-query";
|
|
4772
4811
|
|
|
4773
4812
|
// src/components/databrowser/components/display/ttl-badge.tsx
|
|
4774
4813
|
import { useEffect as useEffect5, useState as useState5 } from "react";
|
|
@@ -4939,7 +4978,7 @@ var TTLBadge = ({
|
|
|
4939
4978
|
var FETCH_TTL_QUERY_KEY = "fetch-ttl";
|
|
4940
4979
|
var useFetchTTL = (dataKey) => {
|
|
4941
4980
|
const { redis } = useRedis();
|
|
4942
|
-
const { isLoading, error, data } =
|
|
4981
|
+
const { isLoading, error, data } = useQuery4({
|
|
4943
4982
|
queryKey: [FETCH_TTL_QUERY_KEY, dataKey],
|
|
4944
4983
|
queryFn: async () => {
|
|
4945
4984
|
const ttl = await redis.ttl(dataKey);
|
|
@@ -5000,11 +5039,11 @@ var useSetTTL = () => {
|
|
|
5000
5039
|
};
|
|
5001
5040
|
|
|
5002
5041
|
// src/components/databrowser/hooks/use-fetch-key-length.ts
|
|
5003
|
-
import { useQuery as
|
|
5042
|
+
import { useQuery as useQuery5 } from "@tanstack/react-query";
|
|
5004
5043
|
var FETCH_KEY_LENGTH_QUERY_KEY = "fetch-key-length";
|
|
5005
5044
|
var useFetchKeyLength = ({ dataKey, type }) => {
|
|
5006
5045
|
const { redis } = useRedis();
|
|
5007
|
-
return
|
|
5046
|
+
return useQuery5({
|
|
5008
5047
|
queryKey: [FETCH_KEY_LENGTH_QUERY_KEY, dataKey],
|
|
5009
5048
|
queryFn: async () => {
|
|
5010
5049
|
switch (type) {
|
|
@@ -5033,11 +5072,11 @@ var useFetchKeyLength = ({ dataKey, type }) => {
|
|
|
5033
5072
|
};
|
|
5034
5073
|
|
|
5035
5074
|
// src/components/databrowser/hooks/use-fetch-key-size.ts
|
|
5036
|
-
import { useQuery as
|
|
5075
|
+
import { useQuery as useQuery6 } from "@tanstack/react-query";
|
|
5037
5076
|
var FETCH_KEY_SIZE_QUERY_KEY = "fetch-key-size";
|
|
5038
5077
|
var useFetchKeySize = (dataKey) => {
|
|
5039
5078
|
const { redis } = useRedis();
|
|
5040
|
-
return
|
|
5079
|
+
return useQuery6({
|
|
5041
5080
|
queryKey: [FETCH_KEY_SIZE_QUERY_KEY, dataKey],
|
|
5042
5081
|
queryFn: async () => {
|
|
5043
5082
|
return await redis.exec(["MEMORY", "USAGE", dataKey]);
|
|
@@ -5079,7 +5118,7 @@ var Badge = ({ children, label }) => /* @__PURE__ */ jsxs9("div", { className: "
|
|
|
5079
5118
|
/* @__PURE__ */ jsx22("span", { className: "font-medium", children })
|
|
5080
5119
|
] });
|
|
5081
5120
|
|
|
5082
|
-
// src/components/databrowser/components/display/
|
|
5121
|
+
// src/components/databrowser/components/display/item-actions.tsx
|
|
5083
5122
|
import { IconDotsVertical } from "@tabler/icons-react";
|
|
5084
5123
|
|
|
5085
5124
|
// src/components/ui/dropdown-menu.tsx
|
|
@@ -5331,7 +5370,7 @@ var Switch = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
|
|
|
5331
5370
|
Switch.displayName = SwitchPrimitives.Root.displayName;
|
|
5332
5371
|
|
|
5333
5372
|
// src/components/databrowser/components/delete-key-modal.tsx
|
|
5334
|
-
import { jsx as jsx26, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
5373
|
+
import { Fragment as Fragment3, jsx as jsx26, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
5335
5374
|
function DeleteKeyModal({
|
|
5336
5375
|
children,
|
|
5337
5376
|
onDeleteConfirm,
|
|
@@ -5339,7 +5378,9 @@ function DeleteKeyModal({
|
|
|
5339
5378
|
onOpenChange,
|
|
5340
5379
|
deletionType,
|
|
5341
5380
|
count: count2 = 1,
|
|
5342
|
-
showReindex
|
|
5381
|
+
showReindex,
|
|
5382
|
+
name,
|
|
5383
|
+
nameLabel
|
|
5343
5384
|
}) {
|
|
5344
5385
|
const isPlural = count2 > 1;
|
|
5345
5386
|
const itemLabel = deletionType === "item" ? "Item" : "Key";
|
|
@@ -5358,7 +5399,10 @@ function DeleteKeyModal({
|
|
|
5358
5399
|
/* @__PURE__ */ jsxs12(DialogDescription, { className: "mt-5", children: [
|
|
5359
5400
|
"Are you sure you want to delete",
|
|
5360
5401
|
" ",
|
|
5361
|
-
|
|
5402
|
+
name ? /* @__PURE__ */ jsxs12(Fragment3, { children: [
|
|
5403
|
+
`${nameLabel ?? deletionType} `,
|
|
5404
|
+
/* @__PURE__ */ jsx26("span", { className: "font-medium text-zinc-900 dark:text-zinc-100", children: nameLabel ? name : `"${name}"` })
|
|
5405
|
+
] }) : isPlural ? `these ${count2} ${deletionType}s` : `this ${deletionType}`,
|
|
5362
5406
|
"?",
|
|
5363
5407
|
/* @__PURE__ */ jsx26("br", {}),
|
|
5364
5408
|
"This action cannot be undone."
|
|
@@ -5409,8 +5453,51 @@ function DeleteKeyModal({
|
|
|
5409
5453
|
] });
|
|
5410
5454
|
}
|
|
5411
5455
|
|
|
5412
|
-
// src/components/databrowser/components/display/
|
|
5456
|
+
// src/components/databrowser/components/display/item-actions.tsx
|
|
5413
5457
|
import { jsx as jsx27, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
5458
|
+
function ItemActions({ dataKey, type }) {
|
|
5459
|
+
const { selectedListItem, setSelectedListItem } = useTab();
|
|
5460
|
+
const { mutateAsync: editItem } = useEditListItem();
|
|
5461
|
+
if (!selectedListItem) return;
|
|
5462
|
+
return /* @__PURE__ */ jsxs13(DropdownMenu, { modal: false, children: [
|
|
5463
|
+
/* @__PURE__ */ jsx27(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx27(Button, { size: "icon-sm", "aria-label": "Item actions", children: /* @__PURE__ */ jsx27(
|
|
5464
|
+
IconDotsVertical,
|
|
5465
|
+
{
|
|
5466
|
+
className: "size-4 text-zinc-500 dark:text-zinc-600",
|
|
5467
|
+
fill: "rgb(var(--color-zinc-500))"
|
|
5468
|
+
}
|
|
5469
|
+
) }) }),
|
|
5470
|
+
/* @__PURE__ */ jsx27(DropdownMenuContent, { align: "end", children: /* @__PURE__ */ jsx27(
|
|
5471
|
+
DeleteKeyModal,
|
|
5472
|
+
{
|
|
5473
|
+
deletionType: "item",
|
|
5474
|
+
name: selectedListItem.key,
|
|
5475
|
+
nameLabel: type === "list" ? "item at index" : void 0,
|
|
5476
|
+
onDeleteConfirm: async () => {
|
|
5477
|
+
await editItem({
|
|
5478
|
+
type,
|
|
5479
|
+
dataKey,
|
|
5480
|
+
itemKey: selectedListItem.key,
|
|
5481
|
+
newKey: void 0
|
|
5482
|
+
});
|
|
5483
|
+
setSelectedListItem(void 0);
|
|
5484
|
+
},
|
|
5485
|
+
children: /* @__PURE__ */ jsx27(
|
|
5486
|
+
DropdownMenuItem,
|
|
5487
|
+
{
|
|
5488
|
+
className: "text-red-500 focus:bg-red-500 focus:text-white",
|
|
5489
|
+
onSelect: (e) => e.preventDefault(),
|
|
5490
|
+
children: "Delete item"
|
|
5491
|
+
}
|
|
5492
|
+
)
|
|
5493
|
+
}
|
|
5494
|
+
) })
|
|
5495
|
+
] });
|
|
5496
|
+
}
|
|
5497
|
+
|
|
5498
|
+
// src/components/databrowser/components/display/key-actions.tsx
|
|
5499
|
+
import { IconDotsVertical as IconDotsVertical2 } from "@tabler/icons-react";
|
|
5500
|
+
import { jsx as jsx28, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
5414
5501
|
function KeyActions({
|
|
5415
5502
|
dataKey,
|
|
5416
5503
|
content,
|
|
@@ -5418,16 +5505,16 @@ function KeyActions({
|
|
|
5418
5505
|
}) {
|
|
5419
5506
|
const { mutateAsync: deleteKey } = useDeleteKey();
|
|
5420
5507
|
const { isValuesSearchSelected } = useTab();
|
|
5421
|
-
return /* @__PURE__ */
|
|
5422
|
-
/* @__PURE__ */
|
|
5423
|
-
|
|
5508
|
+
return /* @__PURE__ */ jsxs14(DropdownMenu, { modal: false, children: [
|
|
5509
|
+
/* @__PURE__ */ jsx28(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx28(Button, { size: "icon-sm", "aria-label": "Key actions", children: /* @__PURE__ */ jsx28(
|
|
5510
|
+
IconDotsVertical2,
|
|
5424
5511
|
{
|
|
5425
5512
|
className: "size-4 text-zinc-500 dark:text-zinc-600",
|
|
5426
5513
|
fill: "rgb(var(--color-zinc-500))"
|
|
5427
5514
|
}
|
|
5428
5515
|
) }) }),
|
|
5429
|
-
/* @__PURE__ */
|
|
5430
|
-
content && /* @__PURE__ */
|
|
5516
|
+
/* @__PURE__ */ jsxs14(DropdownMenuContent, { className: "", align: "end", children: [
|
|
5517
|
+
content && /* @__PURE__ */ jsx28(
|
|
5431
5518
|
DropdownMenuItem,
|
|
5432
5519
|
{
|
|
5433
5520
|
onClick: () => {
|
|
@@ -5439,7 +5526,7 @@ function KeyActions({
|
|
|
5439
5526
|
children: "Copy content"
|
|
5440
5527
|
}
|
|
5441
5528
|
),
|
|
5442
|
-
/* @__PURE__ */
|
|
5529
|
+
/* @__PURE__ */ jsx28(
|
|
5443
5530
|
DropdownMenuItem,
|
|
5444
5531
|
{
|
|
5445
5532
|
onClick: () => {
|
|
@@ -5448,15 +5535,16 @@ function KeyActions({
|
|
|
5448
5535
|
children: "Copy key"
|
|
5449
5536
|
}
|
|
5450
5537
|
),
|
|
5451
|
-
/* @__PURE__ */
|
|
5538
|
+
/* @__PURE__ */ jsx28(
|
|
5452
5539
|
DeleteKeyModal,
|
|
5453
5540
|
{
|
|
5454
5541
|
deletionType: "key",
|
|
5542
|
+
name: dataKey,
|
|
5455
5543
|
showReindex: isValuesSearchSelected && type !== "search",
|
|
5456
5544
|
onDeleteConfirm: async (_e, options) => {
|
|
5457
5545
|
await deleteKey({ keys: [dataKey], reindex: options?.reindex });
|
|
5458
5546
|
},
|
|
5459
|
-
children: /* @__PURE__ */
|
|
5547
|
+
children: /* @__PURE__ */ jsx28(
|
|
5460
5548
|
DropdownMenuItem,
|
|
5461
5549
|
{
|
|
5462
5550
|
className: "text-red-500 focus:bg-red-500 focus:text-white",
|
|
@@ -5471,45 +5559,47 @@ function KeyActions({
|
|
|
5471
5559
|
}
|
|
5472
5560
|
|
|
5473
5561
|
// src/components/databrowser/components/display/display-header.tsx
|
|
5474
|
-
import { jsx as
|
|
5562
|
+
import { jsx as jsx29, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
5475
5563
|
var DisplayHeader = ({
|
|
5476
5564
|
dataKey,
|
|
5477
5565
|
type,
|
|
5478
5566
|
content,
|
|
5479
5567
|
hideTypeTag
|
|
5480
5568
|
}) => {
|
|
5481
|
-
const { setSelectedListItem } = useTab();
|
|
5569
|
+
const { setSelectedListItem, selectedListItem } = useTab();
|
|
5570
|
+
const isListType = type !== "string" && type !== "json" && type !== "search" && type !== "stream";
|
|
5571
|
+
const showItemActions = isListType && Boolean(selectedListItem);
|
|
5482
5572
|
const handleAddItem = () => {
|
|
5483
5573
|
setSelectedListItem({ key: type === "stream" ? "*" : "", isNew: true });
|
|
5484
5574
|
};
|
|
5485
|
-
return /* @__PURE__ */
|
|
5486
|
-
/* @__PURE__ */
|
|
5487
|
-
/* @__PURE__ */
|
|
5488
|
-
/* @__PURE__ */
|
|
5489
|
-
type !== "string" && type !== "json" && type !== "search" && /* @__PURE__ */
|
|
5490
|
-
/* @__PURE__ */
|
|
5575
|
+
return /* @__PURE__ */ jsxs15("div", { className: "rounded-lg", children: [
|
|
5576
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex h-[26px] items-center justify-between gap-4", children: [
|
|
5577
|
+
/* @__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 }) }),
|
|
5578
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-1", children: [
|
|
5579
|
+
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" }) }) }),
|
|
5580
|
+
showItemActions ? /* @__PURE__ */ jsx29(ItemActions, { dataKey, type }) : selectedListItem ? void 0 : /* @__PURE__ */ jsx29(KeyActions, { dataKey, content, type })
|
|
5491
5581
|
] })
|
|
5492
5582
|
] }),
|
|
5493
|
-
type === "search" && hideTypeTag ? void 0 : /* @__PURE__ */
|
|
5494
|
-
!hideTypeTag && /* @__PURE__ */
|
|
5495
|
-
type !== "search" && /* @__PURE__ */
|
|
5496
|
-
type !== "search" && /* @__PURE__ */
|
|
5497
|
-
type !== "search" && /* @__PURE__ */
|
|
5583
|
+
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: [
|
|
5584
|
+
!hideTypeTag && /* @__PURE__ */ jsx29(TypeTag, { variant: type, type: "badge" }),
|
|
5585
|
+
type !== "search" && /* @__PURE__ */ jsx29(SizeBadge, { dataKey }),
|
|
5586
|
+
type !== "search" && /* @__PURE__ */ jsx29(LengthBadge, { dataKey, type, content }),
|
|
5587
|
+
type !== "search" && /* @__PURE__ */ jsx29(HeaderTTLBadge, { dataKey })
|
|
5498
5588
|
] }) })
|
|
5499
5589
|
] });
|
|
5500
5590
|
};
|
|
5501
5591
|
|
|
5502
5592
|
// src/components/databrowser/components/display/key-deleted.tsx
|
|
5503
|
-
import { jsx as
|
|
5593
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
5504
5594
|
var KeyDeleted = () => {
|
|
5505
|
-
return /* @__PURE__ */
|
|
5595
|
+
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
5596
|
};
|
|
5507
5597
|
|
|
5508
5598
|
// src/components/databrowser/components/docs-link.tsx
|
|
5509
5599
|
import { IconExternalLink } from "@tabler/icons-react";
|
|
5510
|
-
import { jsx as
|
|
5600
|
+
import { jsx as jsx31, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
5511
5601
|
var DocsLink = ({ href, className }) => {
|
|
5512
|
-
return /* @__PURE__ */
|
|
5602
|
+
return /* @__PURE__ */ jsxs16(
|
|
5513
5603
|
"a",
|
|
5514
5604
|
{
|
|
5515
5605
|
href,
|
|
@@ -5521,7 +5611,7 @@ var DocsLink = ({ href, className }) => {
|
|
|
5521
5611
|
),
|
|
5522
5612
|
children: [
|
|
5523
5613
|
"Docs",
|
|
5524
|
-
/* @__PURE__ */
|
|
5614
|
+
/* @__PURE__ */ jsx31(IconExternalLink, { size: 12 })
|
|
5525
5615
|
]
|
|
5526
5616
|
}
|
|
5527
5617
|
);
|
|
@@ -5533,8 +5623,8 @@ import { useEffect as useEffect7, useState as useState7 } from "react";
|
|
|
5533
5623
|
// src/components/ui/progress.tsx
|
|
5534
5624
|
import * as React13 from "react";
|
|
5535
5625
|
import * as ProgressPrimitive from "@radix-ui/react-progress";
|
|
5536
|
-
import { jsx as
|
|
5537
|
-
var Progress = React13.forwardRef(({ className, value, ...props }, ref) => /* @__PURE__ */
|
|
5626
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
5627
|
+
var Progress = React13.forwardRef(({ className, value, ...props }, ref) => /* @__PURE__ */ jsx32(
|
|
5538
5628
|
ProgressPrimitive.Root,
|
|
5539
5629
|
{
|
|
5540
5630
|
ref,
|
|
@@ -5543,7 +5633,7 @@ var Progress = React13.forwardRef(({ className, value, ...props }, ref) => /* @_
|
|
|
5543
5633
|
className
|
|
5544
5634
|
),
|
|
5545
5635
|
...props,
|
|
5546
|
-
children: /* @__PURE__ */
|
|
5636
|
+
children: /* @__PURE__ */ jsx32(
|
|
5547
5637
|
ProgressPrimitive.Indicator,
|
|
5548
5638
|
{
|
|
5549
5639
|
className: "h-full w-full flex-1 bg-neutral-900 transition-all dark:bg-neutral-50",
|
|
@@ -5555,7 +5645,7 @@ var Progress = React13.forwardRef(({ className, value, ...props }, ref) => /* @_
|
|
|
5555
5645
|
Progress.displayName = ProgressPrimitive.Root.displayName;
|
|
5556
5646
|
|
|
5557
5647
|
// src/components/databrowser/components/search/save-schema-modal.tsx
|
|
5558
|
-
import { Fragment as
|
|
5648
|
+
import { Fragment as Fragment4, jsx as jsx33, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
5559
5649
|
var SaveSchemaModal = ({
|
|
5560
5650
|
values,
|
|
5561
5651
|
onClose
|
|
@@ -5611,14 +5701,14 @@ var SaveSchemaModal = ({
|
|
|
5611
5701
|
}
|
|
5612
5702
|
};
|
|
5613
5703
|
const isRunning = status !== void 0;
|
|
5614
|
-
return /* @__PURE__ */
|
|
5704
|
+
return /* @__PURE__ */ jsx33(
|
|
5615
5705
|
Dialog,
|
|
5616
5706
|
{
|
|
5617
5707
|
open: values !== void 0,
|
|
5618
5708
|
onOpenChange: (open) => {
|
|
5619
5709
|
if (!open && !isRunning) onClose();
|
|
5620
5710
|
},
|
|
5621
|
-
children: /* @__PURE__ */
|
|
5711
|
+
children: /* @__PURE__ */ jsxs17(
|
|
5622
5712
|
DialogContent,
|
|
5623
5713
|
{
|
|
5624
5714
|
onInteractOutside: (e) => {
|
|
@@ -5628,26 +5718,26 @@ var SaveSchemaModal = ({
|
|
|
5628
5718
|
if (isRunning) e.preventDefault();
|
|
5629
5719
|
},
|
|
5630
5720
|
children: [
|
|
5631
|
-
/* @__PURE__ */
|
|
5632
|
-
/* @__PURE__ */
|
|
5633
|
-
!isRunning && !error && /* @__PURE__ */
|
|
5721
|
+
/* @__PURE__ */ jsxs17(DialogHeader, { children: [
|
|
5722
|
+
/* @__PURE__ */ jsx33(DialogTitle, { children: "Save Schema Changes" }),
|
|
5723
|
+
!isRunning && !error && /* @__PURE__ */ jsxs17(DialogDescription, { children: [
|
|
5634
5724
|
"Saving will drop and recreate the index. This will temporarily make the index unavailable.",
|
|
5635
|
-
/* @__PURE__ */
|
|
5636
|
-
/* @__PURE__ */
|
|
5725
|
+
/* @__PURE__ */ jsx33("br", {}),
|
|
5726
|
+
/* @__PURE__ */ jsx33("br", {}),
|
|
5637
5727
|
"Are you sure you want to continue?"
|
|
5638
5728
|
] })
|
|
5639
5729
|
] }),
|
|
5640
|
-
isRunning && /* @__PURE__ */
|
|
5641
|
-
/* @__PURE__ */
|
|
5642
|
-
/* @__PURE__ */
|
|
5730
|
+
isRunning && /* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-2 py-4", children: [
|
|
5731
|
+
/* @__PURE__ */ jsx33("p", { className: "text-sm text-zinc-500", children: status }),
|
|
5732
|
+
/* @__PURE__ */ jsx33(Progress, { value: progress })
|
|
5643
5733
|
] }),
|
|
5644
|
-
error && /* @__PURE__ */
|
|
5645
|
-
/* @__PURE__ */
|
|
5646
|
-
!isRunning && !error && /* @__PURE__ */
|
|
5647
|
-
/* @__PURE__ */
|
|
5648
|
-
/* @__PURE__ */
|
|
5734
|
+
error && /* @__PURE__ */ jsx33("div", { className: "w-full break-words text-sm text-red-500", children: formatUpstashErrorMessage(error) }),
|
|
5735
|
+
/* @__PURE__ */ jsxs17(DialogFooter, { children: [
|
|
5736
|
+
!isRunning && !error && /* @__PURE__ */ jsxs17(Fragment4, { children: [
|
|
5737
|
+
/* @__PURE__ */ jsx33(Button, { onClick: onClose, children: "Cancel" }),
|
|
5738
|
+
/* @__PURE__ */ jsx33(Button, { variant: "primary", onClick: handleConfirm, children: "Confirm" })
|
|
5649
5739
|
] }),
|
|
5650
|
-
error && /* @__PURE__ */
|
|
5740
|
+
error && /* @__PURE__ */ jsx33(Button, { onClick: onClose, children: "Close" })
|
|
5651
5741
|
] })
|
|
5652
5742
|
]
|
|
5653
5743
|
}
|
|
@@ -5662,11 +5752,11 @@ import { useMemo as useMemo6 } from "react";
|
|
|
5662
5752
|
// src/components/common/editor-with-types.tsx
|
|
5663
5753
|
import { useEffect as useEffect8, useRef as useRef2 } from "react";
|
|
5664
5754
|
import { Editor, useMonaco } from "@monaco-editor/react";
|
|
5665
|
-
import { jsx as
|
|
5755
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
5666
5756
|
var EditorWithTypes = (props) => {
|
|
5667
|
-
return isTest ? /* @__PURE__ */
|
|
5757
|
+
return isTest ? /* @__PURE__ */ jsx34(TestEditor, { ...props }) : /* @__PURE__ */ jsx34(MonacoEditorWithTypes, { ...props });
|
|
5668
5758
|
};
|
|
5669
|
-
var LoadingSpinner = () => /* @__PURE__ */
|
|
5759
|
+
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
5760
|
var MonacoEditorWithTypes = ({
|
|
5671
5761
|
value,
|
|
5672
5762
|
onChange,
|
|
@@ -5719,16 +5809,16 @@ var MonacoEditorWithTypes = ({
|
|
|
5719
5809
|
useEffect8(() => {
|
|
5720
5810
|
if (!validateValue(value)) onChange(defaultValue);
|
|
5721
5811
|
}, [value, onChange, validateValue, defaultValue]);
|
|
5722
|
-
return /* @__PURE__ */
|
|
5812
|
+
return /* @__PURE__ */ jsx34(
|
|
5723
5813
|
"div",
|
|
5724
5814
|
{
|
|
5725
5815
|
className: cn("group/editor relative", height === void 0 && "h-full"),
|
|
5726
5816
|
style: { height },
|
|
5727
|
-
children: /* @__PURE__ */
|
|
5817
|
+
children: /* @__PURE__ */ jsx34(
|
|
5728
5818
|
Editor,
|
|
5729
5819
|
{
|
|
5730
5820
|
theme: theme === "dark" ? "vs-dark" : "light",
|
|
5731
|
-
loading: /* @__PURE__ */
|
|
5821
|
+
loading: /* @__PURE__ */ jsx34(LoadingSpinner, {}),
|
|
5732
5822
|
beforeMount: handleBeforeMount,
|
|
5733
5823
|
onMount: (editor) => {
|
|
5734
5824
|
editorRef.current = editor;
|
|
@@ -5819,12 +5909,12 @@ var handleBeforeMount = (monaco) => {
|
|
|
5819
5909
|
monaco.languages.typescript.typescriptDefaults.setEagerModelSync(true);
|
|
5820
5910
|
};
|
|
5821
5911
|
var TestEditor = ({ value, onChange, height, testLabel }) => {
|
|
5822
|
-
return /* @__PURE__ */
|
|
5912
|
+
return /* @__PURE__ */ jsx34(
|
|
5823
5913
|
"div",
|
|
5824
5914
|
{
|
|
5825
5915
|
className: cn("group/editor relative", height === void 0 && "h-full"),
|
|
5826
5916
|
style: { height },
|
|
5827
|
-
children: /* @__PURE__ */
|
|
5917
|
+
children: /* @__PURE__ */ jsx34(
|
|
5828
5918
|
"textarea",
|
|
5829
5919
|
{
|
|
5830
5920
|
"aria-label": testLabel,
|
|
@@ -5953,11 +6043,31 @@ declare class DateFieldBuilder<Fast extends Record<"fast", boolean> = {
|
|
|
5953
6043
|
from: TFrom["from"];
|
|
5954
6044
|
} : { type: "DATE" };
|
|
5955
6045
|
}
|
|
5956
|
-
declare class KeywordFieldBuilder {
|
|
5957
|
-
|
|
6046
|
+
declare class KeywordFieldBuilder<TFrom extends Record<"from", string | null> = {
|
|
6047
|
+
from: null;
|
|
6048
|
+
}> {
|
|
6049
|
+
private _from;
|
|
6050
|
+
constructor(from?: TFrom);
|
|
6051
|
+
from(field: string): KeywordFieldBuilder<{
|
|
6052
|
+
from: string;
|
|
6053
|
+
}>;
|
|
6054
|
+
[BUILD](): TFrom["from"] extends string ? {
|
|
6055
|
+
type: "KEYWORD";
|
|
6056
|
+
from: TFrom["from"];
|
|
6057
|
+
} : { type: "KEYWORD" };
|
|
5958
6058
|
}
|
|
5959
|
-
declare class FacetFieldBuilder {
|
|
5960
|
-
|
|
6059
|
+
declare class FacetFieldBuilder<TFrom extends Record<"from", string | null> = {
|
|
6060
|
+
from: null;
|
|
6061
|
+
}> {
|
|
6062
|
+
private _from;
|
|
6063
|
+
constructor(from?: TFrom);
|
|
6064
|
+
from(field: string): FacetFieldBuilder<{
|
|
6065
|
+
from: string;
|
|
6066
|
+
}>;
|
|
6067
|
+
[BUILD](): TFrom["from"] extends string ? {
|
|
6068
|
+
type: "FACET";
|
|
6069
|
+
from: TFrom["from"];
|
|
6070
|
+
} : { type: "FACET" };
|
|
5961
6071
|
}
|
|
5962
6072
|
type FieldBuilder = TextFieldBuilder<{
|
|
5963
6073
|
noTokenize: boolean;
|
|
@@ -5975,7 +6085,11 @@ type FieldBuilder = TextFieldBuilder<{
|
|
|
5975
6085
|
fast: boolean;
|
|
5976
6086
|
}, {
|
|
5977
6087
|
from: string | null;
|
|
5978
|
-
}> | KeywordFieldBuilder
|
|
6088
|
+
}> | KeywordFieldBuilder<{
|
|
6089
|
+
from: string | null;
|
|
6090
|
+
}> | FacetFieldBuilder<{
|
|
6091
|
+
from: string | null;
|
|
6092
|
+
}>;
|
|
5979
6093
|
declare const s: {
|
|
5980
6094
|
string(): TextFieldBuilder;
|
|
5981
6095
|
number<T extends NumericField["type"] = "F64">(type?: T): NumericFieldBuilder<T>;
|
|
@@ -6000,7 +6114,7 @@ type Schema = NestedIndexSchema | FlatIndexSchema;
|
|
|
6000
6114
|
};
|
|
6001
6115
|
|
|
6002
6116
|
// src/components/databrowser/components/search/schema-editor.tsx
|
|
6003
|
-
import { jsx as
|
|
6117
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
6004
6118
|
var SCHEMA_PREFIX = "const schema: Schema = s.object({";
|
|
6005
6119
|
var SCHEMA_SUFFIX = "})";
|
|
6006
6120
|
var SCHEMA_DEFAULT = "const schema: Schema = s.object({\n name: s.string(),\n})";
|
|
@@ -6009,7 +6123,7 @@ var isSchemaStringValid = (value) => {
|
|
|
6009
6123
|
};
|
|
6010
6124
|
var SchemaEditor = ({ value, onChange, height }) => {
|
|
6011
6125
|
const typeDefinitions = useMemo6(() => generateSchemaTypeDefinitions(), []);
|
|
6012
|
-
return /* @__PURE__ */
|
|
6126
|
+
return /* @__PURE__ */ jsx35(
|
|
6013
6127
|
EditorWithTypes,
|
|
6014
6128
|
{
|
|
6015
6129
|
value,
|
|
@@ -6143,7 +6257,7 @@ function fieldToBuilder(value) {
|
|
|
6143
6257
|
}
|
|
6144
6258
|
|
|
6145
6259
|
// src/components/databrowser/components/search/display-search.tsx
|
|
6146
|
-
import { jsx as
|
|
6260
|
+
import { jsx as jsx36, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
6147
6261
|
var SearchDisplay = ({
|
|
6148
6262
|
indexName,
|
|
6149
6263
|
isCreateModal,
|
|
@@ -6213,14 +6327,14 @@ var SearchDisplay = ({
|
|
|
6213
6327
|
reset();
|
|
6214
6328
|
};
|
|
6215
6329
|
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__ */
|
|
6330
|
+
return /* @__PURE__ */ jsx36(KeyDeleted, {});
|
|
6331
|
+
}
|
|
6332
|
+
return /* @__PURE__ */ jsxs18("div", { className: "flex h-full min-h-0 w-full min-w-0 flex-col gap-2", children: [
|
|
6333
|
+
!isCreateModal && /* @__PURE__ */ jsx36(DisplayHeader, { dataKey: effectiveIndexName, type: "search", hideTypeTag: isEditModal }),
|
|
6334
|
+
/* @__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: [
|
|
6335
|
+
isCreateModal && /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-1.5", children: [
|
|
6336
|
+
/* @__PURE__ */ jsx36(Label, { htmlFor: "index-name", children: "Index Key" }),
|
|
6337
|
+
/* @__PURE__ */ jsx36(
|
|
6224
6338
|
Input,
|
|
6225
6339
|
{
|
|
6226
6340
|
id: "index-name",
|
|
@@ -6228,42 +6342,42 @@ var SearchDisplay = ({
|
|
|
6228
6342
|
placeholder: "idx_users"
|
|
6229
6343
|
}
|
|
6230
6344
|
),
|
|
6231
|
-
errors.indexName && /* @__PURE__ */
|
|
6345
|
+
errors.indexName && /* @__PURE__ */ jsx36("p", { className: "text-xs text-red-500", children: errors.indexName.message })
|
|
6232
6346
|
] }),
|
|
6233
|
-
/* @__PURE__ */
|
|
6234
|
-
/* @__PURE__ */
|
|
6235
|
-
/* @__PURE__ */
|
|
6236
|
-
/* @__PURE__ */
|
|
6237
|
-
/* @__PURE__ */
|
|
6238
|
-
/* @__PURE__ */
|
|
6347
|
+
/* @__PURE__ */ jsxs18("div", { className: "shrink-0 rounded-md border border-zinc-300 bg-white p-3", children: [
|
|
6348
|
+
/* @__PURE__ */ jsx36("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsx36("h3", { className: "text-sm font-medium text-zinc-700", children: "Config" }) }),
|
|
6349
|
+
/* @__PURE__ */ jsxs18("div", { className: "mt-2 grid grid-cols-2 gap-4 text-sm lg:grid-cols-4", children: [
|
|
6350
|
+
/* @__PURE__ */ jsxs18("div", { children: [
|
|
6351
|
+
/* @__PURE__ */ jsx36("span", { className: "mb-1.5 block text-xs font-medium text-zinc-500", children: "Data Type" }),
|
|
6352
|
+
/* @__PURE__ */ jsx36(
|
|
6239
6353
|
Controller2,
|
|
6240
6354
|
{
|
|
6241
6355
|
name: "dataType",
|
|
6242
6356
|
control,
|
|
6243
|
-
render: ({ field }) => /* @__PURE__ */
|
|
6244
|
-
/* @__PURE__ */
|
|
6245
|
-
/* @__PURE__ */
|
|
6357
|
+
render: ({ field }) => /* @__PURE__ */ jsxs18(Select, { value: field.value, onValueChange: field.onChange, children: [
|
|
6358
|
+
/* @__PURE__ */ jsx36(SelectTrigger, { className: "h-8 w-auto pl-[3px] pr-8", children: /* @__PURE__ */ jsx36(SelectValue, { placeholder: "Select type" }) }),
|
|
6359
|
+
/* @__PURE__ */ jsx36(SelectContent, { children: ["string", "hash", "json"].map((type) => /* @__PURE__ */ jsx36(SelectItem, { value: type, children: /* @__PURE__ */ jsx36(TypeTag, { variant: type, type: "badge" }) }, type)) })
|
|
6246
6360
|
] })
|
|
6247
6361
|
}
|
|
6248
6362
|
)
|
|
6249
6363
|
] }),
|
|
6250
|
-
/* @__PURE__ */
|
|
6251
|
-
/* @__PURE__ */
|
|
6252
|
-
/* @__PURE__ */
|
|
6364
|
+
/* @__PURE__ */ jsxs18("div", { children: [
|
|
6365
|
+
/* @__PURE__ */ jsx36("span", { className: "mb-1.5 block text-xs font-medium text-zinc-500", children: "Language" }),
|
|
6366
|
+
/* @__PURE__ */ jsx36(
|
|
6253
6367
|
Controller2,
|
|
6254
6368
|
{
|
|
6255
6369
|
name: "language",
|
|
6256
6370
|
control,
|
|
6257
|
-
render: ({ field }) => /* @__PURE__ */
|
|
6258
|
-
/* @__PURE__ */
|
|
6259
|
-
/* @__PURE__ */
|
|
6371
|
+
render: ({ field }) => /* @__PURE__ */ jsxs18(Select, { value: field.value, onValueChange: field.onChange, children: [
|
|
6372
|
+
/* @__PURE__ */ jsx36(SelectTrigger, { className: "h-8", children: /* @__PURE__ */ jsx36(SelectValue, { placeholder: "Select language" }) }),
|
|
6373
|
+
/* @__PURE__ */ jsx36(SelectContent, { children: LANGUAGES.map((lang) => /* @__PURE__ */ jsx36(SelectItem, { value: lang, children: lang.charAt(0).toUpperCase() + lang.slice(1) }, lang)) })
|
|
6260
6374
|
] })
|
|
6261
6375
|
}
|
|
6262
6376
|
)
|
|
6263
6377
|
] }),
|
|
6264
|
-
/* @__PURE__ */
|
|
6265
|
-
/* @__PURE__ */
|
|
6266
|
-
/* @__PURE__ */
|
|
6378
|
+
/* @__PURE__ */ jsxs18("div", { className: "col-span-2", children: [
|
|
6379
|
+
/* @__PURE__ */ jsx36("span", { className: "mb-1.5 block text-xs font-medium text-zinc-500", children: "Prefixes" }),
|
|
6380
|
+
/* @__PURE__ */ jsx36(
|
|
6267
6381
|
Input,
|
|
6268
6382
|
{
|
|
6269
6383
|
...register("prefixes", { required: "Please enter at least one prefix" }),
|
|
@@ -6271,18 +6385,18 @@ var SearchDisplay = ({
|
|
|
6271
6385
|
placeholder: "user:, post:"
|
|
6272
6386
|
}
|
|
6273
6387
|
),
|
|
6274
|
-
errors.prefixes && /* @__PURE__ */
|
|
6388
|
+
errors.prefixes && /* @__PURE__ */ jsx36("p", { className: "mt-1 text-xs text-red-500", children: errors.prefixes.message })
|
|
6275
6389
|
] })
|
|
6276
6390
|
] })
|
|
6277
6391
|
] }),
|
|
6278
|
-
/* @__PURE__ */
|
|
6279
|
-
/* @__PURE__ */
|
|
6280
|
-
/* @__PURE__ */
|
|
6392
|
+
/* @__PURE__ */ jsxs18("div", { className: "relative flex min-h-0 flex-1 flex-col rounded-md border border-zinc-300 bg-white", children: [
|
|
6393
|
+
/* @__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" }) }),
|
|
6394
|
+
/* @__PURE__ */ jsx36("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ jsx36("div", { className: "h-full px-1", children: /* @__PURE__ */ jsx36(
|
|
6281
6395
|
Controller2,
|
|
6282
6396
|
{
|
|
6283
6397
|
name: "editorValue",
|
|
6284
6398
|
control,
|
|
6285
|
-
render: ({ field }) => /* @__PURE__ */
|
|
6399
|
+
render: ({ field }) => /* @__PURE__ */ jsx36(
|
|
6286
6400
|
SchemaEditor,
|
|
6287
6401
|
{
|
|
6288
6402
|
value: field.value,
|
|
@@ -6292,18 +6406,18 @@ var SearchDisplay = ({
|
|
|
6292
6406
|
)
|
|
6293
6407
|
}
|
|
6294
6408
|
) }) }),
|
|
6295
|
-
/* @__PURE__ */
|
|
6409
|
+
/* @__PURE__ */ jsx36(
|
|
6296
6410
|
DocsLink,
|
|
6297
6411
|
{
|
|
6298
6412
|
className: "absolute bottom-2 right-2 text-sm",
|
|
6299
|
-
href: "https://upstash
|
|
6413
|
+
href: "https://upstash.com/docs/redis/search/schema-definition"
|
|
6300
6414
|
}
|
|
6301
6415
|
)
|
|
6302
6416
|
] }),
|
|
6303
|
-
isCreateModal && createSchema.error && /* @__PURE__ */
|
|
6304
|
-
parseError && /* @__PURE__ */
|
|
6305
|
-
/* @__PURE__ */
|
|
6306
|
-
(isDirty || isCreateModal || isEditModal) && /* @__PURE__ */
|
|
6417
|
+
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) }),
|
|
6418
|
+
parseError && /* @__PURE__ */ jsx36("div", { className: "w-full break-words text-xs text-red-500", children: parseError }),
|
|
6419
|
+
/* @__PURE__ */ jsx36("div", { className: "flex shrink-0 items-center gap-2", children: /* @__PURE__ */ jsxs18("div", { className: "ml-auto flex gap-2", children: [
|
|
6420
|
+
(isDirty || isCreateModal || isEditModal) && /* @__PURE__ */ jsx36(
|
|
6307
6421
|
Button,
|
|
6308
6422
|
{
|
|
6309
6423
|
onClick: () => {
|
|
@@ -6316,9 +6430,9 @@ var SearchDisplay = ({
|
|
|
6316
6430
|
children: "Cancel"
|
|
6317
6431
|
}
|
|
6318
6432
|
),
|
|
6319
|
-
/* @__PURE__ */
|
|
6433
|
+
/* @__PURE__ */ jsx36(Button, { variant: "primary", onClick: handleSubmit(onSubmit), disabled: !isDirty, children: /* @__PURE__ */ jsx36(Spinner, { isLoading: createSchema.isPending, isLoadingText: "Saving", children: isCreateModal ? "Create" : "Save..." }) })
|
|
6320
6434
|
] }) }),
|
|
6321
|
-
/* @__PURE__ */
|
|
6435
|
+
/* @__PURE__ */ jsx36(
|
|
6322
6436
|
SaveSchemaModal,
|
|
6323
6437
|
{
|
|
6324
6438
|
values: pendingFormValues,
|
|
@@ -6359,7 +6473,7 @@ import { IconTrash as IconTrash2 } from "@tabler/icons-react";
|
|
|
6359
6473
|
// src/components/common/infinite-scroll.tsx
|
|
6360
6474
|
import { useEffect as useEffect10, useRef as useRef3 } from "react";
|
|
6361
6475
|
import { IconLoader2 } from "@tabler/icons-react";
|
|
6362
|
-
import { jsx as
|
|
6476
|
+
import { jsx as jsx37, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
6363
6477
|
var InfiniteScroll = ({
|
|
6364
6478
|
query,
|
|
6365
6479
|
children,
|
|
@@ -6391,7 +6505,7 @@ var InfiniteScroll = ({
|
|
|
6391
6505
|
const timer = setTimeout(checkAndFetchMore, 100);
|
|
6392
6506
|
return () => clearTimeout(timer);
|
|
6393
6507
|
}, [active, query.data]);
|
|
6394
|
-
return /* @__PURE__ */
|
|
6508
|
+
return /* @__PURE__ */ jsx37(
|
|
6395
6509
|
ScrollArea,
|
|
6396
6510
|
{
|
|
6397
6511
|
type: "always",
|
|
@@ -6399,9 +6513,9 @@ var InfiniteScroll = ({
|
|
|
6399
6513
|
...props,
|
|
6400
6514
|
className: cn("block h-full min-h-0 w-full overflow-hidden transition-all", props.className),
|
|
6401
6515
|
ref: scrollRef,
|
|
6402
|
-
children: /* @__PURE__ */
|
|
6516
|
+
children: /* @__PURE__ */ jsxs19("div", { ref: contentRef, children: [
|
|
6403
6517
|
children,
|
|
6404
|
-
/* @__PURE__ */
|
|
6518
|
+
/* @__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
6519
|
] })
|
|
6406
6520
|
}
|
|
6407
6521
|
);
|
|
@@ -6416,10 +6530,10 @@ import { IconCopy, IconExternalLink as IconExternalLink2, IconTrash } from "@tab
|
|
|
6416
6530
|
import * as React14 from "react";
|
|
6417
6531
|
import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
|
|
6418
6532
|
import { IconCheck as IconCheck2, IconChevronRight as IconChevronRight2, IconCircleFilled as IconCircleFilled2 } from "@tabler/icons-react";
|
|
6419
|
-
import { jsx as
|
|
6533
|
+
import { jsx as jsx38, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
6420
6534
|
var ContextMenu = ContextMenuPrimitive.Root;
|
|
6421
6535
|
var ContextMenuTrigger = ContextMenuPrimitive.Trigger;
|
|
6422
|
-
var ContextMenuSubTrigger = React14.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */
|
|
6536
|
+
var ContextMenuSubTrigger = React14.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs20(
|
|
6423
6537
|
ContextMenuPrimitive.SubTrigger,
|
|
6424
6538
|
{
|
|
6425
6539
|
ref,
|
|
@@ -6431,12 +6545,12 @@ var ContextMenuSubTrigger = React14.forwardRef(({ className, inset, children, ..
|
|
|
6431
6545
|
...props,
|
|
6432
6546
|
children: [
|
|
6433
6547
|
children,
|
|
6434
|
-
/* @__PURE__ */
|
|
6548
|
+
/* @__PURE__ */ jsx38(IconChevronRight2, { className: "ml-auto h-4 w-4" })
|
|
6435
6549
|
]
|
|
6436
6550
|
}
|
|
6437
6551
|
));
|
|
6438
6552
|
ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;
|
|
6439
|
-
var ContextMenuSubContent = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
6553
|
+
var ContextMenuSubContent = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx38(
|
|
6440
6554
|
ContextMenuPrimitive.SubContent,
|
|
6441
6555
|
{
|
|
6442
6556
|
ref,
|
|
@@ -6448,7 +6562,7 @@ var ContextMenuSubContent = React14.forwardRef(({ className, ...props }, ref) =>
|
|
|
6448
6562
|
}
|
|
6449
6563
|
));
|
|
6450
6564
|
ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName;
|
|
6451
|
-
var ContextMenuContent = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
6565
|
+
var ContextMenuContent = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx38(ContextMenuPrimitive.Portal, { container: portalRoot, children: /* @__PURE__ */ jsx38(
|
|
6452
6566
|
ContextMenuPrimitive.Content,
|
|
6453
6567
|
{
|
|
6454
6568
|
ref,
|
|
@@ -6460,7 +6574,7 @@ var ContextMenuContent = React14.forwardRef(({ className, ...props }, ref) => /*
|
|
|
6460
6574
|
}
|
|
6461
6575
|
) }));
|
|
6462
6576
|
ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;
|
|
6463
|
-
var ContextMenuItem = React14.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */
|
|
6577
|
+
var ContextMenuItem = React14.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx38(
|
|
6464
6578
|
ContextMenuPrimitive.Item,
|
|
6465
6579
|
{
|
|
6466
6580
|
ref,
|
|
@@ -6473,7 +6587,7 @@ var ContextMenuItem = React14.forwardRef(({ className, inset, ...props }, ref) =
|
|
|
6473
6587
|
}
|
|
6474
6588
|
));
|
|
6475
6589
|
ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;
|
|
6476
|
-
var ContextMenuCheckboxItem = React14.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */
|
|
6590
|
+
var ContextMenuCheckboxItem = React14.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ jsxs20(
|
|
6477
6591
|
ContextMenuPrimitive.CheckboxItem,
|
|
6478
6592
|
{
|
|
6479
6593
|
ref,
|
|
@@ -6484,13 +6598,13 @@ var ContextMenuCheckboxItem = React14.forwardRef(({ className, children, checked
|
|
|
6484
6598
|
checked,
|
|
6485
6599
|
...props,
|
|
6486
6600
|
children: [
|
|
6487
|
-
/* @__PURE__ */
|
|
6601
|
+
/* @__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
6602
|
children
|
|
6489
6603
|
]
|
|
6490
6604
|
}
|
|
6491
6605
|
));
|
|
6492
6606
|
ContextMenuCheckboxItem.displayName = ContextMenuPrimitive.CheckboxItem.displayName;
|
|
6493
|
-
var ContextMenuRadioItem = React14.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */
|
|
6607
|
+
var ContextMenuRadioItem = React14.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs20(
|
|
6494
6608
|
ContextMenuPrimitive.RadioItem,
|
|
6495
6609
|
{
|
|
6496
6610
|
ref,
|
|
@@ -6500,13 +6614,13 @@ var ContextMenuRadioItem = React14.forwardRef(({ className, children, ...props }
|
|
|
6500
6614
|
),
|
|
6501
6615
|
...props,
|
|
6502
6616
|
children: [
|
|
6503
|
-
/* @__PURE__ */
|
|
6617
|
+
/* @__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
6618
|
children
|
|
6505
6619
|
]
|
|
6506
6620
|
}
|
|
6507
6621
|
));
|
|
6508
6622
|
ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName;
|
|
6509
|
-
var ContextMenuLabel = React14.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */
|
|
6623
|
+
var ContextMenuLabel = React14.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx38(
|
|
6510
6624
|
ContextMenuPrimitive.Label,
|
|
6511
6625
|
{
|
|
6512
6626
|
ref,
|
|
@@ -6515,7 +6629,7 @@ var ContextMenuLabel = React14.forwardRef(({ className, inset, ...props }, ref)
|
|
|
6515
6629
|
}
|
|
6516
6630
|
));
|
|
6517
6631
|
ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName;
|
|
6518
|
-
var ContextMenuSeparator = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
6632
|
+
var ContextMenuSeparator = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx38(
|
|
6519
6633
|
ContextMenuPrimitive.Separator,
|
|
6520
6634
|
{
|
|
6521
6635
|
ref,
|
|
@@ -6525,12 +6639,12 @@ var ContextMenuSeparator = React14.forwardRef(({ className, ...props }, ref) =>
|
|
|
6525
6639
|
));
|
|
6526
6640
|
ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName;
|
|
6527
6641
|
var ContextMenuShortcut = ({ className, ...props }) => {
|
|
6528
|
-
return /* @__PURE__ */
|
|
6642
|
+
return /* @__PURE__ */ jsx38("span", { className: cn("ml-auto text-xs tracking-widest text-zinc-500", className), ...props });
|
|
6529
6643
|
};
|
|
6530
6644
|
ContextMenuShortcut.displayName = "ContextMenuShortcut";
|
|
6531
6645
|
|
|
6532
6646
|
// src/components/databrowser/components/item-context-menu.tsx
|
|
6533
|
-
import { Fragment as
|
|
6647
|
+
import { Fragment as Fragment5, jsx as jsx39, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
6534
6648
|
var ItemContextMenu = ({
|
|
6535
6649
|
children,
|
|
6536
6650
|
dataKey,
|
|
@@ -6540,8 +6654,8 @@ var ItemContextMenu = ({
|
|
|
6540
6654
|
const [isAlertOpen, setAlertOpen] = useState9(false);
|
|
6541
6655
|
const [data, setData] = useState9();
|
|
6542
6656
|
const { addTab, setSelectedKey, selectTab, setSelectedListItem } = useDatabrowserStore();
|
|
6543
|
-
return /* @__PURE__ */
|
|
6544
|
-
/* @__PURE__ */
|
|
6657
|
+
return /* @__PURE__ */ jsxs21(Fragment5, { children: [
|
|
6658
|
+
/* @__PURE__ */ jsx39(
|
|
6545
6659
|
DeleteKeyModal,
|
|
6546
6660
|
{
|
|
6547
6661
|
deletionType: "item",
|
|
@@ -6562,8 +6676,8 @@ var ItemContextMenu = ({
|
|
|
6562
6676
|
}
|
|
6563
6677
|
}
|
|
6564
6678
|
),
|
|
6565
|
-
/* @__PURE__ */
|
|
6566
|
-
/* @__PURE__ */
|
|
6679
|
+
/* @__PURE__ */ jsxs21(ContextMenu, { modal: false, children: [
|
|
6680
|
+
/* @__PURE__ */ jsx39(
|
|
6567
6681
|
ContextMenuTrigger,
|
|
6568
6682
|
{
|
|
6569
6683
|
asChild: true,
|
|
@@ -6582,8 +6696,8 @@ var ItemContextMenu = ({
|
|
|
6582
6696
|
children
|
|
6583
6697
|
}
|
|
6584
6698
|
),
|
|
6585
|
-
/* @__PURE__ */
|
|
6586
|
-
/* @__PURE__ */
|
|
6699
|
+
/* @__PURE__ */ jsxs21(ContextMenuContent, { children: [
|
|
6700
|
+
/* @__PURE__ */ jsxs21(
|
|
6587
6701
|
ContextMenuItem,
|
|
6588
6702
|
{
|
|
6589
6703
|
onClick: () => {
|
|
@@ -6595,12 +6709,12 @@ var ItemContextMenu = ({
|
|
|
6595
6709
|
},
|
|
6596
6710
|
className: "gap-2",
|
|
6597
6711
|
children: [
|
|
6598
|
-
/* @__PURE__ */
|
|
6712
|
+
/* @__PURE__ */ jsx39(IconCopy, { size: 16 }),
|
|
6599
6713
|
"Copy key"
|
|
6600
6714
|
]
|
|
6601
6715
|
}
|
|
6602
6716
|
),
|
|
6603
|
-
data?.value && /* @__PURE__ */
|
|
6717
|
+
data?.value && /* @__PURE__ */ jsxs21(
|
|
6604
6718
|
ContextMenuItem,
|
|
6605
6719
|
{
|
|
6606
6720
|
onClick: () => {
|
|
@@ -6611,12 +6725,12 @@ var ItemContextMenu = ({
|
|
|
6611
6725
|
},
|
|
6612
6726
|
className: "gap-2",
|
|
6613
6727
|
children: [
|
|
6614
|
-
/* @__PURE__ */
|
|
6728
|
+
/* @__PURE__ */ jsx39(IconCopy, { size: 16 }),
|
|
6615
6729
|
"Copy value"
|
|
6616
6730
|
]
|
|
6617
6731
|
}
|
|
6618
6732
|
),
|
|
6619
|
-
/* @__PURE__ */
|
|
6733
|
+
/* @__PURE__ */ jsxs21(
|
|
6620
6734
|
ContextMenuItem,
|
|
6621
6735
|
{
|
|
6622
6736
|
onClick: () => {
|
|
@@ -6630,20 +6744,20 @@ var ItemContextMenu = ({
|
|
|
6630
6744
|
},
|
|
6631
6745
|
className: "gap-2",
|
|
6632
6746
|
children: [
|
|
6633
|
-
/* @__PURE__ */
|
|
6747
|
+
/* @__PURE__ */ jsx39(IconExternalLink2, { size: 16 }),
|
|
6634
6748
|
"Open in new tab"
|
|
6635
6749
|
]
|
|
6636
6750
|
}
|
|
6637
6751
|
),
|
|
6638
|
-
/* @__PURE__ */
|
|
6639
|
-
/* @__PURE__ */
|
|
6752
|
+
/* @__PURE__ */ jsx39(ContextMenuSeparator2, {}),
|
|
6753
|
+
/* @__PURE__ */ jsxs21(
|
|
6640
6754
|
ContextMenuItem,
|
|
6641
6755
|
{
|
|
6642
6756
|
disabled: type === "stream",
|
|
6643
6757
|
onClick: () => setAlertOpen(true),
|
|
6644
6758
|
className: "gap-2",
|
|
6645
6759
|
children: [
|
|
6646
|
-
/* @__PURE__ */
|
|
6760
|
+
/* @__PURE__ */ jsx39(IconTrash, { size: 16 }),
|
|
6647
6761
|
"Delete item"
|
|
6648
6762
|
]
|
|
6649
6763
|
}
|
|
@@ -6657,14 +6771,14 @@ var ItemContextMenu = ({
|
|
|
6657
6771
|
import { Controller as Controller3, FormProvider, useForm as useForm3, useFormContext } from "react-hook-form";
|
|
6658
6772
|
|
|
6659
6773
|
// src/components/databrowser/hooks/use-fetch-hash-ttl.ts
|
|
6660
|
-
import { useQuery as
|
|
6774
|
+
import { useQuery as useQuery7 } from "@tanstack/react-query";
|
|
6661
6775
|
var FETCH_HASH_FIELD_TTLS_QUERY_KEY = "fetch-hash-field-ttls";
|
|
6662
6776
|
var useFetchHashFieldExpires = ({
|
|
6663
6777
|
dataKey,
|
|
6664
6778
|
fields
|
|
6665
6779
|
}) => {
|
|
6666
6780
|
const { redis } = useRedis();
|
|
6667
|
-
return
|
|
6781
|
+
return useQuery7({
|
|
6668
6782
|
queryKey: [FETCH_HASH_FIELD_TTLS_QUERY_KEY, dataKey, fields],
|
|
6669
6783
|
queryFn: async () => {
|
|
6670
6784
|
const cachedExpires = /* @__PURE__ */ new Map();
|
|
@@ -6712,12 +6826,12 @@ var useSetHashTTL = () => {
|
|
|
6712
6826
|
};
|
|
6713
6827
|
|
|
6714
6828
|
// src/components/databrowser/components/display/hash/hash-field-ttl-badge.tsx
|
|
6715
|
-
import { jsx as
|
|
6829
|
+
import { jsx as jsx40 } from "react/jsx-runtime";
|
|
6716
6830
|
var HashFieldTTLBadge = ({ dataKey, field }) => {
|
|
6717
6831
|
const { data } = useFetchHashFieldExpires({ dataKey, fields: [field] });
|
|
6718
6832
|
const { mutate: setTTL, isPending } = useSetHashTTL();
|
|
6719
6833
|
const expireAt = data?.[field];
|
|
6720
|
-
return /* @__PURE__ */
|
|
6834
|
+
return /* @__PURE__ */ jsx40(
|
|
6721
6835
|
TTLBadge,
|
|
6722
6836
|
{
|
|
6723
6837
|
label: "Field TTL:",
|
|
@@ -6734,18 +6848,18 @@ import { useController } from "react-hook-form";
|
|
|
6734
6848
|
|
|
6735
6849
|
// src/components/databrowser/components/display/input/content-type-select.tsx
|
|
6736
6850
|
import { useMemo as useMemo7 } from "react";
|
|
6737
|
-
import { jsx as
|
|
6851
|
+
import { jsx as jsx41, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
6738
6852
|
var ContentTypeSelect = ({
|
|
6739
6853
|
value,
|
|
6740
6854
|
onChange,
|
|
6741
6855
|
data
|
|
6742
6856
|
}) => {
|
|
6743
6857
|
const isValidJSON = useMemo7(() => checkIsValidJSON(data), [data]);
|
|
6744
|
-
return /* @__PURE__ */
|
|
6745
|
-
/* @__PURE__ */
|
|
6746
|
-
/* @__PURE__ */
|
|
6747
|
-
/* @__PURE__ */
|
|
6748
|
-
/* @__PURE__ */
|
|
6858
|
+
return /* @__PURE__ */ jsxs22(Select, { value, onValueChange: onChange, children: [
|
|
6859
|
+
/* @__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" }) }),
|
|
6860
|
+
/* @__PURE__ */ jsx41(SelectContent, { children: /* @__PURE__ */ jsxs22(SelectGroup, { children: [
|
|
6861
|
+
/* @__PURE__ */ jsx41(SelectItem, { value: "Text", children: "Text" }),
|
|
6862
|
+
/* @__PURE__ */ jsx41(SelectItem, { disabled: !isValidJSON, value: "JSON", children: "JSON" })
|
|
6749
6863
|
] }) })
|
|
6750
6864
|
] });
|
|
6751
6865
|
};
|
|
@@ -6757,10 +6871,10 @@ import { Editor as Editor2, useMonaco as useMonaco2 } from "@monaco-editor/react
|
|
|
6757
6871
|
// src/components/common/copy-button.tsx
|
|
6758
6872
|
import { useState as useState10 } from "react";
|
|
6759
6873
|
import { IconCheck as IconCheck3, IconCopy as IconCopy2 } from "@tabler/icons-react";
|
|
6760
|
-
import { jsx as
|
|
6874
|
+
import { jsx as jsx42 } from "react/jsx-runtime";
|
|
6761
6875
|
function CopyButton({ value, ...props }) {
|
|
6762
6876
|
const [copied, setCopied] = useState10(false);
|
|
6763
|
-
return /* @__PURE__ */
|
|
6877
|
+
return /* @__PURE__ */ jsx42(
|
|
6764
6878
|
Button,
|
|
6765
6879
|
{
|
|
6766
6880
|
onClick: (e) => {
|
|
@@ -6777,7 +6891,7 @@ function CopyButton({ value, ...props }) {
|
|
|
6777
6891
|
variant: "secondary",
|
|
6778
6892
|
size: "icon-sm",
|
|
6779
6893
|
...props,
|
|
6780
|
-
children: copied ? /* @__PURE__ */
|
|
6894
|
+
children: copied ? /* @__PURE__ */ jsx42(IconCheck3, { className: "size-4 text-green-500" }) : /* @__PURE__ */ jsx42(IconCopy2, { className: "size-4 text-zinc-500" })
|
|
6781
6895
|
}
|
|
6782
6896
|
);
|
|
6783
6897
|
}
|
|
@@ -6790,12 +6904,12 @@ var handleCopyClick = async (textToCopy) => {
|
|
|
6790
6904
|
};
|
|
6791
6905
|
|
|
6792
6906
|
// src/components/databrowser/components/display/input/custom-editor.tsx
|
|
6793
|
-
import { jsx as
|
|
6907
|
+
import { jsx as jsx43, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
6794
6908
|
var CustomEditor = (props) => {
|
|
6795
6909
|
if (isTest) {
|
|
6796
|
-
return /* @__PURE__ */
|
|
6910
|
+
return /* @__PURE__ */ jsx43(TestEditor2, { ...props });
|
|
6797
6911
|
}
|
|
6798
|
-
return /* @__PURE__ */
|
|
6912
|
+
return /* @__PURE__ */ jsx43(MonacoEditor, { ...props });
|
|
6799
6913
|
};
|
|
6800
6914
|
var MonacoEditor = ({
|
|
6801
6915
|
language,
|
|
@@ -6815,7 +6929,7 @@ var MonacoEditor = ({
|
|
|
6815
6929
|
}
|
|
6816
6930
|
monaco?.editor.setModelLanguage(editorRef.current.getModel(), language);
|
|
6817
6931
|
}, [monaco, language, active]);
|
|
6818
|
-
const editor = /* @__PURE__ */
|
|
6932
|
+
const editor = /* @__PURE__ */ jsx43(
|
|
6819
6933
|
Editor2,
|
|
6820
6934
|
{
|
|
6821
6935
|
theme: theme === "dark" ? "vs-dark" : "light",
|
|
@@ -6860,14 +6974,14 @@ var MonacoEditor = ({
|
|
|
6860
6974
|
className: "[&_.monaco-editor-background]:!bg-transparent [&_.monaco-editor]:!bg-transparent"
|
|
6861
6975
|
}
|
|
6862
6976
|
);
|
|
6863
|
-
return /* @__PURE__ */
|
|
6977
|
+
return /* @__PURE__ */ jsxs23(
|
|
6864
6978
|
"div",
|
|
6865
6979
|
{
|
|
6866
6980
|
className: cn("group/editor relative", height === void 0 && "h-full"),
|
|
6867
6981
|
style: { height },
|
|
6868
6982
|
children: [
|
|
6869
6983
|
editor,
|
|
6870
|
-
showCopyButton && /* @__PURE__ */
|
|
6984
|
+
showCopyButton && /* @__PURE__ */ jsx43(
|
|
6871
6985
|
CopyButton,
|
|
6872
6986
|
{
|
|
6873
6987
|
value,
|
|
@@ -6879,14 +6993,14 @@ var MonacoEditor = ({
|
|
|
6879
6993
|
);
|
|
6880
6994
|
};
|
|
6881
6995
|
var TestEditor2 = ({ value, onChange, height, showCopyButton }) => {
|
|
6882
|
-
return /* @__PURE__ */
|
|
6996
|
+
return /* @__PURE__ */ jsxs23(
|
|
6883
6997
|
"div",
|
|
6884
6998
|
{
|
|
6885
6999
|
className: cn("group/editor relative", height === void 0 && "h-full"),
|
|
6886
7000
|
style: { height },
|
|
6887
7001
|
children: [
|
|
6888
|
-
/* @__PURE__ */
|
|
6889
|
-
showCopyButton && /* @__PURE__ */
|
|
7002
|
+
/* @__PURE__ */ jsx43("input", { "aria-label": "editor", value, onChange: (e) => onChange(e.target.value) }),
|
|
7003
|
+
showCopyButton && /* @__PURE__ */ jsx43(
|
|
6890
7004
|
CopyButton,
|
|
6891
7005
|
{
|
|
6892
7006
|
value,
|
|
@@ -6899,7 +7013,7 @@ var TestEditor2 = ({ value, onChange, height, showCopyButton }) => {
|
|
|
6899
7013
|
};
|
|
6900
7014
|
|
|
6901
7015
|
// src/components/databrowser/components/display/input/use-field.tsx
|
|
6902
|
-
import { Fragment as
|
|
7016
|
+
import { Fragment as Fragment6, jsx as jsx44 } from "react/jsx-runtime";
|
|
6903
7017
|
var useField = ({
|
|
6904
7018
|
name,
|
|
6905
7019
|
form,
|
|
@@ -6946,8 +7060,8 @@ var useField = ({
|
|
|
6946
7060
|
}
|
|
6947
7061
|
}, [data, fieldState.isDirty]);
|
|
6948
7062
|
return {
|
|
6949
|
-
selector: /* @__PURE__ */
|
|
6950
|
-
editor: /* @__PURE__ */
|
|
7063
|
+
selector: /* @__PURE__ */ jsx44(ContentTypeSelect, { value: contentType, onChange: handleTypeChange, data: field.value }),
|
|
7064
|
+
editor: /* @__PURE__ */ jsx44(Fragment6, { children: /* @__PURE__ */ jsx44(
|
|
6951
7065
|
CustomEditor,
|
|
6952
7066
|
{
|
|
6953
7067
|
language: contentType === "JSON" ? "json" : "plaintext",
|
|
@@ -6971,13 +7085,13 @@ var checkIsValidJSON = (value) => {
|
|
|
6971
7085
|
};
|
|
6972
7086
|
|
|
6973
7087
|
// src/components/databrowser/components/display/display-list-edit.tsx
|
|
6974
|
-
import { jsx as
|
|
7088
|
+
import { jsx as jsx45, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
6975
7089
|
var ListEditDisplay = ({
|
|
6976
7090
|
dataKey,
|
|
6977
7091
|
type,
|
|
6978
7092
|
item
|
|
6979
7093
|
}) => {
|
|
6980
|
-
return /* @__PURE__ */
|
|
7094
|
+
return /* @__PURE__ */ jsx45("div", { className: "min-h-0 grow rounded-md", children: /* @__PURE__ */ jsx45(ListEditForm, { item, type, dataKey }, item.key) });
|
|
6981
7095
|
};
|
|
6982
7096
|
var ListEditForm = ({
|
|
6983
7097
|
type,
|
|
@@ -7016,21 +7130,29 @@ var ListEditForm = ({
|
|
|
7016
7130
|
});
|
|
7017
7131
|
setSelectedListItem(void 0);
|
|
7018
7132
|
});
|
|
7019
|
-
return /* @__PURE__ */
|
|
7020
|
-
/* @__PURE__ */
|
|
7021
|
-
type === "zset" && /* @__PURE__ */
|
|
7022
|
-
type !== "list" && /* @__PURE__ */
|
|
7023
|
-
|
|
7133
|
+
return /* @__PURE__ */ jsx45(FormProvider, { ...form, children: /* @__PURE__ */ jsxs24("form", { onSubmit, className: "flex h-full min-h-0 flex-col gap-2", children: [
|
|
7134
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex min-h-0 grow flex-col gap-2", children: [
|
|
7135
|
+
type === "zset" && /* @__PURE__ */ jsx45(NumberFormItem, { name: "value", label: valueLabel }),
|
|
7136
|
+
type !== "list" && /* @__PURE__ */ jsx45(
|
|
7137
|
+
FormItem,
|
|
7138
|
+
{
|
|
7139
|
+
readOnly: type === "stream" && !isNew,
|
|
7140
|
+
name: "key",
|
|
7141
|
+
label: keyLabel,
|
|
7142
|
+
data: itemKey
|
|
7143
|
+
}
|
|
7144
|
+
),
|
|
7145
|
+
type !== "set" && type !== "zset" && /* @__PURE__ */ jsx45(
|
|
7024
7146
|
FormItem,
|
|
7025
7147
|
{
|
|
7026
|
-
readOnly: type === "stream",
|
|
7148
|
+
readOnly: type === "stream" && !isNew,
|
|
7027
7149
|
name: "value",
|
|
7028
7150
|
label: valueLabel,
|
|
7029
7151
|
data: itemValue ?? ""
|
|
7030
7152
|
}
|
|
7031
7153
|
)
|
|
7032
7154
|
] }),
|
|
7033
|
-
/* @__PURE__ */
|
|
7155
|
+
/* @__PURE__ */ jsxs24(
|
|
7034
7156
|
"div",
|
|
7035
7157
|
{
|
|
7036
7158
|
className: cn(
|
|
@@ -7038,9 +7160,9 @@ var ListEditForm = ({
|
|
|
7038
7160
|
type === "hash" && itemKey !== "" ? "justify-between" : "justify-end"
|
|
7039
7161
|
),
|
|
7040
7162
|
children: [
|
|
7041
|
-
type === "hash" && itemKey !== "" && /* @__PURE__ */
|
|
7042
|
-
/* @__PURE__ */
|
|
7043
|
-
/* @__PURE__ */
|
|
7163
|
+
type === "hash" && itemKey !== "" && /* @__PURE__ */ jsx45(HashFieldTTLBadge, { dataKey, field: itemKey }),
|
|
7164
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex gap-2", children: [
|
|
7165
|
+
/* @__PURE__ */ jsx45(
|
|
7044
7166
|
Button,
|
|
7045
7167
|
{
|
|
7046
7168
|
type: "button",
|
|
@@ -7050,17 +7172,17 @@ var ListEditForm = ({
|
|
|
7050
7172
|
children: "Cancel"
|
|
7051
7173
|
}
|
|
7052
7174
|
),
|
|
7053
|
-
/* @__PURE__ */
|
|
7175
|
+
/* @__PURE__ */ jsx45(
|
|
7054
7176
|
SimpleTooltip,
|
|
7055
7177
|
{
|
|
7056
7178
|
content: type === "stream" && !isNew ? "Streams are not mutable" : void 0,
|
|
7057
|
-
children: /* @__PURE__ */
|
|
7179
|
+
children: /* @__PURE__ */ jsx45(
|
|
7058
7180
|
Button,
|
|
7059
7181
|
{
|
|
7060
7182
|
variant: "primary",
|
|
7061
7183
|
type: "submit",
|
|
7062
7184
|
disabled: !form.formState.isValid || !form.formState.isDirty || type === "stream" && !isNew,
|
|
7063
|
-
children: /* @__PURE__ */
|
|
7185
|
+
children: /* @__PURE__ */ jsx45(Spinner, { isLoading: isPending, isLoadingText: isNew ? "Adding" : "Saving", children: isNew ? "Add Item" : "Save" })
|
|
7064
7186
|
}
|
|
7065
7187
|
)
|
|
7066
7188
|
}
|
|
@@ -7072,13 +7194,13 @@ var ListEditForm = ({
|
|
|
7072
7194
|
] }) });
|
|
7073
7195
|
};
|
|
7074
7196
|
var NumberFormItem = ({ name, label }) => {
|
|
7075
|
-
return /* @__PURE__ */
|
|
7076
|
-
/* @__PURE__ */
|
|
7077
|
-
/* @__PURE__ */
|
|
7197
|
+
return /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-1", children: [
|
|
7198
|
+
/* @__PURE__ */ jsx45("div", { className: "flex", children: /* @__PURE__ */ jsx45("span", { className: "text-xs font-medium text-zinc-700", children: label }) }),
|
|
7199
|
+
/* @__PURE__ */ jsx45(
|
|
7078
7200
|
Controller3,
|
|
7079
7201
|
{
|
|
7080
7202
|
name,
|
|
7081
|
-
render: ({ field }) => /* @__PURE__ */
|
|
7203
|
+
render: ({ field }) => /* @__PURE__ */ jsx45(
|
|
7082
7204
|
"input",
|
|
7083
7205
|
{
|
|
7084
7206
|
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 +7228,14 @@ var FormItem = ({
|
|
|
7106
7228
|
readOnly,
|
|
7107
7229
|
data
|
|
7108
7230
|
});
|
|
7109
|
-
return /* @__PURE__ */
|
|
7110
|
-
/* @__PURE__ */
|
|
7111
|
-
/* @__PURE__ */
|
|
7231
|
+
return /* @__PURE__ */ jsxs24("div", { className: cn("flex flex-col gap-1", !height && "h-full min-h-0"), children: [
|
|
7232
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-1 text-xs", children: [
|
|
7233
|
+
/* @__PURE__ */ jsx45("span", { className: "font-medium text-zinc-700", children: label }),
|
|
7112
7234
|
" ",
|
|
7113
|
-
/* @__PURE__ */
|
|
7235
|
+
/* @__PURE__ */ jsx45("span", { className: "text-zinc-300", children: "/" }),
|
|
7114
7236
|
selector
|
|
7115
7237
|
] }),
|
|
7116
|
-
/* @__PURE__ */
|
|
7238
|
+
/* @__PURE__ */ jsx45(
|
|
7117
7239
|
"div",
|
|
7118
7240
|
{
|
|
7119
7241
|
className: cn(
|
|
@@ -7128,7 +7250,7 @@ var FormItem = ({
|
|
|
7128
7250
|
|
|
7129
7251
|
// src/components/databrowser/components/display/hash/hash-field-ttl-info.tsx
|
|
7130
7252
|
import { useEffect as useEffect13, useState as useState12 } from "react";
|
|
7131
|
-
import { jsx as
|
|
7253
|
+
import { jsx as jsx46 } from "react/jsx-runtime";
|
|
7132
7254
|
var HashFieldTTLInfo = ({
|
|
7133
7255
|
dataKey,
|
|
7134
7256
|
field,
|
|
@@ -7145,11 +7267,11 @@ var HashFieldTTLInfo = ({
|
|
|
7145
7267
|
return () => clearInterval(interval);
|
|
7146
7268
|
}, [expireAt]);
|
|
7147
7269
|
if (!expireAt || expireAt === TTL_NOT_FOUND || expireAt === TTL_INFINITE) return;
|
|
7148
|
-
return /* @__PURE__ */
|
|
7270
|
+
return /* @__PURE__ */ jsx46("span", { className: "block min-w-[30px] whitespace-nowrap text-right text-red-600", children: formatTime(ttl ?? 0) });
|
|
7149
7271
|
};
|
|
7150
7272
|
|
|
7151
7273
|
// src/components/databrowser/components/display/display-list.tsx
|
|
7152
|
-
import { Fragment as
|
|
7274
|
+
import { Fragment as Fragment7, jsx as jsx47, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
7153
7275
|
var headerLabels = {
|
|
7154
7276
|
list: ["Index", "Content"],
|
|
7155
7277
|
hash: ["Field", "Value"],
|
|
@@ -7162,12 +7284,12 @@ var ListDisplay = ({ dataKey, type }) => {
|
|
|
7162
7284
|
const query = useFetchListItems({ dataKey, type });
|
|
7163
7285
|
const isEmpty = query.isFetched && query.data?.pages.every((page) => page.keys.length === 0);
|
|
7164
7286
|
if (isEmpty) {
|
|
7165
|
-
return /* @__PURE__ */
|
|
7287
|
+
return /* @__PURE__ */ jsx47(KeyDeleted, {});
|
|
7166
7288
|
}
|
|
7167
|
-
return /* @__PURE__ */
|
|
7168
|
-
/* @__PURE__ */
|
|
7169
|
-
selectedListItem && /* @__PURE__ */
|
|
7170
|
-
/* @__PURE__ */
|
|
7289
|
+
return /* @__PURE__ */ jsxs25("div", { className: "flex h-full min-h-0 flex-col gap-2 overflow-hidden", children: [
|
|
7290
|
+
/* @__PURE__ */ jsx47(DisplayHeader, { dataKey, type }),
|
|
7291
|
+
selectedListItem && /* @__PURE__ */ jsx47(ListEditDisplay, { dataKey, type, item: selectedListItem }),
|
|
7292
|
+
/* @__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
7293
|
] });
|
|
7172
7294
|
};
|
|
7173
7295
|
var ListItems = ({
|
|
@@ -7179,7 +7301,7 @@ var ListItems = ({
|
|
|
7179
7301
|
const keys = useMemo8(() => query.data?.pages.flatMap((page) => page.keys) ?? [], [query.data]);
|
|
7180
7302
|
const fields = useMemo8(() => keys.map((key) => key.key), [keys]);
|
|
7181
7303
|
const { mutate: editItem } = useEditListItem();
|
|
7182
|
-
return /* @__PURE__ */
|
|
7304
|
+
return /* @__PURE__ */ jsx47(Fragment7, { children: keys.map(({ key, value }, i) => /* @__PURE__ */ jsxs25(
|
|
7183
7305
|
"tr",
|
|
7184
7306
|
{
|
|
7185
7307
|
"data-item-key": key,
|
|
@@ -7191,7 +7313,7 @@ var ListItems = ({
|
|
|
7191
7313
|
"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
7314
|
),
|
|
7193
7315
|
children: [
|
|
7194
|
-
/* @__PURE__ */
|
|
7316
|
+
/* @__PURE__ */ jsx47(
|
|
7195
7317
|
"td",
|
|
7196
7318
|
{
|
|
7197
7319
|
className: cn(
|
|
@@ -7201,23 +7323,23 @@ var ListItems = ({
|
|
|
7201
7323
|
children: key
|
|
7202
7324
|
}
|
|
7203
7325
|
),
|
|
7204
|
-
value !== void 0 && /* @__PURE__ */
|
|
7326
|
+
value !== void 0 && /* @__PURE__ */ jsx47(
|
|
7205
7327
|
"td",
|
|
7206
7328
|
{
|
|
7207
7329
|
className: cn("cursor-pointer truncate px-3", type === "zset" ? "w-24" : "max-w-0"),
|
|
7208
7330
|
children: value
|
|
7209
7331
|
}
|
|
7210
7332
|
),
|
|
7211
|
-
type !== "stream" && /* @__PURE__ */
|
|
7333
|
+
type !== "stream" && /* @__PURE__ */ jsx47(
|
|
7212
7334
|
"td",
|
|
7213
7335
|
{
|
|
7214
7336
|
className: "w-0 min-w-0 p-0 pr-2",
|
|
7215
7337
|
onClick: (e) => {
|
|
7216
7338
|
e.stopPropagation();
|
|
7217
7339
|
},
|
|
7218
|
-
children: /* @__PURE__ */
|
|
7219
|
-
type === "hash" && /* @__PURE__ */
|
|
7220
|
-
/* @__PURE__ */
|
|
7340
|
+
children: /* @__PURE__ */ jsxs25("div", { className: "flex items-center justify-end gap-2 pr-2", children: [
|
|
7341
|
+
type === "hash" && /* @__PURE__ */ jsx47(HashFieldTTLInfo, { dataKey, field: key, fields }),
|
|
7342
|
+
/* @__PURE__ */ jsx47(
|
|
7221
7343
|
DeleteKeyModal,
|
|
7222
7344
|
{
|
|
7223
7345
|
deletionType: "item",
|
|
@@ -7231,14 +7353,14 @@ var ListItems = ({
|
|
|
7231
7353
|
newKey: void 0
|
|
7232
7354
|
});
|
|
7233
7355
|
},
|
|
7234
|
-
children: /* @__PURE__ */
|
|
7356
|
+
children: /* @__PURE__ */ jsx47(
|
|
7235
7357
|
Button,
|
|
7236
7358
|
{
|
|
7237
7359
|
className: "",
|
|
7238
7360
|
size: "icon-sm",
|
|
7239
7361
|
variant: "secondary",
|
|
7240
7362
|
onClick: (e) => e.stopPropagation(),
|
|
7241
|
-
children: /* @__PURE__ */
|
|
7363
|
+
children: /* @__PURE__ */ jsx47(IconTrash2, { className: "size-4 text-zinc-500" })
|
|
7242
7364
|
}
|
|
7243
7365
|
)
|
|
7244
7366
|
}
|
|
@@ -7255,15 +7377,15 @@ var ListItems = ({
|
|
|
7255
7377
|
// src/components/databrowser/components/display/display-simple.tsx
|
|
7256
7378
|
import { useEffect as useEffect14 } from "react";
|
|
7257
7379
|
import { useForm as useForm4 } from "react-hook-form";
|
|
7258
|
-
import { Fragment as
|
|
7380
|
+
import { Fragment as Fragment8, jsx as jsx48, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
7259
7381
|
var EditorDisplay = ({ dataKey, type }) => {
|
|
7260
7382
|
const { data } = useFetchSimpleKey(dataKey, type);
|
|
7261
7383
|
if (data === null) {
|
|
7262
|
-
return /* @__PURE__ */
|
|
7384
|
+
return /* @__PURE__ */ jsx48(KeyDeleted, {});
|
|
7263
7385
|
}
|
|
7264
|
-
return /* @__PURE__ */
|
|
7265
|
-
/* @__PURE__ */
|
|
7266
|
-
/* @__PURE__ */
|
|
7386
|
+
return /* @__PURE__ */ jsxs26("div", { className: "flex h-full min-h-0 w-full flex-col gap-2 overflow-hidden", children: [
|
|
7387
|
+
/* @__PURE__ */ jsx48(DisplayHeader, { dataKey, type, content: data ?? void 0 }),
|
|
7388
|
+
/* @__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
7389
|
] });
|
|
7268
7390
|
};
|
|
7269
7391
|
var EditorDisplayForm = ({
|
|
@@ -7282,14 +7404,14 @@ var EditorDisplayForm = ({
|
|
|
7282
7404
|
const handleCancel = () => {
|
|
7283
7405
|
form.reset();
|
|
7284
7406
|
};
|
|
7285
|
-
return /* @__PURE__ */
|
|
7286
|
-
/* @__PURE__ */
|
|
7287
|
-
/* @__PURE__ */
|
|
7288
|
-
/* @__PURE__ */
|
|
7407
|
+
return /* @__PURE__ */ jsxs26(Fragment8, { children: [
|
|
7408
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex min-h-0 grow flex-col gap-1", children: [
|
|
7409
|
+
/* @__PURE__ */ jsx48("div", { className: "flex shrink-0 items-center gap-2", children: type === "json" ? /* @__PURE__ */ jsx48("div", {}) : selector }),
|
|
7410
|
+
/* @__PURE__ */ jsx48("div", { className: "min-h-0 grow rounded-md border border-zinc-300 bg-white p-2", children: editor })
|
|
7289
7411
|
] }),
|
|
7290
|
-
/* @__PURE__ */
|
|
7291
|
-
form.formState.isDirty && /* @__PURE__ */
|
|
7292
|
-
/* @__PURE__ */
|
|
7412
|
+
/* @__PURE__ */ jsx48("div", { className: "flex shrink-0 items-center gap-2", children: /* @__PURE__ */ jsxs26("div", { className: "ml-auto flex gap-2", children: [
|
|
7413
|
+
form.formState.isDirty && /* @__PURE__ */ jsx48(Button, { onClick: handleCancel, children: "Cancel" }),
|
|
7414
|
+
/* @__PURE__ */ jsx48(
|
|
7293
7415
|
Button,
|
|
7294
7416
|
{
|
|
7295
7417
|
variant: "primary",
|
|
@@ -7297,7 +7419,7 @@ var EditorDisplayForm = ({
|
|
|
7297
7419
|
await setKey(value);
|
|
7298
7420
|
}),
|
|
7299
7421
|
disabled: !form.formState.isValid || !form.formState.isDirty,
|
|
7300
|
-
children: /* @__PURE__ */
|
|
7422
|
+
children: /* @__PURE__ */ jsx48(Spinner, { isLoading: isSettingKey, isLoadingText: "Saving", children: "Save" })
|
|
7301
7423
|
}
|
|
7302
7424
|
)
|
|
7303
7425
|
] }) })
|
|
@@ -7305,15 +7427,15 @@ var EditorDisplayForm = ({
|
|
|
7305
7427
|
};
|
|
7306
7428
|
|
|
7307
7429
|
// src/components/databrowser/components/display/index.tsx
|
|
7308
|
-
import { Fragment as
|
|
7430
|
+
import { Fragment as Fragment9, jsx as jsx49, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
7309
7431
|
var DataDisplay = () => {
|
|
7310
7432
|
const { selectedKey } = useTab();
|
|
7311
7433
|
const { query } = useKeys();
|
|
7312
7434
|
const type = useKeyType(selectedKey);
|
|
7313
|
-
return /* @__PURE__ */
|
|
7435
|
+
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
7436
|
"Unrecognized key type: ",
|
|
7315
7437
|
type
|
|
7316
|
-
] }) }) : /* @__PURE__ */
|
|
7438
|
+
] }) }) : /* @__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
7439
|
};
|
|
7318
7440
|
|
|
7319
7441
|
// src/components/databrowser/components/header/index.tsx
|
|
@@ -7322,6 +7444,7 @@ import {
|
|
|
7322
7444
|
IconChevronDown as IconChevronDown2,
|
|
7323
7445
|
IconCircleCheck,
|
|
7324
7446
|
IconCirclePlus,
|
|
7447
|
+
IconLoader2 as IconLoader23,
|
|
7325
7448
|
IconPlus as IconPlus3,
|
|
7326
7449
|
IconSearch as IconSearch2,
|
|
7327
7450
|
IconSparkles
|
|
@@ -7332,7 +7455,7 @@ import { useState as useState13 } from "react";
|
|
|
7332
7455
|
import { DialogDescription as DialogDescription2 } from "@radix-ui/react-dialog";
|
|
7333
7456
|
import { IconPlus as IconPlus2 } from "@tabler/icons-react";
|
|
7334
7457
|
import { Controller as Controller4, useForm as useForm5 } from "react-hook-form";
|
|
7335
|
-
import { jsx as
|
|
7458
|
+
import { jsx as jsx50, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
7336
7459
|
function AddKeyModal() {
|
|
7337
7460
|
const { setSelectedKey } = useTab();
|
|
7338
7461
|
const [open, setOpen] = useState13(false);
|
|
@@ -7355,7 +7478,7 @@ function AddKeyModal() {
|
|
|
7355
7478
|
});
|
|
7356
7479
|
}, 100);
|
|
7357
7480
|
});
|
|
7358
|
-
return /* @__PURE__ */
|
|
7481
|
+
return /* @__PURE__ */ jsxs28(
|
|
7359
7482
|
Dialog,
|
|
7360
7483
|
{
|
|
7361
7484
|
open,
|
|
@@ -7364,35 +7487,35 @@ function AddKeyModal() {
|
|
|
7364
7487
|
setOpen(open2);
|
|
7365
7488
|
},
|
|
7366
7489
|
children: [
|
|
7367
|
-
/* @__PURE__ */
|
|
7490
|
+
/* @__PURE__ */ jsx50(SimpleTooltip, { content: "Add key", children: /* @__PURE__ */ jsx50(DialogTrigger, { asChild: true, children: /* @__PURE__ */ jsxs28(
|
|
7368
7491
|
Button,
|
|
7369
7492
|
{
|
|
7370
7493
|
variant: "primary",
|
|
7371
7494
|
"data-testid": "add-key-button",
|
|
7372
7495
|
className: "flex h-8 select-none items-center gap-1 rounded-lg pl-2 pr-3 text-sm font-medium",
|
|
7373
7496
|
children: [
|
|
7374
|
-
/* @__PURE__ */
|
|
7497
|
+
/* @__PURE__ */ jsx50(IconPlus2, { className: "size-5" }),
|
|
7375
7498
|
"Key"
|
|
7376
7499
|
]
|
|
7377
7500
|
}
|
|
7378
7501
|
) }) }),
|
|
7379
|
-
/* @__PURE__ */
|
|
7380
|
-
/* @__PURE__ */
|
|
7381
|
-
/* @__PURE__ */
|
|
7382
|
-
/* @__PURE__ */
|
|
7383
|
-
/* @__PURE__ */
|
|
7384
|
-
/* @__PURE__ */
|
|
7502
|
+
/* @__PURE__ */ jsxs28(DialogContent, { className: "max-w-[400px]", children: [
|
|
7503
|
+
/* @__PURE__ */ jsx50(DialogHeader, { children: /* @__PURE__ */ jsx50(DialogTitle, { children: "Create new key" }) }),
|
|
7504
|
+
/* @__PURE__ */ jsx50("div", { className: "sr-only", children: /* @__PURE__ */ jsx50(DialogDescription2, { children: "Create new key" }) }),
|
|
7505
|
+
/* @__PURE__ */ jsxs28("form", { className: "mt-4", onSubmit, children: [
|
|
7506
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex gap-1", children: [
|
|
7507
|
+
/* @__PURE__ */ jsx50(
|
|
7385
7508
|
Controller4,
|
|
7386
7509
|
{
|
|
7387
7510
|
control,
|
|
7388
7511
|
name: "type",
|
|
7389
|
-
render: ({ field }) => /* @__PURE__ */
|
|
7390
|
-
/* @__PURE__ */
|
|
7391
|
-
/* @__PURE__ */
|
|
7512
|
+
render: ({ field }) => /* @__PURE__ */ jsxs28(Select, { value: field.value, onValueChange: field.onChange, children: [
|
|
7513
|
+
/* @__PURE__ */ jsx50(SelectTrigger, { className: "h-8 w-auto pl-[3px] pr-8", children: /* @__PURE__ */ jsx50(SelectValue, {}) }),
|
|
7514
|
+
/* @__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
7515
|
] })
|
|
7393
7516
|
}
|
|
7394
7517
|
),
|
|
7395
|
-
/* @__PURE__ */
|
|
7518
|
+
/* @__PURE__ */ jsx50(
|
|
7396
7519
|
Controller4,
|
|
7397
7520
|
{
|
|
7398
7521
|
rules: {
|
|
@@ -7400,14 +7523,14 @@ function AddKeyModal() {
|
|
|
7400
7523
|
},
|
|
7401
7524
|
control,
|
|
7402
7525
|
name: "key",
|
|
7403
|
-
render: ({ field }) => /* @__PURE__ */
|
|
7526
|
+
render: ({ field }) => /* @__PURE__ */ jsx50(Input, { placeholder: "mykey", ...field, className: "h-8 grow" })
|
|
7404
7527
|
}
|
|
7405
7528
|
)
|
|
7406
7529
|
] }),
|
|
7407
|
-
formState.errors.key && /* @__PURE__ */
|
|
7408
|
-
/* @__PURE__ */
|
|
7409
|
-
/* @__PURE__ */
|
|
7410
|
-
/* @__PURE__ */
|
|
7530
|
+
formState.errors.key && /* @__PURE__ */ jsx50("p", { className: "mb-3 mt-2 text-xs text-red-500", children: formState.errors.key?.message }),
|
|
7531
|
+
/* @__PURE__ */ jsx50("p", { className: "mt-2 text-xs text-zinc-500", children: "After creating the key, you can edit the value" }),
|
|
7532
|
+
/* @__PURE__ */ jsxs28("div", { className: "mt-6 flex justify-end gap-2", children: [
|
|
7533
|
+
/* @__PURE__ */ jsx50(
|
|
7411
7534
|
Button,
|
|
7412
7535
|
{
|
|
7413
7536
|
type: "button",
|
|
@@ -7418,7 +7541,7 @@ function AddKeyModal() {
|
|
|
7418
7541
|
children: "Cancel"
|
|
7419
7542
|
}
|
|
7420
7543
|
),
|
|
7421
|
-
/* @__PURE__ */
|
|
7544
|
+
/* @__PURE__ */ jsx50(Button, { variant: "primary", type: "submit", children: /* @__PURE__ */ jsx50(Spinner, { isLoading: isPending, isLoadingText: "Creating", children: "Create" }) })
|
|
7422
7545
|
] })
|
|
7423
7546
|
] })
|
|
7424
7547
|
] })
|
|
@@ -7432,37 +7555,62 @@ import { useState as useState14 } from "react";
|
|
|
7432
7555
|
import { IconChevronRight as IconChevronRight3 } from "@tabler/icons-react";
|
|
7433
7556
|
import { useMutation as useMutation9 } from "@tanstack/react-query";
|
|
7434
7557
|
|
|
7558
|
+
// src/lib/scan-keys.ts
|
|
7559
|
+
async function scanKeys(redis, {
|
|
7560
|
+
match,
|
|
7561
|
+
type,
|
|
7562
|
+
count: count2 = 100,
|
|
7563
|
+
limit
|
|
7564
|
+
} = {}) {
|
|
7565
|
+
let cursor = "0";
|
|
7566
|
+
const result = [];
|
|
7567
|
+
while (true) {
|
|
7568
|
+
const [newCursor, keys] = await redis.scan(cursor, {
|
|
7569
|
+
count: count2,
|
|
7570
|
+
type,
|
|
7571
|
+
match
|
|
7572
|
+
});
|
|
7573
|
+
result.push(...keys);
|
|
7574
|
+
if (limit && result.length >= limit) {
|
|
7575
|
+
return result.slice(0, limit);
|
|
7576
|
+
}
|
|
7577
|
+
if (newCursor === "0") break;
|
|
7578
|
+
cursor = newCursor;
|
|
7579
|
+
}
|
|
7580
|
+
return result;
|
|
7581
|
+
}
|
|
7582
|
+
|
|
7435
7583
|
// src/components/databrowser/components/query-wizard/consent-prompt.tsx
|
|
7436
7584
|
import { IconAlertCircleFilled } from "@tabler/icons-react";
|
|
7437
|
-
import { jsx as
|
|
7585
|
+
import { jsx as jsx51, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
7438
7586
|
var ConsentPrompt = ({ onClose }) => {
|
|
7439
7587
|
const store = useDatabrowserStore();
|
|
7440
7588
|
const handleContinue = () => {
|
|
7441
7589
|
store.setAiDataSharingConsent(true);
|
|
7442
7590
|
};
|
|
7443
|
-
return /* @__PURE__ */
|
|
7444
|
-
/* @__PURE__ */
|
|
7445
|
-
/* @__PURE__ */
|
|
7446
|
-
/* @__PURE__ */
|
|
7591
|
+
return /* @__PURE__ */ jsxs29("div", { className: "flex max-w-[500px] flex-col gap-6 rounded-2xl p-6 shadow-lg", children: [
|
|
7592
|
+
/* @__PURE__ */ jsxs29("div", { className: "flex items-center gap-2", children: [
|
|
7593
|
+
/* @__PURE__ */ jsx51("h3", { className: "text-base font-semibold text-zinc-950", children: "AI Query Builder" }),
|
|
7594
|
+
/* @__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
7595
|
] }),
|
|
7448
|
-
/* @__PURE__ */
|
|
7449
|
-
/* @__PURE__ */
|
|
7450
|
-
/* @__PURE__ */
|
|
7451
|
-
/* @__PURE__ */
|
|
7452
|
-
/* @__PURE__ */
|
|
7596
|
+
/* @__PURE__ */ jsxs29("div", { className: "flex gap-3 rounded-xl border border-yellow-300 bg-yellow-50 p-5", children: [
|
|
7597
|
+
/* @__PURE__ */ jsx51(IconAlertCircleFilled, { className: "size-5 shrink-0 text-yellow-800" }),
|
|
7598
|
+
/* @__PURE__ */ jsxs29("div", { className: "flex flex-col gap-1.5", children: [
|
|
7599
|
+
/* @__PURE__ */ jsx51("p", { className: "text-sm font-semibold text-yellow-800", children: "AI Query Builder requires data sharing" }),
|
|
7600
|
+
/* @__PURE__ */ jsxs29("p", { className: "text-sm text-yellow-800", children: [
|
|
7453
7601
|
"To generate accurate queries, we'll send your",
|
|
7454
7602
|
" ",
|
|
7455
|
-
/* @__PURE__ */
|
|
7603
|
+
/* @__PURE__ */ jsx51("span", { className: "font-semibold", children: "index schema" }),
|
|
7456
7604
|
" and a",
|
|
7457
7605
|
" ",
|
|
7458
|
-
/* @__PURE__ */
|
|
7606
|
+
/* @__PURE__ */ jsx51("span", { className: "font-semibold", children: "small sample of your data" }),
|
|
7459
7607
|
" to AI models. This may include field names and example values."
|
|
7460
7608
|
] }),
|
|
7461
|
-
/* @__PURE__ */
|
|
7609
|
+
/* @__PURE__ */ jsx51("p", { className: "text-sm text-yellow-800", children: "Only used to generate the query you request." })
|
|
7462
7610
|
] })
|
|
7463
7611
|
] }),
|
|
7464
|
-
/* @__PURE__ */
|
|
7465
|
-
/* @__PURE__ */
|
|
7612
|
+
/* @__PURE__ */ jsxs29("div", { className: "flex items-center justify-end gap-2", children: [
|
|
7613
|
+
/* @__PURE__ */ jsx51(
|
|
7466
7614
|
"button",
|
|
7467
7615
|
{
|
|
7468
7616
|
onClick: onClose,
|
|
@@ -7470,7 +7618,7 @@ var ConsentPrompt = ({ onClose }) => {
|
|
|
7470
7618
|
children: "Cancel"
|
|
7471
7619
|
}
|
|
7472
7620
|
),
|
|
7473
|
-
/* @__PURE__ */
|
|
7621
|
+
/* @__PURE__ */ jsx51(
|
|
7474
7622
|
"button",
|
|
7475
7623
|
{
|
|
7476
7624
|
onClick: handleContinue,
|
|
@@ -7527,10 +7675,12 @@ export type DateField = {
|
|
|
7527
7675
|
|
|
7528
7676
|
export type KeywordField = {
|
|
7529
7677
|
type: "KEYWORD";
|
|
7678
|
+
from?: string;
|
|
7530
7679
|
};
|
|
7531
7680
|
|
|
7532
7681
|
export type FacetField = {
|
|
7533
7682
|
type: "FACET";
|
|
7683
|
+
from?: string;
|
|
7534
7684
|
};
|
|
7535
7685
|
|
|
7536
7686
|
export type DetailedField =
|
|
@@ -8404,7 +8554,7 @@ var useGenerateQuery = () => {
|
|
|
8404
8554
|
};
|
|
8405
8555
|
|
|
8406
8556
|
// src/components/databrowser/components/query-wizard/query-wizard-popover.tsx
|
|
8407
|
-
import { Fragment as
|
|
8557
|
+
import { Fragment as Fragment10, jsx as jsx52, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
8408
8558
|
var QueryWizardPopover = ({ onClose }) => {
|
|
8409
8559
|
const { valuesSearch, setValuesSearchQuery, setQueryBuilderMode } = useTab();
|
|
8410
8560
|
const { redisNoPipeline: redis } = useRedis();
|
|
@@ -8464,47 +8614,47 @@ var QueryWizardPopover = ({ onClose }) => {
|
|
|
8464
8614
|
}
|
|
8465
8615
|
};
|
|
8466
8616
|
if (isLoadingIndex) {
|
|
8467
|
-
return /* @__PURE__ */
|
|
8617
|
+
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
8618
|
}
|
|
8469
8619
|
if (!valuesSearch.index) {
|
|
8470
|
-
return /* @__PURE__ */
|
|
8471
|
-
/* @__PURE__ */
|
|
8472
|
-
/* @__PURE__ */
|
|
8620
|
+
return /* @__PURE__ */ jsxs30("div", { className: "flex w-[340px] flex-col items-center gap-2 rounded-2xl bg-white p-8", children: [
|
|
8621
|
+
/* @__PURE__ */ jsx52("p", { className: "text-sm font-medium text-zinc-700", children: "No index selected" }),
|
|
8622
|
+
/* @__PURE__ */ jsx52("p", { className: "text-center text-xs text-zinc-500", children: "Create a new index to use the Query Wizard." })
|
|
8473
8623
|
] });
|
|
8474
8624
|
}
|
|
8475
8625
|
if (aiDataSharingConsent === false) {
|
|
8476
|
-
return /* @__PURE__ */
|
|
8626
|
+
return /* @__PURE__ */ jsx52(ConsentPrompt, { onClose });
|
|
8477
8627
|
}
|
|
8478
|
-
return /* @__PURE__ */
|
|
8479
|
-
/* @__PURE__ */
|
|
8480
|
-
/* @__PURE__ */
|
|
8481
|
-
/* @__PURE__ */
|
|
8628
|
+
return /* @__PURE__ */ jsxs30("div", { className: "flex w-[500px] flex-col gap-6 rounded-2xl bg-white p-6", children: [
|
|
8629
|
+
/* @__PURE__ */ jsxs30("div", { className: "flex items-center gap-2", children: [
|
|
8630
|
+
/* @__PURE__ */ jsx52("h3", { className: "text-base font-semibold text-zinc-950", children: "AI Query Builder" }),
|
|
8631
|
+
/* @__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
8632
|
] }),
|
|
8483
|
-
generateQuery.error && /* @__PURE__ */
|
|
8484
|
-
/* @__PURE__ */
|
|
8485
|
-
/* @__PURE__ */
|
|
8633
|
+
generateQuery.error && /* @__PURE__ */ jsxs30("div", { className: "mt-2 rounded-md border border-yellow-300 bg-yellow-50 p-4", children: [
|
|
8634
|
+
/* @__PURE__ */ jsx52("p", { className: "!text-sm font-medium !text-yellow-800", children: generateQuery.error.name }),
|
|
8635
|
+
/* @__PURE__ */ jsx52("p", { className: "mt-0.5 !text-sm !text-yellow-800 opacity-90", children: generateQuery.error.message })
|
|
8486
8636
|
] }),
|
|
8487
|
-
/* @__PURE__ */
|
|
8488
|
-
/* @__PURE__ */
|
|
8637
|
+
/* @__PURE__ */ jsxs30("div", { className: "flex flex-col gap-5", children: [
|
|
8638
|
+
/* @__PURE__ */ jsxs30(
|
|
8489
8639
|
"button",
|
|
8490
8640
|
{
|
|
8491
8641
|
onClick: () => setShowIndexFields(!showIndexFields),
|
|
8492
8642
|
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
8643
|
children: [
|
|
8494
|
-
/* @__PURE__ */
|
|
8644
|
+
/* @__PURE__ */ jsx52(
|
|
8495
8645
|
IconChevronRight3,
|
|
8496
8646
|
{
|
|
8497
8647
|
className: `size-5 text-zinc-700 transition-transform ${showIndexFields ? "rotate-90" : ""}`
|
|
8498
8648
|
}
|
|
8499
8649
|
),
|
|
8500
|
-
/* @__PURE__ */
|
|
8650
|
+
/* @__PURE__ */ jsx52("span", { className: "text-sm font-medium text-zinc-700", children: "Show Index fields" })
|
|
8501
8651
|
]
|
|
8502
8652
|
}
|
|
8503
8653
|
),
|
|
8504
|
-
showIndexFields && indexData && /* @__PURE__ */
|
|
8505
|
-
/* @__PURE__ */
|
|
8506
|
-
/* @__PURE__ */
|
|
8507
|
-
/* @__PURE__ */
|
|
8654
|
+
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) }) }),
|
|
8655
|
+
/* @__PURE__ */ jsxs30("div", { className: "flex flex-col gap-1", children: [
|
|
8656
|
+
/* @__PURE__ */ jsx52(Label, { htmlFor: "query-input", className: "text-sm font-medium text-zinc-950", children: "Describe" }),
|
|
8657
|
+
/* @__PURE__ */ jsx52(
|
|
8508
8658
|
"textarea",
|
|
8509
8659
|
{
|
|
8510
8660
|
id: "query-input",
|
|
@@ -8516,14 +8666,14 @@ var QueryWizardPopover = ({ onClose }) => {
|
|
|
8516
8666
|
autoFocus: true
|
|
8517
8667
|
}
|
|
8518
8668
|
),
|
|
8519
|
-
/* @__PURE__ */
|
|
8520
|
-
/* @__PURE__ */
|
|
8521
|
-
/* @__PURE__ */
|
|
8669
|
+
/* @__PURE__ */ jsxs30("div", { children: [
|
|
8670
|
+
/* @__PURE__ */ jsx52("span", { className: "text-xs text-zinc-500", children: 'Example: Find people named "John", boost if older than 20.' }),
|
|
8671
|
+
/* @__PURE__ */ jsx52(DocsLink, { href: "https://upstash.com/docs/redis/search/query-operators/boolean-operators/overview" })
|
|
8522
8672
|
] })
|
|
8523
8673
|
] })
|
|
8524
8674
|
] }),
|
|
8525
|
-
/* @__PURE__ */
|
|
8526
|
-
/* @__PURE__ */
|
|
8675
|
+
/* @__PURE__ */ jsxs30("div", { className: "flex items-center justify-end gap-2", children: [
|
|
8676
|
+
/* @__PURE__ */ jsx52(
|
|
8527
8677
|
"button",
|
|
8528
8678
|
{
|
|
8529
8679
|
onClick: onClose,
|
|
@@ -8532,17 +8682,17 @@ var QueryWizardPopover = ({ onClose }) => {
|
|
|
8532
8682
|
children: "Cancel"
|
|
8533
8683
|
}
|
|
8534
8684
|
),
|
|
8535
|
-
/* @__PURE__ */
|
|
8685
|
+
/* @__PURE__ */ jsx52(
|
|
8536
8686
|
"button",
|
|
8537
8687
|
{
|
|
8538
8688
|
onClick: handleGenerate,
|
|
8539
8689
|
disabled: !input.trim() || generateQuery.isPending || fetchSampleKeys.isPending,
|
|
8540
8690
|
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__ */
|
|
8691
|
+
children: fetchSampleKeys.isPending ? /* @__PURE__ */ jsxs30(Fragment10, { children: [
|
|
8692
|
+
/* @__PURE__ */ jsx52(Spinner, { isLoading: true }),
|
|
8543
8693
|
"Sampling keys..."
|
|
8544
|
-
] }) : generateQuery.isPending ? /* @__PURE__ */
|
|
8545
|
-
/* @__PURE__ */
|
|
8694
|
+
] }) : generateQuery.isPending ? /* @__PURE__ */ jsxs30(Fragment10, { children: [
|
|
8695
|
+
/* @__PURE__ */ jsx52(Spinner, { isLoading: true }),
|
|
8546
8696
|
"Generating..."
|
|
8547
8697
|
] }) : "Generate Query"
|
|
8548
8698
|
}
|
|
@@ -8552,12 +8702,12 @@ var QueryWizardPopover = ({ onClose }) => {
|
|
|
8552
8702
|
};
|
|
8553
8703
|
|
|
8554
8704
|
// src/components/databrowser/components/search/create-index-modal.tsx
|
|
8555
|
-
import { jsx as
|
|
8705
|
+
import { jsx as jsx53, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
8556
8706
|
var CreateIndexModal = ({
|
|
8557
8707
|
open,
|
|
8558
8708
|
onOpenChange
|
|
8559
8709
|
}) => {
|
|
8560
|
-
return /* @__PURE__ */
|
|
8710
|
+
return /* @__PURE__ */ jsx53(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs31(
|
|
8561
8711
|
DialogContent,
|
|
8562
8712
|
{
|
|
8563
8713
|
className: "max-w-2xl",
|
|
@@ -8568,9 +8718,9 @@ var CreateIndexModal = ({
|
|
|
8568
8718
|
}
|
|
8569
8719
|
},
|
|
8570
8720
|
children: [
|
|
8571
|
-
/* @__PURE__ */
|
|
8572
|
-
/* @__PURE__ */
|
|
8573
|
-
/* @__PURE__ */
|
|
8721
|
+
/* @__PURE__ */ jsx53(DialogHeader, { children: /* @__PURE__ */ jsx53(DialogTitle, { children: "Create new Index" }) }),
|
|
8722
|
+
/* @__PURE__ */ jsx53("div", { className: "sr-only", children: /* @__PURE__ */ jsx53(DialogDescription, { children: "Create new search index" }) }),
|
|
8723
|
+
/* @__PURE__ */ jsx53(SearchDisplay, { isCreateModal: true, onClose: () => onOpenChange(false) })
|
|
8574
8724
|
]
|
|
8575
8725
|
}
|
|
8576
8726
|
) });
|
|
@@ -8578,7 +8728,7 @@ var CreateIndexModal = ({
|
|
|
8578
8728
|
|
|
8579
8729
|
// src/components/databrowser/components/search/edit-index-modal.tsx
|
|
8580
8730
|
import { useEffect as useEffect15 } from "react";
|
|
8581
|
-
import { jsx as
|
|
8731
|
+
import { jsx as jsx54, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
8582
8732
|
var EditIndexModal = ({
|
|
8583
8733
|
open,
|
|
8584
8734
|
onOpenChange,
|
|
@@ -8592,7 +8742,7 @@ var EditIndexModal = ({
|
|
|
8592
8742
|
onOpenChange(false);
|
|
8593
8743
|
}
|
|
8594
8744
|
}, [indexData, onOpenChange, isIndexLoading, open]);
|
|
8595
|
-
return /* @__PURE__ */
|
|
8745
|
+
return /* @__PURE__ */ jsx54(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs32(
|
|
8596
8746
|
DialogContent,
|
|
8597
8747
|
{
|
|
8598
8748
|
className: "min-h-[500px] max-w-2xl",
|
|
@@ -8603,9 +8753,9 @@ var EditIndexModal = ({
|
|
|
8603
8753
|
}
|
|
8604
8754
|
},
|
|
8605
8755
|
children: [
|
|
8606
|
-
/* @__PURE__ */
|
|
8607
|
-
/* @__PURE__ */
|
|
8608
|
-
indexName && /* @__PURE__ */
|
|
8756
|
+
/* @__PURE__ */ jsx54(DialogHeader, { children: /* @__PURE__ */ jsx54(DialogTitle, { children: "Edit Index" }) }),
|
|
8757
|
+
/* @__PURE__ */ jsx54("div", { className: "sr-only", children: /* @__PURE__ */ jsx54(DialogDescription, { children: "Edit search index schema" }) }),
|
|
8758
|
+
indexName && /* @__PURE__ */ jsx54(SearchDisplay, { indexName, isEditModal: true, onClose: () => onOpenChange(false) })
|
|
8609
8759
|
]
|
|
8610
8760
|
}
|
|
8611
8761
|
) });
|
|
@@ -8617,7 +8767,7 @@ import { useMutation as useMutation10 } from "@tanstack/react-query";
|
|
|
8617
8767
|
// src/components/common/reload-button.tsx
|
|
8618
8768
|
import { useState as useState15 } from "react";
|
|
8619
8769
|
import { IconLoader2 as IconLoader22, IconRefresh } from "@tabler/icons-react";
|
|
8620
|
-
import { jsx as
|
|
8770
|
+
import { jsx as jsx55 } from "react/jsx-runtime";
|
|
8621
8771
|
var ReloadButton = ({
|
|
8622
8772
|
onClick,
|
|
8623
8773
|
isLoading: isLoadingProp,
|
|
@@ -8631,20 +8781,20 @@ var ReloadButton = ({
|
|
|
8631
8781
|
setIsLoading(false);
|
|
8632
8782
|
}, 350);
|
|
8633
8783
|
};
|
|
8634
|
-
return /* @__PURE__ */
|
|
8784
|
+
return /* @__PURE__ */ jsx55("div", { children: /* @__PURE__ */ jsx55(SimpleTooltip, { content: tooltip, children: /* @__PURE__ */ jsx55(
|
|
8635
8785
|
Button,
|
|
8636
8786
|
{
|
|
8637
8787
|
variant: "outline",
|
|
8638
8788
|
size: "icon",
|
|
8639
8789
|
onClick: handleClick,
|
|
8640
8790
|
disabled: isLoading || isLoadingProp,
|
|
8641
|
-
children: isLoading ? /* @__PURE__ */
|
|
8791
|
+
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
8792
|
}
|
|
8643
8793
|
) }) });
|
|
8644
8794
|
};
|
|
8645
8795
|
|
|
8646
8796
|
// src/components/databrowser/components/header/refresh-button.tsx
|
|
8647
|
-
import { jsx as
|
|
8797
|
+
import { jsx as jsx56 } from "react/jsx-runtime";
|
|
8648
8798
|
var invalidateAll = () => {
|
|
8649
8799
|
queryClient.invalidateQueries({ queryKey: [FETCH_KEYS_QUERY_KEY] });
|
|
8650
8800
|
queryClient.invalidateQueries({ queryKey: [FETCH_LIST_ITEMS_QUERY_KEY] });
|
|
@@ -8663,7 +8813,7 @@ var RefreshButton = () => {
|
|
|
8663
8813
|
},
|
|
8664
8814
|
onSettled: invalidateAll
|
|
8665
8815
|
});
|
|
8666
|
-
return /* @__PURE__ */
|
|
8816
|
+
return /* @__PURE__ */ jsx56(
|
|
8667
8817
|
ReloadButton,
|
|
8668
8818
|
{
|
|
8669
8819
|
onClick: () => reindex.mutate(),
|
|
@@ -8676,7 +8826,7 @@ var RefreshButton = () => {
|
|
|
8676
8826
|
// src/components/databrowser/components/header/search-input.tsx
|
|
8677
8827
|
import { useEffect as useEffect16, useRef as useRef5, useState as useState16 } from "react";
|
|
8678
8828
|
import { IconX as IconX2 } from "@tabler/icons-react";
|
|
8679
|
-
import { jsx as
|
|
8829
|
+
import { jsx as jsx57, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
8680
8830
|
var dedupeSearchHistory = (history) => {
|
|
8681
8831
|
const seen = /* @__PURE__ */ new Set();
|
|
8682
8832
|
return history.filter((item) => {
|
|
@@ -8732,9 +8882,9 @@ var SearchInput = () => {
|
|
|
8732
8882
|
}
|
|
8733
8883
|
}
|
|
8734
8884
|
};
|
|
8735
|
-
return /* @__PURE__ */
|
|
8736
|
-
/* @__PURE__ */
|
|
8737
|
-
/* @__PURE__ */
|
|
8885
|
+
return /* @__PURE__ */ jsxs33("div", { className: "relative grow", children: [
|
|
8886
|
+
/* @__PURE__ */ jsxs33(Popover, { open: isFocus && filteredHistory.length > 0, children: [
|
|
8887
|
+
/* @__PURE__ */ jsx57(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx57("div", { className: "h-8 rounded-md border border-zinc-300 font-normal", children: /* @__PURE__ */ jsx57(
|
|
8738
8888
|
Input,
|
|
8739
8889
|
{
|
|
8740
8890
|
ref: inputRef,
|
|
@@ -8753,7 +8903,7 @@ var SearchInput = () => {
|
|
|
8753
8903
|
onBlur: () => setIsFocus(false)
|
|
8754
8904
|
}
|
|
8755
8905
|
) }) }),
|
|
8756
|
-
/* @__PURE__ */
|
|
8906
|
+
/* @__PURE__ */ jsx57(
|
|
8757
8907
|
PopoverContent,
|
|
8758
8908
|
{
|
|
8759
8909
|
className: "w-[--radix-popover-trigger-width] divide-y px-3 py-2 text-[13px] text-zinc-900",
|
|
@@ -8762,7 +8912,7 @@ var SearchInput = () => {
|
|
|
8762
8912
|
e.preventDefault();
|
|
8763
8913
|
e.stopPropagation();
|
|
8764
8914
|
},
|
|
8765
|
-
children: filteredHistory.map((item, index) => /* @__PURE__ */
|
|
8915
|
+
children: filteredHistory.map((item, index) => /* @__PURE__ */ jsx57("div", { className: "w-full py-[3px]", children: /* @__PURE__ */ jsx57(
|
|
8766
8916
|
"button",
|
|
8767
8917
|
{
|
|
8768
8918
|
ref: (el) => {
|
|
@@ -8777,7 +8927,7 @@ var SearchInput = () => {
|
|
|
8777
8927
|
}
|
|
8778
8928
|
)
|
|
8779
8929
|
] }),
|
|
8780
|
-
state && /* @__PURE__ */
|
|
8930
|
+
state && /* @__PURE__ */ jsxs33(
|
|
8781
8931
|
Button,
|
|
8782
8932
|
{
|
|
8783
8933
|
type: "button",
|
|
@@ -8789,8 +8939,8 @@ var SearchInput = () => {
|
|
|
8789
8939
|
setState("");
|
|
8790
8940
|
},
|
|
8791
8941
|
children: [
|
|
8792
|
-
/* @__PURE__ */
|
|
8793
|
-
/* @__PURE__ */
|
|
8942
|
+
/* @__PURE__ */ jsx57(IconX2, { size: 16 }),
|
|
8943
|
+
/* @__PURE__ */ jsx57("span", { className: "sr-only", children: "Clear" })
|
|
8794
8944
|
]
|
|
8795
8945
|
}
|
|
8796
8946
|
),
|
|
@@ -8799,7 +8949,7 @@ var SearchInput = () => {
|
|
|
8799
8949
|
};
|
|
8800
8950
|
|
|
8801
8951
|
// src/components/databrowser/components/header/type-selector.tsx
|
|
8802
|
-
import { jsx as
|
|
8952
|
+
import { jsx as jsx58, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
8803
8953
|
var ALL_TYPES_KEY = "all";
|
|
8804
8954
|
function DataTypeSelector({ allowSearch }) {
|
|
8805
8955
|
const { search, setSearchType } = useTab();
|
|
@@ -8807,7 +8957,7 @@ function DataTypeSelector({ allowSearch }) {
|
|
|
8807
8957
|
[ALL_TYPES_KEY, "All Types"],
|
|
8808
8958
|
...Object.entries(DATA_TYPE_NAMES).filter(([key]) => allowSearch || key !== "search")
|
|
8809
8959
|
];
|
|
8810
|
-
return /* @__PURE__ */
|
|
8960
|
+
return /* @__PURE__ */ jsxs34(
|
|
8811
8961
|
Select,
|
|
8812
8962
|
{
|
|
8813
8963
|
onValueChange: (type) => {
|
|
@@ -8819,20 +8969,20 @@ function DataTypeSelector({ allowSearch }) {
|
|
|
8819
8969
|
},
|
|
8820
8970
|
value: search.type === void 0 ? ALL_TYPES_KEY : search.type,
|
|
8821
8971
|
children: [
|
|
8822
|
-
/* @__PURE__ */
|
|
8823
|
-
/* @__PURE__ */
|
|
8972
|
+
/* @__PURE__ */ jsx58(SelectTrigger, { className: "!w-auto shrink-0 select-none whitespace-nowrap border-zinc-300 pr-8", children: /* @__PURE__ */ jsx58(SelectValue, {}) }),
|
|
8973
|
+
/* @__PURE__ */ jsx58(SelectContent, { children: /* @__PURE__ */ jsx58(SelectGroup, { children: entries.map(([key, value]) => /* @__PURE__ */ jsx58(SelectItem, { value: key, children: value }, key)) }) })
|
|
8824
8974
|
]
|
|
8825
8975
|
}
|
|
8826
8976
|
);
|
|
8827
8977
|
}
|
|
8828
8978
|
|
|
8829
8979
|
// src/components/databrowser/components/header/index.tsx
|
|
8830
|
-
import { Fragment as
|
|
8980
|
+
import { Fragment as Fragment11, jsx as jsx59, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
8831
8981
|
var Header = ({ tabType, allowSearch }) => {
|
|
8832
8982
|
const { isValuesSearchSelected, setIsValuesSearchSelected } = useTab();
|
|
8833
|
-
return /* @__PURE__ */
|
|
8834
|
-
/* @__PURE__ */
|
|
8835
|
-
tabType === "all" && /* @__PURE__ */
|
|
8983
|
+
return /* @__PURE__ */ jsxs35("div", { className: "flex items-center justify-between gap-1.5", children: [
|
|
8984
|
+
/* @__PURE__ */ jsxs35("div", { className: "flex grow items-center gap-1.5", children: [
|
|
8985
|
+
tabType === "all" && /* @__PURE__ */ jsx59(
|
|
8836
8986
|
Segmented,
|
|
8837
8987
|
{
|
|
8838
8988
|
options: [
|
|
@@ -8842,9 +8992,9 @@ var Header = ({ tabType, allowSearch }) => {
|
|
|
8842
8992
|
},
|
|
8843
8993
|
{
|
|
8844
8994
|
key: "values",
|
|
8845
|
-
label: /* @__PURE__ */
|
|
8995
|
+
label: /* @__PURE__ */ jsxs35("div", { className: "flex items-center gap-1", children: [
|
|
8846
8996
|
"Search",
|
|
8847
|
-
/* @__PURE__ */
|
|
8997
|
+
/* @__PURE__ */ jsx59("div", { className: "flex h-[18px] items-center rounded-md bg-emerald-100 px-[5px] text-[11px] text-emerald-700", children: "NEW" })
|
|
8848
8998
|
] })
|
|
8849
8999
|
}
|
|
8850
9000
|
],
|
|
@@ -8857,15 +9007,15 @@ var Header = ({ tabType, allowSearch }) => {
|
|
|
8857
9007
|
selectedClassName: "bg-emerald-50 text-emerald-800"
|
|
8858
9008
|
}
|
|
8859
9009
|
),
|
|
8860
|
-
isValuesSearchSelected ? /* @__PURE__ */
|
|
8861
|
-
/* @__PURE__ */
|
|
8862
|
-
/* @__PURE__ */
|
|
9010
|
+
isValuesSearchSelected ? /* @__PURE__ */ jsx59(IndexSelector, {}) : /* @__PURE__ */ jsxs35(Fragment11, { children: [
|
|
9011
|
+
/* @__PURE__ */ jsx59(DataTypeSelector, { allowSearch }),
|
|
9012
|
+
/* @__PURE__ */ jsx59(SearchInput, {})
|
|
8863
9013
|
] })
|
|
8864
9014
|
] }),
|
|
8865
|
-
/* @__PURE__ */
|
|
8866
|
-
isValuesSearchSelected && /* @__PURE__ */
|
|
8867
|
-
/* @__PURE__ */
|
|
8868
|
-
isValuesSearchSelected ? /* @__PURE__ */
|
|
9015
|
+
/* @__PURE__ */ jsxs35("div", { className: "flex items-center gap-1.5", children: [
|
|
9016
|
+
isValuesSearchSelected && /* @__PURE__ */ jsx59(WizardButton, {}),
|
|
9017
|
+
/* @__PURE__ */ jsx59(RefreshButton, {}),
|
|
9018
|
+
isValuesSearchSelected ? /* @__PURE__ */ jsx59(AddIndexButton, {}) : /* @__PURE__ */ jsx59(AddKeyModal, {})
|
|
8869
9019
|
] })
|
|
8870
9020
|
] });
|
|
8871
9021
|
};
|
|
@@ -8874,26 +9024,33 @@ var IndexSelector = () => {
|
|
|
8874
9024
|
valuesSearch: { index },
|
|
8875
9025
|
setValuesSearchIndex
|
|
8876
9026
|
} = useTab();
|
|
8877
|
-
const { data: indexes, isLoading } = useFetchSearchIndexes();
|
|
8878
9027
|
const [open, setOpen] = useState17(false);
|
|
9028
|
+
const [search, setSearch] = useState17("");
|
|
9029
|
+
const debouncedSearch = useDebounce(search, 150);
|
|
9030
|
+
const match = debouncedSearch ? `${debouncedSearch}*` : void 0;
|
|
9031
|
+
const {
|
|
9032
|
+
data: indexes,
|
|
9033
|
+
isLoading,
|
|
9034
|
+
hasNextPage,
|
|
9035
|
+
fetchNextPage,
|
|
9036
|
+
isFetchingNextPage
|
|
9037
|
+
} = useFetchSearchIndexes({ match });
|
|
9038
|
+
const [editingIndex, setEditingIndex] = useState17();
|
|
8879
9039
|
useEffect17(() => {
|
|
8880
|
-
if (!indexes || isLoading) return;
|
|
9040
|
+
if (!indexes || isLoading || debouncedSearch) return;
|
|
8881
9041
|
if (index && !indexes.includes(index)) {
|
|
8882
9042
|
setValuesSearchIndex("");
|
|
8883
9043
|
} else if (!index && indexes.length > 0) {
|
|
8884
9044
|
setValuesSearchIndex(indexes[0]);
|
|
8885
9045
|
}
|
|
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()));
|
|
9046
|
+
}, [indexes, index, isLoading, setValuesSearchIndex, debouncedSearch]);
|
|
8890
9047
|
const handleEditIndex = (indexName) => {
|
|
8891
9048
|
setOpen(false);
|
|
8892
9049
|
setEditingIndex(indexName);
|
|
8893
9050
|
};
|
|
8894
|
-
return /* @__PURE__ */
|
|
8895
|
-
/* @__PURE__ */
|
|
8896
|
-
/* @__PURE__ */
|
|
9051
|
+
return /* @__PURE__ */ jsxs35("div", { className: "flex", children: [
|
|
9052
|
+
/* @__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" }),
|
|
9053
|
+
/* @__PURE__ */ jsxs35(
|
|
8897
9054
|
Popover,
|
|
8898
9055
|
{
|
|
8899
9056
|
open,
|
|
@@ -8903,16 +9060,16 @@ var IndexSelector = () => {
|
|
|
8903
9060
|
},
|
|
8904
9061
|
modal: false,
|
|
8905
9062
|
children: [
|
|
8906
|
-
/* @__PURE__ */
|
|
8907
|
-
/* @__PURE__ */
|
|
8908
|
-
/* @__PURE__ */
|
|
9063
|
+
/* @__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: [
|
|
9064
|
+
/* @__PURE__ */ jsx59("span", { className: "truncate", children: index || "Select an index" }),
|
|
9065
|
+
/* @__PURE__ */ jsx59(IconChevronDown2, { className: "size-4 shrink-0 opacity-50" })
|
|
8909
9066
|
] }) }),
|
|
8910
|
-
/* @__PURE__ */
|
|
8911
|
-
/* @__PURE__ */
|
|
8912
|
-
/* @__PURE__ */
|
|
8913
|
-
/* @__PURE__ */
|
|
8914
|
-
/* @__PURE__ */
|
|
8915
|
-
/* @__PURE__ */
|
|
9067
|
+
/* @__PURE__ */ jsx59(PopoverContent, { className: "p-2", align: "center", children: /* @__PURE__ */ jsxs35("div", { className: "flex flex-col gap-2", children: [
|
|
9068
|
+
/* @__PURE__ */ jsx59(CreateIndexButton, {}),
|
|
9069
|
+
/* @__PURE__ */ jsx59("div", { className: "h-px bg-zinc-100" }),
|
|
9070
|
+
/* @__PURE__ */ jsxs35("div", { className: "flex h-9 items-center rounded-md border border-zinc-300 px-2", children: [
|
|
9071
|
+
/* @__PURE__ */ jsx59(IconSearch2, { className: "size-5 text-zinc-400" }),
|
|
9072
|
+
/* @__PURE__ */ jsx59(
|
|
8916
9073
|
"input",
|
|
8917
9074
|
{
|
|
8918
9075
|
value: search,
|
|
@@ -8922,14 +9079,15 @@ var IndexSelector = () => {
|
|
|
8922
9079
|
}
|
|
8923
9080
|
)
|
|
8924
9081
|
] }),
|
|
8925
|
-
/* @__PURE__ */
|
|
8926
|
-
|
|
8927
|
-
|
|
9082
|
+
/* @__PURE__ */ jsxs35("div", { className: "max-h-[200px] overflow-y-auto", children: [
|
|
9083
|
+
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" }) }),
|
|
9084
|
+
!isLoading && indexes?.length === 0 && /* @__PURE__ */ jsx59("div", { className: "py-4 text-center text-sm text-zinc-500", children: "No indexes found" }),
|
|
9085
|
+
indexes?.map((idx) => /* @__PURE__ */ jsxs35(
|
|
8928
9086
|
"div",
|
|
8929
9087
|
{
|
|
8930
9088
|
className: "flex h-9 items-center rounded-md px-2 transition-colors hover:bg-zinc-100 dark:hover:bg-zinc-200",
|
|
8931
9089
|
children: [
|
|
8932
|
-
/* @__PURE__ */
|
|
9090
|
+
/* @__PURE__ */ jsxs35(
|
|
8933
9091
|
"button",
|
|
8934
9092
|
{
|
|
8935
9093
|
onClick: () => {
|
|
@@ -8938,21 +9096,21 @@ var IndexSelector = () => {
|
|
|
8938
9096
|
},
|
|
8939
9097
|
className: "flex flex-1 items-center gap-2 text-left text-sm",
|
|
8940
9098
|
children: [
|
|
8941
|
-
/* @__PURE__ */
|
|
9099
|
+
/* @__PURE__ */ jsx59(
|
|
8942
9100
|
"span",
|
|
8943
9101
|
{
|
|
8944
9102
|
className: cn(
|
|
8945
9103
|
"flex size-5 items-center justify-center",
|
|
8946
9104
|
idx === index ? "text-emerald-600" : "text-transparent"
|
|
8947
9105
|
),
|
|
8948
|
-
children: /* @__PURE__ */
|
|
9106
|
+
children: /* @__PURE__ */ jsx59(IconCircleCheck, { className: "size-5" })
|
|
8949
9107
|
}
|
|
8950
9108
|
),
|
|
8951
|
-
/* @__PURE__ */
|
|
9109
|
+
/* @__PURE__ */ jsx59("span", { className: "truncate", children: idx })
|
|
8952
9110
|
]
|
|
8953
9111
|
}
|
|
8954
9112
|
),
|
|
8955
|
-
/* @__PURE__ */
|
|
9113
|
+
/* @__PURE__ */ jsx59(
|
|
8956
9114
|
"button",
|
|
8957
9115
|
{
|
|
8958
9116
|
onClick: (event) => {
|
|
@@ -8967,13 +9125,22 @@ var IndexSelector = () => {
|
|
|
8967
9125
|
]
|
|
8968
9126
|
},
|
|
8969
9127
|
idx
|
|
8970
|
-
))
|
|
9128
|
+
)),
|
|
9129
|
+
hasNextPage && /* @__PURE__ */ jsx59(
|
|
9130
|
+
"button",
|
|
9131
|
+
{
|
|
9132
|
+
onClick: () => fetchNextPage(),
|
|
9133
|
+
disabled: isFetchingNextPage,
|
|
9134
|
+
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",
|
|
9135
|
+
children: isFetchingNextPage ? "Loading..." : "Load more"
|
|
9136
|
+
}
|
|
9137
|
+
)
|
|
8971
9138
|
] })
|
|
8972
9139
|
] }) })
|
|
8973
9140
|
]
|
|
8974
9141
|
}
|
|
8975
9142
|
),
|
|
8976
|
-
/* @__PURE__ */
|
|
9143
|
+
/* @__PURE__ */ jsx59(
|
|
8977
9144
|
EditIndexModal,
|
|
8978
9145
|
{
|
|
8979
9146
|
open: Boolean(editingIndex),
|
|
@@ -8985,8 +9152,8 @@ var IndexSelector = () => {
|
|
|
8985
9152
|
};
|
|
8986
9153
|
var CreateIndexButton = () => {
|
|
8987
9154
|
const [open, setOpen] = useState17(false);
|
|
8988
|
-
return /* @__PURE__ */
|
|
8989
|
-
/* @__PURE__ */
|
|
9155
|
+
return /* @__PURE__ */ jsxs35(Fragment11, { children: [
|
|
9156
|
+
/* @__PURE__ */ jsxs35(
|
|
8990
9157
|
"button",
|
|
8991
9158
|
{
|
|
8992
9159
|
onClick: (e) => {
|
|
@@ -8995,39 +9162,39 @@ var CreateIndexButton = () => {
|
|
|
8995
9162
|
},
|
|
8996
9163
|
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
9164
|
children: [
|
|
8998
|
-
/* @__PURE__ */
|
|
8999
|
-
/* @__PURE__ */
|
|
9165
|
+
/* @__PURE__ */ jsx59(IconCirclePlus, { className: "size-5" }),
|
|
9166
|
+
/* @__PURE__ */ jsx59("span", { className: "underline", children: "Create a new Index" })
|
|
9000
9167
|
]
|
|
9001
9168
|
}
|
|
9002
9169
|
),
|
|
9003
|
-
/* @__PURE__ */
|
|
9170
|
+
/* @__PURE__ */ jsx59(CreateIndexModal, { open, onOpenChange: setOpen })
|
|
9004
9171
|
] });
|
|
9005
9172
|
};
|
|
9006
9173
|
var AddIndexButton = () => {
|
|
9007
9174
|
const [open, setOpen] = useState17(false);
|
|
9008
|
-
return /* @__PURE__ */
|
|
9009
|
-
/* @__PURE__ */
|
|
9175
|
+
return /* @__PURE__ */ jsxs35(Fragment11, { children: [
|
|
9176
|
+
/* @__PURE__ */ jsx59(SimpleTooltip, { content: "Create new Index", children: /* @__PURE__ */ jsxs35(
|
|
9010
9177
|
Button,
|
|
9011
9178
|
{
|
|
9012
9179
|
variant: "primary",
|
|
9013
9180
|
onClick: () => setOpen(true),
|
|
9014
9181
|
className: "flex h-8 select-none items-center gap-1 rounded-lg pl-2 pr-3 text-sm font-medium",
|
|
9015
9182
|
children: [
|
|
9016
|
-
/* @__PURE__ */
|
|
9183
|
+
/* @__PURE__ */ jsx59(IconPlus3, { className: "size-5" }),
|
|
9017
9184
|
"Index"
|
|
9018
9185
|
]
|
|
9019
9186
|
}
|
|
9020
9187
|
) }),
|
|
9021
|
-
/* @__PURE__ */
|
|
9188
|
+
/* @__PURE__ */ jsx59(CreateIndexModal, { open, onOpenChange: setOpen })
|
|
9022
9189
|
] });
|
|
9023
9190
|
};
|
|
9024
9191
|
var WizardButton = () => {
|
|
9025
9192
|
const queryWizard = useQueryWizardFn();
|
|
9026
9193
|
const [open, setOpen] = useState17(false);
|
|
9027
9194
|
if (!queryWizard) return null;
|
|
9028
|
-
return /* @__PURE__ */
|
|
9029
|
-
/* @__PURE__ */
|
|
9030
|
-
/* @__PURE__ */
|
|
9195
|
+
return /* @__PURE__ */ jsxs35(Popover, { open, onOpenChange: setOpen, modal: false, children: [
|
|
9196
|
+
/* @__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" }) }) }) }),
|
|
9197
|
+
/* @__PURE__ */ jsx59(
|
|
9031
9198
|
PopoverContent,
|
|
9032
9199
|
{
|
|
9033
9200
|
side: "bottom",
|
|
@@ -9035,18 +9202,18 @@ var WizardButton = () => {
|
|
|
9035
9202
|
alignOffset: -124,
|
|
9036
9203
|
avoidCollisions: false,
|
|
9037
9204
|
className: "w-auto p-0",
|
|
9038
|
-
children: /* @__PURE__ */
|
|
9205
|
+
children: /* @__PURE__ */ jsx59(QueryWizardPopover, { onClose: () => setOpen(false) })
|
|
9039
9206
|
}
|
|
9040
9207
|
)
|
|
9041
9208
|
] });
|
|
9042
9209
|
};
|
|
9043
9210
|
|
|
9044
9211
|
// src/components/databrowser/components/header-error.tsx
|
|
9045
|
-
import { jsx as
|
|
9212
|
+
import { jsx as jsx60 } from "react/jsx-runtime";
|
|
9046
9213
|
var HeaderError = () => {
|
|
9047
9214
|
const { query } = useKeys();
|
|
9048
9215
|
if (!query.error) return null;
|
|
9049
|
-
return /* @__PURE__ */
|
|
9216
|
+
return /* @__PURE__ */ jsx60("p", { className: "text-sm text-red-600 dark:text-red-400", children: formatUpstashErrorMessage(query.error) });
|
|
9050
9217
|
};
|
|
9051
9218
|
|
|
9052
9219
|
// src/components/databrowser/components/search/query-editor.tsx
|
|
@@ -9109,7 +9276,7 @@ type Query = RootQueryFilter<SchemaFields>;
|
|
|
9109
9276
|
};
|
|
9110
9277
|
|
|
9111
9278
|
// src/components/databrowser/components/search/query-editor.tsx
|
|
9112
|
-
import { jsx as
|
|
9279
|
+
import { jsx as jsx61 } from "react/jsx-runtime";
|
|
9113
9280
|
var QUERY_PREFIX = "const query: Query = {";
|
|
9114
9281
|
var QUERY_DEFAULT = "const query: Query = {}";
|
|
9115
9282
|
var isQueryStringValid = (value) => {
|
|
@@ -9117,7 +9284,7 @@ var isQueryStringValid = (value) => {
|
|
|
9117
9284
|
};
|
|
9118
9285
|
var QueryEditor = ({ value, onChange, height, schema }) => {
|
|
9119
9286
|
const typeDefinitions = useMemo9(() => generateTypeDefinitions(schema), [schema]);
|
|
9120
|
-
return /* @__PURE__ */
|
|
9287
|
+
return /* @__PURE__ */ jsx61(
|
|
9121
9288
|
EditorWithTypes,
|
|
9122
9289
|
{
|
|
9123
9290
|
value,
|
|
@@ -9133,13 +9300,13 @@ var QueryEditor = ({ value, onChange, height, schema }) => {
|
|
|
9133
9300
|
};
|
|
9134
9301
|
|
|
9135
9302
|
// src/components/databrowser/components/query-builder.tsx
|
|
9136
|
-
import { jsx as
|
|
9303
|
+
import { jsx as jsx62 } from "react/jsx-runtime";
|
|
9137
9304
|
var QueryBuilder = () => {
|
|
9138
9305
|
const { valuesSearch, setValuesSearchQuery } = useTab();
|
|
9139
9306
|
const { data: indexDetails } = useFetchSearchIndex(valuesSearch.index);
|
|
9140
9307
|
const editorValue = PREFIX + (valuesSearch.query || "{}");
|
|
9141
9308
|
if (!indexDetails) return;
|
|
9142
|
-
return /* @__PURE__ */
|
|
9309
|
+
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
9310
|
QueryEditor,
|
|
9144
9311
|
{
|
|
9145
9312
|
value: editorValue,
|
|
@@ -9154,7 +9321,7 @@ var QueryBuilder = () => {
|
|
|
9154
9321
|
|
|
9155
9322
|
// src/components/databrowser/components/query-builder-error.tsx
|
|
9156
9323
|
import { useEffect as useEffect18, useState as useState18 } from "react";
|
|
9157
|
-
import { jsx as
|
|
9324
|
+
import { jsx as jsx63 } from "react/jsx-runtime";
|
|
9158
9325
|
var ERROR_TIMEOUT = 5e3;
|
|
9159
9326
|
var QueryBuilderError = ({
|
|
9160
9327
|
error,
|
|
@@ -9176,7 +9343,7 @@ var QueryBuilderError = ({
|
|
|
9176
9343
|
return () => clearTimeout(timeout);
|
|
9177
9344
|
}, [error, autoHide]);
|
|
9178
9345
|
if (!displayedError) return;
|
|
9179
|
-
return /* @__PURE__ */
|
|
9346
|
+
return /* @__PURE__ */ jsx63(
|
|
9180
9347
|
"p",
|
|
9181
9348
|
{
|
|
9182
9349
|
className: cn(
|
|
@@ -9197,7 +9364,7 @@ import { IconCode, IconDatabase, IconSearch as IconSearch3, IconSparkles as Icon
|
|
|
9197
9364
|
|
|
9198
9365
|
// src/components/databrowser/components/import-sample-dataset-modal.tsx
|
|
9199
9366
|
import { useEffect as useEffect19, useState as useState19 } from "react";
|
|
9200
|
-
import { Fragment as
|
|
9367
|
+
import { Fragment as Fragment12, jsx as jsx64, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
9201
9368
|
var INDEX_NAME = "users-index";
|
|
9202
9369
|
var USER_COUNT = 100;
|
|
9203
9370
|
var firstNames = [
|
|
@@ -9392,14 +9559,14 @@ var ImportSampleDatasetModal = ({
|
|
|
9392
9559
|
}
|
|
9393
9560
|
};
|
|
9394
9561
|
const isRunning = status !== void 0;
|
|
9395
|
-
return /* @__PURE__ */
|
|
9562
|
+
return /* @__PURE__ */ jsx64(
|
|
9396
9563
|
Dialog,
|
|
9397
9564
|
{
|
|
9398
9565
|
open,
|
|
9399
9566
|
onOpenChange: (isOpen) => {
|
|
9400
9567
|
if (!isRunning) onOpenChange(isOpen);
|
|
9401
9568
|
},
|
|
9402
|
-
children: /* @__PURE__ */
|
|
9569
|
+
children: /* @__PURE__ */ jsxs36(
|
|
9403
9570
|
DialogContent,
|
|
9404
9571
|
{
|
|
9405
9572
|
onInteractOutside: (e) => {
|
|
@@ -9409,28 +9576,28 @@ var ImportSampleDatasetModal = ({
|
|
|
9409
9576
|
if (isRunning) e.preventDefault();
|
|
9410
9577
|
},
|
|
9411
9578
|
children: [
|
|
9412
|
-
/* @__PURE__ */
|
|
9413
|
-
/* @__PURE__ */
|
|
9414
|
-
!isRunning && !error && /* @__PURE__ */
|
|
9579
|
+
/* @__PURE__ */ jsxs36(DialogHeader, { children: [
|
|
9580
|
+
/* @__PURE__ */ jsx64(DialogTitle, { children: "Import Sample Dataset" }),
|
|
9581
|
+
!isRunning && !error && /* @__PURE__ */ jsxs36(DialogDescription, { children: [
|
|
9415
9582
|
"This will create a ",
|
|
9416
|
-
/* @__PURE__ */
|
|
9583
|
+
/* @__PURE__ */ jsx64("strong", { children: "users-index" }),
|
|
9417
9584
|
" with 100 sample user records.",
|
|
9418
|
-
/* @__PURE__ */
|
|
9419
|
-
/* @__PURE__ */
|
|
9585
|
+
/* @__PURE__ */ jsx64("br", {}),
|
|
9586
|
+
/* @__PURE__ */ jsx64("br", {}),
|
|
9420
9587
|
"Each user has name, age, gender, student/employment status, and contact information."
|
|
9421
9588
|
] })
|
|
9422
9589
|
] }),
|
|
9423
|
-
isRunning && /* @__PURE__ */
|
|
9424
|
-
/* @__PURE__ */
|
|
9425
|
-
/* @__PURE__ */
|
|
9590
|
+
isRunning && /* @__PURE__ */ jsxs36("div", { className: "flex flex-col gap-2 py-4", children: [
|
|
9591
|
+
/* @__PURE__ */ jsx64("p", { className: "text-sm text-zinc-500", children: status }),
|
|
9592
|
+
/* @__PURE__ */ jsx64(Progress, { value: progress })
|
|
9426
9593
|
] }),
|
|
9427
|
-
error && /* @__PURE__ */
|
|
9428
|
-
/* @__PURE__ */
|
|
9429
|
-
!isRunning && !error && /* @__PURE__ */
|
|
9430
|
-
/* @__PURE__ */
|
|
9431
|
-
/* @__PURE__ */
|
|
9594
|
+
error && /* @__PURE__ */ jsx64("div", { className: "w-full break-words text-sm text-red-500", children: formatUpstashErrorMessage(error) }),
|
|
9595
|
+
/* @__PURE__ */ jsxs36(DialogFooter, { children: [
|
|
9596
|
+
!isRunning && !error && /* @__PURE__ */ jsxs36(Fragment12, { children: [
|
|
9597
|
+
/* @__PURE__ */ jsx64(Button, { onClick: () => onOpenChange(false), children: "Cancel" }),
|
|
9598
|
+
/* @__PURE__ */ jsx64(Button, { variant: "primary", onClick: handleImport, children: "Import" })
|
|
9432
9599
|
] }),
|
|
9433
|
-
error && /* @__PURE__ */
|
|
9600
|
+
error && /* @__PURE__ */ jsx64(Button, { onClick: () => onOpenChange(false), children: "Close" })
|
|
9434
9601
|
] })
|
|
9435
9602
|
]
|
|
9436
9603
|
}
|
|
@@ -9440,44 +9607,44 @@ var ImportSampleDatasetModal = ({
|
|
|
9440
9607
|
};
|
|
9441
9608
|
|
|
9442
9609
|
// src/components/databrowser/components/search-empty-state.tsx
|
|
9443
|
-
import { jsx as
|
|
9610
|
+
import { jsx as jsx65, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
9444
9611
|
var SearchEmptyState = () => {
|
|
9445
9612
|
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__ */
|
|
9613
|
+
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: [
|
|
9614
|
+
/* @__PURE__ */ jsx65(ImportSampleDatasetModal, { open: importModalOpen, onOpenChange: setImportModalOpen }),
|
|
9615
|
+
/* @__PURE__ */ jsxs37("div", { className: "flex-1", children: [
|
|
9616
|
+
/* @__PURE__ */ jsx65("h2", { className: "mb-2 text-lg font-semibold text-zinc-900", children: "Redis Search" }),
|
|
9617
|
+
/* @__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." }),
|
|
9618
|
+
/* @__PURE__ */ jsxs37("div", { className: "space-y-3", children: [
|
|
9619
|
+
/* @__PURE__ */ jsx65("h3", { className: "text-xs font-medium uppercase tracking-wider text-zinc-400", children: "How it works" }),
|
|
9620
|
+
/* @__PURE__ */ jsxs37("div", { className: "space-y-2.5", children: [
|
|
9621
|
+
/* @__PURE__ */ jsxs37("div", { className: "flex items-start gap-3", children: [
|
|
9622
|
+
/* @__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 }) }),
|
|
9623
|
+
/* @__PURE__ */ jsxs37("div", { children: [
|
|
9624
|
+
/* @__PURE__ */ jsx65("h4", { className: "text-sm font-medium text-zinc-900", children: "Store your data" }),
|
|
9625
|
+
/* @__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
9626
|
] })
|
|
9460
9627
|
] }),
|
|
9461
|
-
/* @__PURE__ */
|
|
9462
|
-
/* @__PURE__ */
|
|
9463
|
-
/* @__PURE__ */
|
|
9464
|
-
/* @__PURE__ */
|
|
9465
|
-
/* @__PURE__ */
|
|
9628
|
+
/* @__PURE__ */ jsxs37("div", { className: "flex items-start gap-3", children: [
|
|
9629
|
+
/* @__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 }) }),
|
|
9630
|
+
/* @__PURE__ */ jsxs37("div", { children: [
|
|
9631
|
+
/* @__PURE__ */ jsx65("h4", { className: "text-sm font-medium text-zinc-900", children: "Create an index" }),
|
|
9632
|
+
/* @__PURE__ */ jsx65("p", { className: "text-sm text-zinc-500", children: "Define a search index specifying which fields to search on." })
|
|
9466
9633
|
] })
|
|
9467
9634
|
] }),
|
|
9468
|
-
/* @__PURE__ */
|
|
9469
|
-
/* @__PURE__ */
|
|
9470
|
-
/* @__PURE__ */
|
|
9471
|
-
/* @__PURE__ */
|
|
9472
|
-
/* @__PURE__ */
|
|
9635
|
+
/* @__PURE__ */ jsxs37("div", { className: "flex items-start gap-3", children: [
|
|
9636
|
+
/* @__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 }) }),
|
|
9637
|
+
/* @__PURE__ */ jsxs37("div", { children: [
|
|
9638
|
+
/* @__PURE__ */ jsx65("h4", { className: "text-sm font-medium text-zinc-900", children: "Search your data" }),
|
|
9639
|
+
/* @__PURE__ */ jsx65("p", { className: "text-sm text-zinc-500", children: "Query with filters, full-text search, and sorted results." })
|
|
9473
9640
|
] })
|
|
9474
9641
|
] })
|
|
9475
9642
|
] })
|
|
9476
9643
|
] }),
|
|
9477
|
-
/* @__PURE__ */
|
|
9644
|
+
/* @__PURE__ */ jsx65(
|
|
9478
9645
|
"a",
|
|
9479
9646
|
{
|
|
9480
|
-
href: "https://upstash
|
|
9647
|
+
href: "https://upstash.com/docs/redis/search/introduction",
|
|
9481
9648
|
target: "_blank",
|
|
9482
9649
|
rel: "noopener noreferrer",
|
|
9483
9650
|
className: "mt-5 inline-block text-sm text-emerald-600 underline-offset-2 hover:underline",
|
|
@@ -9485,11 +9652,11 @@ var SearchEmptyState = () => {
|
|
|
9485
9652
|
}
|
|
9486
9653
|
)
|
|
9487
9654
|
] }),
|
|
9488
|
-
/* @__PURE__ */
|
|
9489
|
-
/* @__PURE__ */
|
|
9490
|
-
/* @__PURE__ */
|
|
9491
|
-
/* @__PURE__ */
|
|
9492
|
-
/* @__PURE__ */
|
|
9655
|
+
/* @__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: [
|
|
9656
|
+
/* @__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 }) }),
|
|
9657
|
+
/* @__PURE__ */ jsx65("h3", { className: "mb-1 text-sm font-medium text-zinc-900", children: "Try it out" }),
|
|
9658
|
+
/* @__PURE__ */ jsx65("p", { className: "mb-4 text-center text-xs text-zinc-500", children: "Load a sample dataset to explore Redis Search" }),
|
|
9659
|
+
/* @__PURE__ */ jsx65(
|
|
9493
9660
|
"button",
|
|
9494
9661
|
{
|
|
9495
9662
|
onClick: () => setImportModalOpen(true),
|
|
@@ -9502,23 +9669,23 @@ var SearchEmptyState = () => {
|
|
|
9502
9669
|
};
|
|
9503
9670
|
|
|
9504
9671
|
// src/components/databrowser/components/sidebar/empty.tsx
|
|
9505
|
-
import { jsx as
|
|
9672
|
+
import { jsx as jsx66, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
9506
9673
|
var Empty = () => {
|
|
9507
|
-
return /* @__PURE__ */
|
|
9508
|
-
/* @__PURE__ */
|
|
9509
|
-
/* @__PURE__ */
|
|
9674
|
+
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: [
|
|
9675
|
+
/* @__PURE__ */ jsx66("p", { className: "text-md font-medium", children: "Data on a break" }),
|
|
9676
|
+
/* @__PURE__ */ jsx66("p", { className: "text-balance text-center", children: '"Quick, lure it back with some CLI magic!"' })
|
|
9510
9677
|
] }) });
|
|
9511
9678
|
};
|
|
9512
9679
|
|
|
9513
9680
|
// src/components/databrowser/components/sidebar/keys-list.tsx
|
|
9514
|
-
import { Fragment as
|
|
9681
|
+
import { Fragment as Fragment14, useRef as useRef6 } from "react";
|
|
9515
9682
|
import { IconChevronRight as IconChevronRight4 } from "@tabler/icons-react";
|
|
9516
9683
|
|
|
9517
9684
|
// src/components/databrowser/components/sidebar-context-menu.tsx
|
|
9518
9685
|
import { useState as useState21 } from "react";
|
|
9519
9686
|
import { ContextMenuSeparator as ContextMenuSeparator3 } from "@radix-ui/react-context-menu";
|
|
9520
9687
|
import { IconCopy as IconCopy3, IconExternalLink as IconExternalLink3, IconTrash as IconTrash3 } from "@tabler/icons-react";
|
|
9521
|
-
import { Fragment as
|
|
9688
|
+
import { Fragment as Fragment13, jsx as jsx67, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
9522
9689
|
var SidebarContextMenu = ({ children }) => {
|
|
9523
9690
|
const { mutateAsync: deleteKey } = useDeleteKey();
|
|
9524
9691
|
const [isAlertOpen, setAlertOpen] = useState21(false);
|
|
@@ -9530,8 +9697,8 @@ var SidebarContextMenu = ({ children }) => {
|
|
|
9530
9697
|
setSearch
|
|
9531
9698
|
} = useDatabrowserStore();
|
|
9532
9699
|
const { search: currentSearch, selectedKeys, isValuesSearchSelected } = useTab();
|
|
9533
|
-
return /* @__PURE__ */
|
|
9534
|
-
/* @__PURE__ */
|
|
9700
|
+
return /* @__PURE__ */ jsxs39(Fragment13, { children: [
|
|
9701
|
+
/* @__PURE__ */ jsx67(
|
|
9535
9702
|
DeleteKeyModal,
|
|
9536
9703
|
{
|
|
9537
9704
|
deletionType: "key",
|
|
@@ -9546,8 +9713,8 @@ var SidebarContextMenu = ({ children }) => {
|
|
|
9546
9713
|
}
|
|
9547
9714
|
}
|
|
9548
9715
|
),
|
|
9549
|
-
/* @__PURE__ */
|
|
9550
|
-
/* @__PURE__ */
|
|
9716
|
+
/* @__PURE__ */ jsxs39(ContextMenu, { modal: false, children: [
|
|
9717
|
+
/* @__PURE__ */ jsx67(
|
|
9551
9718
|
ContextMenuTrigger,
|
|
9552
9719
|
{
|
|
9553
9720
|
onContextMenu: (e) => {
|
|
@@ -9567,8 +9734,8 @@ var SidebarContextMenu = ({ children }) => {
|
|
|
9567
9734
|
children
|
|
9568
9735
|
}
|
|
9569
9736
|
),
|
|
9570
|
-
/* @__PURE__ */
|
|
9571
|
-
/* @__PURE__ */
|
|
9737
|
+
/* @__PURE__ */ jsxs39(ContextMenuContent, { children: [
|
|
9738
|
+
/* @__PURE__ */ jsxs39(
|
|
9572
9739
|
ContextMenuItem,
|
|
9573
9740
|
{
|
|
9574
9741
|
onClick: () => {
|
|
@@ -9580,12 +9747,12 @@ var SidebarContextMenu = ({ children }) => {
|
|
|
9580
9747
|
className: "gap-2",
|
|
9581
9748
|
disabled: contextKeys.length !== 1,
|
|
9582
9749
|
children: [
|
|
9583
|
-
/* @__PURE__ */
|
|
9750
|
+
/* @__PURE__ */ jsx67(IconCopy3, { size: 16 }),
|
|
9584
9751
|
"Copy key"
|
|
9585
9752
|
]
|
|
9586
9753
|
}
|
|
9587
9754
|
),
|
|
9588
|
-
/* @__PURE__ */
|
|
9755
|
+
/* @__PURE__ */ jsxs39(
|
|
9589
9756
|
ContextMenuItem,
|
|
9590
9757
|
{
|
|
9591
9758
|
onClick: () => {
|
|
@@ -9597,14 +9764,14 @@ var SidebarContextMenu = ({ children }) => {
|
|
|
9597
9764
|
className: "gap-2",
|
|
9598
9765
|
disabled: contextKeys.length !== 1,
|
|
9599
9766
|
children: [
|
|
9600
|
-
/* @__PURE__ */
|
|
9767
|
+
/* @__PURE__ */ jsx67(IconExternalLink3, { size: 16 }),
|
|
9601
9768
|
"Open in new tab"
|
|
9602
9769
|
]
|
|
9603
9770
|
}
|
|
9604
9771
|
),
|
|
9605
|
-
/* @__PURE__ */
|
|
9606
|
-
/* @__PURE__ */
|
|
9607
|
-
/* @__PURE__ */
|
|
9772
|
+
/* @__PURE__ */ jsx67(ContextMenuSeparator3, {}),
|
|
9773
|
+
/* @__PURE__ */ jsxs39(ContextMenuItem, { onClick: () => setAlertOpen(true), className: "gap-2", children: [
|
|
9774
|
+
/* @__PURE__ */ jsx67(IconTrash3, { size: 16 }),
|
|
9608
9775
|
contextKeys.length > 1 ? `Delete ${contextKeys.length} keys` : "Delete key"
|
|
9609
9776
|
] })
|
|
9610
9777
|
] })
|
|
@@ -9613,14 +9780,14 @@ var SidebarContextMenu = ({ children }) => {
|
|
|
9613
9780
|
};
|
|
9614
9781
|
|
|
9615
9782
|
// src/components/databrowser/components/sidebar/keys-list.tsx
|
|
9616
|
-
import { Fragment as
|
|
9783
|
+
import { Fragment as Fragment15, jsx as jsx68, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
9617
9784
|
var KeysList = () => {
|
|
9618
9785
|
const { keys } = useKeys();
|
|
9619
9786
|
const lastClickedIndexRef = useRef6(null);
|
|
9620
|
-
return /* @__PURE__ */
|
|
9621
|
-
/* @__PURE__ */
|
|
9622
|
-
keys.map((data, i) => /* @__PURE__ */
|
|
9623
|
-
/* @__PURE__ */
|
|
9787
|
+
return /* @__PURE__ */ jsx68(SidebarContextMenu, { children: /* @__PURE__ */ jsxs40(Fragment15, { children: [
|
|
9788
|
+
/* @__PURE__ */ jsx68("div", { className: "h-px" }),
|
|
9789
|
+
keys.map((data, i) => /* @__PURE__ */ jsxs40(Fragment14, { children: [
|
|
9790
|
+
/* @__PURE__ */ jsx68(
|
|
9624
9791
|
KeyItem,
|
|
9625
9792
|
{
|
|
9626
9793
|
index: i,
|
|
@@ -9629,7 +9796,7 @@ var KeysList = () => {
|
|
|
9629
9796
|
lastClickedIndexRef
|
|
9630
9797
|
}
|
|
9631
9798
|
),
|
|
9632
|
-
i !== keys.length - 1 && /* @__PURE__ */
|
|
9799
|
+
i !== keys.length - 1 && /* @__PURE__ */ jsx68("div", { className: "-z-10 mx-[13px] h-px bg-zinc-200 dark:bg-zinc-300" })
|
|
9633
9800
|
] }, data[0]))
|
|
9634
9801
|
] }) });
|
|
9635
9802
|
};
|
|
@@ -9671,7 +9838,7 @@ var KeyItem = ({
|
|
|
9671
9838
|
lastClickedIndexRef.current = index;
|
|
9672
9839
|
}
|
|
9673
9840
|
};
|
|
9674
|
-
return /* @__PURE__ */
|
|
9841
|
+
return /* @__PURE__ */ jsxs40(
|
|
9675
9842
|
"button",
|
|
9676
9843
|
{
|
|
9677
9844
|
"data-key": dataKey,
|
|
@@ -9683,40 +9850,40 @@ var KeyItem = ({
|
|
|
9683
9850
|
),
|
|
9684
9851
|
onClick: handleClick,
|
|
9685
9852
|
children: [
|
|
9686
|
-
/* @__PURE__ */
|
|
9687
|
-
/* @__PURE__ */
|
|
9688
|
-
score !== void 0 && /* @__PURE__ */
|
|
9689
|
-
isKeySelected && /* @__PURE__ */
|
|
9853
|
+
/* @__PURE__ */ jsx68(TypeTag, { variant: dataType, type: "icon" }),
|
|
9854
|
+
/* @__PURE__ */ jsx68("p", { className: "grow truncate whitespace-nowrap", children: dataKey }),
|
|
9855
|
+
score !== void 0 && /* @__PURE__ */ jsx68("span", { className: "shrink-0 text-xs text-zinc-400", children: score.toFixed(2) }),
|
|
9856
|
+
isKeySelected && /* @__PURE__ */ jsx68(IconChevronRight4, { className: "shrink-0 text-zinc-500", size: 20 })
|
|
9690
9857
|
]
|
|
9691
9858
|
}
|
|
9692
9859
|
);
|
|
9693
9860
|
};
|
|
9694
9861
|
|
|
9695
9862
|
// src/components/databrowser/components/sidebar/skeleton-buttons.tsx
|
|
9696
|
-
import { jsx as
|
|
9863
|
+
import { jsx as jsx69, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
9697
9864
|
var DEFAULT_SKELETON_COUNT = 6;
|
|
9698
|
-
var LoadingSkeleton = () => /* @__PURE__ */
|
|
9699
|
-
/* @__PURE__ */
|
|
9700
|
-
/* @__PURE__ */
|
|
9865
|
+
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: [
|
|
9866
|
+
/* @__PURE__ */ jsx69(Skeleton, { className: "size-5 shrink-0 rounded" }),
|
|
9867
|
+
/* @__PURE__ */ jsx69(Skeleton, { className: "h-4 grow rounded" })
|
|
9701
9868
|
] }, idx)) });
|
|
9702
9869
|
|
|
9703
9870
|
// src/components/databrowser/components/sidebar/index.tsx
|
|
9704
|
-
import { jsx as
|
|
9871
|
+
import { jsx as jsx70 } from "react/jsx-runtime";
|
|
9705
9872
|
function Sidebar() {
|
|
9706
9873
|
const { keys, query } = useKeys();
|
|
9707
|
-
return /* @__PURE__ */
|
|
9874
|
+
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
9875
|
// Infinite scroll already has a loader at the bottom
|
|
9709
|
-
/* @__PURE__ */
|
|
9876
|
+
/* @__PURE__ */ jsx70(
|
|
9710
9877
|
InfiniteScroll,
|
|
9711
9878
|
{
|
|
9712
9879
|
query,
|
|
9713
9880
|
disableRoundedInherit: true,
|
|
9714
9881
|
className: "h-full min-h-0 rounded-xl bg-zinc-100 px-2 py-5 pr-4 dark:bg-zinc-200",
|
|
9715
9882
|
scrollBarClassName: "py-5",
|
|
9716
|
-
children: /* @__PURE__ */
|
|
9883
|
+
children: /* @__PURE__ */ jsx70(KeysList, {})
|
|
9717
9884
|
}
|
|
9718
9885
|
)
|
|
9719
|
-
) : /* @__PURE__ */
|
|
9886
|
+
) : /* @__PURE__ */ jsx70(Empty, {}) });
|
|
9720
9887
|
}
|
|
9721
9888
|
|
|
9722
9889
|
// src/components/databrowser/components/ui-query-builder/ui-query-builder.tsx
|
|
@@ -10090,7 +10257,7 @@ var createInitialQueryState = () => ({
|
|
|
10090
10257
|
});
|
|
10091
10258
|
|
|
10092
10259
|
// src/components/databrowser/components/ui-query-builder/query-builder-context.tsx
|
|
10093
|
-
import { jsx as
|
|
10260
|
+
import { jsx as jsx71 } from "react/jsx-runtime";
|
|
10094
10261
|
var QueryBuilderUIContext = createContext7(null);
|
|
10095
10262
|
var QueryBuilderUIProvider = ({
|
|
10096
10263
|
children,
|
|
@@ -10146,7 +10313,7 @@ var QueryBuilderUIProvider = ({
|
|
|
10146
10313
|
}),
|
|
10147
10314
|
[fieldInfos, updateNode, deleteNode, addChildToGroup, moveNode]
|
|
10148
10315
|
);
|
|
10149
|
-
return /* @__PURE__ */
|
|
10316
|
+
return /* @__PURE__ */ jsx71(QueryBuilderUIContext.Provider, { value, children });
|
|
10150
10317
|
};
|
|
10151
10318
|
var useQueryBuilderUI = () => {
|
|
10152
10319
|
const context = useContext7(QueryBuilderUIContext);
|
|
@@ -10232,7 +10399,7 @@ import { useState as useState23 } from "react";
|
|
|
10232
10399
|
|
|
10233
10400
|
// src/components/databrowser/components/ui-query-builder/dynamic-width-input.tsx
|
|
10234
10401
|
import { useLayoutEffect as useLayoutEffect2, useRef as useRef7, useState as useState22 } from "react";
|
|
10235
|
-
import { jsx as
|
|
10402
|
+
import { jsx as jsx72 } from "react/jsx-runtime";
|
|
10236
10403
|
var measureContext = null;
|
|
10237
10404
|
var getTextWidth = (text, font) => {
|
|
10238
10405
|
if (!measureContext) {
|
|
@@ -10264,7 +10431,7 @@ var DynamicWidthInput = ({
|
|
|
10264
10431
|
setWidth(Math.max(Math.ceil(textWidth), minWidth));
|
|
10265
10432
|
}
|
|
10266
10433
|
}, [value, minWidth, placeholder]);
|
|
10267
|
-
return /* @__PURE__ */
|
|
10434
|
+
return /* @__PURE__ */ jsx72(
|
|
10268
10435
|
"input",
|
|
10269
10436
|
{
|
|
10270
10437
|
ref: inputRef,
|
|
@@ -10281,7 +10448,7 @@ var DynamicWidthInput = ({
|
|
|
10281
10448
|
};
|
|
10282
10449
|
|
|
10283
10450
|
// src/components/databrowser/components/ui-query-builder/boost-badge.tsx
|
|
10284
|
-
import { jsx as
|
|
10451
|
+
import { jsx as jsx73, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
10285
10452
|
var BoostBadge = ({
|
|
10286
10453
|
node,
|
|
10287
10454
|
static: isStatic
|
|
@@ -10310,15 +10477,15 @@ var BoostBadge = ({
|
|
|
10310
10477
|
const isNegative = (node.boost ?? 0) < 0;
|
|
10311
10478
|
const labelBg = isNegative ? "bg-red-50" : "bg-purple-50";
|
|
10312
10479
|
const textColor = isNegative ? "text-red-800" : "text-purple-800";
|
|
10313
|
-
return /* @__PURE__ */
|
|
10314
|
-
/* @__PURE__ */
|
|
10315
|
-
/* @__PURE__ */
|
|
10316
|
-
/* @__PURE__ */
|
|
10317
|
-
/* @__PURE__ */
|
|
10318
|
-
/* @__PURE__ */
|
|
10480
|
+
return /* @__PURE__ */ jsxs42("span", { className: "relative flex h-[26px] items-center overflow-hidden rounded-md border border-zinc-300 text-sm font-medium", children: [
|
|
10481
|
+
/* @__PURE__ */ jsxs42(Tooltip, { delayDuration: 200, children: [
|
|
10482
|
+
/* @__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" }) }),
|
|
10483
|
+
/* @__PURE__ */ jsxs42(TooltipContent, { side: "bottom", className: "max-w-xs", children: [
|
|
10484
|
+
/* @__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}.` }),
|
|
10485
|
+
/* @__PURE__ */ jsx73(DocsLink, { href: "https://upstash.com/docs/redis/search/query-operators/boolean-operators/boost" })
|
|
10319
10486
|
] })
|
|
10320
10487
|
] }),
|
|
10321
|
-
isStatic ? /* @__PURE__ */
|
|
10488
|
+
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
10489
|
DynamicWidthInput,
|
|
10323
10490
|
{
|
|
10324
10491
|
value: localValue,
|
|
@@ -10347,8 +10514,8 @@ import { DragOverlay as DndKitDragOverlay } from "@dnd-kit/core";
|
|
|
10347
10514
|
import { IconGripVertical as IconGripVertical2 } from "@tabler/icons-react";
|
|
10348
10515
|
|
|
10349
10516
|
// src/components/databrowser/components/ui-query-builder/not-badge.tsx
|
|
10350
|
-
import { jsx as
|
|
10351
|
-
var NotBadge = () => /* @__PURE__ */
|
|
10517
|
+
import { jsx as jsx74 } from "react/jsx-runtime";
|
|
10518
|
+
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
10519
|
|
|
10353
10520
|
// src/components/databrowser/components/ui-query-builder/query-condition.tsx
|
|
10354
10521
|
import { useEffect as useEffect20, useState as useState25 } from "react";
|
|
@@ -10357,7 +10524,7 @@ import { IconGripVertical, IconX as IconX3 } from "@tabler/icons-react";
|
|
|
10357
10524
|
// src/components/databrowser/components/ui-query-builder/node-actions-menu.tsx
|
|
10358
10525
|
import { useState as useState24 } from "react";
|
|
10359
10526
|
import { IconDots } from "@tabler/icons-react";
|
|
10360
|
-
import { jsx as
|
|
10527
|
+
import { jsx as jsx75, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
10361
10528
|
var NodeActionsMenu = ({ node }) => {
|
|
10362
10529
|
const { updateNode } = useQueryBuilderUI();
|
|
10363
10530
|
const [open, setOpen] = useState24(false);
|
|
@@ -10367,22 +10534,22 @@ var NodeActionsMenu = ({ node }) => {
|
|
|
10367
10534
|
const handleToggleNot = () => {
|
|
10368
10535
|
updateNode(node.id, { not: !node.not });
|
|
10369
10536
|
};
|
|
10370
|
-
return /* @__PURE__ */
|
|
10371
|
-
/* @__PURE__ */
|
|
10537
|
+
return /* @__PURE__ */ jsxs43(DropdownMenu, { open, onOpenChange: setOpen, children: [
|
|
10538
|
+
/* @__PURE__ */ jsx75(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx75(
|
|
10372
10539
|
"button",
|
|
10373
10540
|
{
|
|
10374
10541
|
type: "button",
|
|
10375
10542
|
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__ */
|
|
10543
|
+
children: /* @__PURE__ */ jsx75(IconDots, { size: 16 })
|
|
10377
10544
|
}
|
|
10378
10545
|
) }),
|
|
10379
|
-
/* @__PURE__ */
|
|
10380
|
-
/* @__PURE__ */
|
|
10381
|
-
/* @__PURE__ */
|
|
10546
|
+
/* @__PURE__ */ jsxs43(DropdownMenuContent, { align: "end", children: [
|
|
10547
|
+
/* @__PURE__ */ jsx75(DropdownMenuItem, { onClick: handleToggleBoost, children: /* @__PURE__ */ jsxs43("div", { className: "flex items-center gap-2", children: [
|
|
10548
|
+
/* @__PURE__ */ jsx75(
|
|
10382
10549
|
"div",
|
|
10383
10550
|
{
|
|
10384
10551
|
className: `h-4 w-8 rounded-full transition-colors ${node.boost === void 0 ? "bg-zinc-200" : "bg-emerald-500"}`,
|
|
10385
|
-
children: /* @__PURE__ */
|
|
10552
|
+
children: /* @__PURE__ */ jsx75(
|
|
10386
10553
|
"div",
|
|
10387
10554
|
{
|
|
10388
10555
|
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 +10557,14 @@ var NodeActionsMenu = ({ node }) => {
|
|
|
10390
10557
|
)
|
|
10391
10558
|
}
|
|
10392
10559
|
),
|
|
10393
|
-
/* @__PURE__ */
|
|
10560
|
+
/* @__PURE__ */ jsx75("span", { children: "Boost" })
|
|
10394
10561
|
] }) }),
|
|
10395
|
-
/* @__PURE__ */
|
|
10396
|
-
/* @__PURE__ */
|
|
10562
|
+
/* @__PURE__ */ jsx75(DropdownMenuItem, { onClick: handleToggleNot, children: /* @__PURE__ */ jsxs43("div", { className: "flex items-center gap-2", children: [
|
|
10563
|
+
/* @__PURE__ */ jsx75(
|
|
10397
10564
|
"div",
|
|
10398
10565
|
{
|
|
10399
10566
|
className: `h-4 w-8 rounded-full transition-colors ${node.not ? "bg-emerald-500" : "bg-zinc-200"}`,
|
|
10400
|
-
children: /* @__PURE__ */
|
|
10567
|
+
children: /* @__PURE__ */ jsx75(
|
|
10401
10568
|
"div",
|
|
10402
10569
|
{
|
|
10403
10570
|
className: `h-4 w-4 transform rounded-full bg-white shadow transition-transform ${node.not ? "translate-x-4" : "translate-x-0"}`
|
|
@@ -10405,14 +10572,14 @@ var NodeActionsMenu = ({ node }) => {
|
|
|
10405
10572
|
)
|
|
10406
10573
|
}
|
|
10407
10574
|
),
|
|
10408
|
-
/* @__PURE__ */
|
|
10575
|
+
/* @__PURE__ */ jsx75("span", { children: "Not" })
|
|
10409
10576
|
] }) })
|
|
10410
10577
|
] })
|
|
10411
10578
|
] });
|
|
10412
10579
|
};
|
|
10413
10580
|
|
|
10414
10581
|
// src/components/databrowser/components/ui-query-builder/query-condition.tsx
|
|
10415
|
-
import { Fragment as
|
|
10582
|
+
import { Fragment as Fragment16, jsx as jsx76, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
10416
10583
|
var formatValueForDisplay = (value) => {
|
|
10417
10584
|
if (Array.isArray(value)) {
|
|
10418
10585
|
return value.join(", ");
|
|
@@ -10633,48 +10800,48 @@ var QueryCondition = ({
|
|
|
10633
10800
|
const filteredOperators = OPERATOR_OPTIONS.filter((op) => allowedOperators.includes(op.value));
|
|
10634
10801
|
const isInvalidOperator = !isUnknownField && currentFieldType !== "unknown" && !allowedOperators.includes(condition.operator);
|
|
10635
10802
|
const operatorError = isInvalidOperator ? `"${condition.operator}" is not valid for ${currentFieldType} fields` : void 0;
|
|
10636
|
-
return /* @__PURE__ */
|
|
10637
|
-
/* @__PURE__ */
|
|
10803
|
+
return /* @__PURE__ */ jsxs44("div", { className: "group/condition flex items-center gap-1 px-1", children: [
|
|
10804
|
+
/* @__PURE__ */ jsx76(
|
|
10638
10805
|
"div",
|
|
10639
10806
|
{
|
|
10640
10807
|
ref: dragHandleProps?.ref,
|
|
10641
10808
|
className: "flex cursor-grab items-center px-1 text-zinc-400 hover:text-zinc-600",
|
|
10642
10809
|
...dragHandleProps?.attributes,
|
|
10643
10810
|
...dragHandleProps?.listeners,
|
|
10644
|
-
children: /* @__PURE__ */
|
|
10811
|
+
children: /* @__PURE__ */ jsx76(IconGripVertical, { size: 16 })
|
|
10645
10812
|
}
|
|
10646
10813
|
),
|
|
10647
|
-
/* @__PURE__ */
|
|
10648
|
-
/* @__PURE__ */
|
|
10649
|
-
/* @__PURE__ */
|
|
10814
|
+
/* @__PURE__ */ jsxs44("div", { className: "flex", children: [
|
|
10815
|
+
/* @__PURE__ */ jsxs44(Select, { value: condition.field, onValueChange: handleFieldChange, children: [
|
|
10816
|
+
/* @__PURE__ */ jsx76(
|
|
10650
10817
|
SimpleTooltip,
|
|
10651
10818
|
{
|
|
10652
10819
|
content: isUnknownField ? "This field is not defined in the schema" : void 0,
|
|
10653
10820
|
variant: "error",
|
|
10654
|
-
children: /* @__PURE__ */
|
|
10821
|
+
children: /* @__PURE__ */ jsx76(
|
|
10655
10822
|
SelectTrigger,
|
|
10656
10823
|
{
|
|
10657
10824
|
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__ */
|
|
10825
|
+
children: /* @__PURE__ */ jsx76(SelectValue, { placeholder: "Select field" })
|
|
10659
10826
|
}
|
|
10660
10827
|
)
|
|
10661
10828
|
}
|
|
10662
10829
|
),
|
|
10663
|
-
/* @__PURE__ */
|
|
10664
|
-
isUnknownField && /* @__PURE__ */
|
|
10665
|
-
fieldNames.length > 0 ? fieldNames.map((field) => /* @__PURE__ */
|
|
10830
|
+
/* @__PURE__ */ jsxs44(SelectContent, { children: [
|
|
10831
|
+
isUnknownField && /* @__PURE__ */ jsx76(SelectItem, { value: condition.field, className: "text-red-500", children: condition.field }, condition.field),
|
|
10832
|
+
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
10833
|
] })
|
|
10667
10834
|
] }),
|
|
10668
|
-
/* @__PURE__ */
|
|
10669
|
-
/* @__PURE__ */
|
|
10835
|
+
/* @__PURE__ */ jsxs44(Select, { value: condition.operator, onValueChange: handleOperatorChange, children: [
|
|
10836
|
+
/* @__PURE__ */ jsx76(SimpleTooltip, { content: operatorError || valueTypeError, variant: "error", children: /* @__PURE__ */ jsx76(
|
|
10670
10837
|
SelectTrigger,
|
|
10671
10838
|
{
|
|
10672
10839
|
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__ */
|
|
10840
|
+
children: /* @__PURE__ */ jsx76(SelectValue, {})
|
|
10674
10841
|
}
|
|
10675
10842
|
) }),
|
|
10676
|
-
/* @__PURE__ */
|
|
10677
|
-
isInvalidOperator && /* @__PURE__ */
|
|
10843
|
+
/* @__PURE__ */ jsxs44(SelectContent, { children: [
|
|
10844
|
+
isInvalidOperator && /* @__PURE__ */ jsx76(
|
|
10678
10845
|
SelectItem,
|
|
10679
10846
|
{
|
|
10680
10847
|
value: condition.operator,
|
|
@@ -10683,7 +10850,7 @@ var QueryCondition = ({
|
|
|
10683
10850
|
},
|
|
10684
10851
|
condition.operator
|
|
10685
10852
|
),
|
|
10686
|
-
filteredOperators.map((op) => /* @__PURE__ */
|
|
10853
|
+
filteredOperators.map((op) => /* @__PURE__ */ jsx76(
|
|
10687
10854
|
SelectItem,
|
|
10688
10855
|
{
|
|
10689
10856
|
value: op.value,
|
|
@@ -10694,9 +10861,9 @@ var QueryCondition = ({
|
|
|
10694
10861
|
))
|
|
10695
10862
|
] })
|
|
10696
10863
|
] }),
|
|
10697
|
-
currentFieldType === "boolean" && condition.operator === "in" ? /* @__PURE__ */
|
|
10698
|
-
/* @__PURE__ */
|
|
10699
|
-
/* @__PURE__ */
|
|
10864
|
+
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: [
|
|
10865
|
+
/* @__PURE__ */ jsxs44("label", { className: "flex items-center gap-1", children: [
|
|
10866
|
+
/* @__PURE__ */ jsx76(
|
|
10700
10867
|
"input",
|
|
10701
10868
|
{
|
|
10702
10869
|
type: "checkbox",
|
|
@@ -10712,10 +10879,10 @@ var QueryCondition = ({
|
|
|
10712
10879
|
className: "h-3 w-3"
|
|
10713
10880
|
}
|
|
10714
10881
|
),
|
|
10715
|
-
/* @__PURE__ */
|
|
10882
|
+
/* @__PURE__ */ jsx76("span", { children: "true" })
|
|
10716
10883
|
] }),
|
|
10717
|
-
/* @__PURE__ */
|
|
10718
|
-
/* @__PURE__ */
|
|
10884
|
+
/* @__PURE__ */ jsxs44("label", { className: "flex items-center gap-1", children: [
|
|
10885
|
+
/* @__PURE__ */ jsx76(
|
|
10719
10886
|
"input",
|
|
10720
10887
|
{
|
|
10721
10888
|
type: "checkbox",
|
|
@@ -10731,9 +10898,9 @@ var QueryCondition = ({
|
|
|
10731
10898
|
className: "h-3 w-3"
|
|
10732
10899
|
}
|
|
10733
10900
|
),
|
|
10734
|
-
/* @__PURE__ */
|
|
10901
|
+
/* @__PURE__ */ jsx76("span", { children: "false" })
|
|
10735
10902
|
] })
|
|
10736
|
-
] }) : currentFieldType === "boolean" ? /* @__PURE__ */
|
|
10903
|
+
] }) : currentFieldType === "boolean" ? /* @__PURE__ */ jsxs44(
|
|
10737
10904
|
Select,
|
|
10738
10905
|
{
|
|
10739
10906
|
value: condition.value === true || condition.value === "true" ? "true" : condition.value === false || condition.value === "false" ? "false" : "true",
|
|
@@ -10745,14 +10912,14 @@ var QueryCondition = ({
|
|
|
10745
10912
|
});
|
|
10746
10913
|
},
|
|
10747
10914
|
children: [
|
|
10748
|
-
/* @__PURE__ */
|
|
10749
|
-
/* @__PURE__ */
|
|
10750
|
-
/* @__PURE__ */
|
|
10751
|
-
/* @__PURE__ */
|
|
10915
|
+
/* @__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, {}) }),
|
|
10916
|
+
/* @__PURE__ */ jsxs44(SelectContent, { children: [
|
|
10917
|
+
/* @__PURE__ */ jsx76(SelectItem, { value: "true", children: "true" }),
|
|
10918
|
+
/* @__PURE__ */ jsx76(SelectItem, { value: "false", children: "false" })
|
|
10752
10919
|
] })
|
|
10753
10920
|
]
|
|
10754
10921
|
}
|
|
10755
|
-
) : /* @__PURE__ */
|
|
10922
|
+
) : /* @__PURE__ */ jsx76(
|
|
10756
10923
|
"input",
|
|
10757
10924
|
{
|
|
10758
10925
|
type: "text",
|
|
@@ -10765,15 +10932,15 @@ var QueryCondition = ({
|
|
|
10765
10932
|
}
|
|
10766
10933
|
)
|
|
10767
10934
|
] }),
|
|
10768
|
-
condition.operator === "fuzzy" && /* @__PURE__ */
|
|
10935
|
+
condition.operator === "fuzzy" && /* @__PURE__ */ jsxs44(
|
|
10769
10936
|
Select,
|
|
10770
10937
|
{
|
|
10771
10938
|
value: String(condition.fuzzyDistance || 1),
|
|
10772
10939
|
onValueChange: handleFuzzyDistanceChange,
|
|
10773
10940
|
children: [
|
|
10774
|
-
/* @__PURE__ */
|
|
10775
|
-
/* @__PURE__ */
|
|
10776
|
-
/* @__PURE__ */
|
|
10941
|
+
/* @__PURE__ */ jsx76(SelectTrigger, { className: "h-[26px] w-16 gap-3 border-zinc-200 bg-white px-2 text-sm", children: /* @__PURE__ */ jsx76(SelectValue, {}) }),
|
|
10942
|
+
/* @__PURE__ */ jsxs44(SelectContent, { children: [
|
|
10943
|
+
/* @__PURE__ */ jsx76(
|
|
10777
10944
|
SelectItem,
|
|
10778
10945
|
{
|
|
10779
10946
|
value: "1",
|
|
@@ -10781,17 +10948,17 @@ var QueryCondition = ({
|
|
|
10781
10948
|
children: "1"
|
|
10782
10949
|
}
|
|
10783
10950
|
),
|
|
10784
|
-
/* @__PURE__ */
|
|
10951
|
+
/* @__PURE__ */ jsx76(SelectItem, { value: "2", description: "Matches words with up to 2 character edits", children: "2" })
|
|
10785
10952
|
] })
|
|
10786
10953
|
]
|
|
10787
10954
|
}
|
|
10788
10955
|
),
|
|
10789
|
-
condition.operator === "phrase" && /* @__PURE__ */
|
|
10790
|
-
/* @__PURE__ */
|
|
10791
|
-
/* @__PURE__ */
|
|
10792
|
-
/* @__PURE__ */
|
|
10793
|
-
/* @__PURE__ */
|
|
10794
|
-
/* @__PURE__ */
|
|
10956
|
+
condition.operator === "phrase" && /* @__PURE__ */ jsxs44(Fragment16, { children: [
|
|
10957
|
+
/* @__PURE__ */ jsxs44(Select, { value: phraseMode, onValueChange: handlePhraseModeChange, children: [
|
|
10958
|
+
/* @__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, {}) }),
|
|
10959
|
+
/* @__PURE__ */ jsxs44(SelectContent, { children: [
|
|
10960
|
+
/* @__PURE__ */ jsx76(SelectItem, { value: "exact", description: "Terms must appear adjacent to each other", children: "exact" }),
|
|
10961
|
+
/* @__PURE__ */ jsx76(
|
|
10795
10962
|
SelectItem,
|
|
10796
10963
|
{
|
|
10797
10964
|
value: "slop",
|
|
@@ -10799,7 +10966,7 @@ var QueryCondition = ({
|
|
|
10799
10966
|
children: "slop"
|
|
10800
10967
|
}
|
|
10801
10968
|
),
|
|
10802
|
-
/* @__PURE__ */
|
|
10969
|
+
/* @__PURE__ */ jsx76(
|
|
10803
10970
|
SelectItem,
|
|
10804
10971
|
{
|
|
10805
10972
|
value: "prefix",
|
|
@@ -10809,7 +10976,7 @@ var QueryCondition = ({
|
|
|
10809
10976
|
)
|
|
10810
10977
|
] })
|
|
10811
10978
|
] }),
|
|
10812
|
-
phraseMode === "slop" && /* @__PURE__ */
|
|
10979
|
+
phraseMode === "slop" && /* @__PURE__ */ jsx76(
|
|
10813
10980
|
"input",
|
|
10814
10981
|
{
|
|
10815
10982
|
type: "number",
|
|
@@ -10822,21 +10989,21 @@ var QueryCondition = ({
|
|
|
10822
10989
|
}
|
|
10823
10990
|
)
|
|
10824
10991
|
] }),
|
|
10825
|
-
node.not && /* @__PURE__ */
|
|
10826
|
-
node.boost !== void 0 && /* @__PURE__ */
|
|
10827
|
-
/* @__PURE__ */
|
|
10992
|
+
node.not && /* @__PURE__ */ jsx76(NotBadge, {}),
|
|
10993
|
+
node.boost !== void 0 && /* @__PURE__ */ jsx76(BoostBadge, { node }),
|
|
10994
|
+
/* @__PURE__ */ jsxs44(
|
|
10828
10995
|
"div",
|
|
10829
10996
|
{
|
|
10830
10997
|
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
10998
|
children: [
|
|
10832
|
-
/* @__PURE__ */
|
|
10833
|
-
/* @__PURE__ */
|
|
10999
|
+
/* @__PURE__ */ jsx76(NodeActionsMenu, { node }),
|
|
11000
|
+
/* @__PURE__ */ jsx76(
|
|
10834
11001
|
"button",
|
|
10835
11002
|
{
|
|
10836
11003
|
type: "button",
|
|
10837
11004
|
onClick: handleDelete,
|
|
10838
11005
|
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__ */
|
|
11006
|
+
children: /* @__PURE__ */ jsx76(IconX3, { size: 16 })
|
|
10840
11007
|
}
|
|
10841
11008
|
)
|
|
10842
11009
|
]
|
|
@@ -10846,12 +11013,12 @@ var QueryCondition = ({
|
|
|
10846
11013
|
};
|
|
10847
11014
|
|
|
10848
11015
|
// src/components/databrowser/components/ui-query-builder/drag-overlay.tsx
|
|
10849
|
-
import { jsx as
|
|
11016
|
+
import { jsx as jsx77, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
10850
11017
|
var QueryDragOverlay = ({
|
|
10851
11018
|
activeNode,
|
|
10852
11019
|
onDropAnimationComplete
|
|
10853
11020
|
}) => {
|
|
10854
|
-
return /* @__PURE__ */
|
|
11021
|
+
return /* @__PURE__ */ jsx77(
|
|
10855
11022
|
DndKitDragOverlay,
|
|
10856
11023
|
{
|
|
10857
11024
|
dropAnimation: {
|
|
@@ -10864,16 +11031,16 @@ var QueryDragOverlay = ({
|
|
|
10864
11031
|
};
|
|
10865
11032
|
}
|
|
10866
11033
|
},
|
|
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__ */
|
|
11034
|
+
children: activeNode && activeNode.type === "condition" ? /* @__PURE__ */ jsxs45("div", { className: "relative -mt-1", children: [
|
|
11035
|
+
/* @__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" }),
|
|
11036
|
+
/* @__PURE__ */ jsx77("div", { className: "relative", children: /* @__PURE__ */ jsx77(QueryCondition, { node: activeNode, isDragging: true }) })
|
|
11037
|
+
] }) : activeNode && activeNode.type === "group" ? /* @__PURE__ */ jsxs45("div", { className: "relative", children: [
|
|
11038
|
+
/* @__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" }),
|
|
11039
|
+
/* @__PURE__ */ jsxs45("div", { className: "relative flex items-center gap-1", children: [
|
|
11040
|
+
/* @__PURE__ */ jsx77("div", { className: "flex cursor-grab items-center text-zinc-400", children: /* @__PURE__ */ jsx77(IconGripVertical2, { size: 16 }) }),
|
|
11041
|
+
/* @__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: [
|
|
11042
|
+
/* @__PURE__ */ jsx77("span", { children: activeNode.groupOperator === "and" ? "And" : "Or" }),
|
|
11043
|
+
/* @__PURE__ */ jsx77(
|
|
10877
11044
|
"svg",
|
|
10878
11045
|
{
|
|
10879
11046
|
className: "text-zinc-400",
|
|
@@ -10882,7 +11049,7 @@ var QueryDragOverlay = ({
|
|
|
10882
11049
|
viewBox: "0 0 16 16",
|
|
10883
11050
|
fill: "none",
|
|
10884
11051
|
xmlns: "http://www.w3.org/2000/svg",
|
|
10885
|
-
children: /* @__PURE__ */
|
|
11052
|
+
children: /* @__PURE__ */ jsx77(
|
|
10886
11053
|
"path",
|
|
10887
11054
|
{
|
|
10888
11055
|
d: "M4 6L8 10L12 6",
|
|
@@ -10896,8 +11063,8 @@ var QueryDragOverlay = ({
|
|
|
10896
11063
|
}
|
|
10897
11064
|
)
|
|
10898
11065
|
] }),
|
|
10899
|
-
activeNode.boost !== void 0 && /* @__PURE__ */
|
|
10900
|
-
activeNode.not && /* @__PURE__ */
|
|
11066
|
+
activeNode.boost !== void 0 && /* @__PURE__ */ jsx77(BoostBadge, { node: activeNode, static: true }),
|
|
11067
|
+
activeNode.not && /* @__PURE__ */ jsx77(NotBadge, {})
|
|
10901
11068
|
] })
|
|
10902
11069
|
] }) : null
|
|
10903
11070
|
}
|
|
@@ -10905,7 +11072,7 @@ var QueryDragOverlay = ({
|
|
|
10905
11072
|
};
|
|
10906
11073
|
|
|
10907
11074
|
// src/components/databrowser/components/ui-query-builder/dnd-context.tsx
|
|
10908
|
-
import { jsx as
|
|
11075
|
+
import { jsx as jsx78, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
10909
11076
|
var QueryDndProvider = ({
|
|
10910
11077
|
children,
|
|
10911
11078
|
rootNode,
|
|
@@ -10977,7 +11144,7 @@ var QueryDndProvider = ({
|
|
|
10977
11144
|
moveNode(activeIdStr, targetGroupId, adjustedIndex);
|
|
10978
11145
|
};
|
|
10979
11146
|
const activeNode = activeId ? findNodeById(rootNode, String(activeId)) : null;
|
|
10980
|
-
return /* @__PURE__ */
|
|
11147
|
+
return /* @__PURE__ */ jsxs46(
|
|
10981
11148
|
DndContext,
|
|
10982
11149
|
{
|
|
10983
11150
|
sensors,
|
|
@@ -10987,7 +11154,7 @@ var QueryDndProvider = ({
|
|
|
10987
11154
|
onDragEnd: handleDragEnd,
|
|
10988
11155
|
children: [
|
|
10989
11156
|
children,
|
|
10990
|
-
/* @__PURE__ */
|
|
11157
|
+
/* @__PURE__ */ jsx78(
|
|
10991
11158
|
QueryDragOverlay,
|
|
10992
11159
|
{
|
|
10993
11160
|
activeNode,
|
|
@@ -11024,7 +11191,7 @@ var findParentGroup = (root2, targetId) => {
|
|
|
11024
11191
|
|
|
11025
11192
|
// src/components/databrowser/components/ui-query-builder/draggable-item.tsx
|
|
11026
11193
|
import { useDraggable } from "@dnd-kit/core";
|
|
11027
|
-
import { jsx as
|
|
11194
|
+
import { jsx as jsx79 } from "react/jsx-runtime";
|
|
11028
11195
|
var DraggableItem = ({
|
|
11029
11196
|
id,
|
|
11030
11197
|
children,
|
|
@@ -11035,7 +11202,7 @@ var DraggableItem = ({
|
|
|
11035
11202
|
});
|
|
11036
11203
|
const isDropAnimating = droppingId === id;
|
|
11037
11204
|
const childElement = children;
|
|
11038
|
-
const childWithDragHandle = typeof children === "object" && children !== null && "type" in childElement ? /* @__PURE__ */
|
|
11205
|
+
const childWithDragHandle = typeof children === "object" && children !== null && "type" in childElement ? /* @__PURE__ */ jsx79(
|
|
11039
11206
|
childElement.type,
|
|
11040
11207
|
{
|
|
11041
11208
|
...childElement.props,
|
|
@@ -11046,7 +11213,7 @@ var DraggableItem = ({
|
|
|
11046
11213
|
}
|
|
11047
11214
|
}
|
|
11048
11215
|
) : children;
|
|
11049
|
-
return /* @__PURE__ */
|
|
11216
|
+
return /* @__PURE__ */ jsx79(
|
|
11050
11217
|
"div",
|
|
11051
11218
|
{
|
|
11052
11219
|
ref: setNodeRef,
|
|
@@ -11059,10 +11226,10 @@ var DraggableItem = ({
|
|
|
11059
11226
|
// src/components/databrowser/components/ui-query-builder/drop-zone.tsx
|
|
11060
11227
|
import { useDroppable } from "@dnd-kit/core";
|
|
11061
11228
|
import { IconPlus as IconPlus4 } from "@tabler/icons-react";
|
|
11062
|
-
import { jsx as
|
|
11229
|
+
import { jsx as jsx80, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
11063
11230
|
var DropIndicator = ({ id, isOver }) => {
|
|
11064
11231
|
const { setNodeRef } = useDroppable({ id });
|
|
11065
|
-
return /* @__PURE__ */
|
|
11232
|
+
return /* @__PURE__ */ jsx80("div", { ref: setNodeRef, className: `relative flex h-2 items-center`, children: /* @__PURE__ */ jsx80(
|
|
11066
11233
|
"div",
|
|
11067
11234
|
{
|
|
11068
11235
|
className: cn(
|
|
@@ -11078,7 +11245,7 @@ var EmptyGroupDropZone = ({
|
|
|
11078
11245
|
onAddCondition
|
|
11079
11246
|
}) => {
|
|
11080
11247
|
const { setNodeRef } = useDroppable({ id: `drop-${groupId}-end` });
|
|
11081
|
-
return /* @__PURE__ */
|
|
11248
|
+
return /* @__PURE__ */ jsxs47(
|
|
11082
11249
|
"button",
|
|
11083
11250
|
{
|
|
11084
11251
|
type: "button",
|
|
@@ -11089,7 +11256,7 @@ var EmptyGroupDropZone = ({
|
|
|
11089
11256
|
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
11257
|
),
|
|
11091
11258
|
children: [
|
|
11092
|
-
/* @__PURE__ */
|
|
11259
|
+
/* @__PURE__ */ jsx80(IconPlus4, { size: 14 }),
|
|
11093
11260
|
"Add a condition"
|
|
11094
11261
|
]
|
|
11095
11262
|
}
|
|
@@ -11097,22 +11264,22 @@ var EmptyGroupDropZone = ({
|
|
|
11097
11264
|
};
|
|
11098
11265
|
|
|
11099
11266
|
// src/components/databrowser/components/ui-query-builder/query-group.tsx
|
|
11100
|
-
import { Fragment as
|
|
11267
|
+
import { Fragment as Fragment17, jsx as jsx81, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
11101
11268
|
var ChildRow = ({
|
|
11102
11269
|
groupId,
|
|
11103
11270
|
child,
|
|
11104
11271
|
depth,
|
|
11105
11272
|
activeOverId,
|
|
11106
11273
|
droppingId
|
|
11107
|
-
}) => /* @__PURE__ */
|
|
11108
|
-
/* @__PURE__ */
|
|
11274
|
+
}) => /* @__PURE__ */ jsxs48("div", { children: [
|
|
11275
|
+
/* @__PURE__ */ jsx81(
|
|
11109
11276
|
DropIndicator,
|
|
11110
11277
|
{
|
|
11111
11278
|
id: `drop-${groupId}-${child.id}`,
|
|
11112
11279
|
isOver: activeOverId === `drop-${groupId}-${child.id}`
|
|
11113
11280
|
}
|
|
11114
11281
|
),
|
|
11115
|
-
/* @__PURE__ */
|
|
11282
|
+
/* @__PURE__ */ jsx81(DraggableItem, { id: child.id, droppingId, children: child.type === "condition" ? /* @__PURE__ */ jsx81(QueryCondition, { node: child }) : /* @__PURE__ */ jsx81(
|
|
11116
11283
|
InnerGroup,
|
|
11117
11284
|
{
|
|
11118
11285
|
node: child,
|
|
@@ -11143,71 +11310,71 @@ var InnerGroup = ({
|
|
|
11143
11310
|
const handleDeleteGroup = () => {
|
|
11144
11311
|
deleteNode(node.id);
|
|
11145
11312
|
};
|
|
11146
|
-
return /* @__PURE__ */
|
|
11147
|
-
/* @__PURE__ */
|
|
11148
|
-
!isRoot && /* @__PURE__ */
|
|
11313
|
+
return /* @__PURE__ */ jsxs48("div", { children: [
|
|
11314
|
+
/* @__PURE__ */ jsxs48("div", { className: "group/group flex items-center gap-1 px-1", children: [
|
|
11315
|
+
!isRoot && /* @__PURE__ */ jsx81(
|
|
11149
11316
|
"div",
|
|
11150
11317
|
{
|
|
11151
11318
|
ref: dragHandleProps?.ref,
|
|
11152
11319
|
className: "flex cursor-grab items-center px-1 text-zinc-400",
|
|
11153
11320
|
...dragHandleProps?.attributes,
|
|
11154
11321
|
...dragHandleProps?.listeners,
|
|
11155
|
-
children: /* @__PURE__ */
|
|
11322
|
+
children: /* @__PURE__ */ jsx81(IconGripVertical3, { size: 16 })
|
|
11156
11323
|
}
|
|
11157
11324
|
),
|
|
11158
|
-
/* @__PURE__ */
|
|
11159
|
-
/* @__PURE__ */
|
|
11160
|
-
/* @__PURE__ */
|
|
11161
|
-
/* @__PURE__ */
|
|
11162
|
-
/* @__PURE__ */
|
|
11325
|
+
/* @__PURE__ */ jsxs48(Select, { value: node.groupOperator, onValueChange: handleOperatorChange, children: [
|
|
11326
|
+
/* @__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, {}) }),
|
|
11327
|
+
/* @__PURE__ */ jsxs48(SelectContent, { children: [
|
|
11328
|
+
/* @__PURE__ */ jsx81(SelectItem, { value: "and", children: "And" }),
|
|
11329
|
+
/* @__PURE__ */ jsx81(SelectItem, { value: "or", children: "Or" })
|
|
11163
11330
|
] })
|
|
11164
11331
|
] }),
|
|
11165
|
-
/* @__PURE__ */
|
|
11166
|
-
/* @__PURE__ */
|
|
11332
|
+
/* @__PURE__ */ jsxs48(DropdownMenu, { children: [
|
|
11333
|
+
/* @__PURE__ */ jsx81(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx81(
|
|
11167
11334
|
"button",
|
|
11168
11335
|
{
|
|
11169
11336
|
type: "button",
|
|
11170
11337
|
disabled: fieldInfos.length === 0,
|
|
11171
11338
|
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__ */
|
|
11339
|
+
children: /* @__PURE__ */ jsx81(IconPlus5, { size: 16 })
|
|
11173
11340
|
}
|
|
11174
11341
|
) }),
|
|
11175
|
-
/* @__PURE__ */
|
|
11176
|
-
/* @__PURE__ */
|
|
11177
|
-
/* @__PURE__ */
|
|
11342
|
+
/* @__PURE__ */ jsxs48(DropdownMenuContent, { align: "start", children: [
|
|
11343
|
+
/* @__PURE__ */ jsx81(DropdownMenuItem, { onClick: handleAddCondition, children: "Add Condition" }),
|
|
11344
|
+
/* @__PURE__ */ jsx81(DropdownMenuItem, { onClick: handleAddGroup, children: "Add Group" })
|
|
11178
11345
|
] })
|
|
11179
11346
|
] }),
|
|
11180
|
-
node.not && /* @__PURE__ */
|
|
11181
|
-
node.boost !== void 0 && /* @__PURE__ */
|
|
11182
|
-
!isRoot && /* @__PURE__ */
|
|
11347
|
+
node.not && /* @__PURE__ */ jsx81(NotBadge, {}),
|
|
11348
|
+
node.boost !== void 0 && /* @__PURE__ */ jsx81(BoostBadge, { node }),
|
|
11349
|
+
!isRoot && /* @__PURE__ */ jsxs48(
|
|
11183
11350
|
"div",
|
|
11184
11351
|
{
|
|
11185
11352
|
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
11353
|
children: [
|
|
11187
|
-
/* @__PURE__ */
|
|
11188
|
-
/* @__PURE__ */
|
|
11354
|
+
/* @__PURE__ */ jsx81(NodeActionsMenu, { node }),
|
|
11355
|
+
/* @__PURE__ */ jsx81(
|
|
11189
11356
|
"button",
|
|
11190
11357
|
{
|
|
11191
11358
|
type: "button",
|
|
11192
11359
|
onClick: handleDeleteGroup,
|
|
11193
11360
|
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__ */
|
|
11361
|
+
children: /* @__PURE__ */ jsx81(IconX4, { size: 16 })
|
|
11195
11362
|
}
|
|
11196
11363
|
)
|
|
11197
11364
|
]
|
|
11198
11365
|
}
|
|
11199
11366
|
)
|
|
11200
11367
|
] }),
|
|
11201
|
-
/* @__PURE__ */
|
|
11368
|
+
/* @__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
11369
|
EmptyGroupDropZone,
|
|
11203
11370
|
{
|
|
11204
11371
|
groupId: node.id,
|
|
11205
11372
|
isOver: activeOverId === `drop-${node.id}-end`,
|
|
11206
11373
|
onAddCondition: fieldInfos.length > 0 ? handleAddCondition : void 0
|
|
11207
11374
|
}
|
|
11208
|
-
) : /* @__PURE__ */
|
|
11375
|
+
) : /* @__PURE__ */ jsxs48(Fragment17, { children: [
|
|
11209
11376
|
node.children.map(
|
|
11210
|
-
(child) => !child.not && /* @__PURE__ */
|
|
11377
|
+
(child) => !child.not && /* @__PURE__ */ jsx81(
|
|
11211
11378
|
ChildRow,
|
|
11212
11379
|
{
|
|
11213
11380
|
groupId: node.id,
|
|
@@ -11219,15 +11386,15 @@ var InnerGroup = ({
|
|
|
11219
11386
|
child.id
|
|
11220
11387
|
)
|
|
11221
11388
|
),
|
|
11222
|
-
node.children.some((child) => child.not) && /* @__PURE__ */
|
|
11223
|
-
/* @__PURE__ */
|
|
11224
|
-
/* @__PURE__ */
|
|
11225
|
-
/* @__PURE__ */
|
|
11226
|
-
/* @__PURE__ */
|
|
11389
|
+
node.children.some((child) => child.not) && /* @__PURE__ */ jsxs48(Tooltip, { delayDuration: 200, children: [
|
|
11390
|
+
/* @__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" }) }),
|
|
11391
|
+
/* @__PURE__ */ jsxs48(TooltipContent, { side: "right", className: "max-w-xs", children: [
|
|
11392
|
+
/* @__PURE__ */ jsx81("span", { children: "Keys matching any of the conditions below are excluded from the results." }),
|
|
11393
|
+
/* @__PURE__ */ jsx81(DocsLink, { href: "https://upstash.com/docs/redis/search/query-operators/boolean-operators/must-not" })
|
|
11227
11394
|
] })
|
|
11228
11395
|
] }),
|
|
11229
11396
|
node.children.map(
|
|
11230
|
-
(child) => child.not && /* @__PURE__ */
|
|
11397
|
+
(child) => child.not && /* @__PURE__ */ jsx81(
|
|
11231
11398
|
ChildRow,
|
|
11232
11399
|
{
|
|
11233
11400
|
groupId: node.id,
|
|
@@ -11239,7 +11406,7 @@ var InnerGroup = ({
|
|
|
11239
11406
|
child.id
|
|
11240
11407
|
)
|
|
11241
11408
|
),
|
|
11242
|
-
/* @__PURE__ */
|
|
11409
|
+
/* @__PURE__ */ jsx81(
|
|
11243
11410
|
DropIndicator,
|
|
11244
11411
|
{
|
|
11245
11412
|
id: `drop-${node.id}-end`,
|
|
@@ -11254,7 +11421,7 @@ var QueryGroup = ({ node, isRoot = false, depth }) => {
|
|
|
11254
11421
|
const [droppingId, setDroppingId] = useState27(null);
|
|
11255
11422
|
if (node.type !== "group") return;
|
|
11256
11423
|
if (!isRoot) {
|
|
11257
|
-
return /* @__PURE__ */
|
|
11424
|
+
return /* @__PURE__ */ jsx81(
|
|
11258
11425
|
InnerGroup,
|
|
11259
11426
|
{
|
|
11260
11427
|
node,
|
|
@@ -11265,13 +11432,13 @@ var QueryGroup = ({ node, isRoot = false, depth }) => {
|
|
|
11265
11432
|
}
|
|
11266
11433
|
);
|
|
11267
11434
|
}
|
|
11268
|
-
return /* @__PURE__ */
|
|
11435
|
+
return /* @__PURE__ */ jsx81(
|
|
11269
11436
|
QueryDndProvider,
|
|
11270
11437
|
{
|
|
11271
11438
|
rootNode: node,
|
|
11272
11439
|
setActiveOverId,
|
|
11273
11440
|
setDroppingId,
|
|
11274
|
-
children: /* @__PURE__ */
|
|
11441
|
+
children: /* @__PURE__ */ jsx81(
|
|
11275
11442
|
InnerGroup,
|
|
11276
11443
|
{
|
|
11277
11444
|
node,
|
|
@@ -11495,7 +11662,7 @@ var useQueryStateSync = () => {
|
|
|
11495
11662
|
};
|
|
11496
11663
|
|
|
11497
11664
|
// src/components/databrowser/components/ui-query-builder/ui-query-builder.tsx
|
|
11498
|
-
import { jsx as
|
|
11665
|
+
import { jsx as jsx82, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
11499
11666
|
var UIQueryBuilder = () => {
|
|
11500
11667
|
const { valuesSearch } = useTab();
|
|
11501
11668
|
const { data: indexDetails } = useFetchSearchIndex(valuesSearch.index);
|
|
@@ -11529,27 +11696,27 @@ var UIQueryBuilder = () => {
|
|
|
11529
11696
|
obs.observe(el);
|
|
11530
11697
|
return () => obs.disconnect();
|
|
11531
11698
|
}, [recomputeShadows]);
|
|
11532
|
-
return /* @__PURE__ */
|
|
11533
|
-
/* @__PURE__ */
|
|
11699
|
+
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: [
|
|
11700
|
+
/* @__PURE__ */ jsx82(
|
|
11534
11701
|
"div",
|
|
11535
11702
|
{
|
|
11536
11703
|
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
11704
|
}
|
|
11538
11705
|
),
|
|
11539
|
-
/* @__PURE__ */
|
|
11706
|
+
/* @__PURE__ */ jsx82(
|
|
11540
11707
|
"div",
|
|
11541
11708
|
{
|
|
11542
11709
|
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
11710
|
}
|
|
11544
11711
|
),
|
|
11545
|
-
/* @__PURE__ */
|
|
11712
|
+
/* @__PURE__ */ jsx82(
|
|
11546
11713
|
ScrollArea,
|
|
11547
11714
|
{
|
|
11548
11715
|
ref: scrollAreaRef,
|
|
11549
11716
|
onScroll: recomputeShadows,
|
|
11550
11717
|
className: "h-full",
|
|
11551
11718
|
scrollBarClassName: "py-1",
|
|
11552
|
-
children: /* @__PURE__ */
|
|
11719
|
+
children: /* @__PURE__ */ jsx82("div", { className: "p-4", children: /* @__PURE__ */ jsx82(QueryGroup, { node: queryState.root, isRoot: true, depth: 0 }) })
|
|
11553
11720
|
}
|
|
11554
11721
|
)
|
|
11555
11722
|
] }) });
|
|
@@ -11622,7 +11789,7 @@ var extractFieldInfo = (schema) => {
|
|
|
11622
11789
|
};
|
|
11623
11790
|
|
|
11624
11791
|
// src/components/databrowser/components/databrowser-instance.tsx
|
|
11625
|
-
import { jsx as
|
|
11792
|
+
import { jsx as jsx83, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
11626
11793
|
var PREFIX = "const query: Query = ";
|
|
11627
11794
|
var QueryBuilderContent = () => {
|
|
11628
11795
|
const { valuesSearch, queryBuilderMode, setQueryBuilderMode } = useTab();
|
|
@@ -11644,8 +11811,8 @@ var QueryBuilderContent = () => {
|
|
|
11644
11811
|
setQueryBuilderMode(newMode);
|
|
11645
11812
|
};
|
|
11646
11813
|
const errorMessage = switchError ?? (query.error ? formatUpstashErrorMessage(query.error) : void 0);
|
|
11647
|
-
return /* @__PURE__ */
|
|
11648
|
-
/* @__PURE__ */
|
|
11814
|
+
return /* @__PURE__ */ jsxs50("div", { className: "relative flex h-full min-h-0 flex-col", children: [
|
|
11815
|
+
/* @__PURE__ */ jsx83("div", { className: "absolute right-4 top-4 z-[2]", children: /* @__PURE__ */ jsx83(
|
|
11649
11816
|
Segmented,
|
|
11650
11817
|
{
|
|
11651
11818
|
options: [
|
|
@@ -11657,13 +11824,13 @@ var QueryBuilderContent = () => {
|
|
|
11657
11824
|
buttonClassName: "h-6"
|
|
11658
11825
|
}
|
|
11659
11826
|
) }),
|
|
11660
|
-
queryBuilderMode === "ui" ? /* @__PURE__ */
|
|
11661
|
-
/* @__PURE__ */
|
|
11662
|
-
/* @__PURE__ */
|
|
11827
|
+
queryBuilderMode === "ui" ? /* @__PURE__ */ jsx83(UIQueryBuilder, {}) : /* @__PURE__ */ jsx83(QueryBuilder, {}),
|
|
11828
|
+
/* @__PURE__ */ jsx83(QueryBuilderError, { error: errorMessage, autoHide: Boolean(switchError) }),
|
|
11829
|
+
/* @__PURE__ */ jsx83(
|
|
11663
11830
|
DocsLink,
|
|
11664
11831
|
{
|
|
11665
11832
|
className: "absolute bottom-2 right-2 text-sm",
|
|
11666
|
-
href: "https://upstash
|
|
11833
|
+
href: "https://upstash.com/docs/redis/search/query-operators/boolean-operators/overview"
|
|
11667
11834
|
}
|
|
11668
11835
|
)
|
|
11669
11836
|
] });
|
|
@@ -11674,8 +11841,8 @@ var SearchContent = () => {
|
|
|
11674
11841
|
return null;
|
|
11675
11842
|
}
|
|
11676
11843
|
const hasIndexes = indexes && indexes.length > 0;
|
|
11677
|
-
if (!hasIndexes) return /* @__PURE__ */
|
|
11678
|
-
return /* @__PURE__ */
|
|
11844
|
+
if (!hasIndexes) return /* @__PURE__ */ jsx83(SearchEmptyState, {});
|
|
11845
|
+
return /* @__PURE__ */ jsx83(QueryBuilderContent, {});
|
|
11679
11846
|
};
|
|
11680
11847
|
var DatabrowserInstance = ({
|
|
11681
11848
|
hidden,
|
|
@@ -11694,7 +11861,7 @@ var DatabrowserInstance = ({
|
|
|
11694
11861
|
}
|
|
11695
11862
|
}, [tabType, isValuesSearchSelected, setIsValuesSearchSelected]);
|
|
11696
11863
|
const showEmptyState = isValuesSearchSelected && !isLoading && (!indexes || indexes.length === 0);
|
|
11697
|
-
return /* @__PURE__ */
|
|
11864
|
+
return /* @__PURE__ */ jsx83(KeysProvider, { children: /* @__PURE__ */ jsxs50(
|
|
11698
11865
|
"div",
|
|
11699
11866
|
{
|
|
11700
11867
|
className: cn(
|
|
@@ -11702,49 +11869,49 @@ var DatabrowserInstance = ({
|
|
|
11702
11869
|
hidden && "hidden"
|
|
11703
11870
|
),
|
|
11704
11871
|
children: [
|
|
11705
|
-
/* @__PURE__ */
|
|
11706
|
-
/* @__PURE__ */
|
|
11707
|
-
!isValuesSearchSelected && /* @__PURE__ */
|
|
11872
|
+
/* @__PURE__ */ jsxs50("div", { className: "space-y-3 py-5", children: [
|
|
11873
|
+
/* @__PURE__ */ jsx83(Header, { tabType, allowSearch }),
|
|
11874
|
+
!isValuesSearchSelected && /* @__PURE__ */ jsx83(HeaderError, {})
|
|
11708
11875
|
] }),
|
|
11709
|
-
showEmptyState ? /* @__PURE__ */
|
|
11876
|
+
showEmptyState ? /* @__PURE__ */ jsx83(SearchEmptyState, {}) : isValuesSearchSelected ? /* @__PURE__ */ jsxs50(
|
|
11710
11877
|
PanelGroup,
|
|
11711
11878
|
{
|
|
11712
11879
|
autoSaveId: "search-layout",
|
|
11713
11880
|
direction: "vertical",
|
|
11714
11881
|
className: "h-full w-full !overflow-visible text-sm antialiased",
|
|
11715
11882
|
children: [
|
|
11716
|
-
/* @__PURE__ */
|
|
11883
|
+
/* @__PURE__ */ jsx83(
|
|
11717
11884
|
Panel,
|
|
11718
11885
|
{
|
|
11719
11886
|
defaultSize: 30,
|
|
11720
11887
|
minSize: 15,
|
|
11721
11888
|
maxSize: 60,
|
|
11722
11889
|
className: queryBuilderMode === "code" ? "!overflow-visible" : "",
|
|
11723
|
-
children: /* @__PURE__ */
|
|
11890
|
+
children: /* @__PURE__ */ jsx83(SearchContent, {})
|
|
11724
11891
|
}
|
|
11725
11892
|
),
|
|
11726
|
-
/* @__PURE__ */
|
|
11727
|
-
/* @__PURE__ */
|
|
11728
|
-
/* @__PURE__ */
|
|
11729
|
-
/* @__PURE__ */
|
|
11730
|
-
/* @__PURE__ */
|
|
11893
|
+
/* @__PURE__ */ jsx83(ResizeHandle, { direction: "vertical" }),
|
|
11894
|
+
/* @__PURE__ */ jsx83(Panel, { minSize: 30, children: /* @__PURE__ */ jsxs50(PanelGroup, { autoSaveId: "persistence", direction: "horizontal", className: "h-full w-full", children: [
|
|
11895
|
+
/* @__PURE__ */ jsx83(Panel, { defaultSize: 30, minSize: 30, children: /* @__PURE__ */ jsx83(Sidebar, {}) }),
|
|
11896
|
+
/* @__PURE__ */ jsx83(ResizeHandle, {}),
|
|
11897
|
+
/* @__PURE__ */ jsx83(Panel, { minSize: 40, children: /* @__PURE__ */ jsx83(DataDisplay, {}) })
|
|
11731
11898
|
] }) })
|
|
11732
11899
|
]
|
|
11733
11900
|
}
|
|
11734
|
-
) : /* @__PURE__ */
|
|
11901
|
+
) : /* @__PURE__ */ jsxs50(
|
|
11735
11902
|
PanelGroup,
|
|
11736
11903
|
{
|
|
11737
11904
|
autoSaveId: "persistence",
|
|
11738
11905
|
direction: "horizontal",
|
|
11739
11906
|
className: "h-full w-full text-sm antialiased",
|
|
11740
11907
|
children: [
|
|
11741
|
-
/* @__PURE__ */
|
|
11742
|
-
/* @__PURE__ */
|
|
11743
|
-
/* @__PURE__ */
|
|
11908
|
+
/* @__PURE__ */ jsx83(Panel, { defaultSize: 30, minSize: 30, children: /* @__PURE__ */ jsx83(Sidebar, {}) }),
|
|
11909
|
+
/* @__PURE__ */ jsx83(ResizeHandle, {}),
|
|
11910
|
+
/* @__PURE__ */ jsx83(Panel, { minSize: 40, children: /* @__PURE__ */ jsx83(DataDisplay, {}) })
|
|
11744
11911
|
]
|
|
11745
11912
|
}
|
|
11746
11913
|
),
|
|
11747
|
-
/* @__PURE__ */
|
|
11914
|
+
/* @__PURE__ */ jsx83(Toaster, {})
|
|
11748
11915
|
]
|
|
11749
11916
|
}
|
|
11750
11917
|
) });
|
|
@@ -11769,8 +11936,8 @@ import { IconChevronDown as IconChevronDown3, IconPlus as IconPlus6, IconWindowM
|
|
|
11769
11936
|
import * as React15 from "react";
|
|
11770
11937
|
import { IconSearch as IconSearch4 } from "@tabler/icons-react";
|
|
11771
11938
|
import { Command as CommandPrimitive } from "cmdk";
|
|
11772
|
-
import { jsx as
|
|
11773
|
-
var Command = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
11939
|
+
import { jsx as jsx84, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
11940
|
+
var Command = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx84(
|
|
11774
11941
|
CommandPrimitive,
|
|
11775
11942
|
{
|
|
11776
11943
|
ref,
|
|
@@ -11782,9 +11949,9 @@ var Command = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
11782
11949
|
}
|
|
11783
11950
|
));
|
|
11784
11951
|
Command.displayName = CommandPrimitive.displayName;
|
|
11785
|
-
var CommandInput = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
11786
|
-
/* @__PURE__ */
|
|
11787
|
-
/* @__PURE__ */
|
|
11952
|
+
var CommandInput = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs51("div", { className: "flex items-center border-b px-3", "cmdk-input-wrapper": "", children: [
|
|
11953
|
+
/* @__PURE__ */ jsx84(IconSearch4, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
|
|
11954
|
+
/* @__PURE__ */ jsx84(
|
|
11788
11955
|
CommandPrimitive.Input,
|
|
11789
11956
|
{
|
|
11790
11957
|
ref,
|
|
@@ -11797,7 +11964,7 @@ var CommandInput = React15.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
11797
11964
|
)
|
|
11798
11965
|
] }));
|
|
11799
11966
|
CommandInput.displayName = CommandPrimitive.Input.displayName;
|
|
11800
|
-
var CommandList = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
11967
|
+
var CommandList = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx84(
|
|
11801
11968
|
CommandPrimitive.List,
|
|
11802
11969
|
{
|
|
11803
11970
|
ref,
|
|
@@ -11806,9 +11973,9 @@ var CommandList = React15.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
11806
11973
|
}
|
|
11807
11974
|
));
|
|
11808
11975
|
CommandList.displayName = CommandPrimitive.List.displayName;
|
|
11809
|
-
var CommandEmpty = React15.forwardRef((props, ref) => /* @__PURE__ */
|
|
11976
|
+
var CommandEmpty = React15.forwardRef((props, ref) => /* @__PURE__ */ jsx84(CommandPrimitive.Empty, { ref, className: "py-6 text-center text-sm", ...props }));
|
|
11810
11977
|
CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
|
|
11811
|
-
var CommandGroup = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
11978
|
+
var CommandGroup = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx84(
|
|
11812
11979
|
CommandPrimitive.Group,
|
|
11813
11980
|
{
|
|
11814
11981
|
ref,
|
|
@@ -11820,7 +11987,7 @@ var CommandGroup = React15.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
11820
11987
|
}
|
|
11821
11988
|
));
|
|
11822
11989
|
CommandGroup.displayName = CommandPrimitive.Group.displayName;
|
|
11823
|
-
var CommandSeparator = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
11990
|
+
var CommandSeparator = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx84(
|
|
11824
11991
|
CommandPrimitive.Separator,
|
|
11825
11992
|
{
|
|
11826
11993
|
ref,
|
|
@@ -11829,7 +11996,7 @@ var CommandSeparator = React15.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
11829
11996
|
}
|
|
11830
11997
|
));
|
|
11831
11998
|
CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
|
|
11832
|
-
var CommandItem = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
11999
|
+
var CommandItem = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx84(
|
|
11833
12000
|
CommandPrimitive.Item,
|
|
11834
12001
|
{
|
|
11835
12002
|
ref,
|
|
@@ -11842,7 +12009,7 @@ var CommandItem = React15.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
11842
12009
|
));
|
|
11843
12010
|
CommandItem.displayName = CommandPrimitive.Item.displayName;
|
|
11844
12011
|
var CommandShortcut = ({ className, ...props }) => {
|
|
11845
|
-
return /* @__PURE__ */
|
|
12012
|
+
return /* @__PURE__ */ jsx84("span", { className: cn("ml-auto text-xs tracking-widest text-zinc-500", className), ...props });
|
|
11846
12013
|
};
|
|
11847
12014
|
CommandShortcut.displayName = "CommandShortcut";
|
|
11848
12015
|
|
|
@@ -11883,16 +12050,16 @@ var useOverflow = () => {
|
|
|
11883
12050
|
};
|
|
11884
12051
|
|
|
11885
12052
|
// src/components/databrowser/components/tab-type-icon.tsx
|
|
11886
|
-
import { jsx as
|
|
12053
|
+
import { jsx as jsx85 } from "react/jsx-runtime";
|
|
11887
12054
|
function TabTypeIcon({ selectedKey }) {
|
|
11888
12055
|
const { data: keyType, isLoading } = useFetchKeyType(selectedKey);
|
|
11889
|
-
if (isLoading) return /* @__PURE__ */
|
|
12056
|
+
if (isLoading) return /* @__PURE__ */ jsx85(Skeleton, { className: "h-5 w-5 rounded" });
|
|
11890
12057
|
if (!keyType || keyType === "none") return;
|
|
11891
|
-
return /* @__PURE__ */
|
|
12058
|
+
return /* @__PURE__ */ jsx85(TypeTag, { variant: keyType, type: "icon" });
|
|
11892
12059
|
}
|
|
11893
12060
|
|
|
11894
12061
|
// src/components/databrowser/components/tab.tsx
|
|
11895
|
-
import { jsx as
|
|
12062
|
+
import { jsx as jsx86, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
11896
12063
|
var Tab = ({ id, isList }) => {
|
|
11897
12064
|
const { active, search, selectedKey, valuesSearch, pinned, isValuesSearchSelected } = useTab();
|
|
11898
12065
|
const {
|
|
@@ -11908,8 +12075,8 @@ var Tab = ({ id, isList }) => {
|
|
|
11908
12075
|
const hasPinnedTabs = tabs.some(([, data]) => data.pinned);
|
|
11909
12076
|
const { ref, isOverflow } = useOverflow();
|
|
11910
12077
|
const label = isValuesSearchSelected ? valuesSearch.index : search.key || selectedKey;
|
|
11911
|
-
const iconNode = isValuesSearchSelected ? /* @__PURE__ */
|
|
11912
|
-
const tabNode = /* @__PURE__ */
|
|
12078
|
+
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;
|
|
12079
|
+
const tabNode = /* @__PURE__ */ jsxs52(
|
|
11913
12080
|
"div",
|
|
11914
12081
|
{
|
|
11915
12082
|
id: isList ? `list-tab-${id}` : `tab-${id}`,
|
|
@@ -11920,8 +12087,8 @@ var Tab = ({ id, isList }) => {
|
|
|
11920
12087
|
!isList && (active ? "bg-white text-zinc-950" : "bg-zinc-200 text-zinc-600 hover:bg-zinc-100")
|
|
11921
12088
|
),
|
|
11922
12089
|
children: [
|
|
11923
|
-
/* @__PURE__ */
|
|
11924
|
-
/* @__PURE__ */
|
|
12090
|
+
/* @__PURE__ */ jsx86("div", { className: cn(!active && "transition-colors"), children: iconNode }),
|
|
12091
|
+
/* @__PURE__ */ jsx86(
|
|
11925
12092
|
"span",
|
|
11926
12093
|
{
|
|
11927
12094
|
ref,
|
|
@@ -11929,8 +12096,8 @@ var Tab = ({ id, isList }) => {
|
|
|
11929
12096
|
children: label || "New Tab"
|
|
11930
12097
|
}
|
|
11931
12098
|
),
|
|
11932
|
-
pinned && /* @__PURE__ */
|
|
11933
|
-
tabs.length > 1 && !pinned && /* @__PURE__ */
|
|
12099
|
+
pinned && /* @__PURE__ */ jsx86(IconPin, { size: 14, className: "text-zinc-500" }),
|
|
12100
|
+
tabs.length > 1 && !pinned && /* @__PURE__ */ jsx86(
|
|
11934
12101
|
"button",
|
|
11935
12102
|
{
|
|
11936
12103
|
onClick: (e) => {
|
|
@@ -11938,46 +12105,46 @@ var Tab = ({ id, isList }) => {
|
|
|
11938
12105
|
removeTab(id);
|
|
11939
12106
|
},
|
|
11940
12107
|
className: "p-[2px] text-zinc-400 transition-colors hover:text-zinc-500",
|
|
11941
|
-
children: /* @__PURE__ */
|
|
12108
|
+
children: /* @__PURE__ */ jsx86(IconX5, { size: 16 })
|
|
11942
12109
|
}
|
|
11943
12110
|
)
|
|
11944
12111
|
]
|
|
11945
12112
|
}
|
|
11946
12113
|
);
|
|
11947
|
-
return /* @__PURE__ */
|
|
11948
|
-
/* @__PURE__ */
|
|
11949
|
-
/* @__PURE__ */
|
|
12114
|
+
return /* @__PURE__ */ jsxs52(ContextMenu, { children: [
|
|
12115
|
+
/* @__PURE__ */ jsx86(SimpleTooltip, { content: isOverflow ? label : void 0, children: /* @__PURE__ */ jsx86(ContextMenuTrigger, { asChild: true, children: tabNode }) }),
|
|
12116
|
+
/* @__PURE__ */ jsxs52(
|
|
11950
12117
|
ContextMenuContent,
|
|
11951
12118
|
{
|
|
11952
12119
|
onClick: (e) => {
|
|
11953
12120
|
e.stopPropagation();
|
|
11954
12121
|
},
|
|
11955
12122
|
children: [
|
|
11956
|
-
/* @__PURE__ */
|
|
11957
|
-
/* @__PURE__ */
|
|
12123
|
+
/* @__PURE__ */ jsxs52(ContextMenuItem, { onSelect: () => togglePinTab(id), className: "gap-2", children: [
|
|
12124
|
+
/* @__PURE__ */ jsx86(IconPin, { size: 16 }),
|
|
11958
12125
|
pinned ? "Unpin Tab" : "Pin Tab"
|
|
11959
12126
|
] }),
|
|
11960
|
-
/* @__PURE__ */
|
|
11961
|
-
/* @__PURE__ */
|
|
12127
|
+
/* @__PURE__ */ jsxs52(ContextMenuItem, { onSelect: () => duplicateTab(id), className: "gap-2", children: [
|
|
12128
|
+
/* @__PURE__ */ jsx86(IconCopyPlus, { size: 16 }),
|
|
11962
12129
|
"Duplicate Tab"
|
|
11963
12130
|
] }),
|
|
11964
|
-
/* @__PURE__ */
|
|
11965
|
-
/* @__PURE__ */
|
|
11966
|
-
/* @__PURE__ */
|
|
12131
|
+
/* @__PURE__ */ jsx86(ContextMenuSeparator, {}),
|
|
12132
|
+
/* @__PURE__ */ jsxs52(ContextMenuItem, { onSelect: () => forceRemoveTab(id), className: "gap-2", children: [
|
|
12133
|
+
/* @__PURE__ */ jsx86(IconX5, { size: 16 }),
|
|
11967
12134
|
"Close Tab"
|
|
11968
12135
|
] }),
|
|
11969
|
-
/* @__PURE__ */
|
|
11970
|
-
/* @__PURE__ */
|
|
12136
|
+
/* @__PURE__ */ jsxs52(ContextMenuItem, { onSelect: () => closeOtherTabs(id), className: "gap-2", children: [
|
|
12137
|
+
/* @__PURE__ */ jsx86(IconSquareX, { size: 16 }),
|
|
11971
12138
|
"Close Other Tabs"
|
|
11972
12139
|
] }),
|
|
11973
|
-
/* @__PURE__ */
|
|
12140
|
+
/* @__PURE__ */ jsxs52(
|
|
11974
12141
|
ContextMenuItem,
|
|
11975
12142
|
{
|
|
11976
12143
|
onSelect: () => closeAllButPinned(),
|
|
11977
12144
|
className: "gap-2",
|
|
11978
12145
|
disabled: !hasPinnedTabs,
|
|
11979
12146
|
children: [
|
|
11980
|
-
/* @__PURE__ */
|
|
12147
|
+
/* @__PURE__ */ jsx86(IconArrowsMinimize, { size: 16 }),
|
|
11981
12148
|
"Close All But Pinned"
|
|
11982
12149
|
]
|
|
11983
12150
|
}
|
|
@@ -11989,7 +12156,7 @@ var Tab = ({ id, isList }) => {
|
|
|
11989
12156
|
};
|
|
11990
12157
|
|
|
11991
12158
|
// src/components/databrowser/components/databrowser-tabs.tsx
|
|
11992
|
-
import { jsx as
|
|
12159
|
+
import { jsx as jsx87, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
11993
12160
|
var SortableTab = ({ id }) => {
|
|
11994
12161
|
const [originalWidth, setOriginalWidth] = useState32(null);
|
|
11995
12162
|
const textRef = useRef11(null);
|
|
@@ -12057,7 +12224,7 @@ var SortableTab = ({ id }) => {
|
|
|
12057
12224
|
minWidth: originalWidth ? `${originalWidth}px` : void 0
|
|
12058
12225
|
} : {}
|
|
12059
12226
|
};
|
|
12060
|
-
return /* @__PURE__ */
|
|
12227
|
+
return /* @__PURE__ */ jsx87(
|
|
12061
12228
|
"div",
|
|
12062
12229
|
{
|
|
12063
12230
|
ref: measureRef,
|
|
@@ -12065,7 +12232,7 @@ var SortableTab = ({ id }) => {
|
|
|
12065
12232
|
className: isDragging ? "cursor-grabbing" : isPinned ? "cursor-default" : "cursor-grab",
|
|
12066
12233
|
...attributes,
|
|
12067
12234
|
...isPinned ? {} : listeners2,
|
|
12068
|
-
children: /* @__PURE__ */
|
|
12235
|
+
children: /* @__PURE__ */ jsx87(TabIdProvider, { value: id, children: /* @__PURE__ */ jsx87(Tab, { id }) })
|
|
12069
12236
|
}
|
|
12070
12237
|
);
|
|
12071
12238
|
};
|
|
@@ -12140,28 +12307,28 @@ var DatabrowserTabs = ({ onFullScreenClick }) => {
|
|
|
12140
12307
|
reorderTabs(oldIndex, newIndex);
|
|
12141
12308
|
}
|
|
12142
12309
|
};
|
|
12143
|
-
return /* @__PURE__ */
|
|
12144
|
-
/* @__PURE__ */
|
|
12145
|
-
/* @__PURE__ */
|
|
12310
|
+
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: [
|
|
12311
|
+
/* @__PURE__ */ jsxs53("div", { className: "relative min-w-0 flex-1", children: [
|
|
12312
|
+
/* @__PURE__ */ jsx87(
|
|
12146
12313
|
"div",
|
|
12147
12314
|
{
|
|
12148
12315
|
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
12316
|
}
|
|
12150
12317
|
),
|
|
12151
|
-
/* @__PURE__ */
|
|
12318
|
+
/* @__PURE__ */ jsx87(
|
|
12152
12319
|
"div",
|
|
12153
12320
|
{
|
|
12154
12321
|
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
12322
|
}
|
|
12156
12323
|
),
|
|
12157
|
-
/* @__PURE__ */
|
|
12324
|
+
/* @__PURE__ */ jsxs53(
|
|
12158
12325
|
"div",
|
|
12159
12326
|
{
|
|
12160
12327
|
ref: scrollRef,
|
|
12161
12328
|
onScroll: recomputeShadows,
|
|
12162
12329
|
className: "scrollbar-hide flex min-w-0 flex-1 items-center gap-1 overflow-x-auto [&::-webkit-scrollbar]:hidden",
|
|
12163
12330
|
children: [
|
|
12164
|
-
/* @__PURE__ */
|
|
12331
|
+
/* @__PURE__ */ jsx87(
|
|
12165
12332
|
DndContext2,
|
|
12166
12333
|
{
|
|
12167
12334
|
sensors,
|
|
@@ -12173,32 +12340,32 @@ var DatabrowserTabs = ({ onFullScreenClick }) => {
|
|
|
12173
12340
|
strategy: MeasuringStrategy.Always
|
|
12174
12341
|
}
|
|
12175
12342
|
},
|
|
12176
|
-
children: /* @__PURE__ */
|
|
12343
|
+
children: /* @__PURE__ */ jsx87(
|
|
12177
12344
|
SortableContext,
|
|
12178
12345
|
{
|
|
12179
12346
|
items: sortedTabs.map(([id]) => id),
|
|
12180
12347
|
strategy: horizontalListSortingStrategy,
|
|
12181
|
-
children: selectedTab && sortedTabs.map(([id]) => /* @__PURE__ */
|
|
12348
|
+
children: selectedTab && sortedTabs.map(([id]) => /* @__PURE__ */ jsx87(SortableTab, { id }, id))
|
|
12182
12349
|
}
|
|
12183
12350
|
)
|
|
12184
12351
|
}
|
|
12185
12352
|
),
|
|
12186
|
-
!isOverflow && /* @__PURE__ */
|
|
12353
|
+
!isOverflow && /* @__PURE__ */ jsx87("div", { className: "flex items-center gap-1 pl-1 pr-1", children: /* @__PURE__ */ jsx87(AddTabButton, {}) })
|
|
12187
12354
|
]
|
|
12188
12355
|
}
|
|
12189
12356
|
)
|
|
12190
12357
|
] }),
|
|
12191
|
-
/* @__PURE__ */
|
|
12192
|
-
isOverflow && /* @__PURE__ */
|
|
12193
|
-
tabs.length > 1 && /* @__PURE__ */
|
|
12194
|
-
onFullScreenClick && /* @__PURE__ */
|
|
12358
|
+
/* @__PURE__ */ jsxs53("div", { className: "flex items-center gap-1 px-1", children: [
|
|
12359
|
+
isOverflow && /* @__PURE__ */ jsx87(AddTabButton, {}),
|
|
12360
|
+
tabs.length > 1 && /* @__PURE__ */ jsx87(TabsListButton, { tabs, onSelectTab: selectTab }),
|
|
12361
|
+
onFullScreenClick && /* @__PURE__ */ jsx87(
|
|
12195
12362
|
Button,
|
|
12196
12363
|
{
|
|
12197
12364
|
"aria-label": "Toggle fullscreen",
|
|
12198
12365
|
variant: "secondary",
|
|
12199
12366
|
onClick: onFullScreenClick,
|
|
12200
12367
|
className: "h-[34px] w-[34px] flex-shrink-0 rounded-lg bg-white text-zinc-500 dark:bg-zinc-100",
|
|
12201
|
-
children: /* @__PURE__ */
|
|
12368
|
+
children: /* @__PURE__ */ jsx87(IconWindowMaximize, { size: 16 })
|
|
12202
12369
|
}
|
|
12203
12370
|
)
|
|
12204
12371
|
] })
|
|
@@ -12216,7 +12383,7 @@ function AddTabButton() {
|
|
|
12216
12383
|
tab.scrollIntoView({ behavior: "smooth" });
|
|
12217
12384
|
}, 20);
|
|
12218
12385
|
};
|
|
12219
|
-
return /* @__PURE__ */
|
|
12386
|
+
return /* @__PURE__ */ jsx87(
|
|
12220
12387
|
Button,
|
|
12221
12388
|
{
|
|
12222
12389
|
"aria-label": "Add new tab",
|
|
@@ -12224,7 +12391,7 @@ function AddTabButton() {
|
|
|
12224
12391
|
size: "icon-sm",
|
|
12225
12392
|
onClick: handleAddTab,
|
|
12226
12393
|
className: "flex-shrink-0 bg-zinc-200 ",
|
|
12227
|
-
children: /* @__PURE__ */
|
|
12394
|
+
children: /* @__PURE__ */ jsx87(IconPlus6, { className: "text-zinc-600", size: 16 })
|
|
12228
12395
|
}
|
|
12229
12396
|
);
|
|
12230
12397
|
}
|
|
@@ -12250,22 +12417,22 @@ function TabsListButton({
|
|
|
12250
12417
|
tab.scrollIntoView({ behavior: "smooth" });
|
|
12251
12418
|
}, 20);
|
|
12252
12419
|
};
|
|
12253
|
-
return /* @__PURE__ */
|
|
12254
|
-
/* @__PURE__ */
|
|
12420
|
+
return /* @__PURE__ */ jsxs53(Popover, { open, onOpenChange: setOpen, children: [
|
|
12421
|
+
/* @__PURE__ */ jsx87(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs53(
|
|
12255
12422
|
Button,
|
|
12256
12423
|
{
|
|
12257
12424
|
variant: "secondary",
|
|
12258
12425
|
className: "h-[34px] gap-1 rounded-lg bg-white px-2",
|
|
12259
12426
|
"aria-label": "Search in tabs",
|
|
12260
12427
|
children: [
|
|
12261
|
-
/* @__PURE__ */
|
|
12262
|
-
/* @__PURE__ */
|
|
12428
|
+
/* @__PURE__ */ jsx87("span", { className: "text-xs text-zinc-600", children: tabs.length }),
|
|
12429
|
+
/* @__PURE__ */ jsx87(IconChevronDown3, { className: "text-zinc-500", size: 16 })
|
|
12263
12430
|
]
|
|
12264
12431
|
}
|
|
12265
12432
|
) }),
|
|
12266
|
-
/* @__PURE__ */
|
|
12267
|
-
/* @__PURE__ */
|
|
12268
|
-
/* @__PURE__ */
|
|
12433
|
+
/* @__PURE__ */ jsx87(PopoverContent, { className: "w-96 p-0", align: "end", children: /* @__PURE__ */ jsx87(Command, { children: /* @__PURE__ */ jsxs53(CommandList, { children: [
|
|
12434
|
+
/* @__PURE__ */ jsx87(CommandEmpty, { children: "No tabs" }),
|
|
12435
|
+
/* @__PURE__ */ jsx87(CommandGroup, { children: sorted.map(([_id, item]) => /* @__PURE__ */ jsx87(
|
|
12269
12436
|
CommandItem,
|
|
12270
12437
|
{
|
|
12271
12438
|
style: {
|
|
@@ -12275,7 +12442,7 @@ function TabsListButton({
|
|
|
12275
12442
|
onSelect: () => {
|
|
12276
12443
|
handleSelectTab(item.id);
|
|
12277
12444
|
},
|
|
12278
|
-
children: /* @__PURE__ */
|
|
12445
|
+
children: /* @__PURE__ */ jsx87(TabIdProvider, { value: _id, children: /* @__PURE__ */ jsx87(Tab, { id: _id, isList: true }) })
|
|
12279
12446
|
},
|
|
12280
12447
|
item.id
|
|
12281
12448
|
)) })
|
|
@@ -12284,7 +12451,7 @@ function TabsListButton({
|
|
|
12284
12451
|
}
|
|
12285
12452
|
|
|
12286
12453
|
// src/components/databrowser/index.tsx
|
|
12287
|
-
import { jsx as
|
|
12454
|
+
import { jsx as jsx88, jsxs as jsxs54 } from "react/jsx-runtime";
|
|
12288
12455
|
var RedisBrowser = ({
|
|
12289
12456
|
url,
|
|
12290
12457
|
token,
|
|
@@ -12302,7 +12469,7 @@ var RedisBrowser = ({
|
|
|
12302
12469
|
useEffect26(() => {
|
|
12303
12470
|
queryClient.resetQueries();
|
|
12304
12471
|
}, [credentials.url]);
|
|
12305
|
-
return /* @__PURE__ */
|
|
12472
|
+
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
12473
|
RedisBrowserRoot,
|
|
12307
12474
|
{
|
|
12308
12475
|
allowSearch,
|
|
@@ -12327,15 +12494,15 @@ var RedisBrowserRoot = ({
|
|
|
12327
12494
|
}, [theme]);
|
|
12328
12495
|
return (
|
|
12329
12496
|
/* ups-db is the custom class used to prefix every style in the css bundle */
|
|
12330
|
-
/* @__PURE__ */
|
|
12497
|
+
/* @__PURE__ */ jsx88(
|
|
12331
12498
|
"div",
|
|
12332
12499
|
{
|
|
12333
12500
|
className: `ups-db ${theme === "dark" ? "dark" : ""}`,
|
|
12334
12501
|
style: { height: "100%" },
|
|
12335
12502
|
ref: rootRef,
|
|
12336
|
-
children: /* @__PURE__ */
|
|
12337
|
-
!hideTabs && /* @__PURE__ */
|
|
12338
|
-
/* @__PURE__ */
|
|
12503
|
+
children: /* @__PURE__ */ jsxs54("div", { className: "flex h-full flex-col rounded-[14px] border-[4px] border-zinc-300 text-zinc-700", children: [
|
|
12504
|
+
!hideTabs && /* @__PURE__ */ jsx88(DatabrowserTabs, { onFullScreenClick }),
|
|
12505
|
+
/* @__PURE__ */ jsx88(DatabrowserInstances, { tabType, allowSearch })
|
|
12339
12506
|
] })
|
|
12340
12507
|
}
|
|
12341
12508
|
)
|
|
@@ -12351,7 +12518,7 @@ var DatabrowserInstances = ({
|
|
|
12351
12518
|
else if (!selectedTab) selectTab(tabs[0][0]);
|
|
12352
12519
|
}, [tabs, selectedTab, addTab, selectTab]);
|
|
12353
12520
|
if (!selectedTab) return;
|
|
12354
|
-
return tabs.map(([id]) => /* @__PURE__ */
|
|
12521
|
+
return tabs.map(([id]) => /* @__PURE__ */ jsx88(TabIdProvider, { value: id, children: /* @__PURE__ */ jsx88(
|
|
12355
12522
|
DatabrowserInstance,
|
|
12356
12523
|
{
|
|
12357
12524
|
hidden: id !== selectedTab,
|