@upstash/react-redis-browser 0.1.10 → 0.1.11-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 +116 -26
- package/dist/index.js +500 -231
- package/dist/index.mjs +767 -498
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,97 @@
|
|
|
1
1
|
// src/components/databrowser/index.tsx
|
|
2
|
-
import { useEffect as
|
|
2
|
+
import { useEffect as useEffect11, useMemo as useMemo8 } from "react";
|
|
3
3
|
|
|
4
4
|
// src/store.tsx
|
|
5
|
-
import { createContext, useContext, useMemo
|
|
5
|
+
import { createContext, useContext, useMemo } from "react";
|
|
6
6
|
import { create, useStore } from "zustand";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
var DatabrowserContext = createContext(void 0);
|
|
9
|
+
var DatabrowserProvider = ({ children }) => {
|
|
10
|
+
const store = useMemo(() => createDatabrowserStore(), []);
|
|
11
|
+
return /* @__PURE__ */ jsx(DatabrowserContext.Provider, { value: { store }, children });
|
|
12
|
+
};
|
|
13
|
+
var useDatabrowser = () => {
|
|
14
|
+
const context = useContext(DatabrowserContext);
|
|
15
|
+
if (!context) {
|
|
16
|
+
throw new Error("useDatabrowser must be used within a DatabrowserProvider");
|
|
17
|
+
}
|
|
18
|
+
return context;
|
|
19
|
+
};
|
|
20
|
+
var useDatabrowserStore = () => {
|
|
21
|
+
const { store } = useDatabrowser();
|
|
22
|
+
return useStore(store);
|
|
23
|
+
};
|
|
24
|
+
var createDatabrowserStore = () => create((set, get) => ({
|
|
25
|
+
selectedTab: void 0,
|
|
26
|
+
tabs: {},
|
|
27
|
+
addTab: () => {
|
|
28
|
+
const id = crypto.randomUUID();
|
|
29
|
+
const newTabData = {
|
|
30
|
+
selectedKey: void 0,
|
|
31
|
+
search: { key: "", type: void 0 }
|
|
32
|
+
};
|
|
33
|
+
set((old) => ({
|
|
34
|
+
tabs: { ...old.tabs, [id]: newTabData },
|
|
35
|
+
selectedTab: old.selectedTab === void 0 ? id : old.selectedTab
|
|
36
|
+
}));
|
|
37
|
+
},
|
|
38
|
+
removeTab: (id) => {
|
|
39
|
+
set((old) => {
|
|
40
|
+
const newTabs = { ...old.tabs };
|
|
41
|
+
delete newTabs[id];
|
|
42
|
+
let selectedTab = old.selectedTab;
|
|
43
|
+
if (selectedTab === id) {
|
|
44
|
+
const tabIds = Object.keys(newTabs);
|
|
45
|
+
selectedTab = tabIds.length > 0 ? tabIds[0] : void 0;
|
|
46
|
+
}
|
|
47
|
+
return { tabs: newTabs, selectedTab };
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
selectTab: (id) => {
|
|
51
|
+
set({ selectedTab: id });
|
|
52
|
+
},
|
|
53
|
+
getSelectedKey: (tabId) => {
|
|
54
|
+
return get().tabs[tabId]?.selectedKey;
|
|
55
|
+
},
|
|
56
|
+
setSelectedKey: (tabId, key) => {
|
|
57
|
+
set((old) => ({
|
|
58
|
+
...old,
|
|
59
|
+
tabs: {
|
|
60
|
+
...old.tabs,
|
|
61
|
+
[tabId]: { ...old.tabs[tabId], selectedKey: key, selectedListItem: void 0 }
|
|
62
|
+
}
|
|
63
|
+
}));
|
|
64
|
+
},
|
|
65
|
+
setSelectedListItem: (tabId, item) => {
|
|
66
|
+
set((old) => ({
|
|
67
|
+
...old,
|
|
68
|
+
tabs: { ...old.tabs, [tabId]: { ...old.tabs[tabId], selectedListItem: item } }
|
|
69
|
+
}));
|
|
70
|
+
},
|
|
71
|
+
setSearch: (tabId, search) => set((old) => ({ ...old, tabs: { ...old.tabs, [tabId]: { ...old.tabs[tabId], search } } })),
|
|
72
|
+
setSearchKey: (tabId, key) => set((old) => ({
|
|
73
|
+
...old,
|
|
74
|
+
tabs: {
|
|
75
|
+
...old.tabs,
|
|
76
|
+
[tabId]: { ...old.tabs[tabId], search: { ...old.tabs[tabId].search, key } }
|
|
77
|
+
}
|
|
78
|
+
})),
|
|
79
|
+
setSearchType: (tabId, type) => set((old) => ({
|
|
80
|
+
...old,
|
|
81
|
+
tabs: {
|
|
82
|
+
...old.tabs,
|
|
83
|
+
[tabId]: { ...old.tabs[tabId], search: { ...old.tabs[tabId].search, type } }
|
|
84
|
+
}
|
|
85
|
+
})),
|
|
86
|
+
searchHistory: [],
|
|
87
|
+
addSearchHistory: (key) => {
|
|
88
|
+
set((old) => ({ ...old, searchHistory: [key, ...old.searchHistory] }));
|
|
89
|
+
}
|
|
90
|
+
}));
|
|
91
|
+
|
|
92
|
+
// src/components/databrowser/index.tsx
|
|
93
|
+
import { TooltipProvider } from "@radix-ui/react-tooltip";
|
|
94
|
+
import { QueryClientProvider } from "@tanstack/react-query";
|
|
7
95
|
|
|
8
96
|
// src/lib/clients.ts
|
|
9
97
|
import { MutationCache, QueryCache, QueryClient } from "@tanstack/react-query";
|
|
@@ -180,140 +268,53 @@ var queryClient = new QueryClient({
|
|
|
180
268
|
})
|
|
181
269
|
});
|
|
182
270
|
|
|
183
|
-
// src/
|
|
184
|
-
import {
|
|
185
|
-
|
|
186
|
-
var
|
|
271
|
+
// src/redis-context.tsx
|
|
272
|
+
import { createContext as createContext2, useContext as useContext2, useMemo as useMemo2 } from "react";
|
|
273
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
274
|
+
var RedisContext = createContext2(void 0);
|
|
275
|
+
var RedisProvider = ({
|
|
187
276
|
children,
|
|
188
277
|
redisCredentials
|
|
189
278
|
}) => {
|
|
190
|
-
const redisInstance =
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
279
|
+
const redisInstance = useMemo2(
|
|
280
|
+
() => redisClient({ credentials: redisCredentials, pipelining: true }),
|
|
281
|
+
[redisCredentials]
|
|
282
|
+
);
|
|
283
|
+
const redisInstanceNoPipeline = useMemo2(
|
|
284
|
+
() => redisClient({ credentials: redisCredentials, pipelining: false }),
|
|
285
|
+
[redisCredentials]
|
|
286
|
+
);
|
|
287
|
+
return /* @__PURE__ */ jsx2(
|
|
288
|
+
RedisContext.Provider,
|
|
289
|
+
{
|
|
290
|
+
value: { redis: redisInstance, redisNoPipeline: redisInstanceNoPipeline },
|
|
291
|
+
children
|
|
292
|
+
}
|
|
293
|
+
);
|
|
196
294
|
};
|
|
197
|
-
var
|
|
198
|
-
const context =
|
|
295
|
+
var useRedis = () => {
|
|
296
|
+
const context = useContext2(RedisContext);
|
|
199
297
|
if (!context) {
|
|
200
|
-
throw new Error("
|
|
298
|
+
throw new Error("useRedis must be used within a RedisProvider");
|
|
201
299
|
}
|
|
202
300
|
return context;
|
|
203
301
|
};
|
|
204
|
-
var useDatabrowserStore = () => {
|
|
205
|
-
const { store } = useDatabrowser();
|
|
206
|
-
return useStore(store);
|
|
207
|
-
};
|
|
208
|
-
var createDatabrowserStore = () => create((set) => ({
|
|
209
|
-
selectedKey: void 0,
|
|
210
|
-
setSelectedKey: (key) => {
|
|
211
|
-
set((old) => ({ ...old, selectedKey: key, selectedListItem: void 0 }));
|
|
212
|
-
},
|
|
213
|
-
selectedListItem: void 0,
|
|
214
|
-
setSelectedListItem: (item) => {
|
|
215
|
-
set((old) => ({ ...old, selectedListItem: item }));
|
|
216
|
-
},
|
|
217
|
-
search: { key: "", type: void 0 },
|
|
218
|
-
setSearch: (search) => set({ search }),
|
|
219
|
-
setSearchKey: (key) => set((state) => ({ search: { ...state.search, key } })),
|
|
220
|
-
setSearchType: (type) => set((state) => ({ search: { ...state.search, type } }))
|
|
221
|
-
}));
|
|
222
302
|
|
|
223
|
-
// src/components/databrowser/
|
|
224
|
-
import { TooltipProvider } from "@radix-ui/react-tooltip";
|
|
225
|
-
import { IconDotsVertical as IconDotsVertical2 } from "@tabler/icons-react";
|
|
226
|
-
import { QueryClientProvider } from "@tanstack/react-query";
|
|
303
|
+
// src/components/databrowser/components/databrowser-instance.tsx
|
|
227
304
|
import { Panel, PanelGroup, PanelResizeHandle } from "react-resizable-panels";
|
|
228
305
|
|
|
229
|
-
// src/components/ui/toaster.tsx
|
|
230
|
-
import { Portal } from "@radix-ui/react-portal";
|
|
231
|
-
|
|
232
|
-
// src/lib/portal-root.ts
|
|
233
|
-
var root;
|
|
234
|
-
if (typeof document !== "undefined") {
|
|
235
|
-
const id = "react-redis-browser-portal-root";
|
|
236
|
-
root = document.querySelector(`#${id}`) ?? document.createElement("div");
|
|
237
|
-
root.classList.add("ups-db");
|
|
238
|
-
root.id = "react-redis-browser-portal-root";
|
|
239
|
-
document.body.append(root);
|
|
240
|
-
}
|
|
241
|
-
var portalRoot = root;
|
|
242
|
-
|
|
243
|
-
// src/components/ui/toast.tsx
|
|
244
|
-
import * as React2 from "react";
|
|
245
|
-
import { Cross2Icon } from "@radix-ui/react-icons";
|
|
246
|
-
import * as ToastPrimitives from "@radix-ui/react-toast";
|
|
247
|
-
|
|
248
|
-
// node_modules/class-variance-authority/node_modules/clsx/dist/clsx.mjs
|
|
249
|
-
function r(e) {
|
|
250
|
-
var t, f, n = "";
|
|
251
|
-
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
252
|
-
else if ("object" == typeof e) if (Array.isArray(e)) for (t = 0; t < e.length; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
253
|
-
else for (t in e) e[t] && (n && (n += " "), n += t);
|
|
254
|
-
return n;
|
|
255
|
-
}
|
|
256
|
-
function clsx() {
|
|
257
|
-
for (var e, t, f = 0, n = ""; f < arguments.length; ) (e = arguments[f++]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
258
|
-
return n;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
// node_modules/class-variance-authority/dist/index.mjs
|
|
262
|
-
var falsyToString = (value) => typeof value === "boolean" ? "".concat(value) : value === 0 ? "0" : value;
|
|
263
|
-
var cx = clsx;
|
|
264
|
-
var cva = (base, config) => {
|
|
265
|
-
return (props) => {
|
|
266
|
-
var ref;
|
|
267
|
-
if ((config === null || config === void 0 ? void 0 : config.variants) == null) return cx(base, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
|
|
268
|
-
const { variants, defaultVariants } = config;
|
|
269
|
-
const getVariantClassNames = Object.keys(variants).map((variant) => {
|
|
270
|
-
const variantProp = props === null || props === void 0 ? void 0 : props[variant];
|
|
271
|
-
const defaultVariantProp = defaultVariants === null || defaultVariants === void 0 ? void 0 : defaultVariants[variant];
|
|
272
|
-
if (variantProp === null) return null;
|
|
273
|
-
const variantKey = falsyToString(variantProp) || falsyToString(defaultVariantProp);
|
|
274
|
-
return variants[variant][variantKey];
|
|
275
|
-
});
|
|
276
|
-
const propsWithoutUndefined = props && Object.entries(props).reduce((acc, param) => {
|
|
277
|
-
let [key, value] = param;
|
|
278
|
-
if (value === void 0) {
|
|
279
|
-
return acc;
|
|
280
|
-
}
|
|
281
|
-
acc[key] = value;
|
|
282
|
-
return acc;
|
|
283
|
-
}, {});
|
|
284
|
-
const getCompoundVariantClassNames = config === null || config === void 0 ? void 0 : (ref = config.compoundVariants) === null || ref === void 0 ? void 0 : ref.reduce((acc, param1) => {
|
|
285
|
-
let { class: cvClass, className: cvClassName, ...compoundVariantOptions } = param1;
|
|
286
|
-
return Object.entries(compoundVariantOptions).every((param) => {
|
|
287
|
-
let [key, value] = param;
|
|
288
|
-
return Array.isArray(value) ? value.includes({
|
|
289
|
-
...defaultVariants,
|
|
290
|
-
...propsWithoutUndefined
|
|
291
|
-
}[key]) : {
|
|
292
|
-
...defaultVariants,
|
|
293
|
-
...propsWithoutUndefined
|
|
294
|
-
}[key] === value;
|
|
295
|
-
}) ? [
|
|
296
|
-
...acc,
|
|
297
|
-
cvClass,
|
|
298
|
-
cvClassName
|
|
299
|
-
] : acc;
|
|
300
|
-
}, []);
|
|
301
|
-
return cx(base, getVariantClassNames, getCompoundVariantClassNames, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
|
|
302
|
-
};
|
|
303
|
-
};
|
|
304
|
-
|
|
305
306
|
// node_modules/clsx/dist/clsx.mjs
|
|
306
|
-
function
|
|
307
|
+
function r(e) {
|
|
307
308
|
var t, f, n = "";
|
|
308
309
|
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
309
310
|
else if ("object" == typeof e) if (Array.isArray(e)) {
|
|
310
311
|
var o = e.length;
|
|
311
|
-
for (t = 0; t < o; t++) e[t] && (f =
|
|
312
|
+
for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
312
313
|
} else for (f in e) e[f] && (n && (n += " "), n += f);
|
|
313
314
|
return n;
|
|
314
315
|
}
|
|
315
|
-
function
|
|
316
|
-
for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t =
|
|
316
|
+
function clsx() {
|
|
317
|
+
for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
317
318
|
return n;
|
|
318
319
|
}
|
|
319
320
|
|
|
@@ -2779,7 +2780,7 @@ var twMerge = /* @__PURE__ */ createTailwindMerge(getDefaultConfig);
|
|
|
2779
2780
|
|
|
2780
2781
|
// src/lib/utils.ts
|
|
2781
2782
|
function cn(...inputs) {
|
|
2782
|
-
return twMerge(
|
|
2783
|
+
return twMerge(clsx(inputs));
|
|
2783
2784
|
}
|
|
2784
2785
|
function formatNumber(value) {
|
|
2785
2786
|
const intl = new Intl.NumberFormat("en-US");
|
|
@@ -2811,10 +2812,86 @@ function formatTime(seconds) {
|
|
|
2811
2812
|
return parts.slice(0, 1).join(" ");
|
|
2812
2813
|
}
|
|
2813
2814
|
|
|
2815
|
+
// src/components/ui/toaster.tsx
|
|
2816
|
+
import { Portal } from "@radix-ui/react-portal";
|
|
2817
|
+
|
|
2818
|
+
// src/lib/portal-root.ts
|
|
2819
|
+
var root;
|
|
2820
|
+
if (typeof document !== "undefined") {
|
|
2821
|
+
const id = "react-redis-browser-portal-root";
|
|
2822
|
+
root = document.querySelector(`#${id}`) ?? document.createElement("div");
|
|
2823
|
+
root.classList.add("ups-db");
|
|
2824
|
+
root.id = "react-redis-browser-portal-root";
|
|
2825
|
+
document.body.append(root);
|
|
2826
|
+
}
|
|
2827
|
+
var portalRoot = root;
|
|
2828
|
+
|
|
2814
2829
|
// src/components/ui/toast.tsx
|
|
2815
|
-
import
|
|
2830
|
+
import * as React2 from "react";
|
|
2831
|
+
import { Cross2Icon } from "@radix-ui/react-icons";
|
|
2832
|
+
import * as ToastPrimitives from "@radix-ui/react-toast";
|
|
2833
|
+
|
|
2834
|
+
// node_modules/class-variance-authority/node_modules/clsx/dist/clsx.mjs
|
|
2835
|
+
function r2(e) {
|
|
2836
|
+
var t, f, n = "";
|
|
2837
|
+
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
2838
|
+
else if ("object" == typeof e) if (Array.isArray(e)) for (t = 0; t < e.length; t++) e[t] && (f = r2(e[t])) && (n && (n += " "), n += f);
|
|
2839
|
+
else for (t in e) e[t] && (n && (n += " "), n += t);
|
|
2840
|
+
return n;
|
|
2841
|
+
}
|
|
2842
|
+
function clsx2() {
|
|
2843
|
+
for (var e, t, f = 0, n = ""; f < arguments.length; ) (e = arguments[f++]) && (t = r2(e)) && (n && (n += " "), n += t);
|
|
2844
|
+
return n;
|
|
2845
|
+
}
|
|
2846
|
+
|
|
2847
|
+
// node_modules/class-variance-authority/dist/index.mjs
|
|
2848
|
+
var falsyToString = (value) => typeof value === "boolean" ? "".concat(value) : value === 0 ? "0" : value;
|
|
2849
|
+
var cx = clsx2;
|
|
2850
|
+
var cva = (base, config) => {
|
|
2851
|
+
return (props) => {
|
|
2852
|
+
var ref;
|
|
2853
|
+
if ((config === null || config === void 0 ? void 0 : config.variants) == null) return cx(base, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
|
|
2854
|
+
const { variants, defaultVariants } = config;
|
|
2855
|
+
const getVariantClassNames = Object.keys(variants).map((variant) => {
|
|
2856
|
+
const variantProp = props === null || props === void 0 ? void 0 : props[variant];
|
|
2857
|
+
const defaultVariantProp = defaultVariants === null || defaultVariants === void 0 ? void 0 : defaultVariants[variant];
|
|
2858
|
+
if (variantProp === null) return null;
|
|
2859
|
+
const variantKey = falsyToString(variantProp) || falsyToString(defaultVariantProp);
|
|
2860
|
+
return variants[variant][variantKey];
|
|
2861
|
+
});
|
|
2862
|
+
const propsWithoutUndefined = props && Object.entries(props).reduce((acc, param) => {
|
|
2863
|
+
let [key, value] = param;
|
|
2864
|
+
if (value === void 0) {
|
|
2865
|
+
return acc;
|
|
2866
|
+
}
|
|
2867
|
+
acc[key] = value;
|
|
2868
|
+
return acc;
|
|
2869
|
+
}, {});
|
|
2870
|
+
const getCompoundVariantClassNames = config === null || config === void 0 ? void 0 : (ref = config.compoundVariants) === null || ref === void 0 ? void 0 : ref.reduce((acc, param1) => {
|
|
2871
|
+
let { class: cvClass, className: cvClassName, ...compoundVariantOptions } = param1;
|
|
2872
|
+
return Object.entries(compoundVariantOptions).every((param) => {
|
|
2873
|
+
let [key, value] = param;
|
|
2874
|
+
return Array.isArray(value) ? value.includes({
|
|
2875
|
+
...defaultVariants,
|
|
2876
|
+
...propsWithoutUndefined
|
|
2877
|
+
}[key]) : {
|
|
2878
|
+
...defaultVariants,
|
|
2879
|
+
...propsWithoutUndefined
|
|
2880
|
+
}[key] === value;
|
|
2881
|
+
}) ? [
|
|
2882
|
+
...acc,
|
|
2883
|
+
cvClass,
|
|
2884
|
+
cvClassName
|
|
2885
|
+
] : acc;
|
|
2886
|
+
}, []);
|
|
2887
|
+
return cx(base, getVariantClassNames, getCompoundVariantClassNames, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
|
|
2888
|
+
};
|
|
2889
|
+
};
|
|
2890
|
+
|
|
2891
|
+
// src/components/ui/toast.tsx
|
|
2892
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
2816
2893
|
var ToastProvider = ToastPrimitives.Provider;
|
|
2817
|
-
var ToastViewport = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
2894
|
+
var ToastViewport = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
|
|
2818
2895
|
ToastPrimitives.Viewport,
|
|
2819
2896
|
{
|
|
2820
2897
|
ref,
|
|
@@ -2841,7 +2918,7 @@ var toastVariants = cva(
|
|
|
2841
2918
|
}
|
|
2842
2919
|
);
|
|
2843
2920
|
var Toast = React2.forwardRef(({ className, variant, ...props }, ref) => {
|
|
2844
|
-
return /* @__PURE__ */
|
|
2921
|
+
return /* @__PURE__ */ jsx3(
|
|
2845
2922
|
ToastPrimitives.Root,
|
|
2846
2923
|
{
|
|
2847
2924
|
ref,
|
|
@@ -2851,7 +2928,7 @@ var Toast = React2.forwardRef(({ className, variant, ...props }, ref) => {
|
|
|
2851
2928
|
);
|
|
2852
2929
|
});
|
|
2853
2930
|
Toast.displayName = ToastPrimitives.Root.displayName;
|
|
2854
|
-
var ToastAction = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
2931
|
+
var ToastAction = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
|
|
2855
2932
|
ToastPrimitives.Action,
|
|
2856
2933
|
{
|
|
2857
2934
|
ref,
|
|
@@ -2863,7 +2940,7 @@ var ToastAction = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
2863
2940
|
}
|
|
2864
2941
|
));
|
|
2865
2942
|
ToastAction.displayName = ToastPrimitives.Action.displayName;
|
|
2866
|
-
var ToastClose = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
2943
|
+
var ToastClose = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
|
|
2867
2944
|
ToastPrimitives.Close,
|
|
2868
2945
|
{
|
|
2869
2946
|
ref,
|
|
@@ -2873,11 +2950,11 @@ var ToastClose = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE_
|
|
|
2873
2950
|
),
|
|
2874
2951
|
"toast-close": "",
|
|
2875
2952
|
...props,
|
|
2876
|
-
children: /* @__PURE__ */
|
|
2953
|
+
children: /* @__PURE__ */ jsx3(Cross2Icon, { className: "size-4" })
|
|
2877
2954
|
}
|
|
2878
2955
|
));
|
|
2879
2956
|
ToastClose.displayName = ToastPrimitives.Close.displayName;
|
|
2880
|
-
var ToastTitle = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
2957
|
+
var ToastTitle = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
|
|
2881
2958
|
ToastPrimitives.Title,
|
|
2882
2959
|
{
|
|
2883
2960
|
ref,
|
|
@@ -2886,7 +2963,7 @@ var ToastTitle = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE_
|
|
|
2886
2963
|
}
|
|
2887
2964
|
));
|
|
2888
2965
|
ToastTitle.displayName = ToastPrimitives.Title.displayName;
|
|
2889
|
-
var ToastDescription = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
2966
|
+
var ToastDescription = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
|
|
2890
2967
|
ToastPrimitives.Description,
|
|
2891
2968
|
{
|
|
2892
2969
|
ref,
|
|
@@ -2897,32 +2974,81 @@ var ToastDescription = React2.forwardRef(({ className, ...props }, ref) => /* @_
|
|
|
2897
2974
|
ToastDescription.displayName = ToastPrimitives.Description.displayName;
|
|
2898
2975
|
|
|
2899
2976
|
// src/components/ui/toaster.tsx
|
|
2900
|
-
import { jsx as
|
|
2977
|
+
import { jsx as jsx4, jsxs } from "react/jsx-runtime";
|
|
2901
2978
|
function Toaster() {
|
|
2902
2979
|
const { toasts } = useToast();
|
|
2903
|
-
return /* @__PURE__ */
|
|
2980
|
+
return /* @__PURE__ */ jsx4(Portal, { container: portalRoot, children: /* @__PURE__ */ jsxs(ToastProvider, { children: [
|
|
2904
2981
|
toasts.map(({ id, title, description, action, ...props }) => /* @__PURE__ */ jsxs(Toast, { ...props, children: [
|
|
2905
2982
|
/* @__PURE__ */ jsxs("div", { className: "grid gap-1", children: [
|
|
2906
|
-
title && /* @__PURE__ */
|
|
2907
|
-
description && /* @__PURE__ */
|
|
2983
|
+
title && /* @__PURE__ */ jsx4(ToastTitle, { children: title }),
|
|
2984
|
+
description && /* @__PURE__ */ jsx4(ToastDescription, { children: description })
|
|
2908
2985
|
] }),
|
|
2909
2986
|
action,
|
|
2910
|
-
/* @__PURE__ */
|
|
2987
|
+
/* @__PURE__ */ jsx4(ToastClose, {})
|
|
2911
2988
|
] }, id)),
|
|
2912
|
-
/* @__PURE__ */
|
|
2989
|
+
/* @__PURE__ */ jsx4(ToastViewport, {})
|
|
2913
2990
|
] }) });
|
|
2914
2991
|
}
|
|
2915
2992
|
|
|
2916
2993
|
// src/components/databrowser/hooks/use-keys.tsx
|
|
2917
|
-
import { createContext as
|
|
2994
|
+
import { createContext as createContext4, useContext as useContext4, useMemo as useMemo4 } from "react";
|
|
2918
2995
|
import { useInfiniteQuery } from "@tanstack/react-query";
|
|
2919
|
-
|
|
2920
|
-
|
|
2996
|
+
|
|
2997
|
+
// src/tab-provider.tsx
|
|
2998
|
+
import { createContext as createContext3, useContext as useContext3, useMemo as useMemo3 } from "react";
|
|
2999
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
3000
|
+
var TabIdContext = createContext3(void 0);
|
|
3001
|
+
var TabIdProvider = ({ children, value }) => {
|
|
3002
|
+
return /* @__PURE__ */ jsx5(TabIdContext.Provider, { value, children });
|
|
3003
|
+
};
|
|
3004
|
+
var useTab = () => {
|
|
3005
|
+
const {
|
|
3006
|
+
selectedTab,
|
|
3007
|
+
tabs,
|
|
3008
|
+
setSelectedKey,
|
|
3009
|
+
setSelectedListItem,
|
|
3010
|
+
setSearch,
|
|
3011
|
+
setSearchKey,
|
|
3012
|
+
setSearchType
|
|
3013
|
+
} = useDatabrowserStore();
|
|
3014
|
+
if (!selectedTab) throw new Error("selectedTab is undefined when using useTab()");
|
|
3015
|
+
return useMemo3(
|
|
3016
|
+
() => ({
|
|
3017
|
+
selectedKey: tabs[selectedTab]?.selectedKey,
|
|
3018
|
+
selectedListItem: tabs[selectedTab]?.selectedListItem,
|
|
3019
|
+
search: tabs[selectedTab]?.search,
|
|
3020
|
+
setSelectedKey: (key) => setSelectedKey(selectedTab, key),
|
|
3021
|
+
setSelectedListItem: (item) => setSelectedListItem(selectedTab, item),
|
|
3022
|
+
setSearch: (search) => setSearch(selectedTab, search),
|
|
3023
|
+
setSearchKey: (key) => setSearchKey(selectedTab, key),
|
|
3024
|
+
setSearchType: (type) => setSearchType(selectedTab, type)
|
|
3025
|
+
}),
|
|
3026
|
+
[selectedTab, tabs]
|
|
3027
|
+
);
|
|
3028
|
+
};
|
|
3029
|
+
|
|
3030
|
+
// src/components/databrowser/hooks/use-fetch-key-type.ts
|
|
3031
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3032
|
+
var FETCH_KEY_TYPE_QUERY_KEY = "fetch-key-type";
|
|
3033
|
+
var useFetchKeyType = (key) => {
|
|
3034
|
+
const { redis } = useRedis();
|
|
3035
|
+
return useQuery({
|
|
3036
|
+
queryKey: [FETCH_KEY_TYPE_QUERY_KEY, key],
|
|
3037
|
+
queryFn: async () => {
|
|
3038
|
+
if (!key) return "none";
|
|
3039
|
+
return await redis.type(key);
|
|
3040
|
+
}
|
|
3041
|
+
});
|
|
3042
|
+
};
|
|
3043
|
+
|
|
3044
|
+
// src/components/databrowser/hooks/use-keys.tsx
|
|
3045
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
3046
|
+
var KeysContext = createContext4(void 0);
|
|
2921
3047
|
var FETCH_KEYS_QUERY_KEY = "use-fetch-keys";
|
|
2922
3048
|
var SCAN_COUNT = 100;
|
|
2923
3049
|
var KeysProvider = ({ children }) => {
|
|
2924
|
-
const { search } =
|
|
2925
|
-
const { redisNoPipeline: redis } =
|
|
3050
|
+
const { search } = useTab();
|
|
3051
|
+
const { redisNoPipeline: redis } = useRedis();
|
|
2926
3052
|
const query = useInfiniteQuery({
|
|
2927
3053
|
queryKey: [FETCH_KEYS_QUERY_KEY, search],
|
|
2928
3054
|
initialPageParam: "0",
|
|
@@ -2950,6 +3076,9 @@ var KeysProvider = ({ children }) => {
|
|
|
2950
3076
|
index += 2;
|
|
2951
3077
|
}
|
|
2952
3078
|
}
|
|
3079
|
+
for (const [key, type] of keys2) {
|
|
3080
|
+
queryClient.setQueryData([FETCH_KEY_TYPE_QUERY_KEY, key], type);
|
|
3081
|
+
}
|
|
2953
3082
|
return {
|
|
2954
3083
|
cursor: cursor === "0" ? void 0 : cursor,
|
|
2955
3084
|
keys: keys2,
|
|
@@ -2960,7 +3089,7 @@ var KeysProvider = ({ children }) => {
|
|
|
2960
3089
|
getNextPageParam: ({ cursor }) => cursor,
|
|
2961
3090
|
refetchOnMount: false
|
|
2962
3091
|
});
|
|
2963
|
-
const keys =
|
|
3092
|
+
const keys = useMemo4(() => {
|
|
2964
3093
|
const keys2 = query.data?.pages.flatMap((page) => page.keys) ?? [];
|
|
2965
3094
|
const keysSet = /* @__PURE__ */ new Set();
|
|
2966
3095
|
const dedupedKeys = [];
|
|
@@ -2971,7 +3100,7 @@ var KeysProvider = ({ children }) => {
|
|
|
2971
3100
|
}
|
|
2972
3101
|
return dedupedKeys;
|
|
2973
3102
|
}, [query.data]);
|
|
2974
|
-
return /* @__PURE__ */
|
|
3103
|
+
return /* @__PURE__ */ jsx6(
|
|
2975
3104
|
KeysContext.Provider,
|
|
2976
3105
|
{
|
|
2977
3106
|
value: {
|
|
@@ -2983,7 +3112,7 @@ var KeysProvider = ({ children }) => {
|
|
|
2983
3112
|
);
|
|
2984
3113
|
};
|
|
2985
3114
|
var useKeys = () => {
|
|
2986
|
-
const context =
|
|
3115
|
+
const context = useContext4(KeysContext);
|
|
2987
3116
|
if (!context) {
|
|
2988
3117
|
throw new Error("useKeys must be used within a KeysProvider");
|
|
2989
3118
|
}
|
|
@@ -2991,20 +3120,20 @@ var useKeys = () => {
|
|
|
2991
3120
|
};
|
|
2992
3121
|
var useKeyType = (key) => {
|
|
2993
3122
|
const { keys } = useKeys();
|
|
2994
|
-
const keyTuple =
|
|
3123
|
+
const keyTuple = useMemo4(() => keys.find(([k, _]) => k === key), [keys, key]);
|
|
2995
3124
|
return keyTuple?.[1];
|
|
2996
3125
|
};
|
|
2997
3126
|
|
|
2998
3127
|
// src/components/databrowser/components/display/display-list.tsx
|
|
2999
|
-
import { useMemo as
|
|
3128
|
+
import { useMemo as useMemo7 } from "react";
|
|
3000
3129
|
import { IconTrash } from "@tabler/icons-react";
|
|
3001
3130
|
|
|
3002
3131
|
// src/components/ui/button.tsx
|
|
3003
3132
|
import * as React3 from "react";
|
|
3004
3133
|
import { Slot } from "@radix-ui/react-slot";
|
|
3005
|
-
import { jsx as
|
|
3134
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
3006
3135
|
var buttonVariants = cva(
|
|
3007
|
-
"inline-flex items-center justify-center rounded-md text-sm ring-offset-white transition-colors focus-visible:outline-none focus-visible:ring-
|
|
3136
|
+
"inline-flex items-center justify-center rounded-md text-sm 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 dark:ring-offset-zinc-950 dark:focus-visible:ring-zinc-300",
|
|
3008
3137
|
{
|
|
3009
3138
|
variants: {
|
|
3010
3139
|
variant: {
|
|
@@ -3034,7 +3163,7 @@ var buttonVariants = cva(
|
|
|
3034
3163
|
var Button = React3.forwardRef(
|
|
3035
3164
|
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
3036
3165
|
const Comp = asChild ? Slot : "button";
|
|
3037
|
-
return /* @__PURE__ */
|
|
3166
|
+
return /* @__PURE__ */ jsx7(Comp, { className: cn(buttonVariants({ variant, size, className })), ref, ...props });
|
|
3038
3167
|
}
|
|
3039
3168
|
);
|
|
3040
3169
|
Button.displayName = "Button";
|
|
@@ -3043,12 +3172,12 @@ Button.displayName = "Button";
|
|
|
3043
3172
|
import { useMutation } from "@tanstack/react-query";
|
|
3044
3173
|
|
|
3045
3174
|
// src/components/databrowser/components/sidebar/db-size.tsx
|
|
3046
|
-
import { useQuery } from "@tanstack/react-query";
|
|
3175
|
+
import { useQuery as useQuery2 } from "@tanstack/react-query";
|
|
3047
3176
|
|
|
3048
3177
|
// src/components/ui/skeleton.tsx
|
|
3049
|
-
import { jsx as
|
|
3178
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
3050
3179
|
function Skeleton({ className, ...props }) {
|
|
3051
|
-
return /* @__PURE__ */
|
|
3180
|
+
return /* @__PURE__ */ jsx8(
|
|
3052
3181
|
"div",
|
|
3053
3182
|
{
|
|
3054
3183
|
className: cn("animate-pulse rounded-md bg-zinc-900/10 dark:bg-zinc-50/10", className),
|
|
@@ -3058,18 +3187,18 @@ function Skeleton({ className, ...props }) {
|
|
|
3058
3187
|
}
|
|
3059
3188
|
|
|
3060
3189
|
// src/components/databrowser/components/sidebar/db-size.tsx
|
|
3061
|
-
import { jsx as
|
|
3190
|
+
import { jsx as jsx9, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
3062
3191
|
var FETCH_DB_SIZE_QUERY_KEY = "fetch-db-size";
|
|
3063
3192
|
var DisplayDbSize = () => {
|
|
3064
|
-
const { redis } =
|
|
3065
|
-
const { data: keyCount } =
|
|
3193
|
+
const { redis } = useRedis();
|
|
3194
|
+
const { data: keyCount } = useQuery2({
|
|
3066
3195
|
queryKey: [FETCH_DB_SIZE_QUERY_KEY],
|
|
3067
3196
|
queryFn: async () => {
|
|
3068
3197
|
return await redis.dbsize();
|
|
3069
3198
|
}
|
|
3070
3199
|
});
|
|
3071
3200
|
if (keyCount === void 0) {
|
|
3072
|
-
return /* @__PURE__ */
|
|
3201
|
+
return /* @__PURE__ */ jsx9("div", { className: "flex items-center justify-center gap-1", children: /* @__PURE__ */ jsx9(Skeleton, { className: "h-5 w-10 rounded" }) });
|
|
3073
3202
|
}
|
|
3074
3203
|
return /* @__PURE__ */ jsxs2("div", { className: "", children: [
|
|
3075
3204
|
formatNumber(keyCount),
|
|
@@ -3079,7 +3208,7 @@ var DisplayDbSize = () => {
|
|
|
3079
3208
|
|
|
3080
3209
|
// src/components/databrowser/hooks/use-add-key.ts
|
|
3081
3210
|
var useAddKey = () => {
|
|
3082
|
-
const { redis } =
|
|
3211
|
+
const { redis } = useRedis();
|
|
3083
3212
|
const mutation = useMutation({
|
|
3084
3213
|
mutationFn: async ({ key, type }) => {
|
|
3085
3214
|
if (await redis.exists(key)) throw new Error(`Key "${key}" already exists`);
|
|
@@ -3151,7 +3280,7 @@ var useAddKey = () => {
|
|
|
3151
3280
|
};
|
|
3152
3281
|
|
|
3153
3282
|
// src/components/databrowser/hooks/use-debounce.ts
|
|
3154
|
-
import { useEffect as useEffect2, useState as
|
|
3283
|
+
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
3155
3284
|
|
|
3156
3285
|
// src/components/databrowser/hooks/use-delete-key.ts
|
|
3157
3286
|
import { useMutation as useMutation2 } from "@tanstack/react-query";
|
|
@@ -3159,16 +3288,12 @@ import { useMutation as useMutation2 } from "@tanstack/react-query";
|
|
|
3159
3288
|
// src/components/databrowser/hooks/use-delete-key-cache.ts
|
|
3160
3289
|
import { useCallback } from "react";
|
|
3161
3290
|
|
|
3162
|
-
// src/components/databrowser/hooks/use-fetch-key-type.tsx
|
|
3163
|
-
import { useQuery as useQuery2 } from "@tanstack/react-query";
|
|
3164
|
-
var FETCH_KEY_TYPE_QUERY_KEY = "fetch-key-type";
|
|
3165
|
-
|
|
3166
3291
|
// src/components/databrowser/hooks/use-fetch-list-items.tsx
|
|
3167
3292
|
import { useInfiniteQuery as useInfiniteQuery2 } from "@tanstack/react-query";
|
|
3168
3293
|
var LIST_DISPLAY_PAGE_SIZE = 50;
|
|
3169
3294
|
var FETCH_LIST_ITEMS_QUERY_KEY = "use-fetch-list-items";
|
|
3170
3295
|
var useFetchListItems = ({ dataKey, type }) => {
|
|
3171
|
-
const { redisNoPipeline: redis } =
|
|
3296
|
+
const { redisNoPipeline: redis } = useRedis();
|
|
3172
3297
|
const setQuery = useInfiniteQuery2({
|
|
3173
3298
|
enabled: type === "set",
|
|
3174
3299
|
queryKey: [FETCH_LIST_ITEMS_QUERY_KEY, dataKey, "set"],
|
|
@@ -3283,7 +3408,7 @@ function transformArray(inputArray) {
|
|
|
3283
3408
|
import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
3284
3409
|
var FETCH_SIMPLE_KEY_QUERY_KEY = "fetch-simple-key";
|
|
3285
3410
|
var useFetchSimpleKey = (dataKey, type) => {
|
|
3286
|
-
const { redisNoPipeline: redis } =
|
|
3411
|
+
const { redisNoPipeline: redis } = useRedis();
|
|
3287
3412
|
const { deleteKeyCache } = useDeleteKeyCache();
|
|
3288
3413
|
return useQuery3({
|
|
3289
3414
|
queryKey: [FETCH_SIMPLE_KEY_QUERY_KEY, dataKey],
|
|
@@ -3310,7 +3435,7 @@ var sortObject = (obj) => {
|
|
|
3310
3435
|
|
|
3311
3436
|
// src/components/databrowser/hooks/use-delete-key-cache.ts
|
|
3312
3437
|
var useDeleteKeyCache = () => {
|
|
3313
|
-
const { setSelectedKey } =
|
|
3438
|
+
const { setSelectedKey } = useTab();
|
|
3314
3439
|
const deleteKeyCache = useCallback(
|
|
3315
3440
|
(key) => {
|
|
3316
3441
|
setSelectedKey(void 0);
|
|
@@ -3334,7 +3459,7 @@ var useDeleteKeyCache = () => {
|
|
|
3334
3459
|
|
|
3335
3460
|
// src/components/databrowser/hooks/use-delete-key.ts
|
|
3336
3461
|
var useDeleteKey = () => {
|
|
3337
|
-
const { redis } =
|
|
3462
|
+
const { redis } = useRedis();
|
|
3338
3463
|
const { deleteKeyCache } = useDeleteKeyCache();
|
|
3339
3464
|
const deleteKey = useMutation2({
|
|
3340
3465
|
mutationFn: async (key) => {
|
|
@@ -3353,7 +3478,7 @@ var useDeleteKey = () => {
|
|
|
3353
3478
|
// src/components/databrowser/hooks/use-edit-list-item.tsx
|
|
3354
3479
|
import { useMutation as useMutation3 } from "@tanstack/react-query";
|
|
3355
3480
|
var useEditListItem = () => {
|
|
3356
|
-
const { redis } =
|
|
3481
|
+
const { redis } = useRedis();
|
|
3357
3482
|
return useMutation3({
|
|
3358
3483
|
mutationFn: async ({
|
|
3359
3484
|
type,
|
|
@@ -3436,7 +3561,7 @@ import { useEffect as useEffect5 } from "react";
|
|
|
3436
3561
|
import { useQuery as useQuery6 } from "@tanstack/react-query";
|
|
3437
3562
|
|
|
3438
3563
|
// src/components/databrowser/components/display/ttl-badge.tsx
|
|
3439
|
-
import { useEffect as useEffect4, useState as
|
|
3564
|
+
import { useEffect as useEffect4, useState as useState4 } from "react";
|
|
3440
3565
|
import { IconChevronDown } from "@tabler/icons-react";
|
|
3441
3566
|
|
|
3442
3567
|
// src/components/databrowser/components/display/header-badges.tsx
|
|
@@ -3446,7 +3571,7 @@ import bytes from "bytes";
|
|
|
3446
3571
|
import { useQuery as useQuery4 } from "@tanstack/react-query";
|
|
3447
3572
|
var FETCH_KEY_LENGTH_QUERY_KEY = "fetch-key-length";
|
|
3448
3573
|
var useFetchKeyLength = ({ dataKey, type }) => {
|
|
3449
|
-
const { redis } =
|
|
3574
|
+
const { redis } = useRedis();
|
|
3450
3575
|
return useQuery4({
|
|
3451
3576
|
queryKey: [FETCH_KEY_LENGTH_QUERY_KEY, dataKey],
|
|
3452
3577
|
queryFn: async () => {
|
|
@@ -3476,7 +3601,7 @@ var useFetchKeyLength = ({ dataKey, type }) => {
|
|
|
3476
3601
|
import { useQuery as useQuery5 } from "@tanstack/react-query";
|
|
3477
3602
|
var FETCH_KEY_SIZE_QUERY_KEY = "fetch-key-size";
|
|
3478
3603
|
var useFetchKeySize = (dataKey) => {
|
|
3479
|
-
const { redis } =
|
|
3604
|
+
const { redis } = useRedis();
|
|
3480
3605
|
return useQuery5({
|
|
3481
3606
|
queryKey: [FETCH_KEY_SIZE_QUERY_KEY, dataKey],
|
|
3482
3607
|
queryFn: async () => {
|
|
@@ -3486,7 +3611,7 @@ var useFetchKeySize = (dataKey) => {
|
|
|
3486
3611
|
};
|
|
3487
3612
|
|
|
3488
3613
|
// src/components/databrowser/components/display/header-badges.tsx
|
|
3489
|
-
import { jsx as
|
|
3614
|
+
import { jsx as jsx10, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
3490
3615
|
var LengthBadge = ({
|
|
3491
3616
|
dataKey,
|
|
3492
3617
|
type,
|
|
@@ -3494,18 +3619,18 @@ var LengthBadge = ({
|
|
|
3494
3619
|
}) => {
|
|
3495
3620
|
const { data, isLoading } = useFetchKeyLength({ dataKey, type });
|
|
3496
3621
|
const length = content?.length ?? data;
|
|
3497
|
-
return /* @__PURE__ */
|
|
3622
|
+
return /* @__PURE__ */ jsx10(Badge, { label: "Length:", children: isLoading ? /* @__PURE__ */ jsx10(Skeleton, { className: "ml-1 h-3 w-10 rounded-md opacity-50" }) : length });
|
|
3498
3623
|
};
|
|
3499
3624
|
var SizeBadge = ({ dataKey }) => {
|
|
3500
3625
|
const { data: size } = useFetchKeySize(dataKey);
|
|
3501
|
-
return /* @__PURE__ */
|
|
3626
|
+
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, {
|
|
3502
3627
|
unitSeparator: " "
|
|
3503
3628
|
}) });
|
|
3504
3629
|
};
|
|
3505
3630
|
var HeaderTTLBadge = ({ dataKey }) => {
|
|
3506
|
-
const { data: expireAt } =
|
|
3631
|
+
const { data: expireAt } = useFetchTTL(dataKey);
|
|
3507
3632
|
const { mutate: setTTL, isPending } = useSetTTL();
|
|
3508
|
-
return /* @__PURE__ */
|
|
3633
|
+
return /* @__PURE__ */ jsx10(
|
|
3509
3634
|
TTLBadge,
|
|
3510
3635
|
{
|
|
3511
3636
|
expireAt,
|
|
@@ -3515,20 +3640,20 @@ var HeaderTTLBadge = ({ dataKey }) => {
|
|
|
3515
3640
|
);
|
|
3516
3641
|
};
|
|
3517
3642
|
var Badge = ({ children, label }) => /* @__PURE__ */ jsxs3("div", { className: "flex h-6 items-center gap-0.5 rounded-md bg-white px-2 text-xs text-zinc-700", children: [
|
|
3518
|
-
/* @__PURE__ */
|
|
3519
|
-
/* @__PURE__ */
|
|
3643
|
+
/* @__PURE__ */ jsx10("span", { className: "text-zinc-500", children: label }),
|
|
3644
|
+
/* @__PURE__ */ jsx10("span", { className: "font-medium", children })
|
|
3520
3645
|
] });
|
|
3521
3646
|
|
|
3522
3647
|
// src/components/databrowser/components/display/ttl-popover.tsx
|
|
3523
|
-
import { useEffect as useEffect3, useMemo as
|
|
3648
|
+
import { useEffect as useEffect3, useMemo as useMemo5, useState as useState3 } from "react";
|
|
3524
3649
|
import { Controller, useForm } from "react-hook-form";
|
|
3525
3650
|
|
|
3526
3651
|
// src/components/ui/input.tsx
|
|
3527
3652
|
import * as React4 from "react";
|
|
3528
|
-
import { jsx as
|
|
3653
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
3529
3654
|
var Input = React4.forwardRef(
|
|
3530
3655
|
({ className, type, ...props }, ref) => {
|
|
3531
|
-
return /* @__PURE__ */
|
|
3656
|
+
return /* @__PURE__ */ jsx11(
|
|
3532
3657
|
"input",
|
|
3533
3658
|
{
|
|
3534
3659
|
type,
|
|
@@ -3547,10 +3672,10 @@ Input.displayName = "Input";
|
|
|
3547
3672
|
// src/components/ui/popover.tsx
|
|
3548
3673
|
import * as React5 from "react";
|
|
3549
3674
|
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
3550
|
-
import { jsx as
|
|
3675
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
3551
3676
|
var Popover = PopoverPrimitive.Root;
|
|
3552
3677
|
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
3553
|
-
var PopoverContent = React5.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */
|
|
3678
|
+
var PopoverContent = React5.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx12(PopoverPrimitive.Portal, { container: portalRoot, children: /* @__PURE__ */ jsx12(
|
|
3554
3679
|
PopoverPrimitive.Content,
|
|
3555
3680
|
{
|
|
3556
3681
|
ref,
|
|
@@ -3568,7 +3693,7 @@ PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
|
3568
3693
|
// src/components/ui/select.tsx
|
|
3569
3694
|
import * as React6 from "react";
|
|
3570
3695
|
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
3571
|
-
import { jsx as
|
|
3696
|
+
import { jsx as jsx13, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
3572
3697
|
var Select = SelectPrimitive.Root;
|
|
3573
3698
|
var SelectGroup = SelectPrimitive.Group;
|
|
3574
3699
|
var SelectValue = SelectPrimitive.Value;
|
|
@@ -3583,7 +3708,7 @@ var SelectTrigger = React6.forwardRef(({ className, children, ...props }, ref) =
|
|
|
3583
3708
|
...props,
|
|
3584
3709
|
children: [
|
|
3585
3710
|
children,
|
|
3586
|
-
/* @__PURE__ */
|
|
3711
|
+
/* @__PURE__ */ jsx13(SelectPrimitive.Icon, { asChild: true, className: "absolute right-2", children: /* @__PURE__ */ jsx13(
|
|
3587
3712
|
"svg",
|
|
3588
3713
|
{
|
|
3589
3714
|
width: "16",
|
|
@@ -3591,7 +3716,7 @@ var SelectTrigger = React6.forwardRef(({ className, children, ...props }, ref) =
|
|
|
3591
3716
|
viewBox: "0 0 16 16",
|
|
3592
3717
|
fill: "none",
|
|
3593
3718
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3594
|
-
children: /* @__PURE__ */
|
|
3719
|
+
children: /* @__PURE__ */ jsx13(
|
|
3595
3720
|
"path",
|
|
3596
3721
|
{
|
|
3597
3722
|
d: "M4 6L8 10L12 6",
|
|
@@ -3608,7 +3733,7 @@ var SelectTrigger = React6.forwardRef(({ className, children, ...props }, ref) =
|
|
|
3608
3733
|
}
|
|
3609
3734
|
));
|
|
3610
3735
|
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
3611
|
-
var SelectContent = React6.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */
|
|
3736
|
+
var SelectContent = React6.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx13(SelectPrimitive.Portal, { container: portalRoot, children: /* @__PURE__ */ jsx13(
|
|
3612
3737
|
SelectPrimitive.Content,
|
|
3613
3738
|
{
|
|
3614
3739
|
ref,
|
|
@@ -3619,7 +3744,7 @@ var SelectContent = React6.forwardRef(({ className, children, position = "popper
|
|
|
3619
3744
|
),
|
|
3620
3745
|
position,
|
|
3621
3746
|
...props,
|
|
3622
|
-
children: /* @__PURE__ */
|
|
3747
|
+
children: /* @__PURE__ */ jsx13(
|
|
3623
3748
|
SelectPrimitive.Viewport,
|
|
3624
3749
|
{
|
|
3625
3750
|
className: cn(
|
|
@@ -3632,7 +3757,7 @@ var SelectContent = React6.forwardRef(({ className, children, position = "popper
|
|
|
3632
3757
|
}
|
|
3633
3758
|
) }));
|
|
3634
3759
|
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
3635
|
-
var SelectLabel = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
3760
|
+
var SelectLabel = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx13(
|
|
3636
3761
|
SelectPrimitive.Label,
|
|
3637
3762
|
{
|
|
3638
3763
|
ref,
|
|
@@ -3651,7 +3776,7 @@ var SelectItem = React6.forwardRef(({ className, children, ...props }, ref) => /
|
|
|
3651
3776
|
),
|
|
3652
3777
|
...props,
|
|
3653
3778
|
children: [
|
|
3654
|
-
/* @__PURE__ */
|
|
3779
|
+
/* @__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(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx13(
|
|
3655
3780
|
"svg",
|
|
3656
3781
|
{
|
|
3657
3782
|
width: "15",
|
|
@@ -3660,7 +3785,7 @@ var SelectItem = React6.forwardRef(({ className, children, ...props }, ref) => /
|
|
|
3660
3785
|
fill: "none",
|
|
3661
3786
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3662
3787
|
className: "h-4 w-4",
|
|
3663
|
-
children: /* @__PURE__ */
|
|
3788
|
+
children: /* @__PURE__ */ jsx13(
|
|
3664
3789
|
"path",
|
|
3665
3790
|
{
|
|
3666
3791
|
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",
|
|
@@ -3671,12 +3796,12 @@ var SelectItem = React6.forwardRef(({ className, children, ...props }, ref) => /
|
|
|
3671
3796
|
)
|
|
3672
3797
|
}
|
|
3673
3798
|
) }) }) }),
|
|
3674
|
-
/* @__PURE__ */
|
|
3799
|
+
/* @__PURE__ */ jsx13(SelectPrimitive.ItemText, { children })
|
|
3675
3800
|
]
|
|
3676
3801
|
}
|
|
3677
3802
|
));
|
|
3678
3803
|
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
3679
|
-
var SelectSeparator = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
3804
|
+
var SelectSeparator = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx13(
|
|
3680
3805
|
SelectPrimitive.Separator,
|
|
3681
3806
|
{
|
|
3682
3807
|
ref,
|
|
@@ -3687,16 +3812,16 @@ var SelectSeparator = React6.forwardRef(({ className, ...props }, ref) => /* @__
|
|
|
3687
3812
|
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
|
|
3688
3813
|
|
|
3689
3814
|
// src/components/ui/spinner.tsx
|
|
3690
|
-
import { Fragment, jsx as
|
|
3815
|
+
import { Fragment, jsx as jsx14, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
3691
3816
|
var Spinner = ({
|
|
3692
3817
|
isLoading,
|
|
3693
3818
|
className,
|
|
3694
3819
|
isLoadingText,
|
|
3695
3820
|
children
|
|
3696
3821
|
}) => {
|
|
3697
|
-
return /* @__PURE__ */
|
|
3822
|
+
return /* @__PURE__ */ jsx14("div", { className: className ?? "flex items-center", children: isLoading ? /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
3698
3823
|
isLoadingText,
|
|
3699
|
-
/* @__PURE__ */
|
|
3824
|
+
/* @__PURE__ */ jsx14(
|
|
3700
3825
|
"svg",
|
|
3701
3826
|
{
|
|
3702
3827
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3709,14 +3834,14 @@ var Spinner = ({
|
|
|
3709
3834
|
strokeLinecap: "round",
|
|
3710
3835
|
strokeLinejoin: "round",
|
|
3711
3836
|
className: cn("h-4 w-4 animate-spin", isLoadingText ? "ml-2" : ""),
|
|
3712
|
-
children: /* @__PURE__ */
|
|
3837
|
+
children: /* @__PURE__ */ jsx14("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" })
|
|
3713
3838
|
}
|
|
3714
3839
|
)
|
|
3715
3840
|
] }) : children });
|
|
3716
3841
|
};
|
|
3717
3842
|
|
|
3718
3843
|
// src/components/databrowser/components/display/ttl-popover.tsx
|
|
3719
|
-
import { jsx as
|
|
3844
|
+
import { jsx as jsx15, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
3720
3845
|
var timeUnits = [
|
|
3721
3846
|
{ label: "Seconds", value: 1 },
|
|
3722
3847
|
{ label: "Minutes", value: 60 },
|
|
@@ -3729,8 +3854,8 @@ function TTLPopover({
|
|
|
3729
3854
|
setTTL,
|
|
3730
3855
|
isPending
|
|
3731
3856
|
}) {
|
|
3732
|
-
const [open, setOpen] =
|
|
3733
|
-
const defaultValues =
|
|
3857
|
+
const [open, setOpen] = useState3(false);
|
|
3858
|
+
const defaultValues = useMemo5(() => {
|
|
3734
3859
|
return { type: "Seconds", value: ttl };
|
|
3735
3860
|
}, [ttl]);
|
|
3736
3861
|
const { control, handleSubmit, formState, reset } = useForm({
|
|
@@ -3758,8 +3883,8 @@ function TTLPopover({
|
|
|
3758
3883
|
setOpen(isOpen);
|
|
3759
3884
|
},
|
|
3760
3885
|
children: [
|
|
3761
|
-
/* @__PURE__ */
|
|
3762
|
-
/* @__PURE__ */
|
|
3886
|
+
/* @__PURE__ */ jsx15(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx15("button", { children }) }),
|
|
3887
|
+
/* @__PURE__ */ jsx15(PopoverContent, { className: "w-[300px]", align: "end", children: /* @__PURE__ */ jsxs6(
|
|
3763
3888
|
"form",
|
|
3764
3889
|
{
|
|
3765
3890
|
className: "space-y-4",
|
|
@@ -3768,10 +3893,10 @@ function TTLPopover({
|
|
|
3768
3893
|
e.stopPropagation();
|
|
3769
3894
|
},
|
|
3770
3895
|
children: [
|
|
3771
|
-
/* @__PURE__ */
|
|
3896
|
+
/* @__PURE__ */ jsx15("h4", { className: "font-medium leading-none", children: "Expiration" }),
|
|
3772
3897
|
/* @__PURE__ */ jsxs6("div", { children: [
|
|
3773
3898
|
/* @__PURE__ */ jsxs6("div", { className: "flex items-center", children: [
|
|
3774
|
-
/* @__PURE__ */
|
|
3899
|
+
/* @__PURE__ */ jsx15(
|
|
3775
3900
|
Controller,
|
|
3776
3901
|
{
|
|
3777
3902
|
rules: {
|
|
@@ -3780,26 +3905,26 @@ function TTLPopover({
|
|
|
3780
3905
|
},
|
|
3781
3906
|
control,
|
|
3782
3907
|
name: "value",
|
|
3783
|
-
render: ({ field }) => /* @__PURE__ */
|
|
3908
|
+
render: ({ field }) => /* @__PURE__ */ jsx15(Input, { min: "-1", ...field, className: "grow rounded-r-none" })
|
|
3784
3909
|
}
|
|
3785
3910
|
),
|
|
3786
|
-
/* @__PURE__ */
|
|
3911
|
+
/* @__PURE__ */ jsx15(
|
|
3787
3912
|
Controller,
|
|
3788
3913
|
{
|
|
3789
3914
|
control,
|
|
3790
3915
|
name: "type",
|
|
3791
3916
|
render: ({ field }) => /* @__PURE__ */ jsxs6(Select, { value: field.value, onValueChange: field.onChange, children: [
|
|
3792
|
-
/* @__PURE__ */
|
|
3793
|
-
/* @__PURE__ */
|
|
3917
|
+
/* @__PURE__ */ jsx15(SelectTrigger, { className: "w-auto rounded-l-none border-l-0 pr-8", children: /* @__PURE__ */ jsx15(SelectValue, {}) }),
|
|
3918
|
+
/* @__PURE__ */ jsx15(SelectContent, { children: timeUnits.map((unit) => /* @__PURE__ */ jsx15(SelectItem, { value: unit.label, children: unit.label }, unit.label)) })
|
|
3794
3919
|
] })
|
|
3795
3920
|
}
|
|
3796
3921
|
)
|
|
3797
3922
|
] }),
|
|
3798
|
-
formState.errors.value && /* @__PURE__ */
|
|
3799
|
-
/* @__PURE__ */
|
|
3923
|
+
formState.errors.value && /* @__PURE__ */ jsx15("p", { className: "mt-2 text-xs text-red-500", children: formState.errors.value.message }),
|
|
3924
|
+
/* @__PURE__ */ jsx15("p", { className: "mt-2 text-xs text-zinc-500", children: "TTL sets a timer to automatically delete keys after a defined period." })
|
|
3800
3925
|
] }),
|
|
3801
3926
|
/* @__PURE__ */ jsxs6("div", { className: "flex justify-between", children: [
|
|
3802
|
-
/* @__PURE__ */
|
|
3927
|
+
/* @__PURE__ */ jsx15(
|
|
3803
3928
|
Button,
|
|
3804
3929
|
{
|
|
3805
3930
|
type: "button",
|
|
@@ -3810,8 +3935,8 @@ function TTLPopover({
|
|
|
3810
3935
|
}
|
|
3811
3936
|
),
|
|
3812
3937
|
/* @__PURE__ */ jsxs6("div", { className: "flex gap-2", children: [
|
|
3813
|
-
/* @__PURE__ */
|
|
3814
|
-
/* @__PURE__ */
|
|
3938
|
+
/* @__PURE__ */ jsx15(Button, { variant: "outline", onClick: () => setOpen(false), type: "button", children: "Cancel" }),
|
|
3939
|
+
/* @__PURE__ */ jsx15(Button, { variant: "primary", type: "submit", children: /* @__PURE__ */ jsx15(Spinner, { isLoading: isPending, isLoadingText: "Saving", children: "Save" }) })
|
|
3815
3940
|
] })
|
|
3816
3941
|
] })
|
|
3817
3942
|
]
|
|
@@ -3823,7 +3948,7 @@ function TTLPopover({
|
|
|
3823
3948
|
}
|
|
3824
3949
|
|
|
3825
3950
|
// src/components/databrowser/components/display/ttl-badge.tsx
|
|
3826
|
-
import { jsx as
|
|
3951
|
+
import { jsx as jsx16, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3827
3952
|
var TTL_INFINITE = -1;
|
|
3828
3953
|
var TTL_NOT_FOUND = -2;
|
|
3829
3954
|
var calculateTTL = (expireAt) => {
|
|
@@ -3837,7 +3962,7 @@ var TTLBadge = ({
|
|
|
3837
3962
|
setTTL,
|
|
3838
3963
|
isPending
|
|
3839
3964
|
}) => {
|
|
3840
|
-
const [ttl, setTTLLabel] =
|
|
3965
|
+
const [ttl, setTTLLabel] = useState4(() => calculateTTL(expireAt));
|
|
3841
3966
|
useEffect4(() => {
|
|
3842
3967
|
setTTLLabel(calculateTTL(expireAt));
|
|
3843
3968
|
const interval = setInterval(() => {
|
|
@@ -3845,16 +3970,16 @@ var TTLBadge = ({
|
|
|
3845
3970
|
}, 1e3);
|
|
3846
3971
|
return () => clearInterval(interval);
|
|
3847
3972
|
}, [expireAt]);
|
|
3848
|
-
return /* @__PURE__ */
|
|
3973
|
+
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__ */ jsxs7("div", { className: "flex gap-[2px]", children: [
|
|
3849
3974
|
ttl === TTL_INFINITE ? "Forever" : formatTime(ttl),
|
|
3850
|
-
/* @__PURE__ */
|
|
3975
|
+
/* @__PURE__ */ jsx16(IconChevronDown, { className: "mt-[1px] text-zinc-400", size: 12 })
|
|
3851
3976
|
] }) }) });
|
|
3852
3977
|
};
|
|
3853
3978
|
|
|
3854
3979
|
// src/components/databrowser/hooks/use-fetch-ttl.ts
|
|
3855
3980
|
var FETCH_TTL_QUERY_KEY = "fetch-ttl";
|
|
3856
|
-
var
|
|
3857
|
-
const { redis } =
|
|
3981
|
+
var useFetchTTL = (dataKey) => {
|
|
3982
|
+
const { redis } = useRedis();
|
|
3858
3983
|
const { isLoading, error, data } = useQuery6({
|
|
3859
3984
|
queryKey: [FETCH_TTL_QUERY_KEY, dataKey],
|
|
3860
3985
|
queryFn: async () => {
|
|
@@ -3875,7 +4000,7 @@ var useFetchKeyExpire = (dataKey) => {
|
|
|
3875
4000
|
// src/components/databrowser/hooks/use-set-simple-key.tsx
|
|
3876
4001
|
import { useMutation as useMutation4 } from "@tanstack/react-query";
|
|
3877
4002
|
var useSetSimpleKey = (dataKey, type) => {
|
|
3878
|
-
const { redis } =
|
|
4003
|
+
const { redis } = useRedis();
|
|
3879
4004
|
return useMutation4({
|
|
3880
4005
|
mutationFn: async (value) => {
|
|
3881
4006
|
if (type === "string") {
|
|
@@ -3898,7 +4023,7 @@ var useSetSimpleKey = (dataKey, type) => {
|
|
|
3898
4023
|
// src/components/databrowser/hooks/use-set-ttl.ts
|
|
3899
4024
|
import { useMutation as useMutation5 } from "@tanstack/react-query";
|
|
3900
4025
|
var useSetTTL = () => {
|
|
3901
|
-
const { redis } =
|
|
4026
|
+
const { redis } = useRedis();
|
|
3902
4027
|
const updateTTL = useMutation5({
|
|
3903
4028
|
mutationFn: async ({ dataKey, ttl }) => {
|
|
3904
4029
|
await (ttl === void 0 || ttl === TTL_INFINITE ? redis.persist(dataKey) : redis.expire(dataKey, ttl));
|
|
@@ -3916,14 +4041,14 @@ var useSetTTL = () => {
|
|
|
3916
4041
|
};
|
|
3917
4042
|
|
|
3918
4043
|
// src/components/databrowser/components/item-context-menu.tsx
|
|
3919
|
-
import { useState as
|
|
4044
|
+
import { useState as useState5 } from "react";
|
|
3920
4045
|
import { ContextMenuSeparator as ContextMenuSeparator2 } from "@radix-ui/react-context-menu";
|
|
3921
4046
|
|
|
3922
4047
|
// src/components/ui/context-menu.tsx
|
|
3923
4048
|
import * as React7 from "react";
|
|
3924
4049
|
import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
|
|
3925
4050
|
import { CheckIcon, ChevronRightIcon, DotFilledIcon } from "@radix-ui/react-icons";
|
|
3926
|
-
import { jsx as
|
|
4051
|
+
import { jsx as jsx17, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3927
4052
|
var ContextMenu = ContextMenuPrimitive.Root;
|
|
3928
4053
|
var ContextMenuTrigger = ContextMenuPrimitive.Trigger;
|
|
3929
4054
|
var ContextMenuSubTrigger = React7.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs8(
|
|
@@ -3938,12 +4063,12 @@ var ContextMenuSubTrigger = React7.forwardRef(({ className, inset, children, ...
|
|
|
3938
4063
|
...props,
|
|
3939
4064
|
children: [
|
|
3940
4065
|
children,
|
|
3941
|
-
/* @__PURE__ */
|
|
4066
|
+
/* @__PURE__ */ jsx17(ChevronRightIcon, { className: "ml-auto h-4 w-4" })
|
|
3942
4067
|
]
|
|
3943
4068
|
}
|
|
3944
4069
|
));
|
|
3945
4070
|
ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;
|
|
3946
|
-
var ContextMenuSubContent = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
4071
|
+
var ContextMenuSubContent = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx17(
|
|
3947
4072
|
ContextMenuPrimitive.SubContent,
|
|
3948
4073
|
{
|
|
3949
4074
|
ref,
|
|
@@ -3955,7 +4080,7 @@ var ContextMenuSubContent = React7.forwardRef(({ className, ...props }, ref) =>
|
|
|
3955
4080
|
}
|
|
3956
4081
|
));
|
|
3957
4082
|
ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName;
|
|
3958
|
-
var ContextMenuContent = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
4083
|
+
var ContextMenuContent = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx17(ContextMenuPrimitive.Portal, { container: portalRoot, children: /* @__PURE__ */ jsx17(
|
|
3959
4084
|
ContextMenuPrimitive.Content,
|
|
3960
4085
|
{
|
|
3961
4086
|
ref,
|
|
@@ -3967,7 +4092,7 @@ var ContextMenuContent = React7.forwardRef(({ className, ...props }, ref) => /*
|
|
|
3967
4092
|
}
|
|
3968
4093
|
) }));
|
|
3969
4094
|
ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;
|
|
3970
|
-
var ContextMenuItem = React7.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */
|
|
4095
|
+
var ContextMenuItem = React7.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx17(
|
|
3971
4096
|
ContextMenuPrimitive.Item,
|
|
3972
4097
|
{
|
|
3973
4098
|
ref,
|
|
@@ -3991,7 +4116,7 @@ var ContextMenuCheckboxItem = React7.forwardRef(({ className, children, checked,
|
|
|
3991
4116
|
checked,
|
|
3992
4117
|
...props,
|
|
3993
4118
|
children: [
|
|
3994
|
-
/* @__PURE__ */
|
|
4119
|
+
/* @__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(CheckIcon, { className: "h-4 w-4" }) }) }),
|
|
3995
4120
|
children
|
|
3996
4121
|
]
|
|
3997
4122
|
}
|
|
@@ -4007,13 +4132,13 @@ var ContextMenuRadioItem = React7.forwardRef(({ className, children, ...props },
|
|
|
4007
4132
|
),
|
|
4008
4133
|
...props,
|
|
4009
4134
|
children: [
|
|
4010
|
-
/* @__PURE__ */
|
|
4135
|
+
/* @__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(DotFilledIcon, { className: "h-4 w-4 fill-current" }) }) }),
|
|
4011
4136
|
children
|
|
4012
4137
|
]
|
|
4013
4138
|
}
|
|
4014
4139
|
));
|
|
4015
4140
|
ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName;
|
|
4016
|
-
var ContextMenuLabel = React7.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */
|
|
4141
|
+
var ContextMenuLabel = React7.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx17(
|
|
4017
4142
|
ContextMenuPrimitive.Label,
|
|
4018
4143
|
{
|
|
4019
4144
|
ref,
|
|
@@ -4026,7 +4151,7 @@ var ContextMenuLabel = React7.forwardRef(({ className, inset, ...props }, ref) =
|
|
|
4026
4151
|
}
|
|
4027
4152
|
));
|
|
4028
4153
|
ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName;
|
|
4029
|
-
var ContextMenuSeparator = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
4154
|
+
var ContextMenuSeparator = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx17(
|
|
4030
4155
|
ContextMenuPrimitive.Separator,
|
|
4031
4156
|
{
|
|
4032
4157
|
ref,
|
|
@@ -4036,7 +4161,7 @@ var ContextMenuSeparator = React7.forwardRef(({ className, ...props }, ref) => /
|
|
|
4036
4161
|
));
|
|
4037
4162
|
ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName;
|
|
4038
4163
|
var ContextMenuShortcut = ({ className, ...props }) => {
|
|
4039
|
-
return /* @__PURE__ */
|
|
4164
|
+
return /* @__PURE__ */ jsx17(
|
|
4040
4165
|
"span",
|
|
4041
4166
|
{
|
|
4042
4167
|
className: cn(
|
|
@@ -4052,12 +4177,12 @@ ContextMenuShortcut.displayName = "ContextMenuShortcut";
|
|
|
4052
4177
|
// src/components/ui/alert-dialog.tsx
|
|
4053
4178
|
import * as React8 from "react";
|
|
4054
4179
|
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
|
|
4055
|
-
import { jsx as
|
|
4180
|
+
import { jsx as jsx18, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
4056
4181
|
var AlertDialog = AlertDialogPrimitive.Root;
|
|
4057
4182
|
var AlertDialogTrigger = AlertDialogPrimitive.Trigger;
|
|
4058
|
-
var AlertDialogPortal = ({ ...props }) => /* @__PURE__ */
|
|
4183
|
+
var AlertDialogPortal = ({ ...props }) => /* @__PURE__ */ jsx18(AlertDialogPrimitive.Portal, { container: portalRoot, ...props });
|
|
4059
4184
|
AlertDialogPortal.displayName = AlertDialogPrimitive.Portal.displayName;
|
|
4060
|
-
var AlertDialogOverlay = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
4185
|
+
var AlertDialogOverlay = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx18(
|
|
4061
4186
|
AlertDialogPrimitive.Overlay,
|
|
4062
4187
|
{
|
|
4063
4188
|
className: cn(
|
|
@@ -4070,8 +4195,8 @@ var AlertDialogOverlay = React8.forwardRef(({ className, ...props }, ref) => /*
|
|
|
4070
4195
|
));
|
|
4071
4196
|
AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName;
|
|
4072
4197
|
var AlertDialogContent = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs9(AlertDialogPortal, { children: [
|
|
4073
|
-
/* @__PURE__ */
|
|
4074
|
-
/* @__PURE__ */
|
|
4198
|
+
/* @__PURE__ */ jsx18(AlertDialogOverlay, {}),
|
|
4199
|
+
/* @__PURE__ */ jsx18(
|
|
4075
4200
|
AlertDialogPrimitive.Content,
|
|
4076
4201
|
{
|
|
4077
4202
|
ref,
|
|
@@ -4084,9 +4209,9 @@ var AlertDialogContent = React8.forwardRef(({ className, ...props }, ref) => /*
|
|
|
4084
4209
|
)
|
|
4085
4210
|
] }));
|
|
4086
4211
|
AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName;
|
|
4087
|
-
var AlertDialogHeader = ({ className, ...props }) => /* @__PURE__ */
|
|
4212
|
+
var AlertDialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsx18("div", { className: cn("flex flex-col space-y-2 text-center sm:text-left", className), ...props });
|
|
4088
4213
|
AlertDialogHeader.displayName = "AlertDialogHeader";
|
|
4089
|
-
var AlertDialogFooter = ({ className, ...props }) => /* @__PURE__ */
|
|
4214
|
+
var AlertDialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx18(
|
|
4090
4215
|
"div",
|
|
4091
4216
|
{
|
|
4092
4217
|
className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className),
|
|
@@ -4094,7 +4219,7 @@ var AlertDialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx16(
|
|
|
4094
4219
|
}
|
|
4095
4220
|
);
|
|
4096
4221
|
AlertDialogFooter.displayName = "AlertDialogFooter";
|
|
4097
|
-
var AlertDialogTitle = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
4222
|
+
var AlertDialogTitle = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx18(
|
|
4098
4223
|
AlertDialogPrimitive.Title,
|
|
4099
4224
|
{
|
|
4100
4225
|
ref,
|
|
@@ -4103,7 +4228,7 @@ var AlertDialogTitle = React8.forwardRef(({ className, ...props }, ref) => /* @_
|
|
|
4103
4228
|
}
|
|
4104
4229
|
));
|
|
4105
4230
|
AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName;
|
|
4106
|
-
var AlertDialogDescription = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
4231
|
+
var AlertDialogDescription = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx18(
|
|
4107
4232
|
AlertDialogPrimitive.Description,
|
|
4108
4233
|
{
|
|
4109
4234
|
ref,
|
|
@@ -4112,9 +4237,9 @@ var AlertDialogDescription = React8.forwardRef(({ className, ...props }, ref) =>
|
|
|
4112
4237
|
}
|
|
4113
4238
|
));
|
|
4114
4239
|
AlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName;
|
|
4115
|
-
var AlertDialogAction = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
4240
|
+
var AlertDialogAction = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx18(AlertDialogPrimitive.Action, { ref, className: cn(buttonVariants(), className), ...props }));
|
|
4116
4241
|
AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName;
|
|
4117
|
-
var AlertDialogCancel = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
4242
|
+
var AlertDialogCancel = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx18(
|
|
4118
4243
|
AlertDialogPrimitive.Cancel,
|
|
4119
4244
|
{
|
|
4120
4245
|
ref,
|
|
@@ -4125,7 +4250,7 @@ var AlertDialogCancel = React8.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
4125
4250
|
AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName;
|
|
4126
4251
|
|
|
4127
4252
|
// src/components/databrowser/components/display/delete-alert-dialog.tsx
|
|
4128
|
-
import { jsx as
|
|
4253
|
+
import { jsx as jsx19, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
4129
4254
|
function DeleteAlertDialog({
|
|
4130
4255
|
children,
|
|
4131
4256
|
onDeleteConfirm,
|
|
@@ -4134,21 +4259,21 @@ function DeleteAlertDialog({
|
|
|
4134
4259
|
deletionType
|
|
4135
4260
|
}) {
|
|
4136
4261
|
return /* @__PURE__ */ jsxs10(AlertDialog, { open, onOpenChange, children: [
|
|
4137
|
-
children && /* @__PURE__ */
|
|
4262
|
+
children && /* @__PURE__ */ jsx19(AlertDialogTrigger, { asChild: true, children }),
|
|
4138
4263
|
/* @__PURE__ */ jsxs10(AlertDialogContent, { children: [
|
|
4139
4264
|
/* @__PURE__ */ jsxs10(AlertDialogHeader, { children: [
|
|
4140
|
-
/* @__PURE__ */
|
|
4265
|
+
/* @__PURE__ */ jsx19(AlertDialogTitle, { children: deletionType === "item" ? "Delete Item" : "Delete Key" }),
|
|
4141
4266
|
/* @__PURE__ */ jsxs10(AlertDialogDescription, { className: "mt-5", children: [
|
|
4142
4267
|
"Are you sure you want to delete this ",
|
|
4143
4268
|
deletionType,
|
|
4144
4269
|
"?",
|
|
4145
|
-
/* @__PURE__ */
|
|
4270
|
+
/* @__PURE__ */ jsx19("br", {}),
|
|
4146
4271
|
"This action cannot be undone."
|
|
4147
4272
|
] })
|
|
4148
4273
|
] }),
|
|
4149
4274
|
/* @__PURE__ */ jsxs10(AlertDialogFooter, { children: [
|
|
4150
|
-
/* @__PURE__ */
|
|
4151
|
-
/* @__PURE__ */
|
|
4275
|
+
/* @__PURE__ */ jsx19(AlertDialogCancel, { type: "button", children: "Cancel" }),
|
|
4276
|
+
/* @__PURE__ */ jsx19(
|
|
4152
4277
|
AlertDialogAction,
|
|
4153
4278
|
{
|
|
4154
4279
|
className: "bg-red-500 text-gray-50 hover:bg-red-600",
|
|
@@ -4162,17 +4287,17 @@ function DeleteAlertDialog({
|
|
|
4162
4287
|
}
|
|
4163
4288
|
|
|
4164
4289
|
// src/components/databrowser/components/item-context-menu.tsx
|
|
4165
|
-
import { Fragment as Fragment2, jsx as
|
|
4290
|
+
import { Fragment as Fragment2, jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
4166
4291
|
var ItemContextMenu = ({
|
|
4167
4292
|
children,
|
|
4168
4293
|
dataKey,
|
|
4169
4294
|
type
|
|
4170
4295
|
}) => {
|
|
4171
4296
|
const { mutate: editItem } = useEditListItem();
|
|
4172
|
-
const [isAlertOpen, setAlertOpen] =
|
|
4173
|
-
const [data, setData] =
|
|
4297
|
+
const [isAlertOpen, setAlertOpen] = useState5(false);
|
|
4298
|
+
const [data, setData] = useState5();
|
|
4174
4299
|
return /* @__PURE__ */ jsxs11(Fragment2, { children: [
|
|
4175
|
-
/* @__PURE__ */
|
|
4300
|
+
/* @__PURE__ */ jsx20(
|
|
4176
4301
|
DeleteAlertDialog,
|
|
4177
4302
|
{
|
|
4178
4303
|
deletionType: "item",
|
|
@@ -4194,7 +4319,7 @@ var ItemContextMenu = ({
|
|
|
4194
4319
|
}
|
|
4195
4320
|
),
|
|
4196
4321
|
/* @__PURE__ */ jsxs11(ContextMenu, { children: [
|
|
4197
|
-
/* @__PURE__ */
|
|
4322
|
+
/* @__PURE__ */ jsx20(
|
|
4198
4323
|
ContextMenuTrigger,
|
|
4199
4324
|
{
|
|
4200
4325
|
asChild: true,
|
|
@@ -4214,7 +4339,7 @@ var ItemContextMenu = ({
|
|
|
4214
4339
|
}
|
|
4215
4340
|
),
|
|
4216
4341
|
/* @__PURE__ */ jsxs11(ContextMenuContent, { children: [
|
|
4217
|
-
/* @__PURE__ */
|
|
4342
|
+
/* @__PURE__ */ jsx20(
|
|
4218
4343
|
ContextMenuItem,
|
|
4219
4344
|
{
|
|
4220
4345
|
onClick: () => {
|
|
@@ -4227,7 +4352,7 @@ var ItemContextMenu = ({
|
|
|
4227
4352
|
children: "Copy key"
|
|
4228
4353
|
}
|
|
4229
4354
|
),
|
|
4230
|
-
data?.value && /* @__PURE__ */
|
|
4355
|
+
data?.value && /* @__PURE__ */ jsx20(
|
|
4231
4356
|
ContextMenuItem,
|
|
4232
4357
|
{
|
|
4233
4358
|
onClick: () => {
|
|
@@ -4239,8 +4364,8 @@ var ItemContextMenu = ({
|
|
|
4239
4364
|
children: "Copy value"
|
|
4240
4365
|
}
|
|
4241
4366
|
),
|
|
4242
|
-
/* @__PURE__ */
|
|
4243
|
-
/* @__PURE__ */
|
|
4367
|
+
/* @__PURE__ */ jsx20(ContextMenuSeparator2, {}),
|
|
4368
|
+
/* @__PURE__ */ jsx20(ContextMenuItem, { disabled: type === "stream", onClick: () => setAlertOpen(true), children: "Delete item" })
|
|
4244
4369
|
] })
|
|
4245
4370
|
] })
|
|
4246
4371
|
] });
|
|
@@ -4252,36 +4377,36 @@ import { IconLoader2 } from "@tabler/icons-react";
|
|
|
4252
4377
|
// src/components/ui/scroll-area.tsx
|
|
4253
4378
|
import * as React9 from "react";
|
|
4254
4379
|
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
|
|
4255
|
-
import { jsx as
|
|
4256
|
-
var ScrollArea = React9.forwardRef(({ className, children, onScroll, ...props }, ref) => /* @__PURE__ */ jsxs12(
|
|
4380
|
+
import { jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
4381
|
+
var ScrollArea = React9.forwardRef(({ className, children, onScroll, roundedInherit = true, ...props }, ref) => /* @__PURE__ */ jsxs12(
|
|
4257
4382
|
ScrollAreaPrimitive.Root,
|
|
4258
4383
|
{
|
|
4259
4384
|
ref,
|
|
4260
4385
|
className: cn("relative overflow-hidden", className),
|
|
4261
4386
|
...props,
|
|
4262
4387
|
children: [
|
|
4263
|
-
/* @__PURE__ */
|
|
4388
|
+
/* @__PURE__ */ jsx21(
|
|
4264
4389
|
ScrollAreaPrimitive.Viewport,
|
|
4265
4390
|
{
|
|
4266
4391
|
onScroll,
|
|
4267
|
-
className: "h-full w-full
|
|
4392
|
+
className: cn("h-full w-full [&>div]:!block", roundedInherit && "rounded-[inherit]"),
|
|
4268
4393
|
children
|
|
4269
4394
|
}
|
|
4270
4395
|
),
|
|
4271
|
-
/* @__PURE__ */
|
|
4272
|
-
/* @__PURE__ */
|
|
4396
|
+
/* @__PURE__ */ jsx21(ScrollBar, {}),
|
|
4397
|
+
/* @__PURE__ */ jsx21(ScrollAreaPrimitive.Corner, {})
|
|
4273
4398
|
]
|
|
4274
4399
|
}
|
|
4275
4400
|
));
|
|
4276
4401
|
ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
|
|
4277
|
-
var ScrollBar = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
4402
|
+
var ScrollBar = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx21(
|
|
4278
4403
|
ScrollAreaPrimitive.ScrollAreaScrollbar,
|
|
4279
4404
|
{
|
|
4280
4405
|
ref,
|
|
4281
4406
|
orientation: "vertical",
|
|
4282
4407
|
className: cn("flex h-full w-2 touch-none select-none transition-colors", className),
|
|
4283
4408
|
...props,
|
|
4284
|
-
children: /* @__PURE__ */
|
|
4409
|
+
children: /* @__PURE__ */ jsx21(
|
|
4285
4410
|
ScrollAreaPrimitive.ScrollAreaThumb,
|
|
4286
4411
|
{
|
|
4287
4412
|
className: cn("relative flex-1 rounded-full bg-neutral-200/70 dark:bg-neutral-800")
|
|
@@ -4292,10 +4417,11 @@ var ScrollBar = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
4292
4417
|
ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
|
|
4293
4418
|
|
|
4294
4419
|
// src/components/databrowser/components/sidebar/infinite-scroll.tsx
|
|
4295
|
-
import { jsx as
|
|
4420
|
+
import { jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
4296
4421
|
var InfiniteScroll = ({
|
|
4297
4422
|
query,
|
|
4298
|
-
children
|
|
4423
|
+
children,
|
|
4424
|
+
...props
|
|
4299
4425
|
}) => {
|
|
4300
4426
|
const handleScroll = (e) => {
|
|
4301
4427
|
const { scrollTop, clientHeight, scrollHeight } = e.currentTarget;
|
|
@@ -4310,11 +4436,12 @@ var InfiniteScroll = ({
|
|
|
4310
4436
|
ScrollArea,
|
|
4311
4437
|
{
|
|
4312
4438
|
type: "always",
|
|
4313
|
-
className: "block h-full w-full transition-all",
|
|
4439
|
+
className: "block h-full w-full overflow-visible rounded-lg border border-zinc-200 bg-white p-1 pr-3 transition-all",
|
|
4314
4440
|
onScroll: handleScroll,
|
|
4441
|
+
...props,
|
|
4315
4442
|
children: [
|
|
4316
4443
|
children,
|
|
4317
|
-
/* @__PURE__ */
|
|
4444
|
+
/* @__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 }) })
|
|
4318
4445
|
]
|
|
4319
4446
|
}
|
|
4320
4447
|
);
|
|
@@ -4344,15 +4471,15 @@ import {
|
|
|
4344
4471
|
IconList,
|
|
4345
4472
|
IconQuote
|
|
4346
4473
|
} from "@tabler/icons-react";
|
|
4347
|
-
import { jsx as
|
|
4474
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
4348
4475
|
var iconsMap = {
|
|
4349
|
-
string: /* @__PURE__ */
|
|
4350
|
-
set: /* @__PURE__ */
|
|
4351
|
-
hash: /* @__PURE__ */
|
|
4352
|
-
json: /* @__PURE__ */
|
|
4353
|
-
zset: /* @__PURE__ */
|
|
4354
|
-
list: /* @__PURE__ */
|
|
4355
|
-
stream: /* @__PURE__ */
|
|
4476
|
+
string: /* @__PURE__ */ jsx23(IconQuote, { size: 15, stroke: 1.3 }),
|
|
4477
|
+
set: /* @__PURE__ */ jsx23(IconLayersIntersect, { size: 15, stroke: 1.3 }),
|
|
4478
|
+
hash: /* @__PURE__ */ jsx23(IconHash, { size: 15, stroke: 1.3 }),
|
|
4479
|
+
json: /* @__PURE__ */ jsx23(IconCodeDots, { size: 15, stroke: 1.3 }),
|
|
4480
|
+
zset: /* @__PURE__ */ jsx23(IconArrowsSort, { size: 15, stroke: 1.3 }),
|
|
4481
|
+
list: /* @__PURE__ */ jsx23(IconList, { size: 15, stroke: 1.3 }),
|
|
4482
|
+
stream: /* @__PURE__ */ jsx23(IconList, { size: 15, stroke: 1.3 })
|
|
4356
4483
|
};
|
|
4357
4484
|
var tagVariants = cva("inline-flex shrink-0 items-center rounded-md justify-center", {
|
|
4358
4485
|
variants: {
|
|
@@ -4376,7 +4503,7 @@ var tagVariants = cva("inline-flex shrink-0 items-center rounded-md justify-cent
|
|
|
4376
4503
|
}
|
|
4377
4504
|
});
|
|
4378
4505
|
function TypeTag({ className, variant, type }) {
|
|
4379
|
-
return /* @__PURE__ */
|
|
4506
|
+
return /* @__PURE__ */ jsx23("span", { className: cn(tagVariants({ variant, type, className })), children: type === "icon" ? iconsMap[variant] : DATA_TYPE_NAMES[variant] });
|
|
4380
4507
|
}
|
|
4381
4508
|
|
|
4382
4509
|
// src/components/databrowser/components/display/key-actions.tsx
|
|
@@ -4386,7 +4513,7 @@ import { IconDotsVertical } from "@tabler/icons-react";
|
|
|
4386
4513
|
import * as React10 from "react";
|
|
4387
4514
|
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
4388
4515
|
import { CheckIcon as CheckIcon2, ChevronRightIcon as ChevronRightIcon2, DotFilledIcon as DotFilledIcon2 } from "@radix-ui/react-icons";
|
|
4389
|
-
import { jsx as
|
|
4516
|
+
import { jsx as jsx24, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
4390
4517
|
var DropdownMenu = DropdownMenuPrimitive.Root;
|
|
4391
4518
|
var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
4392
4519
|
var DropdownMenuSubTrigger = React10.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs14(
|
|
@@ -4394,45 +4521,45 @@ var DropdownMenuSubTrigger = React10.forwardRef(({ className, inset, children, .
|
|
|
4394
4521
|
{
|
|
4395
4522
|
ref,
|
|
4396
4523
|
className: cn(
|
|
4397
|
-
"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-
|
|
4524
|
+
"flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-neutral-100 data-[state=open]:bg-neutral-100 dark:focus:bg-neutral-800 dark:data-[state=open]:bg-neutral-800 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
4398
4525
|
inset && "pl-8",
|
|
4399
4526
|
className
|
|
4400
4527
|
),
|
|
4401
4528
|
...props,
|
|
4402
4529
|
children: [
|
|
4403
4530
|
children,
|
|
4404
|
-
/* @__PURE__ */
|
|
4531
|
+
/* @__PURE__ */ jsx24(ChevronRightIcon2, { className: "ml-auto" })
|
|
4405
4532
|
]
|
|
4406
4533
|
}
|
|
4407
4534
|
));
|
|
4408
4535
|
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
|
|
4409
|
-
var DropdownMenuSubContent = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
4536
|
+
var DropdownMenuSubContent = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
4410
4537
|
DropdownMenuPrimitive.SubContent,
|
|
4411
4538
|
{
|
|
4412
4539
|
ref,
|
|
4413
4540
|
className: cn(
|
|
4414
|
-
"z-50 min-w-[8rem] overflow-hidden rounded-md border border-neutral-200 bg-white p-1 text-neutral-950 shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50",
|
|
4541
|
+
"z-50 min-w-[8rem] origin-[--radix-dropdown-menu-content-transform-origin] overflow-hidden rounded-md border border-neutral-200 bg-white p-1 text-neutral-950 shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50",
|
|
4415
4542
|
className
|
|
4416
4543
|
),
|
|
4417
4544
|
...props
|
|
4418
4545
|
}
|
|
4419
4546
|
));
|
|
4420
4547
|
DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
|
|
4421
|
-
var DropdownMenuContent = React10.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */
|
|
4548
|
+
var DropdownMenuContent = React10.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx24(DropdownMenuPrimitive.Portal, { container: portalRoot, children: /* @__PURE__ */ jsx24(
|
|
4422
4549
|
DropdownMenuPrimitive.Content,
|
|
4423
4550
|
{
|
|
4424
4551
|
ref,
|
|
4425
4552
|
sideOffset,
|
|
4426
4553
|
className: cn(
|
|
4427
|
-
"z-50 min-w-[8rem] overflow-hidden rounded-md border border-neutral-200 bg-white p-1 text-neutral-950 shadow-md dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50",
|
|
4428
|
-
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
4554
|
+
"z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border border-neutral-200 bg-white p-1 text-neutral-950 shadow-md dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50",
|
|
4555
|
+
"origin-[--radix-dropdown-menu-content-transform-origin] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
4429
4556
|
className
|
|
4430
4557
|
),
|
|
4431
4558
|
...props
|
|
4432
4559
|
}
|
|
4433
4560
|
) }));
|
|
4434
4561
|
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
4435
|
-
var DropdownMenuItem = React10.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */
|
|
4562
|
+
var DropdownMenuItem = React10.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
4436
4563
|
DropdownMenuPrimitive.Item,
|
|
4437
4564
|
{
|
|
4438
4565
|
ref,
|
|
@@ -4456,7 +4583,7 @@ var DropdownMenuCheckboxItem = React10.forwardRef(({ className, children, checke
|
|
|
4456
4583
|
checked,
|
|
4457
4584
|
...props,
|
|
4458
4585
|
children: [
|
|
4459
|
-
/* @__PURE__ */
|
|
4586
|
+
/* @__PURE__ */ jsx24("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx24(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx24(CheckIcon2, { className: "h-4 w-4" }) }) }),
|
|
4460
4587
|
children
|
|
4461
4588
|
]
|
|
4462
4589
|
}
|
|
@@ -4472,13 +4599,13 @@ var DropdownMenuRadioItem = React10.forwardRef(({ className, children, ...props
|
|
|
4472
4599
|
),
|
|
4473
4600
|
...props,
|
|
4474
4601
|
children: [
|
|
4475
|
-
/* @__PURE__ */
|
|
4602
|
+
/* @__PURE__ */ jsx24("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx24(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx24(DotFilledIcon2, { className: "h-2 w-2 fill-current" }) }) }),
|
|
4476
4603
|
children
|
|
4477
4604
|
]
|
|
4478
4605
|
}
|
|
4479
4606
|
));
|
|
4480
4607
|
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
|
|
4481
|
-
var DropdownMenuLabel = React10.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */
|
|
4608
|
+
var DropdownMenuLabel = React10.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
4482
4609
|
DropdownMenuPrimitive.Label,
|
|
4483
4610
|
{
|
|
4484
4611
|
ref,
|
|
@@ -4487,7 +4614,7 @@ var DropdownMenuLabel = React10.forwardRef(({ className, inset, ...props }, ref)
|
|
|
4487
4614
|
}
|
|
4488
4615
|
));
|
|
4489
4616
|
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
|
|
4490
|
-
var DropdownMenuSeparator = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
4617
|
+
var DropdownMenuSeparator = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
4491
4618
|
DropdownMenuPrimitive.Separator,
|
|
4492
4619
|
{
|
|
4493
4620
|
ref,
|
|
@@ -4497,18 +4624,18 @@ var DropdownMenuSeparator = React10.forwardRef(({ className, ...props }, ref) =>
|
|
|
4497
4624
|
));
|
|
4498
4625
|
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
|
|
4499
4626
|
var DropdownMenuShortcut = ({ className, ...props }) => {
|
|
4500
|
-
return /* @__PURE__ */
|
|
4627
|
+
return /* @__PURE__ */ jsx24("span", { className: cn("ml-auto text-xs tracking-widest opacity-60", className), ...props });
|
|
4501
4628
|
};
|
|
4502
4629
|
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
4503
4630
|
|
|
4504
4631
|
// src/components/databrowser/components/display/key-actions.tsx
|
|
4505
|
-
import { jsx as
|
|
4632
|
+
import { jsx as jsx25, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
4506
4633
|
function KeyActions({ dataKey, content }) {
|
|
4507
4634
|
const { mutateAsync: deleteKey } = useDeleteKey();
|
|
4508
4635
|
return /* @__PURE__ */ jsxs15(DropdownMenu, { children: [
|
|
4509
|
-
/* @__PURE__ */
|
|
4636
|
+
/* @__PURE__ */ jsx25(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx25(Button, { size: "icon-sm", children: /* @__PURE__ */ jsx25(IconDotsVertical, { className: "size-4 text-zinc-500" }) }) }),
|
|
4510
4637
|
/* @__PURE__ */ jsxs15(DropdownMenuContent, { className: "", align: "end", children: [
|
|
4511
|
-
content && /* @__PURE__ */
|
|
4638
|
+
content && /* @__PURE__ */ jsx25(
|
|
4512
4639
|
DropdownMenuItem,
|
|
4513
4640
|
{
|
|
4514
4641
|
onClick: () => {
|
|
@@ -4520,12 +4647,12 @@ function KeyActions({ dataKey, content }) {
|
|
|
4520
4647
|
children: "Copy content"
|
|
4521
4648
|
}
|
|
4522
4649
|
),
|
|
4523
|
-
/* @__PURE__ */
|
|
4650
|
+
/* @__PURE__ */ jsx25(
|
|
4524
4651
|
DeleteAlertDialog,
|
|
4525
4652
|
{
|
|
4526
4653
|
deletionType: "key",
|
|
4527
4654
|
onDeleteConfirm: async () => await deleteKey(dataKey),
|
|
4528
|
-
children: /* @__PURE__ */
|
|
4655
|
+
children: /* @__PURE__ */ jsx25(DropdownMenuItem, { onSelect: (e) => e.preventDefault(), children: "Delete key" })
|
|
4529
4656
|
}
|
|
4530
4657
|
)
|
|
4531
4658
|
] })
|
|
@@ -4533,29 +4660,29 @@ function KeyActions({ dataKey, content }) {
|
|
|
4533
4660
|
}
|
|
4534
4661
|
|
|
4535
4662
|
// src/components/databrowser/components/display/display-header.tsx
|
|
4536
|
-
import { jsx as
|
|
4663
|
+
import { jsx as jsx26, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
4537
4664
|
var DisplayHeader = ({
|
|
4538
4665
|
dataKey,
|
|
4539
4666
|
type,
|
|
4540
4667
|
content
|
|
4541
4668
|
}) => {
|
|
4542
|
-
const { setSelectedListItem } =
|
|
4669
|
+
const { setSelectedListItem } = useTab();
|
|
4543
4670
|
const handleAddItem = () => {
|
|
4544
4671
|
setSelectedListItem({ key: type === "stream" ? "*" : "", isNew: true });
|
|
4545
4672
|
};
|
|
4546
|
-
return /* @__PURE__ */ jsxs16("div", { className: "rounded-lg bg-zinc-100
|
|
4673
|
+
return /* @__PURE__ */ jsxs16("div", { className: "rounded-lg bg-zinc-100", children: [
|
|
4547
4674
|
/* @__PURE__ */ jsxs16("div", { className: "flex min-h-10 items-center justify-between gap-4", children: [
|
|
4548
|
-
/* @__PURE__ */
|
|
4675
|
+
/* @__PURE__ */ jsx26("h2", { className: "grow truncate text-base", children: dataKey.trim() === "" ? /* @__PURE__ */ jsx26("span", { className: "ml-1 text-zinc-500", children: "(Empty Key)" }) : /* @__PURE__ */ jsx26("span", { className: "font-semibold", children: dataKey }) }),
|
|
4549
4676
|
/* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-1", children: [
|
|
4550
|
-
type !== "string" && type !== "json" && /* @__PURE__ */
|
|
4551
|
-
/* @__PURE__ */
|
|
4677
|
+
type !== "string" && type !== "json" && /* @__PURE__ */ jsx26(Button, { onClick: handleAddItem, size: "icon-sm", children: /* @__PURE__ */ jsx26(IconPlus, { className: "size-4 text-zinc-500" }) }),
|
|
4678
|
+
/* @__PURE__ */ jsx26(KeyActions, { dataKey, content })
|
|
4552
4679
|
] })
|
|
4553
4680
|
] }),
|
|
4554
4681
|
/* @__PURE__ */ jsxs16("div", { className: "flex h-10 flex-wrap items-center gap-1.5", children: [
|
|
4555
|
-
/* @__PURE__ */
|
|
4556
|
-
/* @__PURE__ */
|
|
4557
|
-
/* @__PURE__ */
|
|
4558
|
-
/* @__PURE__ */
|
|
4682
|
+
/* @__PURE__ */ jsx26(TypeTag, { variant: type, type: "badge" }),
|
|
4683
|
+
/* @__PURE__ */ jsx26(SizeBadge, { dataKey }),
|
|
4684
|
+
/* @__PURE__ */ jsx26(LengthBadge, { dataKey, type, content }),
|
|
4685
|
+
/* @__PURE__ */ jsx26(HeaderTTLBadge, { dataKey })
|
|
4559
4686
|
] })
|
|
4560
4687
|
] });
|
|
4561
4688
|
};
|
|
@@ -4566,10 +4693,10 @@ import { Controller as Controller2, FormProvider, useForm as useForm2, useFormCo
|
|
|
4566
4693
|
// src/components/ui/tooltip.tsx
|
|
4567
4694
|
import * as React11 from "react";
|
|
4568
4695
|
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
4569
|
-
import { Fragment as Fragment3, jsx as
|
|
4696
|
+
import { Fragment as Fragment3, jsx as jsx27, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
4570
4697
|
var Tooltip = TooltipPrimitive.Root;
|
|
4571
4698
|
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
4572
|
-
var TooltipContent = React11.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */
|
|
4699
|
+
var TooltipContent = React11.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx27(
|
|
4573
4700
|
TooltipPrimitive.Content,
|
|
4574
4701
|
{
|
|
4575
4702
|
ref,
|
|
@@ -4586,10 +4713,10 @@ var SimpleTooltip = ({
|
|
|
4586
4713
|
content,
|
|
4587
4714
|
children
|
|
4588
4715
|
}) => {
|
|
4589
|
-
if (!content) return /* @__PURE__ */
|
|
4716
|
+
if (!content) return /* @__PURE__ */ jsx27(Fragment3, { children });
|
|
4590
4717
|
return /* @__PURE__ */ jsxs17(Tooltip, { delayDuration: 400, children: [
|
|
4591
|
-
/* @__PURE__ */
|
|
4592
|
-
/* @__PURE__ */
|
|
4718
|
+
/* @__PURE__ */ jsx27(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx27("div", { children }) }),
|
|
4719
|
+
/* @__PURE__ */ jsx27(TooltipContent, { children: content })
|
|
4593
4720
|
] });
|
|
4594
4721
|
};
|
|
4595
4722
|
|
|
@@ -4600,7 +4727,7 @@ var useFetchHashFieldExpires = ({
|
|
|
4600
4727
|
dataKey,
|
|
4601
4728
|
fields
|
|
4602
4729
|
}) => {
|
|
4603
|
-
const { redis } =
|
|
4730
|
+
const { redis } = useRedis();
|
|
4604
4731
|
return useQuery7({
|
|
4605
4732
|
queryKey: [FETCH_HASH_FIELD_TTLS_QUERY_KEY, dataKey, fields],
|
|
4606
4733
|
queryFn: async () => {
|
|
@@ -4631,7 +4758,7 @@ var useFetchHashFieldExpires = ({
|
|
|
4631
4758
|
// src/components/databrowser/hooks/use-set-hash-ttl.ts
|
|
4632
4759
|
import { useMutation as useMutation6 } from "@tanstack/react-query";
|
|
4633
4760
|
var useSetHashTTL = () => {
|
|
4634
|
-
const { redis } =
|
|
4761
|
+
const { redis } = useRedis();
|
|
4635
4762
|
return useMutation6({
|
|
4636
4763
|
mutationFn: async ({
|
|
4637
4764
|
dataKey,
|
|
@@ -4649,12 +4776,12 @@ var useSetHashTTL = () => {
|
|
|
4649
4776
|
};
|
|
4650
4777
|
|
|
4651
4778
|
// src/components/databrowser/components/display/hash/hash-field-ttl-badge.tsx
|
|
4652
|
-
import { jsx as
|
|
4779
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
4653
4780
|
var HashFieldTTLBadge = ({ dataKey, field }) => {
|
|
4654
4781
|
const { data } = useFetchHashFieldExpires({ dataKey, fields: [field] });
|
|
4655
4782
|
const { mutate: setTTL, isPending } = useSetHashTTL();
|
|
4656
4783
|
const expireAt = data?.[field];
|
|
4657
|
-
return /* @__PURE__ */
|
|
4784
|
+
return /* @__PURE__ */ jsx28(
|
|
4658
4785
|
TTLBadge,
|
|
4659
4786
|
{
|
|
4660
4787
|
label: "Field TTL:",
|
|
@@ -4666,23 +4793,23 @@ var HashFieldTTLBadge = ({ dataKey, field }) => {
|
|
|
4666
4793
|
};
|
|
4667
4794
|
|
|
4668
4795
|
// src/components/databrowser/components/display/input/use-field.tsx
|
|
4669
|
-
import { useEffect as useEffect7, useState as
|
|
4796
|
+
import { useEffect as useEffect7, useState as useState7 } from "react";
|
|
4670
4797
|
import { useController } from "react-hook-form";
|
|
4671
4798
|
|
|
4672
4799
|
// src/components/databrowser/components/display/input/content-type-select.tsx
|
|
4673
|
-
import { useMemo as
|
|
4674
|
-
import { jsx as
|
|
4800
|
+
import { useMemo as useMemo6 } from "react";
|
|
4801
|
+
import { jsx as jsx29, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4675
4802
|
var ContentTypeSelect = ({
|
|
4676
4803
|
value,
|
|
4677
4804
|
onChange,
|
|
4678
4805
|
data
|
|
4679
4806
|
}) => {
|
|
4680
|
-
const isValidJSON =
|
|
4807
|
+
const isValidJSON = useMemo6(() => checkIsValidJSON(data), [data]);
|
|
4681
4808
|
return /* @__PURE__ */ jsxs18(Select, { value, onValueChange: onChange, children: [
|
|
4682
|
-
/* @__PURE__ */
|
|
4683
|
-
/* @__PURE__ */
|
|
4684
|
-
/* @__PURE__ */
|
|
4685
|
-
/* @__PURE__ */
|
|
4809
|
+
/* @__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" }) }),
|
|
4810
|
+
/* @__PURE__ */ jsx29(SelectContent, { children: /* @__PURE__ */ jsxs18(SelectGroup, { children: [
|
|
4811
|
+
/* @__PURE__ */ jsx29(SelectItem, { value: "Text", children: "Text" }),
|
|
4812
|
+
/* @__PURE__ */ jsx29(SelectItem, { disabled: !isValidJSON, value: "JSON", children: "JSON" })
|
|
4686
4813
|
] }) })
|
|
4687
4814
|
] });
|
|
4688
4815
|
};
|
|
@@ -4692,12 +4819,12 @@ import { useEffect as useEffect6, useRef } from "react";
|
|
|
4692
4819
|
import { Editor, useMonaco } from "@monaco-editor/react";
|
|
4693
4820
|
|
|
4694
4821
|
// src/components/databrowser/copy-button.tsx
|
|
4695
|
-
import { useState as
|
|
4822
|
+
import { useState as useState6 } from "react";
|
|
4696
4823
|
import { IconCheck, IconCopy } from "@tabler/icons-react";
|
|
4697
|
-
import { jsx as
|
|
4824
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
4698
4825
|
function CopyButton({ value, ...props }) {
|
|
4699
|
-
const [copied, setCopied] =
|
|
4700
|
-
return /* @__PURE__ */
|
|
4826
|
+
const [copied, setCopied] = useState6(false);
|
|
4827
|
+
return /* @__PURE__ */ jsx30(
|
|
4701
4828
|
Button,
|
|
4702
4829
|
{
|
|
4703
4830
|
onClick: (e) => {
|
|
@@ -4714,7 +4841,7 @@ function CopyButton({ value, ...props }) {
|
|
|
4714
4841
|
variant: "secondary",
|
|
4715
4842
|
size: "icon-sm",
|
|
4716
4843
|
...props,
|
|
4717
|
-
children: copied ? /* @__PURE__ */
|
|
4844
|
+
children: copied ? /* @__PURE__ */ jsx30(IconCheck, { className: "size-4 text-green-500" }) : /* @__PURE__ */ jsx30(IconCopy, { className: "size-4 text-zinc-500" })
|
|
4718
4845
|
}
|
|
4719
4846
|
);
|
|
4720
4847
|
}
|
|
@@ -4727,7 +4854,7 @@ var handleCopyClick = async (textToCopy) => {
|
|
|
4727
4854
|
};
|
|
4728
4855
|
|
|
4729
4856
|
// src/components/databrowser/components/display/input/custom-editor.tsx
|
|
4730
|
-
import { jsx as
|
|
4857
|
+
import { jsx as jsx31, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4731
4858
|
var CustomEditor = ({
|
|
4732
4859
|
language,
|
|
4733
4860
|
value,
|
|
@@ -4752,7 +4879,7 @@ var CustomEditor = ({
|
|
|
4752
4879
|
height
|
|
4753
4880
|
},
|
|
4754
4881
|
children: [
|
|
4755
|
-
/* @__PURE__ */
|
|
4882
|
+
/* @__PURE__ */ jsx31(
|
|
4756
4883
|
Editor,
|
|
4757
4884
|
{
|
|
4758
4885
|
loading: void 0,
|
|
@@ -4793,7 +4920,7 @@ var CustomEditor = ({
|
|
|
4793
4920
|
}
|
|
4794
4921
|
}
|
|
4795
4922
|
),
|
|
4796
|
-
showCopyButton && /* @__PURE__ */
|
|
4923
|
+
showCopyButton && /* @__PURE__ */ jsx31(
|
|
4797
4924
|
CopyButton,
|
|
4798
4925
|
{
|
|
4799
4926
|
value,
|
|
@@ -4806,7 +4933,7 @@ var CustomEditor = ({
|
|
|
4806
4933
|
};
|
|
4807
4934
|
|
|
4808
4935
|
// src/components/databrowser/components/display/input/use-field.tsx
|
|
4809
|
-
import { Fragment as Fragment4, jsx as
|
|
4936
|
+
import { Fragment as Fragment4, jsx as jsx32 } from "react/jsx-runtime";
|
|
4810
4937
|
var useField = ({
|
|
4811
4938
|
name,
|
|
4812
4939
|
form,
|
|
@@ -4819,7 +4946,7 @@ var useField = ({
|
|
|
4819
4946
|
name,
|
|
4820
4947
|
control: form.control
|
|
4821
4948
|
});
|
|
4822
|
-
const [contentType, setContentType] =
|
|
4949
|
+
const [contentType, setContentType] = useState7(
|
|
4823
4950
|
() => checkIsValidJSON(field.value) ? "JSON" : "Text"
|
|
4824
4951
|
);
|
|
4825
4952
|
useEffect7(() => {
|
|
@@ -4846,8 +4973,8 @@ var useField = ({
|
|
|
4846
4973
|
}
|
|
4847
4974
|
};
|
|
4848
4975
|
return {
|
|
4849
|
-
selector: /* @__PURE__ */
|
|
4850
|
-
editor: /* @__PURE__ */
|
|
4976
|
+
selector: /* @__PURE__ */ jsx32(ContentTypeSelect, { value: contentType, onChange: handleTypeChange, data: field.value }),
|
|
4977
|
+
editor: /* @__PURE__ */ jsx32(Fragment4, { children: /* @__PURE__ */ jsx32(
|
|
4851
4978
|
CustomEditor,
|
|
4852
4979
|
{
|
|
4853
4980
|
language: contentType === "JSON" ? "json" : "plaintext",
|
|
@@ -4871,13 +4998,13 @@ var checkIsValidJSON = (value) => {
|
|
|
4871
4998
|
};
|
|
4872
4999
|
|
|
4873
5000
|
// src/components/databrowser/components/display/display-list-edit.tsx
|
|
4874
|
-
import { jsx as
|
|
5001
|
+
import { jsx as jsx33, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4875
5002
|
var ListEditDisplay = ({
|
|
4876
5003
|
dataKey,
|
|
4877
5004
|
type,
|
|
4878
5005
|
item
|
|
4879
5006
|
}) => {
|
|
4880
|
-
return /* @__PURE__ */
|
|
5007
|
+
return /* @__PURE__ */ jsx33("div", { className: "grow rounded-md bg-zinc-100", children: /* @__PURE__ */ jsx33(ListEditForm, { item, type, dataKey }, item.key) });
|
|
4881
5008
|
};
|
|
4882
5009
|
var ListEditForm = ({
|
|
4883
5010
|
type,
|
|
@@ -4903,7 +5030,7 @@ var ListEditForm = ({
|
|
|
4903
5030
|
}
|
|
4904
5031
|
});
|
|
4905
5032
|
const { mutateAsync: editItem, isPending } = useEditListItem();
|
|
4906
|
-
const { setSelectedListItem } =
|
|
5033
|
+
const { setSelectedListItem } = useTab();
|
|
4907
5034
|
const [keyLabel, valueLabel] = headerLabels[type];
|
|
4908
5035
|
const onSubmit = form.handleSubmit(async ({ key, value }) => {
|
|
4909
5036
|
await editItem({
|
|
@@ -4916,9 +5043,9 @@ var ListEditForm = ({
|
|
|
4916
5043
|
});
|
|
4917
5044
|
setSelectedListItem(void 0);
|
|
4918
5045
|
});
|
|
4919
|
-
return /* @__PURE__ */
|
|
5046
|
+
return /* @__PURE__ */ jsx33(FormProvider, { ...form, children: /* @__PURE__ */ jsxs20("form", { onSubmit, className: "flex flex-col gap-2", children: [
|
|
4920
5047
|
/* @__PURE__ */ jsxs20("div", { className: "flex grow flex-col gap-2", children: [
|
|
4921
|
-
type !== "list" && /* @__PURE__ */
|
|
5048
|
+
type !== "list" && /* @__PURE__ */ jsx33(
|
|
4922
5049
|
FormItem,
|
|
4923
5050
|
{
|
|
4924
5051
|
readOnly: type === "stream",
|
|
@@ -4928,7 +5055,7 @@ var ListEditForm = ({
|
|
|
4928
5055
|
data: itemKey
|
|
4929
5056
|
}
|
|
4930
5057
|
),
|
|
4931
|
-
type === "zset" ? /* @__PURE__ */
|
|
5058
|
+
type === "zset" ? /* @__PURE__ */ jsx33(NumberFormItem, { name: "value", label: valueLabel }) : type !== "set" && /* @__PURE__ */ jsx33(
|
|
4932
5059
|
FormItem,
|
|
4933
5060
|
{
|
|
4934
5061
|
readOnly: type === "stream",
|
|
@@ -4947,9 +5074,9 @@ var ListEditForm = ({
|
|
|
4947
5074
|
type === "hash" && itemKey !== "" ? "justify-between" : "justify-end"
|
|
4948
5075
|
),
|
|
4949
5076
|
children: [
|
|
4950
|
-
type === "hash" && itemKey !== "" && /* @__PURE__ */
|
|
5077
|
+
type === "hash" && itemKey !== "" && /* @__PURE__ */ jsx33(HashFieldTTLBadge, { dataKey, field: itemKey }),
|
|
4951
5078
|
/* @__PURE__ */ jsxs20("div", { className: "flex gap-2", children: [
|
|
4952
|
-
/* @__PURE__ */
|
|
5079
|
+
/* @__PURE__ */ jsx33(
|
|
4953
5080
|
Button,
|
|
4954
5081
|
{
|
|
4955
5082
|
type: "button",
|
|
@@ -4959,17 +5086,17 @@ var ListEditForm = ({
|
|
|
4959
5086
|
children: "Cancel"
|
|
4960
5087
|
}
|
|
4961
5088
|
),
|
|
4962
|
-
/* @__PURE__ */
|
|
5089
|
+
/* @__PURE__ */ jsx33(
|
|
4963
5090
|
SimpleTooltip,
|
|
4964
5091
|
{
|
|
4965
5092
|
content: type === "stream" && !isNew ? "Streams are not mutable" : void 0,
|
|
4966
|
-
children: /* @__PURE__ */
|
|
5093
|
+
children: /* @__PURE__ */ jsx33(
|
|
4967
5094
|
Button,
|
|
4968
5095
|
{
|
|
4969
5096
|
variant: "primary",
|
|
4970
5097
|
type: "submit",
|
|
4971
5098
|
disabled: !form.formState.isValid || !form.formState.isDirty || type === "stream" && !isNew,
|
|
4972
|
-
children: /* @__PURE__ */
|
|
5099
|
+
children: /* @__PURE__ */ jsx33(Spinner, { isLoading: isPending, isLoadingText: "Saving", children: "Save" })
|
|
4973
5100
|
}
|
|
4974
5101
|
)
|
|
4975
5102
|
}
|
|
@@ -4982,12 +5109,12 @@ var ListEditForm = ({
|
|
|
4982
5109
|
};
|
|
4983
5110
|
var NumberFormItem = ({ name, label }) => {
|
|
4984
5111
|
return /* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-1", children: [
|
|
4985
|
-
/* @__PURE__ */
|
|
4986
|
-
/* @__PURE__ */
|
|
5112
|
+
/* @__PURE__ */ jsx33("div", { className: "flex", children: /* @__PURE__ */ jsx33("span", { className: "text-xs font-medium text-zinc-700", children: label }) }),
|
|
5113
|
+
/* @__PURE__ */ jsx33(
|
|
4987
5114
|
Controller2,
|
|
4988
5115
|
{
|
|
4989
5116
|
name,
|
|
4990
|
-
render: ({ field }) => /* @__PURE__ */
|
|
5117
|
+
render: ({ field }) => /* @__PURE__ */ jsx33(
|
|
4991
5118
|
"input",
|
|
4992
5119
|
{
|
|
4993
5120
|
className: "plain-input rounded-md border border-zinc-300 px-3 py-1 shadow-sm",
|
|
@@ -5017,18 +5144,18 @@ var FormItem = ({
|
|
|
5017
5144
|
});
|
|
5018
5145
|
return /* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-1", children: [
|
|
5019
5146
|
/* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-1 text-xs", children: [
|
|
5020
|
-
/* @__PURE__ */
|
|
5147
|
+
/* @__PURE__ */ jsx33("span", { className: "font-medium text-zinc-700", children: label }),
|
|
5021
5148
|
" ",
|
|
5022
|
-
/* @__PURE__ */
|
|
5149
|
+
/* @__PURE__ */ jsx33("span", { className: "text-zinc-300", children: "/" }),
|
|
5023
5150
|
selector
|
|
5024
5151
|
] }),
|
|
5025
|
-
/* @__PURE__ */
|
|
5152
|
+
/* @__PURE__ */ jsx33("div", { className: "overflow-hidden rounded-md border border-zinc-300 bg-white p-2 shadow-sm", children: editor })
|
|
5026
5153
|
] });
|
|
5027
5154
|
};
|
|
5028
5155
|
|
|
5029
5156
|
// src/components/databrowser/components/display/hash/hash-field-ttl-info.tsx
|
|
5030
|
-
import { useEffect as useEffect8, useState as
|
|
5031
|
-
import { jsx as
|
|
5157
|
+
import { useEffect as useEffect8, useState as useState8 } from "react";
|
|
5158
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
5032
5159
|
var HashFieldTTLInfo = ({
|
|
5033
5160
|
dataKey,
|
|
5034
5161
|
field,
|
|
@@ -5036,7 +5163,7 @@ var HashFieldTTLInfo = ({
|
|
|
5036
5163
|
}) => {
|
|
5037
5164
|
const { data } = useFetchHashFieldExpires({ dataKey, fields });
|
|
5038
5165
|
const expireAt = data?.[field];
|
|
5039
|
-
const [ttl, setTTL] =
|
|
5166
|
+
const [ttl, setTTL] = useState8(() => calculateTTL(expireAt));
|
|
5040
5167
|
useEffect8(() => {
|
|
5041
5168
|
setTTL(calculateTTL(expireAt));
|
|
5042
5169
|
const interval = setInterval(() => {
|
|
@@ -5045,11 +5172,11 @@ var HashFieldTTLInfo = ({
|
|
|
5045
5172
|
return () => clearInterval(interval);
|
|
5046
5173
|
}, [expireAt]);
|
|
5047
5174
|
if (!expireAt || expireAt === TTL_NOT_FOUND || expireAt === TTL_INFINITE) return;
|
|
5048
|
-
return /* @__PURE__ */
|
|
5175
|
+
return /* @__PURE__ */ jsx34("span", { className: "block min-w-[30px] whitespace-nowrap text-right text-red-600", children: formatTime(ttl ?? 0) });
|
|
5049
5176
|
};
|
|
5050
5177
|
|
|
5051
5178
|
// src/components/databrowser/components/display/display-list.tsx
|
|
5052
|
-
import { Fragment as Fragment5, jsx as
|
|
5179
|
+
import { Fragment as Fragment5, jsx as jsx35, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
5053
5180
|
var headerLabels = {
|
|
5054
5181
|
list: ["Index", "Content"],
|
|
5055
5182
|
hash: ["Field", "Value"],
|
|
@@ -5058,12 +5185,12 @@ var headerLabels = {
|
|
|
5058
5185
|
set: ["Value", ""]
|
|
5059
5186
|
};
|
|
5060
5187
|
var ListDisplay = ({ dataKey, type }) => {
|
|
5061
|
-
const { selectedListItem } =
|
|
5188
|
+
const { selectedListItem } = useTab();
|
|
5062
5189
|
const query = useFetchListItems({ dataKey, type });
|
|
5063
5190
|
return /* @__PURE__ */ jsxs21("div", { className: "flex h-full flex-col gap-2", children: [
|
|
5064
|
-
/* @__PURE__ */
|
|
5065
|
-
selectedListItem && /* @__PURE__ */
|
|
5066
|
-
/* @__PURE__ */
|
|
5191
|
+
/* @__PURE__ */ jsx35(DisplayHeader, { dataKey, type }),
|
|
5192
|
+
selectedListItem && /* @__PURE__ */ jsx35(ListEditDisplay, { dataKey, type, item: selectedListItem }),
|
|
5193
|
+
/* @__PURE__ */ jsx35("div", { className: cn("min-h-0 grow", selectedListItem && "hidden"), children: /* @__PURE__ */ jsx35(InfiniteScroll, { query, children: /* @__PURE__ */ jsx35("table", { className: "w-full", children: /* @__PURE__ */ jsx35(ItemContextMenu, { dataKey, type, children: /* @__PURE__ */ jsx35("tbody", { children: /* @__PURE__ */ jsx35(ListItems, { dataKey, type, query }) }) }) }) }) })
|
|
5067
5194
|
] });
|
|
5068
5195
|
};
|
|
5069
5196
|
var ListItems = ({
|
|
@@ -5071,11 +5198,11 @@ var ListItems = ({
|
|
|
5071
5198
|
type,
|
|
5072
5199
|
dataKey
|
|
5073
5200
|
}) => {
|
|
5074
|
-
const { setSelectedListItem } =
|
|
5075
|
-
const keys =
|
|
5076
|
-
const fields =
|
|
5201
|
+
const { setSelectedListItem } = useTab();
|
|
5202
|
+
const keys = useMemo7(() => query.data?.pages.flatMap((page) => page.keys) ?? [], [query.data]);
|
|
5203
|
+
const fields = useMemo7(() => keys.map((key) => key.key), [keys]);
|
|
5077
5204
|
const { mutate: editItem } = useEditListItem();
|
|
5078
|
-
return /* @__PURE__ */
|
|
5205
|
+
return /* @__PURE__ */ jsx35(Fragment5, { children: keys.map(({ key, value }, i) => /* @__PURE__ */ jsxs21(
|
|
5079
5206
|
"tr",
|
|
5080
5207
|
{
|
|
5081
5208
|
"data-item-key": key,
|
|
@@ -5083,9 +5210,9 @@ var ListItems = ({
|
|
|
5083
5210
|
onClick: () => {
|
|
5084
5211
|
setSelectedListItem({ key });
|
|
5085
5212
|
},
|
|
5086
|
-
className: cn("h-10 border-b border-b-zinc-100 hover:bg-zinc-100
|
|
5213
|
+
className: cn("h-10 border-b border-b-zinc-100 transition-colors hover:bg-zinc-100"),
|
|
5087
5214
|
children: [
|
|
5088
|
-
/* @__PURE__ */
|
|
5215
|
+
/* @__PURE__ */ jsx35(
|
|
5089
5216
|
"td",
|
|
5090
5217
|
{
|
|
5091
5218
|
className: cn(
|
|
@@ -5095,14 +5222,14 @@ var ListItems = ({
|
|
|
5095
5222
|
children: key
|
|
5096
5223
|
}
|
|
5097
5224
|
),
|
|
5098
|
-
value !== void 0 && /* @__PURE__ */
|
|
5225
|
+
value !== void 0 && /* @__PURE__ */ jsx35(
|
|
5099
5226
|
"td",
|
|
5100
5227
|
{
|
|
5101
5228
|
className: cn("cursor-pointer truncate px-3", type === "zset" ? "w-24" : "max-w-0"),
|
|
5102
5229
|
children: value
|
|
5103
5230
|
}
|
|
5104
5231
|
),
|
|
5105
|
-
type !== "stream" && /* @__PURE__ */
|
|
5232
|
+
type !== "stream" && /* @__PURE__ */ jsx35(
|
|
5106
5233
|
"td",
|
|
5107
5234
|
{
|
|
5108
5235
|
className: "w-0 min-w-0 p-0",
|
|
@@ -5110,8 +5237,8 @@ var ListItems = ({
|
|
|
5110
5237
|
e.stopPropagation();
|
|
5111
5238
|
},
|
|
5112
5239
|
children: /* @__PURE__ */ jsxs21("div", { className: "flex items-center justify-end gap-2", children: [
|
|
5113
|
-
type === "hash" && /* @__PURE__ */
|
|
5114
|
-
/* @__PURE__ */
|
|
5240
|
+
type === "hash" && /* @__PURE__ */ jsx35(HashFieldTTLInfo, { dataKey, field: key, fields }),
|
|
5241
|
+
/* @__PURE__ */ jsx35(
|
|
5115
5242
|
DeleteAlertDialog,
|
|
5116
5243
|
{
|
|
5117
5244
|
deletionType: "item",
|
|
@@ -5125,14 +5252,14 @@ var ListItems = ({
|
|
|
5125
5252
|
newKey: void 0
|
|
5126
5253
|
});
|
|
5127
5254
|
},
|
|
5128
|
-
children: /* @__PURE__ */
|
|
5255
|
+
children: /* @__PURE__ */ jsx35(
|
|
5129
5256
|
Button,
|
|
5130
5257
|
{
|
|
5131
5258
|
className: "",
|
|
5132
5259
|
size: "icon-sm",
|
|
5133
5260
|
variant: "secondary",
|
|
5134
5261
|
onClick: (e) => e.stopPropagation(),
|
|
5135
|
-
children: /* @__PURE__ */
|
|
5262
|
+
children: /* @__PURE__ */ jsx35(IconTrash, { className: "size-4 text-zinc-500" })
|
|
5136
5263
|
}
|
|
5137
5264
|
)
|
|
5138
5265
|
}
|
|
@@ -5149,18 +5276,12 @@ var ListItems = ({
|
|
|
5149
5276
|
// src/components/databrowser/components/display/display-simple.tsx
|
|
5150
5277
|
import { useEffect as useEffect9 } from "react";
|
|
5151
5278
|
import { useForm as useForm3 } from "react-hook-form";
|
|
5152
|
-
import { Fragment as Fragment6, jsx as
|
|
5279
|
+
import { Fragment as Fragment6, jsx as jsx36, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
5153
5280
|
var EditorDisplay = ({ dataKey, type }) => {
|
|
5154
5281
|
const { data } = useFetchSimpleKey(dataKey, type);
|
|
5155
5282
|
return /* @__PURE__ */ jsxs22("div", { className: "flex h-full w-full flex-col gap-2", children: [
|
|
5156
|
-
/* @__PURE__ */
|
|
5157
|
-
/* @__PURE__ */
|
|
5158
|
-
"div",
|
|
5159
|
-
{
|
|
5160
|
-
className: "flex h-full grow flex-col gap-2\n rounded-md bg-zinc-100 p-3",
|
|
5161
|
-
children: data === void 0 ? /* @__PURE__ */ jsx34(Spinner, { isLoadingText: "", isLoading: true }) : data === null ? /* @__PURE__ */ jsx34(Fragment6, {}) : /* @__PURE__ */ jsx34(EditorDisplayForm, { dataKey, type, data }, dataKey)
|
|
5162
|
-
}
|
|
5163
|
-
)
|
|
5283
|
+
/* @__PURE__ */ jsx36(DisplayHeader, { dataKey, type, content: data ?? void 0 }),
|
|
5284
|
+
/* @__PURE__ */ jsx36("div", { className: "flex h-full grow flex-col gap-2 rounded-md bg-zinc-100", children: data === void 0 ? /* @__PURE__ */ jsx36(Spinner, { isLoadingText: "", isLoading: true }) : data === null ? /* @__PURE__ */ jsx36(Fragment6, {}) : /* @__PURE__ */ jsx36(EditorDisplayForm, { dataKey, type, data }, dataKey) })
|
|
5164
5285
|
] });
|
|
5165
5286
|
};
|
|
5166
5287
|
var EditorDisplayForm = ({
|
|
@@ -5181,12 +5302,12 @@ var EditorDisplayForm = ({
|
|
|
5181
5302
|
};
|
|
5182
5303
|
return /* @__PURE__ */ jsxs22(Fragment6, { children: [
|
|
5183
5304
|
/* @__PURE__ */ jsxs22("div", { className: "flex grow flex-col gap-1", children: [
|
|
5184
|
-
/* @__PURE__ */
|
|
5185
|
-
/* @__PURE__ */
|
|
5305
|
+
/* @__PURE__ */ jsx36("div", { className: "flex shrink-0 items-center gap-2", children: type === "json" ? /* @__PURE__ */ jsx36("div", {}) : selector }),
|
|
5306
|
+
/* @__PURE__ */ jsx36("div", { className: "grow rounded-md border border-zinc-300 bg-white p-1", children: editor })
|
|
5186
5307
|
] }),
|
|
5187
|
-
/* @__PURE__ */
|
|
5188
|
-
form.formState.isDirty && /* @__PURE__ */
|
|
5189
|
-
/* @__PURE__ */
|
|
5308
|
+
/* @__PURE__ */ jsx36("div", { className: "flex shrink-0 items-center gap-2", children: /* @__PURE__ */ jsxs22("div", { className: "ml-auto flex gap-2", children: [
|
|
5309
|
+
form.formState.isDirty && /* @__PURE__ */ jsx36(Button, { onClick: handleCancel, children: "Cancel" }),
|
|
5310
|
+
/* @__PURE__ */ jsx36(
|
|
5190
5311
|
Button,
|
|
5191
5312
|
{
|
|
5192
5313
|
variant: "primary",
|
|
@@ -5194,7 +5315,7 @@ var EditorDisplayForm = ({
|
|
|
5194
5315
|
await setKey(value);
|
|
5195
5316
|
}),
|
|
5196
5317
|
disabled: !form.formState.isValid || !form.formState.isDirty,
|
|
5197
|
-
children: /* @__PURE__ */
|
|
5318
|
+
children: /* @__PURE__ */ jsx36(Spinner, { isLoading: isSettingKey, isLoadingText: "Saving", children: "Save" })
|
|
5198
5319
|
}
|
|
5199
5320
|
)
|
|
5200
5321
|
] }) })
|
|
@@ -5202,19 +5323,19 @@ var EditorDisplayForm = ({
|
|
|
5202
5323
|
};
|
|
5203
5324
|
|
|
5204
5325
|
// src/components/databrowser/components/display/index.tsx
|
|
5205
|
-
import { Fragment as Fragment7, jsx as
|
|
5326
|
+
import { Fragment as Fragment7, jsx as jsx37 } from "react/jsx-runtime";
|
|
5206
5327
|
var DataDisplay = () => {
|
|
5207
|
-
const { selectedKey } =
|
|
5328
|
+
const { selectedKey } = useTab();
|
|
5208
5329
|
const { query } = useKeys();
|
|
5209
5330
|
const type = useKeyType(selectedKey);
|
|
5210
|
-
return /* @__PURE__ */
|
|
5331
|
+
return /* @__PURE__ */ jsx37("div", { className: "h-full p-4", children: !selectedKey ? /* @__PURE__ */ jsx37("div", {}) : !type ? query.isLoading ? /* @__PURE__ */ jsx37("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsx37("span", { className: "text-gray-500", children: "Loading..." }) }) : /* @__PURE__ */ jsx37("div", {}) : /* @__PURE__ */ jsx37(Fragment7, { children: type === "string" || type === "json" ? /* @__PURE__ */ jsx37(EditorDisplay, { dataKey: selectedKey, type }) : /* @__PURE__ */ jsx37(ListDisplay, { dataKey: selectedKey, type }) }) });
|
|
5211
5332
|
};
|
|
5212
5333
|
|
|
5213
5334
|
// src/components/databrowser/components/sidebar/index.tsx
|
|
5214
5335
|
import { IconRefresh } from "@tabler/icons-react";
|
|
5215
5336
|
|
|
5216
5337
|
// src/components/databrowser/components/add-key-modal.tsx
|
|
5217
|
-
import { useState as
|
|
5338
|
+
import { useState as useState9 } from "react";
|
|
5218
5339
|
import { DialogDescription as DialogDescription2 } from "@radix-ui/react-dialog";
|
|
5219
5340
|
import { PlusIcon } from "@radix-ui/react-icons";
|
|
5220
5341
|
import { Controller as Controller3, useForm as useForm4 } from "react-hook-form";
|
|
@@ -5222,12 +5343,12 @@ import { Controller as Controller3, useForm as useForm4 } from "react-hook-form"
|
|
|
5222
5343
|
// src/components/ui/dialog.tsx
|
|
5223
5344
|
import * as React12 from "react";
|
|
5224
5345
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
5225
|
-
import { jsx as
|
|
5346
|
+
import { jsx as jsx38, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
5226
5347
|
var Dialog = DialogPrimitive.Root;
|
|
5227
5348
|
var DialogTrigger = DialogPrimitive.Trigger;
|
|
5228
|
-
var DialogPortal = (props) => /* @__PURE__ */
|
|
5349
|
+
var DialogPortal = (props) => /* @__PURE__ */ jsx38(DialogPrimitive.Portal, { container: portalRoot, ...props });
|
|
5229
5350
|
DialogPortal.displayName = DialogPrimitive.Portal.displayName;
|
|
5230
|
-
var DialogOverlay = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
5351
|
+
var DialogOverlay = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx38(
|
|
5231
5352
|
DialogPrimitive.Overlay,
|
|
5232
5353
|
{
|
|
5233
5354
|
ref,
|
|
@@ -5242,7 +5363,7 @@ var DialogOverlay = React12.forwardRef(({ className, ...props }, ref) => /* @__P
|
|
|
5242
5363
|
));
|
|
5243
5364
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
5244
5365
|
var DialogContent = React12.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs23(DialogPortal, { children: [
|
|
5245
|
-
/* @__PURE__ */
|
|
5366
|
+
/* @__PURE__ */ jsx38(DialogOverlay, {}),
|
|
5246
5367
|
/* @__PURE__ */ jsxs23(
|
|
5247
5368
|
DialogPrimitive.Content,
|
|
5248
5369
|
{
|
|
@@ -5264,7 +5385,7 @@ var DialogContent = React12.forwardRef(({ className, children, ...props }, ref)
|
|
|
5264
5385
|
children: [
|
|
5265
5386
|
children,
|
|
5266
5387
|
/* @__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 dark:ring-offset-zinc-950 dark:focus:ring-zinc-300 dark:data-[state=open]:bg-zinc-800 dark:data-[state=open]:text-zinc-400", children: [
|
|
5267
|
-
/* @__PURE__ */
|
|
5388
|
+
/* @__PURE__ */ jsx38(
|
|
5268
5389
|
"svg",
|
|
5269
5390
|
{
|
|
5270
5391
|
width: "15",
|
|
@@ -5273,7 +5394,7 @@ var DialogContent = React12.forwardRef(({ className, children, ...props }, ref)
|
|
|
5273
5394
|
fill: "none",
|
|
5274
5395
|
xmlns: "http://www.w3.org/2000/svg",
|
|
5275
5396
|
className: "h-4 w-4",
|
|
5276
|
-
children: /* @__PURE__ */
|
|
5397
|
+
children: /* @__PURE__ */ jsx38(
|
|
5277
5398
|
"path",
|
|
5278
5399
|
{
|
|
5279
5400
|
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",
|
|
@@ -5284,16 +5405,16 @@ var DialogContent = React12.forwardRef(({ className, children, ...props }, ref)
|
|
|
5284
5405
|
)
|
|
5285
5406
|
}
|
|
5286
5407
|
),
|
|
5287
|
-
/* @__PURE__ */
|
|
5408
|
+
/* @__PURE__ */ jsx38("span", { className: "sr-only", children: "Close" })
|
|
5288
5409
|
] })
|
|
5289
5410
|
]
|
|
5290
5411
|
}
|
|
5291
5412
|
)
|
|
5292
5413
|
] }));
|
|
5293
5414
|
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
5294
|
-
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */
|
|
5415
|
+
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsx38("div", { className: cn("flex flex-col space-y-1.5 text-center sm:text-left", className), ...props });
|
|
5295
5416
|
DialogHeader.displayName = "DialogHeader";
|
|
5296
|
-
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */
|
|
5417
|
+
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx38(
|
|
5297
5418
|
"div",
|
|
5298
5419
|
{
|
|
5299
5420
|
className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className),
|
|
@@ -5301,7 +5422,7 @@ var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx36(
|
|
|
5301
5422
|
}
|
|
5302
5423
|
);
|
|
5303
5424
|
DialogFooter.displayName = "DialogFooter";
|
|
5304
|
-
var DialogTitle = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
5425
|
+
var DialogTitle = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx38(
|
|
5305
5426
|
DialogPrimitive.Title,
|
|
5306
5427
|
{
|
|
5307
5428
|
ref,
|
|
@@ -5310,7 +5431,7 @@ var DialogTitle = React12.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
5310
5431
|
}
|
|
5311
5432
|
));
|
|
5312
5433
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
5313
|
-
var DialogDescription = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
5434
|
+
var DialogDescription = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx38(
|
|
5314
5435
|
DialogPrimitive.Description,
|
|
5315
5436
|
{
|
|
5316
5437
|
ref,
|
|
@@ -5321,10 +5442,10 @@ var DialogDescription = React12.forwardRef(({ className, ...props }, ref) => /*
|
|
|
5321
5442
|
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
5322
5443
|
|
|
5323
5444
|
// src/components/databrowser/components/add-key-modal.tsx
|
|
5324
|
-
import { jsx as
|
|
5445
|
+
import { jsx as jsx39, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
5325
5446
|
function AddKeyModal() {
|
|
5326
|
-
const { setSelectedKey } =
|
|
5327
|
-
const [open, setOpen] =
|
|
5447
|
+
const { setSelectedKey } = useTab();
|
|
5448
|
+
const [open, setOpen] = useState9(false);
|
|
5328
5449
|
const { mutateAsync: addKey, isPending } = useAddKey();
|
|
5329
5450
|
const { control, handleSubmit, formState, reset } = useForm4({
|
|
5330
5451
|
defaultValues: {
|
|
@@ -5353,24 +5474,24 @@ function AddKeyModal() {
|
|
|
5353
5474
|
setOpen(open2);
|
|
5354
5475
|
},
|
|
5355
5476
|
children: [
|
|
5356
|
-
/* @__PURE__ */
|
|
5477
|
+
/* @__PURE__ */ jsx39(DialogTrigger, { asChild: true, children: /* @__PURE__ */ jsx39(Button, { variant: "primary", size: "icon-sm", children: /* @__PURE__ */ jsx39(PlusIcon, { className: "size-4" }) }) }),
|
|
5357
5478
|
/* @__PURE__ */ jsxs24(DialogContent, { className: "max-w-[400px]", children: [
|
|
5358
|
-
/* @__PURE__ */
|
|
5359
|
-
/* @__PURE__ */
|
|
5479
|
+
/* @__PURE__ */ jsx39(DialogHeader, { children: /* @__PURE__ */ jsx39(DialogTitle, { children: "Create new key" }) }),
|
|
5480
|
+
/* @__PURE__ */ jsx39("div", { className: "sr-only", children: /* @__PURE__ */ jsx39(DialogDescription2, { children: "Create new key" }) }),
|
|
5360
5481
|
/* @__PURE__ */ jsxs24("form", { className: "mt-4", onSubmit, children: [
|
|
5361
5482
|
/* @__PURE__ */ jsxs24("div", { className: "flex gap-1", children: [
|
|
5362
|
-
/* @__PURE__ */
|
|
5483
|
+
/* @__PURE__ */ jsx39(
|
|
5363
5484
|
Controller3,
|
|
5364
5485
|
{
|
|
5365
5486
|
control,
|
|
5366
5487
|
name: "type",
|
|
5367
5488
|
render: ({ field }) => /* @__PURE__ */ jsxs24(Select, { value: field.value, onValueChange: field.onChange, children: [
|
|
5368
|
-
/* @__PURE__ */
|
|
5369
|
-
/* @__PURE__ */
|
|
5489
|
+
/* @__PURE__ */ jsx39(SelectTrigger, { className: "h-8 w-auto pl-[3px] pr-8", children: /* @__PURE__ */ jsx39(SelectValue, {}) }),
|
|
5490
|
+
/* @__PURE__ */ jsx39(SelectContent, { children: /* @__PURE__ */ jsx39(SelectGroup, { children: DATA_TYPES.map((type) => /* @__PURE__ */ jsx39(SelectItem, { value: type, children: /* @__PURE__ */ jsx39(TypeTag, { variant: type, type: "badge" }) }, type)) }) })
|
|
5370
5491
|
] })
|
|
5371
5492
|
}
|
|
5372
5493
|
),
|
|
5373
|
-
/* @__PURE__ */
|
|
5494
|
+
/* @__PURE__ */ jsx39(
|
|
5374
5495
|
Controller3,
|
|
5375
5496
|
{
|
|
5376
5497
|
rules: {
|
|
@@ -5378,14 +5499,14 @@ function AddKeyModal() {
|
|
|
5378
5499
|
},
|
|
5379
5500
|
control,
|
|
5380
5501
|
name: "key",
|
|
5381
|
-
render: ({ field }) => /* @__PURE__ */
|
|
5502
|
+
render: ({ field }) => /* @__PURE__ */ jsx39(Input, { placeholder: "mykey", ...field, className: "h-8 grow" })
|
|
5382
5503
|
}
|
|
5383
5504
|
)
|
|
5384
5505
|
] }),
|
|
5385
|
-
formState.errors.key && /* @__PURE__ */
|
|
5386
|
-
/* @__PURE__ */
|
|
5506
|
+
formState.errors.key && /* @__PURE__ */ jsx39("p", { className: "mb-3 mt-2 text-xs text-red-500", children: formState.errors.key?.message }),
|
|
5507
|
+
/* @__PURE__ */ jsx39("p", { className: "mt-2 text-xs text-zinc-500", children: "After creating the key, you can edit the value" }),
|
|
5387
5508
|
/* @__PURE__ */ jsxs24("div", { className: "mt-6 flex justify-end gap-2", children: [
|
|
5388
|
-
/* @__PURE__ */
|
|
5509
|
+
/* @__PURE__ */ jsx39(
|
|
5389
5510
|
Button,
|
|
5390
5511
|
{
|
|
5391
5512
|
type: "button",
|
|
@@ -5396,7 +5517,7 @@ function AddKeyModal() {
|
|
|
5396
5517
|
children: "Cancel"
|
|
5397
5518
|
}
|
|
5398
5519
|
),
|
|
5399
|
-
/* @__PURE__ */
|
|
5520
|
+
/* @__PURE__ */ jsx39(Button, { variant: "primary", type: "submit", children: /* @__PURE__ */ jsx39(Spinner, { isLoading: isPending, isLoadingText: "Creating", children: "Create" }) })
|
|
5400
5521
|
] })
|
|
5401
5522
|
] })
|
|
5402
5523
|
] })
|
|
@@ -5406,24 +5527,24 @@ function AddKeyModal() {
|
|
|
5406
5527
|
}
|
|
5407
5528
|
|
|
5408
5529
|
// src/components/databrowser/components/sidebar/empty.tsx
|
|
5409
|
-
import { jsx as
|
|
5530
|
+
import { jsx as jsx40, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
5410
5531
|
var Empty = () => {
|
|
5411
|
-
return /* @__PURE__ */
|
|
5412
|
-
/* @__PURE__ */
|
|
5413
|
-
/* @__PURE__ */
|
|
5532
|
+
return /* @__PURE__ */ jsx40("div", { className: "flex h-full w-full items-center justify-center rounded-md border border-dashed px-4 py-6 text-center", children: /* @__PURE__ */ jsxs25("div", { className: "space-y-5", children: [
|
|
5533
|
+
/* @__PURE__ */ jsx40("p", { className: "text-md font-medium", children: "Data on a break" }),
|
|
5534
|
+
/* @__PURE__ */ jsx40("p", { className: "text-balance text-center", children: '"Quick, lure it back with some CLI magic!"' })
|
|
5414
5535
|
] }) });
|
|
5415
5536
|
};
|
|
5416
5537
|
|
|
5417
5538
|
// src/components/databrowser/components/sidebar-context-menu.tsx
|
|
5418
|
-
import { useState as
|
|
5539
|
+
import { useState as useState10 } from "react";
|
|
5419
5540
|
import { ContextMenuSeparator as ContextMenuSeparator3 } from "@radix-ui/react-context-menu";
|
|
5420
|
-
import { Fragment as Fragment8, jsx as
|
|
5541
|
+
import { Fragment as Fragment8, jsx as jsx41, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
5421
5542
|
var SidebarContextMenu = ({ children }) => {
|
|
5422
5543
|
const { mutate: deleteKey } = useDeleteKey();
|
|
5423
|
-
const [isAlertOpen, setAlertOpen] =
|
|
5424
|
-
const [dataKey, setDataKey] =
|
|
5544
|
+
const [isAlertOpen, setAlertOpen] = useState10(false);
|
|
5545
|
+
const [dataKey, setDataKey] = useState10("");
|
|
5425
5546
|
return /* @__PURE__ */ jsxs26(Fragment8, { children: [
|
|
5426
|
-
/* @__PURE__ */
|
|
5547
|
+
/* @__PURE__ */ jsx41(
|
|
5427
5548
|
DeleteAlertDialog,
|
|
5428
5549
|
{
|
|
5429
5550
|
deletionType: "key",
|
|
@@ -5437,7 +5558,7 @@ var SidebarContextMenu = ({ children }) => {
|
|
|
5437
5558
|
}
|
|
5438
5559
|
),
|
|
5439
5560
|
/* @__PURE__ */ jsxs26(ContextMenu, { children: [
|
|
5440
|
-
/* @__PURE__ */
|
|
5561
|
+
/* @__PURE__ */ jsx41(
|
|
5441
5562
|
ContextMenuTrigger,
|
|
5442
5563
|
{
|
|
5443
5564
|
onContextMenu: (e) => {
|
|
@@ -5453,7 +5574,7 @@ var SidebarContextMenu = ({ children }) => {
|
|
|
5453
5574
|
}
|
|
5454
5575
|
),
|
|
5455
5576
|
/* @__PURE__ */ jsxs26(ContextMenuContent, { children: [
|
|
5456
|
-
/* @__PURE__ */
|
|
5577
|
+
/* @__PURE__ */ jsx41(
|
|
5457
5578
|
ContextMenuItem,
|
|
5458
5579
|
{
|
|
5459
5580
|
onClick: () => {
|
|
@@ -5465,18 +5586,18 @@ var SidebarContextMenu = ({ children }) => {
|
|
|
5465
5586
|
children: "Copy key"
|
|
5466
5587
|
}
|
|
5467
5588
|
),
|
|
5468
|
-
/* @__PURE__ */
|
|
5469
|
-
/* @__PURE__ */
|
|
5589
|
+
/* @__PURE__ */ jsx41(ContextMenuSeparator3, {}),
|
|
5590
|
+
/* @__PURE__ */ jsx41(ContextMenuItem, { onClick: () => setAlertOpen(true), children: "Delete key" })
|
|
5470
5591
|
] })
|
|
5471
5592
|
] })
|
|
5472
5593
|
] });
|
|
5473
5594
|
};
|
|
5474
5595
|
|
|
5475
5596
|
// src/components/databrowser/components/sidebar/keys-list.tsx
|
|
5476
|
-
import { Fragment as Fragment9, jsx as
|
|
5597
|
+
import { Fragment as Fragment9, jsx as jsx42, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
5477
5598
|
var KeysList = () => {
|
|
5478
5599
|
const { keys } = useKeys();
|
|
5479
|
-
return /* @__PURE__ */
|
|
5600
|
+
return /* @__PURE__ */ jsx42(SidebarContextMenu, { children: /* @__PURE__ */ jsx42(Fragment9, { children: keys.map((data, i) => /* @__PURE__ */ jsx42(KeyItem, { nextKey: keys.at(i + 1)?.[0] ?? "", data }, data[0])) }) });
|
|
5480
5601
|
};
|
|
5481
5602
|
var keyStyles = {
|
|
5482
5603
|
string: "border-sky-400 !bg-sky-50 text-sky-900",
|
|
@@ -5488,7 +5609,7 @@ var keyStyles = {
|
|
|
5488
5609
|
stream: "border-green-400 !bg-green-50 text-green-900"
|
|
5489
5610
|
};
|
|
5490
5611
|
var KeyItem = ({ data, nextKey }) => {
|
|
5491
|
-
const { selectedKey, setSelectedKey } =
|
|
5612
|
+
const { selectedKey, setSelectedKey } = useTab();
|
|
5492
5613
|
const [dataKey, dataType] = data;
|
|
5493
5614
|
const isKeySelected = selectedKey === dataKey;
|
|
5494
5615
|
const isNextKeySelected = selectedKey === nextKey;
|
|
@@ -5498,49 +5619,125 @@ var KeyItem = ({ data, nextKey }) => {
|
|
|
5498
5619
|
"data-key": dataKey,
|
|
5499
5620
|
variant: isKeySelected ? "default" : "ghost",
|
|
5500
5621
|
className: cn(
|
|
5501
|
-
"relative flex h-10 w-full items-center justify-start gap-2 px-3 py-0 ",
|
|
5622
|
+
"relative flex h-10 w-full items-center justify-start gap-2 px-3 py-0 !ring-0 focus-visible:bg-zinc-50",
|
|
5502
5623
|
"select-none border border-transparent text-left",
|
|
5503
5624
|
isKeySelected && "shadow-sm",
|
|
5504
5625
|
isKeySelected && keyStyles[dataType]
|
|
5505
5626
|
),
|
|
5506
5627
|
onClick: () => setSelectedKey(dataKey),
|
|
5507
5628
|
children: [
|
|
5508
|
-
/* @__PURE__ */
|
|
5509
|
-
/* @__PURE__ */
|
|
5510
|
-
!isKeySelected && !isNextKeySelected && /* @__PURE__ */
|
|
5629
|
+
/* @__PURE__ */ jsx42(TypeTag, { variant: dataType, type: "icon" }),
|
|
5630
|
+
/* @__PURE__ */ jsx42("p", { className: "truncate whitespace-nowrap", children: dataKey }),
|
|
5631
|
+
!isKeySelected && !isNextKeySelected && /* @__PURE__ */ jsx42("span", { className: "absolute -bottom-px left-3 right-3 h-px bg-zinc-100" })
|
|
5511
5632
|
]
|
|
5512
5633
|
}
|
|
5513
5634
|
);
|
|
5514
5635
|
};
|
|
5515
5636
|
|
|
5516
5637
|
// src/components/databrowser/components/sidebar/search-input.tsx
|
|
5517
|
-
import { useState as
|
|
5638
|
+
import { useState as useState11, useRef as useRef2, useEffect as useEffect10 } from "react";
|
|
5518
5639
|
import { IconX } from "@tabler/icons-react";
|
|
5519
|
-
import { jsx as
|
|
5640
|
+
import { jsx as jsx43, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
5641
|
+
var dedupeSearchHistory = (history) => {
|
|
5642
|
+
const seen = /* @__PURE__ */ new Set();
|
|
5643
|
+
return history.filter((item) => {
|
|
5644
|
+
if (!item || seen.has(item)) return false;
|
|
5645
|
+
seen.add(item);
|
|
5646
|
+
return true;
|
|
5647
|
+
});
|
|
5648
|
+
};
|
|
5520
5649
|
var SearchInput = () => {
|
|
5521
|
-
const { setSearchKey, search } =
|
|
5522
|
-
const
|
|
5523
|
-
const
|
|
5650
|
+
const { setSearchKey, search } = useTab();
|
|
5651
|
+
const { searchHistory, addSearchHistory } = useDatabrowserStore();
|
|
5652
|
+
const [state, setState] = useState11(search.key);
|
|
5653
|
+
const [isFocus, setIsFocus] = useState11(false);
|
|
5654
|
+
const [focusedIndex, setFocusedIndex] = useState11(-1);
|
|
5655
|
+
const inputRef = useRef2(null);
|
|
5656
|
+
const historyItemRefs = useRef2([]);
|
|
5657
|
+
const handleSubmit = (value) => {
|
|
5524
5658
|
if (value.trim() !== "" && !value.includes("*")) value = `${value}*`;
|
|
5659
|
+
addSearchHistory(value);
|
|
5525
5660
|
setSearchKey(value);
|
|
5526
5661
|
setState(value);
|
|
5527
5662
|
};
|
|
5528
|
-
|
|
5529
|
-
|
|
5530
|
-
|
|
5531
|
-
|
|
5532
|
-
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
5663
|
+
const filteredHistory = dedupeSearchHistory(
|
|
5664
|
+
searchHistory.filter((item) => item.includes(state) && item !== state)
|
|
5665
|
+
).slice(0, 5).map((item) => item.endsWith("*") ? item.slice(0, -1) : item);
|
|
5666
|
+
useEffect10(() => {
|
|
5667
|
+
setFocusedIndex(-1);
|
|
5668
|
+
}, [filteredHistory.length]);
|
|
5669
|
+
const handleKeyDown = (e) => {
|
|
5670
|
+
if (e.key === "Enter") {
|
|
5671
|
+
const text = focusedIndex >= 0 && focusedIndex < filteredHistory.length ? filteredHistory[focusedIndex] : e.currentTarget.value;
|
|
5672
|
+
handleSubmit(text);
|
|
5673
|
+
} else if (e.key === "Escape") {
|
|
5674
|
+
setState("");
|
|
5675
|
+
setFocusedIndex(-1);
|
|
5676
|
+
inputRef.current?.blur();
|
|
5677
|
+
} else if (e.key === "ArrowDown" || e.key === "Tab" && !e.shiftKey) {
|
|
5678
|
+
e.preventDefault();
|
|
5679
|
+
if (focusedIndex < filteredHistory.length - 1) {
|
|
5680
|
+
setFocusedIndex(focusedIndex + 1);
|
|
5681
|
+
} else if (filteredHistory.length > 0) {
|
|
5682
|
+
setFocusedIndex(0);
|
|
5542
5683
|
}
|
|
5543
|
-
)
|
|
5684
|
+
} else if (e.key === "ArrowUp" || e.key === "Tab" && e.shiftKey) {
|
|
5685
|
+
e.preventDefault();
|
|
5686
|
+
if (focusedIndex > 0) {
|
|
5687
|
+
setFocusedIndex(focusedIndex - 1);
|
|
5688
|
+
} else if (filteredHistory.length > 0 && focusedIndex === 0) {
|
|
5689
|
+
setFocusedIndex(-1);
|
|
5690
|
+
inputRef.current?.focus();
|
|
5691
|
+
} else if (filteredHistory.length > 0) {
|
|
5692
|
+
setFocusedIndex(filteredHistory.length - 1);
|
|
5693
|
+
}
|
|
5694
|
+
}
|
|
5695
|
+
};
|
|
5696
|
+
return /* @__PURE__ */ jsxs28("div", { className: "relative grow", children: [
|
|
5697
|
+
/* @__PURE__ */ jsxs28(Popover, { open: isFocus && filteredHistory.length > 0, children: [
|
|
5698
|
+
/* @__PURE__ */ jsx43(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx43("div", { children: /* @__PURE__ */ jsx43(
|
|
5699
|
+
Input,
|
|
5700
|
+
{
|
|
5701
|
+
ref: inputRef,
|
|
5702
|
+
placeholder: "Search",
|
|
5703
|
+
className: "rounded-l-none border-zinc-300 font-normal",
|
|
5704
|
+
onKeyDown: handleKeyDown,
|
|
5705
|
+
onChange: (e) => {
|
|
5706
|
+
setState(e.currentTarget.value);
|
|
5707
|
+
if (e.currentTarget.value.trim() === "") handleSubmit("");
|
|
5708
|
+
},
|
|
5709
|
+
value: state,
|
|
5710
|
+
onFocus: () => {
|
|
5711
|
+
setIsFocus(true);
|
|
5712
|
+
setFocusedIndex(-1);
|
|
5713
|
+
},
|
|
5714
|
+
onBlur: () => setIsFocus(false)
|
|
5715
|
+
}
|
|
5716
|
+
) }) }),
|
|
5717
|
+
/* @__PURE__ */ jsx43(
|
|
5718
|
+
PopoverContent,
|
|
5719
|
+
{
|
|
5720
|
+
className: "w-[--radix-popover-trigger-width] divide-y px-3 py-2 text-[13px] text-zinc-900",
|
|
5721
|
+
autoFocus: false,
|
|
5722
|
+
onOpenAutoFocus: (e) => {
|
|
5723
|
+
e.preventDefault();
|
|
5724
|
+
e.stopPropagation();
|
|
5725
|
+
},
|
|
5726
|
+
children: filteredHistory.map((item, index) => /* @__PURE__ */ jsx43("div", { className: "w-full py-[3px]", children: /* @__PURE__ */ jsx43(
|
|
5727
|
+
"button",
|
|
5728
|
+
{
|
|
5729
|
+
ref: (el) => {
|
|
5730
|
+
historyItemRefs.current[index] = el;
|
|
5731
|
+
},
|
|
5732
|
+
onClick: () => handleSubmit(item),
|
|
5733
|
+
onMouseEnter: () => setFocusedIndex(index),
|
|
5734
|
+
className: `block w-full rounded-sm p-1 text-left transition-colors ${focusedIndex === index ? "bg-zinc-100" : "hover:bg-zinc-100"}`,
|
|
5735
|
+
children: item
|
|
5736
|
+
}
|
|
5737
|
+
) }, item))
|
|
5738
|
+
}
|
|
5739
|
+
)
|
|
5740
|
+
] }),
|
|
5544
5741
|
state && /* @__PURE__ */ jsxs28(
|
|
5545
5742
|
Button,
|
|
5546
5743
|
{
|
|
@@ -5553,27 +5750,28 @@ var SearchInput = () => {
|
|
|
5553
5750
|
setState("");
|
|
5554
5751
|
},
|
|
5555
5752
|
children: [
|
|
5556
|
-
/* @__PURE__ */
|
|
5557
|
-
/* @__PURE__ */
|
|
5753
|
+
/* @__PURE__ */ jsx43(IconX, { size: 16 }),
|
|
5754
|
+
/* @__PURE__ */ jsx43("span", { className: "sr-only", children: "Clear" })
|
|
5558
5755
|
]
|
|
5559
5756
|
}
|
|
5560
|
-
)
|
|
5757
|
+
),
|
|
5758
|
+
" "
|
|
5561
5759
|
] });
|
|
5562
5760
|
};
|
|
5563
5761
|
|
|
5564
5762
|
// src/components/databrowser/components/sidebar/skeleton-buttons.tsx
|
|
5565
|
-
import { jsx as
|
|
5763
|
+
import { jsx as jsx44, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
5566
5764
|
var DEFAULT_SKELETON_COUNT = 6;
|
|
5567
|
-
var LoadingSkeleton = () => /* @__PURE__ */
|
|
5568
|
-
/* @__PURE__ */
|
|
5569
|
-
/* @__PURE__ */
|
|
5765
|
+
var LoadingSkeleton = () => /* @__PURE__ */ jsx44("div", { className: "grid", children: Array.from({ length: DEFAULT_SKELETON_COUNT }).fill(0).map((_, idx) => /* @__PURE__ */ jsxs29("div", { className: "flex h-10 items-center gap-2 px-3", children: [
|
|
5766
|
+
/* @__PURE__ */ jsx44(Skeleton, { className: "size-5 shrink-0 rounded" }),
|
|
5767
|
+
/* @__PURE__ */ jsx44(Skeleton, { className: "h-4 grow rounded" })
|
|
5570
5768
|
] }, idx)) });
|
|
5571
5769
|
|
|
5572
5770
|
// src/components/databrowser/components/sidebar/type-selector.tsx
|
|
5573
|
-
import { jsx as
|
|
5771
|
+
import { jsx as jsx45, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
5574
5772
|
var ALL_TYPES_KEY = "all";
|
|
5575
5773
|
function DataTypeSelector() {
|
|
5576
|
-
const { search, setSearchType } =
|
|
5774
|
+
const { search, setSearchType } = useTab();
|
|
5577
5775
|
return /* @__PURE__ */ jsxs30(
|
|
5578
5776
|
Select,
|
|
5579
5777
|
{
|
|
@@ -5586,9 +5784,9 @@ function DataTypeSelector() {
|
|
|
5586
5784
|
},
|
|
5587
5785
|
value: search.type === void 0 ? ALL_TYPES_KEY : search.type,
|
|
5588
5786
|
children: [
|
|
5589
|
-
/* @__PURE__ */
|
|
5590
|
-
/* @__PURE__ */
|
|
5591
|
-
([key, value]) => /* @__PURE__ */
|
|
5787
|
+
/* @__PURE__ */ jsx45(SelectTrigger, { className: "!w-auto select-none whitespace-nowrap rounded-r-none border-r-0 border-zinc-300 pr-8", children: /* @__PURE__ */ jsx45(SelectValue, {}) }),
|
|
5788
|
+
/* @__PURE__ */ jsx45(SelectContent, { children: /* @__PURE__ */ jsx45(SelectGroup, { children: [[ALL_TYPES_KEY, "All Types"], ...Object.entries(DATA_TYPE_NAMES)].map(
|
|
5789
|
+
([key, value]) => /* @__PURE__ */ jsx45(SelectItem, { value: key, children: value }, key)
|
|
5592
5790
|
) }) })
|
|
5593
5791
|
]
|
|
5594
5792
|
}
|
|
@@ -5596,15 +5794,15 @@ function DataTypeSelector() {
|
|
|
5596
5794
|
}
|
|
5597
5795
|
|
|
5598
5796
|
// src/components/databrowser/components/sidebar/index.tsx
|
|
5599
|
-
import { jsx as
|
|
5797
|
+
import { jsx as jsx46, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
5600
5798
|
function Sidebar() {
|
|
5601
5799
|
const { keys, query } = useKeys();
|
|
5602
|
-
return /* @__PURE__ */ jsxs31("div", { className: "flex h-full flex-col gap-2
|
|
5603
|
-
/* @__PURE__ */ jsxs31("div", { className: "rounded-lg bg-zinc-100
|
|
5800
|
+
return /* @__PURE__ */ jsxs31("div", { className: "flex h-full flex-col gap-2 p-4", children: [
|
|
5801
|
+
/* @__PURE__ */ jsxs31("div", { className: "rounded-lg bg-zinc-100", children: [
|
|
5604
5802
|
/* @__PURE__ */ jsxs31("div", { className: "flex h-10 items-center justify-between pl-1", children: [
|
|
5605
|
-
/* @__PURE__ */
|
|
5803
|
+
/* @__PURE__ */ jsx46(DisplayDbSize, {}),
|
|
5606
5804
|
/* @__PURE__ */ jsxs31("div", { className: "flex gap-1", children: [
|
|
5607
|
-
/* @__PURE__ */
|
|
5805
|
+
/* @__PURE__ */ jsx46(
|
|
5608
5806
|
Button,
|
|
5609
5807
|
{
|
|
5610
5808
|
className: "h-7 w-7 px-0",
|
|
@@ -5625,32 +5823,28 @@ function Sidebar() {
|
|
|
5625
5823
|
queryKey: [FETCH_KEY_TYPE_QUERY_KEY]
|
|
5626
5824
|
});
|
|
5627
5825
|
},
|
|
5628
|
-
children: /* @__PURE__ */
|
|
5826
|
+
children: /* @__PURE__ */ jsx46(Spinner, { isLoading: query.isFetching, children: /* @__PURE__ */ jsx46(IconRefresh, { size: 16 }) })
|
|
5629
5827
|
}
|
|
5630
5828
|
),
|
|
5631
|
-
/* @__PURE__ */
|
|
5829
|
+
/* @__PURE__ */ jsx46(AddKeyModal, {})
|
|
5632
5830
|
] })
|
|
5633
5831
|
] }),
|
|
5634
5832
|
/* @__PURE__ */ jsxs31("div", { className: "flex h-10 items-center", children: [
|
|
5635
|
-
/* @__PURE__ */
|
|
5636
|
-
/* @__PURE__ */
|
|
5833
|
+
/* @__PURE__ */ jsx46(DataTypeSelector, {}),
|
|
5834
|
+
/* @__PURE__ */ jsx46(SearchInput, {})
|
|
5637
5835
|
] })
|
|
5638
5836
|
] }),
|
|
5639
|
-
query.isLoading && keys.length === 0 ? /* @__PURE__ */
|
|
5837
|
+
query.isLoading && keys.length === 0 ? /* @__PURE__ */ jsx46(LoadingSkeleton, {}) : keys.length > 0 ? (
|
|
5640
5838
|
// Infinite scroll already has a loader at the bottom
|
|
5641
|
-
/* @__PURE__ */
|
|
5642
|
-
) : /* @__PURE__ */
|
|
5839
|
+
/* @__PURE__ */ jsx46(InfiniteScroll, { query, roundedInherit: false, children: /* @__PURE__ */ jsx46(KeysList, {}) })
|
|
5840
|
+
) : /* @__PURE__ */ jsx46(Empty, {})
|
|
5643
5841
|
] });
|
|
5644
5842
|
}
|
|
5645
5843
|
|
|
5646
|
-
// src/components/databrowser/
|
|
5647
|
-
import { jsx as
|
|
5648
|
-
var
|
|
5649
|
-
|
|
5650
|
-
useEffect10(() => {
|
|
5651
|
-
queryClient.resetQueries();
|
|
5652
|
-
}, [credentials.url]);
|
|
5653
|
-
return /* @__PURE__ */ jsx45(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx45(TooltipProvider, { children: /* @__PURE__ */ jsx45(DatabrowserProvider, { redisCredentials: credentials, children: /* @__PURE__ */ jsx45(KeysProvider, { children: /* @__PURE__ */ jsxs32("div", { className: "ups-db", style: { height: "100%" }, children: [
|
|
5844
|
+
// src/components/databrowser/components/databrowser-instance.tsx
|
|
5845
|
+
import { jsx as jsx47, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
5846
|
+
var DatabrowserInstance = ({ hidden }) => {
|
|
5847
|
+
return /* @__PURE__ */ jsx47(KeysProvider, { children: /* @__PURE__ */ jsxs32("div", { className: cn("h-full rounded-md bg-zinc-100", hidden && "hidden"), children: [
|
|
5654
5848
|
/* @__PURE__ */ jsxs32(
|
|
5655
5849
|
PanelGroup,
|
|
5656
5850
|
{
|
|
@@ -5658,22 +5852,97 @@ var RedisBrowser = ({ token, url }) => {
|
|
|
5658
5852
|
direction: "horizontal",
|
|
5659
5853
|
className: "h-full w-full gap-0.5 text-sm antialiased",
|
|
5660
5854
|
children: [
|
|
5661
|
-
/* @__PURE__ */
|
|
5662
|
-
/* @__PURE__ */
|
|
5663
|
-
|
|
5664
|
-
{
|
|
5665
|
-
size: 16,
|
|
5666
|
-
stroke: 1,
|
|
5667
|
-
className: "pointer-events-none shrink-0 opacity-20"
|
|
5668
|
-
}
|
|
5669
|
-
) }),
|
|
5670
|
-
/* @__PURE__ */ jsx45(Panel, { minSize: 40, children: /* @__PURE__ */ jsx45(DataDisplay, {}) })
|
|
5855
|
+
/* @__PURE__ */ jsx47(Panel, { defaultSize: 30, minSize: 30, children: /* @__PURE__ */ jsx47(Sidebar, {}) }),
|
|
5856
|
+
/* @__PURE__ */ jsx47(PanelResizeHandle, { className: "group flex h-full w-1.5 justify-center", children: /* @__PURE__ */ jsx47("div", { className: "h-full border-r border-dashed border-zinc-200 transition-colors group-hover:border-zinc-300" }) }),
|
|
5857
|
+
/* @__PURE__ */ jsx47(Panel, { minSize: 40, children: /* @__PURE__ */ jsx47(DataDisplay, {}) })
|
|
5671
5858
|
]
|
|
5672
5859
|
}
|
|
5673
5860
|
),
|
|
5674
|
-
/* @__PURE__ */
|
|
5861
|
+
/* @__PURE__ */ jsx47(Toaster, {})
|
|
5862
|
+
] }) });
|
|
5863
|
+
};
|
|
5864
|
+
|
|
5865
|
+
// src/components/databrowser/components/databrowser-tabs.tsx
|
|
5866
|
+
import { IconPlus as IconPlus2, IconX as IconX2 } from "@tabler/icons-react";
|
|
5867
|
+
|
|
5868
|
+
// src/components/databrowser/components/tab-type-icon.tsx
|
|
5869
|
+
import { jsx as jsx48 } from "react/jsx-runtime";
|
|
5870
|
+
function TabTypeIcon({ selectedKey }) {
|
|
5871
|
+
const { data: keyType, isLoading } = useFetchKeyType(selectedKey);
|
|
5872
|
+
if (isLoading) return /* @__PURE__ */ jsx48(Skeleton, { className: "h-5 w-5 rounded" });
|
|
5873
|
+
if (!keyType || keyType === "none") return;
|
|
5874
|
+
return /* @__PURE__ */ jsx48(TypeTag, { variant: keyType, type: "icon" });
|
|
5875
|
+
}
|
|
5876
|
+
|
|
5877
|
+
// src/components/databrowser/components/databrowser-tabs.tsx
|
|
5878
|
+
import { Fragment as Fragment10, jsx as jsx49, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
5879
|
+
var Tab = ({ id }) => {
|
|
5880
|
+
const { selectTab, selectedTab, tabs, removeTab } = useDatabrowserStore();
|
|
5881
|
+
return /* @__PURE__ */ jsxs33(
|
|
5882
|
+
"div",
|
|
5883
|
+
{
|
|
5884
|
+
onClick: () => selectTab(id),
|
|
5885
|
+
className: cn(
|
|
5886
|
+
"flex h-9 translate-y-[1px] cursor-pointer items-center gap-2 rounded-t-lg border border-zinc-200 px-3 text-[13px] transition-colors",
|
|
5887
|
+
id === selectedTab ? "border-b-white bg-white text-zinc-900" : "bg-zinc-100 hover:bg-zinc-50"
|
|
5888
|
+
),
|
|
5889
|
+
children: [
|
|
5890
|
+
tabs[id].selectedKey ? /* @__PURE__ */ jsxs33(Fragment10, { children: [
|
|
5891
|
+
/* @__PURE__ */ jsx49(TabTypeIcon, { selectedKey: tabs[id].selectedKey }),
|
|
5892
|
+
/* @__PURE__ */ jsx49("span", { className: "max-w-32 truncate", children: tabs[id].selectedKey })
|
|
5893
|
+
] }) : "New Tab",
|
|
5894
|
+
Object.keys(tabs).length > 1 && /* @__PURE__ */ jsx49(
|
|
5895
|
+
"button",
|
|
5896
|
+
{
|
|
5897
|
+
onClick: (e) => {
|
|
5898
|
+
e.stopPropagation();
|
|
5899
|
+
removeTab(id);
|
|
5900
|
+
},
|
|
5901
|
+
className: "p-1 text-zinc-300 transition-colors hover:text-zinc-500",
|
|
5902
|
+
children: /* @__PURE__ */ jsx49(IconX2, { size: 16 })
|
|
5903
|
+
}
|
|
5904
|
+
)
|
|
5905
|
+
]
|
|
5906
|
+
}
|
|
5907
|
+
);
|
|
5908
|
+
};
|
|
5909
|
+
var DatabrowserTabs = () => {
|
|
5910
|
+
const { tabs, addTab } = useDatabrowserStore();
|
|
5911
|
+
return /* @__PURE__ */ jsxs33("div", { className: "mb-2 flex items-center gap-1 border-b border-zinc-200", children: [
|
|
5912
|
+
Object.keys(tabs).map((id) => /* @__PURE__ */ jsx49(Tab, { id }, id)),
|
|
5913
|
+
/* @__PURE__ */ jsx49(
|
|
5914
|
+
Button,
|
|
5915
|
+
{
|
|
5916
|
+
variant: "secondary",
|
|
5917
|
+
size: "icon-sm",
|
|
5918
|
+
onClick: addTab,
|
|
5919
|
+
className: "mr-1 flex-shrink-0",
|
|
5920
|
+
title: "Add new tab",
|
|
5921
|
+
children: /* @__PURE__ */ jsx49(IconPlus2, { className: "text-zinc-500", size: 16 })
|
|
5922
|
+
}
|
|
5923
|
+
)
|
|
5924
|
+
] });
|
|
5925
|
+
};
|
|
5926
|
+
|
|
5927
|
+
// src/components/databrowser/index.tsx
|
|
5928
|
+
import { jsx as jsx50, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
5929
|
+
var RedisBrowser = ({ token, url }) => {
|
|
5930
|
+
const credentials = useMemo8(() => ({ token, url }), [token, url]);
|
|
5931
|
+
useEffect11(() => {
|
|
5932
|
+
queryClient.resetQueries();
|
|
5933
|
+
}, [credentials.url]);
|
|
5934
|
+
return /* @__PURE__ */ jsx50(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx50(RedisProvider, { redisCredentials: credentials, children: /* @__PURE__ */ jsx50(DatabrowserProvider, { children: /* @__PURE__ */ jsx50(TooltipProvider, { children: /* @__PURE__ */ jsxs34("div", { className: "ups-db", style: { height: "100%" }, children: [
|
|
5935
|
+
/* @__PURE__ */ jsx50(DatabrowserTabs, {}),
|
|
5936
|
+
/* @__PURE__ */ jsx50(DatabrowserInstances, {})
|
|
5675
5937
|
] }) }) }) }) });
|
|
5676
5938
|
};
|
|
5939
|
+
var DatabrowserInstances = () => {
|
|
5940
|
+
const { tabs, selectedTab, addTab } = useDatabrowserStore();
|
|
5941
|
+
useEffect11(() => {
|
|
5942
|
+
if (Object.keys(tabs).length === 0) addTab();
|
|
5943
|
+
}, [tabs]);
|
|
5944
|
+
return Object.entries(tabs).map(([id]) => /* @__PURE__ */ jsx50(TabIdProvider, { value: id, children: /* @__PURE__ */ jsx50(DatabrowserInstance, { hidden: id !== selectedTab }) }, id));
|
|
5945
|
+
};
|
|
5677
5946
|
export {
|
|
5678
5947
|
RedisBrowser
|
|
5679
5948
|
};
|