@upstash/react-redis-browser 0.1.10 → 0.1.11-canary-2
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 +138 -26
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +518 -232
- package/dist/index.mjs +785 -499
- 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, disableRoundedInherit = false, ...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", !disableRoundedInherit && "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,15 @@ var InfiniteScroll = ({
|
|
|
4310
4436
|
ScrollArea,
|
|
4311
4437
|
{
|
|
4312
4438
|
type: "always",
|
|
4313
|
-
className: "block h-full w-full transition-all",
|
|
4314
4439
|
onScroll: handleScroll,
|
|
4440
|
+
...props,
|
|
4441
|
+
className: cn(
|
|
4442
|
+
"block h-full w-full overflow-visible rounded-lg border border-zinc-200 bg-white p-1 pr-3 transition-all",
|
|
4443
|
+
props.className
|
|
4444
|
+
),
|
|
4315
4445
|
children: [
|
|
4316
4446
|
children,
|
|
4317
|
-
/* @__PURE__ */
|
|
4447
|
+
/* @__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
4448
|
]
|
|
4319
4449
|
}
|
|
4320
4450
|
);
|
|
@@ -4344,15 +4474,15 @@ import {
|
|
|
4344
4474
|
IconList,
|
|
4345
4475
|
IconQuote
|
|
4346
4476
|
} from "@tabler/icons-react";
|
|
4347
|
-
import { jsx as
|
|
4477
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
4348
4478
|
var iconsMap = {
|
|
4349
|
-
string: /* @__PURE__ */
|
|
4350
|
-
set: /* @__PURE__ */
|
|
4351
|
-
hash: /* @__PURE__ */
|
|
4352
|
-
json: /* @__PURE__ */
|
|
4353
|
-
zset: /* @__PURE__ */
|
|
4354
|
-
list: /* @__PURE__ */
|
|
4355
|
-
stream: /* @__PURE__ */
|
|
4479
|
+
string: /* @__PURE__ */ jsx23(IconQuote, { size: 15, stroke: 1.3 }),
|
|
4480
|
+
set: /* @__PURE__ */ jsx23(IconLayersIntersect, { size: 15, stroke: 1.3 }),
|
|
4481
|
+
hash: /* @__PURE__ */ jsx23(IconHash, { size: 15, stroke: 1.3 }),
|
|
4482
|
+
json: /* @__PURE__ */ jsx23(IconCodeDots, { size: 15, stroke: 1.3 }),
|
|
4483
|
+
zset: /* @__PURE__ */ jsx23(IconArrowsSort, { size: 15, stroke: 1.3 }),
|
|
4484
|
+
list: /* @__PURE__ */ jsx23(IconList, { size: 15, stroke: 1.3 }),
|
|
4485
|
+
stream: /* @__PURE__ */ jsx23(IconList, { size: 15, stroke: 1.3 })
|
|
4356
4486
|
};
|
|
4357
4487
|
var tagVariants = cva("inline-flex shrink-0 items-center rounded-md justify-center", {
|
|
4358
4488
|
variants: {
|
|
@@ -4376,7 +4506,7 @@ var tagVariants = cva("inline-flex shrink-0 items-center rounded-md justify-cent
|
|
|
4376
4506
|
}
|
|
4377
4507
|
});
|
|
4378
4508
|
function TypeTag({ className, variant, type }) {
|
|
4379
|
-
return /* @__PURE__ */
|
|
4509
|
+
return /* @__PURE__ */ jsx23("span", { className: cn(tagVariants({ variant, type, className })), children: type === "icon" ? iconsMap[variant] : DATA_TYPE_NAMES[variant] });
|
|
4380
4510
|
}
|
|
4381
4511
|
|
|
4382
4512
|
// src/components/databrowser/components/display/key-actions.tsx
|
|
@@ -4386,7 +4516,7 @@ import { IconDotsVertical } from "@tabler/icons-react";
|
|
|
4386
4516
|
import * as React10 from "react";
|
|
4387
4517
|
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
4388
4518
|
import { CheckIcon as CheckIcon2, ChevronRightIcon as ChevronRightIcon2, DotFilledIcon as DotFilledIcon2 } from "@radix-ui/react-icons";
|
|
4389
|
-
import { jsx as
|
|
4519
|
+
import { jsx as jsx24, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
4390
4520
|
var DropdownMenu = DropdownMenuPrimitive.Root;
|
|
4391
4521
|
var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
4392
4522
|
var DropdownMenuSubTrigger = React10.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs14(
|
|
@@ -4394,45 +4524,45 @@ var DropdownMenuSubTrigger = React10.forwardRef(({ className, inset, children, .
|
|
|
4394
4524
|
{
|
|
4395
4525
|
ref,
|
|
4396
4526
|
className: cn(
|
|
4397
|
-
"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-
|
|
4527
|
+
"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
4528
|
inset && "pl-8",
|
|
4399
4529
|
className
|
|
4400
4530
|
),
|
|
4401
4531
|
...props,
|
|
4402
4532
|
children: [
|
|
4403
4533
|
children,
|
|
4404
|
-
/* @__PURE__ */
|
|
4534
|
+
/* @__PURE__ */ jsx24(ChevronRightIcon2, { className: "ml-auto" })
|
|
4405
4535
|
]
|
|
4406
4536
|
}
|
|
4407
4537
|
));
|
|
4408
4538
|
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
|
|
4409
|
-
var DropdownMenuSubContent = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
4539
|
+
var DropdownMenuSubContent = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
4410
4540
|
DropdownMenuPrimitive.SubContent,
|
|
4411
4541
|
{
|
|
4412
4542
|
ref,
|
|
4413
4543
|
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",
|
|
4544
|
+
"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
4545
|
className
|
|
4416
4546
|
),
|
|
4417
4547
|
...props
|
|
4418
4548
|
}
|
|
4419
4549
|
));
|
|
4420
4550
|
DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
|
|
4421
|
-
var DropdownMenuContent = React10.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */
|
|
4551
|
+
var DropdownMenuContent = React10.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx24(DropdownMenuPrimitive.Portal, { container: portalRoot, children: /* @__PURE__ */ jsx24(
|
|
4422
4552
|
DropdownMenuPrimitive.Content,
|
|
4423
4553
|
{
|
|
4424
4554
|
ref,
|
|
4425
4555
|
sideOffset,
|
|
4426
4556
|
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",
|
|
4557
|
+
"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",
|
|
4558
|
+
"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
4559
|
className
|
|
4430
4560
|
),
|
|
4431
4561
|
...props
|
|
4432
4562
|
}
|
|
4433
4563
|
) }));
|
|
4434
4564
|
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
4435
|
-
var DropdownMenuItem = React10.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */
|
|
4565
|
+
var DropdownMenuItem = React10.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
4436
4566
|
DropdownMenuPrimitive.Item,
|
|
4437
4567
|
{
|
|
4438
4568
|
ref,
|
|
@@ -4456,7 +4586,7 @@ var DropdownMenuCheckboxItem = React10.forwardRef(({ className, children, checke
|
|
|
4456
4586
|
checked,
|
|
4457
4587
|
...props,
|
|
4458
4588
|
children: [
|
|
4459
|
-
/* @__PURE__ */
|
|
4589
|
+
/* @__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
4590
|
children
|
|
4461
4591
|
]
|
|
4462
4592
|
}
|
|
@@ -4472,13 +4602,13 @@ var DropdownMenuRadioItem = React10.forwardRef(({ className, children, ...props
|
|
|
4472
4602
|
),
|
|
4473
4603
|
...props,
|
|
4474
4604
|
children: [
|
|
4475
|
-
/* @__PURE__ */
|
|
4605
|
+
/* @__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
4606
|
children
|
|
4477
4607
|
]
|
|
4478
4608
|
}
|
|
4479
4609
|
));
|
|
4480
4610
|
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
|
|
4481
|
-
var DropdownMenuLabel = React10.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */
|
|
4611
|
+
var DropdownMenuLabel = React10.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
4482
4612
|
DropdownMenuPrimitive.Label,
|
|
4483
4613
|
{
|
|
4484
4614
|
ref,
|
|
@@ -4487,7 +4617,7 @@ var DropdownMenuLabel = React10.forwardRef(({ className, inset, ...props }, ref)
|
|
|
4487
4617
|
}
|
|
4488
4618
|
));
|
|
4489
4619
|
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
|
|
4490
|
-
var DropdownMenuSeparator = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
4620
|
+
var DropdownMenuSeparator = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
4491
4621
|
DropdownMenuPrimitive.Separator,
|
|
4492
4622
|
{
|
|
4493
4623
|
ref,
|
|
@@ -4497,18 +4627,18 @@ var DropdownMenuSeparator = React10.forwardRef(({ className, ...props }, ref) =>
|
|
|
4497
4627
|
));
|
|
4498
4628
|
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
|
|
4499
4629
|
var DropdownMenuShortcut = ({ className, ...props }) => {
|
|
4500
|
-
return /* @__PURE__ */
|
|
4630
|
+
return /* @__PURE__ */ jsx24("span", { className: cn("ml-auto text-xs tracking-widest opacity-60", className), ...props });
|
|
4501
4631
|
};
|
|
4502
4632
|
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
4503
4633
|
|
|
4504
4634
|
// src/components/databrowser/components/display/key-actions.tsx
|
|
4505
|
-
import { jsx as
|
|
4635
|
+
import { jsx as jsx25, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
4506
4636
|
function KeyActions({ dataKey, content }) {
|
|
4507
4637
|
const { mutateAsync: deleteKey } = useDeleteKey();
|
|
4508
4638
|
return /* @__PURE__ */ jsxs15(DropdownMenu, { children: [
|
|
4509
|
-
/* @__PURE__ */
|
|
4639
|
+
/* @__PURE__ */ jsx25(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx25(Button, { size: "icon-sm", children: /* @__PURE__ */ jsx25(IconDotsVertical, { className: "size-4 text-zinc-500" }) }) }),
|
|
4510
4640
|
/* @__PURE__ */ jsxs15(DropdownMenuContent, { className: "", align: "end", children: [
|
|
4511
|
-
content && /* @__PURE__ */
|
|
4641
|
+
content && /* @__PURE__ */ jsx25(
|
|
4512
4642
|
DropdownMenuItem,
|
|
4513
4643
|
{
|
|
4514
4644
|
onClick: () => {
|
|
@@ -4520,12 +4650,12 @@ function KeyActions({ dataKey, content }) {
|
|
|
4520
4650
|
children: "Copy content"
|
|
4521
4651
|
}
|
|
4522
4652
|
),
|
|
4523
|
-
/* @__PURE__ */
|
|
4653
|
+
/* @__PURE__ */ jsx25(
|
|
4524
4654
|
DeleteAlertDialog,
|
|
4525
4655
|
{
|
|
4526
4656
|
deletionType: "key",
|
|
4527
4657
|
onDeleteConfirm: async () => await deleteKey(dataKey),
|
|
4528
|
-
children: /* @__PURE__ */
|
|
4658
|
+
children: /* @__PURE__ */ jsx25(DropdownMenuItem, { onSelect: (e) => e.preventDefault(), children: "Delete key" })
|
|
4529
4659
|
}
|
|
4530
4660
|
)
|
|
4531
4661
|
] })
|
|
@@ -4533,29 +4663,29 @@ function KeyActions({ dataKey, content }) {
|
|
|
4533
4663
|
}
|
|
4534
4664
|
|
|
4535
4665
|
// src/components/databrowser/components/display/display-header.tsx
|
|
4536
|
-
import { jsx as
|
|
4666
|
+
import { jsx as jsx26, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
4537
4667
|
var DisplayHeader = ({
|
|
4538
4668
|
dataKey,
|
|
4539
4669
|
type,
|
|
4540
4670
|
content
|
|
4541
4671
|
}) => {
|
|
4542
|
-
const { setSelectedListItem } =
|
|
4672
|
+
const { setSelectedListItem } = useTab();
|
|
4543
4673
|
const handleAddItem = () => {
|
|
4544
4674
|
setSelectedListItem({ key: type === "stream" ? "*" : "", isNew: true });
|
|
4545
4675
|
};
|
|
4546
|
-
return /* @__PURE__ */ jsxs16("div", { className: "rounded-lg bg-zinc-100
|
|
4676
|
+
return /* @__PURE__ */ jsxs16("div", { className: "rounded-lg bg-zinc-100", children: [
|
|
4547
4677
|
/* @__PURE__ */ jsxs16("div", { className: "flex min-h-10 items-center justify-between gap-4", children: [
|
|
4548
|
-
/* @__PURE__ */
|
|
4678
|
+
/* @__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
4679
|
/* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-1", children: [
|
|
4550
|
-
type !== "string" && type !== "json" && /* @__PURE__ */
|
|
4551
|
-
/* @__PURE__ */
|
|
4680
|
+
type !== "string" && type !== "json" && /* @__PURE__ */ jsx26(Button, { onClick: handleAddItem, size: "icon-sm", children: /* @__PURE__ */ jsx26(IconPlus, { className: "size-4 text-zinc-500" }) }),
|
|
4681
|
+
/* @__PURE__ */ jsx26(KeyActions, { dataKey, content })
|
|
4552
4682
|
] })
|
|
4553
4683
|
] }),
|
|
4554
4684
|
/* @__PURE__ */ jsxs16("div", { className: "flex h-10 flex-wrap items-center gap-1.5", children: [
|
|
4555
|
-
/* @__PURE__ */
|
|
4556
|
-
/* @__PURE__ */
|
|
4557
|
-
/* @__PURE__ */
|
|
4558
|
-
/* @__PURE__ */
|
|
4685
|
+
/* @__PURE__ */ jsx26(TypeTag, { variant: type, type: "badge" }),
|
|
4686
|
+
/* @__PURE__ */ jsx26(SizeBadge, { dataKey }),
|
|
4687
|
+
/* @__PURE__ */ jsx26(LengthBadge, { dataKey, type, content }),
|
|
4688
|
+
/* @__PURE__ */ jsx26(HeaderTTLBadge, { dataKey })
|
|
4559
4689
|
] })
|
|
4560
4690
|
] });
|
|
4561
4691
|
};
|
|
@@ -4566,10 +4696,10 @@ import { Controller as Controller2, FormProvider, useForm as useForm2, useFormCo
|
|
|
4566
4696
|
// src/components/ui/tooltip.tsx
|
|
4567
4697
|
import * as React11 from "react";
|
|
4568
4698
|
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
4569
|
-
import { Fragment as Fragment3, jsx as
|
|
4699
|
+
import { Fragment as Fragment3, jsx as jsx27, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
4570
4700
|
var Tooltip = TooltipPrimitive.Root;
|
|
4571
4701
|
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
4572
|
-
var TooltipContent = React11.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */
|
|
4702
|
+
var TooltipContent = React11.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx27(
|
|
4573
4703
|
TooltipPrimitive.Content,
|
|
4574
4704
|
{
|
|
4575
4705
|
ref,
|
|
@@ -4586,10 +4716,10 @@ var SimpleTooltip = ({
|
|
|
4586
4716
|
content,
|
|
4587
4717
|
children
|
|
4588
4718
|
}) => {
|
|
4589
|
-
if (!content) return /* @__PURE__ */
|
|
4719
|
+
if (!content) return /* @__PURE__ */ jsx27(Fragment3, { children });
|
|
4590
4720
|
return /* @__PURE__ */ jsxs17(Tooltip, { delayDuration: 400, children: [
|
|
4591
|
-
/* @__PURE__ */
|
|
4592
|
-
/* @__PURE__ */
|
|
4721
|
+
/* @__PURE__ */ jsx27(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx27("div", { children }) }),
|
|
4722
|
+
/* @__PURE__ */ jsx27(TooltipContent, { children: content })
|
|
4593
4723
|
] });
|
|
4594
4724
|
};
|
|
4595
4725
|
|
|
@@ -4600,7 +4730,7 @@ var useFetchHashFieldExpires = ({
|
|
|
4600
4730
|
dataKey,
|
|
4601
4731
|
fields
|
|
4602
4732
|
}) => {
|
|
4603
|
-
const { redis } =
|
|
4733
|
+
const { redis } = useRedis();
|
|
4604
4734
|
return useQuery7({
|
|
4605
4735
|
queryKey: [FETCH_HASH_FIELD_TTLS_QUERY_KEY, dataKey, fields],
|
|
4606
4736
|
queryFn: async () => {
|
|
@@ -4631,7 +4761,7 @@ var useFetchHashFieldExpires = ({
|
|
|
4631
4761
|
// src/components/databrowser/hooks/use-set-hash-ttl.ts
|
|
4632
4762
|
import { useMutation as useMutation6 } from "@tanstack/react-query";
|
|
4633
4763
|
var useSetHashTTL = () => {
|
|
4634
|
-
const { redis } =
|
|
4764
|
+
const { redis } = useRedis();
|
|
4635
4765
|
return useMutation6({
|
|
4636
4766
|
mutationFn: async ({
|
|
4637
4767
|
dataKey,
|
|
@@ -4649,12 +4779,12 @@ var useSetHashTTL = () => {
|
|
|
4649
4779
|
};
|
|
4650
4780
|
|
|
4651
4781
|
// src/components/databrowser/components/display/hash/hash-field-ttl-badge.tsx
|
|
4652
|
-
import { jsx as
|
|
4782
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
4653
4783
|
var HashFieldTTLBadge = ({ dataKey, field }) => {
|
|
4654
4784
|
const { data } = useFetchHashFieldExpires({ dataKey, fields: [field] });
|
|
4655
4785
|
const { mutate: setTTL, isPending } = useSetHashTTL();
|
|
4656
4786
|
const expireAt = data?.[field];
|
|
4657
|
-
return /* @__PURE__ */
|
|
4787
|
+
return /* @__PURE__ */ jsx28(
|
|
4658
4788
|
TTLBadge,
|
|
4659
4789
|
{
|
|
4660
4790
|
label: "Field TTL:",
|
|
@@ -4666,23 +4796,23 @@ var HashFieldTTLBadge = ({ dataKey, field }) => {
|
|
|
4666
4796
|
};
|
|
4667
4797
|
|
|
4668
4798
|
// src/components/databrowser/components/display/input/use-field.tsx
|
|
4669
|
-
import { useEffect as useEffect7, useState as
|
|
4799
|
+
import { useEffect as useEffect7, useState as useState7 } from "react";
|
|
4670
4800
|
import { useController } from "react-hook-form";
|
|
4671
4801
|
|
|
4672
4802
|
// src/components/databrowser/components/display/input/content-type-select.tsx
|
|
4673
|
-
import { useMemo as
|
|
4674
|
-
import { jsx as
|
|
4803
|
+
import { useMemo as useMemo6 } from "react";
|
|
4804
|
+
import { jsx as jsx29, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4675
4805
|
var ContentTypeSelect = ({
|
|
4676
4806
|
value,
|
|
4677
4807
|
onChange,
|
|
4678
4808
|
data
|
|
4679
4809
|
}) => {
|
|
4680
|
-
const isValidJSON =
|
|
4810
|
+
const isValidJSON = useMemo6(() => checkIsValidJSON(data), [data]);
|
|
4681
4811
|
return /* @__PURE__ */ jsxs18(Select, { value, onValueChange: onChange, children: [
|
|
4682
|
-
/* @__PURE__ */
|
|
4683
|
-
/* @__PURE__ */
|
|
4684
|
-
/* @__PURE__ */
|
|
4685
|
-
/* @__PURE__ */
|
|
4812
|
+
/* @__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" }) }),
|
|
4813
|
+
/* @__PURE__ */ jsx29(SelectContent, { children: /* @__PURE__ */ jsxs18(SelectGroup, { children: [
|
|
4814
|
+
/* @__PURE__ */ jsx29(SelectItem, { value: "Text", children: "Text" }),
|
|
4815
|
+
/* @__PURE__ */ jsx29(SelectItem, { disabled: !isValidJSON, value: "JSON", children: "JSON" })
|
|
4686
4816
|
] }) })
|
|
4687
4817
|
] });
|
|
4688
4818
|
};
|
|
@@ -4692,12 +4822,12 @@ import { useEffect as useEffect6, useRef } from "react";
|
|
|
4692
4822
|
import { Editor, useMonaco } from "@monaco-editor/react";
|
|
4693
4823
|
|
|
4694
4824
|
// src/components/databrowser/copy-button.tsx
|
|
4695
|
-
import { useState as
|
|
4825
|
+
import { useState as useState6 } from "react";
|
|
4696
4826
|
import { IconCheck, IconCopy } from "@tabler/icons-react";
|
|
4697
|
-
import { jsx as
|
|
4827
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
4698
4828
|
function CopyButton({ value, ...props }) {
|
|
4699
|
-
const [copied, setCopied] =
|
|
4700
|
-
return /* @__PURE__ */
|
|
4829
|
+
const [copied, setCopied] = useState6(false);
|
|
4830
|
+
return /* @__PURE__ */ jsx30(
|
|
4701
4831
|
Button,
|
|
4702
4832
|
{
|
|
4703
4833
|
onClick: (e) => {
|
|
@@ -4714,7 +4844,7 @@ function CopyButton({ value, ...props }) {
|
|
|
4714
4844
|
variant: "secondary",
|
|
4715
4845
|
size: "icon-sm",
|
|
4716
4846
|
...props,
|
|
4717
|
-
children: copied ? /* @__PURE__ */
|
|
4847
|
+
children: copied ? /* @__PURE__ */ jsx30(IconCheck, { className: "size-4 text-green-500" }) : /* @__PURE__ */ jsx30(IconCopy, { className: "size-4 text-zinc-500" })
|
|
4718
4848
|
}
|
|
4719
4849
|
);
|
|
4720
4850
|
}
|
|
@@ -4727,7 +4857,7 @@ var handleCopyClick = async (textToCopy) => {
|
|
|
4727
4857
|
};
|
|
4728
4858
|
|
|
4729
4859
|
// src/components/databrowser/components/display/input/custom-editor.tsx
|
|
4730
|
-
import { jsx as
|
|
4860
|
+
import { jsx as jsx31, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4731
4861
|
var CustomEditor = ({
|
|
4732
4862
|
language,
|
|
4733
4863
|
value,
|
|
@@ -4752,7 +4882,7 @@ var CustomEditor = ({
|
|
|
4752
4882
|
height
|
|
4753
4883
|
},
|
|
4754
4884
|
children: [
|
|
4755
|
-
/* @__PURE__ */
|
|
4885
|
+
/* @__PURE__ */ jsx31(
|
|
4756
4886
|
Editor,
|
|
4757
4887
|
{
|
|
4758
4888
|
loading: void 0,
|
|
@@ -4793,7 +4923,7 @@ var CustomEditor = ({
|
|
|
4793
4923
|
}
|
|
4794
4924
|
}
|
|
4795
4925
|
),
|
|
4796
|
-
showCopyButton && /* @__PURE__ */
|
|
4926
|
+
showCopyButton && /* @__PURE__ */ jsx31(
|
|
4797
4927
|
CopyButton,
|
|
4798
4928
|
{
|
|
4799
4929
|
value,
|
|
@@ -4806,7 +4936,7 @@ var CustomEditor = ({
|
|
|
4806
4936
|
};
|
|
4807
4937
|
|
|
4808
4938
|
// src/components/databrowser/components/display/input/use-field.tsx
|
|
4809
|
-
import { Fragment as Fragment4, jsx as
|
|
4939
|
+
import { Fragment as Fragment4, jsx as jsx32 } from "react/jsx-runtime";
|
|
4810
4940
|
var useField = ({
|
|
4811
4941
|
name,
|
|
4812
4942
|
form,
|
|
@@ -4819,7 +4949,7 @@ var useField = ({
|
|
|
4819
4949
|
name,
|
|
4820
4950
|
control: form.control
|
|
4821
4951
|
});
|
|
4822
|
-
const [contentType, setContentType] =
|
|
4952
|
+
const [contentType, setContentType] = useState7(
|
|
4823
4953
|
() => checkIsValidJSON(field.value) ? "JSON" : "Text"
|
|
4824
4954
|
);
|
|
4825
4955
|
useEffect7(() => {
|
|
@@ -4846,8 +4976,8 @@ var useField = ({
|
|
|
4846
4976
|
}
|
|
4847
4977
|
};
|
|
4848
4978
|
return {
|
|
4849
|
-
selector: /* @__PURE__ */
|
|
4850
|
-
editor: /* @__PURE__ */
|
|
4979
|
+
selector: /* @__PURE__ */ jsx32(ContentTypeSelect, { value: contentType, onChange: handleTypeChange, data: field.value }),
|
|
4980
|
+
editor: /* @__PURE__ */ jsx32(Fragment4, { children: /* @__PURE__ */ jsx32(
|
|
4851
4981
|
CustomEditor,
|
|
4852
4982
|
{
|
|
4853
4983
|
language: contentType === "JSON" ? "json" : "plaintext",
|
|
@@ -4871,13 +5001,13 @@ var checkIsValidJSON = (value) => {
|
|
|
4871
5001
|
};
|
|
4872
5002
|
|
|
4873
5003
|
// src/components/databrowser/components/display/display-list-edit.tsx
|
|
4874
|
-
import { jsx as
|
|
5004
|
+
import { jsx as jsx33, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4875
5005
|
var ListEditDisplay = ({
|
|
4876
5006
|
dataKey,
|
|
4877
5007
|
type,
|
|
4878
5008
|
item
|
|
4879
5009
|
}) => {
|
|
4880
|
-
return /* @__PURE__ */
|
|
5010
|
+
return /* @__PURE__ */ jsx33("div", { className: "grow rounded-md bg-zinc-100", children: /* @__PURE__ */ jsx33(ListEditForm, { item, type, dataKey }, item.key) });
|
|
4881
5011
|
};
|
|
4882
5012
|
var ListEditForm = ({
|
|
4883
5013
|
type,
|
|
@@ -4903,7 +5033,7 @@ var ListEditForm = ({
|
|
|
4903
5033
|
}
|
|
4904
5034
|
});
|
|
4905
5035
|
const { mutateAsync: editItem, isPending } = useEditListItem();
|
|
4906
|
-
const { setSelectedListItem } =
|
|
5036
|
+
const { setSelectedListItem } = useTab();
|
|
4907
5037
|
const [keyLabel, valueLabel] = headerLabels[type];
|
|
4908
5038
|
const onSubmit = form.handleSubmit(async ({ key, value }) => {
|
|
4909
5039
|
await editItem({
|
|
@@ -4916,9 +5046,9 @@ var ListEditForm = ({
|
|
|
4916
5046
|
});
|
|
4917
5047
|
setSelectedListItem(void 0);
|
|
4918
5048
|
});
|
|
4919
|
-
return /* @__PURE__ */
|
|
5049
|
+
return /* @__PURE__ */ jsx33(FormProvider, { ...form, children: /* @__PURE__ */ jsxs20("form", { onSubmit, className: "flex flex-col gap-2", children: [
|
|
4920
5050
|
/* @__PURE__ */ jsxs20("div", { className: "flex grow flex-col gap-2", children: [
|
|
4921
|
-
type !== "list" && /* @__PURE__ */
|
|
5051
|
+
type !== "list" && /* @__PURE__ */ jsx33(
|
|
4922
5052
|
FormItem,
|
|
4923
5053
|
{
|
|
4924
5054
|
readOnly: type === "stream",
|
|
@@ -4928,7 +5058,7 @@ var ListEditForm = ({
|
|
|
4928
5058
|
data: itemKey
|
|
4929
5059
|
}
|
|
4930
5060
|
),
|
|
4931
|
-
type === "zset" ? /* @__PURE__ */
|
|
5061
|
+
type === "zset" ? /* @__PURE__ */ jsx33(NumberFormItem, { name: "value", label: valueLabel }) : type !== "set" && /* @__PURE__ */ jsx33(
|
|
4932
5062
|
FormItem,
|
|
4933
5063
|
{
|
|
4934
5064
|
readOnly: type === "stream",
|
|
@@ -4947,9 +5077,9 @@ var ListEditForm = ({
|
|
|
4947
5077
|
type === "hash" && itemKey !== "" ? "justify-between" : "justify-end"
|
|
4948
5078
|
),
|
|
4949
5079
|
children: [
|
|
4950
|
-
type === "hash" && itemKey !== "" && /* @__PURE__ */
|
|
5080
|
+
type === "hash" && itemKey !== "" && /* @__PURE__ */ jsx33(HashFieldTTLBadge, { dataKey, field: itemKey }),
|
|
4951
5081
|
/* @__PURE__ */ jsxs20("div", { className: "flex gap-2", children: [
|
|
4952
|
-
/* @__PURE__ */
|
|
5082
|
+
/* @__PURE__ */ jsx33(
|
|
4953
5083
|
Button,
|
|
4954
5084
|
{
|
|
4955
5085
|
type: "button",
|
|
@@ -4959,17 +5089,17 @@ var ListEditForm = ({
|
|
|
4959
5089
|
children: "Cancel"
|
|
4960
5090
|
}
|
|
4961
5091
|
),
|
|
4962
|
-
/* @__PURE__ */
|
|
5092
|
+
/* @__PURE__ */ jsx33(
|
|
4963
5093
|
SimpleTooltip,
|
|
4964
5094
|
{
|
|
4965
5095
|
content: type === "stream" && !isNew ? "Streams are not mutable" : void 0,
|
|
4966
|
-
children: /* @__PURE__ */
|
|
5096
|
+
children: /* @__PURE__ */ jsx33(
|
|
4967
5097
|
Button,
|
|
4968
5098
|
{
|
|
4969
5099
|
variant: "primary",
|
|
4970
5100
|
type: "submit",
|
|
4971
5101
|
disabled: !form.formState.isValid || !form.formState.isDirty || type === "stream" && !isNew,
|
|
4972
|
-
children: /* @__PURE__ */
|
|
5102
|
+
children: /* @__PURE__ */ jsx33(Spinner, { isLoading: isPending, isLoadingText: "Saving", children: "Save" })
|
|
4973
5103
|
}
|
|
4974
5104
|
)
|
|
4975
5105
|
}
|
|
@@ -4982,12 +5112,12 @@ var ListEditForm = ({
|
|
|
4982
5112
|
};
|
|
4983
5113
|
var NumberFormItem = ({ name, label }) => {
|
|
4984
5114
|
return /* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-1", children: [
|
|
4985
|
-
/* @__PURE__ */
|
|
4986
|
-
/* @__PURE__ */
|
|
5115
|
+
/* @__PURE__ */ jsx33("div", { className: "flex", children: /* @__PURE__ */ jsx33("span", { className: "text-xs font-medium text-zinc-700", children: label }) }),
|
|
5116
|
+
/* @__PURE__ */ jsx33(
|
|
4987
5117
|
Controller2,
|
|
4988
5118
|
{
|
|
4989
5119
|
name,
|
|
4990
|
-
render: ({ field }) => /* @__PURE__ */
|
|
5120
|
+
render: ({ field }) => /* @__PURE__ */ jsx33(
|
|
4991
5121
|
"input",
|
|
4992
5122
|
{
|
|
4993
5123
|
className: "plain-input rounded-md border border-zinc-300 px-3 py-1 shadow-sm",
|
|
@@ -5017,18 +5147,18 @@ var FormItem = ({
|
|
|
5017
5147
|
});
|
|
5018
5148
|
return /* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-1", children: [
|
|
5019
5149
|
/* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-1 text-xs", children: [
|
|
5020
|
-
/* @__PURE__ */
|
|
5150
|
+
/* @__PURE__ */ jsx33("span", { className: "font-medium text-zinc-700", children: label }),
|
|
5021
5151
|
" ",
|
|
5022
|
-
/* @__PURE__ */
|
|
5152
|
+
/* @__PURE__ */ jsx33("span", { className: "text-zinc-300", children: "/" }),
|
|
5023
5153
|
selector
|
|
5024
5154
|
] }),
|
|
5025
|
-
/* @__PURE__ */
|
|
5155
|
+
/* @__PURE__ */ jsx33("div", { className: "overflow-hidden rounded-md border border-zinc-300 bg-white p-2 shadow-sm", children: editor })
|
|
5026
5156
|
] });
|
|
5027
5157
|
};
|
|
5028
5158
|
|
|
5029
5159
|
// src/components/databrowser/components/display/hash/hash-field-ttl-info.tsx
|
|
5030
|
-
import { useEffect as useEffect8, useState as
|
|
5031
|
-
import { jsx as
|
|
5160
|
+
import { useEffect as useEffect8, useState as useState8 } from "react";
|
|
5161
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
5032
5162
|
var HashFieldTTLInfo = ({
|
|
5033
5163
|
dataKey,
|
|
5034
5164
|
field,
|
|
@@ -5036,7 +5166,7 @@ var HashFieldTTLInfo = ({
|
|
|
5036
5166
|
}) => {
|
|
5037
5167
|
const { data } = useFetchHashFieldExpires({ dataKey, fields });
|
|
5038
5168
|
const expireAt = data?.[field];
|
|
5039
|
-
const [ttl, setTTL] =
|
|
5169
|
+
const [ttl, setTTL] = useState8(() => calculateTTL(expireAt));
|
|
5040
5170
|
useEffect8(() => {
|
|
5041
5171
|
setTTL(calculateTTL(expireAt));
|
|
5042
5172
|
const interval = setInterval(() => {
|
|
@@ -5045,11 +5175,11 @@ var HashFieldTTLInfo = ({
|
|
|
5045
5175
|
return () => clearInterval(interval);
|
|
5046
5176
|
}, [expireAt]);
|
|
5047
5177
|
if (!expireAt || expireAt === TTL_NOT_FOUND || expireAt === TTL_INFINITE) return;
|
|
5048
|
-
return /* @__PURE__ */
|
|
5178
|
+
return /* @__PURE__ */ jsx34("span", { className: "block min-w-[30px] whitespace-nowrap text-right text-red-600", children: formatTime(ttl ?? 0) });
|
|
5049
5179
|
};
|
|
5050
5180
|
|
|
5051
5181
|
// src/components/databrowser/components/display/display-list.tsx
|
|
5052
|
-
import { Fragment as Fragment5, jsx as
|
|
5182
|
+
import { Fragment as Fragment5, jsx as jsx35, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
5053
5183
|
var headerLabels = {
|
|
5054
5184
|
list: ["Index", "Content"],
|
|
5055
5185
|
hash: ["Field", "Value"],
|
|
@@ -5058,12 +5188,12 @@ var headerLabels = {
|
|
|
5058
5188
|
set: ["Value", ""]
|
|
5059
5189
|
};
|
|
5060
5190
|
var ListDisplay = ({ dataKey, type }) => {
|
|
5061
|
-
const { selectedListItem } =
|
|
5191
|
+
const { selectedListItem } = useTab();
|
|
5062
5192
|
const query = useFetchListItems({ dataKey, type });
|
|
5063
5193
|
return /* @__PURE__ */ jsxs21("div", { className: "flex h-full flex-col gap-2", children: [
|
|
5064
|
-
/* @__PURE__ */
|
|
5065
|
-
selectedListItem && /* @__PURE__ */
|
|
5066
|
-
/* @__PURE__ */
|
|
5194
|
+
/* @__PURE__ */ jsx35(DisplayHeader, { dataKey, type }),
|
|
5195
|
+
selectedListItem && /* @__PURE__ */ jsx35(ListEditDisplay, { dataKey, type, item: selectedListItem }),
|
|
5196
|
+
/* @__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
5197
|
] });
|
|
5068
5198
|
};
|
|
5069
5199
|
var ListItems = ({
|
|
@@ -5071,11 +5201,11 @@ var ListItems = ({
|
|
|
5071
5201
|
type,
|
|
5072
5202
|
dataKey
|
|
5073
5203
|
}) => {
|
|
5074
|
-
const { setSelectedListItem } =
|
|
5075
|
-
const keys =
|
|
5076
|
-
const fields =
|
|
5204
|
+
const { setSelectedListItem } = useTab();
|
|
5205
|
+
const keys = useMemo7(() => query.data?.pages.flatMap((page) => page.keys) ?? [], [query.data]);
|
|
5206
|
+
const fields = useMemo7(() => keys.map((key) => key.key), [keys]);
|
|
5077
5207
|
const { mutate: editItem } = useEditListItem();
|
|
5078
|
-
return /* @__PURE__ */
|
|
5208
|
+
return /* @__PURE__ */ jsx35(Fragment5, { children: keys.map(({ key, value }, i) => /* @__PURE__ */ jsxs21(
|
|
5079
5209
|
"tr",
|
|
5080
5210
|
{
|
|
5081
5211
|
"data-item-key": key,
|
|
@@ -5083,9 +5213,9 @@ var ListItems = ({
|
|
|
5083
5213
|
onClick: () => {
|
|
5084
5214
|
setSelectedListItem({ key });
|
|
5085
5215
|
},
|
|
5086
|
-
className: cn("h-10 border-b border-b-zinc-100 hover:bg-zinc-100
|
|
5216
|
+
className: cn("h-10 border-b border-b-zinc-100 transition-colors hover:bg-zinc-100"),
|
|
5087
5217
|
children: [
|
|
5088
|
-
/* @__PURE__ */
|
|
5218
|
+
/* @__PURE__ */ jsx35(
|
|
5089
5219
|
"td",
|
|
5090
5220
|
{
|
|
5091
5221
|
className: cn(
|
|
@@ -5095,14 +5225,14 @@ var ListItems = ({
|
|
|
5095
5225
|
children: key
|
|
5096
5226
|
}
|
|
5097
5227
|
),
|
|
5098
|
-
value !== void 0 && /* @__PURE__ */
|
|
5228
|
+
value !== void 0 && /* @__PURE__ */ jsx35(
|
|
5099
5229
|
"td",
|
|
5100
5230
|
{
|
|
5101
5231
|
className: cn("cursor-pointer truncate px-3", type === "zset" ? "w-24" : "max-w-0"),
|
|
5102
5232
|
children: value
|
|
5103
5233
|
}
|
|
5104
5234
|
),
|
|
5105
|
-
type !== "stream" && /* @__PURE__ */
|
|
5235
|
+
type !== "stream" && /* @__PURE__ */ jsx35(
|
|
5106
5236
|
"td",
|
|
5107
5237
|
{
|
|
5108
5238
|
className: "w-0 min-w-0 p-0",
|
|
@@ -5110,8 +5240,8 @@ var ListItems = ({
|
|
|
5110
5240
|
e.stopPropagation();
|
|
5111
5241
|
},
|
|
5112
5242
|
children: /* @__PURE__ */ jsxs21("div", { className: "flex items-center justify-end gap-2", children: [
|
|
5113
|
-
type === "hash" && /* @__PURE__ */
|
|
5114
|
-
/* @__PURE__ */
|
|
5243
|
+
type === "hash" && /* @__PURE__ */ jsx35(HashFieldTTLInfo, { dataKey, field: key, fields }),
|
|
5244
|
+
/* @__PURE__ */ jsx35(
|
|
5115
5245
|
DeleteAlertDialog,
|
|
5116
5246
|
{
|
|
5117
5247
|
deletionType: "item",
|
|
@@ -5125,14 +5255,14 @@ var ListItems = ({
|
|
|
5125
5255
|
newKey: void 0
|
|
5126
5256
|
});
|
|
5127
5257
|
},
|
|
5128
|
-
children: /* @__PURE__ */
|
|
5258
|
+
children: /* @__PURE__ */ jsx35(
|
|
5129
5259
|
Button,
|
|
5130
5260
|
{
|
|
5131
5261
|
className: "",
|
|
5132
5262
|
size: "icon-sm",
|
|
5133
5263
|
variant: "secondary",
|
|
5134
5264
|
onClick: (e) => e.stopPropagation(),
|
|
5135
|
-
children: /* @__PURE__ */
|
|
5265
|
+
children: /* @__PURE__ */ jsx35(IconTrash, { className: "size-4 text-zinc-500" })
|
|
5136
5266
|
}
|
|
5137
5267
|
)
|
|
5138
5268
|
}
|
|
@@ -5149,18 +5279,12 @@ var ListItems = ({
|
|
|
5149
5279
|
// src/components/databrowser/components/display/display-simple.tsx
|
|
5150
5280
|
import { useEffect as useEffect9 } from "react";
|
|
5151
5281
|
import { useForm as useForm3 } from "react-hook-form";
|
|
5152
|
-
import { Fragment as Fragment6, jsx as
|
|
5282
|
+
import { Fragment as Fragment6, jsx as jsx36, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
5153
5283
|
var EditorDisplay = ({ dataKey, type }) => {
|
|
5154
5284
|
const { data } = useFetchSimpleKey(dataKey, type);
|
|
5155
5285
|
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
|
-
)
|
|
5286
|
+
/* @__PURE__ */ jsx36(DisplayHeader, { dataKey, type, content: data ?? void 0 }),
|
|
5287
|
+
/* @__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
5288
|
] });
|
|
5165
5289
|
};
|
|
5166
5290
|
var EditorDisplayForm = ({
|
|
@@ -5181,12 +5305,12 @@ var EditorDisplayForm = ({
|
|
|
5181
5305
|
};
|
|
5182
5306
|
return /* @__PURE__ */ jsxs22(Fragment6, { children: [
|
|
5183
5307
|
/* @__PURE__ */ jsxs22("div", { className: "flex grow flex-col gap-1", children: [
|
|
5184
|
-
/* @__PURE__ */
|
|
5185
|
-
/* @__PURE__ */
|
|
5308
|
+
/* @__PURE__ */ jsx36("div", { className: "flex shrink-0 items-center gap-2", children: type === "json" ? /* @__PURE__ */ jsx36("div", {}) : selector }),
|
|
5309
|
+
/* @__PURE__ */ jsx36("div", { className: "grow rounded-md border border-zinc-300 bg-white p-1", children: editor })
|
|
5186
5310
|
] }),
|
|
5187
|
-
/* @__PURE__ */
|
|
5188
|
-
form.formState.isDirty && /* @__PURE__ */
|
|
5189
|
-
/* @__PURE__ */
|
|
5311
|
+
/* @__PURE__ */ jsx36("div", { className: "flex shrink-0 items-center gap-2", children: /* @__PURE__ */ jsxs22("div", { className: "ml-auto flex gap-2", children: [
|
|
5312
|
+
form.formState.isDirty && /* @__PURE__ */ jsx36(Button, { onClick: handleCancel, children: "Cancel" }),
|
|
5313
|
+
/* @__PURE__ */ jsx36(
|
|
5190
5314
|
Button,
|
|
5191
5315
|
{
|
|
5192
5316
|
variant: "primary",
|
|
@@ -5194,7 +5318,7 @@ var EditorDisplayForm = ({
|
|
|
5194
5318
|
await setKey(value);
|
|
5195
5319
|
}),
|
|
5196
5320
|
disabled: !form.formState.isValid || !form.formState.isDirty,
|
|
5197
|
-
children: /* @__PURE__ */
|
|
5321
|
+
children: /* @__PURE__ */ jsx36(Spinner, { isLoading: isSettingKey, isLoadingText: "Saving", children: "Save" })
|
|
5198
5322
|
}
|
|
5199
5323
|
)
|
|
5200
5324
|
] }) })
|
|
@@ -5202,19 +5326,19 @@ var EditorDisplayForm = ({
|
|
|
5202
5326
|
};
|
|
5203
5327
|
|
|
5204
5328
|
// src/components/databrowser/components/display/index.tsx
|
|
5205
|
-
import { Fragment as Fragment7, jsx as
|
|
5329
|
+
import { Fragment as Fragment7, jsx as jsx37 } from "react/jsx-runtime";
|
|
5206
5330
|
var DataDisplay = () => {
|
|
5207
|
-
const { selectedKey } =
|
|
5331
|
+
const { selectedKey } = useTab();
|
|
5208
5332
|
const { query } = useKeys();
|
|
5209
5333
|
const type = useKeyType(selectedKey);
|
|
5210
|
-
return /* @__PURE__ */
|
|
5334
|
+
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
5335
|
};
|
|
5212
5336
|
|
|
5213
5337
|
// src/components/databrowser/components/sidebar/index.tsx
|
|
5214
5338
|
import { IconRefresh } from "@tabler/icons-react";
|
|
5215
5339
|
|
|
5216
5340
|
// src/components/databrowser/components/add-key-modal.tsx
|
|
5217
|
-
import { useState as
|
|
5341
|
+
import { useState as useState9 } from "react";
|
|
5218
5342
|
import { DialogDescription as DialogDescription2 } from "@radix-ui/react-dialog";
|
|
5219
5343
|
import { PlusIcon } from "@radix-ui/react-icons";
|
|
5220
5344
|
import { Controller as Controller3, useForm as useForm4 } from "react-hook-form";
|
|
@@ -5222,12 +5346,12 @@ import { Controller as Controller3, useForm as useForm4 } from "react-hook-form"
|
|
|
5222
5346
|
// src/components/ui/dialog.tsx
|
|
5223
5347
|
import * as React12 from "react";
|
|
5224
5348
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
5225
|
-
import { jsx as
|
|
5349
|
+
import { jsx as jsx38, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
5226
5350
|
var Dialog = DialogPrimitive.Root;
|
|
5227
5351
|
var DialogTrigger = DialogPrimitive.Trigger;
|
|
5228
|
-
var DialogPortal = (props) => /* @__PURE__ */
|
|
5352
|
+
var DialogPortal = (props) => /* @__PURE__ */ jsx38(DialogPrimitive.Portal, { container: portalRoot, ...props });
|
|
5229
5353
|
DialogPortal.displayName = DialogPrimitive.Portal.displayName;
|
|
5230
|
-
var DialogOverlay = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
5354
|
+
var DialogOverlay = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx38(
|
|
5231
5355
|
DialogPrimitive.Overlay,
|
|
5232
5356
|
{
|
|
5233
5357
|
ref,
|
|
@@ -5242,7 +5366,7 @@ var DialogOverlay = React12.forwardRef(({ className, ...props }, ref) => /* @__P
|
|
|
5242
5366
|
));
|
|
5243
5367
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
5244
5368
|
var DialogContent = React12.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs23(DialogPortal, { children: [
|
|
5245
|
-
/* @__PURE__ */
|
|
5369
|
+
/* @__PURE__ */ jsx38(DialogOverlay, {}),
|
|
5246
5370
|
/* @__PURE__ */ jsxs23(
|
|
5247
5371
|
DialogPrimitive.Content,
|
|
5248
5372
|
{
|
|
@@ -5264,7 +5388,7 @@ var DialogContent = React12.forwardRef(({ className, children, ...props }, ref)
|
|
|
5264
5388
|
children: [
|
|
5265
5389
|
children,
|
|
5266
5390
|
/* @__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__ */
|
|
5391
|
+
/* @__PURE__ */ jsx38(
|
|
5268
5392
|
"svg",
|
|
5269
5393
|
{
|
|
5270
5394
|
width: "15",
|
|
@@ -5273,7 +5397,7 @@ var DialogContent = React12.forwardRef(({ className, children, ...props }, ref)
|
|
|
5273
5397
|
fill: "none",
|
|
5274
5398
|
xmlns: "http://www.w3.org/2000/svg",
|
|
5275
5399
|
className: "h-4 w-4",
|
|
5276
|
-
children: /* @__PURE__ */
|
|
5400
|
+
children: /* @__PURE__ */ jsx38(
|
|
5277
5401
|
"path",
|
|
5278
5402
|
{
|
|
5279
5403
|
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 +5408,16 @@ var DialogContent = React12.forwardRef(({ className, children, ...props }, ref)
|
|
|
5284
5408
|
)
|
|
5285
5409
|
}
|
|
5286
5410
|
),
|
|
5287
|
-
/* @__PURE__ */
|
|
5411
|
+
/* @__PURE__ */ jsx38("span", { className: "sr-only", children: "Close" })
|
|
5288
5412
|
] })
|
|
5289
5413
|
]
|
|
5290
5414
|
}
|
|
5291
5415
|
)
|
|
5292
5416
|
] }));
|
|
5293
5417
|
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
5294
|
-
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */
|
|
5418
|
+
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsx38("div", { className: cn("flex flex-col space-y-1.5 text-center sm:text-left", className), ...props });
|
|
5295
5419
|
DialogHeader.displayName = "DialogHeader";
|
|
5296
|
-
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */
|
|
5420
|
+
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx38(
|
|
5297
5421
|
"div",
|
|
5298
5422
|
{
|
|
5299
5423
|
className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className),
|
|
@@ -5301,7 +5425,7 @@ var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx36(
|
|
|
5301
5425
|
}
|
|
5302
5426
|
);
|
|
5303
5427
|
DialogFooter.displayName = "DialogFooter";
|
|
5304
|
-
var DialogTitle = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
5428
|
+
var DialogTitle = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx38(
|
|
5305
5429
|
DialogPrimitive.Title,
|
|
5306
5430
|
{
|
|
5307
5431
|
ref,
|
|
@@ -5310,7 +5434,7 @@ var DialogTitle = React12.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
5310
5434
|
}
|
|
5311
5435
|
));
|
|
5312
5436
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
5313
|
-
var DialogDescription = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
5437
|
+
var DialogDescription = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx38(
|
|
5314
5438
|
DialogPrimitive.Description,
|
|
5315
5439
|
{
|
|
5316
5440
|
ref,
|
|
@@ -5321,10 +5445,10 @@ var DialogDescription = React12.forwardRef(({ className, ...props }, ref) => /*
|
|
|
5321
5445
|
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
5322
5446
|
|
|
5323
5447
|
// src/components/databrowser/components/add-key-modal.tsx
|
|
5324
|
-
import { jsx as
|
|
5448
|
+
import { jsx as jsx39, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
5325
5449
|
function AddKeyModal() {
|
|
5326
|
-
const { setSelectedKey } =
|
|
5327
|
-
const [open, setOpen] =
|
|
5450
|
+
const { setSelectedKey } = useTab();
|
|
5451
|
+
const [open, setOpen] = useState9(false);
|
|
5328
5452
|
const { mutateAsync: addKey, isPending } = useAddKey();
|
|
5329
5453
|
const { control, handleSubmit, formState, reset } = useForm4({
|
|
5330
5454
|
defaultValues: {
|
|
@@ -5353,24 +5477,24 @@ function AddKeyModal() {
|
|
|
5353
5477
|
setOpen(open2);
|
|
5354
5478
|
},
|
|
5355
5479
|
children: [
|
|
5356
|
-
/* @__PURE__ */
|
|
5480
|
+
/* @__PURE__ */ jsx39(DialogTrigger, { asChild: true, children: /* @__PURE__ */ jsx39(Button, { variant: "primary", size: "icon-sm", children: /* @__PURE__ */ jsx39(PlusIcon, { className: "size-4" }) }) }),
|
|
5357
5481
|
/* @__PURE__ */ jsxs24(DialogContent, { className: "max-w-[400px]", children: [
|
|
5358
|
-
/* @__PURE__ */
|
|
5359
|
-
/* @__PURE__ */
|
|
5482
|
+
/* @__PURE__ */ jsx39(DialogHeader, { children: /* @__PURE__ */ jsx39(DialogTitle, { children: "Create new key" }) }),
|
|
5483
|
+
/* @__PURE__ */ jsx39("div", { className: "sr-only", children: /* @__PURE__ */ jsx39(DialogDescription2, { children: "Create new key" }) }),
|
|
5360
5484
|
/* @__PURE__ */ jsxs24("form", { className: "mt-4", onSubmit, children: [
|
|
5361
5485
|
/* @__PURE__ */ jsxs24("div", { className: "flex gap-1", children: [
|
|
5362
|
-
/* @__PURE__ */
|
|
5486
|
+
/* @__PURE__ */ jsx39(
|
|
5363
5487
|
Controller3,
|
|
5364
5488
|
{
|
|
5365
5489
|
control,
|
|
5366
5490
|
name: "type",
|
|
5367
5491
|
render: ({ field }) => /* @__PURE__ */ jsxs24(Select, { value: field.value, onValueChange: field.onChange, children: [
|
|
5368
|
-
/* @__PURE__ */
|
|
5369
|
-
/* @__PURE__ */
|
|
5492
|
+
/* @__PURE__ */ jsx39(SelectTrigger, { className: "h-8 w-auto pl-[3px] pr-8", children: /* @__PURE__ */ jsx39(SelectValue, {}) }),
|
|
5493
|
+
/* @__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
5494
|
] })
|
|
5371
5495
|
}
|
|
5372
5496
|
),
|
|
5373
|
-
/* @__PURE__ */
|
|
5497
|
+
/* @__PURE__ */ jsx39(
|
|
5374
5498
|
Controller3,
|
|
5375
5499
|
{
|
|
5376
5500
|
rules: {
|
|
@@ -5378,14 +5502,14 @@ function AddKeyModal() {
|
|
|
5378
5502
|
},
|
|
5379
5503
|
control,
|
|
5380
5504
|
name: "key",
|
|
5381
|
-
render: ({ field }) => /* @__PURE__ */
|
|
5505
|
+
render: ({ field }) => /* @__PURE__ */ jsx39(Input, { placeholder: "mykey", ...field, className: "h-8 grow" })
|
|
5382
5506
|
}
|
|
5383
5507
|
)
|
|
5384
5508
|
] }),
|
|
5385
|
-
formState.errors.key && /* @__PURE__ */
|
|
5386
|
-
/* @__PURE__ */
|
|
5509
|
+
formState.errors.key && /* @__PURE__ */ jsx39("p", { className: "mb-3 mt-2 text-xs text-red-500", children: formState.errors.key?.message }),
|
|
5510
|
+
/* @__PURE__ */ jsx39("p", { className: "mt-2 text-xs text-zinc-500", children: "After creating the key, you can edit the value" }),
|
|
5387
5511
|
/* @__PURE__ */ jsxs24("div", { className: "mt-6 flex justify-end gap-2", children: [
|
|
5388
|
-
/* @__PURE__ */
|
|
5512
|
+
/* @__PURE__ */ jsx39(
|
|
5389
5513
|
Button,
|
|
5390
5514
|
{
|
|
5391
5515
|
type: "button",
|
|
@@ -5396,7 +5520,7 @@ function AddKeyModal() {
|
|
|
5396
5520
|
children: "Cancel"
|
|
5397
5521
|
}
|
|
5398
5522
|
),
|
|
5399
|
-
/* @__PURE__ */
|
|
5523
|
+
/* @__PURE__ */ jsx39(Button, { variant: "primary", type: "submit", children: /* @__PURE__ */ jsx39(Spinner, { isLoading: isPending, isLoadingText: "Creating", children: "Create" }) })
|
|
5400
5524
|
] })
|
|
5401
5525
|
] })
|
|
5402
5526
|
] })
|
|
@@ -5406,24 +5530,24 @@ function AddKeyModal() {
|
|
|
5406
5530
|
}
|
|
5407
5531
|
|
|
5408
5532
|
// src/components/databrowser/components/sidebar/empty.tsx
|
|
5409
|
-
import { jsx as
|
|
5533
|
+
import { jsx as jsx40, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
5410
5534
|
var Empty = () => {
|
|
5411
|
-
return /* @__PURE__ */
|
|
5412
|
-
/* @__PURE__ */
|
|
5413
|
-
/* @__PURE__ */
|
|
5535
|
+
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: [
|
|
5536
|
+
/* @__PURE__ */ jsx40("p", { className: "text-md font-medium", children: "Data on a break" }),
|
|
5537
|
+
/* @__PURE__ */ jsx40("p", { className: "text-balance text-center", children: '"Quick, lure it back with some CLI magic!"' })
|
|
5414
5538
|
] }) });
|
|
5415
5539
|
};
|
|
5416
5540
|
|
|
5417
5541
|
// src/components/databrowser/components/sidebar-context-menu.tsx
|
|
5418
|
-
import { useState as
|
|
5542
|
+
import { useState as useState10 } from "react";
|
|
5419
5543
|
import { ContextMenuSeparator as ContextMenuSeparator3 } from "@radix-ui/react-context-menu";
|
|
5420
|
-
import { Fragment as Fragment8, jsx as
|
|
5544
|
+
import { Fragment as Fragment8, jsx as jsx41, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
5421
5545
|
var SidebarContextMenu = ({ children }) => {
|
|
5422
5546
|
const { mutate: deleteKey } = useDeleteKey();
|
|
5423
|
-
const [isAlertOpen, setAlertOpen] =
|
|
5424
|
-
const [dataKey, setDataKey] =
|
|
5547
|
+
const [isAlertOpen, setAlertOpen] = useState10(false);
|
|
5548
|
+
const [dataKey, setDataKey] = useState10("");
|
|
5425
5549
|
return /* @__PURE__ */ jsxs26(Fragment8, { children: [
|
|
5426
|
-
/* @__PURE__ */
|
|
5550
|
+
/* @__PURE__ */ jsx41(
|
|
5427
5551
|
DeleteAlertDialog,
|
|
5428
5552
|
{
|
|
5429
5553
|
deletionType: "key",
|
|
@@ -5437,7 +5561,7 @@ var SidebarContextMenu = ({ children }) => {
|
|
|
5437
5561
|
}
|
|
5438
5562
|
),
|
|
5439
5563
|
/* @__PURE__ */ jsxs26(ContextMenu, { children: [
|
|
5440
|
-
/* @__PURE__ */
|
|
5564
|
+
/* @__PURE__ */ jsx41(
|
|
5441
5565
|
ContextMenuTrigger,
|
|
5442
5566
|
{
|
|
5443
5567
|
onContextMenu: (e) => {
|
|
@@ -5453,7 +5577,7 @@ var SidebarContextMenu = ({ children }) => {
|
|
|
5453
5577
|
}
|
|
5454
5578
|
),
|
|
5455
5579
|
/* @__PURE__ */ jsxs26(ContextMenuContent, { children: [
|
|
5456
|
-
/* @__PURE__ */
|
|
5580
|
+
/* @__PURE__ */ jsx41(
|
|
5457
5581
|
ContextMenuItem,
|
|
5458
5582
|
{
|
|
5459
5583
|
onClick: () => {
|
|
@@ -5465,18 +5589,18 @@ var SidebarContextMenu = ({ children }) => {
|
|
|
5465
5589
|
children: "Copy key"
|
|
5466
5590
|
}
|
|
5467
5591
|
),
|
|
5468
|
-
/* @__PURE__ */
|
|
5469
|
-
/* @__PURE__ */
|
|
5592
|
+
/* @__PURE__ */ jsx41(ContextMenuSeparator3, {}),
|
|
5593
|
+
/* @__PURE__ */ jsx41(ContextMenuItem, { onClick: () => setAlertOpen(true), children: "Delete key" })
|
|
5470
5594
|
] })
|
|
5471
5595
|
] })
|
|
5472
5596
|
] });
|
|
5473
5597
|
};
|
|
5474
5598
|
|
|
5475
5599
|
// src/components/databrowser/components/sidebar/keys-list.tsx
|
|
5476
|
-
import { Fragment as Fragment9, jsx as
|
|
5600
|
+
import { Fragment as Fragment9, jsx as jsx42, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
5477
5601
|
var KeysList = () => {
|
|
5478
5602
|
const { keys } = useKeys();
|
|
5479
|
-
return /* @__PURE__ */
|
|
5603
|
+
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
5604
|
};
|
|
5481
5605
|
var keyStyles = {
|
|
5482
5606
|
string: "border-sky-400 !bg-sky-50 text-sky-900",
|
|
@@ -5488,7 +5612,7 @@ var keyStyles = {
|
|
|
5488
5612
|
stream: "border-green-400 !bg-green-50 text-green-900"
|
|
5489
5613
|
};
|
|
5490
5614
|
var KeyItem = ({ data, nextKey }) => {
|
|
5491
|
-
const { selectedKey, setSelectedKey } =
|
|
5615
|
+
const { selectedKey, setSelectedKey } = useTab();
|
|
5492
5616
|
const [dataKey, dataType] = data;
|
|
5493
5617
|
const isKeySelected = selectedKey === dataKey;
|
|
5494
5618
|
const isNextKeySelected = selectedKey === nextKey;
|
|
@@ -5498,49 +5622,125 @@ var KeyItem = ({ data, nextKey }) => {
|
|
|
5498
5622
|
"data-key": dataKey,
|
|
5499
5623
|
variant: isKeySelected ? "default" : "ghost",
|
|
5500
5624
|
className: cn(
|
|
5501
|
-
"relative flex h-10 w-full items-center justify-start gap-2 px-3 py-0 ",
|
|
5625
|
+
"relative flex h-10 w-full items-center justify-start gap-2 px-3 py-0 !ring-0 focus-visible:bg-zinc-50",
|
|
5502
5626
|
"select-none border border-transparent text-left",
|
|
5503
5627
|
isKeySelected && "shadow-sm",
|
|
5504
5628
|
isKeySelected && keyStyles[dataType]
|
|
5505
5629
|
),
|
|
5506
5630
|
onClick: () => setSelectedKey(dataKey),
|
|
5507
5631
|
children: [
|
|
5508
|
-
/* @__PURE__ */
|
|
5509
|
-
/* @__PURE__ */
|
|
5510
|
-
!isKeySelected && !isNextKeySelected && /* @__PURE__ */
|
|
5632
|
+
/* @__PURE__ */ jsx42(TypeTag, { variant: dataType, type: "icon" }),
|
|
5633
|
+
/* @__PURE__ */ jsx42("p", { className: "truncate whitespace-nowrap", children: dataKey }),
|
|
5634
|
+
!isKeySelected && !isNextKeySelected && /* @__PURE__ */ jsx42("span", { className: "absolute -bottom-px left-3 right-3 h-px bg-zinc-100" })
|
|
5511
5635
|
]
|
|
5512
5636
|
}
|
|
5513
5637
|
);
|
|
5514
5638
|
};
|
|
5515
5639
|
|
|
5516
5640
|
// src/components/databrowser/components/sidebar/search-input.tsx
|
|
5517
|
-
import { useState as
|
|
5641
|
+
import { useState as useState11, useRef as useRef2, useEffect as useEffect10 } from "react";
|
|
5518
5642
|
import { IconX } from "@tabler/icons-react";
|
|
5519
|
-
import { jsx as
|
|
5643
|
+
import { jsx as jsx43, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
5644
|
+
var dedupeSearchHistory = (history) => {
|
|
5645
|
+
const seen = /* @__PURE__ */ new Set();
|
|
5646
|
+
return history.filter((item) => {
|
|
5647
|
+
if (!item || seen.has(item)) return false;
|
|
5648
|
+
seen.add(item);
|
|
5649
|
+
return true;
|
|
5650
|
+
});
|
|
5651
|
+
};
|
|
5520
5652
|
var SearchInput = () => {
|
|
5521
|
-
const { setSearchKey, search } =
|
|
5522
|
-
const
|
|
5523
|
-
const
|
|
5653
|
+
const { setSearchKey, search } = useTab();
|
|
5654
|
+
const { searchHistory, addSearchHistory } = useDatabrowserStore();
|
|
5655
|
+
const [state, setState] = useState11(search.key);
|
|
5656
|
+
const [isFocus, setIsFocus] = useState11(false);
|
|
5657
|
+
const [focusedIndex, setFocusedIndex] = useState11(-1);
|
|
5658
|
+
const inputRef = useRef2(null);
|
|
5659
|
+
const historyItemRefs = useRef2([]);
|
|
5660
|
+
const handleSubmit = (value) => {
|
|
5524
5661
|
if (value.trim() !== "" && !value.includes("*")) value = `${value}*`;
|
|
5662
|
+
addSearchHistory(value);
|
|
5525
5663
|
setSearchKey(value);
|
|
5526
5664
|
setState(value);
|
|
5527
5665
|
};
|
|
5528
|
-
|
|
5529
|
-
|
|
5530
|
-
|
|
5531
|
-
|
|
5532
|
-
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
5666
|
+
const filteredHistory = dedupeSearchHistory(
|
|
5667
|
+
searchHistory.filter((item) => item.includes(state) && item !== state)
|
|
5668
|
+
).slice(0, 5).map((item) => item.endsWith("*") ? item.slice(0, -1) : item);
|
|
5669
|
+
useEffect10(() => {
|
|
5670
|
+
setFocusedIndex(-1);
|
|
5671
|
+
}, [filteredHistory.length]);
|
|
5672
|
+
const handleKeyDown = (e) => {
|
|
5673
|
+
if (e.key === "Enter") {
|
|
5674
|
+
const text = focusedIndex >= 0 && focusedIndex < filteredHistory.length ? filteredHistory[focusedIndex] : e.currentTarget.value;
|
|
5675
|
+
handleSubmit(text);
|
|
5676
|
+
} else if (e.key === "Escape") {
|
|
5677
|
+
setState("");
|
|
5678
|
+
setFocusedIndex(-1);
|
|
5679
|
+
inputRef.current?.blur();
|
|
5680
|
+
} else if (e.key === "ArrowDown" || e.key === "Tab" && !e.shiftKey) {
|
|
5681
|
+
e.preventDefault();
|
|
5682
|
+
if (focusedIndex < filteredHistory.length - 1) {
|
|
5683
|
+
setFocusedIndex(focusedIndex + 1);
|
|
5684
|
+
} else if (filteredHistory.length > 0) {
|
|
5685
|
+
setFocusedIndex(0);
|
|
5542
5686
|
}
|
|
5543
|
-
)
|
|
5687
|
+
} else if (e.key === "ArrowUp" || e.key === "Tab" && e.shiftKey) {
|
|
5688
|
+
e.preventDefault();
|
|
5689
|
+
if (focusedIndex > 0) {
|
|
5690
|
+
setFocusedIndex(focusedIndex - 1);
|
|
5691
|
+
} else if (filteredHistory.length > 0 && focusedIndex === 0) {
|
|
5692
|
+
setFocusedIndex(-1);
|
|
5693
|
+
inputRef.current?.focus();
|
|
5694
|
+
} else if (filteredHistory.length > 0) {
|
|
5695
|
+
setFocusedIndex(filteredHistory.length - 1);
|
|
5696
|
+
}
|
|
5697
|
+
}
|
|
5698
|
+
};
|
|
5699
|
+
return /* @__PURE__ */ jsxs28("div", { className: "relative grow", children: [
|
|
5700
|
+
/* @__PURE__ */ jsxs28(Popover, { open: isFocus && filteredHistory.length > 0, children: [
|
|
5701
|
+
/* @__PURE__ */ jsx43(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx43("div", { children: /* @__PURE__ */ jsx43(
|
|
5702
|
+
Input,
|
|
5703
|
+
{
|
|
5704
|
+
ref: inputRef,
|
|
5705
|
+
placeholder: "Search",
|
|
5706
|
+
className: "rounded-l-none border-zinc-300 font-normal",
|
|
5707
|
+
onKeyDown: handleKeyDown,
|
|
5708
|
+
onChange: (e) => {
|
|
5709
|
+
setState(e.currentTarget.value);
|
|
5710
|
+
if (e.currentTarget.value.trim() === "") handleSubmit("");
|
|
5711
|
+
},
|
|
5712
|
+
value: state,
|
|
5713
|
+
onFocus: () => {
|
|
5714
|
+
setIsFocus(true);
|
|
5715
|
+
setFocusedIndex(-1);
|
|
5716
|
+
},
|
|
5717
|
+
onBlur: () => setIsFocus(false)
|
|
5718
|
+
}
|
|
5719
|
+
) }) }),
|
|
5720
|
+
/* @__PURE__ */ jsx43(
|
|
5721
|
+
PopoverContent,
|
|
5722
|
+
{
|
|
5723
|
+
className: "w-[--radix-popover-trigger-width] divide-y px-3 py-2 text-[13px] text-zinc-900",
|
|
5724
|
+
autoFocus: false,
|
|
5725
|
+
onOpenAutoFocus: (e) => {
|
|
5726
|
+
e.preventDefault();
|
|
5727
|
+
e.stopPropagation();
|
|
5728
|
+
},
|
|
5729
|
+
children: filteredHistory.map((item, index) => /* @__PURE__ */ jsx43("div", { className: "w-full py-[3px]", children: /* @__PURE__ */ jsx43(
|
|
5730
|
+
"button",
|
|
5731
|
+
{
|
|
5732
|
+
ref: (el) => {
|
|
5733
|
+
historyItemRefs.current[index] = el;
|
|
5734
|
+
},
|
|
5735
|
+
onClick: () => handleSubmit(item),
|
|
5736
|
+
onMouseEnter: () => setFocusedIndex(index),
|
|
5737
|
+
className: `block w-full rounded-sm p-1 text-left transition-colors ${focusedIndex === index ? "bg-zinc-100" : "hover:bg-zinc-100"}`,
|
|
5738
|
+
children: item
|
|
5739
|
+
}
|
|
5740
|
+
) }, item))
|
|
5741
|
+
}
|
|
5742
|
+
)
|
|
5743
|
+
] }),
|
|
5544
5744
|
state && /* @__PURE__ */ jsxs28(
|
|
5545
5745
|
Button,
|
|
5546
5746
|
{
|
|
@@ -5553,27 +5753,28 @@ var SearchInput = () => {
|
|
|
5553
5753
|
setState("");
|
|
5554
5754
|
},
|
|
5555
5755
|
children: [
|
|
5556
|
-
/* @__PURE__ */
|
|
5557
|
-
/* @__PURE__ */
|
|
5756
|
+
/* @__PURE__ */ jsx43(IconX, { size: 16 }),
|
|
5757
|
+
/* @__PURE__ */ jsx43("span", { className: "sr-only", children: "Clear" })
|
|
5558
5758
|
]
|
|
5559
5759
|
}
|
|
5560
|
-
)
|
|
5760
|
+
),
|
|
5761
|
+
" "
|
|
5561
5762
|
] });
|
|
5562
5763
|
};
|
|
5563
5764
|
|
|
5564
5765
|
// src/components/databrowser/components/sidebar/skeleton-buttons.tsx
|
|
5565
|
-
import { jsx as
|
|
5766
|
+
import { jsx as jsx44, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
5566
5767
|
var DEFAULT_SKELETON_COUNT = 6;
|
|
5567
|
-
var LoadingSkeleton = () => /* @__PURE__ */
|
|
5568
|
-
/* @__PURE__ */
|
|
5569
|
-
/* @__PURE__ */
|
|
5768
|
+
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: [
|
|
5769
|
+
/* @__PURE__ */ jsx44(Skeleton, { className: "size-5 shrink-0 rounded" }),
|
|
5770
|
+
/* @__PURE__ */ jsx44(Skeleton, { className: "h-4 grow rounded" })
|
|
5570
5771
|
] }, idx)) });
|
|
5571
5772
|
|
|
5572
5773
|
// src/components/databrowser/components/sidebar/type-selector.tsx
|
|
5573
|
-
import { jsx as
|
|
5774
|
+
import { jsx as jsx45, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
5574
5775
|
var ALL_TYPES_KEY = "all";
|
|
5575
5776
|
function DataTypeSelector() {
|
|
5576
|
-
const { search, setSearchType } =
|
|
5777
|
+
const { search, setSearchType } = useTab();
|
|
5577
5778
|
return /* @__PURE__ */ jsxs30(
|
|
5578
5779
|
Select,
|
|
5579
5780
|
{
|
|
@@ -5586,9 +5787,9 @@ function DataTypeSelector() {
|
|
|
5586
5787
|
},
|
|
5587
5788
|
value: search.type === void 0 ? ALL_TYPES_KEY : search.type,
|
|
5588
5789
|
children: [
|
|
5589
|
-
/* @__PURE__ */
|
|
5590
|
-
/* @__PURE__ */
|
|
5591
|
-
([key, value]) => /* @__PURE__ */
|
|
5790
|
+
/* @__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, {}) }),
|
|
5791
|
+
/* @__PURE__ */ jsx45(SelectContent, { children: /* @__PURE__ */ jsx45(SelectGroup, { children: [[ALL_TYPES_KEY, "All Types"], ...Object.entries(DATA_TYPE_NAMES)].map(
|
|
5792
|
+
([key, value]) => /* @__PURE__ */ jsx45(SelectItem, { value: key, children: value }, key)
|
|
5592
5793
|
) }) })
|
|
5593
5794
|
]
|
|
5594
5795
|
}
|
|
@@ -5596,15 +5797,15 @@ function DataTypeSelector() {
|
|
|
5596
5797
|
}
|
|
5597
5798
|
|
|
5598
5799
|
// src/components/databrowser/components/sidebar/index.tsx
|
|
5599
|
-
import { jsx as
|
|
5800
|
+
import { jsx as jsx46, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
5600
5801
|
function Sidebar() {
|
|
5601
5802
|
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
|
|
5803
|
+
return /* @__PURE__ */ jsxs31("div", { className: "flex h-full flex-col gap-2 p-4", children: [
|
|
5804
|
+
/* @__PURE__ */ jsxs31("div", { className: "rounded-lg bg-zinc-100", children: [
|
|
5604
5805
|
/* @__PURE__ */ jsxs31("div", { className: "flex h-10 items-center justify-between pl-1", children: [
|
|
5605
|
-
/* @__PURE__ */
|
|
5806
|
+
/* @__PURE__ */ jsx46(DisplayDbSize, {}),
|
|
5606
5807
|
/* @__PURE__ */ jsxs31("div", { className: "flex gap-1", children: [
|
|
5607
|
-
/* @__PURE__ */
|
|
5808
|
+
/* @__PURE__ */ jsx46(
|
|
5608
5809
|
Button,
|
|
5609
5810
|
{
|
|
5610
5811
|
className: "h-7 w-7 px-0",
|
|
@@ -5625,32 +5826,28 @@ function Sidebar() {
|
|
|
5625
5826
|
queryKey: [FETCH_KEY_TYPE_QUERY_KEY]
|
|
5626
5827
|
});
|
|
5627
5828
|
},
|
|
5628
|
-
children: /* @__PURE__ */
|
|
5829
|
+
children: /* @__PURE__ */ jsx46(Spinner, { isLoading: query.isFetching, children: /* @__PURE__ */ jsx46(IconRefresh, { size: 16 }) })
|
|
5629
5830
|
}
|
|
5630
5831
|
),
|
|
5631
|
-
/* @__PURE__ */
|
|
5832
|
+
/* @__PURE__ */ jsx46(AddKeyModal, {})
|
|
5632
5833
|
] })
|
|
5633
5834
|
] }),
|
|
5634
5835
|
/* @__PURE__ */ jsxs31("div", { className: "flex h-10 items-center", children: [
|
|
5635
|
-
/* @__PURE__ */
|
|
5636
|
-
/* @__PURE__ */
|
|
5836
|
+
/* @__PURE__ */ jsx46(DataTypeSelector, {}),
|
|
5837
|
+
/* @__PURE__ */ jsx46(SearchInput, {})
|
|
5637
5838
|
] })
|
|
5638
5839
|
] }),
|
|
5639
|
-
query.isLoading && keys.length === 0 ? /* @__PURE__ */
|
|
5840
|
+
query.isLoading && keys.length === 0 ? /* @__PURE__ */ jsx46(LoadingSkeleton, {}) : keys.length > 0 ? (
|
|
5640
5841
|
// Infinite scroll already has a loader at the bottom
|
|
5641
|
-
/* @__PURE__ */
|
|
5642
|
-
) : /* @__PURE__ */
|
|
5842
|
+
/* @__PURE__ */ jsx46(InfiniteScroll, { query, disableRoundedInherit: true, className: "min-h-0", children: /* @__PURE__ */ jsx46(KeysList, {}) })
|
|
5843
|
+
) : /* @__PURE__ */ jsx46(Empty, {})
|
|
5643
5844
|
] });
|
|
5644
5845
|
}
|
|
5645
5846
|
|
|
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: [
|
|
5847
|
+
// src/components/databrowser/components/databrowser-instance.tsx
|
|
5848
|
+
import { jsx as jsx47, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
5849
|
+
var DatabrowserInstance = ({ hidden }) => {
|
|
5850
|
+
return /* @__PURE__ */ jsx47(KeysProvider, { children: /* @__PURE__ */ jsxs32("div", { className: cn("min-h-0 grow rounded-md bg-zinc-100", hidden && "hidden"), children: [
|
|
5654
5851
|
/* @__PURE__ */ jsxs32(
|
|
5655
5852
|
PanelGroup,
|
|
5656
5853
|
{
|
|
@@ -5658,21 +5855,110 @@ var RedisBrowser = ({ token, url }) => {
|
|
|
5658
5855
|
direction: "horizontal",
|
|
5659
5856
|
className: "h-full w-full gap-0.5 text-sm antialiased",
|
|
5660
5857
|
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, {}) })
|
|
5858
|
+
/* @__PURE__ */ jsx47(Panel, { defaultSize: 30, minSize: 30, children: /* @__PURE__ */ jsx47(Sidebar, {}) }),
|
|
5859
|
+
/* @__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" }) }),
|
|
5860
|
+
/* @__PURE__ */ jsx47(Panel, { minSize: 40, children: /* @__PURE__ */ jsx47(DataDisplay, {}) })
|
|
5671
5861
|
]
|
|
5672
5862
|
}
|
|
5673
5863
|
),
|
|
5674
|
-
/* @__PURE__ */
|
|
5675
|
-
] }) })
|
|
5864
|
+
/* @__PURE__ */ jsx47(Toaster, {})
|
|
5865
|
+
] }) });
|
|
5866
|
+
};
|
|
5867
|
+
|
|
5868
|
+
// src/components/databrowser/components/databrowser-tabs.tsx
|
|
5869
|
+
import { IconPlus as IconPlus2, IconX as IconX2 } from "@tabler/icons-react";
|
|
5870
|
+
|
|
5871
|
+
// src/components/databrowser/components/tab-type-icon.tsx
|
|
5872
|
+
import { jsx as jsx48 } from "react/jsx-runtime";
|
|
5873
|
+
function TabTypeIcon({ selectedKey }) {
|
|
5874
|
+
const { data: keyType, isLoading } = useFetchKeyType(selectedKey);
|
|
5875
|
+
if (isLoading) return /* @__PURE__ */ jsx48(Skeleton, { className: "h-5 w-5 rounded" });
|
|
5876
|
+
if (!keyType || keyType === "none") return;
|
|
5877
|
+
return /* @__PURE__ */ jsx48(TypeTag, { variant: keyType, type: "icon" });
|
|
5878
|
+
}
|
|
5879
|
+
|
|
5880
|
+
// src/components/databrowser/components/databrowser-tabs.tsx
|
|
5881
|
+
import { Fragment as Fragment10, jsx as jsx49, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
5882
|
+
var Tab = ({ id }) => {
|
|
5883
|
+
const { selectTab, selectedTab, tabs, removeTab } = useDatabrowserStore();
|
|
5884
|
+
return /* @__PURE__ */ jsxs33(
|
|
5885
|
+
"div",
|
|
5886
|
+
{
|
|
5887
|
+
onClick: () => selectTab(id),
|
|
5888
|
+
className: cn(
|
|
5889
|
+
"flex h-9 cursor-pointer items-center gap-2 rounded-t-lg border border-zinc-200 px-3 text-[13px] transition-colors",
|
|
5890
|
+
id === selectedTab ? "border-b-white bg-white text-zinc-900" : "bg-zinc-100 hover:bg-zinc-50"
|
|
5891
|
+
),
|
|
5892
|
+
children: [
|
|
5893
|
+
tabs[id].selectedKey ? /* @__PURE__ */ jsxs33(Fragment10, { children: [
|
|
5894
|
+
/* @__PURE__ */ jsx49(TabTypeIcon, { selectedKey: tabs[id].selectedKey }),
|
|
5895
|
+
/* @__PURE__ */ jsx49("span", { className: "max-w-32 truncate whitespace-nowrap", children: tabs[id].selectedKey })
|
|
5896
|
+
] }) : /* @__PURE__ */ jsx49("span", { className: "whitespace-nowrap", children: "New Tab" }),
|
|
5897
|
+
Object.keys(tabs).length > 1 && /* @__PURE__ */ jsx49(
|
|
5898
|
+
"button",
|
|
5899
|
+
{
|
|
5900
|
+
onClick: (e) => {
|
|
5901
|
+
e.stopPropagation();
|
|
5902
|
+
removeTab(id);
|
|
5903
|
+
},
|
|
5904
|
+
className: "p-1 text-zinc-300 transition-colors hover:text-zinc-500",
|
|
5905
|
+
children: /* @__PURE__ */ jsx49(IconX2, { size: 16 })
|
|
5906
|
+
}
|
|
5907
|
+
)
|
|
5908
|
+
]
|
|
5909
|
+
}
|
|
5910
|
+
);
|
|
5911
|
+
};
|
|
5912
|
+
var DatabrowserTabs = () => {
|
|
5913
|
+
const { tabs, addTab } = useDatabrowserStore();
|
|
5914
|
+
return /* @__PURE__ */ jsxs33("div", { className: "relative mb-2 shrink-0", children: [
|
|
5915
|
+
/* @__PURE__ */ jsx49("div", { className: "absolute bottom-0 left-0 right-0 -z-10 h-[1px] w-full bg-zinc-200" }),
|
|
5916
|
+
/* @__PURE__ */ jsxs33("div", { className: "scrollbar-hide flex translate-y-[1px] items-center gap-1 overflow-x-scroll pb-[1px] [&::-webkit-scrollbar]:hidden", children: [
|
|
5917
|
+
Object.keys(tabs).map((id) => /* @__PURE__ */ jsx49(Tab, { id }, id)),
|
|
5918
|
+
/* @__PURE__ */ jsx49(
|
|
5919
|
+
Button,
|
|
5920
|
+
{
|
|
5921
|
+
variant: "secondary",
|
|
5922
|
+
size: "icon-sm",
|
|
5923
|
+
onClick: addTab,
|
|
5924
|
+
className: "mr-1 flex-shrink-0",
|
|
5925
|
+
title: "Add new tab",
|
|
5926
|
+
children: /* @__PURE__ */ jsx49(IconPlus2, { className: "text-zinc-500", size: 16 })
|
|
5927
|
+
}
|
|
5928
|
+
)
|
|
5929
|
+
] })
|
|
5930
|
+
] });
|
|
5931
|
+
};
|
|
5932
|
+
|
|
5933
|
+
// src/components/databrowser/index.tsx
|
|
5934
|
+
import { jsx as jsx50, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
5935
|
+
var RedisBrowser = ({
|
|
5936
|
+
token,
|
|
5937
|
+
url,
|
|
5938
|
+
hideTabs
|
|
5939
|
+
}) => {
|
|
5940
|
+
const credentials = useMemo8(() => ({ token, url }), [token, url]);
|
|
5941
|
+
useEffect11(() => {
|
|
5942
|
+
queryClient.resetQueries();
|
|
5943
|
+
}, [credentials.url]);
|
|
5944
|
+
return /* @__PURE__ */ jsx50(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx50(RedisProvider, { redisCredentials: credentials, children: /* @__PURE__ */ jsx50(DatabrowserProvider, { children: /* @__PURE__ */ jsx50(TooltipProvider, { children: /* @__PURE__ */ jsxs34(
|
|
5945
|
+
"div",
|
|
5946
|
+
{
|
|
5947
|
+
className: "ups-db",
|
|
5948
|
+
style: { height: "100%", display: "flex", flexDirection: "column" },
|
|
5949
|
+
children: [
|
|
5950
|
+
!hideTabs && /* @__PURE__ */ jsx50(DatabrowserTabs, {}),
|
|
5951
|
+
/* @__PURE__ */ jsx50(DatabrowserInstances, {})
|
|
5952
|
+
]
|
|
5953
|
+
}
|
|
5954
|
+
) }) }) }) });
|
|
5955
|
+
};
|
|
5956
|
+
var DatabrowserInstances = () => {
|
|
5957
|
+
const { tabs, selectedTab, addTab } = useDatabrowserStore();
|
|
5958
|
+
useEffect11(() => {
|
|
5959
|
+
if (Object.keys(tabs).length === 0) addTab();
|
|
5960
|
+
}, [tabs]);
|
|
5961
|
+
return Object.entries(tabs).map(([id]) => /* @__PURE__ */ jsx50(TabIdProvider, { value: id, children: /* @__PURE__ */ jsx50(DatabrowserInstance, { hidden: id !== selectedTab }) }, id));
|
|
5676
5962
|
};
|
|
5677
5963
|
export {
|
|
5678
5964
|
RedisBrowser
|