@upstash/react-redis-browser 0.2.12 → 0.2.13-canary
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 +191 -149
- package/dist/index.js +1358 -576
- package/dist/index.mjs +1610 -828
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/components/databrowser/index.tsx
|
|
2
|
-
import { useEffect as
|
|
2
|
+
import { useEffect as useEffect15, useMemo as useMemo10, useRef as useRef8 } from "react";
|
|
3
3
|
|
|
4
4
|
// src/dark-mode-context.tsx
|
|
5
5
|
import { createContext, useContext } from "react";
|
|
@@ -193,7 +193,10 @@ var queryClient = new QueryClient({
|
|
|
193
193
|
}
|
|
194
194
|
},
|
|
195
195
|
queryCache: new QueryCache({
|
|
196
|
-
onError:
|
|
196
|
+
onError: (error, query) => {
|
|
197
|
+
if (query.meta?.hideToast) return;
|
|
198
|
+
handleError(error);
|
|
199
|
+
}
|
|
197
200
|
}),
|
|
198
201
|
mutationCache: new MutationCache({
|
|
199
202
|
onError: handleError
|
|
@@ -263,7 +266,7 @@ var DatabrowserProvider = ({
|
|
|
263
266
|
removeItem: () => {
|
|
264
267
|
}
|
|
265
268
|
},
|
|
266
|
-
version:
|
|
269
|
+
version: 6,
|
|
267
270
|
migrate: (originalState, version) => {
|
|
268
271
|
const state = originalState;
|
|
269
272
|
if (version <= 1) {
|
|
@@ -279,6 +282,19 @@ var DatabrowserProvider = ({
|
|
|
279
282
|
];
|
|
280
283
|
});
|
|
281
284
|
}
|
|
285
|
+
if (version <= 5) {
|
|
286
|
+
state.tabs = state.tabs.map(([id, data]) => {
|
|
287
|
+
const oldData = data;
|
|
288
|
+
return [
|
|
289
|
+
id,
|
|
290
|
+
{
|
|
291
|
+
...data,
|
|
292
|
+
valuesSearch: oldData.valuesSearch ?? { index: "", query: "" },
|
|
293
|
+
isValuesSearchSelected: oldData.isValuesSearchSelected ?? false
|
|
294
|
+
}
|
|
295
|
+
];
|
|
296
|
+
});
|
|
297
|
+
}
|
|
282
298
|
return state;
|
|
283
299
|
}
|
|
284
300
|
})
|
|
@@ -310,6 +326,8 @@ var storeCreator = (set, get) => ({
|
|
|
310
326
|
id,
|
|
311
327
|
selectedKeys: [],
|
|
312
328
|
search: { key: "", type: void 0 },
|
|
329
|
+
valuesSearch: { index: "", query: "" },
|
|
330
|
+
isValuesSearchSelected: false,
|
|
313
331
|
pinned: false
|
|
314
332
|
};
|
|
315
333
|
set((old) => ({
|
|
@@ -469,6 +487,58 @@ var storeCreator = (set, get) => ({
|
|
|
469
487
|
return { ...old, tabs: newTabs };
|
|
470
488
|
});
|
|
471
489
|
},
|
|
490
|
+
setValuesSearch: (tabId, valuesSearch) => {
|
|
491
|
+
set((old) => {
|
|
492
|
+
const tabIndex = old.tabs.findIndex(([id]) => id === tabId);
|
|
493
|
+
if (tabIndex === -1) return old;
|
|
494
|
+
const newTabs = [...old.tabs];
|
|
495
|
+
const [, tabData] = newTabs[tabIndex];
|
|
496
|
+
newTabs[tabIndex] = [tabId, { ...tabData, valuesSearch }];
|
|
497
|
+
return { ...old, tabs: newTabs };
|
|
498
|
+
});
|
|
499
|
+
},
|
|
500
|
+
setValuesSearchIndex: (tabId, index) => {
|
|
501
|
+
set((old) => {
|
|
502
|
+
const tabIndex = old.tabs.findIndex(([id]) => id === tabId);
|
|
503
|
+
if (tabIndex === -1) return old;
|
|
504
|
+
const newTabs = [...old.tabs];
|
|
505
|
+
const [, tabData] = newTabs[tabIndex];
|
|
506
|
+
newTabs[tabIndex] = [
|
|
507
|
+
tabId,
|
|
508
|
+
{
|
|
509
|
+
...tabData,
|
|
510
|
+
valuesSearch: { ...tabData.valuesSearch, index }
|
|
511
|
+
}
|
|
512
|
+
];
|
|
513
|
+
return { ...old, tabs: newTabs };
|
|
514
|
+
});
|
|
515
|
+
},
|
|
516
|
+
setValuesSearchQuery: (tabId, query) => {
|
|
517
|
+
set((old) => {
|
|
518
|
+
const tabIndex = old.tabs.findIndex(([id]) => id === tabId);
|
|
519
|
+
if (tabIndex === -1) return old;
|
|
520
|
+
const newTabs = [...old.tabs];
|
|
521
|
+
const [, tabData] = newTabs[tabIndex];
|
|
522
|
+
newTabs[tabIndex] = [
|
|
523
|
+
tabId,
|
|
524
|
+
{
|
|
525
|
+
...tabData,
|
|
526
|
+
valuesSearch: { ...tabData.valuesSearch, query }
|
|
527
|
+
}
|
|
528
|
+
];
|
|
529
|
+
return { ...old, tabs: newTabs };
|
|
530
|
+
});
|
|
531
|
+
},
|
|
532
|
+
setIsValuesSearchSelected: (tabId, isSelected) => {
|
|
533
|
+
set((old) => {
|
|
534
|
+
const tabIndex = old.tabs.findIndex(([id]) => id === tabId);
|
|
535
|
+
if (tabIndex === -1) return old;
|
|
536
|
+
const newTabs = [...old.tabs];
|
|
537
|
+
const [, tabData] = newTabs[tabIndex];
|
|
538
|
+
newTabs[tabIndex] = [tabId, { ...tabData, isValuesSearchSelected: isSelected }];
|
|
539
|
+
return { ...old, tabs: newTabs };
|
|
540
|
+
});
|
|
541
|
+
},
|
|
472
542
|
searchHistory: [],
|
|
473
543
|
addSearchHistory: (key) => {
|
|
474
544
|
set((old) => ({ ...old, searchHistory: [key, ...old.searchHistory] }));
|
|
@@ -498,7 +568,11 @@ var useTab = () => {
|
|
|
498
568
|
setSelectedListItem,
|
|
499
569
|
setSearch,
|
|
500
570
|
setSearchKey,
|
|
501
|
-
setSearchType
|
|
571
|
+
setSearchType,
|
|
572
|
+
setValuesSearch,
|
|
573
|
+
setValuesSearchIndex,
|
|
574
|
+
setValuesSearchQuery,
|
|
575
|
+
setIsValuesSearchSelected
|
|
502
576
|
} = useDatabrowserStore();
|
|
503
577
|
const tabId = useTabId();
|
|
504
578
|
const tabData = useMemo3(() => tabs.find(([id]) => id === tabId)?.[1], [tabs, tabId]);
|
|
@@ -512,13 +586,19 @@ var useTab = () => {
|
|
|
512
586
|
selectedKeys: tabData.selectedKeys ?? [],
|
|
513
587
|
selectedListItem: tabData.selectedListItem,
|
|
514
588
|
search: tabData.search,
|
|
589
|
+
valuesSearch: tabData.valuesSearch,
|
|
590
|
+
isValuesSearchSelected: tabData.isValuesSearchSelected,
|
|
515
591
|
pinned: tabData.pinned,
|
|
516
592
|
setSelectedKey: (key) => setSelectedKey(tabId, key),
|
|
517
593
|
setSelectedKeys: (keys) => setSelectedKeys(tabId, keys),
|
|
518
594
|
setSelectedListItem: (item) => setSelectedListItem(tabId, item),
|
|
519
595
|
setSearch: (search) => setSearch(tabId, search),
|
|
520
596
|
setSearchKey: (key) => setSearchKey(tabId, key),
|
|
521
|
-
setSearchType: (type) => setSearchType(tabId, type)
|
|
597
|
+
setSearchType: (type) => setSearchType(tabId, type),
|
|
598
|
+
setValuesSearch: (search) => setValuesSearch(tabId, search),
|
|
599
|
+
setValuesSearchIndex: (index) => setValuesSearchIndex(tabId, index),
|
|
600
|
+
setValuesSearchQuery: (query) => setValuesSearchQuery(tabId, query),
|
|
601
|
+
setIsValuesSearchSelected: (isSelected) => setIsValuesSearchSelected(tabId, isSelected)
|
|
522
602
|
}),
|
|
523
603
|
[selectedTab, tabs, tabId]
|
|
524
604
|
);
|
|
@@ -3026,9 +3106,14 @@ var twMerge = /* @__PURE__ */ createTailwindMerge(getDefaultConfig);
|
|
|
3026
3106
|
function cn(...inputs) {
|
|
3027
3107
|
return twMerge(clsx(inputs));
|
|
3028
3108
|
}
|
|
3029
|
-
function
|
|
3030
|
-
|
|
3031
|
-
|
|
3109
|
+
function parseJSObjectLiteral(value) {
|
|
3110
|
+
try {
|
|
3111
|
+
let jsonified = value.replaceAll(/([,{]\s*)(\$?[A-Z_a-z]\w*)\s*:/g, '$1"$2":');
|
|
3112
|
+
jsonified = jsonified.replaceAll(/,\s*([\]}])/g, "$1");
|
|
3113
|
+
return JSON.parse(jsonified);
|
|
3114
|
+
} catch {
|
|
3115
|
+
return;
|
|
3116
|
+
}
|
|
3032
3117
|
}
|
|
3033
3118
|
var units = {
|
|
3034
3119
|
year: 24 * 60 * 60 * 1e3 * 365,
|
|
@@ -3062,8 +3147,8 @@ import { Portal } from "@radix-ui/react-portal";
|
|
|
3062
3147
|
|
|
3063
3148
|
// src/components/ui/toast.tsx
|
|
3064
3149
|
import * as React2 from "react";
|
|
3065
|
-
import { IconX } from "@tabler/icons-react";
|
|
3066
3150
|
import * as ToastPrimitives from "@radix-ui/react-toast";
|
|
3151
|
+
import { IconX } from "@tabler/icons-react";
|
|
3067
3152
|
|
|
3068
3153
|
// node_modules/class-variance-authority/node_modules/clsx/dist/clsx.mjs
|
|
3069
3154
|
function r2(e) {
|
|
@@ -3242,15 +3327,39 @@ var useFetchKeyType = (key) => {
|
|
|
3242
3327
|
});
|
|
3243
3328
|
};
|
|
3244
3329
|
|
|
3330
|
+
// src/components/databrowser/hooks/use-fetch-search-index.tsx
|
|
3331
|
+
import { useQuery as useQuery2 } from "@tanstack/react-query";
|
|
3332
|
+
var FETCH_SEARCH_INDEX_QUERY_KEY = "fetch-search-index";
|
|
3333
|
+
var useFetchSearchIndex = (indexName) => {
|
|
3334
|
+
const { redisNoPipeline: redis } = useRedis();
|
|
3335
|
+
return useQuery2({
|
|
3336
|
+
queryKey: [FETCH_SEARCH_INDEX_QUERY_KEY, indexName],
|
|
3337
|
+
queryFn: async () => {
|
|
3338
|
+
if (!indexName) return;
|
|
3339
|
+
const result = await redis.search.index(indexName).describe();
|
|
3340
|
+
return result;
|
|
3341
|
+
},
|
|
3342
|
+
enabled: Boolean(indexName)
|
|
3343
|
+
});
|
|
3344
|
+
};
|
|
3345
|
+
|
|
3245
3346
|
// src/components/databrowser/hooks/use-keys.tsx
|
|
3246
3347
|
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
3247
3348
|
var KeysContext = createContext5(void 0);
|
|
3248
3349
|
var FETCH_KEYS_QUERY_KEY = "use-fetch-keys";
|
|
3249
3350
|
var SCAN_COUNTS = [100, 300, 500];
|
|
3250
3351
|
var KeysProvider = ({ children }) => {
|
|
3251
|
-
const { active, search } = useTab();
|
|
3352
|
+
const { active, search, valuesSearch, isValuesSearchSelected } = useTab();
|
|
3353
|
+
const { data: searchIndexDetails, isLoading: isIndexDetailsLoading } = useFetchSearchIndex(
|
|
3354
|
+
valuesSearch.index
|
|
3355
|
+
);
|
|
3252
3356
|
const { redisNoPipeline: redis } = useRedis();
|
|
3253
|
-
const
|
|
3357
|
+
const parsedValueQuery = parseJSObjectLiteral(valuesSearch.query);
|
|
3358
|
+
const isQueryEnabled = active && (isValuesSearchSelected ? Boolean(valuesSearch.index) && Boolean(searchIndexDetails) : true);
|
|
3359
|
+
const redisKeyScan = async ({
|
|
3360
|
+
count: count2,
|
|
3361
|
+
cursor
|
|
3362
|
+
}) => {
|
|
3254
3363
|
const args = [cursor];
|
|
3255
3364
|
if (search.key) {
|
|
3256
3365
|
args.push("MATCH", search.key);
|
|
@@ -3260,7 +3369,46 @@ var KeysProvider = ({ children }) => {
|
|
|
3260
3369
|
}
|
|
3261
3370
|
args.push("COUNT", count2.toString());
|
|
3262
3371
|
if (!search.type) args.push("WITHTYPE");
|
|
3263
|
-
|
|
3372
|
+
const [newCursor, values] = await redis.exec(["SCAN", ...args]);
|
|
3373
|
+
const keys2 = [];
|
|
3374
|
+
let index = 0;
|
|
3375
|
+
while (true) {
|
|
3376
|
+
if (search.type) {
|
|
3377
|
+
if (index >= values.length) break;
|
|
3378
|
+
keys2.push({ key: values[index], type: search.type });
|
|
3379
|
+
index += 1;
|
|
3380
|
+
} else {
|
|
3381
|
+
if (index + 1 >= values.length) break;
|
|
3382
|
+
keys2.push({ key: values[index], type: values[index + 1] });
|
|
3383
|
+
index += 2;
|
|
3384
|
+
}
|
|
3385
|
+
}
|
|
3386
|
+
return { cursor: newCursor, keys: keys2 };
|
|
3387
|
+
};
|
|
3388
|
+
const redisValueScan = async ({
|
|
3389
|
+
count: count2,
|
|
3390
|
+
cursor
|
|
3391
|
+
}) => {
|
|
3392
|
+
if (!searchIndexDetails) throw new Error("Attempted search while loading the search index");
|
|
3393
|
+
const offset = Number.parseInt(cursor, 10) || 0;
|
|
3394
|
+
const result = await redis.search.index(valuesSearch.index).query({
|
|
3395
|
+
filter: parsedValueQuery ?? {},
|
|
3396
|
+
limit: count2,
|
|
3397
|
+
offset,
|
|
3398
|
+
select: {}
|
|
3399
|
+
});
|
|
3400
|
+
const keys2 = result.map((doc) => ({
|
|
3401
|
+
key: doc.key,
|
|
3402
|
+
type: searchIndexDetails.dataType
|
|
3403
|
+
}));
|
|
3404
|
+
const hasMore = keys2.length >= count2;
|
|
3405
|
+
const nextCursor = hasMore ? String(offset + keys2.length) : "0";
|
|
3406
|
+
return { cursor: nextCursor, keys: keys2 };
|
|
3407
|
+
};
|
|
3408
|
+
const performScan = async (count2, cursor) => {
|
|
3409
|
+
const scanFunction = isValuesSearchSelected ? redisValueScan : redisKeyScan;
|
|
3410
|
+
const result = await scanFunction({ count: count2, cursor });
|
|
3411
|
+
return [result.cursor, result.keys];
|
|
3264
3412
|
};
|
|
3265
3413
|
const scanUntilAvailable = async (cursor) => {
|
|
3266
3414
|
let i = 0;
|
|
@@ -3274,25 +3422,12 @@ var KeysProvider = ({ children }) => {
|
|
|
3274
3422
|
}
|
|
3275
3423
|
};
|
|
3276
3424
|
const query = useInfiniteQuery({
|
|
3277
|
-
queryKey: [FETCH_KEYS_QUERY_KEY, search],
|
|
3278
|
-
|
|
3279
|
-
enabled: active,
|
|
3425
|
+
queryKey: [FETCH_KEYS_QUERY_KEY, search, valuesSearch, isValuesSearchSelected],
|
|
3426
|
+
enabled: isQueryEnabled,
|
|
3280
3427
|
initialPageParam: "0",
|
|
3281
3428
|
queryFn: async ({ pageParam: lastCursor }) => {
|
|
3282
3429
|
const [cursor, values] = await scanUntilAvailable(lastCursor);
|
|
3283
|
-
const keys2 = [];
|
|
3284
|
-
let index = 0;
|
|
3285
|
-
while (true) {
|
|
3286
|
-
if (search.type) {
|
|
3287
|
-
if (index >= values.length) break;
|
|
3288
|
-
keys2.push([values[index], search.type]);
|
|
3289
|
-
index += 1;
|
|
3290
|
-
} else {
|
|
3291
|
-
if (index + 1 >= values.length) break;
|
|
3292
|
-
keys2.push([values[index], values[index + 1]]);
|
|
3293
|
-
index += 2;
|
|
3294
|
-
}
|
|
3295
|
-
}
|
|
3430
|
+
const keys2 = values.map((value) => [value.key, value.type]);
|
|
3296
3431
|
for (const [key, type] of keys2) {
|
|
3297
3432
|
queryClient.setQueryData([FETCH_KEY_TYPE_QUERY_KEY, key], type);
|
|
3298
3433
|
}
|
|
@@ -3302,6 +3437,9 @@ var KeysProvider = ({ children }) => {
|
|
|
3302
3437
|
hasNextPage: cursor !== "0"
|
|
3303
3438
|
};
|
|
3304
3439
|
},
|
|
3440
|
+
meta: {
|
|
3441
|
+
hideToast: true
|
|
3442
|
+
},
|
|
3305
3443
|
select: (data) => data,
|
|
3306
3444
|
getNextPageParam: ({ cursor }) => cursor,
|
|
3307
3445
|
refetchOnMount: false
|
|
@@ -3322,7 +3460,10 @@ var KeysProvider = ({ children }) => {
|
|
|
3322
3460
|
{
|
|
3323
3461
|
value: {
|
|
3324
3462
|
keys,
|
|
3325
|
-
query
|
|
3463
|
+
query: {
|
|
3464
|
+
...query,
|
|
3465
|
+
isLoading: query.isLoading || isIndexDetailsLoading
|
|
3466
|
+
}
|
|
3326
3467
|
},
|
|
3327
3468
|
children
|
|
3328
3469
|
}
|
|
@@ -3350,24 +3491,24 @@ import * as React3 from "react";
|
|
|
3350
3491
|
import { Slot } from "@radix-ui/react-slot";
|
|
3351
3492
|
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
3352
3493
|
var buttonVariants = cva(
|
|
3353
|
-
"inline-flex items-center justify-center rounded-
|
|
3494
|
+
"inline-flex items-center justify-center rounded-lg text-sm shadow-[0_1px_1px_0_rgba(0,0,0,0.10)]ring-offset-white transition-colors focus-visible:outline-none focus-visible:ring-0 focus-visible:ring-zinc-950 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
3354
3495
|
{
|
|
3355
3496
|
variants: {
|
|
3356
3497
|
variant: {
|
|
3357
|
-
default: "bg-white text-black border
|
|
3498
|
+
default: "bg-white text-black border border-zinc-300 hover:bg-white/70",
|
|
3358
3499
|
destructive: "bg-red-500 text-zinc-50 hover:bg-red-500/90",
|
|
3359
|
-
outline: "border border-zinc-
|
|
3360
|
-
primary: "bg-emerald-500 text-white
|
|
3500
|
+
outline: "border border-zinc-300 bg-white hover:bg-zinc-100 hover:text-zinc-900",
|
|
3501
|
+
primary: "bg-emerald-500 text-white hover:bg-emerald-600",
|
|
3361
3502
|
secondary: "bg-zinc-100 text-zinc-900 hover:bg-zinc-100/80",
|
|
3362
3503
|
ghost: "hover:bg-black/10",
|
|
3363
3504
|
link: "text-zinc-900 underline-offset-4 hover:underline"
|
|
3364
3505
|
},
|
|
3365
3506
|
size: {
|
|
3366
3507
|
default: "h-8 px-4 py-2",
|
|
3367
|
-
sm: "px-2 h-
|
|
3508
|
+
sm: "px-2 h-[26px] rounded-md",
|
|
3368
3509
|
lg: "h-10 px-8 rounded-md",
|
|
3369
3510
|
icon: "h-8 w-8",
|
|
3370
|
-
"icon-sm": "h-
|
|
3511
|
+
"icon-sm": "h-[26px] w-[26px] rounded-md",
|
|
3371
3512
|
"icon-xs": "h-5 w-5"
|
|
3372
3513
|
}
|
|
3373
3514
|
},
|
|
@@ -3387,37 +3528,6 @@ Button.displayName = "Button";
|
|
|
3387
3528
|
|
|
3388
3529
|
// src/components/databrowser/hooks/use-add-key.ts
|
|
3389
3530
|
import { useMutation } from "@tanstack/react-query";
|
|
3390
|
-
|
|
3391
|
-
// src/components/databrowser/components/sidebar/db-size.tsx
|
|
3392
|
-
import { useQuery as useQuery2 } from "@tanstack/react-query";
|
|
3393
|
-
|
|
3394
|
-
// src/components/ui/skeleton.tsx
|
|
3395
|
-
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
3396
|
-
function Skeleton({ className, ...props }) {
|
|
3397
|
-
return /* @__PURE__ */ jsx9("div", { className: cn("animate-pulse rounded-md bg-zinc-900/10", className), ...props });
|
|
3398
|
-
}
|
|
3399
|
-
|
|
3400
|
-
// src/components/databrowser/components/sidebar/db-size.tsx
|
|
3401
|
-
import { jsx as jsx10, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
3402
|
-
var FETCH_DB_SIZE_QUERY_KEY = "fetch-db-size";
|
|
3403
|
-
var DisplayDbSize = () => {
|
|
3404
|
-
const { redis } = useRedis();
|
|
3405
|
-
const { data: keyCount } = useQuery2({
|
|
3406
|
-
queryKey: [FETCH_DB_SIZE_QUERY_KEY],
|
|
3407
|
-
queryFn: async () => {
|
|
3408
|
-
return await redis.dbsize();
|
|
3409
|
-
}
|
|
3410
|
-
});
|
|
3411
|
-
if (keyCount === void 0) {
|
|
3412
|
-
return /* @__PURE__ */ jsx10("div", { className: "flex items-center justify-center gap-1", children: /* @__PURE__ */ jsx10(Skeleton, { className: "h-5 w-10 rounded" }) });
|
|
3413
|
-
}
|
|
3414
|
-
return /* @__PURE__ */ jsxs2("div", { className: "", children: [
|
|
3415
|
-
formatNumber(keyCount),
|
|
3416
|
-
" Keys"
|
|
3417
|
-
] });
|
|
3418
|
-
};
|
|
3419
|
-
|
|
3420
|
-
// src/components/databrowser/hooks/use-add-key.ts
|
|
3421
3531
|
var useAddKey = () => {
|
|
3422
3532
|
const { redis } = useRedis();
|
|
3423
3533
|
const mutation = useMutation({
|
|
@@ -3467,9 +3577,6 @@ var useAddKey = () => {
|
|
|
3467
3577
|
}
|
|
3468
3578
|
},
|
|
3469
3579
|
onSuccess: (_, { key, type }) => {
|
|
3470
|
-
queryClient.invalidateQueries({
|
|
3471
|
-
queryKey: [FETCH_DB_SIZE_QUERY_KEY]
|
|
3472
|
-
});
|
|
3473
3580
|
queryClient.setQueriesData(
|
|
3474
3581
|
{
|
|
3475
3582
|
queryKey: [FETCH_KEYS_QUERY_KEY]
|
|
@@ -3677,9 +3784,6 @@ var useDeleteKey = () => {
|
|
|
3677
3784
|
},
|
|
3678
3785
|
onSuccess: (_, key) => {
|
|
3679
3786
|
deleteKeyCache(key);
|
|
3680
|
-
queryClient.invalidateQueries({
|
|
3681
|
-
queryKey: [FETCH_DB_SIZE_QUERY_KEY]
|
|
3682
|
-
});
|
|
3683
3787
|
}
|
|
3684
3788
|
});
|
|
3685
3789
|
return deleteKey;
|
|
@@ -3774,6 +3878,12 @@ import { useQuery as useQuery6 } from "@tanstack/react-query";
|
|
|
3774
3878
|
import { useEffect as useEffect4, useState as useState4 } from "react";
|
|
3775
3879
|
import { IconChevronDown } from "@tabler/icons-react";
|
|
3776
3880
|
|
|
3881
|
+
// src/components/ui/skeleton.tsx
|
|
3882
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
3883
|
+
function Skeleton({ className, ...props }) {
|
|
3884
|
+
return /* @__PURE__ */ jsx9("div", { className: cn("animate-pulse rounded-md bg-zinc-900/10", className), ...props });
|
|
3885
|
+
}
|
|
3886
|
+
|
|
3777
3887
|
// src/components/databrowser/components/display/header-badges.tsx
|
|
3778
3888
|
import bytes from "bytes";
|
|
3779
3889
|
|
|
@@ -3801,6 +3911,9 @@ var useFetchKeyLength = ({ dataKey, type }) => {
|
|
|
3801
3911
|
case "stream": {
|
|
3802
3912
|
return await redis.xlen(dataKey);
|
|
3803
3913
|
}
|
|
3914
|
+
case "search": {
|
|
3915
|
+
return null;
|
|
3916
|
+
}
|
|
3804
3917
|
}
|
|
3805
3918
|
return null;
|
|
3806
3919
|
}
|
|
@@ -3821,7 +3934,7 @@ var useFetchKeySize = (dataKey) => {
|
|
|
3821
3934
|
};
|
|
3822
3935
|
|
|
3823
3936
|
// src/components/databrowser/components/display/header-badges.tsx
|
|
3824
|
-
import { jsx as
|
|
3937
|
+
import { jsx as jsx10, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
3825
3938
|
var LengthBadge = ({
|
|
3826
3939
|
dataKey,
|
|
3827
3940
|
type,
|
|
@@ -3829,18 +3942,18 @@ var LengthBadge = ({
|
|
|
3829
3942
|
}) => {
|
|
3830
3943
|
const { data, isLoading } = useFetchKeyLength({ dataKey, type });
|
|
3831
3944
|
const length = content?.length ?? data;
|
|
3832
|
-
return /* @__PURE__ */
|
|
3945
|
+
return /* @__PURE__ */ jsx10(Badge, { label: "Length:", children: isLoading ? /* @__PURE__ */ jsx10(Skeleton, { className: "ml-1 h-3 w-10 rounded-md opacity-50" }) : length });
|
|
3833
3946
|
};
|
|
3834
3947
|
var SizeBadge = ({ dataKey }) => {
|
|
3835
3948
|
const { data: size } = useFetchKeySize(dataKey);
|
|
3836
|
-
return /* @__PURE__ */
|
|
3949
|
+
return /* @__PURE__ */ jsx10(Badge, { label: "Size:", children: size === void 0 || size === null ? /* @__PURE__ */ jsx10(Skeleton, { className: "ml-1 h-3 w-10 rounded-md opacity-50" }) : bytes(size, {
|
|
3837
3950
|
unitSeparator: " "
|
|
3838
3951
|
}) });
|
|
3839
3952
|
};
|
|
3840
3953
|
var HeaderTTLBadge = ({ dataKey }) => {
|
|
3841
3954
|
const { data: expireAt } = useFetchTTL(dataKey);
|
|
3842
3955
|
const { mutate: setTTL, isPending } = useSetTTL();
|
|
3843
|
-
return /* @__PURE__ */
|
|
3956
|
+
return /* @__PURE__ */ jsx10(
|
|
3844
3957
|
TTLBadge,
|
|
3845
3958
|
{
|
|
3846
3959
|
expireAt,
|
|
@@ -3849,9 +3962,9 @@ var HeaderTTLBadge = ({ dataKey }) => {
|
|
|
3849
3962
|
}
|
|
3850
3963
|
);
|
|
3851
3964
|
};
|
|
3852
|
-
var Badge = ({ children, label }) => /* @__PURE__ */
|
|
3853
|
-
/* @__PURE__ */
|
|
3854
|
-
/* @__PURE__ */
|
|
3965
|
+
var Badge = ({ children, label }) => /* @__PURE__ */ jsxs2("div", { className: "flex h-[26px] items-center gap-0.5 whitespace-nowrap rounded-md bg-zinc-200 px-2 text-xs text-zinc-700 dark:bg-zinc-200", children: [
|
|
3966
|
+
/* @__PURE__ */ jsx10("span", { className: "text-zinc-500 dark:text-zinc-500", children: label }),
|
|
3967
|
+
/* @__PURE__ */ jsx10("span", { className: "font-medium", children })
|
|
3855
3968
|
] });
|
|
3856
3969
|
|
|
3857
3970
|
// src/components/databrowser/components/display/ttl-popover.tsx
|
|
@@ -3860,10 +3973,10 @@ import { Controller, useForm } from "react-hook-form";
|
|
|
3860
3973
|
|
|
3861
3974
|
// src/components/ui/input.tsx
|
|
3862
3975
|
import * as React4 from "react";
|
|
3863
|
-
import { jsx as
|
|
3976
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
3864
3977
|
var Input = React4.forwardRef(
|
|
3865
3978
|
({ className, type, ...props }, ref) => {
|
|
3866
|
-
return /* @__PURE__ */
|
|
3979
|
+
return /* @__PURE__ */ jsx11(
|
|
3867
3980
|
"input",
|
|
3868
3981
|
{
|
|
3869
3982
|
type,
|
|
@@ -3882,10 +3995,10 @@ Input.displayName = "Input";
|
|
|
3882
3995
|
// src/components/ui/popover.tsx
|
|
3883
3996
|
import * as React5 from "react";
|
|
3884
3997
|
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
3885
|
-
import { jsx as
|
|
3998
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
3886
3999
|
var Popover = PopoverPrimitive.Root;
|
|
3887
4000
|
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
3888
|
-
var PopoverContent = React5.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */
|
|
4001
|
+
var PopoverContent = React5.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx12(PopoverPrimitive.Portal, { container: portalRoot, children: /* @__PURE__ */ jsx12(
|
|
3889
4002
|
PopoverPrimitive.Content,
|
|
3890
4003
|
{
|
|
3891
4004
|
ref,
|
|
@@ -3903,22 +4016,22 @@ PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
|
3903
4016
|
// src/components/ui/select.tsx
|
|
3904
4017
|
import * as React6 from "react";
|
|
3905
4018
|
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
3906
|
-
import { jsx as
|
|
4019
|
+
import { jsx as jsx13, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
3907
4020
|
var Select = SelectPrimitive.Root;
|
|
3908
4021
|
var SelectGroup = SelectPrimitive.Group;
|
|
3909
4022
|
var SelectValue = SelectPrimitive.Value;
|
|
3910
|
-
var SelectTrigger = React6.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */
|
|
4023
|
+
var SelectTrigger = React6.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs3(
|
|
3911
4024
|
SelectPrimitive.Trigger,
|
|
3912
4025
|
{
|
|
3913
4026
|
ref,
|
|
3914
4027
|
className: cn(
|
|
3915
|
-
"relative flex h-8 w-full items-center justify-between rounded-
|
|
4028
|
+
"relative flex h-8 w-full items-center justify-between rounded-lg border border-zinc-200 bg-white px-3 py-2 font-medium text-zinc-950 text-sm ring-offset-white placeholder:text-zinc-500 focus:ring-zinc-950 disabled:cursor-not-allowed disabled:opacity-50",
|
|
3916
4029
|
className
|
|
3917
4030
|
),
|
|
3918
4031
|
...props,
|
|
3919
4032
|
children: [
|
|
3920
4033
|
children,
|
|
3921
|
-
/* @__PURE__ */
|
|
4034
|
+
/* @__PURE__ */ jsx13(SelectPrimitive.Icon, { asChild: true, className: "absolute right-2", children: /* @__PURE__ */ jsx13(
|
|
3922
4035
|
"svg",
|
|
3923
4036
|
{
|
|
3924
4037
|
width: "16",
|
|
@@ -3926,7 +4039,7 @@ var SelectTrigger = React6.forwardRef(({ className, children, ...props }, ref) =
|
|
|
3926
4039
|
viewBox: "0 0 16 16",
|
|
3927
4040
|
fill: "none",
|
|
3928
4041
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3929
|
-
children: /* @__PURE__ */
|
|
4042
|
+
children: /* @__PURE__ */ jsx13(
|
|
3930
4043
|
"path",
|
|
3931
4044
|
{
|
|
3932
4045
|
d: "M4 6L8 10L12 6",
|
|
@@ -3943,7 +4056,7 @@ var SelectTrigger = React6.forwardRef(({ className, children, ...props }, ref) =
|
|
|
3943
4056
|
}
|
|
3944
4057
|
));
|
|
3945
4058
|
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
3946
|
-
var SelectContent = React6.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */
|
|
4059
|
+
var SelectContent = React6.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx13(SelectPrimitive.Portal, { container: portalRoot, children: /* @__PURE__ */ jsx13(
|
|
3947
4060
|
SelectPrimitive.Content,
|
|
3948
4061
|
{
|
|
3949
4062
|
ref,
|
|
@@ -3954,7 +4067,7 @@ var SelectContent = React6.forwardRef(({ className, children, position = "popper
|
|
|
3954
4067
|
),
|
|
3955
4068
|
position,
|
|
3956
4069
|
...props,
|
|
3957
|
-
children: /* @__PURE__ */
|
|
4070
|
+
children: /* @__PURE__ */ jsx13(
|
|
3958
4071
|
SelectPrimitive.Viewport,
|
|
3959
4072
|
{
|
|
3960
4073
|
className: cn(
|
|
@@ -3967,7 +4080,7 @@ var SelectContent = React6.forwardRef(({ className, children, position = "popper
|
|
|
3967
4080
|
}
|
|
3968
4081
|
) }));
|
|
3969
4082
|
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
3970
|
-
var SelectLabel = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
4083
|
+
var SelectLabel = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx13(
|
|
3971
4084
|
SelectPrimitive.Label,
|
|
3972
4085
|
{
|
|
3973
4086
|
ref,
|
|
@@ -3976,7 +4089,7 @@ var SelectLabel = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
3976
4089
|
}
|
|
3977
4090
|
));
|
|
3978
4091
|
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
3979
|
-
var SelectItem = React6.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */
|
|
4092
|
+
var SelectItem = React6.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs3(
|
|
3980
4093
|
SelectPrimitive.Item,
|
|
3981
4094
|
{
|
|
3982
4095
|
ref,
|
|
@@ -3986,7 +4099,7 @@ var SelectItem = React6.forwardRef(({ className, children, ...props }, ref) => /
|
|
|
3986
4099
|
),
|
|
3987
4100
|
...props,
|
|
3988
4101
|
children: [
|
|
3989
|
-
/* @__PURE__ */
|
|
4102
|
+
/* @__PURE__ */ jsx13("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx13(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx13(
|
|
3990
4103
|
"svg",
|
|
3991
4104
|
{
|
|
3992
4105
|
width: "15",
|
|
@@ -3995,7 +4108,7 @@ var SelectItem = React6.forwardRef(({ className, children, ...props }, ref) => /
|
|
|
3995
4108
|
fill: "none",
|
|
3996
4109
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3997
4110
|
className: "h-4 w-4",
|
|
3998
|
-
children: /* @__PURE__ */
|
|
4111
|
+
children: /* @__PURE__ */ jsx13(
|
|
3999
4112
|
"path",
|
|
4000
4113
|
{
|
|
4001
4114
|
d: "M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",
|
|
@@ -4005,13 +4118,13 @@ var SelectItem = React6.forwardRef(({ className, children, ...props }, ref) => /
|
|
|
4005
4118
|
}
|
|
4006
4119
|
)
|
|
4007
4120
|
}
|
|
4008
|
-
) }) })
|
|
4009
|
-
/* @__PURE__ */
|
|
4121
|
+
) }) }),
|
|
4122
|
+
/* @__PURE__ */ jsx13(SelectPrimitive.ItemText, { children })
|
|
4010
4123
|
]
|
|
4011
4124
|
}
|
|
4012
4125
|
));
|
|
4013
4126
|
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
4014
|
-
var SelectSeparator = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
4127
|
+
var SelectSeparator = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx13(
|
|
4015
4128
|
SelectPrimitive.Separator,
|
|
4016
4129
|
{
|
|
4017
4130
|
ref,
|
|
@@ -4022,16 +4135,16 @@ var SelectSeparator = React6.forwardRef(({ className, ...props }, ref) => /* @__
|
|
|
4022
4135
|
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
|
|
4023
4136
|
|
|
4024
4137
|
// src/components/ui/spinner.tsx
|
|
4025
|
-
import { Fragment, jsx as
|
|
4138
|
+
import { Fragment, jsx as jsx14, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
4026
4139
|
var Spinner = ({
|
|
4027
4140
|
isLoading,
|
|
4028
4141
|
className,
|
|
4029
4142
|
isLoadingText,
|
|
4030
4143
|
children
|
|
4031
4144
|
}) => {
|
|
4032
|
-
return /* @__PURE__ */
|
|
4145
|
+
return /* @__PURE__ */ jsx14("div", { className: className ?? "flex items-center", children: isLoading ? /* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
4033
4146
|
isLoadingText,
|
|
4034
|
-
/* @__PURE__ */
|
|
4147
|
+
/* @__PURE__ */ jsx14(
|
|
4035
4148
|
"svg",
|
|
4036
4149
|
{
|
|
4037
4150
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -4044,14 +4157,14 @@ var Spinner = ({
|
|
|
4044
4157
|
strokeLinecap: "round",
|
|
4045
4158
|
strokeLinejoin: "round",
|
|
4046
4159
|
className: cn("h-4 w-4 animate-spin", isLoadingText ? "ml-2" : ""),
|
|
4047
|
-
children: /* @__PURE__ */
|
|
4160
|
+
children: /* @__PURE__ */ jsx14("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" })
|
|
4048
4161
|
}
|
|
4049
4162
|
)
|
|
4050
4163
|
] }) : children });
|
|
4051
4164
|
};
|
|
4052
4165
|
|
|
4053
4166
|
// src/components/databrowser/components/display/ttl-popover.tsx
|
|
4054
|
-
import { jsx as
|
|
4167
|
+
import { jsx as jsx15, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
4055
4168
|
var timeUnits = [
|
|
4056
4169
|
{ label: "Seconds", value: 1 },
|
|
4057
4170
|
{ label: "Minutes", value: 60 },
|
|
@@ -4084,7 +4197,7 @@ function TTLPopover({
|
|
|
4084
4197
|
await setTTL(TTL_INFINITE);
|
|
4085
4198
|
setOpen(false);
|
|
4086
4199
|
};
|
|
4087
|
-
return /* @__PURE__ */
|
|
4200
|
+
return /* @__PURE__ */ jsxs5(
|
|
4088
4201
|
Popover,
|
|
4089
4202
|
{
|
|
4090
4203
|
open,
|
|
@@ -4093,8 +4206,8 @@ function TTLPopover({
|
|
|
4093
4206
|
setOpen(isOpen);
|
|
4094
4207
|
},
|
|
4095
4208
|
children: [
|
|
4096
|
-
/* @__PURE__ */
|
|
4097
|
-
/* @__PURE__ */
|
|
4209
|
+
/* @__PURE__ */ jsx15(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx15("button", { children }) }),
|
|
4210
|
+
/* @__PURE__ */ jsx15(PopoverContent, { className: "w-[300px]", align: "end", children: /* @__PURE__ */ jsxs5(
|
|
4098
4211
|
"form",
|
|
4099
4212
|
{
|
|
4100
4213
|
className: "space-y-4",
|
|
@@ -4103,10 +4216,10 @@ function TTLPopover({
|
|
|
4103
4216
|
e.stopPropagation();
|
|
4104
4217
|
},
|
|
4105
4218
|
children: [
|
|
4106
|
-
/* @__PURE__ */
|
|
4107
|
-
/* @__PURE__ */
|
|
4108
|
-
/* @__PURE__ */
|
|
4109
|
-
/* @__PURE__ */
|
|
4219
|
+
/* @__PURE__ */ jsx15("h4", { className: "font-medium leading-none", children: "Expiration" }),
|
|
4220
|
+
/* @__PURE__ */ jsxs5("div", { children: [
|
|
4221
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex items-center", children: [
|
|
4222
|
+
/* @__PURE__ */ jsx15(
|
|
4110
4223
|
Controller,
|
|
4111
4224
|
{
|
|
4112
4225
|
rules: {
|
|
@@ -4115,26 +4228,26 @@ function TTLPopover({
|
|
|
4115
4228
|
},
|
|
4116
4229
|
control,
|
|
4117
4230
|
name: "value",
|
|
4118
|
-
render: ({ field }) => /* @__PURE__ */
|
|
4231
|
+
render: ({ field }) => /* @__PURE__ */ jsx15(Input, { min: "-1", ...field, className: "grow rounded-r-none" })
|
|
4119
4232
|
}
|
|
4120
4233
|
),
|
|
4121
|
-
/* @__PURE__ */
|
|
4234
|
+
/* @__PURE__ */ jsx15(
|
|
4122
4235
|
Controller,
|
|
4123
4236
|
{
|
|
4124
4237
|
control,
|
|
4125
4238
|
name: "type",
|
|
4126
|
-
render: ({ field }) => /* @__PURE__ */
|
|
4127
|
-
/* @__PURE__ */
|
|
4128
|
-
/* @__PURE__ */
|
|
4239
|
+
render: ({ field }) => /* @__PURE__ */ jsxs5(Select, { value: field.value, onValueChange: field.onChange, children: [
|
|
4240
|
+
/* @__PURE__ */ jsx15(SelectTrigger, { className: "w-auto rounded-l-none border-l-0 pr-8", children: /* @__PURE__ */ jsx15(SelectValue, {}) }),
|
|
4241
|
+
/* @__PURE__ */ jsx15(SelectContent, { children: timeUnits.map((unit) => /* @__PURE__ */ jsx15(SelectItem, { value: unit.label, children: unit.label }, unit.label)) })
|
|
4129
4242
|
] })
|
|
4130
4243
|
}
|
|
4131
4244
|
)
|
|
4132
4245
|
] }),
|
|
4133
|
-
formState.errors.value && /* @__PURE__ */
|
|
4134
|
-
/* @__PURE__ */
|
|
4246
|
+
formState.errors.value && /* @__PURE__ */ jsx15("p", { className: "mt-2 text-xs text-red-500", children: formState.errors.value.message }),
|
|
4247
|
+
/* @__PURE__ */ jsx15("p", { className: "mt-2 text-xs text-zinc-500", children: "TTL sets a timer to automatically delete keys after a defined period." })
|
|
4135
4248
|
] }),
|
|
4136
|
-
/* @__PURE__ */
|
|
4137
|
-
/* @__PURE__ */
|
|
4249
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex justify-between", children: [
|
|
4250
|
+
/* @__PURE__ */ jsx15(
|
|
4138
4251
|
Button,
|
|
4139
4252
|
{
|
|
4140
4253
|
type: "button",
|
|
@@ -4144,9 +4257,9 @@ function TTLPopover({
|
|
|
4144
4257
|
children: "Persist"
|
|
4145
4258
|
}
|
|
4146
4259
|
),
|
|
4147
|
-
/* @__PURE__ */
|
|
4148
|
-
/* @__PURE__ */
|
|
4149
|
-
/* @__PURE__ */
|
|
4260
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex gap-2", children: [
|
|
4261
|
+
/* @__PURE__ */ jsx15(Button, { variant: "outline", onClick: () => setOpen(false), type: "button", children: "Cancel" }),
|
|
4262
|
+
/* @__PURE__ */ jsx15(Button, { variant: "primary", type: "submit", children: /* @__PURE__ */ jsx15(Spinner, { isLoading: isPending, isLoadingText: "Saving", children: "Save" }) })
|
|
4150
4263
|
] })
|
|
4151
4264
|
] })
|
|
4152
4265
|
]
|
|
@@ -4158,7 +4271,7 @@ function TTLPopover({
|
|
|
4158
4271
|
}
|
|
4159
4272
|
|
|
4160
4273
|
// src/components/databrowser/components/display/ttl-badge.tsx
|
|
4161
|
-
import { jsx as
|
|
4274
|
+
import { jsx as jsx16, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
4162
4275
|
var TTL_INFINITE = -1;
|
|
4163
4276
|
var TTL_NOT_FOUND = -2;
|
|
4164
4277
|
var calculateTTL = (expireAt) => {
|
|
@@ -4180,9 +4293,9 @@ var TTLBadge = ({
|
|
|
4180
4293
|
}, 1e3);
|
|
4181
4294
|
return () => clearInterval(interval);
|
|
4182
4295
|
}, [expireAt]);
|
|
4183
|
-
return /* @__PURE__ */
|
|
4184
|
-
ttl === TTL_INFINITE ? "
|
|
4185
|
-
/* @__PURE__ */
|
|
4296
|
+
return /* @__PURE__ */ jsx16(Badge, { label, children: ttl === void 0 ? /* @__PURE__ */ jsx16(Skeleton, { className: "ml-1 h-3 w-10 rounded-md opacity-50" }) : /* @__PURE__ */ jsx16(TTLPopover, { ttl, setTTL, isPending, children: /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-[2px]", children: [
|
|
4297
|
+
ttl === TTL_INFINITE ? "No" : formatTime(ttl),
|
|
4298
|
+
/* @__PURE__ */ jsx16(IconChevronDown, { className: "shrink-0 text-zinc-400", size: 16 })
|
|
4186
4299
|
] }) }) });
|
|
4187
4300
|
};
|
|
4188
4301
|
|
|
@@ -4252,17 +4365,17 @@ var useSetTTL = () => {
|
|
|
4252
4365
|
|
|
4253
4366
|
// src/components/databrowser/components/item-context-menu.tsx
|
|
4254
4367
|
import { useState as useState5 } from "react";
|
|
4255
|
-
import { IconCopy, IconExternalLink, IconTrash } from "@tabler/icons-react";
|
|
4256
4368
|
import { ContextMenuSeparator as ContextMenuSeparator2 } from "@radix-ui/react-context-menu";
|
|
4369
|
+
import { IconCopy, IconExternalLink, IconTrash } from "@tabler/icons-react";
|
|
4257
4370
|
|
|
4258
4371
|
// src/components/ui/context-menu.tsx
|
|
4259
4372
|
import * as React7 from "react";
|
|
4260
4373
|
import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
|
|
4261
4374
|
import { IconCheck, IconChevronRight, IconCircleFilled } from "@tabler/icons-react";
|
|
4262
|
-
import { jsx as
|
|
4375
|
+
import { jsx as jsx17, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
4263
4376
|
var ContextMenu = ContextMenuPrimitive.Root;
|
|
4264
4377
|
var ContextMenuTrigger = ContextMenuPrimitive.Trigger;
|
|
4265
|
-
var ContextMenuSubTrigger = React7.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */
|
|
4378
|
+
var ContextMenuSubTrigger = React7.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs7(
|
|
4266
4379
|
ContextMenuPrimitive.SubTrigger,
|
|
4267
4380
|
{
|
|
4268
4381
|
ref,
|
|
@@ -4274,12 +4387,12 @@ var ContextMenuSubTrigger = React7.forwardRef(({ className, inset, children, ...
|
|
|
4274
4387
|
...props,
|
|
4275
4388
|
children: [
|
|
4276
4389
|
children,
|
|
4277
|
-
/* @__PURE__ */
|
|
4390
|
+
/* @__PURE__ */ jsx17(IconChevronRight, { className: "ml-auto h-4 w-4" })
|
|
4278
4391
|
]
|
|
4279
4392
|
}
|
|
4280
4393
|
));
|
|
4281
4394
|
ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;
|
|
4282
|
-
var ContextMenuSubContent = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
4395
|
+
var ContextMenuSubContent = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx17(
|
|
4283
4396
|
ContextMenuPrimitive.SubContent,
|
|
4284
4397
|
{
|
|
4285
4398
|
ref,
|
|
@@ -4291,7 +4404,7 @@ var ContextMenuSubContent = React7.forwardRef(({ className, ...props }, ref) =>
|
|
|
4291
4404
|
}
|
|
4292
4405
|
));
|
|
4293
4406
|
ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName;
|
|
4294
|
-
var ContextMenuContent = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
4407
|
+
var ContextMenuContent = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx17(ContextMenuPrimitive.Portal, { container: portalRoot, children: /* @__PURE__ */ jsx17(
|
|
4295
4408
|
ContextMenuPrimitive.Content,
|
|
4296
4409
|
{
|
|
4297
4410
|
ref,
|
|
@@ -4303,7 +4416,7 @@ var ContextMenuContent = React7.forwardRef(({ className, ...props }, ref) => /*
|
|
|
4303
4416
|
}
|
|
4304
4417
|
) }));
|
|
4305
4418
|
ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;
|
|
4306
|
-
var ContextMenuItem = React7.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */
|
|
4419
|
+
var ContextMenuItem = React7.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx17(
|
|
4307
4420
|
ContextMenuPrimitive.Item,
|
|
4308
4421
|
{
|
|
4309
4422
|
ref,
|
|
@@ -4316,7 +4429,7 @@ var ContextMenuItem = React7.forwardRef(({ className, inset, ...props }, ref) =>
|
|
|
4316
4429
|
}
|
|
4317
4430
|
));
|
|
4318
4431
|
ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;
|
|
4319
|
-
var ContextMenuCheckboxItem = React7.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */
|
|
4432
|
+
var ContextMenuCheckboxItem = React7.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ jsxs7(
|
|
4320
4433
|
ContextMenuPrimitive.CheckboxItem,
|
|
4321
4434
|
{
|
|
4322
4435
|
ref,
|
|
@@ -4327,13 +4440,13 @@ var ContextMenuCheckboxItem = React7.forwardRef(({ className, children, checked,
|
|
|
4327
4440
|
checked,
|
|
4328
4441
|
...props,
|
|
4329
4442
|
children: [
|
|
4330
|
-
/* @__PURE__ */
|
|
4443
|
+
/* @__PURE__ */ jsx17("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx17(ContextMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx17(IconCheck, { className: "h-4 w-4" }) }) }),
|
|
4331
4444
|
children
|
|
4332
4445
|
]
|
|
4333
4446
|
}
|
|
4334
4447
|
));
|
|
4335
4448
|
ContextMenuCheckboxItem.displayName = ContextMenuPrimitive.CheckboxItem.displayName;
|
|
4336
|
-
var ContextMenuRadioItem = React7.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */
|
|
4449
|
+
var ContextMenuRadioItem = React7.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs7(
|
|
4337
4450
|
ContextMenuPrimitive.RadioItem,
|
|
4338
4451
|
{
|
|
4339
4452
|
ref,
|
|
@@ -4343,13 +4456,13 @@ var ContextMenuRadioItem = React7.forwardRef(({ className, children, ...props },
|
|
|
4343
4456
|
),
|
|
4344
4457
|
...props,
|
|
4345
4458
|
children: [
|
|
4346
|
-
/* @__PURE__ */
|
|
4459
|
+
/* @__PURE__ */ jsx17("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx17(ContextMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx17(IconCircleFilled, { className: "h-4 w-4" }) }) }),
|
|
4347
4460
|
children
|
|
4348
4461
|
]
|
|
4349
4462
|
}
|
|
4350
4463
|
));
|
|
4351
4464
|
ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName;
|
|
4352
|
-
var ContextMenuLabel = React7.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */
|
|
4465
|
+
var ContextMenuLabel = React7.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx17(
|
|
4353
4466
|
ContextMenuPrimitive.Label,
|
|
4354
4467
|
{
|
|
4355
4468
|
ref,
|
|
@@ -4358,7 +4471,7 @@ var ContextMenuLabel = React7.forwardRef(({ className, inset, ...props }, ref) =
|
|
|
4358
4471
|
}
|
|
4359
4472
|
));
|
|
4360
4473
|
ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName;
|
|
4361
|
-
var ContextMenuSeparator = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
4474
|
+
var ContextMenuSeparator = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx17(
|
|
4362
4475
|
ContextMenuPrimitive.Separator,
|
|
4363
4476
|
{
|
|
4364
4477
|
ref,
|
|
@@ -4368,19 +4481,19 @@ var ContextMenuSeparator = React7.forwardRef(({ className, ...props }, ref) => /
|
|
|
4368
4481
|
));
|
|
4369
4482
|
ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName;
|
|
4370
4483
|
var ContextMenuShortcut = ({ className, ...props }) => {
|
|
4371
|
-
return /* @__PURE__ */
|
|
4484
|
+
return /* @__PURE__ */ jsx17("span", { className: cn("ml-auto text-xs tracking-widest text-zinc-500", className), ...props });
|
|
4372
4485
|
};
|
|
4373
4486
|
ContextMenuShortcut.displayName = "ContextMenuShortcut";
|
|
4374
4487
|
|
|
4375
4488
|
// src/components/ui/alert-dialog.tsx
|
|
4376
4489
|
import * as React8 from "react";
|
|
4377
4490
|
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
|
|
4378
|
-
import { jsx as
|
|
4491
|
+
import { jsx as jsx18, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
4379
4492
|
var AlertDialog = AlertDialogPrimitive.Root;
|
|
4380
4493
|
var AlertDialogTrigger = AlertDialogPrimitive.Trigger;
|
|
4381
|
-
var AlertDialogPortal = ({ ...props }) => /* @__PURE__ */
|
|
4494
|
+
var AlertDialogPortal = ({ ...props }) => /* @__PURE__ */ jsx18(AlertDialogPrimitive.Portal, { container: portalRoot, ...props });
|
|
4382
4495
|
AlertDialogPortal.displayName = AlertDialogPrimitive.Portal.displayName;
|
|
4383
|
-
var AlertDialogOverlay = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
4496
|
+
var AlertDialogOverlay = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx18(
|
|
4384
4497
|
AlertDialogPrimitive.Overlay,
|
|
4385
4498
|
{
|
|
4386
4499
|
className: cn(
|
|
@@ -4392,9 +4505,9 @@ var AlertDialogOverlay = React8.forwardRef(({ className, ...props }, ref) => /*
|
|
|
4392
4505
|
}
|
|
4393
4506
|
));
|
|
4394
4507
|
AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName;
|
|
4395
|
-
var AlertDialogContent = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
4396
|
-
/* @__PURE__ */
|
|
4397
|
-
/* @__PURE__ */
|
|
4508
|
+
var AlertDialogContent = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs8(AlertDialogPortal, { children: [
|
|
4509
|
+
/* @__PURE__ */ jsx18(AlertDialogOverlay, {}),
|
|
4510
|
+
/* @__PURE__ */ jsx18(
|
|
4398
4511
|
AlertDialogPrimitive.Content,
|
|
4399
4512
|
{
|
|
4400
4513
|
ref,
|
|
@@ -4407,9 +4520,9 @@ var AlertDialogContent = React8.forwardRef(({ className, ...props }, ref) => /*
|
|
|
4407
4520
|
)
|
|
4408
4521
|
] }));
|
|
4409
4522
|
AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName;
|
|
4410
|
-
var AlertDialogHeader = ({ className, ...props }) => /* @__PURE__ */
|
|
4523
|
+
var AlertDialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsx18("div", { className: cn("flex flex-col space-y-2 text-center sm:text-left", className), ...props });
|
|
4411
4524
|
AlertDialogHeader.displayName = "AlertDialogHeader";
|
|
4412
|
-
var AlertDialogFooter = ({ className, ...props }) => /* @__PURE__ */
|
|
4525
|
+
var AlertDialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx18(
|
|
4413
4526
|
"div",
|
|
4414
4527
|
{
|
|
4415
4528
|
className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className),
|
|
@@ -4417,7 +4530,7 @@ var AlertDialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx19(
|
|
|
4417
4530
|
}
|
|
4418
4531
|
);
|
|
4419
4532
|
AlertDialogFooter.displayName = "AlertDialogFooter";
|
|
4420
|
-
var AlertDialogTitle = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
4533
|
+
var AlertDialogTitle = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx18(
|
|
4421
4534
|
AlertDialogPrimitive.Title,
|
|
4422
4535
|
{
|
|
4423
4536
|
ref,
|
|
@@ -4426,7 +4539,7 @@ var AlertDialogTitle = React8.forwardRef(({ className, ...props }, ref) => /* @_
|
|
|
4426
4539
|
}
|
|
4427
4540
|
));
|
|
4428
4541
|
AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName;
|
|
4429
|
-
var AlertDialogDescription = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
4542
|
+
var AlertDialogDescription = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx18(
|
|
4430
4543
|
AlertDialogPrimitive.Description,
|
|
4431
4544
|
{
|
|
4432
4545
|
ref,
|
|
@@ -4435,9 +4548,9 @@ var AlertDialogDescription = React8.forwardRef(({ className, ...props }, ref) =>
|
|
|
4435
4548
|
}
|
|
4436
4549
|
));
|
|
4437
4550
|
AlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName;
|
|
4438
|
-
var AlertDialogAction = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
4551
|
+
var AlertDialogAction = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx18(AlertDialogPrimitive.Action, { ref, className: cn(buttonVariants(), className), ...props }));
|
|
4439
4552
|
AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName;
|
|
4440
|
-
var AlertDialogCancel = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
4553
|
+
var AlertDialogCancel = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx18(
|
|
4441
4554
|
AlertDialogPrimitive.Cancel,
|
|
4442
4555
|
{
|
|
4443
4556
|
ref,
|
|
@@ -4448,7 +4561,7 @@ var AlertDialogCancel = React8.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
4448
4561
|
AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName;
|
|
4449
4562
|
|
|
4450
4563
|
// src/components/databrowser/components/display/delete-alert-dialog.tsx
|
|
4451
|
-
import { jsx as
|
|
4564
|
+
import { jsx as jsx19, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
4452
4565
|
function DeleteAlertDialog({
|
|
4453
4566
|
children,
|
|
4454
4567
|
onDeleteConfirm,
|
|
@@ -4460,22 +4573,23 @@ function DeleteAlertDialog({
|
|
|
4460
4573
|
const isPlural = count2 > 1;
|
|
4461
4574
|
const itemLabel = deletionType === "item" ? "Item" : "Key";
|
|
4462
4575
|
const itemsLabel = deletionType === "item" ? "Items" : "Keys";
|
|
4463
|
-
return /* @__PURE__ */
|
|
4464
|
-
children && /* @__PURE__ */
|
|
4465
|
-
/* @__PURE__ */
|
|
4466
|
-
/* @__PURE__ */
|
|
4467
|
-
/* @__PURE__ */
|
|
4468
|
-
/* @__PURE__ */
|
|
4469
|
-
"Are you sure you want to delete
|
|
4576
|
+
return /* @__PURE__ */ jsxs9(AlertDialog, { open, onOpenChange, children: [
|
|
4577
|
+
children && /* @__PURE__ */ jsx19(AlertDialogTrigger, { asChild: true, children }),
|
|
4578
|
+
/* @__PURE__ */ jsxs9(AlertDialogContent, { children: [
|
|
4579
|
+
/* @__PURE__ */ jsxs9(AlertDialogHeader, { children: [
|
|
4580
|
+
/* @__PURE__ */ jsx19(AlertDialogTitle, { children: isPlural ? `Delete ${count2} ${itemsLabel}` : `Delete ${itemLabel}` }),
|
|
4581
|
+
/* @__PURE__ */ jsxs9(AlertDialogDescription, { className: "mt-5", children: [
|
|
4582
|
+
"Are you sure you want to delete",
|
|
4583
|
+
" ",
|
|
4470
4584
|
isPlural ? `these ${count2} ${deletionType}s` : `this ${deletionType}`,
|
|
4471
4585
|
"?",
|
|
4472
|
-
/* @__PURE__ */
|
|
4586
|
+
/* @__PURE__ */ jsx19("br", {}),
|
|
4473
4587
|
"This action cannot be undone."
|
|
4474
4588
|
] })
|
|
4475
4589
|
] }),
|
|
4476
|
-
/* @__PURE__ */
|
|
4477
|
-
/* @__PURE__ */
|
|
4478
|
-
/* @__PURE__ */
|
|
4590
|
+
/* @__PURE__ */ jsxs9(AlertDialogFooter, { children: [
|
|
4591
|
+
/* @__PURE__ */ jsx19(AlertDialogCancel, { type: "button", children: "Cancel" }),
|
|
4592
|
+
/* @__PURE__ */ jsx19(
|
|
4479
4593
|
AlertDialogAction,
|
|
4480
4594
|
{
|
|
4481
4595
|
className: "bg-red-500 text-zinc-50 hover:bg-red-600",
|
|
@@ -4489,7 +4603,7 @@ function DeleteAlertDialog({
|
|
|
4489
4603
|
}
|
|
4490
4604
|
|
|
4491
4605
|
// src/components/databrowser/components/item-context-menu.tsx
|
|
4492
|
-
import { Fragment as Fragment2, jsx as
|
|
4606
|
+
import { Fragment as Fragment2, jsx as jsx20, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
4493
4607
|
var ItemContextMenu = ({
|
|
4494
4608
|
children,
|
|
4495
4609
|
dataKey,
|
|
@@ -4499,8 +4613,8 @@ var ItemContextMenu = ({
|
|
|
4499
4613
|
const [isAlertOpen, setAlertOpen] = useState5(false);
|
|
4500
4614
|
const [data, setData] = useState5();
|
|
4501
4615
|
const { addTab, setSelectedKey, selectTab, setSelectedListItem } = useDatabrowserStore();
|
|
4502
|
-
return /* @__PURE__ */
|
|
4503
|
-
/* @__PURE__ */
|
|
4616
|
+
return /* @__PURE__ */ jsxs10(Fragment2, { children: [
|
|
4617
|
+
/* @__PURE__ */ jsx20(
|
|
4504
4618
|
DeleteAlertDialog,
|
|
4505
4619
|
{
|
|
4506
4620
|
deletionType: "item",
|
|
@@ -4521,8 +4635,8 @@ var ItemContextMenu = ({
|
|
|
4521
4635
|
}
|
|
4522
4636
|
}
|
|
4523
4637
|
),
|
|
4524
|
-
/* @__PURE__ */
|
|
4525
|
-
/* @__PURE__ */
|
|
4638
|
+
/* @__PURE__ */ jsxs10(ContextMenu, { modal: false, children: [
|
|
4639
|
+
/* @__PURE__ */ jsx20(
|
|
4526
4640
|
ContextMenuTrigger,
|
|
4527
4641
|
{
|
|
4528
4642
|
asChild: true,
|
|
@@ -4541,8 +4655,8 @@ var ItemContextMenu = ({
|
|
|
4541
4655
|
children
|
|
4542
4656
|
}
|
|
4543
4657
|
),
|
|
4544
|
-
/* @__PURE__ */
|
|
4545
|
-
/* @__PURE__ */
|
|
4658
|
+
/* @__PURE__ */ jsxs10(ContextMenuContent, { children: [
|
|
4659
|
+
/* @__PURE__ */ jsxs10(
|
|
4546
4660
|
ContextMenuItem,
|
|
4547
4661
|
{
|
|
4548
4662
|
onClick: () => {
|
|
@@ -4554,12 +4668,12 @@ var ItemContextMenu = ({
|
|
|
4554
4668
|
},
|
|
4555
4669
|
className: "gap-2",
|
|
4556
4670
|
children: [
|
|
4557
|
-
/* @__PURE__ */
|
|
4671
|
+
/* @__PURE__ */ jsx20(IconCopy, { size: 16 }),
|
|
4558
4672
|
"Copy key"
|
|
4559
4673
|
]
|
|
4560
4674
|
}
|
|
4561
4675
|
),
|
|
4562
|
-
data?.value && /* @__PURE__ */
|
|
4676
|
+
data?.value && /* @__PURE__ */ jsxs10(
|
|
4563
4677
|
ContextMenuItem,
|
|
4564
4678
|
{
|
|
4565
4679
|
onClick: () => {
|
|
@@ -4570,12 +4684,12 @@ var ItemContextMenu = ({
|
|
|
4570
4684
|
},
|
|
4571
4685
|
className: "gap-2",
|
|
4572
4686
|
children: [
|
|
4573
|
-
/* @__PURE__ */
|
|
4687
|
+
/* @__PURE__ */ jsx20(IconCopy, { size: 16 }),
|
|
4574
4688
|
"Copy value"
|
|
4575
4689
|
]
|
|
4576
4690
|
}
|
|
4577
4691
|
),
|
|
4578
|
-
/* @__PURE__ */
|
|
4692
|
+
/* @__PURE__ */ jsxs10(
|
|
4579
4693
|
ContextMenuItem,
|
|
4580
4694
|
{
|
|
4581
4695
|
onClick: () => {
|
|
@@ -4589,20 +4703,20 @@ var ItemContextMenu = ({
|
|
|
4589
4703
|
},
|
|
4590
4704
|
className: "gap-2",
|
|
4591
4705
|
children: [
|
|
4592
|
-
/* @__PURE__ */
|
|
4706
|
+
/* @__PURE__ */ jsx20(IconExternalLink, { size: 16 }),
|
|
4593
4707
|
"Open in new tab"
|
|
4594
4708
|
]
|
|
4595
4709
|
}
|
|
4596
4710
|
),
|
|
4597
|
-
/* @__PURE__ */
|
|
4598
|
-
/* @__PURE__ */
|
|
4711
|
+
/* @__PURE__ */ jsx20(ContextMenuSeparator2, {}),
|
|
4712
|
+
/* @__PURE__ */ jsxs10(
|
|
4599
4713
|
ContextMenuItem,
|
|
4600
4714
|
{
|
|
4601
4715
|
disabled: type === "stream",
|
|
4602
4716
|
onClick: () => setAlertOpen(true),
|
|
4603
4717
|
className: "gap-2",
|
|
4604
4718
|
children: [
|
|
4605
|
-
/* @__PURE__ */
|
|
4719
|
+
/* @__PURE__ */ jsx20(IconTrash, { size: 16 }),
|
|
4606
4720
|
"Delete item"
|
|
4607
4721
|
]
|
|
4608
4722
|
}
|
|
@@ -4613,42 +4727,47 @@ var ItemContextMenu = ({
|
|
|
4613
4727
|
};
|
|
4614
4728
|
|
|
4615
4729
|
// src/components/databrowser/components/sidebar/infinite-scroll.tsx
|
|
4616
|
-
import { IconLoader2 } from "@tabler/icons-react";
|
|
4617
4730
|
import { useEffect as useEffect6, useRef } from "react";
|
|
4731
|
+
import { IconLoader2 } from "@tabler/icons-react";
|
|
4618
4732
|
|
|
4619
4733
|
// src/components/ui/scroll-area.tsx
|
|
4620
4734
|
import * as React9 from "react";
|
|
4621
4735
|
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
|
|
4622
|
-
import { jsx as
|
|
4623
|
-
var ScrollArea = React9.forwardRef(
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
|
|
4627
|
-
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
)
|
|
4736
|
+
import { jsx as jsx21, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
4737
|
+
var ScrollArea = React9.forwardRef(
|
|
4738
|
+
({ className, scrollBarClassName, children, onScroll, disableRoundedInherit = false, ...props }, ref) => /* @__PURE__ */ jsxs11(
|
|
4739
|
+
ScrollAreaPrimitive.Root,
|
|
4740
|
+
{
|
|
4741
|
+
ref,
|
|
4742
|
+
className: cn("relative overflow-hidden", className),
|
|
4743
|
+
...props,
|
|
4744
|
+
children: [
|
|
4745
|
+
/* @__PURE__ */ jsx21(
|
|
4746
|
+
ScrollAreaPrimitive.Viewport,
|
|
4747
|
+
{
|
|
4748
|
+
onScroll,
|
|
4749
|
+
className: cn(
|
|
4750
|
+
"h-full w-full [&>div]:!block",
|
|
4751
|
+
!disableRoundedInherit && "rounded-[inherit]"
|
|
4752
|
+
),
|
|
4753
|
+
children
|
|
4754
|
+
}
|
|
4755
|
+
),
|
|
4756
|
+
/* @__PURE__ */ jsx21(ScrollBar, { className: scrollBarClassName }),
|
|
4757
|
+
/* @__PURE__ */ jsx21(ScrollAreaPrimitive.Corner, {})
|
|
4758
|
+
]
|
|
4759
|
+
}
|
|
4760
|
+
)
|
|
4761
|
+
);
|
|
4643
4762
|
ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
|
|
4644
|
-
var ScrollBar = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
4763
|
+
var ScrollBar = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx21(
|
|
4645
4764
|
ScrollAreaPrimitive.ScrollAreaScrollbar,
|
|
4646
4765
|
{
|
|
4647
4766
|
ref,
|
|
4648
4767
|
orientation: "vertical",
|
|
4649
|
-
className: cn("flex h-full w-2 touch-none select-none transition-colors", className),
|
|
4768
|
+
className: cn("mr-1 flex h-full w-2 touch-none select-none transition-colors", className),
|
|
4650
4769
|
...props,
|
|
4651
|
-
children: /* @__PURE__ */
|
|
4770
|
+
children: /* @__PURE__ */ jsx21(
|
|
4652
4771
|
ScrollAreaPrimitive.ScrollAreaThumb,
|
|
4653
4772
|
{
|
|
4654
4773
|
className: cn("relative flex-1 rounded-full bg-zinc-200/70")
|
|
@@ -4659,7 +4778,7 @@ var ScrollBar = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
4659
4778
|
ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
|
|
4660
4779
|
|
|
4661
4780
|
// src/components/databrowser/components/sidebar/infinite-scroll.tsx
|
|
4662
|
-
import { jsx as
|
|
4781
|
+
import { jsx as jsx22, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
4663
4782
|
var InfiniteScroll = ({
|
|
4664
4783
|
query,
|
|
4665
4784
|
children,
|
|
@@ -4691,20 +4810,17 @@ var InfiniteScroll = ({
|
|
|
4691
4810
|
const timer = setTimeout(checkAndFetchMore, 100);
|
|
4692
4811
|
return () => clearTimeout(timer);
|
|
4693
4812
|
}, [active, query.data]);
|
|
4694
|
-
return /* @__PURE__ */
|
|
4813
|
+
return /* @__PURE__ */ jsx22(
|
|
4695
4814
|
ScrollArea,
|
|
4696
4815
|
{
|
|
4697
4816
|
type: "always",
|
|
4698
4817
|
onScroll: handleScroll,
|
|
4699
4818
|
...props,
|
|
4700
|
-
className: cn(
|
|
4701
|
-
"block h-full w-full overflow-visible rounded-lg border border-zinc-200 bg-white p-1 pr-3 transition-all",
|
|
4702
|
-
props.className
|
|
4703
|
-
),
|
|
4819
|
+
className: cn("block h-full w-full overflow-visible transition-all", props.className),
|
|
4704
4820
|
ref: scrollRef,
|
|
4705
|
-
children: /* @__PURE__ */
|
|
4821
|
+
children: /* @__PURE__ */ jsxs12("div", { ref: contentRef, children: [
|
|
4706
4822
|
children,
|
|
4707
|
-
/* @__PURE__ */
|
|
4823
|
+
/* @__PURE__ */ jsx22("div", { className: "flex h-[100px] justify-center py-2 text-zinc-300", children: query.isFetching && /* @__PURE__ */ jsx22(IconLoader2, { className: "animate-spin", size: 16 }) })
|
|
4708
4824
|
] })
|
|
4709
4825
|
}
|
|
4710
4826
|
);
|
|
@@ -4716,10 +4832,10 @@ import { IconPlus } from "@tabler/icons-react";
|
|
|
4716
4832
|
// src/components/ui/tooltip.tsx
|
|
4717
4833
|
import * as React10 from "react";
|
|
4718
4834
|
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
4719
|
-
import { Fragment as Fragment3, jsx as
|
|
4835
|
+
import { Fragment as Fragment3, jsx as jsx23, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
4720
4836
|
var Tooltip = TooltipPrimitive.Root;
|
|
4721
4837
|
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
4722
|
-
var TooltipContent = React10.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */
|
|
4838
|
+
var TooltipContent = React10.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx23(TooltipPrimitive.Portal, { container: portalRoot, children: /* @__PURE__ */ jsx23(
|
|
4723
4839
|
TooltipPrimitive.Content,
|
|
4724
4840
|
{
|
|
4725
4841
|
ref,
|
|
@@ -4736,15 +4852,24 @@ var SimpleTooltip = ({
|
|
|
4736
4852
|
content,
|
|
4737
4853
|
children
|
|
4738
4854
|
}) => {
|
|
4739
|
-
if (!content) return /* @__PURE__ */
|
|
4740
|
-
return /* @__PURE__ */
|
|
4741
|
-
/* @__PURE__ */
|
|
4742
|
-
/* @__PURE__ */
|
|
4855
|
+
if (!content) return /* @__PURE__ */ jsx23(Fragment3, { children });
|
|
4856
|
+
return /* @__PURE__ */ jsxs13(Tooltip, { delayDuration: 400, children: [
|
|
4857
|
+
/* @__PURE__ */ jsx23(TooltipTrigger, { asChild: true, children }),
|
|
4858
|
+
/* @__PURE__ */ jsx23(TooltipContent, { side: "top", children: content })
|
|
4743
4859
|
] });
|
|
4744
4860
|
};
|
|
4745
4861
|
|
|
4746
4862
|
// src/types/index.ts
|
|
4747
|
-
var DATA_TYPES = [
|
|
4863
|
+
var DATA_TYPES = [
|
|
4864
|
+
"string",
|
|
4865
|
+
"list",
|
|
4866
|
+
"hash",
|
|
4867
|
+
"set",
|
|
4868
|
+
"zset",
|
|
4869
|
+
"json",
|
|
4870
|
+
"stream",
|
|
4871
|
+
"search"
|
|
4872
|
+
];
|
|
4748
4873
|
var DATA_TYPE_NAMES = {
|
|
4749
4874
|
string: "String",
|
|
4750
4875
|
list: "List",
|
|
@@ -4752,7 +4877,8 @@ var DATA_TYPE_NAMES = {
|
|
|
4752
4877
|
set: "Set",
|
|
4753
4878
|
zset: "Sorted Set",
|
|
4754
4879
|
json: "JSON",
|
|
4755
|
-
stream: "Stream"
|
|
4880
|
+
stream: "Stream",
|
|
4881
|
+
search: "Search Index"
|
|
4756
4882
|
};
|
|
4757
4883
|
|
|
4758
4884
|
// src/components/databrowser/components/type-tag.tsx
|
|
@@ -4762,17 +4888,19 @@ import {
|
|
|
4762
4888
|
IconHash,
|
|
4763
4889
|
IconLayersIntersect,
|
|
4764
4890
|
IconList,
|
|
4765
|
-
IconQuote
|
|
4891
|
+
IconQuote,
|
|
4892
|
+
IconSearch
|
|
4766
4893
|
} from "@tabler/icons-react";
|
|
4767
|
-
import { jsx as
|
|
4894
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
4768
4895
|
var iconsMap = {
|
|
4769
|
-
string: /* @__PURE__ */
|
|
4770
|
-
set: /* @__PURE__ */
|
|
4771
|
-
hash: /* @__PURE__ */
|
|
4772
|
-
json: /* @__PURE__ */
|
|
4773
|
-
zset: /* @__PURE__ */
|
|
4774
|
-
list: /* @__PURE__ */
|
|
4775
|
-
stream: /* @__PURE__ */
|
|
4896
|
+
string: /* @__PURE__ */ jsx24(IconQuote, { size: 15, stroke: 1.2 }),
|
|
4897
|
+
set: /* @__PURE__ */ jsx24(IconLayersIntersect, { size: 15, stroke: 1.2 }),
|
|
4898
|
+
hash: /* @__PURE__ */ jsx24(IconHash, { size: 15, stroke: 1.2 }),
|
|
4899
|
+
json: /* @__PURE__ */ jsx24(IconCodeDots, { size: 15, stroke: 1.2 }),
|
|
4900
|
+
zset: /* @__PURE__ */ jsx24(IconArrowsSort, { size: 15, stroke: 1.2 }),
|
|
4901
|
+
list: /* @__PURE__ */ jsx24(IconList, { size: 15, stroke: 1.2 }),
|
|
4902
|
+
stream: /* @__PURE__ */ jsx24(IconList, { size: 15, stroke: 1.2 }),
|
|
4903
|
+
search: /* @__PURE__ */ jsx24(IconSearch, { size: 15, stroke: 1.2 })
|
|
4776
4904
|
};
|
|
4777
4905
|
var tagVariants = cva("inline-flex shrink-0 items-center rounded-md justify-center", {
|
|
4778
4906
|
variants: {
|
|
@@ -4783,11 +4911,12 @@ var tagVariants = cva("inline-flex shrink-0 items-center rounded-md justify-cent
|
|
|
4783
4911
|
zset: "bg-pink-200 text-pink-800",
|
|
4784
4912
|
json: "bg-purple-200 text-purple-800",
|
|
4785
4913
|
list: "bg-orange-200 text-orange-800",
|
|
4786
|
-
stream: "bg-green-200 text-green-800"
|
|
4914
|
+
stream: "bg-green-200 text-green-800",
|
|
4915
|
+
search: "bg-rose-200 text-rose-800"
|
|
4787
4916
|
},
|
|
4788
4917
|
type: {
|
|
4789
4918
|
icon: "size-5",
|
|
4790
|
-
badge: "h-
|
|
4919
|
+
badge: "h-[26px] px-2 uppercase whitespace-nowrap text-xs font-medium leading-none tracking-wide"
|
|
4791
4920
|
}
|
|
4792
4921
|
},
|
|
4793
4922
|
defaultVariants: {
|
|
@@ -4796,7 +4925,7 @@ var tagVariants = cva("inline-flex shrink-0 items-center rounded-md justify-cent
|
|
|
4796
4925
|
}
|
|
4797
4926
|
});
|
|
4798
4927
|
function TypeTag({ className, variant, type }) {
|
|
4799
|
-
return /* @__PURE__ */
|
|
4928
|
+
return /* @__PURE__ */ jsx24("span", { className: cn(tagVariants({ variant, type, className })), children: type === "icon" ? iconsMap[variant] : DATA_TYPE_NAMES[variant] });
|
|
4800
4929
|
}
|
|
4801
4930
|
|
|
4802
4931
|
// src/components/databrowser/components/display/key-actions.tsx
|
|
@@ -4806,10 +4935,10 @@ import { IconDotsVertical } from "@tabler/icons-react";
|
|
|
4806
4935
|
import * as React11 from "react";
|
|
4807
4936
|
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
4808
4937
|
import { IconCheck as IconCheck2, IconChevronRight as IconChevronRight2, IconCircleFilled as IconCircleFilled2 } from "@tabler/icons-react";
|
|
4809
|
-
import { jsx as
|
|
4938
|
+
import { jsx as jsx25, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
4810
4939
|
var DropdownMenu = DropdownMenuPrimitive.Root;
|
|
4811
4940
|
var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
4812
|
-
var DropdownMenuSubTrigger = React11.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */
|
|
4941
|
+
var DropdownMenuSubTrigger = React11.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs14(
|
|
4813
4942
|
DropdownMenuPrimitive.SubTrigger,
|
|
4814
4943
|
{
|
|
4815
4944
|
ref,
|
|
@@ -4821,12 +4950,12 @@ var DropdownMenuSubTrigger = React11.forwardRef(({ className, inset, children, .
|
|
|
4821
4950
|
...props,
|
|
4822
4951
|
children: [
|
|
4823
4952
|
children,
|
|
4824
|
-
/* @__PURE__ */
|
|
4953
|
+
/* @__PURE__ */ jsx25(IconChevronRight2, { className: "ml-auto" })
|
|
4825
4954
|
]
|
|
4826
4955
|
}
|
|
4827
4956
|
));
|
|
4828
4957
|
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
|
|
4829
|
-
var DropdownMenuSubContent = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
4958
|
+
var DropdownMenuSubContent = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx25(
|
|
4830
4959
|
DropdownMenuPrimitive.SubContent,
|
|
4831
4960
|
{
|
|
4832
4961
|
ref,
|
|
@@ -4838,7 +4967,7 @@ var DropdownMenuSubContent = React11.forwardRef(({ className, ...props }, ref) =
|
|
|
4838
4967
|
}
|
|
4839
4968
|
));
|
|
4840
4969
|
DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
|
|
4841
|
-
var DropdownMenuContent = React11.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */
|
|
4970
|
+
var DropdownMenuContent = React11.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx25(DropdownMenuPrimitive.Portal, { container: portalRoot, children: /* @__PURE__ */ jsx25(
|
|
4842
4971
|
DropdownMenuPrimitive.Content,
|
|
4843
4972
|
{
|
|
4844
4973
|
ref,
|
|
@@ -4852,7 +4981,7 @@ var DropdownMenuContent = React11.forwardRef(({ className, sideOffset = 4, ...pr
|
|
|
4852
4981
|
}
|
|
4853
4982
|
) }));
|
|
4854
4983
|
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
4855
|
-
var DropdownMenuItem = React11.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */
|
|
4984
|
+
var DropdownMenuItem = React11.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx25(
|
|
4856
4985
|
DropdownMenuPrimitive.Item,
|
|
4857
4986
|
{
|
|
4858
4987
|
ref,
|
|
@@ -4865,7 +4994,7 @@ var DropdownMenuItem = React11.forwardRef(({ className, inset, ...props }, ref)
|
|
|
4865
4994
|
}
|
|
4866
4995
|
));
|
|
4867
4996
|
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
|
4868
|
-
var DropdownMenuCheckboxItem = React11.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */
|
|
4997
|
+
var DropdownMenuCheckboxItem = React11.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ jsxs14(
|
|
4869
4998
|
DropdownMenuPrimitive.CheckboxItem,
|
|
4870
4999
|
{
|
|
4871
5000
|
ref,
|
|
@@ -4876,13 +5005,13 @@ var DropdownMenuCheckboxItem = React11.forwardRef(({ className, children, checke
|
|
|
4876
5005
|
checked,
|
|
4877
5006
|
...props,
|
|
4878
5007
|
children: [
|
|
4879
|
-
/* @__PURE__ */
|
|
5008
|
+
/* @__PURE__ */ jsx25("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx25(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx25(IconCheck2, { className: "h-4 w-4" }) }) }),
|
|
4880
5009
|
children
|
|
4881
5010
|
]
|
|
4882
5011
|
}
|
|
4883
5012
|
));
|
|
4884
5013
|
DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
|
|
4885
|
-
var DropdownMenuRadioItem = React11.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */
|
|
5014
|
+
var DropdownMenuRadioItem = React11.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs14(
|
|
4886
5015
|
DropdownMenuPrimitive.RadioItem,
|
|
4887
5016
|
{
|
|
4888
5017
|
ref,
|
|
@@ -4892,13 +5021,13 @@ var DropdownMenuRadioItem = React11.forwardRef(({ className, children, ...props
|
|
|
4892
5021
|
),
|
|
4893
5022
|
...props,
|
|
4894
5023
|
children: [
|
|
4895
|
-
/* @__PURE__ */
|
|
5024
|
+
/* @__PURE__ */ jsx25("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx25(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx25(IconCircleFilled2, { className: "h-2 w-2" }) }) }),
|
|
4896
5025
|
children
|
|
4897
5026
|
]
|
|
4898
5027
|
}
|
|
4899
5028
|
));
|
|
4900
5029
|
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
|
|
4901
|
-
var DropdownMenuLabel = React11.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */
|
|
5030
|
+
var DropdownMenuLabel = React11.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx25(
|
|
4902
5031
|
DropdownMenuPrimitive.Label,
|
|
4903
5032
|
{
|
|
4904
5033
|
ref,
|
|
@@ -4907,7 +5036,7 @@ var DropdownMenuLabel = React11.forwardRef(({ className, inset, ...props }, ref)
|
|
|
4907
5036
|
}
|
|
4908
5037
|
));
|
|
4909
5038
|
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
|
|
4910
|
-
var DropdownMenuSeparator = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
5039
|
+
var DropdownMenuSeparator = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx25(
|
|
4911
5040
|
DropdownMenuPrimitive.Separator,
|
|
4912
5041
|
{
|
|
4913
5042
|
ref,
|
|
@@ -4917,18 +5046,24 @@ var DropdownMenuSeparator = React11.forwardRef(({ className, ...props }, ref) =>
|
|
|
4917
5046
|
));
|
|
4918
5047
|
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
|
|
4919
5048
|
var DropdownMenuShortcut = ({ className, ...props }) => {
|
|
4920
|
-
return /* @__PURE__ */
|
|
5049
|
+
return /* @__PURE__ */ jsx25("span", { className: cn("ml-auto text-xs tracking-widest opacity-60", className), ...props });
|
|
4921
5050
|
};
|
|
4922
5051
|
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
4923
5052
|
|
|
4924
5053
|
// src/components/databrowser/components/display/key-actions.tsx
|
|
4925
|
-
import { jsx as
|
|
5054
|
+
import { jsx as jsx26, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
4926
5055
|
function KeyActions({ dataKey, content }) {
|
|
4927
5056
|
const { mutateAsync: deleteKey } = useDeleteKey();
|
|
4928
|
-
return /* @__PURE__ */
|
|
4929
|
-
/* @__PURE__ */
|
|
4930
|
-
|
|
4931
|
-
|
|
5057
|
+
return /* @__PURE__ */ jsxs15(DropdownMenu, { modal: false, children: [
|
|
5058
|
+
/* @__PURE__ */ jsx26(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx26(Button, { size: "icon-sm", "aria-label": "Key actions", children: /* @__PURE__ */ jsx26(
|
|
5059
|
+
IconDotsVertical,
|
|
5060
|
+
{
|
|
5061
|
+
className: "size-4 text-zinc-500 dark:text-zinc-600",
|
|
5062
|
+
fill: "rgb(var(--color-zinc-500))"
|
|
5063
|
+
}
|
|
5064
|
+
) }) }),
|
|
5065
|
+
/* @__PURE__ */ jsxs15(DropdownMenuContent, { className: "", align: "end", children: [
|
|
5066
|
+
content && /* @__PURE__ */ jsx26(
|
|
4932
5067
|
DropdownMenuItem,
|
|
4933
5068
|
{
|
|
4934
5069
|
onClick: () => {
|
|
@@ -4940,7 +5075,7 @@ function KeyActions({ dataKey, content }) {
|
|
|
4940
5075
|
children: "Copy content"
|
|
4941
5076
|
}
|
|
4942
5077
|
),
|
|
4943
|
-
/* @__PURE__ */
|
|
5078
|
+
/* @__PURE__ */ jsx26(
|
|
4944
5079
|
DropdownMenuItem,
|
|
4945
5080
|
{
|
|
4946
5081
|
onClick: () => {
|
|
@@ -4949,12 +5084,12 @@ function KeyActions({ dataKey, content }) {
|
|
|
4949
5084
|
children: "Copy key"
|
|
4950
5085
|
}
|
|
4951
5086
|
),
|
|
4952
|
-
/* @__PURE__ */
|
|
5087
|
+
/* @__PURE__ */ jsx26(
|
|
4953
5088
|
DeleteAlertDialog,
|
|
4954
5089
|
{
|
|
4955
5090
|
deletionType: "key",
|
|
4956
5091
|
onDeleteConfirm: async () => await deleteKey(dataKey),
|
|
4957
|
-
children: /* @__PURE__ */
|
|
5092
|
+
children: /* @__PURE__ */ jsx26(
|
|
4958
5093
|
DropdownMenuItem,
|
|
4959
5094
|
{
|
|
4960
5095
|
className: "text-red-500 focus:bg-red-500 focus:text-white",
|
|
@@ -4969,7 +5104,7 @@ function KeyActions({ dataKey, content }) {
|
|
|
4969
5104
|
}
|
|
4970
5105
|
|
|
4971
5106
|
// src/components/databrowser/components/display/display-header.tsx
|
|
4972
|
-
import { jsx as
|
|
5107
|
+
import { jsx as jsx27, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
4973
5108
|
var DisplayHeader = ({
|
|
4974
5109
|
dataKey,
|
|
4975
5110
|
type,
|
|
@@ -4979,19 +5114,19 @@ var DisplayHeader = ({
|
|
|
4979
5114
|
const handleAddItem = () => {
|
|
4980
5115
|
setSelectedListItem({ key: type === "stream" ? "*" : "", isNew: true });
|
|
4981
5116
|
};
|
|
4982
|
-
return /* @__PURE__ */
|
|
4983
|
-
/* @__PURE__ */
|
|
4984
|
-
/* @__PURE__ */
|
|
4985
|
-
/* @__PURE__ */
|
|
4986
|
-
type !== "string" && type !== "json" && /* @__PURE__ */
|
|
4987
|
-
/* @__PURE__ */
|
|
5117
|
+
return /* @__PURE__ */ jsxs16("div", { className: "rounded-lg", children: [
|
|
5118
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex h-[26px] items-center justify-between gap-4", children: [
|
|
5119
|
+
/* @__PURE__ */ jsx27("h2", { className: "grow truncate text-sm", children: dataKey.trim() === "" ? /* @__PURE__ */ jsx27("span", { className: "ml-1 text-zinc-500", children: "(Empty Key)" }) : /* @__PURE__ */ jsx27("span", { className: "font-medium text-zinc-950", children: dataKey }) }),
|
|
5120
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-1", children: [
|
|
5121
|
+
type !== "string" && type !== "json" && type !== "search" && /* @__PURE__ */ jsx27(SimpleTooltip, { content: "Add item", children: /* @__PURE__ */ jsx27(Button, { onClick: handleAddItem, size: "icon-sm", "aria-label": "Add item", children: /* @__PURE__ */ jsx27(IconPlus, { className: "size-4 text-zinc-500 dark:text-zinc-600" }) }) }),
|
|
5122
|
+
/* @__PURE__ */ jsx27(KeyActions, { dataKey, content })
|
|
4988
5123
|
] })
|
|
4989
5124
|
] }),
|
|
4990
|
-
/* @__PURE__ */
|
|
4991
|
-
/* @__PURE__ */
|
|
4992
|
-
/* @__PURE__ */
|
|
4993
|
-
/* @__PURE__ */
|
|
4994
|
-
/* @__PURE__ */
|
|
5125
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex h-10 items-center gap-1.5 overflow-scroll", children: [
|
|
5126
|
+
/* @__PURE__ */ jsx27(TypeTag, { variant: type, type: "badge" }),
|
|
5127
|
+
/* @__PURE__ */ jsx27(SizeBadge, { dataKey }),
|
|
5128
|
+
/* @__PURE__ */ jsx27(LengthBadge, { dataKey, type, content }),
|
|
5129
|
+
/* @__PURE__ */ jsx27(HeaderTTLBadge, { dataKey })
|
|
4995
5130
|
] })
|
|
4996
5131
|
] });
|
|
4997
5132
|
};
|
|
@@ -5055,12 +5190,12 @@ var useSetHashTTL = () => {
|
|
|
5055
5190
|
};
|
|
5056
5191
|
|
|
5057
5192
|
// src/components/databrowser/components/display/hash/hash-field-ttl-badge.tsx
|
|
5058
|
-
import { jsx as
|
|
5193
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
5059
5194
|
var HashFieldTTLBadge = ({ dataKey, field }) => {
|
|
5060
5195
|
const { data } = useFetchHashFieldExpires({ dataKey, fields: [field] });
|
|
5061
5196
|
const { mutate: setTTL, isPending } = useSetHashTTL();
|
|
5062
5197
|
const expireAt = data?.[field];
|
|
5063
|
-
return /* @__PURE__ */
|
|
5198
|
+
return /* @__PURE__ */ jsx28(
|
|
5064
5199
|
TTLBadge,
|
|
5065
5200
|
{
|
|
5066
5201
|
label: "Field TTL:",
|
|
@@ -5077,18 +5212,18 @@ import { useController } from "react-hook-form";
|
|
|
5077
5212
|
|
|
5078
5213
|
// src/components/databrowser/components/display/input/content-type-select.tsx
|
|
5079
5214
|
import { useMemo as useMemo6 } from "react";
|
|
5080
|
-
import { jsx as
|
|
5215
|
+
import { jsx as jsx29, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
5081
5216
|
var ContentTypeSelect = ({
|
|
5082
5217
|
value,
|
|
5083
5218
|
onChange,
|
|
5084
5219
|
data
|
|
5085
5220
|
}) => {
|
|
5086
5221
|
const isValidJSON = useMemo6(() => checkIsValidJSON(data), [data]);
|
|
5087
|
-
return /* @__PURE__ */
|
|
5088
|
-
/* @__PURE__ */
|
|
5089
|
-
/* @__PURE__ */
|
|
5090
|
-
/* @__PURE__ */
|
|
5091
|
-
/* @__PURE__ */
|
|
5222
|
+
return /* @__PURE__ */ jsxs17(Select, { value, onValueChange: onChange, children: [
|
|
5223
|
+
/* @__PURE__ */ jsx29(SelectTrigger, { className: "h-6 w-auto border-none bg-transparent pl-0 pr-6 text-xs text-zinc-500", children: /* @__PURE__ */ jsx29(SelectValue, { placeholder: "Text" }) }),
|
|
5224
|
+
/* @__PURE__ */ jsx29(SelectContent, { children: /* @__PURE__ */ jsxs17(SelectGroup, { children: [
|
|
5225
|
+
/* @__PURE__ */ jsx29(SelectItem, { value: "Text", children: "Text" }),
|
|
5226
|
+
/* @__PURE__ */ jsx29(SelectItem, { disabled: !isValidJSON, value: "JSON", children: "JSON" })
|
|
5092
5227
|
] }) })
|
|
5093
5228
|
] });
|
|
5094
5229
|
};
|
|
@@ -5100,10 +5235,10 @@ import { Editor, useMonaco } from "@monaco-editor/react";
|
|
|
5100
5235
|
// src/components/databrowser/copy-button.tsx
|
|
5101
5236
|
import { useState as useState6 } from "react";
|
|
5102
5237
|
import { IconCheck as IconCheck3, IconCopy as IconCopy2 } from "@tabler/icons-react";
|
|
5103
|
-
import { jsx as
|
|
5238
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
5104
5239
|
function CopyButton({ value, ...props }) {
|
|
5105
5240
|
const [copied, setCopied] = useState6(false);
|
|
5106
|
-
return /* @__PURE__ */
|
|
5241
|
+
return /* @__PURE__ */ jsx30(
|
|
5107
5242
|
Button,
|
|
5108
5243
|
{
|
|
5109
5244
|
onClick: (e) => {
|
|
@@ -5120,7 +5255,7 @@ function CopyButton({ value, ...props }) {
|
|
|
5120
5255
|
variant: "secondary",
|
|
5121
5256
|
size: "icon-sm",
|
|
5122
5257
|
...props,
|
|
5123
|
-
children: copied ? /* @__PURE__ */
|
|
5258
|
+
children: copied ? /* @__PURE__ */ jsx30(IconCheck3, { className: "size-4 text-green-500" }) : /* @__PURE__ */ jsx30(IconCopy2, { className: "size-4 text-zinc-500" })
|
|
5124
5259
|
}
|
|
5125
5260
|
);
|
|
5126
5261
|
}
|
|
@@ -5133,12 +5268,12 @@ var handleCopyClick = async (textToCopy) => {
|
|
|
5133
5268
|
};
|
|
5134
5269
|
|
|
5135
5270
|
// src/components/databrowser/components/display/input/custom-editor.tsx
|
|
5136
|
-
import { jsx as
|
|
5271
|
+
import { jsx as jsx31, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
5137
5272
|
var CustomEditor = (props) => {
|
|
5138
5273
|
if (isTest) {
|
|
5139
|
-
return /* @__PURE__ */
|
|
5274
|
+
return /* @__PURE__ */ jsx31(TestEditor, { ...props });
|
|
5140
5275
|
}
|
|
5141
|
-
return /* @__PURE__ */
|
|
5276
|
+
return /* @__PURE__ */ jsx31(MonacoEditor, { ...props });
|
|
5142
5277
|
};
|
|
5143
5278
|
var MonacoEditor = ({
|
|
5144
5279
|
language,
|
|
@@ -5158,7 +5293,7 @@ var MonacoEditor = ({
|
|
|
5158
5293
|
}
|
|
5159
5294
|
monaco?.editor.setModelLanguage(editorRef.current.getModel(), language);
|
|
5160
5295
|
}, [monaco, language, active]);
|
|
5161
|
-
const editor = /* @__PURE__ */
|
|
5296
|
+
const editor = /* @__PURE__ */ jsx31(
|
|
5162
5297
|
Editor,
|
|
5163
5298
|
{
|
|
5164
5299
|
theme: theme === "dark" ? "vs-dark" : "light",
|
|
@@ -5199,14 +5334,14 @@ var MonacoEditor = ({
|
|
|
5199
5334
|
className: "[&_.monaco-editor-background]:!bg-transparent [&_.monaco-editor]:!bg-transparent"
|
|
5200
5335
|
}
|
|
5201
5336
|
);
|
|
5202
|
-
return /* @__PURE__ */
|
|
5337
|
+
return /* @__PURE__ */ jsxs18(
|
|
5203
5338
|
"div",
|
|
5204
5339
|
{
|
|
5205
5340
|
className: cn("group/editor relative", height === void 0 && "h-full"),
|
|
5206
5341
|
style: { height },
|
|
5207
5342
|
children: [
|
|
5208
5343
|
editor,
|
|
5209
|
-
showCopyButton && /* @__PURE__ */
|
|
5344
|
+
showCopyButton && /* @__PURE__ */ jsx31(
|
|
5210
5345
|
CopyButton,
|
|
5211
5346
|
{
|
|
5212
5347
|
value,
|
|
@@ -5218,14 +5353,14 @@ var MonacoEditor = ({
|
|
|
5218
5353
|
);
|
|
5219
5354
|
};
|
|
5220
5355
|
var TestEditor = ({ value, onChange, height, showCopyButton }) => {
|
|
5221
|
-
return /* @__PURE__ */
|
|
5356
|
+
return /* @__PURE__ */ jsxs18(
|
|
5222
5357
|
"div",
|
|
5223
5358
|
{
|
|
5224
5359
|
className: cn("group/editor relative", height === void 0 && "h-full"),
|
|
5225
5360
|
style: { height },
|
|
5226
5361
|
children: [
|
|
5227
|
-
/* @__PURE__ */
|
|
5228
|
-
showCopyButton && /* @__PURE__ */
|
|
5362
|
+
/* @__PURE__ */ jsx31("input", { "aria-label": "editor", value, onChange: (e) => onChange(e.target.value) }),
|
|
5363
|
+
showCopyButton && /* @__PURE__ */ jsx31(
|
|
5229
5364
|
CopyButton,
|
|
5230
5365
|
{
|
|
5231
5366
|
value,
|
|
@@ -5238,7 +5373,7 @@ var TestEditor = ({ value, onChange, height, showCopyButton }) => {
|
|
|
5238
5373
|
};
|
|
5239
5374
|
|
|
5240
5375
|
// src/components/databrowser/components/display/input/use-field.tsx
|
|
5241
|
-
import { Fragment as Fragment4, jsx as
|
|
5376
|
+
import { Fragment as Fragment4, jsx as jsx32 } from "react/jsx-runtime";
|
|
5242
5377
|
var useField = ({
|
|
5243
5378
|
name,
|
|
5244
5379
|
form,
|
|
@@ -5278,8 +5413,8 @@ var useField = ({
|
|
|
5278
5413
|
}
|
|
5279
5414
|
};
|
|
5280
5415
|
return {
|
|
5281
|
-
selector: /* @__PURE__ */
|
|
5282
|
-
editor: /* @__PURE__ */
|
|
5416
|
+
selector: /* @__PURE__ */ jsx32(ContentTypeSelect, { value: contentType, onChange: handleTypeChange, data: field.value }),
|
|
5417
|
+
editor: /* @__PURE__ */ jsx32(Fragment4, { children: /* @__PURE__ */ jsx32(
|
|
5283
5418
|
CustomEditor,
|
|
5284
5419
|
{
|
|
5285
5420
|
language: contentType === "JSON" ? "json" : "plaintext",
|
|
@@ -5303,13 +5438,13 @@ var checkIsValidJSON = (value) => {
|
|
|
5303
5438
|
};
|
|
5304
5439
|
|
|
5305
5440
|
// src/components/databrowser/components/display/display-list-edit.tsx
|
|
5306
|
-
import { jsx as
|
|
5441
|
+
import { jsx as jsx33, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
5307
5442
|
var ListEditDisplay = ({
|
|
5308
5443
|
dataKey,
|
|
5309
5444
|
type,
|
|
5310
5445
|
item
|
|
5311
5446
|
}) => {
|
|
5312
|
-
return /* @__PURE__ */
|
|
5447
|
+
return /* @__PURE__ */ jsx33("div", { className: "grow rounded-md bg-zinc-100", children: /* @__PURE__ */ jsx33(ListEditForm, { item, type, dataKey }, item.key) });
|
|
5313
5448
|
};
|
|
5314
5449
|
var ListEditForm = ({
|
|
5315
5450
|
type,
|
|
@@ -5348,11 +5483,11 @@ var ListEditForm = ({
|
|
|
5348
5483
|
});
|
|
5349
5484
|
setSelectedListItem(void 0);
|
|
5350
5485
|
});
|
|
5351
|
-
return /* @__PURE__ */
|
|
5352
|
-
/* @__PURE__ */
|
|
5353
|
-
type === "zset" && /* @__PURE__ */
|
|
5354
|
-
type !== "list" && /* @__PURE__ */
|
|
5355
|
-
type !== "set" && type !== "zset" && /* @__PURE__ */
|
|
5486
|
+
return /* @__PURE__ */ jsx33(FormProvider, { ...form, children: /* @__PURE__ */ jsxs19("form", { onSubmit, className: "flex h-full flex-col gap-2", children: [
|
|
5487
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex grow flex-col gap-2", children: [
|
|
5488
|
+
type === "zset" && /* @__PURE__ */ jsx33(NumberFormItem, { name: "value", label: valueLabel }),
|
|
5489
|
+
type !== "list" && /* @__PURE__ */ jsx33(FormItem, { readOnly: type === "stream", name: "key", label: keyLabel, data: itemKey }),
|
|
5490
|
+
type !== "set" && type !== "zset" && /* @__PURE__ */ jsx33(
|
|
5356
5491
|
FormItem,
|
|
5357
5492
|
{
|
|
5358
5493
|
readOnly: type === "stream",
|
|
@@ -5362,7 +5497,7 @@ var ListEditForm = ({
|
|
|
5362
5497
|
}
|
|
5363
5498
|
)
|
|
5364
5499
|
] }),
|
|
5365
|
-
/* @__PURE__ */
|
|
5500
|
+
/* @__PURE__ */ jsxs19(
|
|
5366
5501
|
"div",
|
|
5367
5502
|
{
|
|
5368
5503
|
className: cn(
|
|
@@ -5370,9 +5505,9 @@ var ListEditForm = ({
|
|
|
5370
5505
|
type === "hash" && itemKey !== "" ? "justify-between" : "justify-end"
|
|
5371
5506
|
),
|
|
5372
5507
|
children: [
|
|
5373
|
-
type === "hash" && itemKey !== "" && /* @__PURE__ */
|
|
5374
|
-
/* @__PURE__ */
|
|
5375
|
-
/* @__PURE__ */
|
|
5508
|
+
type === "hash" && itemKey !== "" && /* @__PURE__ */ jsx33(HashFieldTTLBadge, { dataKey, field: itemKey }),
|
|
5509
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex gap-2", children: [
|
|
5510
|
+
/* @__PURE__ */ jsx33(
|
|
5376
5511
|
Button,
|
|
5377
5512
|
{
|
|
5378
5513
|
type: "button",
|
|
@@ -5382,17 +5517,17 @@ var ListEditForm = ({
|
|
|
5382
5517
|
children: "Cancel"
|
|
5383
5518
|
}
|
|
5384
5519
|
),
|
|
5385
|
-
/* @__PURE__ */
|
|
5520
|
+
/* @__PURE__ */ jsx33(
|
|
5386
5521
|
SimpleTooltip,
|
|
5387
5522
|
{
|
|
5388
5523
|
content: type === "stream" && !isNew ? "Streams are not mutable" : void 0,
|
|
5389
|
-
children: /* @__PURE__ */
|
|
5524
|
+
children: /* @__PURE__ */ jsx33(
|
|
5390
5525
|
Button,
|
|
5391
5526
|
{
|
|
5392
5527
|
variant: "primary",
|
|
5393
5528
|
type: "submit",
|
|
5394
5529
|
disabled: !form.formState.isValid || !form.formState.isDirty || type === "stream" && !isNew,
|
|
5395
|
-
children: /* @__PURE__ */
|
|
5530
|
+
children: /* @__PURE__ */ jsx33(Spinner, { isLoading: isPending, isLoadingText: "Saving", children: "Save" })
|
|
5396
5531
|
}
|
|
5397
5532
|
)
|
|
5398
5533
|
}
|
|
@@ -5404,13 +5539,13 @@ var ListEditForm = ({
|
|
|
5404
5539
|
] }) });
|
|
5405
5540
|
};
|
|
5406
5541
|
var NumberFormItem = ({ name, label }) => {
|
|
5407
|
-
return /* @__PURE__ */
|
|
5408
|
-
/* @__PURE__ */
|
|
5409
|
-
/* @__PURE__ */
|
|
5542
|
+
return /* @__PURE__ */ jsxs19("div", { className: "flex flex-col gap-1", children: [
|
|
5543
|
+
/* @__PURE__ */ jsx33("div", { className: "flex", children: /* @__PURE__ */ jsx33("span", { className: "text-xs font-medium text-zinc-700", children: label }) }),
|
|
5544
|
+
/* @__PURE__ */ jsx33(
|
|
5410
5545
|
Controller2,
|
|
5411
5546
|
{
|
|
5412
5547
|
name,
|
|
5413
|
-
render: ({ field }) => /* @__PURE__ */
|
|
5548
|
+
render: ({ field }) => /* @__PURE__ */ jsx33(
|
|
5414
5549
|
"input",
|
|
5415
5550
|
{
|
|
5416
5551
|
className: "plain-input rounded-md border border-zinc-300 px-3 py-1 shadow-sm",
|
|
@@ -5438,14 +5573,14 @@ var FormItem = ({
|
|
|
5438
5573
|
readOnly,
|
|
5439
5574
|
data
|
|
5440
5575
|
});
|
|
5441
|
-
return /* @__PURE__ */
|
|
5442
|
-
/* @__PURE__ */
|
|
5443
|
-
/* @__PURE__ */
|
|
5576
|
+
return /* @__PURE__ */ jsxs19("div", { className: cn("flex flex-col gap-1", !height && "h-full"), children: [
|
|
5577
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex items-center gap-1 text-xs", children: [
|
|
5578
|
+
/* @__PURE__ */ jsx33("span", { className: "font-medium text-zinc-700", children: label }),
|
|
5444
5579
|
" ",
|
|
5445
|
-
/* @__PURE__ */
|
|
5580
|
+
/* @__PURE__ */ jsx33("span", { className: "text-zinc-300", children: "/" }),
|
|
5446
5581
|
selector
|
|
5447
5582
|
] }),
|
|
5448
|
-
/* @__PURE__ */
|
|
5583
|
+
/* @__PURE__ */ jsx33(
|
|
5449
5584
|
"div",
|
|
5450
5585
|
{
|
|
5451
5586
|
className: cn(
|
|
@@ -5460,7 +5595,7 @@ var FormItem = ({
|
|
|
5460
5595
|
|
|
5461
5596
|
// src/components/databrowser/components/display/hash/hash-field-ttl-info.tsx
|
|
5462
5597
|
import { useEffect as useEffect9, useState as useState8 } from "react";
|
|
5463
|
-
import { jsx as
|
|
5598
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
5464
5599
|
var HashFieldTTLInfo = ({
|
|
5465
5600
|
dataKey,
|
|
5466
5601
|
field,
|
|
@@ -5477,11 +5612,11 @@ var HashFieldTTLInfo = ({
|
|
|
5477
5612
|
return () => clearInterval(interval);
|
|
5478
5613
|
}, [expireAt]);
|
|
5479
5614
|
if (!expireAt || expireAt === TTL_NOT_FOUND || expireAt === TTL_INFINITE) return;
|
|
5480
|
-
return /* @__PURE__ */
|
|
5615
|
+
return /* @__PURE__ */ jsx34("span", { className: "block min-w-[30px] whitespace-nowrap text-right text-red-600", children: formatTime(ttl ?? 0) });
|
|
5481
5616
|
};
|
|
5482
5617
|
|
|
5483
5618
|
// src/components/databrowser/components/display/display-list.tsx
|
|
5484
|
-
import { Fragment as Fragment5, jsx as
|
|
5619
|
+
import { Fragment as Fragment5, jsx as jsx35, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
5485
5620
|
var headerLabels = {
|
|
5486
5621
|
list: ["Index", "Content"],
|
|
5487
5622
|
hash: ["Field", "Value"],
|
|
@@ -5492,10 +5627,10 @@ var headerLabels = {
|
|
|
5492
5627
|
var ListDisplay = ({ dataKey, type }) => {
|
|
5493
5628
|
const { selectedListItem } = useTab();
|
|
5494
5629
|
const query = useFetchListItems({ dataKey, type });
|
|
5495
|
-
return /* @__PURE__ */
|
|
5496
|
-
/* @__PURE__ */
|
|
5497
|
-
selectedListItem && /* @__PURE__ */
|
|
5498
|
-
/* @__PURE__ */
|
|
5630
|
+
return /* @__PURE__ */ jsxs20("div", { className: "flex h-full flex-col gap-2", children: [
|
|
5631
|
+
/* @__PURE__ */ jsx35(DisplayHeader, { dataKey, type }),
|
|
5632
|
+
selectedListItem && /* @__PURE__ */ jsx35(ListEditDisplay, { dataKey, type, item: selectedListItem }),
|
|
5633
|
+
/* @__PURE__ */ jsx35("div", { className: cn("min-h-0 grow", selectedListItem && "hidden"), children: /* @__PURE__ */ jsx35(InfiniteScroll, { query, className: "rounded-lg border border-zinc-200 bg-white", children: /* @__PURE__ */ jsx35("table", { className: "w-full", children: /* @__PURE__ */ jsx35(ItemContextMenu, { dataKey, type, children: /* @__PURE__ */ jsx35("tbody", { children: /* @__PURE__ */ jsx35(ListItems, { dataKey, type, query }) }) }) }) }) })
|
|
5499
5634
|
] });
|
|
5500
5635
|
};
|
|
5501
5636
|
var ListItems = ({
|
|
@@ -5507,7 +5642,7 @@ var ListItems = ({
|
|
|
5507
5642
|
const keys = useMemo7(() => query.data?.pages.flatMap((page) => page.keys) ?? [], [query.data]);
|
|
5508
5643
|
const fields = useMemo7(() => keys.map((key) => key.key), [keys]);
|
|
5509
5644
|
const { mutate: editItem } = useEditListItem();
|
|
5510
|
-
return /* @__PURE__ */
|
|
5645
|
+
return /* @__PURE__ */ jsx35(Fragment5, { children: keys.map(({ key, value }, i) => /* @__PURE__ */ jsxs20(
|
|
5511
5646
|
"tr",
|
|
5512
5647
|
{
|
|
5513
5648
|
"data-item-key": key,
|
|
@@ -5516,10 +5651,10 @@ var ListItems = ({
|
|
|
5516
5651
|
setSelectedListItem({ key });
|
|
5517
5652
|
},
|
|
5518
5653
|
className: cn(
|
|
5519
|
-
"h-
|
|
5654
|
+
"h-9 border-b border-b-zinc-100 transition-colors hover:bg-zinc-100 dark:border-b-zinc-200 dark:hover:bg-zinc-200"
|
|
5520
5655
|
),
|
|
5521
5656
|
children: [
|
|
5522
|
-
/* @__PURE__ */
|
|
5657
|
+
/* @__PURE__ */ jsx35(
|
|
5523
5658
|
"td",
|
|
5524
5659
|
{
|
|
5525
5660
|
className: cn(
|
|
@@ -5529,23 +5664,23 @@ var ListItems = ({
|
|
|
5529
5664
|
children: key
|
|
5530
5665
|
}
|
|
5531
5666
|
),
|
|
5532
|
-
value !== void 0 && /* @__PURE__ */
|
|
5667
|
+
value !== void 0 && /* @__PURE__ */ jsx35(
|
|
5533
5668
|
"td",
|
|
5534
5669
|
{
|
|
5535
5670
|
className: cn("cursor-pointer truncate px-3", type === "zset" ? "w-24" : "max-w-0"),
|
|
5536
5671
|
children: value
|
|
5537
5672
|
}
|
|
5538
5673
|
),
|
|
5539
|
-
type !== "stream" && /* @__PURE__ */
|
|
5674
|
+
type !== "stream" && /* @__PURE__ */ jsx35(
|
|
5540
5675
|
"td",
|
|
5541
5676
|
{
|
|
5542
5677
|
className: "w-0 min-w-0 p-0 pr-2",
|
|
5543
5678
|
onClick: (e) => {
|
|
5544
5679
|
e.stopPropagation();
|
|
5545
5680
|
},
|
|
5546
|
-
children: /* @__PURE__ */
|
|
5547
|
-
type === "hash" && /* @__PURE__ */
|
|
5548
|
-
/* @__PURE__ */
|
|
5681
|
+
children: /* @__PURE__ */ jsxs20("div", { className: "flex items-center justify-end gap-2", children: [
|
|
5682
|
+
type === "hash" && /* @__PURE__ */ jsx35(HashFieldTTLInfo, { dataKey, field: key, fields }),
|
|
5683
|
+
/* @__PURE__ */ jsx35(
|
|
5549
5684
|
DeleteAlertDialog,
|
|
5550
5685
|
{
|
|
5551
5686
|
deletionType: "item",
|
|
@@ -5559,14 +5694,14 @@ var ListItems = ({
|
|
|
5559
5694
|
newKey: void 0
|
|
5560
5695
|
});
|
|
5561
5696
|
},
|
|
5562
|
-
children: /* @__PURE__ */
|
|
5697
|
+
children: /* @__PURE__ */ jsx35(
|
|
5563
5698
|
Button,
|
|
5564
5699
|
{
|
|
5565
5700
|
className: "",
|
|
5566
5701
|
size: "icon-sm",
|
|
5567
5702
|
variant: "secondary",
|
|
5568
5703
|
onClick: (e) => e.stopPropagation(),
|
|
5569
|
-
children: /* @__PURE__ */
|
|
5704
|
+
children: /* @__PURE__ */ jsx35(IconTrash2, { className: "size-4 text-zinc-500" })
|
|
5570
5705
|
}
|
|
5571
5706
|
)
|
|
5572
5707
|
}
|
|
@@ -5580,6 +5715,17 @@ var ListItems = ({
|
|
|
5580
5715
|
)) });
|
|
5581
5716
|
};
|
|
5582
5717
|
|
|
5718
|
+
// src/components/databrowser/components/display/display-search.tsx
|
|
5719
|
+
import { jsx as jsx36, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
5720
|
+
var SearchDisplay = ({ dataKey, type }) => {
|
|
5721
|
+
const { data, isLoading } = useFetchSearchIndex(dataKey);
|
|
5722
|
+
const content = data ? JSON.stringify(data, null, 2) : void 0;
|
|
5723
|
+
return /* @__PURE__ */ jsxs21("div", { className: "flex h-full w-full flex-col gap-2", children: [
|
|
5724
|
+
/* @__PURE__ */ jsx36(DisplayHeader, { dataKey, type, content }),
|
|
5725
|
+
/* @__PURE__ */ jsx36("div", { className: "flex h-full grow flex-col gap-2 rounded-md bg-zinc-100", children: isLoading ? /* @__PURE__ */ jsx36(Spinner, { isLoadingText: "", isLoading: true }) : data === null || data === void 0 ? /* @__PURE__ */ jsx36("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsx36("span", { className: "text-zinc-500", children: "No data found" }) }) : /* @__PURE__ */ jsx36("div", { className: "grow overflow-auto rounded-md border border-zinc-300 bg-white p-2", children: /* @__PURE__ */ jsx36("pre", { className: "whitespace-pre-wrap break-words font-mono text-sm", children: JSON.stringify(data, null, 2) }) }) })
|
|
5726
|
+
] });
|
|
5727
|
+
};
|
|
5728
|
+
|
|
5583
5729
|
// src/components/databrowser/components/display/display-simple.tsx
|
|
5584
5730
|
import { useEffect as useEffect10 } from "react";
|
|
5585
5731
|
import { useForm as useForm3 } from "react-hook-form";
|
|
@@ -5635,23 +5781,72 @@ var DataDisplay = () => {
|
|
|
5635
5781
|
const { selectedKey } = useTab();
|
|
5636
5782
|
const { query } = useKeys();
|
|
5637
5783
|
const type = useKeyType(selectedKey);
|
|
5638
|
-
return /* @__PURE__ */ jsx38("div", { className: "h-full p-
|
|
5784
|
+
return /* @__PURE__ */ jsx38("div", { className: "h-full rounded-xl bg-zinc-100 p-5", children: !selectedKey ? /* @__PURE__ */ jsx38("div", {}) : !type ? query.isLoading ? /* @__PURE__ */ jsx38("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsx38("span", { className: "text-zinc-500", children: "Loading..." }) }) : /* @__PURE__ */ jsx38("div", {}) : /* @__PURE__ */ jsx38(Fragment7, { children: type === "string" || type === "json" ? /* @__PURE__ */ jsx38(EditorDisplay, { dataKey: selectedKey, type }) : type === "search" ? /* @__PURE__ */ jsx38(SearchDisplay, { dataKey: selectedKey, type }) : /* @__PURE__ */ jsx38(ListDisplay, { dataKey: selectedKey, type }) }) });
|
|
5785
|
+
};
|
|
5786
|
+
|
|
5787
|
+
// src/components/ui/segmented.tsx
|
|
5788
|
+
import { jsx as jsx39 } from "react/jsx-runtime";
|
|
5789
|
+
var Segmented = ({
|
|
5790
|
+
options,
|
|
5791
|
+
value,
|
|
5792
|
+
onChange
|
|
5793
|
+
}) => {
|
|
5794
|
+
return /* @__PURE__ */ jsx39("div", { className: "flex w-fit gap-[2px] rounded-lg bg-zinc-200 p-[2px] text-sm", children: options.map((option) => /* @__PURE__ */ jsx39(
|
|
5795
|
+
"button",
|
|
5796
|
+
{
|
|
5797
|
+
className: cn(
|
|
5798
|
+
"h-7 rounded-md px-3 transition-all",
|
|
5799
|
+
value === option.key ? "bg-white text-zinc-950" : "text-zinc-700"
|
|
5800
|
+
),
|
|
5801
|
+
onClick: () => {
|
|
5802
|
+
onChange?.(option.key);
|
|
5803
|
+
},
|
|
5804
|
+
children: option.label
|
|
5805
|
+
},
|
|
5806
|
+
option.key
|
|
5807
|
+
)) });
|
|
5808
|
+
};
|
|
5809
|
+
|
|
5810
|
+
// src/components/databrowser/hooks/use-fetch-search-indexes.tsx
|
|
5811
|
+
import { useQuery as useQuery8 } from "@tanstack/react-query";
|
|
5812
|
+
var FETCH_SEARCH_INDEXES_QUERY_KEY = "fetch-search-indexes";
|
|
5813
|
+
var useFetchSearchIndexes = (match) => {
|
|
5814
|
+
const { redisNoPipeline: redis } = useRedis();
|
|
5815
|
+
return useQuery8({
|
|
5816
|
+
queryKey: [FETCH_SEARCH_INDEXES_QUERY_KEY],
|
|
5817
|
+
queryFn: async () => {
|
|
5818
|
+
let cursor = "0";
|
|
5819
|
+
const finalResult = [];
|
|
5820
|
+
while (true) {
|
|
5821
|
+
const [newCursor, results] = await redis.scan(cursor, {
|
|
5822
|
+
count: 100,
|
|
5823
|
+
type: "search",
|
|
5824
|
+
match
|
|
5825
|
+
});
|
|
5826
|
+
finalResult.push(...results);
|
|
5827
|
+
if (newCursor === "0") break;
|
|
5828
|
+
cursor = newCursor;
|
|
5829
|
+
}
|
|
5830
|
+
return finalResult;
|
|
5831
|
+
}
|
|
5832
|
+
});
|
|
5639
5833
|
};
|
|
5640
5834
|
|
|
5641
5835
|
// src/components/databrowser/components/add-key-modal.tsx
|
|
5642
5836
|
import { useState as useState9 } from "react";
|
|
5643
5837
|
import { DialogDescription as DialogDescription2 } from "@radix-ui/react-dialog";
|
|
5838
|
+
import { IconPlus as IconPlus2 } from "@tabler/icons-react";
|
|
5644
5839
|
import { Controller as Controller3, useForm as useForm4 } from "react-hook-form";
|
|
5645
5840
|
|
|
5646
5841
|
// src/components/ui/dialog.tsx
|
|
5647
5842
|
import * as React12 from "react";
|
|
5648
5843
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
5649
|
-
import { jsx as
|
|
5844
|
+
import { jsx as jsx40, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
5650
5845
|
var Dialog = DialogPrimitive.Root;
|
|
5651
5846
|
var DialogTrigger = DialogPrimitive.Trigger;
|
|
5652
|
-
var DialogPortal = (props) => /* @__PURE__ */
|
|
5847
|
+
var DialogPortal = (props) => /* @__PURE__ */ jsx40(DialogPrimitive.Portal, { container: portalRoot, ...props });
|
|
5653
5848
|
DialogPortal.displayName = DialogPrimitive.Portal.displayName;
|
|
5654
|
-
var DialogOverlay = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
5849
|
+
var DialogOverlay = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx40(
|
|
5655
5850
|
DialogPrimitive.Overlay,
|
|
5656
5851
|
{
|
|
5657
5852
|
ref,
|
|
@@ -5666,7 +5861,7 @@ var DialogOverlay = React12.forwardRef(({ className, ...props }, ref) => /* @__P
|
|
|
5666
5861
|
));
|
|
5667
5862
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
5668
5863
|
var DialogContent = React12.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs23(DialogPortal, { children: [
|
|
5669
|
-
/* @__PURE__ */
|
|
5864
|
+
/* @__PURE__ */ jsx40(DialogOverlay, {}),
|
|
5670
5865
|
/* @__PURE__ */ jsxs23(
|
|
5671
5866
|
DialogPrimitive.Content,
|
|
5672
5867
|
{
|
|
@@ -5688,7 +5883,7 @@ var DialogContent = React12.forwardRef(({ className, children, ...props }, ref)
|
|
|
5688
5883
|
children: [
|
|
5689
5884
|
children,
|
|
5690
5885
|
/* @__PURE__ */ jsxs23(DialogPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-white transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-zinc-950 focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-zinc-100 data-[state=open]:text-zinc-500", children: [
|
|
5691
|
-
/* @__PURE__ */
|
|
5886
|
+
/* @__PURE__ */ jsx40(
|
|
5692
5887
|
"svg",
|
|
5693
5888
|
{
|
|
5694
5889
|
width: "15",
|
|
@@ -5697,7 +5892,7 @@ var DialogContent = React12.forwardRef(({ className, children, ...props }, ref)
|
|
|
5697
5892
|
fill: "none",
|
|
5698
5893
|
xmlns: "http://www.w3.org/2000/svg",
|
|
5699
5894
|
className: "h-4 w-4",
|
|
5700
|
-
children: /* @__PURE__ */
|
|
5895
|
+
children: /* @__PURE__ */ jsx40(
|
|
5701
5896
|
"path",
|
|
5702
5897
|
{
|
|
5703
5898
|
d: "M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",
|
|
@@ -5708,16 +5903,16 @@ var DialogContent = React12.forwardRef(({ className, children, ...props }, ref)
|
|
|
5708
5903
|
)
|
|
5709
5904
|
}
|
|
5710
5905
|
),
|
|
5711
|
-
/* @__PURE__ */
|
|
5906
|
+
/* @__PURE__ */ jsx40("span", { className: "sr-only", children: "Close" })
|
|
5712
5907
|
] })
|
|
5713
5908
|
]
|
|
5714
5909
|
}
|
|
5715
5910
|
)
|
|
5716
5911
|
] }));
|
|
5717
5912
|
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
5718
|
-
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */
|
|
5913
|
+
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsx40("div", { className: cn("flex flex-col space-y-1.5 text-center sm:text-left", className), ...props });
|
|
5719
5914
|
DialogHeader.displayName = "DialogHeader";
|
|
5720
|
-
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */
|
|
5915
|
+
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx40(
|
|
5721
5916
|
"div",
|
|
5722
5917
|
{
|
|
5723
5918
|
className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className),
|
|
@@ -5725,7 +5920,7 @@ var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx39(
|
|
|
5725
5920
|
}
|
|
5726
5921
|
);
|
|
5727
5922
|
DialogFooter.displayName = "DialogFooter";
|
|
5728
|
-
var DialogTitle = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
5923
|
+
var DialogTitle = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx40(
|
|
5729
5924
|
DialogPrimitive.Title,
|
|
5730
5925
|
{
|
|
5731
5926
|
ref,
|
|
@@ -5734,7 +5929,7 @@ var DialogTitle = React12.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
5734
5929
|
}
|
|
5735
5930
|
));
|
|
5736
5931
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
5737
|
-
var DialogDescription = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
5932
|
+
var DialogDescription = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx40(
|
|
5738
5933
|
DialogPrimitive.Description,
|
|
5739
5934
|
{
|
|
5740
5935
|
ref,
|
|
@@ -5745,8 +5940,7 @@ var DialogDescription = React12.forwardRef(({ className, ...props }, ref) => /*
|
|
|
5745
5940
|
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
5746
5941
|
|
|
5747
5942
|
// src/components/databrowser/components/add-key-modal.tsx
|
|
5748
|
-
import {
|
|
5749
|
-
import { jsx as jsx40, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
5943
|
+
import { jsx as jsx41, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
5750
5944
|
function AddKeyModal() {
|
|
5751
5945
|
const { setSelectedKey } = useTab();
|
|
5752
5946
|
const [open, setOpen] = useState9(false);
|
|
@@ -5778,24 +5972,35 @@ function AddKeyModal() {
|
|
|
5778
5972
|
setOpen(open2);
|
|
5779
5973
|
},
|
|
5780
5974
|
children: [
|
|
5781
|
-
/* @__PURE__ */
|
|
5975
|
+
/* @__PURE__ */ jsx41(SimpleTooltip, { content: "Add key", children: /* @__PURE__ */ jsx41(DialogTrigger, { asChild: true, children: /* @__PURE__ */ jsxs24(
|
|
5976
|
+
Button,
|
|
5977
|
+
{
|
|
5978
|
+
variant: "primary",
|
|
5979
|
+
"data-testid": "add-key-button",
|
|
5980
|
+
className: "flex h-8 items-center gap-1 rounded-lg pl-2 pr-3 text-sm font-medium",
|
|
5981
|
+
children: [
|
|
5982
|
+
/* @__PURE__ */ jsx41(IconPlus2, { className: "size-5" }),
|
|
5983
|
+
"Key"
|
|
5984
|
+
]
|
|
5985
|
+
}
|
|
5986
|
+
) }) }),
|
|
5782
5987
|
/* @__PURE__ */ jsxs24(DialogContent, { className: "max-w-[400px]", children: [
|
|
5783
|
-
/* @__PURE__ */
|
|
5784
|
-
/* @__PURE__ */
|
|
5988
|
+
/* @__PURE__ */ jsx41(DialogHeader, { children: /* @__PURE__ */ jsx41(DialogTitle, { children: "Create new key" }) }),
|
|
5989
|
+
/* @__PURE__ */ jsx41("div", { className: "sr-only", children: /* @__PURE__ */ jsx41(DialogDescription2, { children: "Create new key" }) }),
|
|
5785
5990
|
/* @__PURE__ */ jsxs24("form", { className: "mt-4", onSubmit, children: [
|
|
5786
5991
|
/* @__PURE__ */ jsxs24("div", { className: "flex gap-1", children: [
|
|
5787
|
-
/* @__PURE__ */
|
|
5992
|
+
/* @__PURE__ */ jsx41(
|
|
5788
5993
|
Controller3,
|
|
5789
5994
|
{
|
|
5790
5995
|
control,
|
|
5791
5996
|
name: "type",
|
|
5792
5997
|
render: ({ field }) => /* @__PURE__ */ jsxs24(Select, { value: field.value, onValueChange: field.onChange, children: [
|
|
5793
|
-
/* @__PURE__ */
|
|
5794
|
-
/* @__PURE__ */
|
|
5998
|
+
/* @__PURE__ */ jsx41(SelectTrigger, { className: "h-8 w-auto pl-[3px] pr-8", children: /* @__PURE__ */ jsx41(SelectValue, {}) }),
|
|
5999
|
+
/* @__PURE__ */ jsx41(SelectContent, { children: /* @__PURE__ */ jsx41(SelectGroup, { children: DATA_TYPES.filter((t) => t !== "search").map((type) => /* @__PURE__ */ jsx41(SelectItem, { value: type, children: /* @__PURE__ */ jsx41(TypeTag, { variant: type, type: "badge" }) }, type)) }) })
|
|
5795
6000
|
] })
|
|
5796
6001
|
}
|
|
5797
6002
|
),
|
|
5798
|
-
/* @__PURE__ */
|
|
6003
|
+
/* @__PURE__ */ jsx41(
|
|
5799
6004
|
Controller3,
|
|
5800
6005
|
{
|
|
5801
6006
|
rules: {
|
|
@@ -5803,14 +6008,14 @@ function AddKeyModal() {
|
|
|
5803
6008
|
},
|
|
5804
6009
|
control,
|
|
5805
6010
|
name: "key",
|
|
5806
|
-
render: ({ field }) => /* @__PURE__ */
|
|
6011
|
+
render: ({ field }) => /* @__PURE__ */ jsx41(Input, { placeholder: "mykey", ...field, className: "h-8 grow" })
|
|
5807
6012
|
}
|
|
5808
6013
|
)
|
|
5809
6014
|
] }),
|
|
5810
|
-
formState.errors.key && /* @__PURE__ */
|
|
5811
|
-
/* @__PURE__ */
|
|
6015
|
+
formState.errors.key && /* @__PURE__ */ jsx41("p", { className: "mb-3 mt-2 text-xs text-red-500", children: formState.errors.key?.message }),
|
|
6016
|
+
/* @__PURE__ */ jsx41("p", { className: "mt-2 text-xs text-zinc-500", children: "After creating the key, you can edit the value" }),
|
|
5812
6017
|
/* @__PURE__ */ jsxs24("div", { className: "mt-6 flex justify-end gap-2", children: [
|
|
5813
|
-
/* @__PURE__ */
|
|
6018
|
+
/* @__PURE__ */ jsx41(
|
|
5814
6019
|
Button,
|
|
5815
6020
|
{
|
|
5816
6021
|
type: "button",
|
|
@@ -5821,7 +6026,7 @@ function AddKeyModal() {
|
|
|
5821
6026
|
children: "Cancel"
|
|
5822
6027
|
}
|
|
5823
6028
|
),
|
|
5824
|
-
/* @__PURE__ */
|
|
6029
|
+
/* @__PURE__ */ jsx41(Button, { variant: "primary", type: "submit", children: /* @__PURE__ */ jsx41(Spinner, { isLoading: isPending, isLoadingText: "Creating", children: "Create" }) })
|
|
5825
6030
|
] })
|
|
5826
6031
|
] })
|
|
5827
6032
|
] })
|
|
@@ -5830,222 +6035,38 @@ function AddKeyModal() {
|
|
|
5830
6035
|
);
|
|
5831
6036
|
}
|
|
5832
6037
|
|
|
5833
|
-
// src/components/databrowser/components/sidebar/
|
|
5834
|
-
import {
|
|
5835
|
-
|
|
5836
|
-
|
|
5837
|
-
|
|
5838
|
-
|
|
5839
|
-
|
|
5840
|
-
}
|
|
5841
|
-
|
|
5842
|
-
|
|
5843
|
-
|
|
5844
|
-
|
|
5845
|
-
|
|
5846
|
-
|
|
5847
|
-
|
|
5848
|
-
|
|
5849
|
-
|
|
5850
|
-
|
|
5851
|
-
|
|
5852
|
-
|
|
5853
|
-
|
|
5854
|
-
|
|
5855
|
-
|
|
5856
|
-
|
|
5857
|
-
|
|
5858
|
-
|
|
5859
|
-
{
|
|
5860
|
-
deletionType: "key",
|
|
5861
|
-
count: contextKeys.length,
|
|
5862
|
-
open: isAlertOpen,
|
|
5863
|
-
onOpenChange: setAlertOpen,
|
|
5864
|
-
onDeleteConfirm: (e) => {
|
|
5865
|
-
e.stopPropagation();
|
|
5866
|
-
for (const key of contextKeys) {
|
|
5867
|
-
deleteKey(key);
|
|
5868
|
-
}
|
|
5869
|
-
setAlertOpen(false);
|
|
5870
|
-
}
|
|
5871
|
-
}
|
|
5872
|
-
),
|
|
5873
|
-
/* @__PURE__ */ jsxs26(ContextMenu, { modal: false, children: [
|
|
5874
|
-
/* @__PURE__ */ jsx42(
|
|
5875
|
-
ContextMenuTrigger,
|
|
5876
|
-
{
|
|
5877
|
-
onContextMenu: (e) => {
|
|
5878
|
-
const el = e.target;
|
|
5879
|
-
const key = el.closest("[data-key]");
|
|
5880
|
-
if (key && key instanceof HTMLElement && key.dataset.key !== void 0) {
|
|
5881
|
-
const clickedKey = key.dataset.key;
|
|
5882
|
-
if (selectedKeys.includes(clickedKey)) {
|
|
5883
|
-
setContextKeys(selectedKeys);
|
|
5884
|
-
} else {
|
|
5885
|
-
setSelectedKey(clickedKey);
|
|
5886
|
-
setContextKeys([clickedKey]);
|
|
5887
|
-
}
|
|
5888
|
-
} else {
|
|
5889
|
-
throw new Error("Key not found");
|
|
5890
|
-
}
|
|
5891
|
-
},
|
|
5892
|
-
children
|
|
5893
|
-
}
|
|
5894
|
-
),
|
|
5895
|
-
/* @__PURE__ */ jsxs26(ContextMenuContent, { children: [
|
|
5896
|
-
/* @__PURE__ */ jsxs26(
|
|
5897
|
-
ContextMenuItem,
|
|
5898
|
-
{
|
|
5899
|
-
onClick: () => {
|
|
5900
|
-
navigator.clipboard.writeText(contextKeys[0]);
|
|
5901
|
-
toast({
|
|
5902
|
-
description: "Key copied to clipboard"
|
|
5903
|
-
});
|
|
5904
|
-
},
|
|
5905
|
-
className: "gap-2",
|
|
5906
|
-
disabled: contextKeys.length !== 1,
|
|
5907
|
-
children: [
|
|
5908
|
-
/* @__PURE__ */ jsx42(IconCopy3, { size: 16 }),
|
|
5909
|
-
"Copy key"
|
|
5910
|
-
]
|
|
5911
|
-
}
|
|
5912
|
-
),
|
|
5913
|
-
/* @__PURE__ */ jsxs26(
|
|
5914
|
-
ContextMenuItem,
|
|
5915
|
-
{
|
|
5916
|
-
onClick: () => {
|
|
5917
|
-
const newTabId = addTab();
|
|
5918
|
-
setSelectedKeyGlobal(newTabId, contextKeys[0]);
|
|
5919
|
-
setSearch(newTabId, currentSearch);
|
|
5920
|
-
selectTab(newTabId);
|
|
5921
|
-
},
|
|
5922
|
-
className: "gap-2",
|
|
5923
|
-
disabled: contextKeys.length !== 1,
|
|
5924
|
-
children: [
|
|
5925
|
-
/* @__PURE__ */ jsx42(IconExternalLink2, { size: 16 }),
|
|
5926
|
-
"Open in new tab"
|
|
5927
|
-
]
|
|
5928
|
-
}
|
|
5929
|
-
),
|
|
5930
|
-
/* @__PURE__ */ jsx42(ContextMenuSeparator3, {}),
|
|
5931
|
-
/* @__PURE__ */ jsxs26(ContextMenuItem, { onClick: () => setAlertOpen(true), className: "gap-2", children: [
|
|
5932
|
-
/* @__PURE__ */ jsx42(IconTrash3, { size: 16 }),
|
|
5933
|
-
contextKeys.length > 1 ? `Delete ${contextKeys.length} keys` : "Delete key"
|
|
5934
|
-
] })
|
|
5935
|
-
] })
|
|
5936
|
-
] })
|
|
5937
|
-
] });
|
|
5938
|
-
};
|
|
5939
|
-
|
|
5940
|
-
// src/components/databrowser/components/sidebar/keys-list.tsx
|
|
5941
|
-
import { Fragment as Fragment10, jsx as jsx43, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
5942
|
-
var KeysList = () => {
|
|
5943
|
-
const { keys } = useKeys();
|
|
5944
|
-
const lastClickedIndexRef = useRef3(null);
|
|
5945
|
-
return /* @__PURE__ */ jsx43(SidebarContextMenu, { children: /* @__PURE__ */ jsxs27(Fragment10, { children: [
|
|
5946
|
-
/* @__PURE__ */ jsx43("div", { className: "h-px" }),
|
|
5947
|
-
keys.map((data, i) => /* @__PURE__ */ jsxs27(Fragment9, { children: [
|
|
5948
|
-
/* @__PURE__ */ jsx43(
|
|
5949
|
-
KeyItem,
|
|
5950
|
-
{
|
|
5951
|
-
index: i,
|
|
5952
|
-
data,
|
|
5953
|
-
allKeys: keys,
|
|
5954
|
-
lastClickedIndexRef
|
|
5955
|
-
}
|
|
5956
|
-
),
|
|
5957
|
-
i !== keys.length - 1 && /* @__PURE__ */ jsx43("div", { className: "-z-10 mx-2 h-px bg-zinc-100 dark:bg-zinc-200" })
|
|
5958
|
-
] }, data[0]))
|
|
5959
|
-
] }) });
|
|
5960
|
-
};
|
|
5961
|
-
var keyStyles = {
|
|
5962
|
-
string: "border-sky-400 !bg-sky-50 text-sky-900",
|
|
5963
|
-
hash: "border-amber-400 !bg-amber-50 text-amber-900",
|
|
5964
|
-
set: "border-indigo-400 !bg-indigo-50 text-indigo-900",
|
|
5965
|
-
zset: "border-pink-400 !bg-pink-50 text-pink-900",
|
|
5966
|
-
json: "border-purple-400 !bg-purple-50 text-purple-900",
|
|
5967
|
-
list: "border-orange-400 !bg-orange-50 text-orange-900",
|
|
5968
|
-
stream: "border-green-400 !bg-green-50 text-green-900"
|
|
5969
|
-
};
|
|
5970
|
-
var KeyItem = ({
|
|
5971
|
-
data,
|
|
5972
|
-
index,
|
|
5973
|
-
allKeys,
|
|
5974
|
-
lastClickedIndexRef
|
|
5975
|
-
}) => {
|
|
5976
|
-
const { selectedKeys, setSelectedKeys, setSelectedKey } = useTab();
|
|
5977
|
-
const [dataKey, dataType] = data;
|
|
5978
|
-
const isKeySelected = selectedKeys.includes(dataKey);
|
|
5979
|
-
const handleClick = (e) => {
|
|
5980
|
-
if (e.shiftKey && lastClickedIndexRef.current !== null) {
|
|
5981
|
-
const start = Math.min(lastClickedIndexRef.current, index);
|
|
5982
|
-
const end = Math.max(lastClickedIndexRef.current, index);
|
|
5983
|
-
const rangeKeys = allKeys.slice(start, end + 1).map(([key]) => key);
|
|
5984
|
-
setSelectedKeys(rangeKeys);
|
|
5985
|
-
} else if (e.metaKey || e.ctrlKey) {
|
|
5986
|
-
if (isKeySelected) {
|
|
5987
|
-
setSelectedKeys(selectedKeys.filter((k) => k !== dataKey));
|
|
5988
|
-
} else {
|
|
5989
|
-
setSelectedKeys([...selectedKeys, dataKey]);
|
|
5990
|
-
}
|
|
5991
|
-
lastClickedIndexRef.current = index;
|
|
5992
|
-
} else {
|
|
5993
|
-
setSelectedKey(dataKey);
|
|
5994
|
-
lastClickedIndexRef.current = index;
|
|
5995
|
-
}
|
|
5996
|
-
};
|
|
5997
|
-
return /* @__PURE__ */ jsxs27(
|
|
5998
|
-
Button,
|
|
5999
|
-
{
|
|
6000
|
-
"data-key": dataKey,
|
|
6001
|
-
variant: isKeySelected ? "default" : "ghost",
|
|
6002
|
-
className: cn(
|
|
6003
|
-
"relative flex h-10 w-full items-center justify-start gap-2 px-3 py-0 !ring-0 focus-visible:bg-zinc-50",
|
|
6004
|
-
"-my-px select-none border border-transparent text-left",
|
|
6005
|
-
isKeySelected && "shadow-sm",
|
|
6006
|
-
isKeySelected && keyStyles[dataType]
|
|
6007
|
-
),
|
|
6008
|
-
onClick: handleClick,
|
|
6009
|
-
children: [
|
|
6010
|
-
/* @__PURE__ */ jsx43(TypeTag, { variant: dataType, type: "icon" }),
|
|
6011
|
-
/* @__PURE__ */ jsx43("p", { className: "truncate whitespace-nowrap", children: dataKey })
|
|
6012
|
-
]
|
|
6013
|
-
}
|
|
6014
|
-
);
|
|
6015
|
-
};
|
|
6016
|
-
|
|
6017
|
-
// src/components/databrowser/components/sidebar/reload-button.tsx
|
|
6018
|
-
import { useState as useState11 } from "react";
|
|
6019
|
-
import { IconLoader2 as IconLoader22, IconRefresh } from "@tabler/icons-react";
|
|
6020
|
-
import { jsx as jsx44 } from "react/jsx-runtime";
|
|
6021
|
-
var ReloadButton = ({
|
|
6022
|
-
onClick,
|
|
6023
|
-
isLoading: isLoadingProp
|
|
6024
|
-
}) => {
|
|
6025
|
-
const [isLoading, setIsLoading] = useState11(false);
|
|
6026
|
-
const handleClick = () => {
|
|
6027
|
-
setIsLoading(true);
|
|
6028
|
-
onClick();
|
|
6029
|
-
setTimeout(() => {
|
|
6030
|
-
setIsLoading(false);
|
|
6031
|
-
}, 350);
|
|
6032
|
-
};
|
|
6033
|
-
return /* @__PURE__ */ jsx44("div", { children: /* @__PURE__ */ jsx44(SimpleTooltip, { content: "Refresh", children: /* @__PURE__ */ jsx44(
|
|
6034
|
-
Button,
|
|
6035
|
-
{
|
|
6036
|
-
variant: "outline",
|
|
6037
|
-
size: "icon-sm",
|
|
6038
|
-
onClick: handleClick,
|
|
6039
|
-
disabled: isLoading || isLoadingProp,
|
|
6040
|
-
children: isLoading ? /* @__PURE__ */ jsx44(IconLoader22, { className: "animate-spin text-zinc-500", size: 16 }) : /* @__PURE__ */ jsx44(IconRefresh, { className: "text-zinc-500 dark:text-zinc-600", size: 16 })
|
|
6041
|
-
}
|
|
6042
|
-
) }) });
|
|
6038
|
+
// src/components/databrowser/components/sidebar/reload-button.tsx
|
|
6039
|
+
import { useState as useState10 } from "react";
|
|
6040
|
+
import { IconLoader2 as IconLoader22, IconRefresh } from "@tabler/icons-react";
|
|
6041
|
+
import { jsx as jsx42 } from "react/jsx-runtime";
|
|
6042
|
+
var ReloadButton = ({
|
|
6043
|
+
onClick,
|
|
6044
|
+
isLoading: isLoadingProp
|
|
6045
|
+
}) => {
|
|
6046
|
+
const [isLoading, setIsLoading] = useState10(false);
|
|
6047
|
+
const handleClick = () => {
|
|
6048
|
+
setIsLoading(true);
|
|
6049
|
+
onClick();
|
|
6050
|
+
setTimeout(() => {
|
|
6051
|
+
setIsLoading(false);
|
|
6052
|
+
}, 350);
|
|
6053
|
+
};
|
|
6054
|
+
return /* @__PURE__ */ jsx42("div", { children: /* @__PURE__ */ jsx42(SimpleTooltip, { content: "Refresh", children: /* @__PURE__ */ jsx42(
|
|
6055
|
+
Button,
|
|
6056
|
+
{
|
|
6057
|
+
variant: "outline",
|
|
6058
|
+
size: "icon",
|
|
6059
|
+
onClick: handleClick,
|
|
6060
|
+
disabled: isLoading || isLoadingProp,
|
|
6061
|
+
children: isLoading ? /* @__PURE__ */ jsx42(IconLoader22, { className: "size-5 animate-spin text-zinc-500" }) : /* @__PURE__ */ jsx42(IconRefresh, { className: "size-5 text-zinc-500 dark:text-zinc-600" })
|
|
6062
|
+
}
|
|
6063
|
+
) }) });
|
|
6043
6064
|
};
|
|
6044
6065
|
|
|
6045
6066
|
// src/components/databrowser/components/sidebar/search-input.tsx
|
|
6046
|
-
import { useEffect as useEffect11, useRef as
|
|
6067
|
+
import { useEffect as useEffect11, useRef as useRef3, useState as useState11 } from "react";
|
|
6047
6068
|
import { IconX as IconX2 } from "@tabler/icons-react";
|
|
6048
|
-
import { jsx as
|
|
6069
|
+
import { jsx as jsx43, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
6049
6070
|
var dedupeSearchHistory = (history) => {
|
|
6050
6071
|
const seen = /* @__PURE__ */ new Set();
|
|
6051
6072
|
return history.filter((item) => {
|
|
@@ -6057,11 +6078,11 @@ var dedupeSearchHistory = (history) => {
|
|
|
6057
6078
|
var SearchInput = () => {
|
|
6058
6079
|
const { setSearchKey, search } = useTab();
|
|
6059
6080
|
const { searchHistory, addSearchHistory } = useDatabrowserStore();
|
|
6060
|
-
const [state, setState] =
|
|
6061
|
-
const [isFocus, setIsFocus] =
|
|
6062
|
-
const [focusedIndex, setFocusedIndex] =
|
|
6063
|
-
const inputRef =
|
|
6064
|
-
const historyItemRefs =
|
|
6081
|
+
const [state, setState] = useState11(search.key);
|
|
6082
|
+
const [isFocus, setIsFocus] = useState11(false);
|
|
6083
|
+
const [focusedIndex, setFocusedIndex] = useState11(-1);
|
|
6084
|
+
const inputRef = useRef3(null);
|
|
6085
|
+
const historyItemRefs = useRef3([]);
|
|
6065
6086
|
const handleSubmit = (value) => {
|
|
6066
6087
|
if (value.trim() !== "" && !value.includes("*")) value = `${value}*`;
|
|
6067
6088
|
addSearchHistory(value);
|
|
@@ -6101,14 +6122,14 @@ var SearchInput = () => {
|
|
|
6101
6122
|
}
|
|
6102
6123
|
}
|
|
6103
6124
|
};
|
|
6104
|
-
return /* @__PURE__ */
|
|
6105
|
-
/* @__PURE__ */
|
|
6106
|
-
/* @__PURE__ */
|
|
6125
|
+
return /* @__PURE__ */ jsxs25("div", { className: "relative grow", children: [
|
|
6126
|
+
/* @__PURE__ */ jsxs25(Popover, { open: isFocus && filteredHistory.length > 0, children: [
|
|
6127
|
+
/* @__PURE__ */ jsx43(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx43("div", { className: "h-8 rounded-md border border-zinc-300 font-normal", children: /* @__PURE__ */ jsx43(
|
|
6107
6128
|
Input,
|
|
6108
6129
|
{
|
|
6109
6130
|
ref: inputRef,
|
|
6110
6131
|
placeholder: "Search",
|
|
6111
|
-
className: "h-full
|
|
6132
|
+
className: "h-full border-none pr-6",
|
|
6112
6133
|
onKeyDown: handleKeyDown,
|
|
6113
6134
|
onChange: (e) => {
|
|
6114
6135
|
setState(e.currentTarget.value);
|
|
@@ -6122,7 +6143,7 @@ var SearchInput = () => {
|
|
|
6122
6143
|
onBlur: () => setIsFocus(false)
|
|
6123
6144
|
}
|
|
6124
6145
|
) }) }),
|
|
6125
|
-
/* @__PURE__ */
|
|
6146
|
+
/* @__PURE__ */ jsx43(
|
|
6126
6147
|
PopoverContent,
|
|
6127
6148
|
{
|
|
6128
6149
|
className: "w-[--radix-popover-trigger-width] divide-y px-3 py-2 text-[13px] text-zinc-900",
|
|
@@ -6131,7 +6152,7 @@ var SearchInput = () => {
|
|
|
6131
6152
|
e.preventDefault();
|
|
6132
6153
|
e.stopPropagation();
|
|
6133
6154
|
},
|
|
6134
|
-
children: filteredHistory.map((item, index) => /* @__PURE__ */
|
|
6155
|
+
children: filteredHistory.map((item, index) => /* @__PURE__ */ jsx43("div", { className: "w-full py-[3px]", children: /* @__PURE__ */ jsx43(
|
|
6135
6156
|
"button",
|
|
6136
6157
|
{
|
|
6137
6158
|
ref: (el) => {
|
|
@@ -6146,131 +6167,896 @@ var SearchInput = () => {
|
|
|
6146
6167
|
}
|
|
6147
6168
|
)
|
|
6148
6169
|
] }),
|
|
6149
|
-
state && /* @__PURE__ */
|
|
6170
|
+
state && /* @__PURE__ */ jsxs25(
|
|
6150
6171
|
Button,
|
|
6151
6172
|
{
|
|
6152
|
-
type: "button",
|
|
6153
|
-
variant: "link",
|
|
6154
|
-
size: "icon",
|
|
6155
|
-
className: "absolute right-1 top-1/2 h-5 w-5 -translate-y-1/2 text-zinc-500 hover:text-zinc-900",
|
|
6156
|
-
onClick: () => {
|
|
6157
|
-
setSearchKey("");
|
|
6158
|
-
setState("");
|
|
6159
|
-
},
|
|
6160
|
-
children: [
|
|
6161
|
-
/* @__PURE__ */
|
|
6162
|
-
/* @__PURE__ */
|
|
6163
|
-
]
|
|
6173
|
+
type: "button",
|
|
6174
|
+
variant: "link",
|
|
6175
|
+
size: "icon",
|
|
6176
|
+
className: "absolute right-1 top-1/2 h-5 w-5 -translate-y-1/2 text-zinc-500 hover:text-zinc-900",
|
|
6177
|
+
onClick: () => {
|
|
6178
|
+
setSearchKey("");
|
|
6179
|
+
setState("");
|
|
6180
|
+
},
|
|
6181
|
+
children: [
|
|
6182
|
+
/* @__PURE__ */ jsx43(IconX2, { size: 16 }),
|
|
6183
|
+
/* @__PURE__ */ jsx43("span", { className: "sr-only", children: "Clear" })
|
|
6184
|
+
]
|
|
6185
|
+
}
|
|
6186
|
+
),
|
|
6187
|
+
" "
|
|
6188
|
+
] });
|
|
6189
|
+
};
|
|
6190
|
+
|
|
6191
|
+
// src/components/databrowser/components/sidebar/type-selector.tsx
|
|
6192
|
+
import { jsx as jsx44, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
6193
|
+
var ALL_TYPES_KEY = "all";
|
|
6194
|
+
function DataTypeSelector() {
|
|
6195
|
+
const { search, setSearchType } = useTab();
|
|
6196
|
+
return /* @__PURE__ */ jsxs26(
|
|
6197
|
+
Select,
|
|
6198
|
+
{
|
|
6199
|
+
onValueChange: (type) => {
|
|
6200
|
+
if (type === ALL_TYPES_KEY) {
|
|
6201
|
+
setSearchType(void 0);
|
|
6202
|
+
} else {
|
|
6203
|
+
setSearchType(type);
|
|
6204
|
+
}
|
|
6205
|
+
},
|
|
6206
|
+
value: search.type === void 0 ? ALL_TYPES_KEY : search.type,
|
|
6207
|
+
children: [
|
|
6208
|
+
/* @__PURE__ */ jsx44(SelectTrigger, { className: "!w-auto select-none whitespace-nowrap border-zinc-300 pr-8", children: /* @__PURE__ */ jsx44(SelectValue, {}) }),
|
|
6209
|
+
/* @__PURE__ */ jsx44(SelectContent, { children: /* @__PURE__ */ jsx44(SelectGroup, { children: [[ALL_TYPES_KEY, "All Types"], ...Object.entries(DATA_TYPE_NAMES)].map(
|
|
6210
|
+
([key, value]) => /* @__PURE__ */ jsx44(SelectItem, { value: key, children: value }, key)
|
|
6211
|
+
) }) })
|
|
6212
|
+
]
|
|
6213
|
+
}
|
|
6214
|
+
);
|
|
6215
|
+
}
|
|
6216
|
+
|
|
6217
|
+
// src/components/databrowser/components/header/index.tsx
|
|
6218
|
+
import { Fragment as Fragment8, jsx as jsx45, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
6219
|
+
var Header = () => {
|
|
6220
|
+
const { isValuesSearchSelected, setIsValuesSearchSelected } = useTab();
|
|
6221
|
+
return /* @__PURE__ */ jsxs27("div", { className: "flex items-center gap-1.5", children: [
|
|
6222
|
+
/* @__PURE__ */ jsx45(
|
|
6223
|
+
Segmented,
|
|
6224
|
+
{
|
|
6225
|
+
options: [
|
|
6226
|
+
{
|
|
6227
|
+
key: "keys",
|
|
6228
|
+
label: "Keys"
|
|
6229
|
+
},
|
|
6230
|
+
{
|
|
6231
|
+
key: "values",
|
|
6232
|
+
label: /* @__PURE__ */ jsxs27("div", { className: "flex items-center gap-1", children: [
|
|
6233
|
+
"Values",
|
|
6234
|
+
/* @__PURE__ */ jsx45("div", { className: "flex h-[18px] items-center rounded-md bg-emerald-100 px-[5px] text-[11px] text-emerald-700", children: "NEW" })
|
|
6235
|
+
] })
|
|
6236
|
+
}
|
|
6237
|
+
],
|
|
6238
|
+
value: isValuesSearchSelected ? "values" : "keys",
|
|
6239
|
+
onChange: (value) => {
|
|
6240
|
+
setIsValuesSearchSelected(value === "values");
|
|
6241
|
+
}
|
|
6242
|
+
}
|
|
6243
|
+
),
|
|
6244
|
+
isValuesSearchSelected ? /* @__PURE__ */ jsx45(Fragment8, { children: /* @__PURE__ */ jsx45(IndexSelector, {}) }) : /* @__PURE__ */ jsxs27(Fragment8, { children: [
|
|
6245
|
+
/* @__PURE__ */ jsx45(DataTypeSelector, {}),
|
|
6246
|
+
/* @__PURE__ */ jsx45(SearchInput, {})
|
|
6247
|
+
] }),
|
|
6248
|
+
/* @__PURE__ */ jsx45(RefreshButton, {}),
|
|
6249
|
+
/* @__PURE__ */ jsx45(AddKeyModal, {})
|
|
6250
|
+
] });
|
|
6251
|
+
};
|
|
6252
|
+
var IndexSelector = () => {
|
|
6253
|
+
const {
|
|
6254
|
+
valuesSearch: { index },
|
|
6255
|
+
setValuesSearchIndex
|
|
6256
|
+
} = useTab();
|
|
6257
|
+
const { data } = useFetchSearchIndexes();
|
|
6258
|
+
return /* @__PURE__ */ jsxs27(
|
|
6259
|
+
Select,
|
|
6260
|
+
{
|
|
6261
|
+
value: index,
|
|
6262
|
+
onValueChange: (value) => {
|
|
6263
|
+
setValuesSearchIndex(value);
|
|
6264
|
+
},
|
|
6265
|
+
children: [
|
|
6266
|
+
/* @__PURE__ */ jsx45(SelectTrigger, { className: "select-none whitespace-nowrap border-zinc-300", children: /* @__PURE__ */ jsx45(SelectValue, { placeholder: "Select an index" }) }),
|
|
6267
|
+
/* @__PURE__ */ jsx45(SelectContent, { children: /* @__PURE__ */ jsx45(SelectGroup, { children: data?.map((index2) => /* @__PURE__ */ jsx45(SelectItem, { value: index2, children: index2 }, index2)) }) })
|
|
6268
|
+
]
|
|
6269
|
+
}
|
|
6270
|
+
);
|
|
6271
|
+
};
|
|
6272
|
+
var RefreshButton = () => {
|
|
6273
|
+
const { query } = useKeys();
|
|
6274
|
+
return /* @__PURE__ */ jsx45(
|
|
6275
|
+
ReloadButton,
|
|
6276
|
+
{
|
|
6277
|
+
onClick: () => {
|
|
6278
|
+
queryClient.invalidateQueries({
|
|
6279
|
+
queryKey: [FETCH_KEYS_QUERY_KEY]
|
|
6280
|
+
});
|
|
6281
|
+
queryClient.invalidateQueries({
|
|
6282
|
+
queryKey: [FETCH_LIST_ITEMS_QUERY_KEY]
|
|
6283
|
+
});
|
|
6284
|
+
queryClient.invalidateQueries({
|
|
6285
|
+
queryKey: [FETCH_SIMPLE_KEY_QUERY_KEY]
|
|
6286
|
+
});
|
|
6287
|
+
queryClient.invalidateQueries({
|
|
6288
|
+
queryKey: [FETCH_KEY_TYPE_QUERY_KEY]
|
|
6289
|
+
});
|
|
6290
|
+
},
|
|
6291
|
+
isLoading: query.isFetching
|
|
6292
|
+
}
|
|
6293
|
+
);
|
|
6294
|
+
};
|
|
6295
|
+
|
|
6296
|
+
// src/components/databrowser/components/header-error.tsx
|
|
6297
|
+
import { jsx as jsx46 } from "react/jsx-runtime";
|
|
6298
|
+
var formatUpstashErrorMessage = (error) => {
|
|
6299
|
+
if (error.name !== "UpstashError") return error.message;
|
|
6300
|
+
const commandIndex = error.message.indexOf(", command was:");
|
|
6301
|
+
if (commandIndex !== -1) {
|
|
6302
|
+
return error.message.slice(0, commandIndex);
|
|
6303
|
+
}
|
|
6304
|
+
return error.message;
|
|
6305
|
+
};
|
|
6306
|
+
var HeaderError = () => {
|
|
6307
|
+
const { query } = useKeys();
|
|
6308
|
+
if (!query.error) return null;
|
|
6309
|
+
return /* @__PURE__ */ jsx46("p", { className: "text-sm text-red-600 dark:text-red-400", children: formatUpstashErrorMessage(query.error) });
|
|
6310
|
+
};
|
|
6311
|
+
|
|
6312
|
+
// src/components/databrowser/components/query-builder.tsx
|
|
6313
|
+
import { useState as useState12 } from "react";
|
|
6314
|
+
|
|
6315
|
+
// src/components/databrowser/components/display/input/query-editor.tsx
|
|
6316
|
+
import { useEffect as useEffect12, useMemo as useMemo8, useRef as useRef4 } from "react";
|
|
6317
|
+
import { Editor as Editor2, useMonaco as useMonaco2 } from "@monaco-editor/react";
|
|
6318
|
+
|
|
6319
|
+
// src/components/databrowser/components/display/input/generateTypeDefinitions.tsx
|
|
6320
|
+
var generateTypeDefinitions = (schema) => {
|
|
6321
|
+
let schemaFieldsInterface = "";
|
|
6322
|
+
if (schema && Object.keys(schema).length > 0) {
|
|
6323
|
+
const fieldLines = Object.entries(schema).map(([fieldName, fieldDef]) => {
|
|
6324
|
+
const fieldType = fieldDef.type;
|
|
6325
|
+
let operationType;
|
|
6326
|
+
switch (fieldType) {
|
|
6327
|
+
case "TEXT": {
|
|
6328
|
+
operationType = "StringOperations";
|
|
6329
|
+
break;
|
|
6330
|
+
}
|
|
6331
|
+
case "U64":
|
|
6332
|
+
case "I64":
|
|
6333
|
+
case "F64": {
|
|
6334
|
+
operationType = "NumberOperations";
|
|
6335
|
+
break;
|
|
6336
|
+
}
|
|
6337
|
+
case "BOOL": {
|
|
6338
|
+
operationType = "BooleanOperations";
|
|
6339
|
+
break;
|
|
6340
|
+
}
|
|
6341
|
+
case "DATE": {
|
|
6342
|
+
operationType = "DateOperations";
|
|
6343
|
+
break;
|
|
6344
|
+
}
|
|
6345
|
+
default: {
|
|
6346
|
+
operationType = "StringOperations";
|
|
6347
|
+
}
|
|
6348
|
+
}
|
|
6349
|
+
const escapedFieldName = fieldName.includes(".") ? `"${fieldName}"` : fieldName;
|
|
6350
|
+
return ` ${escapedFieldName}?: ${operationType};`;
|
|
6351
|
+
}).join("\n");
|
|
6352
|
+
schemaFieldsInterface = `
|
|
6353
|
+
/** Schema fields for the current index */
|
|
6354
|
+
interface SchemaFields {
|
|
6355
|
+
${fieldLines}
|
|
6356
|
+
}`;
|
|
6357
|
+
} else {
|
|
6358
|
+
schemaFieldsInterface = `
|
|
6359
|
+
/** Schema fields - no schema available, using dynamic fields */
|
|
6360
|
+
interface SchemaFields {
|
|
6361
|
+
[fieldName: string]: StringOperations | NumberOperations | BooleanOperations | DateOperations;
|
|
6362
|
+
}`;
|
|
6363
|
+
}
|
|
6364
|
+
return `
|
|
6365
|
+
// String operations for TEXT fields
|
|
6366
|
+
type StringOperationMap = {
|
|
6367
|
+
/** Exact match */
|
|
6368
|
+
$eq: string;
|
|
6369
|
+
/** Not equal */
|
|
6370
|
+
$ne: string;
|
|
6371
|
+
/** Match any value in array */
|
|
6372
|
+
$in: string[];
|
|
6373
|
+
/** Fuzzy match with optional distance */
|
|
6374
|
+
$fuzzy: string | { value: string; distance?: number; transpositionCostOne?: boolean };
|
|
6375
|
+
/** Phrase match */
|
|
6376
|
+
$phrase: string;
|
|
6377
|
+
/** Regular expression match */
|
|
6378
|
+
$regex: string;
|
|
6379
|
+
};
|
|
6380
|
+
|
|
6381
|
+
// Number operations for U64, I64, F64 fields
|
|
6382
|
+
type NumberOperationMap = {
|
|
6383
|
+
/** Exact match */
|
|
6384
|
+
$eq: number;
|
|
6385
|
+
/** Not equal */
|
|
6386
|
+
$ne: number;
|
|
6387
|
+
/** Match any value in array */
|
|
6388
|
+
$in: number[];
|
|
6389
|
+
/** Greater than */
|
|
6390
|
+
$gt: number;
|
|
6391
|
+
/** Greater than or equal */
|
|
6392
|
+
$gte: number;
|
|
6393
|
+
/** Less than */
|
|
6394
|
+
$lt: number;
|
|
6395
|
+
/** Less than or equal */
|
|
6396
|
+
$lte: number;
|
|
6397
|
+
};
|
|
6398
|
+
|
|
6399
|
+
// Boolean operations for BOOL fields
|
|
6400
|
+
type BooleanOperationMap = {
|
|
6401
|
+
/** Exact match */
|
|
6402
|
+
$eq: boolean;
|
|
6403
|
+
/** Not equal */
|
|
6404
|
+
$ne: boolean;
|
|
6405
|
+
/** Match any value in array */
|
|
6406
|
+
$in: boolean[];
|
|
6407
|
+
};
|
|
6408
|
+
|
|
6409
|
+
// Date operations for DATE fields
|
|
6410
|
+
type DateOperationMap = {
|
|
6411
|
+
/** Exact match */
|
|
6412
|
+
$eq: string | Date;
|
|
6413
|
+
/** Not equal */
|
|
6414
|
+
$ne: string | Date;
|
|
6415
|
+
/** Match any value in array */
|
|
6416
|
+
$in: (string | Date)[];
|
|
6417
|
+
};
|
|
6418
|
+
|
|
6419
|
+
// String field operations with optional boost
|
|
6420
|
+
type StringOperations =
|
|
6421
|
+
| { $eq: string; $boost?: number }
|
|
6422
|
+
| { $ne: string; $boost?: number }
|
|
6423
|
+
| { $in: string[]; $boost?: number }
|
|
6424
|
+
| { $fuzzy: string | { value: string; distance?: number; transpositionCostOne?: boolean }; $boost?: number }
|
|
6425
|
+
| { $phrase: string; $boost?: number }
|
|
6426
|
+
| { $regex: string; $boost?: number }
|
|
6427
|
+
| string;
|
|
6428
|
+
|
|
6429
|
+
// Number field operations with optional boost
|
|
6430
|
+
type NumberOperations =
|
|
6431
|
+
| { $eq: number; $boost?: number }
|
|
6432
|
+
| { $ne: number; $boost?: number }
|
|
6433
|
+
| { $in: number[]; $boost?: number }
|
|
6434
|
+
| { $gt: number; $boost?: number }
|
|
6435
|
+
| { $gte: number; $boost?: number }
|
|
6436
|
+
| { $lt: number; $boost?: number }
|
|
6437
|
+
| { $lte: number; $boost?: number }
|
|
6438
|
+
| number;
|
|
6439
|
+
|
|
6440
|
+
// Boolean field operations with optional boost
|
|
6441
|
+
type BooleanOperations =
|
|
6442
|
+
| { $eq: boolean; $boost?: number }
|
|
6443
|
+
| { $ne: boolean; $boost?: number }
|
|
6444
|
+
| { $in: boolean[]; $boost?: number }
|
|
6445
|
+
| boolean;
|
|
6446
|
+
|
|
6447
|
+
// Date field operations with optional boost
|
|
6448
|
+
type DateOperations =
|
|
6449
|
+
| { $eq: string | Date; $boost?: number }
|
|
6450
|
+
| { $ne: string | Date; $boost?: number }
|
|
6451
|
+
| { $in: (string | Date)[]; $boost?: number }
|
|
6452
|
+
| string
|
|
6453
|
+
| Date;
|
|
6454
|
+
|
|
6455
|
+
${schemaFieldsInterface}
|
|
6456
|
+
|
|
6457
|
+
// Query leaf - field conditions without logical operators
|
|
6458
|
+
type QueryLeaf = SchemaFields & {
|
|
6459
|
+
$and?: never;
|
|
6460
|
+
$or?: never;
|
|
6461
|
+
$must?: never;
|
|
6462
|
+
$should?: never;
|
|
6463
|
+
$mustNot?: never;
|
|
6464
|
+
$boost?: never;
|
|
6465
|
+
};
|
|
6466
|
+
|
|
6467
|
+
// Base type for boolean nodes - allows field conditions
|
|
6468
|
+
type BoolBase = SchemaFields;
|
|
6469
|
+
|
|
6470
|
+
// $and: all conditions must match
|
|
6471
|
+
type AndNode = BoolBase & {
|
|
6472
|
+
/** All conditions in this array must match */
|
|
6473
|
+
$and: QueryFilter[];
|
|
6474
|
+
/** Boost score for this node */
|
|
6475
|
+
$boost?: number;
|
|
6476
|
+
$or?: never;
|
|
6477
|
+
$must?: never;
|
|
6478
|
+
$should?: never;
|
|
6479
|
+
$mustNot?: never;
|
|
6480
|
+
};
|
|
6481
|
+
|
|
6482
|
+
// $or: at least one condition must match
|
|
6483
|
+
type OrNode = BoolBase & {
|
|
6484
|
+
/** At least one condition must match */
|
|
6485
|
+
$or: QueryFilter[];
|
|
6486
|
+
/** Boost score for this node */
|
|
6487
|
+
$boost?: number;
|
|
6488
|
+
$and?: never;
|
|
6489
|
+
$must?: never;
|
|
6490
|
+
$should?: never;
|
|
6491
|
+
$mustNot?: never;
|
|
6492
|
+
};
|
|
6493
|
+
|
|
6494
|
+
// $must only (Elasticsearch-style)
|
|
6495
|
+
type MustNode = BoolBase & {
|
|
6496
|
+
/** All conditions must match (similar to $and) */
|
|
6497
|
+
$must: QueryFilter[];
|
|
6498
|
+
/** Boost score for this node */
|
|
6499
|
+
$boost?: number;
|
|
6500
|
+
$and?: never;
|
|
6501
|
+
$or?: never;
|
|
6502
|
+
$should?: never;
|
|
6503
|
+
$mustNot?: never;
|
|
6504
|
+
};
|
|
6505
|
+
|
|
6506
|
+
// $should only (Elasticsearch-style)
|
|
6507
|
+
type ShouldNode = BoolBase & {
|
|
6508
|
+
/** At least one should match (affects scoring) */
|
|
6509
|
+
$should: QueryFilter[];
|
|
6510
|
+
/** Boost score for this node */
|
|
6511
|
+
$boost?: number;
|
|
6512
|
+
$and?: never;
|
|
6513
|
+
$or?: never;
|
|
6514
|
+
$must?: never;
|
|
6515
|
+
$mustNot?: never;
|
|
6516
|
+
};
|
|
6517
|
+
|
|
6518
|
+
// $must + $should combined
|
|
6519
|
+
type MustShouldNode = BoolBase & {
|
|
6520
|
+
/** All these must match */
|
|
6521
|
+
$must: QueryFilter[];
|
|
6522
|
+
/** At least one should match for higher score */
|
|
6523
|
+
$should: QueryFilter[];
|
|
6524
|
+
$and?: never;
|
|
6525
|
+
$or?: never;
|
|
6526
|
+
$mustNot?: never;
|
|
6527
|
+
};
|
|
6528
|
+
|
|
6529
|
+
// $mustNot only
|
|
6530
|
+
type NotNode = BoolBase & {
|
|
6531
|
+
/** None of these conditions should match */
|
|
6532
|
+
$mustNot: QueryFilter[];
|
|
6533
|
+
/** Boost score for this node */
|
|
6534
|
+
$boost?: number;
|
|
6535
|
+
$and?: never;
|
|
6536
|
+
$or?: never;
|
|
6537
|
+
$must?: never;
|
|
6538
|
+
$should?: never;
|
|
6539
|
+
};
|
|
6540
|
+
|
|
6541
|
+
// $and + $mustNot combined
|
|
6542
|
+
type AndNotNode = BoolBase & {
|
|
6543
|
+
$and: QueryFilter[];
|
|
6544
|
+
$mustNot: QueryFilter[];
|
|
6545
|
+
$boost?: number;
|
|
6546
|
+
$or?: never;
|
|
6547
|
+
$must?: never;
|
|
6548
|
+
$should?: never;
|
|
6549
|
+
};
|
|
6550
|
+
|
|
6551
|
+
// $or + $mustNot combined
|
|
6552
|
+
type OrNotNode = BoolBase & {
|
|
6553
|
+
$or: QueryFilter[];
|
|
6554
|
+
$mustNot: QueryFilter[];
|
|
6555
|
+
$boost?: number;
|
|
6556
|
+
$and?: never;
|
|
6557
|
+
$must?: never;
|
|
6558
|
+
$should?: never;
|
|
6559
|
+
};
|
|
6560
|
+
|
|
6561
|
+
// $should + $mustNot combined
|
|
6562
|
+
type ShouldNotNode = BoolBase & {
|
|
6563
|
+
$should: QueryFilter[];
|
|
6564
|
+
$mustNot: QueryFilter[];
|
|
6565
|
+
$boost?: number;
|
|
6566
|
+
$and?: never;
|
|
6567
|
+
$or?: never;
|
|
6568
|
+
$must?: never;
|
|
6569
|
+
};
|
|
6570
|
+
|
|
6571
|
+
// $must + $mustNot combined
|
|
6572
|
+
type MustNotNode = BoolBase & {
|
|
6573
|
+
$must: QueryFilter[];
|
|
6574
|
+
$mustNot: QueryFilter[];
|
|
6575
|
+
$boost?: number;
|
|
6576
|
+
$and?: never;
|
|
6577
|
+
$or?: never;
|
|
6578
|
+
$should?: never;
|
|
6579
|
+
};
|
|
6580
|
+
|
|
6581
|
+
// Full boolean node: $must + $should + $mustNot
|
|
6582
|
+
type BoolNode = BoolBase & {
|
|
6583
|
+
$must: QueryFilter[];
|
|
6584
|
+
$should: QueryFilter[];
|
|
6585
|
+
$mustNot: QueryFilter[];
|
|
6586
|
+
$boost?: number;
|
|
6587
|
+
$and?: never;
|
|
6588
|
+
$or?: never;
|
|
6589
|
+
};
|
|
6590
|
+
|
|
6591
|
+
// Query filter - union of all node types
|
|
6592
|
+
type QueryFilter =
|
|
6593
|
+
| QueryLeaf
|
|
6594
|
+
| AndNode
|
|
6595
|
+
| OrNode
|
|
6596
|
+
| MustNode
|
|
6597
|
+
| ShouldNode
|
|
6598
|
+
| MustShouldNode
|
|
6599
|
+
| NotNode
|
|
6600
|
+
| AndNotNode
|
|
6601
|
+
| OrNotNode
|
|
6602
|
+
| ShouldNotNode
|
|
6603
|
+
| MustNotNode
|
|
6604
|
+
| BoolNode;
|
|
6605
|
+
|
|
6606
|
+
// Root-level $or restriction (no field conditions at root with $or)
|
|
6607
|
+
type RootOrNode = {
|
|
6608
|
+
$or: QueryFilter[];
|
|
6609
|
+
$boost?: number;
|
|
6610
|
+
$and?: never;
|
|
6611
|
+
$must?: never;
|
|
6612
|
+
$should?: never;
|
|
6613
|
+
$mustNot?: never;
|
|
6614
|
+
};
|
|
6615
|
+
|
|
6616
|
+
// Root query filter - restricts $or from mixing with fields at root level
|
|
6617
|
+
type Query =
|
|
6618
|
+
| QueryLeaf
|
|
6619
|
+
| AndNode
|
|
6620
|
+
| RootOrNode
|
|
6621
|
+
| MustNode
|
|
6622
|
+
| ShouldNode
|
|
6623
|
+
| MustShouldNode
|
|
6624
|
+
| NotNode
|
|
6625
|
+
| AndNotNode
|
|
6626
|
+
| ShouldNotNode
|
|
6627
|
+
| MustNotNode
|
|
6628
|
+
| BoolNode;
|
|
6629
|
+
`;
|
|
6630
|
+
};
|
|
6631
|
+
|
|
6632
|
+
// src/components/databrowser/components/display/input/query-editor.tsx
|
|
6633
|
+
import { jsx as jsx47 } from "react/jsx-runtime";
|
|
6634
|
+
var QueryEditor = (props) => {
|
|
6635
|
+
if (isTest) {
|
|
6636
|
+
return /* @__PURE__ */ jsx47(TestQueryEditor, { ...props });
|
|
6637
|
+
}
|
|
6638
|
+
return /* @__PURE__ */ jsx47(MonacoQueryEditor, { ...props });
|
|
6639
|
+
};
|
|
6640
|
+
var MonacoQueryEditor = ({ value, onChange, height, schema }) => {
|
|
6641
|
+
const monaco = useMonaco2();
|
|
6642
|
+
const editorRef = useRef4(null);
|
|
6643
|
+
const theme = useTheme();
|
|
6644
|
+
const libDisposableRef = useRef4(null);
|
|
6645
|
+
const typeDefinitions = useMemo8(() => generateTypeDefinitions(schema), [schema]);
|
|
6646
|
+
useEffect12(() => {
|
|
6647
|
+
if (!monaco) return;
|
|
6648
|
+
if (libDisposableRef.current) {
|
|
6649
|
+
libDisposableRef.current.dispose();
|
|
6650
|
+
}
|
|
6651
|
+
libDisposableRef.current = monaco.languages.typescript.typescriptDefaults.addExtraLib(
|
|
6652
|
+
typeDefinitions,
|
|
6653
|
+
"file:///query-types.d.ts"
|
|
6654
|
+
);
|
|
6655
|
+
return () => {
|
|
6656
|
+
if (libDisposableRef.current) {
|
|
6657
|
+
libDisposableRef.current.dispose();
|
|
6658
|
+
}
|
|
6659
|
+
};
|
|
6660
|
+
}, [monaco, typeDefinitions]);
|
|
6661
|
+
const handleBeforeMount = (monaco2) => {
|
|
6662
|
+
monaco2.languages.typescript.typescriptDefaults.setCompilerOptions({
|
|
6663
|
+
target: monaco2.languages.typescript.ScriptTarget.ES2020,
|
|
6664
|
+
allowNonTsExtensions: true,
|
|
6665
|
+
moduleResolution: monaco2.languages.typescript.ModuleResolutionKind.NodeJs,
|
|
6666
|
+
module: monaco2.languages.typescript.ModuleKind.CommonJS,
|
|
6667
|
+
noEmit: true,
|
|
6668
|
+
esModuleInterop: true,
|
|
6669
|
+
strict: true,
|
|
6670
|
+
allowJs: true
|
|
6671
|
+
});
|
|
6672
|
+
libDisposableRef.current = monaco2.languages.typescript.typescriptDefaults.addExtraLib(
|
|
6673
|
+
typeDefinitions,
|
|
6674
|
+
"file:///query-types.d.ts"
|
|
6675
|
+
);
|
|
6676
|
+
monaco2.languages.typescript.typescriptDefaults.setDiagnosticsOptions({
|
|
6677
|
+
noSemanticValidation: false,
|
|
6678
|
+
noSyntaxValidation: false
|
|
6679
|
+
});
|
|
6680
|
+
monaco2.languages.typescript.typescriptDefaults.setEagerModelSync(true);
|
|
6681
|
+
};
|
|
6682
|
+
useEffect12(() => {
|
|
6683
|
+
const match = value.startsWith("const query: Query = {");
|
|
6684
|
+
const ending = value.endsWith("}");
|
|
6685
|
+
if (!match || !ending) {
|
|
6686
|
+
onChange("const query: Query = {}");
|
|
6687
|
+
}
|
|
6688
|
+
}, [value, editorRef.current, onChange]);
|
|
6689
|
+
const handleChange = (newValue) => {
|
|
6690
|
+
if (!newValue) {
|
|
6691
|
+
onChange("");
|
|
6692
|
+
return;
|
|
6693
|
+
}
|
|
6694
|
+
const match = newValue.startsWith("const query: Query = {");
|
|
6695
|
+
if (match) {
|
|
6696
|
+
onChange(newValue);
|
|
6697
|
+
} else {
|
|
6698
|
+
const editor = editorRef.current;
|
|
6699
|
+
if (editor) {
|
|
6700
|
+
editor.setValue(value);
|
|
6701
|
+
}
|
|
6702
|
+
}
|
|
6703
|
+
};
|
|
6704
|
+
return /* @__PURE__ */ jsx47("div", { className: cn("group/editor relative"), style: { height }, children: /* @__PURE__ */ jsx47(
|
|
6705
|
+
Editor2,
|
|
6706
|
+
{
|
|
6707
|
+
theme: theme === "dark" ? "vs-dark" : "light",
|
|
6708
|
+
loading: void 0,
|
|
6709
|
+
beforeMount: handleBeforeMount,
|
|
6710
|
+
onMount: (editor) => {
|
|
6711
|
+
editorRef.current = editor;
|
|
6712
|
+
},
|
|
6713
|
+
value,
|
|
6714
|
+
onChange: handleChange,
|
|
6715
|
+
defaultLanguage: "typescript",
|
|
6716
|
+
path: "query.ts",
|
|
6717
|
+
options: {
|
|
6718
|
+
wordWrap: "on",
|
|
6719
|
+
overviewRulerBorder: false,
|
|
6720
|
+
overviewRulerLanes: 0,
|
|
6721
|
+
formatOnPaste: true,
|
|
6722
|
+
formatOnType: true,
|
|
6723
|
+
renderWhitespace: "none",
|
|
6724
|
+
smoothScrolling: true,
|
|
6725
|
+
scrollbar: {
|
|
6726
|
+
verticalScrollbarSize: 12
|
|
6727
|
+
},
|
|
6728
|
+
autoIndent: "full",
|
|
6729
|
+
guides: { indentation: false },
|
|
6730
|
+
fontSize: 13,
|
|
6731
|
+
cursorBlinking: "smooth",
|
|
6732
|
+
minimap: { enabled: false },
|
|
6733
|
+
folding: true,
|
|
6734
|
+
glyphMargin: false,
|
|
6735
|
+
lineNumbers: "on",
|
|
6736
|
+
parameterHints: { enabled: true },
|
|
6737
|
+
lineDecorationsWidth: 0,
|
|
6738
|
+
automaticLayout: true,
|
|
6739
|
+
scrollBeyondLastLine: false,
|
|
6740
|
+
renderLineHighlight: "line",
|
|
6741
|
+
unusualLineTerminators: "auto",
|
|
6742
|
+
padding: { top: 8, bottom: 8 },
|
|
6743
|
+
quickSuggestions: true,
|
|
6744
|
+
suggest: {
|
|
6745
|
+
showVariables: false,
|
|
6746
|
+
showConstants: false,
|
|
6747
|
+
showFunctions: false,
|
|
6748
|
+
showClasses: false,
|
|
6749
|
+
showInterfaces: false,
|
|
6750
|
+
showModules: false,
|
|
6751
|
+
showKeywords: false
|
|
6752
|
+
},
|
|
6753
|
+
suggestOnTriggerCharacters: true,
|
|
6754
|
+
acceptSuggestionOnEnter: "on",
|
|
6755
|
+
tabCompletion: "on",
|
|
6756
|
+
wordBasedSuggestions: "off",
|
|
6757
|
+
// Disable navigation features
|
|
6758
|
+
gotoLocation: {
|
|
6759
|
+
multiple: "goto",
|
|
6760
|
+
multipleDefinitions: "goto",
|
|
6761
|
+
multipleTypeDefinitions: "goto",
|
|
6762
|
+
multipleDeclarations: "goto",
|
|
6763
|
+
multipleImplementations: "goto",
|
|
6764
|
+
multipleReferences: "goto"
|
|
6765
|
+
},
|
|
6766
|
+
definitionLinkOpensInPeek: false,
|
|
6767
|
+
contextmenu: false
|
|
6768
|
+
},
|
|
6769
|
+
className: "[&_.current-line]:!border-none [&_.current-line]:!bg-emerald-50 [&_.monaco-editor-background]:!bg-transparent [&_.monaco-editor]:!bg-transparent [&_[role='presentation']]:!bg-transparent"
|
|
6770
|
+
}
|
|
6771
|
+
) });
|
|
6772
|
+
};
|
|
6773
|
+
var TestQueryEditor = ({ value, onChange, height }) => {
|
|
6774
|
+
return /* @__PURE__ */ jsx47("div", { className: cn("group/editor relative"), style: { height }, children: /* @__PURE__ */ jsx47(
|
|
6775
|
+
"textarea",
|
|
6776
|
+
{
|
|
6777
|
+
"aria-label": "query-editor",
|
|
6778
|
+
value,
|
|
6779
|
+
onChange: (e) => onChange(e.target.value),
|
|
6780
|
+
className: "h-full w-full resize-none bg-transparent p-2 font-mono text-sm"
|
|
6781
|
+
}
|
|
6782
|
+
) });
|
|
6783
|
+
};
|
|
6784
|
+
|
|
6785
|
+
// src/components/databrowser/components/query-builder.tsx
|
|
6786
|
+
import { jsx as jsx48 } from "react/jsx-runtime";
|
|
6787
|
+
var QueryBuilder = () => {
|
|
6788
|
+
const { valuesSearch, setValuesSearchQuery } = useTab();
|
|
6789
|
+
const [value, setValue] = useState12(valuesSearch.query);
|
|
6790
|
+
const { data: indexDetails } = useFetchSearchIndex(valuesSearch.index);
|
|
6791
|
+
return /* @__PURE__ */ jsx48("div", { className: "rounded-lg border border-zinc-300 bg-white px-[6px] dark:border-zinc-700", children: /* @__PURE__ */ jsx48(
|
|
6792
|
+
QueryEditor,
|
|
6793
|
+
{
|
|
6794
|
+
height: 300,
|
|
6795
|
+
value,
|
|
6796
|
+
onChange: (value2) => {
|
|
6797
|
+
setValue(value2);
|
|
6798
|
+
const sliced = value2.slice(PREFIX.length);
|
|
6799
|
+
const parsed = parseJSObjectLiteral(sliced);
|
|
6800
|
+
const newValue = value2.slice(PREFIX.length);
|
|
6801
|
+
if (parsed && valuesSearch.query !== newValue) {
|
|
6802
|
+
setValuesSearchQuery(newValue);
|
|
6803
|
+
}
|
|
6804
|
+
},
|
|
6805
|
+
schema: indexDetails?.schema
|
|
6806
|
+
}
|
|
6807
|
+
) });
|
|
6808
|
+
};
|
|
6809
|
+
|
|
6810
|
+
// src/components/databrowser/components/sidebar/empty.tsx
|
|
6811
|
+
import { jsx as jsx49, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
6812
|
+
var Empty = () => {
|
|
6813
|
+
return /* @__PURE__ */ jsx49("div", { className: "flex h-full w-full items-center justify-center rounded-md border bg-white px-4 py-6 text-center", children: /* @__PURE__ */ jsxs28("div", { className: "space-y-5", children: [
|
|
6814
|
+
/* @__PURE__ */ jsx49("p", { className: "text-md font-medium", children: "Data on a break" }),
|
|
6815
|
+
/* @__PURE__ */ jsx49("p", { className: "text-balance text-center", children: '"Quick, lure it back with some CLI magic!"' })
|
|
6816
|
+
] }) });
|
|
6817
|
+
};
|
|
6818
|
+
|
|
6819
|
+
// src/components/databrowser/components/sidebar/keys-list.tsx
|
|
6820
|
+
import { Fragment as Fragment10, useRef as useRef5 } from "react";
|
|
6821
|
+
import { IconChevronRight as IconChevronRight3 } from "@tabler/icons-react";
|
|
6822
|
+
|
|
6823
|
+
// src/components/databrowser/components/sidebar-context-menu.tsx
|
|
6824
|
+
import { useState as useState13 } from "react";
|
|
6825
|
+
import { ContextMenuSeparator as ContextMenuSeparator3 } from "@radix-ui/react-context-menu";
|
|
6826
|
+
import { IconCopy as IconCopy3, IconExternalLink as IconExternalLink2, IconTrash as IconTrash3 } from "@tabler/icons-react";
|
|
6827
|
+
import { Fragment as Fragment9, jsx as jsx50, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
6828
|
+
var SidebarContextMenu = ({ children }) => {
|
|
6829
|
+
const { mutate: deleteKey } = useDeleteKey();
|
|
6830
|
+
const [isAlertOpen, setAlertOpen] = useState13(false);
|
|
6831
|
+
const [contextKeys, setContextKeys] = useState13([]);
|
|
6832
|
+
const {
|
|
6833
|
+
addTab,
|
|
6834
|
+
setSelectedKey: setSelectedKeyGlobal,
|
|
6835
|
+
selectTab,
|
|
6836
|
+
setSearch
|
|
6837
|
+
} = useDatabrowserStore();
|
|
6838
|
+
const { search: currentSearch, selectedKeys, setSelectedKey } = useTab();
|
|
6839
|
+
return /* @__PURE__ */ jsxs29(Fragment9, { children: [
|
|
6840
|
+
/* @__PURE__ */ jsx50(
|
|
6841
|
+
DeleteAlertDialog,
|
|
6842
|
+
{
|
|
6843
|
+
deletionType: "key",
|
|
6844
|
+
count: contextKeys.length,
|
|
6845
|
+
open: isAlertOpen,
|
|
6846
|
+
onOpenChange: setAlertOpen,
|
|
6847
|
+
onDeleteConfirm: (e) => {
|
|
6848
|
+
e.stopPropagation();
|
|
6849
|
+
for (const key of contextKeys) {
|
|
6850
|
+
deleteKey(key);
|
|
6851
|
+
}
|
|
6852
|
+
setAlertOpen(false);
|
|
6853
|
+
}
|
|
6164
6854
|
}
|
|
6165
6855
|
),
|
|
6166
|
-
|
|
6856
|
+
/* @__PURE__ */ jsxs29(ContextMenu, { modal: false, children: [
|
|
6857
|
+
/* @__PURE__ */ jsx50(
|
|
6858
|
+
ContextMenuTrigger,
|
|
6859
|
+
{
|
|
6860
|
+
onContextMenu: (e) => {
|
|
6861
|
+
const el = e.target;
|
|
6862
|
+
const key = el.closest("[data-key]");
|
|
6863
|
+
if (key && key instanceof HTMLElement && key.dataset.key !== void 0) {
|
|
6864
|
+
const clickedKey = key.dataset.key;
|
|
6865
|
+
if (selectedKeys.includes(clickedKey)) {
|
|
6866
|
+
setContextKeys(selectedKeys);
|
|
6867
|
+
} else {
|
|
6868
|
+
setSelectedKey(clickedKey);
|
|
6869
|
+
setContextKeys([clickedKey]);
|
|
6870
|
+
}
|
|
6871
|
+
} else {
|
|
6872
|
+
throw new Error("Key not found");
|
|
6873
|
+
}
|
|
6874
|
+
},
|
|
6875
|
+
children
|
|
6876
|
+
}
|
|
6877
|
+
),
|
|
6878
|
+
/* @__PURE__ */ jsxs29(ContextMenuContent, { children: [
|
|
6879
|
+
/* @__PURE__ */ jsxs29(
|
|
6880
|
+
ContextMenuItem,
|
|
6881
|
+
{
|
|
6882
|
+
onClick: () => {
|
|
6883
|
+
navigator.clipboard.writeText(contextKeys[0]);
|
|
6884
|
+
toast({
|
|
6885
|
+
description: "Key copied to clipboard"
|
|
6886
|
+
});
|
|
6887
|
+
},
|
|
6888
|
+
className: "gap-2",
|
|
6889
|
+
disabled: contextKeys.length !== 1,
|
|
6890
|
+
children: [
|
|
6891
|
+
/* @__PURE__ */ jsx50(IconCopy3, { size: 16 }),
|
|
6892
|
+
"Copy key"
|
|
6893
|
+
]
|
|
6894
|
+
}
|
|
6895
|
+
),
|
|
6896
|
+
/* @__PURE__ */ jsxs29(
|
|
6897
|
+
ContextMenuItem,
|
|
6898
|
+
{
|
|
6899
|
+
onClick: () => {
|
|
6900
|
+
const newTabId = addTab();
|
|
6901
|
+
setSelectedKeyGlobal(newTabId, contextKeys[0]);
|
|
6902
|
+
setSearch(newTabId, currentSearch);
|
|
6903
|
+
selectTab(newTabId);
|
|
6904
|
+
},
|
|
6905
|
+
className: "gap-2",
|
|
6906
|
+
disabled: contextKeys.length !== 1,
|
|
6907
|
+
children: [
|
|
6908
|
+
/* @__PURE__ */ jsx50(IconExternalLink2, { size: 16 }),
|
|
6909
|
+
"Open in new tab"
|
|
6910
|
+
]
|
|
6911
|
+
}
|
|
6912
|
+
),
|
|
6913
|
+
/* @__PURE__ */ jsx50(ContextMenuSeparator3, {}),
|
|
6914
|
+
/* @__PURE__ */ jsxs29(ContextMenuItem, { onClick: () => setAlertOpen(true), className: "gap-2", children: [
|
|
6915
|
+
/* @__PURE__ */ jsx50(IconTrash3, { size: 16 }),
|
|
6916
|
+
contextKeys.length > 1 ? `Delete ${contextKeys.length} keys` : "Delete key"
|
|
6917
|
+
] })
|
|
6918
|
+
] })
|
|
6919
|
+
] })
|
|
6167
6920
|
] });
|
|
6168
6921
|
};
|
|
6169
6922
|
|
|
6170
|
-
// src/components/databrowser/components/sidebar/
|
|
6171
|
-
import { jsx as
|
|
6172
|
-
var
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
/* @__PURE__ */
|
|
6176
|
-
|
|
6177
|
-
|
|
6178
|
-
|
|
6179
|
-
|
|
6180
|
-
|
|
6181
|
-
|
|
6182
|
-
|
|
6923
|
+
// src/components/databrowser/components/sidebar/keys-list.tsx
|
|
6924
|
+
import { Fragment as Fragment11, jsx as jsx51, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
6925
|
+
var KeysList = () => {
|
|
6926
|
+
const { keys } = useKeys();
|
|
6927
|
+
const lastClickedIndexRef = useRef5(null);
|
|
6928
|
+
return /* @__PURE__ */ jsx51(SidebarContextMenu, { children: /* @__PURE__ */ jsxs30(Fragment11, { children: [
|
|
6929
|
+
/* @__PURE__ */ jsx51("div", { className: "h-px" }),
|
|
6930
|
+
keys.map((data, i) => /* @__PURE__ */ jsxs30(Fragment10, { children: [
|
|
6931
|
+
/* @__PURE__ */ jsx51(
|
|
6932
|
+
KeyItem,
|
|
6933
|
+
{
|
|
6934
|
+
index: i,
|
|
6935
|
+
data,
|
|
6936
|
+
allKeys: keys,
|
|
6937
|
+
lastClickedIndexRef
|
|
6938
|
+
}
|
|
6939
|
+
),
|
|
6940
|
+
i !== keys.length - 1 && /* @__PURE__ */ jsx51("div", { className: "-z-10 mx-[13px] h-px bg-zinc-200 dark:bg-zinc-200" })
|
|
6941
|
+
] }, data[0]))
|
|
6942
|
+
] }) });
|
|
6943
|
+
};
|
|
6944
|
+
var KeyItem = ({
|
|
6945
|
+
data,
|
|
6946
|
+
index,
|
|
6947
|
+
allKeys,
|
|
6948
|
+
lastClickedIndexRef
|
|
6949
|
+
}) => {
|
|
6950
|
+
const { selectedKeys, setSelectedKeys, setSelectedKey } = useTab();
|
|
6951
|
+
const [dataKey, dataType] = data;
|
|
6952
|
+
const isKeySelected = selectedKeys.includes(dataKey);
|
|
6953
|
+
const handleClick = (e) => {
|
|
6954
|
+
if (e.shiftKey && lastClickedIndexRef.current !== null) {
|
|
6955
|
+
const start = Math.min(lastClickedIndexRef.current, index);
|
|
6956
|
+
const end = Math.max(lastClickedIndexRef.current, index);
|
|
6957
|
+
const rangeKeys = allKeys.slice(start, end + 1).map(([key]) => key);
|
|
6958
|
+
setSelectedKeys(rangeKeys);
|
|
6959
|
+
} else if (e.metaKey || e.ctrlKey) {
|
|
6960
|
+
if (isKeySelected) {
|
|
6961
|
+
setSelectedKeys(selectedKeys.filter((k) => k !== dataKey));
|
|
6962
|
+
} else {
|
|
6963
|
+
setSelectedKeys([...selectedKeys, dataKey]);
|
|
6964
|
+
}
|
|
6965
|
+
lastClickedIndexRef.current = index;
|
|
6966
|
+
} else {
|
|
6967
|
+
setSelectedKey(dataKey);
|
|
6968
|
+
lastClickedIndexRef.current = index;
|
|
6969
|
+
}
|
|
6970
|
+
};
|
|
6183
6971
|
return /* @__PURE__ */ jsxs30(
|
|
6184
|
-
|
|
6972
|
+
"button",
|
|
6185
6973
|
{
|
|
6186
|
-
|
|
6187
|
-
|
|
6188
|
-
|
|
6189
|
-
|
|
6190
|
-
|
|
6191
|
-
|
|
6192
|
-
|
|
6193
|
-
value: search.type === void 0 ? ALL_TYPES_KEY : search.type,
|
|
6974
|
+
"data-key": dataKey,
|
|
6975
|
+
className: cn(
|
|
6976
|
+
"relative flex h-10 w-full items-center justify-start gap-2 rounded-lg px-3 py-0 !ring-0 transition-colors focus-visible:bg-zinc-50",
|
|
6977
|
+
"-my-px select-none border border-transparent text-left",
|
|
6978
|
+
isKeySelected ? "border-zinc-300 bg-white font-medium text-zinc-950 shadow-[0_1px_2px_0_rgba(0,0,0,0.10)]" : "shadow-none hover:bg-zinc-200"
|
|
6979
|
+
),
|
|
6980
|
+
onClick: handleClick,
|
|
6194
6981
|
children: [
|
|
6195
|
-
/* @__PURE__ */
|
|
6196
|
-
/* @__PURE__ */
|
|
6197
|
-
|
|
6198
|
-
) }) })
|
|
6982
|
+
/* @__PURE__ */ jsx51(TypeTag, { variant: dataType, type: "icon" }),
|
|
6983
|
+
/* @__PURE__ */ jsx51("p", { className: "grow truncate whitespace-nowrap", children: dataKey }),
|
|
6984
|
+
isKeySelected && /* @__PURE__ */ jsx51(IconChevronRight3, { className: "shrink-0 text-zinc-500", size: 20 })
|
|
6199
6985
|
]
|
|
6200
6986
|
}
|
|
6201
6987
|
);
|
|
6202
|
-
}
|
|
6988
|
+
};
|
|
6989
|
+
|
|
6990
|
+
// src/components/databrowser/components/sidebar/skeleton-buttons.tsx
|
|
6991
|
+
import { jsx as jsx52, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
6992
|
+
var DEFAULT_SKELETON_COUNT = 6;
|
|
6993
|
+
var LoadingSkeleton = () => /* @__PURE__ */ jsx52("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__ */ jsxs31("div", { className: "flex h-10 items-center gap-2 px-3", children: [
|
|
6994
|
+
/* @__PURE__ */ jsx52(Skeleton, { className: "size-5 shrink-0 rounded" }),
|
|
6995
|
+
/* @__PURE__ */ jsx52(Skeleton, { className: "h-4 grow rounded" })
|
|
6996
|
+
] }, idx)) });
|
|
6203
6997
|
|
|
6204
6998
|
// src/components/databrowser/components/sidebar/index.tsx
|
|
6205
|
-
import { jsx as
|
|
6999
|
+
import { jsx as jsx53 } from "react/jsx-runtime";
|
|
6206
7000
|
function Sidebar() {
|
|
6207
7001
|
const { keys, query } = useKeys();
|
|
6208
|
-
return /* @__PURE__ */
|
|
6209
|
-
|
|
6210
|
-
|
|
6211
|
-
|
|
6212
|
-
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
queryKey: [FETCH_LIST_ITEMS_QUERY_KEY]
|
|
6222
|
-
});
|
|
6223
|
-
queryClient.invalidateQueries({
|
|
6224
|
-
queryKey: [FETCH_SIMPLE_KEY_QUERY_KEY]
|
|
6225
|
-
});
|
|
6226
|
-
queryClient.invalidateQueries({
|
|
6227
|
-
queryKey: [FETCH_DB_SIZE_QUERY_KEY]
|
|
6228
|
-
});
|
|
6229
|
-
queryClient.invalidateQueries({
|
|
6230
|
-
queryKey: [FETCH_KEY_TYPE_QUERY_KEY]
|
|
6231
|
-
});
|
|
6232
|
-
},
|
|
6233
|
-
isLoading: query.isFetching
|
|
6234
|
-
}
|
|
6235
|
-
),
|
|
6236
|
-
/* @__PURE__ */ jsx48(AddKeyModal, {})
|
|
6237
|
-
] })
|
|
6238
|
-
] }),
|
|
6239
|
-
/* @__PURE__ */ jsxs31("div", { className: "flex h-10 items-center", children: [
|
|
6240
|
-
/* @__PURE__ */ jsx48(DataTypeSelector, {}),
|
|
6241
|
-
/* @__PURE__ */ jsx48(SearchInput, {})
|
|
6242
|
-
] })
|
|
6243
|
-
] }),
|
|
6244
|
-
query.isLoading && keys.length === 0 ? /* @__PURE__ */ jsx48(LoadingSkeleton, {}) : keys.length > 0 ? (
|
|
6245
|
-
// Infinite scroll already has a loader at the bottom
|
|
6246
|
-
/* @__PURE__ */ jsx48(InfiniteScroll, { query, disableRoundedInherit: true, className: "min-h-0", children: /* @__PURE__ */ jsx48(KeysList, {}) })
|
|
6247
|
-
) : /* @__PURE__ */ jsx48(Empty, {})
|
|
6248
|
-
] });
|
|
7002
|
+
return /* @__PURE__ */ jsx53("div", { className: "flex h-full flex-col gap-2", children: query.isLoading && keys.length === 0 ? /* @__PURE__ */ jsx53(LoadingSkeleton, {}) : keys.length > 0 ? (
|
|
7003
|
+
// Infinite scroll already has a loader at the bottom
|
|
7004
|
+
/* @__PURE__ */ jsx53(
|
|
7005
|
+
InfiniteScroll,
|
|
7006
|
+
{
|
|
7007
|
+
query,
|
|
7008
|
+
disableRoundedInherit: true,
|
|
7009
|
+
className: "min-h-0 rounded-xl bg-zinc-100 px-2 py-5 pr-4",
|
|
7010
|
+
scrollBarClassName: "py-5",
|
|
7011
|
+
children: /* @__PURE__ */ jsx53(KeysList, {})
|
|
7012
|
+
}
|
|
7013
|
+
)
|
|
7014
|
+
) : /* @__PURE__ */ jsx53(Empty, {}) });
|
|
6249
7015
|
}
|
|
6250
7016
|
|
|
6251
7017
|
// src/components/databrowser/components/databrowser-instance.tsx
|
|
6252
|
-
import { jsx as
|
|
7018
|
+
import { jsx as jsx54, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
7019
|
+
var PREFIX = "const query: Query = ";
|
|
6253
7020
|
var DatabrowserInstance = ({ hidden }) => {
|
|
6254
|
-
|
|
6255
|
-
|
|
6256
|
-
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
|
|
6260
|
-
|
|
6261
|
-
|
|
6262
|
-
|
|
6263
|
-
|
|
6264
|
-
/* @__PURE__ */
|
|
6265
|
-
|
|
6266
|
-
|
|
6267
|
-
|
|
6268
|
-
|
|
6269
|
-
|
|
7021
|
+
const { isValuesSearchSelected } = useTab();
|
|
7022
|
+
return /* @__PURE__ */ jsx54(KeysProvider, { children: /* @__PURE__ */ jsxs32(
|
|
7023
|
+
"div",
|
|
7024
|
+
{
|
|
7025
|
+
className: cn(
|
|
7026
|
+
"flex min-h-0 grow flex-col rounded-md bg-white px-5 pb-5",
|
|
7027
|
+
hidden && "hidden"
|
|
7028
|
+
),
|
|
7029
|
+
children: [
|
|
7030
|
+
/* @__PURE__ */ jsxs32("div", { className: "space-y-3 py-5", children: [
|
|
7031
|
+
/* @__PURE__ */ jsx54(Header, {}),
|
|
7032
|
+
isValuesSearchSelected && /* @__PURE__ */ jsx54(QueryBuilder, {}),
|
|
7033
|
+
/* @__PURE__ */ jsx54(HeaderError, {})
|
|
7034
|
+
] }),
|
|
7035
|
+
/* @__PURE__ */ jsxs32(
|
|
7036
|
+
PanelGroup,
|
|
7037
|
+
{
|
|
7038
|
+
autoSaveId: "persistence",
|
|
7039
|
+
direction: "horizontal",
|
|
7040
|
+
className: "h-full w-full text-sm antialiased",
|
|
7041
|
+
children: [
|
|
7042
|
+
/* @__PURE__ */ jsx54(Panel, { defaultSize: 30, minSize: 30, children: /* @__PURE__ */ jsx54(Sidebar, {}) }),
|
|
7043
|
+
/* @__PURE__ */ jsxs32(PanelResizeHandle, { className: "group mx-[2px] flex h-full flex-col items-center justify-center gap-1 rounded-md px-[8px] transition-colors hover:bg-zinc-300/10", children: [
|
|
7044
|
+
/* @__PURE__ */ jsx54("div", { className: "h-[3px] w-[3px] rounded-full bg-zinc-300" }),
|
|
7045
|
+
/* @__PURE__ */ jsx54("div", { className: "h-[3px] w-[3px] rounded-full bg-zinc-300" }),
|
|
7046
|
+
/* @__PURE__ */ jsx54("div", { className: "h-[3px] w-[3px] rounded-full bg-zinc-300" })
|
|
7047
|
+
] }),
|
|
7048
|
+
/* @__PURE__ */ jsx54(Panel, { minSize: 40, children: /* @__PURE__ */ jsx54(DataDisplay, {}) })
|
|
7049
|
+
]
|
|
7050
|
+
}
|
|
7051
|
+
),
|
|
7052
|
+
/* @__PURE__ */ jsx54(Toaster, {})
|
|
7053
|
+
]
|
|
7054
|
+
}
|
|
7055
|
+
) });
|
|
6270
7056
|
};
|
|
6271
7057
|
|
|
6272
7058
|
// src/components/databrowser/components/databrowser-tabs.tsx
|
|
6273
|
-
import { useCallback as useCallback3, useEffect as
|
|
7059
|
+
import { useCallback as useCallback3, useEffect as useEffect14, useMemo as useMemo9, useRef as useRef7, useState as useState15 } from "react";
|
|
6274
7060
|
import {
|
|
6275
7061
|
closestCenter,
|
|
6276
7062
|
DndContext,
|
|
@@ -6282,14 +7068,14 @@ import {
|
|
|
6282
7068
|
import { restrictToHorizontalAxis } from "@dnd-kit/modifiers";
|
|
6283
7069
|
import { horizontalListSortingStrategy, SortableContext, useSortable } from "@dnd-kit/sortable";
|
|
6284
7070
|
import { CSS } from "@dnd-kit/utilities";
|
|
6285
|
-
import { IconChevronDown as IconChevronDown2,
|
|
7071
|
+
import { IconChevronDown as IconChevronDown2, IconPlus as IconPlus3, IconWindowMaximize } from "@tabler/icons-react";
|
|
6286
7072
|
|
|
6287
7073
|
// src/components/ui/command.tsx
|
|
6288
7074
|
import * as React13 from "react";
|
|
7075
|
+
import { IconSearch as IconSearch2 } from "@tabler/icons-react";
|
|
6289
7076
|
import { Command as CommandPrimitive } from "cmdk";
|
|
6290
|
-
import {
|
|
6291
|
-
|
|
6292
|
-
var Command = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx50(
|
|
7077
|
+
import { jsx as jsx55, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
7078
|
+
var Command = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx55(
|
|
6293
7079
|
CommandPrimitive,
|
|
6294
7080
|
{
|
|
6295
7081
|
ref,
|
|
@@ -6302,8 +7088,8 @@ var Command = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
6302
7088
|
));
|
|
6303
7089
|
Command.displayName = CommandPrimitive.displayName;
|
|
6304
7090
|
var CommandInput = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs33("div", { className: "flex items-center border-b px-3", "cmdk-input-wrapper": "", children: [
|
|
6305
|
-
/* @__PURE__ */
|
|
6306
|
-
/* @__PURE__ */
|
|
7091
|
+
/* @__PURE__ */ jsx55(IconSearch2, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
|
|
7092
|
+
/* @__PURE__ */ jsx55(
|
|
6307
7093
|
CommandPrimitive.Input,
|
|
6308
7094
|
{
|
|
6309
7095
|
ref,
|
|
@@ -6316,7 +7102,7 @@ var CommandInput = React13.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
6316
7102
|
)
|
|
6317
7103
|
] }));
|
|
6318
7104
|
CommandInput.displayName = CommandPrimitive.Input.displayName;
|
|
6319
|
-
var CommandList = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
7105
|
+
var CommandList = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx55(
|
|
6320
7106
|
CommandPrimitive.List,
|
|
6321
7107
|
{
|
|
6322
7108
|
ref,
|
|
@@ -6325,9 +7111,9 @@ var CommandList = React13.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
6325
7111
|
}
|
|
6326
7112
|
));
|
|
6327
7113
|
CommandList.displayName = CommandPrimitive.List.displayName;
|
|
6328
|
-
var CommandEmpty = React13.forwardRef((props, ref) => /* @__PURE__ */
|
|
7114
|
+
var CommandEmpty = React13.forwardRef((props, ref) => /* @__PURE__ */ jsx55(CommandPrimitive.Empty, { ref, className: "py-6 text-center text-sm", ...props }));
|
|
6329
7115
|
CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
|
|
6330
|
-
var CommandGroup = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
7116
|
+
var CommandGroup = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx55(
|
|
6331
7117
|
CommandPrimitive.Group,
|
|
6332
7118
|
{
|
|
6333
7119
|
ref,
|
|
@@ -6339,7 +7125,7 @@ var CommandGroup = React13.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
6339
7125
|
}
|
|
6340
7126
|
));
|
|
6341
7127
|
CommandGroup.displayName = CommandPrimitive.Group.displayName;
|
|
6342
|
-
var CommandSeparator = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
7128
|
+
var CommandSeparator = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx55(
|
|
6343
7129
|
CommandPrimitive.Separator,
|
|
6344
7130
|
{
|
|
6345
7131
|
ref,
|
|
@@ -6348,7 +7134,7 @@ var CommandSeparator = React13.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
6348
7134
|
}
|
|
6349
7135
|
));
|
|
6350
7136
|
CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
|
|
6351
|
-
var CommandItem = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
7137
|
+
var CommandItem = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx55(
|
|
6352
7138
|
CommandPrimitive.Item,
|
|
6353
7139
|
{
|
|
6354
7140
|
ref,
|
|
@@ -6361,7 +7147,7 @@ var CommandItem = React13.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
6361
7147
|
));
|
|
6362
7148
|
CommandItem.displayName = CommandPrimitive.Item.displayName;
|
|
6363
7149
|
var CommandShortcut = ({ className, ...props }) => {
|
|
6364
|
-
return /* @__PURE__ */
|
|
7150
|
+
return /* @__PURE__ */ jsx55("span", { className: cn("ml-auto text-xs tracking-widest text-zinc-500", className), ...props });
|
|
6365
7151
|
};
|
|
6366
7152
|
CommandShortcut.displayName = "CommandShortcut";
|
|
6367
7153
|
|
|
@@ -6370,25 +7156,16 @@ import {
|
|
|
6370
7156
|
IconArrowsMinimize,
|
|
6371
7157
|
IconCopyPlus,
|
|
6372
7158
|
IconPin,
|
|
6373
|
-
IconSearch as
|
|
7159
|
+
IconSearch as IconSearch3,
|
|
6374
7160
|
IconSquareX,
|
|
6375
7161
|
IconX as IconX3
|
|
6376
7162
|
} from "@tabler/icons-react";
|
|
6377
7163
|
|
|
6378
|
-
// src/components/databrowser/components/tab-type-icon.tsx
|
|
6379
|
-
import { jsx as jsx51 } from "react/jsx-runtime";
|
|
6380
|
-
function TabTypeIcon({ selectedKey }) {
|
|
6381
|
-
const { data: keyType, isLoading } = useFetchKeyType(selectedKey);
|
|
6382
|
-
if (isLoading) return /* @__PURE__ */ jsx51(Skeleton, { className: "h-5 w-5 rounded" });
|
|
6383
|
-
if (!keyType || keyType === "none") return;
|
|
6384
|
-
return /* @__PURE__ */ jsx51(TypeTag, { variant: keyType, type: "icon" });
|
|
6385
|
-
}
|
|
6386
|
-
|
|
6387
7164
|
// src/hooks/use-overflow.ts
|
|
6388
|
-
import { useCallback as useCallback2, useEffect as
|
|
7165
|
+
import { useCallback as useCallback2, useEffect as useEffect13, useRef as useRef6, useState as useState14 } from "react";
|
|
6389
7166
|
var useOverflow = () => {
|
|
6390
|
-
const [isOverflow, setIsOverflow] =
|
|
6391
|
-
const observerRef =
|
|
7167
|
+
const [isOverflow, setIsOverflow] = useState14(false);
|
|
7168
|
+
const observerRef = useRef6(null);
|
|
6392
7169
|
const ref = useCallback2((node) => {
|
|
6393
7170
|
if (observerRef.current) {
|
|
6394
7171
|
observerRef.current.disconnect();
|
|
@@ -6402,7 +7179,7 @@ var useOverflow = () => {
|
|
|
6402
7179
|
});
|
|
6403
7180
|
observerRef.current.observe(node);
|
|
6404
7181
|
}, []);
|
|
6405
|
-
|
|
7182
|
+
useEffect13(() => {
|
|
6406
7183
|
return () => {
|
|
6407
7184
|
observerRef.current?.disconnect();
|
|
6408
7185
|
};
|
|
@@ -6410,10 +7187,19 @@ var useOverflow = () => {
|
|
|
6410
7187
|
return { ref, isOverflow };
|
|
6411
7188
|
};
|
|
6412
7189
|
|
|
7190
|
+
// src/components/databrowser/components/tab-type-icon.tsx
|
|
7191
|
+
import { jsx as jsx56 } from "react/jsx-runtime";
|
|
7192
|
+
function TabTypeIcon({ selectedKey }) {
|
|
7193
|
+
const { data: keyType, isLoading } = useFetchKeyType(selectedKey);
|
|
7194
|
+
if (isLoading) return /* @__PURE__ */ jsx56(Skeleton, { className: "h-5 w-5 rounded" });
|
|
7195
|
+
if (!keyType || keyType === "none") return;
|
|
7196
|
+
return /* @__PURE__ */ jsx56(TypeTag, { variant: keyType, type: "icon" });
|
|
7197
|
+
}
|
|
7198
|
+
|
|
6413
7199
|
// src/components/databrowser/components/tab.tsx
|
|
6414
|
-
import { jsx as
|
|
7200
|
+
import { jsx as jsx57, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
6415
7201
|
var Tab = ({ id, isList }) => {
|
|
6416
|
-
const { active, search, selectedKey, pinned } = useTab();
|
|
7202
|
+
const { active, search, selectedKey, valuesSearch, pinned, isValuesSearchSelected } = useTab();
|
|
6417
7203
|
const {
|
|
6418
7204
|
selectTab,
|
|
6419
7205
|
removeTab,
|
|
@@ -6426,22 +7212,21 @@ var Tab = ({ id, isList }) => {
|
|
|
6426
7212
|
} = useDatabrowserStore();
|
|
6427
7213
|
const hasPinnedTabs = tabs.some(([, data]) => data.pinned);
|
|
6428
7214
|
const { ref, isOverflow } = useOverflow();
|
|
6429
|
-
const label = search.key || selectedKey;
|
|
6430
|
-
const iconNode = search.key ? /* @__PURE__ */
|
|
7215
|
+
const label = isValuesSearchSelected ? valuesSearch.index : search.key || selectedKey;
|
|
7216
|
+
const iconNode = isValuesSearchSelected ? /* @__PURE__ */ jsx57("div", { className: "flex h-[20px] w-[20px] items-center justify-center rounded-md bg-emerald-200 text-emerald-800", children: /* @__PURE__ */ jsx57(IconSearch3, { size: 14 }) }) : search.key ? /* @__PURE__ */ jsx57("div", { className: "flex h-[20px] w-[20px] items-center justify-center rounded-md bg-zinc-100 text-zinc-600", children: /* @__PURE__ */ jsx57(IconSearch3, { size: 14 }) }) : selectedKey ? /* @__PURE__ */ jsx57(TabTypeIcon, { selectedKey }) : void 0;
|
|
6431
7217
|
const tabNode = /* @__PURE__ */ jsxs34(
|
|
6432
7218
|
"div",
|
|
6433
7219
|
{
|
|
6434
7220
|
id: isList ? `list-tab-${id}` : `tab-${id}`,
|
|
6435
7221
|
onClick: () => selectTab(id),
|
|
6436
7222
|
className: cn(
|
|
6437
|
-
"flex h-
|
|
7223
|
+
"flex h-[40px] w-full cursor-pointer items-center gap-2 rounded-t-lg px-3 text-[13px] transition-colors",
|
|
6438
7224
|
isList && "max-w-[370px]",
|
|
6439
|
-
!isList && "
|
|
6440
|
-
!isList && (active ? "border-b-white bg-white text-zinc-900" : "bg-zinc-100 hover:bg-zinc-50")
|
|
7225
|
+
!isList && (active ? "bg-white text-zinc-950" : "bg-zinc-200 text-zinc-600 hover:bg-zinc-100")
|
|
6441
7226
|
),
|
|
6442
7227
|
children: [
|
|
6443
|
-
iconNode,
|
|
6444
|
-
/* @__PURE__ */
|
|
7228
|
+
/* @__PURE__ */ jsx57("div", { className: cn(!active && "transition-colors"), children: iconNode }),
|
|
7229
|
+
/* @__PURE__ */ jsx57(
|
|
6445
7230
|
"span",
|
|
6446
7231
|
{
|
|
6447
7232
|
ref,
|
|
@@ -6449,23 +7234,23 @@ var Tab = ({ id, isList }) => {
|
|
|
6449
7234
|
children: label || "New Tab"
|
|
6450
7235
|
}
|
|
6451
7236
|
),
|
|
6452
|
-
pinned && /* @__PURE__ */
|
|
6453
|
-
tabs.length > 1 && !pinned && /* @__PURE__ */
|
|
7237
|
+
pinned && /* @__PURE__ */ jsx57(IconPin, { size: 14, className: "text-zinc-500" }),
|
|
7238
|
+
tabs.length > 1 && !pinned && /* @__PURE__ */ jsx57(
|
|
6454
7239
|
"button",
|
|
6455
7240
|
{
|
|
6456
7241
|
onClick: (e) => {
|
|
6457
7242
|
e.stopPropagation();
|
|
6458
7243
|
removeTab(id);
|
|
6459
7244
|
},
|
|
6460
|
-
className: "p-
|
|
6461
|
-
children: /* @__PURE__ */
|
|
7245
|
+
className: "p-[2px] text-zinc-400 transition-colors hover:text-zinc-500",
|
|
7246
|
+
children: /* @__PURE__ */ jsx57(IconX3, { size: 16 })
|
|
6462
7247
|
}
|
|
6463
7248
|
)
|
|
6464
7249
|
]
|
|
6465
7250
|
}
|
|
6466
7251
|
);
|
|
6467
7252
|
return /* @__PURE__ */ jsxs34(ContextMenu, { children: [
|
|
6468
|
-
/* @__PURE__ */
|
|
7253
|
+
/* @__PURE__ */ jsx57(SimpleTooltip, { content: isOverflow ? label : void 0, children: /* @__PURE__ */ jsx57(ContextMenuTrigger, { asChild: true, children: tabNode }) }),
|
|
6469
7254
|
/* @__PURE__ */ jsxs34(
|
|
6470
7255
|
ContextMenuContent,
|
|
6471
7256
|
{
|
|
@@ -6474,20 +7259,20 @@ var Tab = ({ id, isList }) => {
|
|
|
6474
7259
|
},
|
|
6475
7260
|
children: [
|
|
6476
7261
|
/* @__PURE__ */ jsxs34(ContextMenuItem, { onSelect: () => togglePinTab(id), className: "gap-2", children: [
|
|
6477
|
-
/* @__PURE__ */
|
|
7262
|
+
/* @__PURE__ */ jsx57(IconPin, { size: 16 }),
|
|
6478
7263
|
pinned ? "Unpin Tab" : "Pin Tab"
|
|
6479
7264
|
] }),
|
|
6480
7265
|
/* @__PURE__ */ jsxs34(ContextMenuItem, { onSelect: () => duplicateTab(id), className: "gap-2", children: [
|
|
6481
|
-
/* @__PURE__ */
|
|
7266
|
+
/* @__PURE__ */ jsx57(IconCopyPlus, { size: 16 }),
|
|
6482
7267
|
"Duplicate Tab"
|
|
6483
7268
|
] }),
|
|
6484
|
-
/* @__PURE__ */
|
|
7269
|
+
/* @__PURE__ */ jsx57(ContextMenuSeparator, {}),
|
|
6485
7270
|
/* @__PURE__ */ jsxs34(ContextMenuItem, { onSelect: () => forceRemoveTab(id), className: "gap-2", children: [
|
|
6486
|
-
/* @__PURE__ */
|
|
7271
|
+
/* @__PURE__ */ jsx57(IconX3, { size: 16 }),
|
|
6487
7272
|
"Close Tab"
|
|
6488
7273
|
] }),
|
|
6489
7274
|
/* @__PURE__ */ jsxs34(ContextMenuItem, { onSelect: () => closeOtherTabs(id), className: "gap-2", children: [
|
|
6490
|
-
/* @__PURE__ */
|
|
7275
|
+
/* @__PURE__ */ jsx57(IconSquareX, { size: 16 }),
|
|
6491
7276
|
"Close Other Tabs"
|
|
6492
7277
|
] }),
|
|
6493
7278
|
/* @__PURE__ */ jsxs34(
|
|
@@ -6497,7 +7282,7 @@ var Tab = ({ id, isList }) => {
|
|
|
6497
7282
|
className: "gap-2",
|
|
6498
7283
|
disabled: !hasPinnedTabs,
|
|
6499
7284
|
children: [
|
|
6500
|
-
/* @__PURE__ */
|
|
7285
|
+
/* @__PURE__ */ jsx57(IconArrowsMinimize, { size: 16 }),
|
|
6501
7286
|
"Close All But Pinned"
|
|
6502
7287
|
]
|
|
6503
7288
|
}
|
|
@@ -6509,10 +7294,10 @@ var Tab = ({ id, isList }) => {
|
|
|
6509
7294
|
};
|
|
6510
7295
|
|
|
6511
7296
|
// src/components/databrowser/components/databrowser-tabs.tsx
|
|
6512
|
-
import { jsx as
|
|
7297
|
+
import { jsx as jsx58, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
6513
7298
|
var SortableTab = ({ id }) => {
|
|
6514
|
-
const [originalWidth, setOriginalWidth] =
|
|
6515
|
-
const textRef =
|
|
7299
|
+
const [originalWidth, setOriginalWidth] = useState15(null);
|
|
7300
|
+
const textRef = useRef7(null);
|
|
6516
7301
|
const { tabs } = useDatabrowserStore();
|
|
6517
7302
|
const tabData = tabs.find(([tabId]) => tabId === id)?.[1];
|
|
6518
7303
|
const isPinned = tabData?.pinned;
|
|
@@ -6536,7 +7321,7 @@ var SortableTab = ({ id }) => {
|
|
|
6536
7321
|
}
|
|
6537
7322
|
setNodeRef(element);
|
|
6538
7323
|
};
|
|
6539
|
-
|
|
7324
|
+
useEffect14(() => {
|
|
6540
7325
|
if (textRef.current && isDragging) {
|
|
6541
7326
|
const originalMaxWidth = textRef.current.style.maxWidth;
|
|
6542
7327
|
const originalWhiteSpace = textRef.current.style.whiteSpace;
|
|
@@ -6556,7 +7341,7 @@ var SortableTab = ({ id }) => {
|
|
|
6556
7341
|
};
|
|
6557
7342
|
}
|
|
6558
7343
|
}, [isDragging]);
|
|
6559
|
-
|
|
7344
|
+
useEffect14(() => {
|
|
6560
7345
|
const resizeObserver = new ResizeObserver((entries) => {
|
|
6561
7346
|
if (entries[0]) {
|
|
6562
7347
|
setOriginalWidth(entries[0].contentRect.width);
|
|
@@ -6577,7 +7362,7 @@ var SortableTab = ({ id }) => {
|
|
|
6577
7362
|
minWidth: originalWidth ? `${originalWidth}px` : void 0
|
|
6578
7363
|
} : {}
|
|
6579
7364
|
};
|
|
6580
|
-
return /* @__PURE__ */
|
|
7365
|
+
return /* @__PURE__ */ jsx58(
|
|
6581
7366
|
"div",
|
|
6582
7367
|
{
|
|
6583
7368
|
ref: measureRef,
|
|
@@ -6585,24 +7370,24 @@ var SortableTab = ({ id }) => {
|
|
|
6585
7370
|
className: isDragging ? "cursor-grabbing" : isPinned ? "cursor-default" : "cursor-grab",
|
|
6586
7371
|
...attributes,
|
|
6587
7372
|
...isPinned ? {} : listeners2,
|
|
6588
|
-
children: /* @__PURE__ */
|
|
7373
|
+
children: /* @__PURE__ */ jsx58(TabIdProvider, { value: id, children: /* @__PURE__ */ jsx58(Tab, { id }) })
|
|
6589
7374
|
}
|
|
6590
7375
|
);
|
|
6591
7376
|
};
|
|
6592
7377
|
var DatabrowserTabs = ({ onFullScreenClick }) => {
|
|
6593
7378
|
const { tabs, reorderTabs, selectedTab, selectTab } = useDatabrowserStore();
|
|
6594
|
-
const sortedTabs =
|
|
7379
|
+
const sortedTabs = useMemo9(() => {
|
|
6595
7380
|
return [...tabs].sort(([, a], [, b]) => {
|
|
6596
7381
|
if (a.pinned && !b.pinned) return -1;
|
|
6597
7382
|
if (!a.pinned && b.pinned) return 1;
|
|
6598
7383
|
return 0;
|
|
6599
7384
|
});
|
|
6600
7385
|
}, [tabs]);
|
|
6601
|
-
const scrollRef =
|
|
6602
|
-
const [hasLeftShadow, setHasLeftShadow] =
|
|
6603
|
-
const [hasRightShadow, setHasRightShadow] =
|
|
6604
|
-
const [isOverflow, setIsOverflow] =
|
|
6605
|
-
|
|
7386
|
+
const scrollRef = useRef7(null);
|
|
7387
|
+
const [hasLeftShadow, setHasLeftShadow] = useState15(false);
|
|
7388
|
+
const [hasRightShadow, setHasRightShadow] = useState15(false);
|
|
7389
|
+
const [isOverflow, setIsOverflow] = useState15(false);
|
|
7390
|
+
useEffect14(() => {
|
|
6606
7391
|
const el = scrollRef.current;
|
|
6607
7392
|
if (!el) return;
|
|
6608
7393
|
const onWheel = (event) => {
|
|
@@ -6632,7 +7417,7 @@ var DatabrowserTabs = ({ onFullScreenClick }) => {
|
|
|
6632
7417
|
setHasRightShadow(scrollLeft + clientWidth < scrollWidth - 1);
|
|
6633
7418
|
setIsOverflow(scrollWidth > clientWidth + 1);
|
|
6634
7419
|
}, []);
|
|
6635
|
-
|
|
7420
|
+
useEffect14(() => {
|
|
6636
7421
|
recomputeShadows();
|
|
6637
7422
|
const el = scrollRef.current;
|
|
6638
7423
|
if (!el) return;
|
|
@@ -6660,73 +7445,70 @@ var DatabrowserTabs = ({ onFullScreenClick }) => {
|
|
|
6660
7445
|
reorderTabs(oldIndex, newIndex);
|
|
6661
7446
|
}
|
|
6662
7447
|
};
|
|
6663
|
-
return /* @__PURE__ */
|
|
6664
|
-
/* @__PURE__ */
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
|
|
6668
|
-
"
|
|
6669
|
-
|
|
6670
|
-
|
|
6671
|
-
|
|
6672
|
-
|
|
6673
|
-
|
|
6674
|
-
"
|
|
6675
|
-
|
|
6676
|
-
|
|
6677
|
-
|
|
6678
|
-
|
|
6679
|
-
|
|
6680
|
-
|
|
6681
|
-
|
|
6682
|
-
|
|
6683
|
-
|
|
6684
|
-
|
|
6685
|
-
|
|
6686
|
-
|
|
6687
|
-
|
|
6688
|
-
|
|
6689
|
-
|
|
6690
|
-
|
|
6691
|
-
|
|
6692
|
-
|
|
6693
|
-
|
|
6694
|
-
|
|
6695
|
-
|
|
6696
|
-
|
|
6697
|
-
|
|
6698
|
-
|
|
6699
|
-
|
|
6700
|
-
|
|
6701
|
-
|
|
6702
|
-
|
|
6703
|
-
|
|
6704
|
-
|
|
6705
|
-
|
|
6706
|
-
|
|
6707
|
-
|
|
6708
|
-
|
|
6709
|
-
|
|
6710
|
-
|
|
6711
|
-
|
|
6712
|
-
|
|
6713
|
-
/* @__PURE__ */
|
|
6714
|
-
|
|
6715
|
-
|
|
6716
|
-
|
|
6717
|
-
|
|
6718
|
-
|
|
6719
|
-
|
|
6720
|
-
|
|
6721
|
-
|
|
6722
|
-
|
|
6723
|
-
|
|
6724
|
-
|
|
6725
|
-
}
|
|
6726
|
-
)
|
|
6727
|
-
] })
|
|
7448
|
+
return /* @__PURE__ */ jsx58("div", { className: "relative shrink-0 overflow-hidden rounded-t-lg bg-zinc-300", children: /* @__PURE__ */ jsxs35("div", { className: "flex items-center gap-1", children: [
|
|
7449
|
+
/* @__PURE__ */ jsxs35("div", { className: "relative min-w-0 flex-1", children: [
|
|
7450
|
+
/* @__PURE__ */ jsx58(
|
|
7451
|
+
"div",
|
|
7452
|
+
{
|
|
7453
|
+
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"}`
|
|
7454
|
+
}
|
|
7455
|
+
),
|
|
7456
|
+
/* @__PURE__ */ jsx58(
|
|
7457
|
+
"div",
|
|
7458
|
+
{
|
|
7459
|
+
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"}`
|
|
7460
|
+
}
|
|
7461
|
+
),
|
|
7462
|
+
/* @__PURE__ */ jsxs35(
|
|
7463
|
+
"div",
|
|
7464
|
+
{
|
|
7465
|
+
ref: scrollRef,
|
|
7466
|
+
onScroll: recomputeShadows,
|
|
7467
|
+
className: "scrollbar-hide flex min-w-0 flex-1 items-center gap-1 overflow-x-auto [&::-webkit-scrollbar]:hidden",
|
|
7468
|
+
children: [
|
|
7469
|
+
/* @__PURE__ */ jsx58(
|
|
7470
|
+
DndContext,
|
|
7471
|
+
{
|
|
7472
|
+
sensors,
|
|
7473
|
+
collisionDetection: closestCenter,
|
|
7474
|
+
onDragEnd: handleDragEnd,
|
|
7475
|
+
modifiers: [restrictToHorizontalAxis],
|
|
7476
|
+
measuring: {
|
|
7477
|
+
droppable: {
|
|
7478
|
+
strategy: MeasuringStrategy.Always
|
|
7479
|
+
}
|
|
7480
|
+
},
|
|
7481
|
+
children: /* @__PURE__ */ jsx58(
|
|
7482
|
+
SortableContext,
|
|
7483
|
+
{
|
|
7484
|
+
items: sortedTabs.map(([id]) => id),
|
|
7485
|
+
strategy: horizontalListSortingStrategy,
|
|
7486
|
+
children: selectedTab && sortedTabs.map(([id]) => /* @__PURE__ */ jsx58(SortableTab, { id }, id))
|
|
7487
|
+
}
|
|
7488
|
+
)
|
|
7489
|
+
}
|
|
7490
|
+
),
|
|
7491
|
+
!isOverflow && /* @__PURE__ */ jsx58("div", { className: "flex items-center gap-1 pl-1 pr-1", children: /* @__PURE__ */ jsx58(AddTabButton, {}) })
|
|
7492
|
+
]
|
|
7493
|
+
}
|
|
7494
|
+
)
|
|
7495
|
+
] }),
|
|
7496
|
+
/* @__PURE__ */ jsxs35("div", { className: "flex items-center gap-1 pl-1", children: [
|
|
7497
|
+
isOverflow && /* @__PURE__ */ jsx58(AddTabButton, {}),
|
|
7498
|
+
tabs.length > 1 && /* @__PURE__ */ jsx58(TabsListButton, { tabs, onSelectTab: selectTab }),
|
|
7499
|
+
onFullScreenClick && /* @__PURE__ */ jsx58(
|
|
7500
|
+
Button,
|
|
7501
|
+
{
|
|
7502
|
+
"aria-label": "Toggle fullscreen",
|
|
7503
|
+
variant: "secondary",
|
|
7504
|
+
size: "icon-sm",
|
|
7505
|
+
onClick: onFullScreenClick,
|
|
7506
|
+
className: "flex-shrink-0 bg-white text-zinc-500 dark:bg-zinc-100",
|
|
7507
|
+
children: /* @__PURE__ */ jsx58(IconWindowMaximize, { size: 16 })
|
|
7508
|
+
}
|
|
7509
|
+
)
|
|
6728
7510
|
] })
|
|
6729
|
-
] });
|
|
7511
|
+
] }) });
|
|
6730
7512
|
};
|
|
6731
7513
|
function AddTabButton() {
|
|
6732
7514
|
const { addTab, selectTab } = useDatabrowserStore();
|
|
@@ -6740,15 +7522,15 @@ function AddTabButton() {
|
|
|
6740
7522
|
tab.scrollIntoView({ behavior: "smooth" });
|
|
6741
7523
|
}, 20);
|
|
6742
7524
|
};
|
|
6743
|
-
return /* @__PURE__ */
|
|
7525
|
+
return /* @__PURE__ */ jsx58(
|
|
6744
7526
|
Button,
|
|
6745
7527
|
{
|
|
6746
7528
|
"aria-label": "Add new tab",
|
|
6747
7529
|
variant: "secondary",
|
|
6748
7530
|
size: "icon-sm",
|
|
6749
7531
|
onClick: handleAddTab,
|
|
6750
|
-
className: "flex-shrink-0
|
|
6751
|
-
children: /* @__PURE__ */
|
|
7532
|
+
className: "flex-shrink-0 bg-zinc-200 ",
|
|
7533
|
+
children: /* @__PURE__ */ jsx58(IconPlus3, { className: "text-zinc-600", size: 16 })
|
|
6752
7534
|
}
|
|
6753
7535
|
);
|
|
6754
7536
|
}
|
|
@@ -6756,8 +7538,8 @@ function TabsListButton({
|
|
|
6756
7538
|
tabs,
|
|
6757
7539
|
onSelectTab
|
|
6758
7540
|
}) {
|
|
6759
|
-
const [open, setOpen] =
|
|
6760
|
-
const sorted =
|
|
7541
|
+
const [open, setOpen] = useState15(false);
|
|
7542
|
+
const sorted = useMemo9(() => {
|
|
6761
7543
|
return [...tabs].sort(([, a], [, b]) => {
|
|
6762
7544
|
if (a.pinned && !b.pinned) return -1;
|
|
6763
7545
|
if (!a.pinned && b.pinned) return 1;
|
|
@@ -6775,22 +7557,22 @@ function TabsListButton({
|
|
|
6775
7557
|
}, 20);
|
|
6776
7558
|
};
|
|
6777
7559
|
return /* @__PURE__ */ jsxs35(Popover, { open, onOpenChange: setOpen, children: [
|
|
6778
|
-
/* @__PURE__ */
|
|
7560
|
+
/* @__PURE__ */ jsx58(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs35(
|
|
6779
7561
|
Button,
|
|
6780
7562
|
{
|
|
6781
7563
|
variant: "secondary",
|
|
6782
7564
|
size: "sm",
|
|
6783
|
-
className: "
|
|
7565
|
+
className: "gap-1 bg-white px-2",
|
|
6784
7566
|
"aria-label": "Search in tabs",
|
|
6785
7567
|
children: [
|
|
6786
|
-
/* @__PURE__ */
|
|
6787
|
-
/* @__PURE__ */
|
|
7568
|
+
/* @__PURE__ */ jsx58("span", { className: "text-xs text-zinc-600", children: tabs.length }),
|
|
7569
|
+
/* @__PURE__ */ jsx58(IconChevronDown2, { className: "text-zinc-500", size: 16 })
|
|
6788
7570
|
]
|
|
6789
7571
|
}
|
|
6790
7572
|
) }),
|
|
6791
|
-
/* @__PURE__ */
|
|
6792
|
-
/* @__PURE__ */
|
|
6793
|
-
/* @__PURE__ */
|
|
7573
|
+
/* @__PURE__ */ jsx58(PopoverContent, { className: "w-96 p-0", align: "end", children: /* @__PURE__ */ jsx58(Command, { children: /* @__PURE__ */ jsxs35(CommandList, { children: [
|
|
7574
|
+
/* @__PURE__ */ jsx58(CommandEmpty, { children: "No tabs" }),
|
|
7575
|
+
/* @__PURE__ */ jsx58(CommandGroup, { children: sorted.map(([_id, item]) => /* @__PURE__ */ jsx58(
|
|
6794
7576
|
CommandItem,
|
|
6795
7577
|
{
|
|
6796
7578
|
style: {
|
|
@@ -6800,7 +7582,7 @@ function TabsListButton({
|
|
|
6800
7582
|
onSelect: () => {
|
|
6801
7583
|
handleSelectTab(item.id);
|
|
6802
7584
|
},
|
|
6803
|
-
children: /* @__PURE__ */
|
|
7585
|
+
children: /* @__PURE__ */ jsx58(TabIdProvider, { value: _id, children: /* @__PURE__ */ jsx58(Tab, { id: _id, isList: true }) })
|
|
6804
7586
|
},
|
|
6805
7587
|
item.id
|
|
6806
7588
|
)) })
|
|
@@ -6809,7 +7591,7 @@ function TabsListButton({
|
|
|
6809
7591
|
}
|
|
6810
7592
|
|
|
6811
7593
|
// src/components/databrowser/index.tsx
|
|
6812
|
-
import { jsx as
|
|
7594
|
+
import { jsx as jsx59, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
6813
7595
|
var RedisBrowser = ({
|
|
6814
7596
|
url,
|
|
6815
7597
|
token,
|
|
@@ -6819,12 +7601,12 @@ var RedisBrowser = ({
|
|
|
6819
7601
|
onFullScreenClick,
|
|
6820
7602
|
theme = "light"
|
|
6821
7603
|
}) => {
|
|
6822
|
-
const credentials =
|
|
6823
|
-
const rootRef =
|
|
6824
|
-
|
|
7604
|
+
const credentials = useMemo10(() => ({ token, url }), [token, url]);
|
|
7605
|
+
const rootRef = useRef8(null);
|
|
7606
|
+
useEffect15(() => {
|
|
6825
7607
|
queryClient.resetQueries();
|
|
6826
7608
|
}, [credentials.url]);
|
|
6827
|
-
return /* @__PURE__ */
|
|
7609
|
+
return /* @__PURE__ */ jsx59(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx59(RedisProvider, { redisCredentials: credentials, telemetry: !disableTelemetry, children: /* @__PURE__ */ jsx59(DarkModeProvider, { theme, children: /* @__PURE__ */ jsx59(DatabrowserProvider, { storage, rootRef, children: /* @__PURE__ */ jsx59(TooltipProvider, { children: /* @__PURE__ */ jsx59(
|
|
6828
7610
|
RedisBrowserRoot,
|
|
6829
7611
|
{
|
|
6830
7612
|
hideTabs,
|
|
@@ -6839,21 +7621,21 @@ var RedisBrowserRoot = ({
|
|
|
6839
7621
|
onFullScreenClick
|
|
6840
7622
|
}) => {
|
|
6841
7623
|
const theme = useTheme();
|
|
6842
|
-
|
|
7624
|
+
useEffect15(() => {
|
|
6843
7625
|
portalWrapper.classList.add("text-zinc-700");
|
|
6844
7626
|
portalWrapper.classList.toggle("dark", theme === "dark");
|
|
6845
7627
|
}, [theme]);
|
|
6846
7628
|
return (
|
|
6847
7629
|
/* ups-db is the custom class used to prefix every style in the css bundle */
|
|
6848
|
-
/* @__PURE__ */
|
|
7630
|
+
/* @__PURE__ */ jsx59(
|
|
6849
7631
|
"div",
|
|
6850
7632
|
{
|
|
6851
7633
|
className: `ups-db ${theme === "dark" ? "dark" : ""}`,
|
|
6852
7634
|
style: { height: "100%" },
|
|
6853
7635
|
ref: rootRef,
|
|
6854
|
-
children: /* @__PURE__ */ jsxs36("div", { className: "flex h-full flex-col text-zinc-700", children: [
|
|
6855
|
-
!hideTabs && /* @__PURE__ */
|
|
6856
|
-
/* @__PURE__ */
|
|
7636
|
+
children: /* @__PURE__ */ jsxs36("div", { className: "flex h-full flex-col overflow-hidden rounded-[14px] border-[4px] border-zinc-300 text-zinc-700", children: [
|
|
7637
|
+
!hideTabs && /* @__PURE__ */ jsx59(DatabrowserTabs, { onFullScreenClick }),
|
|
7638
|
+
/* @__PURE__ */ jsx59(DatabrowserInstances, {})
|
|
6857
7639
|
] })
|
|
6858
7640
|
}
|
|
6859
7641
|
)
|
|
@@ -6861,12 +7643,12 @@ var RedisBrowserRoot = ({
|
|
|
6861
7643
|
};
|
|
6862
7644
|
var DatabrowserInstances = () => {
|
|
6863
7645
|
const { tabs, selectedTab, selectTab, addTab } = useDatabrowserStore();
|
|
6864
|
-
|
|
7646
|
+
useEffect15(() => {
|
|
6865
7647
|
if (tabs.length === 0) addTab();
|
|
6866
7648
|
else if (!selectedTab) selectTab(tabs[0][0]);
|
|
6867
7649
|
}, [tabs, selectedTab, addTab, selectTab]);
|
|
6868
7650
|
if (!selectedTab) return;
|
|
6869
|
-
return tabs.map(([id]) => /* @__PURE__ */
|
|
7651
|
+
return tabs.map(([id]) => /* @__PURE__ */ jsx59(TabIdProvider, { value: id, children: /* @__PURE__ */ jsx59(DatabrowserInstance, { hidden: id !== selectedTab }) }, id));
|
|
6870
7652
|
};
|
|
6871
7653
|
export {
|
|
6872
7654
|
RedisBrowser
|