@upstash/react-redis-browser 0.1.11 → 0.2.0
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/README.md +28 -13
- package/dist/index.css +175 -66
- package/dist/index.d.mts +23 -2
- package/dist/index.d.ts +23 -2
- package/dist/index.js +725 -290
- package/dist/index.mjs +988 -553
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
// src/components/databrowser/index.tsx
|
|
2
|
-
import { useEffect as
|
|
2
|
+
import { useEffect as useEffect13, useMemo as useMemo8 } from "react";
|
|
3
3
|
|
|
4
|
-
// src/
|
|
5
|
-
import { createContext, useContext, useMemo
|
|
6
|
-
import { create, useStore } from "zustand";
|
|
4
|
+
// src/redis-context.tsx
|
|
5
|
+
import { createContext, useContext, useMemo } from "react";
|
|
7
6
|
|
|
8
7
|
// src/lib/clients.ts
|
|
9
8
|
import { MutationCache, QueryCache, QueryClient } from "@tanstack/react-query";
|
|
10
|
-
import { Redis } from "@upstash/redis";
|
|
9
|
+
import { Redis } from "@upstash/redis/cloudflare";
|
|
11
10
|
|
|
12
11
|
// src/components/ui/use-toast.ts
|
|
13
12
|
import * as React from "react";
|
|
@@ -136,8 +135,9 @@ var redisClient = ({
|
|
|
136
135
|
credentials,
|
|
137
136
|
pipelining
|
|
138
137
|
}) => {
|
|
139
|
-
const
|
|
140
|
-
const
|
|
138
|
+
const safeProcess = typeof process === "undefined" ? { env: {} } : process;
|
|
139
|
+
const token = credentials?.token || safeProcess.env.NEXT_PUBLIC_UPSTASH_REDIS_REST_TOKEN;
|
|
140
|
+
const url = credentials?.url || safeProcess.env.NEXT_PUBLIC_UPSTASH_REDIS_REST_URL;
|
|
141
141
|
if (!url) {
|
|
142
142
|
throw new Error("Redis URL is missing!");
|
|
143
143
|
}
|
|
@@ -180,22 +180,82 @@ var queryClient = new QueryClient({
|
|
|
180
180
|
})
|
|
181
181
|
});
|
|
182
182
|
|
|
183
|
-
// src/
|
|
183
|
+
// src/redis-context.tsx
|
|
184
184
|
import { jsx } from "react/jsx-runtime";
|
|
185
|
-
var
|
|
186
|
-
var
|
|
185
|
+
var RedisContext = createContext(void 0);
|
|
186
|
+
var RedisProvider = ({
|
|
187
187
|
children,
|
|
188
188
|
redisCredentials
|
|
189
189
|
}) => {
|
|
190
|
-
const redisInstance = useMemo(
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
190
|
+
const redisInstance = useMemo(
|
|
191
|
+
() => redisClient({ credentials: redisCredentials, pipelining: true }),
|
|
192
|
+
[redisCredentials]
|
|
193
|
+
);
|
|
194
|
+
const redisInstanceNoPipeline = useMemo(
|
|
195
|
+
() => redisClient({ credentials: redisCredentials, pipelining: false }),
|
|
196
|
+
[redisCredentials]
|
|
197
|
+
);
|
|
198
|
+
return /* @__PURE__ */ jsx(
|
|
199
|
+
RedisContext.Provider,
|
|
200
|
+
{
|
|
201
|
+
value: { redis: redisInstance, redisNoPipeline: redisInstanceNoPipeline },
|
|
202
|
+
children
|
|
203
|
+
}
|
|
204
|
+
);
|
|
205
|
+
};
|
|
206
|
+
var useRedis = () => {
|
|
207
|
+
const context = useContext(RedisContext);
|
|
208
|
+
if (!context) {
|
|
209
|
+
throw new Error("useRedis must be used within a RedisProvider");
|
|
210
|
+
}
|
|
211
|
+
return context;
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
// src/store.tsx
|
|
215
|
+
import { createContext as createContext2, useContext as useContext2, useMemo as useMemo2 } from "react";
|
|
216
|
+
import { create, useStore } from "zustand";
|
|
217
|
+
import { persist } from "zustand/middleware";
|
|
218
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
219
|
+
var DatabrowserContext = createContext2(void 0);
|
|
220
|
+
var DatabrowserProvider = ({
|
|
221
|
+
children,
|
|
222
|
+
storage
|
|
223
|
+
}) => {
|
|
224
|
+
const store = useMemo2(() => {
|
|
225
|
+
if (!storage) return create(storeCreator);
|
|
226
|
+
return create()(
|
|
227
|
+
persist(storeCreator, {
|
|
228
|
+
name: "redis-browser-data",
|
|
229
|
+
storage: {
|
|
230
|
+
getItem: () => {
|
|
231
|
+
const data = storage.get();
|
|
232
|
+
if (!data) return null;
|
|
233
|
+
try {
|
|
234
|
+
return JSON.parse(data);
|
|
235
|
+
} catch {
|
|
236
|
+
console.error("Error while parsing stored data.");
|
|
237
|
+
return null;
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
setItem: (_name, value) => storage.set(JSON.stringify(value)),
|
|
241
|
+
removeItem: () => {
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
version: 1,
|
|
245
|
+
// @ts-expect-error Reset the store for < v1
|
|
246
|
+
migrate: (state, version) => {
|
|
247
|
+
if (version === 0) {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
return state;
|
|
251
|
+
}
|
|
252
|
+
})
|
|
253
|
+
);
|
|
254
|
+
}, []);
|
|
255
|
+
return /* @__PURE__ */ jsx2(DatabrowserContext.Provider, { value: { store }, children });
|
|
196
256
|
};
|
|
197
257
|
var useDatabrowser = () => {
|
|
198
|
-
const context =
|
|
258
|
+
const context = useContext2(DatabrowserContext);
|
|
199
259
|
if (!context) {
|
|
200
260
|
throw new Error("useDatabrowser must be used within a DatabrowserProvider");
|
|
201
261
|
}
|
|
@@ -205,115 +265,170 @@ var useDatabrowserStore = () => {
|
|
|
205
265
|
const { store } = useDatabrowser();
|
|
206
266
|
return useStore(store);
|
|
207
267
|
};
|
|
208
|
-
var
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
268
|
+
var storeCreator = (set, get) => ({
|
|
269
|
+
selectedTab: void 0,
|
|
270
|
+
tabs: [],
|
|
271
|
+
addTab: () => {
|
|
272
|
+
const id = crypto.randomUUID();
|
|
273
|
+
const newTabData = {
|
|
274
|
+
selectedKey: void 0,
|
|
275
|
+
search: { key: "", type: void 0 }
|
|
276
|
+
};
|
|
277
|
+
set((old) => ({
|
|
278
|
+
tabs: [...old.tabs, [id, newTabData]],
|
|
279
|
+
selectedTab: id
|
|
280
|
+
}));
|
|
281
|
+
},
|
|
282
|
+
removeTab: (id) => {
|
|
283
|
+
set((old) => {
|
|
284
|
+
const tabIndex = old.tabs.findIndex(([tabId]) => tabId === id);
|
|
285
|
+
if (tabIndex === -1) return old;
|
|
286
|
+
const newTabs = [...old.tabs];
|
|
287
|
+
newTabs.splice(tabIndex, 1);
|
|
288
|
+
let selectedTab = old.selectedTab;
|
|
289
|
+
if (selectedTab === id) {
|
|
290
|
+
const [newId] = newTabs[tabIndex - 1] ?? newTabs[tabIndex];
|
|
291
|
+
selectedTab = newTabs.length > 0 ? newId : void 0;
|
|
292
|
+
}
|
|
293
|
+
return { tabs: newTabs, selectedTab };
|
|
294
|
+
});
|
|
295
|
+
},
|
|
296
|
+
selectTab: (id) => {
|
|
297
|
+
set({ selectedTab: id });
|
|
298
|
+
},
|
|
299
|
+
getSelectedKey: (tabId) => {
|
|
300
|
+
return get().tabs.find(([id]) => id === tabId)?.[1]?.selectedKey;
|
|
301
|
+
},
|
|
302
|
+
setSelectedKey: (tabId, key) => {
|
|
303
|
+
set((old) => {
|
|
304
|
+
const tabIndex = old.tabs.findIndex(([id]) => id === tabId);
|
|
305
|
+
if (tabIndex === -1) return old;
|
|
306
|
+
const newTabs = [...old.tabs];
|
|
307
|
+
const [, tabData] = newTabs[tabIndex];
|
|
308
|
+
newTabs[tabIndex] = [tabId, { ...tabData, selectedKey: key, selectedListItem: void 0 }];
|
|
309
|
+
return { ...old, tabs: newTabs };
|
|
310
|
+
});
|
|
311
|
+
},
|
|
312
|
+
setSelectedListItem: (tabId, item) => {
|
|
313
|
+
set((old) => {
|
|
314
|
+
const tabIndex = old.tabs.findIndex(([id]) => id === tabId);
|
|
315
|
+
if (tabIndex === -1) return old;
|
|
316
|
+
const newTabs = [...old.tabs];
|
|
317
|
+
const [, tabData] = newTabs[tabIndex];
|
|
318
|
+
newTabs[tabIndex] = [tabId, { ...tabData, selectedListItem: item }];
|
|
319
|
+
return { ...old, tabs: newTabs };
|
|
320
|
+
});
|
|
321
|
+
},
|
|
322
|
+
setSearch: (tabId, search) => {
|
|
323
|
+
set((old) => {
|
|
324
|
+
const tabIndex = old.tabs.findIndex(([id]) => id === tabId);
|
|
325
|
+
if (tabIndex === -1) return old;
|
|
326
|
+
const newTabs = [...old.tabs];
|
|
327
|
+
const [, tabData] = newTabs[tabIndex];
|
|
328
|
+
newTabs[tabIndex] = [tabId, { ...tabData, search }];
|
|
329
|
+
return { ...old, tabs: newTabs };
|
|
330
|
+
});
|
|
331
|
+
},
|
|
332
|
+
setSearchKey: (tabId, key) => {
|
|
333
|
+
set((old) => {
|
|
334
|
+
const tabIndex = old.tabs.findIndex(([id]) => id === tabId);
|
|
335
|
+
if (tabIndex === -1) return old;
|
|
336
|
+
const newTabs = [...old.tabs];
|
|
337
|
+
const [, tabData] = newTabs[tabIndex];
|
|
338
|
+
newTabs[tabIndex] = [
|
|
339
|
+
tabId,
|
|
340
|
+
{
|
|
341
|
+
...tabData,
|
|
342
|
+
search: { ...tabData.search, key }
|
|
343
|
+
}
|
|
344
|
+
];
|
|
345
|
+
return { ...old, tabs: newTabs };
|
|
346
|
+
});
|
|
212
347
|
},
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
348
|
+
setSearchType: (tabId, type) => {
|
|
349
|
+
set((old) => {
|
|
350
|
+
const tabIndex = old.tabs.findIndex(([id]) => id === tabId);
|
|
351
|
+
if (tabIndex === -1) return old;
|
|
352
|
+
const newTabs = [...old.tabs];
|
|
353
|
+
const [, tabData] = newTabs[tabIndex];
|
|
354
|
+
newTabs[tabIndex] = [
|
|
355
|
+
tabId,
|
|
356
|
+
{
|
|
357
|
+
...tabData,
|
|
358
|
+
search: { ...tabData.search, type }
|
|
359
|
+
}
|
|
360
|
+
];
|
|
361
|
+
return { ...old, tabs: newTabs };
|
|
362
|
+
});
|
|
216
363
|
},
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
})
|
|
364
|
+
searchHistory: [],
|
|
365
|
+
addSearchHistory: (key) => {
|
|
366
|
+
set((old) => ({ ...old, searchHistory: [key, ...old.searchHistory] }));
|
|
367
|
+
}
|
|
368
|
+
});
|
|
369
|
+
|
|
370
|
+
// src/tab-provider.tsx
|
|
371
|
+
import { createContext as createContext3, useContext as useContext3, useMemo as useMemo3 } from "react";
|
|
372
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
373
|
+
var TabIdContext = createContext3(void 0);
|
|
374
|
+
var TabIdProvider = ({ children, value }) => {
|
|
375
|
+
return /* @__PURE__ */ jsx3(TabIdContext.Provider, { value, children });
|
|
376
|
+
};
|
|
377
|
+
var useTabId = () => {
|
|
378
|
+
const tabId = useContext3(TabIdContext);
|
|
379
|
+
if (!tabId) {
|
|
380
|
+
throw new Error("useTabId must be used within a TabProvider");
|
|
381
|
+
}
|
|
382
|
+
return tabId;
|
|
383
|
+
};
|
|
384
|
+
var useTab = () => {
|
|
385
|
+
const {
|
|
386
|
+
selectedTab,
|
|
387
|
+
tabs,
|
|
388
|
+
setSelectedKey,
|
|
389
|
+
setSelectedListItem,
|
|
390
|
+
setSearch,
|
|
391
|
+
setSearchKey,
|
|
392
|
+
setSearchType
|
|
393
|
+
} = useDatabrowserStore();
|
|
394
|
+
const tabId = useTabId();
|
|
395
|
+
const tabData = useMemo3(() => tabs.find(([id]) => id === tabId)?.[1], [tabs, tabId]);
|
|
396
|
+
if (!selectedTab || !tabData) throw new Error("selectedTab is undefined when using useTab()");
|
|
397
|
+
return useMemo3(
|
|
398
|
+
() => ({
|
|
399
|
+
active: selectedTab === tabId,
|
|
400
|
+
selectedKey: tabData.selectedKey,
|
|
401
|
+
selectedListItem: tabData.selectedListItem,
|
|
402
|
+
search: tabData.search,
|
|
403
|
+
setSelectedKey: (key) => setSelectedKey(tabId, key),
|
|
404
|
+
setSelectedListItem: (item) => setSelectedListItem(tabId, item),
|
|
405
|
+
setSearch: (search) => setSearch(tabId, search),
|
|
406
|
+
setSearchKey: (key) => setSearchKey(tabId, key),
|
|
407
|
+
setSearchType: (type) => setSearchType(tabId, type)
|
|
408
|
+
}),
|
|
409
|
+
[selectedTab, tabs, tabId]
|
|
410
|
+
);
|
|
411
|
+
};
|
|
222
412
|
|
|
223
413
|
// src/components/databrowser/index.tsx
|
|
224
414
|
import { TooltipProvider } from "@radix-ui/react-tooltip";
|
|
225
|
-
import { IconDotsVertical as IconDotsVertical2 } from "@tabler/icons-react";
|
|
226
415
|
import { QueryClientProvider } from "@tanstack/react-query";
|
|
227
|
-
import { Panel, PanelGroup, PanelResizeHandle } from "react-resizable-panels";
|
|
228
|
-
|
|
229
|
-
// src/components/ui/toaster.tsx
|
|
230
|
-
import { Portal } from "@radix-ui/react-portal";
|
|
231
416
|
|
|
232
|
-
// src/
|
|
233
|
-
|
|
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
|
-
};
|
|
417
|
+
// src/components/databrowser/components/databrowser-instance.tsx
|
|
418
|
+
import { Panel, PanelGroup, PanelResizeHandle } from "react-resizable-panels";
|
|
304
419
|
|
|
305
420
|
// node_modules/clsx/dist/clsx.mjs
|
|
306
|
-
function
|
|
421
|
+
function r(e) {
|
|
307
422
|
var t, f, n = "";
|
|
308
423
|
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
309
424
|
else if ("object" == typeof e) if (Array.isArray(e)) {
|
|
310
425
|
var o = e.length;
|
|
311
|
-
for (t = 0; t < o; t++) e[t] && (f =
|
|
426
|
+
for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
312
427
|
} else for (f in e) e[f] && (n && (n += " "), n += f);
|
|
313
428
|
return n;
|
|
314
429
|
}
|
|
315
|
-
function
|
|
316
|
-
for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t =
|
|
430
|
+
function clsx() {
|
|
431
|
+
for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
317
432
|
return n;
|
|
318
433
|
}
|
|
319
434
|
|
|
@@ -2779,7 +2894,7 @@ var twMerge = /* @__PURE__ */ createTailwindMerge(getDefaultConfig);
|
|
|
2779
2894
|
|
|
2780
2895
|
// src/lib/utils.ts
|
|
2781
2896
|
function cn(...inputs) {
|
|
2782
|
-
return twMerge(
|
|
2897
|
+
return twMerge(clsx(inputs));
|
|
2783
2898
|
}
|
|
2784
2899
|
function formatNumber(value) {
|
|
2785
2900
|
const intl = new Intl.NumberFormat("en-US");
|
|
@@ -2810,11 +2925,88 @@ function formatTime(seconds) {
|
|
|
2810
2925
|
}
|
|
2811
2926
|
return parts.slice(0, 1).join(" ");
|
|
2812
2927
|
}
|
|
2928
|
+
var isTest = typeof window !== "undefined" && window.__PLAYWRIGHT__ === true;
|
|
2929
|
+
|
|
2930
|
+
// src/components/ui/toaster.tsx
|
|
2931
|
+
import { Portal } from "@radix-ui/react-portal";
|
|
2932
|
+
|
|
2933
|
+
// src/lib/portal-root.ts
|
|
2934
|
+
var root;
|
|
2935
|
+
if (typeof document !== "undefined") {
|
|
2936
|
+
const id = "react-redis-browser-portal-root";
|
|
2937
|
+
root = document.querySelector(`#${id}`) ?? document.createElement("div");
|
|
2938
|
+
root.classList.add("ups-db");
|
|
2939
|
+
root.id = "react-redis-browser-portal-root";
|
|
2940
|
+
document.body.append(root);
|
|
2941
|
+
}
|
|
2942
|
+
var portalRoot = root;
|
|
2813
2943
|
|
|
2814
2944
|
// src/components/ui/toast.tsx
|
|
2815
|
-
import
|
|
2945
|
+
import * as React2 from "react";
|
|
2946
|
+
import { Cross2Icon } from "@radix-ui/react-icons";
|
|
2947
|
+
import * as ToastPrimitives from "@radix-ui/react-toast";
|
|
2948
|
+
|
|
2949
|
+
// node_modules/class-variance-authority/node_modules/clsx/dist/clsx.mjs
|
|
2950
|
+
function r2(e) {
|
|
2951
|
+
var t, f, n = "";
|
|
2952
|
+
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
2953
|
+
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);
|
|
2954
|
+
else for (t in e) e[t] && (n && (n += " "), n += t);
|
|
2955
|
+
return n;
|
|
2956
|
+
}
|
|
2957
|
+
function clsx2() {
|
|
2958
|
+
for (var e, t, f = 0, n = ""; f < arguments.length; ) (e = arguments[f++]) && (t = r2(e)) && (n && (n += " "), n += t);
|
|
2959
|
+
return n;
|
|
2960
|
+
}
|
|
2961
|
+
|
|
2962
|
+
// node_modules/class-variance-authority/dist/index.mjs
|
|
2963
|
+
var falsyToString = (value) => typeof value === "boolean" ? "".concat(value) : value === 0 ? "0" : value;
|
|
2964
|
+
var cx = clsx2;
|
|
2965
|
+
var cva = (base, config) => {
|
|
2966
|
+
return (props) => {
|
|
2967
|
+
var ref;
|
|
2968
|
+
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);
|
|
2969
|
+
const { variants, defaultVariants } = config;
|
|
2970
|
+
const getVariantClassNames = Object.keys(variants).map((variant) => {
|
|
2971
|
+
const variantProp = props === null || props === void 0 ? void 0 : props[variant];
|
|
2972
|
+
const defaultVariantProp = defaultVariants === null || defaultVariants === void 0 ? void 0 : defaultVariants[variant];
|
|
2973
|
+
if (variantProp === null) return null;
|
|
2974
|
+
const variantKey = falsyToString(variantProp) || falsyToString(defaultVariantProp);
|
|
2975
|
+
return variants[variant][variantKey];
|
|
2976
|
+
});
|
|
2977
|
+
const propsWithoutUndefined = props && Object.entries(props).reduce((acc, param) => {
|
|
2978
|
+
let [key, value] = param;
|
|
2979
|
+
if (value === void 0) {
|
|
2980
|
+
return acc;
|
|
2981
|
+
}
|
|
2982
|
+
acc[key] = value;
|
|
2983
|
+
return acc;
|
|
2984
|
+
}, {});
|
|
2985
|
+
const getCompoundVariantClassNames = config === null || config === void 0 ? void 0 : (ref = config.compoundVariants) === null || ref === void 0 ? void 0 : ref.reduce((acc, param1) => {
|
|
2986
|
+
let { class: cvClass, className: cvClassName, ...compoundVariantOptions } = param1;
|
|
2987
|
+
return Object.entries(compoundVariantOptions).every((param) => {
|
|
2988
|
+
let [key, value] = param;
|
|
2989
|
+
return Array.isArray(value) ? value.includes({
|
|
2990
|
+
...defaultVariants,
|
|
2991
|
+
...propsWithoutUndefined
|
|
2992
|
+
}[key]) : {
|
|
2993
|
+
...defaultVariants,
|
|
2994
|
+
...propsWithoutUndefined
|
|
2995
|
+
}[key] === value;
|
|
2996
|
+
}) ? [
|
|
2997
|
+
...acc,
|
|
2998
|
+
cvClass,
|
|
2999
|
+
cvClassName
|
|
3000
|
+
] : acc;
|
|
3001
|
+
}, []);
|
|
3002
|
+
return cx(base, getVariantClassNames, getCompoundVariantClassNames, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
|
|
3003
|
+
};
|
|
3004
|
+
};
|
|
3005
|
+
|
|
3006
|
+
// src/components/ui/toast.tsx
|
|
3007
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
2816
3008
|
var ToastProvider = ToastPrimitives.Provider;
|
|
2817
|
-
var ToastViewport = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
3009
|
+
var ToastViewport = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx4(
|
|
2818
3010
|
ToastPrimitives.Viewport,
|
|
2819
3011
|
{
|
|
2820
3012
|
ref,
|
|
@@ -2841,7 +3033,7 @@ var toastVariants = cva(
|
|
|
2841
3033
|
}
|
|
2842
3034
|
);
|
|
2843
3035
|
var Toast = React2.forwardRef(({ className, variant, ...props }, ref) => {
|
|
2844
|
-
return /* @__PURE__ */
|
|
3036
|
+
return /* @__PURE__ */ jsx4(
|
|
2845
3037
|
ToastPrimitives.Root,
|
|
2846
3038
|
{
|
|
2847
3039
|
ref,
|
|
@@ -2851,7 +3043,7 @@ var Toast = React2.forwardRef(({ className, variant, ...props }, ref) => {
|
|
|
2851
3043
|
);
|
|
2852
3044
|
});
|
|
2853
3045
|
Toast.displayName = ToastPrimitives.Root.displayName;
|
|
2854
|
-
var ToastAction = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
3046
|
+
var ToastAction = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx4(
|
|
2855
3047
|
ToastPrimitives.Action,
|
|
2856
3048
|
{
|
|
2857
3049
|
ref,
|
|
@@ -2863,7 +3055,7 @@ var ToastAction = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
2863
3055
|
}
|
|
2864
3056
|
));
|
|
2865
3057
|
ToastAction.displayName = ToastPrimitives.Action.displayName;
|
|
2866
|
-
var ToastClose = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
3058
|
+
var ToastClose = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx4(
|
|
2867
3059
|
ToastPrimitives.Close,
|
|
2868
3060
|
{
|
|
2869
3061
|
ref,
|
|
@@ -2873,11 +3065,11 @@ var ToastClose = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE_
|
|
|
2873
3065
|
),
|
|
2874
3066
|
"toast-close": "",
|
|
2875
3067
|
...props,
|
|
2876
|
-
children: /* @__PURE__ */
|
|
3068
|
+
children: /* @__PURE__ */ jsx4(Cross2Icon, { className: "size-4" })
|
|
2877
3069
|
}
|
|
2878
3070
|
));
|
|
2879
3071
|
ToastClose.displayName = ToastPrimitives.Close.displayName;
|
|
2880
|
-
var ToastTitle = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
3072
|
+
var ToastTitle = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx4(
|
|
2881
3073
|
ToastPrimitives.Title,
|
|
2882
3074
|
{
|
|
2883
3075
|
ref,
|
|
@@ -2886,7 +3078,7 @@ var ToastTitle = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE_
|
|
|
2886
3078
|
}
|
|
2887
3079
|
));
|
|
2888
3080
|
ToastTitle.displayName = ToastPrimitives.Title.displayName;
|
|
2889
|
-
var ToastDescription = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
3081
|
+
var ToastDescription = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx4(
|
|
2890
3082
|
ToastPrimitives.Description,
|
|
2891
3083
|
{
|
|
2892
3084
|
ref,
|
|
@@ -2897,46 +3089,78 @@ var ToastDescription = React2.forwardRef(({ className, ...props }, ref) => /* @_
|
|
|
2897
3089
|
ToastDescription.displayName = ToastPrimitives.Description.displayName;
|
|
2898
3090
|
|
|
2899
3091
|
// src/components/ui/toaster.tsx
|
|
2900
|
-
import { jsx as
|
|
3092
|
+
import { jsx as jsx5, jsxs } from "react/jsx-runtime";
|
|
2901
3093
|
function Toaster() {
|
|
2902
3094
|
const { toasts } = useToast();
|
|
2903
|
-
return /* @__PURE__ */
|
|
3095
|
+
return /* @__PURE__ */ jsx5(Portal, { container: portalRoot, children: /* @__PURE__ */ jsxs(ToastProvider, { children: [
|
|
2904
3096
|
toasts.map(({ id, title, description, action, ...props }) => /* @__PURE__ */ jsxs(Toast, { ...props, children: [
|
|
2905
3097
|
/* @__PURE__ */ jsxs("div", { className: "grid gap-1", children: [
|
|
2906
|
-
title && /* @__PURE__ */
|
|
2907
|
-
description && /* @__PURE__ */
|
|
3098
|
+
title && /* @__PURE__ */ jsx5(ToastTitle, { children: title }),
|
|
3099
|
+
description && /* @__PURE__ */ jsx5(ToastDescription, { children: description })
|
|
2908
3100
|
] }),
|
|
2909
3101
|
action,
|
|
2910
|
-
/* @__PURE__ */
|
|
3102
|
+
/* @__PURE__ */ jsx5(ToastClose, {})
|
|
2911
3103
|
] }, id)),
|
|
2912
|
-
/* @__PURE__ */
|
|
3104
|
+
/* @__PURE__ */ jsx5(ToastViewport, {})
|
|
2913
3105
|
] }) });
|
|
2914
3106
|
}
|
|
2915
3107
|
|
|
2916
3108
|
// src/components/databrowser/hooks/use-keys.tsx
|
|
2917
|
-
import { createContext as
|
|
3109
|
+
import { createContext as createContext4, useContext as useContext4, useMemo as useMemo4 } from "react";
|
|
2918
3110
|
import { useInfiniteQuery } from "@tanstack/react-query";
|
|
2919
|
-
|
|
2920
|
-
|
|
3111
|
+
|
|
3112
|
+
// src/components/databrowser/hooks/use-fetch-key-type.ts
|
|
3113
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3114
|
+
var FETCH_KEY_TYPE_QUERY_KEY = "fetch-key-type";
|
|
3115
|
+
var useFetchKeyType = (key) => {
|
|
3116
|
+
const { redis } = useRedis();
|
|
3117
|
+
return useQuery({
|
|
3118
|
+
queryKey: [FETCH_KEY_TYPE_QUERY_KEY, key],
|
|
3119
|
+
queryFn: async () => {
|
|
3120
|
+
if (!key) return "none";
|
|
3121
|
+
return await redis.type(key);
|
|
3122
|
+
}
|
|
3123
|
+
});
|
|
3124
|
+
};
|
|
3125
|
+
|
|
3126
|
+
// src/components/databrowser/hooks/use-keys.tsx
|
|
3127
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
3128
|
+
var KeysContext = createContext4(void 0);
|
|
2921
3129
|
var FETCH_KEYS_QUERY_KEY = "use-fetch-keys";
|
|
2922
|
-
var
|
|
3130
|
+
var SCAN_COUNTS = [100, 300, 500];
|
|
2923
3131
|
var KeysProvider = ({ children }) => {
|
|
2924
|
-
const { search } =
|
|
2925
|
-
const { redisNoPipeline: redis } =
|
|
3132
|
+
const { active, search } = useTab();
|
|
3133
|
+
const { redisNoPipeline: redis } = useRedis();
|
|
3134
|
+
const performScan = async (count2, cursor) => {
|
|
3135
|
+
const args = [cursor];
|
|
3136
|
+
if (search.key) {
|
|
3137
|
+
args.push("MATCH", search.key);
|
|
3138
|
+
}
|
|
3139
|
+
if (search.type) {
|
|
3140
|
+
args.push("TYPE", search.type);
|
|
3141
|
+
}
|
|
3142
|
+
args.push("COUNT", count2.toString());
|
|
3143
|
+
if (!search.type) args.push("WITHTYPE");
|
|
3144
|
+
return await redis.exec(["SCAN", ...args]);
|
|
3145
|
+
};
|
|
3146
|
+
const scanUntilAvailable = async (cursor) => {
|
|
3147
|
+
let i = 0;
|
|
3148
|
+
while (true) {
|
|
3149
|
+
const [newCursor, values] = await performScan(SCAN_COUNTS[i] ?? SCAN_COUNTS.at(-1), cursor);
|
|
3150
|
+
cursor = newCursor;
|
|
3151
|
+
i++;
|
|
3152
|
+
if (values.length > 0 || cursor === "0") {
|
|
3153
|
+
return [cursor, values];
|
|
3154
|
+
}
|
|
3155
|
+
}
|
|
3156
|
+
};
|
|
2926
3157
|
const query = useInfiniteQuery({
|
|
2927
3158
|
queryKey: [FETCH_KEYS_QUERY_KEY, search],
|
|
3159
|
+
// Only fetch when tab is active
|
|
3160
|
+
enabled: active,
|
|
2928
3161
|
initialPageParam: "0",
|
|
2929
3162
|
queryFn: async ({ pageParam: lastCursor }) => {
|
|
2930
|
-
const
|
|
2931
|
-
if (search.key) {
|
|
2932
|
-
args.push("MATCH", search.key);
|
|
2933
|
-
}
|
|
2934
|
-
if (search.type) {
|
|
2935
|
-
args.push("TYPE", search.type);
|
|
2936
|
-
}
|
|
2937
|
-
args.push("COUNT", SCAN_COUNT.toString());
|
|
2938
|
-
if (!search.type) args.push("WITHTYPE");
|
|
2939
|
-
const [cursor, values] = await redis.exec(["SCAN", ...args]);
|
|
3163
|
+
const [cursor, values] = await scanUntilAvailable(lastCursor);
|
|
2940
3164
|
const keys2 = [];
|
|
2941
3165
|
let index = 0;
|
|
2942
3166
|
while (true) {
|
|
@@ -2950,6 +3174,9 @@ var KeysProvider = ({ children }) => {
|
|
|
2950
3174
|
index += 2;
|
|
2951
3175
|
}
|
|
2952
3176
|
}
|
|
3177
|
+
for (const [key, type] of keys2) {
|
|
3178
|
+
queryClient.setQueryData([FETCH_KEY_TYPE_QUERY_KEY, key], type);
|
|
3179
|
+
}
|
|
2953
3180
|
return {
|
|
2954
3181
|
cursor: cursor === "0" ? void 0 : cursor,
|
|
2955
3182
|
keys: keys2,
|
|
@@ -2960,7 +3187,7 @@ var KeysProvider = ({ children }) => {
|
|
|
2960
3187
|
getNextPageParam: ({ cursor }) => cursor,
|
|
2961
3188
|
refetchOnMount: false
|
|
2962
3189
|
});
|
|
2963
|
-
const keys =
|
|
3190
|
+
const keys = useMemo4(() => {
|
|
2964
3191
|
const keys2 = query.data?.pages.flatMap((page) => page.keys) ?? [];
|
|
2965
3192
|
const keysSet = /* @__PURE__ */ new Set();
|
|
2966
3193
|
const dedupedKeys = [];
|
|
@@ -2971,7 +3198,7 @@ var KeysProvider = ({ children }) => {
|
|
|
2971
3198
|
}
|
|
2972
3199
|
return dedupedKeys;
|
|
2973
3200
|
}, [query.data]);
|
|
2974
|
-
return /* @__PURE__ */
|
|
3201
|
+
return /* @__PURE__ */ jsx6(
|
|
2975
3202
|
KeysContext.Provider,
|
|
2976
3203
|
{
|
|
2977
3204
|
value: {
|
|
@@ -2983,7 +3210,7 @@ var KeysProvider = ({ children }) => {
|
|
|
2983
3210
|
);
|
|
2984
3211
|
};
|
|
2985
3212
|
var useKeys = () => {
|
|
2986
|
-
const context =
|
|
3213
|
+
const context = useContext4(KeysContext);
|
|
2987
3214
|
if (!context) {
|
|
2988
3215
|
throw new Error("useKeys must be used within a KeysProvider");
|
|
2989
3216
|
}
|
|
@@ -2991,20 +3218,20 @@ var useKeys = () => {
|
|
|
2991
3218
|
};
|
|
2992
3219
|
var useKeyType = (key) => {
|
|
2993
3220
|
const { keys } = useKeys();
|
|
2994
|
-
const keyTuple =
|
|
3221
|
+
const keyTuple = useMemo4(() => keys.find(([k, _]) => k === key), [keys, key]);
|
|
2995
3222
|
return keyTuple?.[1];
|
|
2996
3223
|
};
|
|
2997
3224
|
|
|
2998
3225
|
// src/components/databrowser/components/display/display-list.tsx
|
|
2999
|
-
import { useMemo as
|
|
3226
|
+
import { useMemo as useMemo7 } from "react";
|
|
3000
3227
|
import { IconTrash } from "@tabler/icons-react";
|
|
3001
3228
|
|
|
3002
3229
|
// src/components/ui/button.tsx
|
|
3003
3230
|
import * as React3 from "react";
|
|
3004
3231
|
import { Slot } from "@radix-ui/react-slot";
|
|
3005
|
-
import { jsx as
|
|
3232
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
3006
3233
|
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-
|
|
3234
|
+
"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
3235
|
{
|
|
3009
3236
|
variants: {
|
|
3010
3237
|
variant: {
|
|
@@ -3034,7 +3261,7 @@ var buttonVariants = cva(
|
|
|
3034
3261
|
var Button = React3.forwardRef(
|
|
3035
3262
|
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
3036
3263
|
const Comp = asChild ? Slot : "button";
|
|
3037
|
-
return /* @__PURE__ */
|
|
3264
|
+
return /* @__PURE__ */ jsx7(Comp, { className: cn(buttonVariants({ variant, size, className })), ref, ...props });
|
|
3038
3265
|
}
|
|
3039
3266
|
);
|
|
3040
3267
|
Button.displayName = "Button";
|
|
@@ -3043,12 +3270,12 @@ Button.displayName = "Button";
|
|
|
3043
3270
|
import { useMutation } from "@tanstack/react-query";
|
|
3044
3271
|
|
|
3045
3272
|
// src/components/databrowser/components/sidebar/db-size.tsx
|
|
3046
|
-
import { useQuery } from "@tanstack/react-query";
|
|
3273
|
+
import { useQuery as useQuery2 } from "@tanstack/react-query";
|
|
3047
3274
|
|
|
3048
3275
|
// src/components/ui/skeleton.tsx
|
|
3049
|
-
import { jsx as
|
|
3276
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
3050
3277
|
function Skeleton({ className, ...props }) {
|
|
3051
|
-
return /* @__PURE__ */
|
|
3278
|
+
return /* @__PURE__ */ jsx8(
|
|
3052
3279
|
"div",
|
|
3053
3280
|
{
|
|
3054
3281
|
className: cn("animate-pulse rounded-md bg-zinc-900/10 dark:bg-zinc-50/10", className),
|
|
@@ -3058,18 +3285,18 @@ function Skeleton({ className, ...props }) {
|
|
|
3058
3285
|
}
|
|
3059
3286
|
|
|
3060
3287
|
// src/components/databrowser/components/sidebar/db-size.tsx
|
|
3061
|
-
import { jsx as
|
|
3288
|
+
import { jsx as jsx9, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
3062
3289
|
var FETCH_DB_SIZE_QUERY_KEY = "fetch-db-size";
|
|
3063
3290
|
var DisplayDbSize = () => {
|
|
3064
|
-
const { redis } =
|
|
3065
|
-
const { data: keyCount } =
|
|
3291
|
+
const { redis } = useRedis();
|
|
3292
|
+
const { data: keyCount } = useQuery2({
|
|
3066
3293
|
queryKey: [FETCH_DB_SIZE_QUERY_KEY],
|
|
3067
3294
|
queryFn: async () => {
|
|
3068
3295
|
return await redis.dbsize();
|
|
3069
3296
|
}
|
|
3070
3297
|
});
|
|
3071
3298
|
if (keyCount === void 0) {
|
|
3072
|
-
return /* @__PURE__ */
|
|
3299
|
+
return /* @__PURE__ */ jsx9("div", { className: "flex items-center justify-center gap-1", children: /* @__PURE__ */ jsx9(Skeleton, { className: "h-5 w-10 rounded" }) });
|
|
3073
3300
|
}
|
|
3074
3301
|
return /* @__PURE__ */ jsxs2("div", { className: "", children: [
|
|
3075
3302
|
formatNumber(keyCount),
|
|
@@ -3079,7 +3306,7 @@ var DisplayDbSize = () => {
|
|
|
3079
3306
|
|
|
3080
3307
|
// src/components/databrowser/hooks/use-add-key.ts
|
|
3081
3308
|
var useAddKey = () => {
|
|
3082
|
-
const { redis } =
|
|
3309
|
+
const { redis } = useRedis();
|
|
3083
3310
|
const mutation = useMutation({
|
|
3084
3311
|
mutationFn: async ({ key, type }) => {
|
|
3085
3312
|
if (await redis.exists(key)) throw new Error(`Key "${key}" already exists`);
|
|
@@ -3136,7 +3363,7 @@ var useAddKey = () => {
|
|
|
3136
3363
|
queryKey: [FETCH_KEYS_QUERY_KEY]
|
|
3137
3364
|
},
|
|
3138
3365
|
(data) => {
|
|
3139
|
-
if (!data)
|
|
3366
|
+
if (!data) return;
|
|
3140
3367
|
return {
|
|
3141
3368
|
...data,
|
|
3142
3369
|
pages: data.pages.map(
|
|
@@ -3151,7 +3378,7 @@ var useAddKey = () => {
|
|
|
3151
3378
|
};
|
|
3152
3379
|
|
|
3153
3380
|
// src/components/databrowser/hooks/use-debounce.ts
|
|
3154
|
-
import { useEffect as useEffect2, useState as
|
|
3381
|
+
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
3155
3382
|
|
|
3156
3383
|
// src/components/databrowser/hooks/use-delete-key.ts
|
|
3157
3384
|
import { useMutation as useMutation2 } from "@tanstack/react-query";
|
|
@@ -3159,16 +3386,12 @@ import { useMutation as useMutation2 } from "@tanstack/react-query";
|
|
|
3159
3386
|
// src/components/databrowser/hooks/use-delete-key-cache.ts
|
|
3160
3387
|
import { useCallback } from "react";
|
|
3161
3388
|
|
|
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
3389
|
// src/components/databrowser/hooks/use-fetch-list-items.tsx
|
|
3167
3390
|
import { useInfiniteQuery as useInfiniteQuery2 } from "@tanstack/react-query";
|
|
3168
3391
|
var LIST_DISPLAY_PAGE_SIZE = 50;
|
|
3169
3392
|
var FETCH_LIST_ITEMS_QUERY_KEY = "use-fetch-list-items";
|
|
3170
3393
|
var useFetchListItems = ({ dataKey, type }) => {
|
|
3171
|
-
const { redisNoPipeline: redis } =
|
|
3394
|
+
const { redisNoPipeline: redis } = useRedis();
|
|
3172
3395
|
const setQuery = useInfiniteQuery2({
|
|
3173
3396
|
enabled: type === "set",
|
|
3174
3397
|
queryKey: [FETCH_LIST_ITEMS_QUERY_KEY, dataKey, "set"],
|
|
@@ -3283,7 +3506,7 @@ function transformArray(inputArray) {
|
|
|
3283
3506
|
import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
3284
3507
|
var FETCH_SIMPLE_KEY_QUERY_KEY = "fetch-simple-key";
|
|
3285
3508
|
var useFetchSimpleKey = (dataKey, type) => {
|
|
3286
|
-
const { redisNoPipeline: redis } =
|
|
3509
|
+
const { redisNoPipeline: redis } = useRedis();
|
|
3287
3510
|
const { deleteKeyCache } = useDeleteKeyCache();
|
|
3288
3511
|
return useQuery3({
|
|
3289
3512
|
queryKey: [FETCH_SIMPLE_KEY_QUERY_KEY, dataKey],
|
|
@@ -3310,7 +3533,7 @@ var sortObject = (obj) => {
|
|
|
3310
3533
|
|
|
3311
3534
|
// src/components/databrowser/hooks/use-delete-key-cache.ts
|
|
3312
3535
|
var useDeleteKeyCache = () => {
|
|
3313
|
-
const { setSelectedKey } =
|
|
3536
|
+
const { setSelectedKey } = useTab();
|
|
3314
3537
|
const deleteKeyCache = useCallback(
|
|
3315
3538
|
(key) => {
|
|
3316
3539
|
setSelectedKey(void 0);
|
|
@@ -3334,7 +3557,7 @@ var useDeleteKeyCache = () => {
|
|
|
3334
3557
|
|
|
3335
3558
|
// src/components/databrowser/hooks/use-delete-key.ts
|
|
3336
3559
|
var useDeleteKey = () => {
|
|
3337
|
-
const { redis } =
|
|
3560
|
+
const { redis } = useRedis();
|
|
3338
3561
|
const { deleteKeyCache } = useDeleteKeyCache();
|
|
3339
3562
|
const deleteKey = useMutation2({
|
|
3340
3563
|
mutationFn: async (key) => {
|
|
@@ -3353,7 +3576,7 @@ var useDeleteKey = () => {
|
|
|
3353
3576
|
// src/components/databrowser/hooks/use-edit-list-item.tsx
|
|
3354
3577
|
import { useMutation as useMutation3 } from "@tanstack/react-query";
|
|
3355
3578
|
var useEditListItem = () => {
|
|
3356
|
-
const { redis } =
|
|
3579
|
+
const { redis } = useRedis();
|
|
3357
3580
|
return useMutation3({
|
|
3358
3581
|
mutationFn: async ({
|
|
3359
3582
|
type,
|
|
@@ -3436,7 +3659,7 @@ import { useEffect as useEffect5 } from "react";
|
|
|
3436
3659
|
import { useQuery as useQuery6 } from "@tanstack/react-query";
|
|
3437
3660
|
|
|
3438
3661
|
// src/components/databrowser/components/display/ttl-badge.tsx
|
|
3439
|
-
import { useEffect as useEffect4, useState as
|
|
3662
|
+
import { useEffect as useEffect4, useState as useState4 } from "react";
|
|
3440
3663
|
import { IconChevronDown } from "@tabler/icons-react";
|
|
3441
3664
|
|
|
3442
3665
|
// src/components/databrowser/components/display/header-badges.tsx
|
|
@@ -3446,7 +3669,7 @@ import bytes from "bytes";
|
|
|
3446
3669
|
import { useQuery as useQuery4 } from "@tanstack/react-query";
|
|
3447
3670
|
var FETCH_KEY_LENGTH_QUERY_KEY = "fetch-key-length";
|
|
3448
3671
|
var useFetchKeyLength = ({ dataKey, type }) => {
|
|
3449
|
-
const { redis } =
|
|
3672
|
+
const { redis } = useRedis();
|
|
3450
3673
|
return useQuery4({
|
|
3451
3674
|
queryKey: [FETCH_KEY_LENGTH_QUERY_KEY, dataKey],
|
|
3452
3675
|
queryFn: async () => {
|
|
@@ -3476,7 +3699,7 @@ var useFetchKeyLength = ({ dataKey, type }) => {
|
|
|
3476
3699
|
import { useQuery as useQuery5 } from "@tanstack/react-query";
|
|
3477
3700
|
var FETCH_KEY_SIZE_QUERY_KEY = "fetch-key-size";
|
|
3478
3701
|
var useFetchKeySize = (dataKey) => {
|
|
3479
|
-
const { redis } =
|
|
3702
|
+
const { redis } = useRedis();
|
|
3480
3703
|
return useQuery5({
|
|
3481
3704
|
queryKey: [FETCH_KEY_SIZE_QUERY_KEY, dataKey],
|
|
3482
3705
|
queryFn: async () => {
|
|
@@ -3486,7 +3709,7 @@ var useFetchKeySize = (dataKey) => {
|
|
|
3486
3709
|
};
|
|
3487
3710
|
|
|
3488
3711
|
// src/components/databrowser/components/display/header-badges.tsx
|
|
3489
|
-
import { jsx as
|
|
3712
|
+
import { jsx as jsx10, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
3490
3713
|
var LengthBadge = ({
|
|
3491
3714
|
dataKey,
|
|
3492
3715
|
type,
|
|
@@ -3494,18 +3717,18 @@ var LengthBadge = ({
|
|
|
3494
3717
|
}) => {
|
|
3495
3718
|
const { data, isLoading } = useFetchKeyLength({ dataKey, type });
|
|
3496
3719
|
const length = content?.length ?? data;
|
|
3497
|
-
return /* @__PURE__ */
|
|
3720
|
+
return /* @__PURE__ */ jsx10(Badge, { label: "Length:", children: isLoading ? /* @__PURE__ */ jsx10(Skeleton, { className: "ml-1 h-3 w-10 rounded-md opacity-50" }) : length });
|
|
3498
3721
|
};
|
|
3499
3722
|
var SizeBadge = ({ dataKey }) => {
|
|
3500
3723
|
const { data: size } = useFetchKeySize(dataKey);
|
|
3501
|
-
return /* @__PURE__ */
|
|
3724
|
+
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
3725
|
unitSeparator: " "
|
|
3503
3726
|
}) });
|
|
3504
3727
|
};
|
|
3505
3728
|
var HeaderTTLBadge = ({ dataKey }) => {
|
|
3506
|
-
const { data: expireAt } =
|
|
3729
|
+
const { data: expireAt } = useFetchTTL(dataKey);
|
|
3507
3730
|
const { mutate: setTTL, isPending } = useSetTTL();
|
|
3508
|
-
return /* @__PURE__ */
|
|
3731
|
+
return /* @__PURE__ */ jsx10(
|
|
3509
3732
|
TTLBadge,
|
|
3510
3733
|
{
|
|
3511
3734
|
expireAt,
|
|
@@ -3515,20 +3738,20 @@ var HeaderTTLBadge = ({ dataKey }) => {
|
|
|
3515
3738
|
);
|
|
3516
3739
|
};
|
|
3517
3740
|
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__ */
|
|
3741
|
+
/* @__PURE__ */ jsx10("span", { className: "text-zinc-500", children: label }),
|
|
3742
|
+
/* @__PURE__ */ jsx10("span", { className: "font-medium", children })
|
|
3520
3743
|
] });
|
|
3521
3744
|
|
|
3522
3745
|
// src/components/databrowser/components/display/ttl-popover.tsx
|
|
3523
|
-
import { useEffect as useEffect3, useMemo as
|
|
3746
|
+
import { useEffect as useEffect3, useMemo as useMemo5, useState as useState3 } from "react";
|
|
3524
3747
|
import { Controller, useForm } from "react-hook-form";
|
|
3525
3748
|
|
|
3526
3749
|
// src/components/ui/input.tsx
|
|
3527
3750
|
import * as React4 from "react";
|
|
3528
|
-
import { jsx as
|
|
3751
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
3529
3752
|
var Input = React4.forwardRef(
|
|
3530
3753
|
({ className, type, ...props }, ref) => {
|
|
3531
|
-
return /* @__PURE__ */
|
|
3754
|
+
return /* @__PURE__ */ jsx11(
|
|
3532
3755
|
"input",
|
|
3533
3756
|
{
|
|
3534
3757
|
type,
|
|
@@ -3547,10 +3770,10 @@ Input.displayName = "Input";
|
|
|
3547
3770
|
// src/components/ui/popover.tsx
|
|
3548
3771
|
import * as React5 from "react";
|
|
3549
3772
|
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
3550
|
-
import { jsx as
|
|
3773
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
3551
3774
|
var Popover = PopoverPrimitive.Root;
|
|
3552
3775
|
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
3553
|
-
var PopoverContent = React5.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */
|
|
3776
|
+
var PopoverContent = React5.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx12(PopoverPrimitive.Portal, { container: portalRoot, children: /* @__PURE__ */ jsx12(
|
|
3554
3777
|
PopoverPrimitive.Content,
|
|
3555
3778
|
{
|
|
3556
3779
|
ref,
|
|
@@ -3568,7 +3791,7 @@ PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
|
3568
3791
|
// src/components/ui/select.tsx
|
|
3569
3792
|
import * as React6 from "react";
|
|
3570
3793
|
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
3571
|
-
import { jsx as
|
|
3794
|
+
import { jsx as jsx13, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
3572
3795
|
var Select = SelectPrimitive.Root;
|
|
3573
3796
|
var SelectGroup = SelectPrimitive.Group;
|
|
3574
3797
|
var SelectValue = SelectPrimitive.Value;
|
|
@@ -3583,7 +3806,7 @@ var SelectTrigger = React6.forwardRef(({ className, children, ...props }, ref) =
|
|
|
3583
3806
|
...props,
|
|
3584
3807
|
children: [
|
|
3585
3808
|
children,
|
|
3586
|
-
/* @__PURE__ */
|
|
3809
|
+
/* @__PURE__ */ jsx13(SelectPrimitive.Icon, { asChild: true, className: "absolute right-2", children: /* @__PURE__ */ jsx13(
|
|
3587
3810
|
"svg",
|
|
3588
3811
|
{
|
|
3589
3812
|
width: "16",
|
|
@@ -3591,7 +3814,7 @@ var SelectTrigger = React6.forwardRef(({ className, children, ...props }, ref) =
|
|
|
3591
3814
|
viewBox: "0 0 16 16",
|
|
3592
3815
|
fill: "none",
|
|
3593
3816
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3594
|
-
children: /* @__PURE__ */
|
|
3817
|
+
children: /* @__PURE__ */ jsx13(
|
|
3595
3818
|
"path",
|
|
3596
3819
|
{
|
|
3597
3820
|
d: "M4 6L8 10L12 6",
|
|
@@ -3608,7 +3831,7 @@ var SelectTrigger = React6.forwardRef(({ className, children, ...props }, ref) =
|
|
|
3608
3831
|
}
|
|
3609
3832
|
));
|
|
3610
3833
|
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
3611
|
-
var SelectContent = React6.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */
|
|
3834
|
+
var SelectContent = React6.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx13(SelectPrimitive.Portal, { container: portalRoot, children: /* @__PURE__ */ jsx13(
|
|
3612
3835
|
SelectPrimitive.Content,
|
|
3613
3836
|
{
|
|
3614
3837
|
ref,
|
|
@@ -3619,7 +3842,7 @@ var SelectContent = React6.forwardRef(({ className, children, position = "popper
|
|
|
3619
3842
|
),
|
|
3620
3843
|
position,
|
|
3621
3844
|
...props,
|
|
3622
|
-
children: /* @__PURE__ */
|
|
3845
|
+
children: /* @__PURE__ */ jsx13(
|
|
3623
3846
|
SelectPrimitive.Viewport,
|
|
3624
3847
|
{
|
|
3625
3848
|
className: cn(
|
|
@@ -3632,7 +3855,7 @@ var SelectContent = React6.forwardRef(({ className, children, position = "popper
|
|
|
3632
3855
|
}
|
|
3633
3856
|
) }));
|
|
3634
3857
|
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
3635
|
-
var SelectLabel = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
3858
|
+
var SelectLabel = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx13(
|
|
3636
3859
|
SelectPrimitive.Label,
|
|
3637
3860
|
{
|
|
3638
3861
|
ref,
|
|
@@ -3651,7 +3874,7 @@ var SelectItem = React6.forwardRef(({ className, children, ...props }, ref) => /
|
|
|
3651
3874
|
),
|
|
3652
3875
|
...props,
|
|
3653
3876
|
children: [
|
|
3654
|
-
/* @__PURE__ */
|
|
3877
|
+
/* @__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
3878
|
"svg",
|
|
3656
3879
|
{
|
|
3657
3880
|
width: "15",
|
|
@@ -3660,7 +3883,7 @@ var SelectItem = React6.forwardRef(({ className, children, ...props }, ref) => /
|
|
|
3660
3883
|
fill: "none",
|
|
3661
3884
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3662
3885
|
className: "h-4 w-4",
|
|
3663
|
-
children: /* @__PURE__ */
|
|
3886
|
+
children: /* @__PURE__ */ jsx13(
|
|
3664
3887
|
"path",
|
|
3665
3888
|
{
|
|
3666
3889
|
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 +3894,12 @@ var SelectItem = React6.forwardRef(({ className, children, ...props }, ref) => /
|
|
|
3671
3894
|
)
|
|
3672
3895
|
}
|
|
3673
3896
|
) }) }) }),
|
|
3674
|
-
/* @__PURE__ */
|
|
3897
|
+
/* @__PURE__ */ jsx13(SelectPrimitive.ItemText, { children })
|
|
3675
3898
|
]
|
|
3676
3899
|
}
|
|
3677
3900
|
));
|
|
3678
3901
|
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
3679
|
-
var SelectSeparator = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
3902
|
+
var SelectSeparator = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx13(
|
|
3680
3903
|
SelectPrimitive.Separator,
|
|
3681
3904
|
{
|
|
3682
3905
|
ref,
|
|
@@ -3687,16 +3910,16 @@ var SelectSeparator = React6.forwardRef(({ className, ...props }, ref) => /* @__
|
|
|
3687
3910
|
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
|
|
3688
3911
|
|
|
3689
3912
|
// src/components/ui/spinner.tsx
|
|
3690
|
-
import { Fragment, jsx as
|
|
3913
|
+
import { Fragment, jsx as jsx14, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
3691
3914
|
var Spinner = ({
|
|
3692
3915
|
isLoading,
|
|
3693
3916
|
className,
|
|
3694
3917
|
isLoadingText,
|
|
3695
3918
|
children
|
|
3696
3919
|
}) => {
|
|
3697
|
-
return /* @__PURE__ */
|
|
3920
|
+
return /* @__PURE__ */ jsx14("div", { className: className ?? "flex items-center", children: isLoading ? /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
3698
3921
|
isLoadingText,
|
|
3699
|
-
/* @__PURE__ */
|
|
3922
|
+
/* @__PURE__ */ jsx14(
|
|
3700
3923
|
"svg",
|
|
3701
3924
|
{
|
|
3702
3925
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3709,14 +3932,14 @@ var Spinner = ({
|
|
|
3709
3932
|
strokeLinecap: "round",
|
|
3710
3933
|
strokeLinejoin: "round",
|
|
3711
3934
|
className: cn("h-4 w-4 animate-spin", isLoadingText ? "ml-2" : ""),
|
|
3712
|
-
children: /* @__PURE__ */
|
|
3935
|
+
children: /* @__PURE__ */ jsx14("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" })
|
|
3713
3936
|
}
|
|
3714
3937
|
)
|
|
3715
3938
|
] }) : children });
|
|
3716
3939
|
};
|
|
3717
3940
|
|
|
3718
3941
|
// src/components/databrowser/components/display/ttl-popover.tsx
|
|
3719
|
-
import { jsx as
|
|
3942
|
+
import { jsx as jsx15, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
3720
3943
|
var timeUnits = [
|
|
3721
3944
|
{ label: "Seconds", value: 1 },
|
|
3722
3945
|
{ label: "Minutes", value: 60 },
|
|
@@ -3729,8 +3952,8 @@ function TTLPopover({
|
|
|
3729
3952
|
setTTL,
|
|
3730
3953
|
isPending
|
|
3731
3954
|
}) {
|
|
3732
|
-
const [open, setOpen] =
|
|
3733
|
-
const defaultValues =
|
|
3955
|
+
const [open, setOpen] = useState3(false);
|
|
3956
|
+
const defaultValues = useMemo5(() => {
|
|
3734
3957
|
return { type: "Seconds", value: ttl };
|
|
3735
3958
|
}, [ttl]);
|
|
3736
3959
|
const { control, handleSubmit, formState, reset } = useForm({
|
|
@@ -3758,8 +3981,8 @@ function TTLPopover({
|
|
|
3758
3981
|
setOpen(isOpen);
|
|
3759
3982
|
},
|
|
3760
3983
|
children: [
|
|
3761
|
-
/* @__PURE__ */
|
|
3762
|
-
/* @__PURE__ */
|
|
3984
|
+
/* @__PURE__ */ jsx15(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx15("button", { children }) }),
|
|
3985
|
+
/* @__PURE__ */ jsx15(PopoverContent, { className: "w-[300px]", align: "end", children: /* @__PURE__ */ jsxs6(
|
|
3763
3986
|
"form",
|
|
3764
3987
|
{
|
|
3765
3988
|
className: "space-y-4",
|
|
@@ -3768,10 +3991,10 @@ function TTLPopover({
|
|
|
3768
3991
|
e.stopPropagation();
|
|
3769
3992
|
},
|
|
3770
3993
|
children: [
|
|
3771
|
-
/* @__PURE__ */
|
|
3994
|
+
/* @__PURE__ */ jsx15("h4", { className: "font-medium leading-none", children: "Expiration" }),
|
|
3772
3995
|
/* @__PURE__ */ jsxs6("div", { children: [
|
|
3773
3996
|
/* @__PURE__ */ jsxs6("div", { className: "flex items-center", children: [
|
|
3774
|
-
/* @__PURE__ */
|
|
3997
|
+
/* @__PURE__ */ jsx15(
|
|
3775
3998
|
Controller,
|
|
3776
3999
|
{
|
|
3777
4000
|
rules: {
|
|
@@ -3780,26 +4003,26 @@ function TTLPopover({
|
|
|
3780
4003
|
},
|
|
3781
4004
|
control,
|
|
3782
4005
|
name: "value",
|
|
3783
|
-
render: ({ field }) => /* @__PURE__ */
|
|
4006
|
+
render: ({ field }) => /* @__PURE__ */ jsx15(Input, { min: "-1", ...field, className: "grow rounded-r-none" })
|
|
3784
4007
|
}
|
|
3785
4008
|
),
|
|
3786
|
-
/* @__PURE__ */
|
|
4009
|
+
/* @__PURE__ */ jsx15(
|
|
3787
4010
|
Controller,
|
|
3788
4011
|
{
|
|
3789
4012
|
control,
|
|
3790
4013
|
name: "type",
|
|
3791
4014
|
render: ({ field }) => /* @__PURE__ */ jsxs6(Select, { value: field.value, onValueChange: field.onChange, children: [
|
|
3792
|
-
/* @__PURE__ */
|
|
3793
|
-
/* @__PURE__ */
|
|
4015
|
+
/* @__PURE__ */ jsx15(SelectTrigger, { className: "w-auto rounded-l-none border-l-0 pr-8", children: /* @__PURE__ */ jsx15(SelectValue, {}) }),
|
|
4016
|
+
/* @__PURE__ */ jsx15(SelectContent, { children: timeUnits.map((unit) => /* @__PURE__ */ jsx15(SelectItem, { value: unit.label, children: unit.label }, unit.label)) })
|
|
3794
4017
|
] })
|
|
3795
4018
|
}
|
|
3796
4019
|
)
|
|
3797
4020
|
] }),
|
|
3798
|
-
formState.errors.value && /* @__PURE__ */
|
|
3799
|
-
/* @__PURE__ */
|
|
4021
|
+
formState.errors.value && /* @__PURE__ */ jsx15("p", { className: "mt-2 text-xs text-red-500", children: formState.errors.value.message }),
|
|
4022
|
+
/* @__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
4023
|
] }),
|
|
3801
4024
|
/* @__PURE__ */ jsxs6("div", { className: "flex justify-between", children: [
|
|
3802
|
-
/* @__PURE__ */
|
|
4025
|
+
/* @__PURE__ */ jsx15(
|
|
3803
4026
|
Button,
|
|
3804
4027
|
{
|
|
3805
4028
|
type: "button",
|
|
@@ -3810,8 +4033,8 @@ function TTLPopover({
|
|
|
3810
4033
|
}
|
|
3811
4034
|
),
|
|
3812
4035
|
/* @__PURE__ */ jsxs6("div", { className: "flex gap-2", children: [
|
|
3813
|
-
/* @__PURE__ */
|
|
3814
|
-
/* @__PURE__ */
|
|
4036
|
+
/* @__PURE__ */ jsx15(Button, { variant: "outline", onClick: () => setOpen(false), type: "button", children: "Cancel" }),
|
|
4037
|
+
/* @__PURE__ */ jsx15(Button, { variant: "primary", type: "submit", children: /* @__PURE__ */ jsx15(Spinner, { isLoading: isPending, isLoadingText: "Saving", children: "Save" }) })
|
|
3815
4038
|
] })
|
|
3816
4039
|
] })
|
|
3817
4040
|
]
|
|
@@ -3823,7 +4046,7 @@ function TTLPopover({
|
|
|
3823
4046
|
}
|
|
3824
4047
|
|
|
3825
4048
|
// src/components/databrowser/components/display/ttl-badge.tsx
|
|
3826
|
-
import { jsx as
|
|
4049
|
+
import { jsx as jsx16, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3827
4050
|
var TTL_INFINITE = -1;
|
|
3828
4051
|
var TTL_NOT_FOUND = -2;
|
|
3829
4052
|
var calculateTTL = (expireAt) => {
|
|
@@ -3837,7 +4060,7 @@ var TTLBadge = ({
|
|
|
3837
4060
|
setTTL,
|
|
3838
4061
|
isPending
|
|
3839
4062
|
}) => {
|
|
3840
|
-
const [ttl, setTTLLabel] =
|
|
4063
|
+
const [ttl, setTTLLabel] = useState4(() => calculateTTL(expireAt));
|
|
3841
4064
|
useEffect4(() => {
|
|
3842
4065
|
setTTLLabel(calculateTTL(expireAt));
|
|
3843
4066
|
const interval = setInterval(() => {
|
|
@@ -3845,16 +4068,16 @@ var TTLBadge = ({
|
|
|
3845
4068
|
}, 1e3);
|
|
3846
4069
|
return () => clearInterval(interval);
|
|
3847
4070
|
}, [expireAt]);
|
|
3848
|
-
return /* @__PURE__ */
|
|
4071
|
+
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
4072
|
ttl === TTL_INFINITE ? "Forever" : formatTime(ttl),
|
|
3850
|
-
/* @__PURE__ */
|
|
4073
|
+
/* @__PURE__ */ jsx16(IconChevronDown, { className: "mt-[1px] text-zinc-400", size: 12 })
|
|
3851
4074
|
] }) }) });
|
|
3852
4075
|
};
|
|
3853
4076
|
|
|
3854
4077
|
// src/components/databrowser/hooks/use-fetch-ttl.ts
|
|
3855
4078
|
var FETCH_TTL_QUERY_KEY = "fetch-ttl";
|
|
3856
|
-
var
|
|
3857
|
-
const { redis } =
|
|
4079
|
+
var useFetchTTL = (dataKey) => {
|
|
4080
|
+
const { redis } = useRedis();
|
|
3858
4081
|
const { isLoading, error, data } = useQuery6({
|
|
3859
4082
|
queryKey: [FETCH_TTL_QUERY_KEY, dataKey],
|
|
3860
4083
|
queryFn: async () => {
|
|
@@ -3875,7 +4098,7 @@ var useFetchKeyExpire = (dataKey) => {
|
|
|
3875
4098
|
// src/components/databrowser/hooks/use-set-simple-key.tsx
|
|
3876
4099
|
import { useMutation as useMutation4 } from "@tanstack/react-query";
|
|
3877
4100
|
var useSetSimpleKey = (dataKey, type) => {
|
|
3878
|
-
const { redis } =
|
|
4101
|
+
const { redis } = useRedis();
|
|
3879
4102
|
return useMutation4({
|
|
3880
4103
|
mutationFn: async (value) => {
|
|
3881
4104
|
if (type === "string") {
|
|
@@ -3898,7 +4121,7 @@ var useSetSimpleKey = (dataKey, type) => {
|
|
|
3898
4121
|
// src/components/databrowser/hooks/use-set-ttl.ts
|
|
3899
4122
|
import { useMutation as useMutation5 } from "@tanstack/react-query";
|
|
3900
4123
|
var useSetTTL = () => {
|
|
3901
|
-
const { redis } =
|
|
4124
|
+
const { redis } = useRedis();
|
|
3902
4125
|
const updateTTL = useMutation5({
|
|
3903
4126
|
mutationFn: async ({ dataKey, ttl }) => {
|
|
3904
4127
|
await (ttl === void 0 || ttl === TTL_INFINITE ? redis.persist(dataKey) : redis.expire(dataKey, ttl));
|
|
@@ -3916,14 +4139,14 @@ var useSetTTL = () => {
|
|
|
3916
4139
|
};
|
|
3917
4140
|
|
|
3918
4141
|
// src/components/databrowser/components/item-context-menu.tsx
|
|
3919
|
-
import { useState as
|
|
4142
|
+
import { useState as useState5 } from "react";
|
|
3920
4143
|
import { ContextMenuSeparator as ContextMenuSeparator2 } from "@radix-ui/react-context-menu";
|
|
3921
4144
|
|
|
3922
4145
|
// src/components/ui/context-menu.tsx
|
|
3923
4146
|
import * as React7 from "react";
|
|
3924
4147
|
import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
|
|
3925
4148
|
import { CheckIcon, ChevronRightIcon, DotFilledIcon } from "@radix-ui/react-icons";
|
|
3926
|
-
import { jsx as
|
|
4149
|
+
import { jsx as jsx17, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3927
4150
|
var ContextMenu = ContextMenuPrimitive.Root;
|
|
3928
4151
|
var ContextMenuTrigger = ContextMenuPrimitive.Trigger;
|
|
3929
4152
|
var ContextMenuSubTrigger = React7.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs8(
|
|
@@ -3938,12 +4161,12 @@ var ContextMenuSubTrigger = React7.forwardRef(({ className, inset, children, ...
|
|
|
3938
4161
|
...props,
|
|
3939
4162
|
children: [
|
|
3940
4163
|
children,
|
|
3941
|
-
/* @__PURE__ */
|
|
4164
|
+
/* @__PURE__ */ jsx17(ChevronRightIcon, { className: "ml-auto h-4 w-4" })
|
|
3942
4165
|
]
|
|
3943
4166
|
}
|
|
3944
4167
|
));
|
|
3945
4168
|
ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;
|
|
3946
|
-
var ContextMenuSubContent = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
4169
|
+
var ContextMenuSubContent = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx17(
|
|
3947
4170
|
ContextMenuPrimitive.SubContent,
|
|
3948
4171
|
{
|
|
3949
4172
|
ref,
|
|
@@ -3955,7 +4178,7 @@ var ContextMenuSubContent = React7.forwardRef(({ className, ...props }, ref) =>
|
|
|
3955
4178
|
}
|
|
3956
4179
|
));
|
|
3957
4180
|
ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName;
|
|
3958
|
-
var ContextMenuContent = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
4181
|
+
var ContextMenuContent = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx17(ContextMenuPrimitive.Portal, { container: portalRoot, children: /* @__PURE__ */ jsx17(
|
|
3959
4182
|
ContextMenuPrimitive.Content,
|
|
3960
4183
|
{
|
|
3961
4184
|
ref,
|
|
@@ -3967,7 +4190,7 @@ var ContextMenuContent = React7.forwardRef(({ className, ...props }, ref) => /*
|
|
|
3967
4190
|
}
|
|
3968
4191
|
) }));
|
|
3969
4192
|
ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;
|
|
3970
|
-
var ContextMenuItem = React7.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */
|
|
4193
|
+
var ContextMenuItem = React7.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx17(
|
|
3971
4194
|
ContextMenuPrimitive.Item,
|
|
3972
4195
|
{
|
|
3973
4196
|
ref,
|
|
@@ -3991,7 +4214,7 @@ var ContextMenuCheckboxItem = React7.forwardRef(({ className, children, checked,
|
|
|
3991
4214
|
checked,
|
|
3992
4215
|
...props,
|
|
3993
4216
|
children: [
|
|
3994
|
-
/* @__PURE__ */
|
|
4217
|
+
/* @__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
4218
|
children
|
|
3996
4219
|
]
|
|
3997
4220
|
}
|
|
@@ -4007,13 +4230,13 @@ var ContextMenuRadioItem = React7.forwardRef(({ className, children, ...props },
|
|
|
4007
4230
|
),
|
|
4008
4231
|
...props,
|
|
4009
4232
|
children: [
|
|
4010
|
-
/* @__PURE__ */
|
|
4233
|
+
/* @__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
4234
|
children
|
|
4012
4235
|
]
|
|
4013
4236
|
}
|
|
4014
4237
|
));
|
|
4015
4238
|
ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName;
|
|
4016
|
-
var ContextMenuLabel = React7.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */
|
|
4239
|
+
var ContextMenuLabel = React7.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx17(
|
|
4017
4240
|
ContextMenuPrimitive.Label,
|
|
4018
4241
|
{
|
|
4019
4242
|
ref,
|
|
@@ -4026,7 +4249,7 @@ var ContextMenuLabel = React7.forwardRef(({ className, inset, ...props }, ref) =
|
|
|
4026
4249
|
}
|
|
4027
4250
|
));
|
|
4028
4251
|
ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName;
|
|
4029
|
-
var ContextMenuSeparator = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
4252
|
+
var ContextMenuSeparator = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx17(
|
|
4030
4253
|
ContextMenuPrimitive.Separator,
|
|
4031
4254
|
{
|
|
4032
4255
|
ref,
|
|
@@ -4036,7 +4259,7 @@ var ContextMenuSeparator = React7.forwardRef(({ className, ...props }, ref) => /
|
|
|
4036
4259
|
));
|
|
4037
4260
|
ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName;
|
|
4038
4261
|
var ContextMenuShortcut = ({ className, ...props }) => {
|
|
4039
|
-
return /* @__PURE__ */
|
|
4262
|
+
return /* @__PURE__ */ jsx17(
|
|
4040
4263
|
"span",
|
|
4041
4264
|
{
|
|
4042
4265
|
className: cn(
|
|
@@ -4052,12 +4275,12 @@ ContextMenuShortcut.displayName = "ContextMenuShortcut";
|
|
|
4052
4275
|
// src/components/ui/alert-dialog.tsx
|
|
4053
4276
|
import * as React8 from "react";
|
|
4054
4277
|
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
|
|
4055
|
-
import { jsx as
|
|
4278
|
+
import { jsx as jsx18, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
4056
4279
|
var AlertDialog = AlertDialogPrimitive.Root;
|
|
4057
4280
|
var AlertDialogTrigger = AlertDialogPrimitive.Trigger;
|
|
4058
|
-
var AlertDialogPortal = ({ ...props }) => /* @__PURE__ */
|
|
4281
|
+
var AlertDialogPortal = ({ ...props }) => /* @__PURE__ */ jsx18(AlertDialogPrimitive.Portal, { container: portalRoot, ...props });
|
|
4059
4282
|
AlertDialogPortal.displayName = AlertDialogPrimitive.Portal.displayName;
|
|
4060
|
-
var AlertDialogOverlay = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
4283
|
+
var AlertDialogOverlay = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx18(
|
|
4061
4284
|
AlertDialogPrimitive.Overlay,
|
|
4062
4285
|
{
|
|
4063
4286
|
className: cn(
|
|
@@ -4070,8 +4293,8 @@ var AlertDialogOverlay = React8.forwardRef(({ className, ...props }, ref) => /*
|
|
|
4070
4293
|
));
|
|
4071
4294
|
AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName;
|
|
4072
4295
|
var AlertDialogContent = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs9(AlertDialogPortal, { children: [
|
|
4073
|
-
/* @__PURE__ */
|
|
4074
|
-
/* @__PURE__ */
|
|
4296
|
+
/* @__PURE__ */ jsx18(AlertDialogOverlay, {}),
|
|
4297
|
+
/* @__PURE__ */ jsx18(
|
|
4075
4298
|
AlertDialogPrimitive.Content,
|
|
4076
4299
|
{
|
|
4077
4300
|
ref,
|
|
@@ -4084,9 +4307,9 @@ var AlertDialogContent = React8.forwardRef(({ className, ...props }, ref) => /*
|
|
|
4084
4307
|
)
|
|
4085
4308
|
] }));
|
|
4086
4309
|
AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName;
|
|
4087
|
-
var AlertDialogHeader = ({ className, ...props }) => /* @__PURE__ */
|
|
4310
|
+
var AlertDialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsx18("div", { className: cn("flex flex-col space-y-2 text-center sm:text-left", className), ...props });
|
|
4088
4311
|
AlertDialogHeader.displayName = "AlertDialogHeader";
|
|
4089
|
-
var AlertDialogFooter = ({ className, ...props }) => /* @__PURE__ */
|
|
4312
|
+
var AlertDialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx18(
|
|
4090
4313
|
"div",
|
|
4091
4314
|
{
|
|
4092
4315
|
className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className),
|
|
@@ -4094,7 +4317,7 @@ var AlertDialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx16(
|
|
|
4094
4317
|
}
|
|
4095
4318
|
);
|
|
4096
4319
|
AlertDialogFooter.displayName = "AlertDialogFooter";
|
|
4097
|
-
var AlertDialogTitle = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
4320
|
+
var AlertDialogTitle = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx18(
|
|
4098
4321
|
AlertDialogPrimitive.Title,
|
|
4099
4322
|
{
|
|
4100
4323
|
ref,
|
|
@@ -4103,7 +4326,7 @@ var AlertDialogTitle = React8.forwardRef(({ className, ...props }, ref) => /* @_
|
|
|
4103
4326
|
}
|
|
4104
4327
|
));
|
|
4105
4328
|
AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName;
|
|
4106
|
-
var AlertDialogDescription = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
4329
|
+
var AlertDialogDescription = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx18(
|
|
4107
4330
|
AlertDialogPrimitive.Description,
|
|
4108
4331
|
{
|
|
4109
4332
|
ref,
|
|
@@ -4112,9 +4335,9 @@ var AlertDialogDescription = React8.forwardRef(({ className, ...props }, ref) =>
|
|
|
4112
4335
|
}
|
|
4113
4336
|
));
|
|
4114
4337
|
AlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName;
|
|
4115
|
-
var AlertDialogAction = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
4338
|
+
var AlertDialogAction = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx18(AlertDialogPrimitive.Action, { ref, className: cn(buttonVariants(), className), ...props }));
|
|
4116
4339
|
AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName;
|
|
4117
|
-
var AlertDialogCancel = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
4340
|
+
var AlertDialogCancel = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx18(
|
|
4118
4341
|
AlertDialogPrimitive.Cancel,
|
|
4119
4342
|
{
|
|
4120
4343
|
ref,
|
|
@@ -4125,7 +4348,7 @@ var AlertDialogCancel = React8.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
4125
4348
|
AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName;
|
|
4126
4349
|
|
|
4127
4350
|
// src/components/databrowser/components/display/delete-alert-dialog.tsx
|
|
4128
|
-
import { jsx as
|
|
4351
|
+
import { jsx as jsx19, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
4129
4352
|
function DeleteAlertDialog({
|
|
4130
4353
|
children,
|
|
4131
4354
|
onDeleteConfirm,
|
|
@@ -4134,21 +4357,21 @@ function DeleteAlertDialog({
|
|
|
4134
4357
|
deletionType
|
|
4135
4358
|
}) {
|
|
4136
4359
|
return /* @__PURE__ */ jsxs10(AlertDialog, { open, onOpenChange, children: [
|
|
4137
|
-
children && /* @__PURE__ */
|
|
4360
|
+
children && /* @__PURE__ */ jsx19(AlertDialogTrigger, { asChild: true, children }),
|
|
4138
4361
|
/* @__PURE__ */ jsxs10(AlertDialogContent, { children: [
|
|
4139
4362
|
/* @__PURE__ */ jsxs10(AlertDialogHeader, { children: [
|
|
4140
|
-
/* @__PURE__ */
|
|
4363
|
+
/* @__PURE__ */ jsx19(AlertDialogTitle, { children: deletionType === "item" ? "Delete Item" : "Delete Key" }),
|
|
4141
4364
|
/* @__PURE__ */ jsxs10(AlertDialogDescription, { className: "mt-5", children: [
|
|
4142
4365
|
"Are you sure you want to delete this ",
|
|
4143
4366
|
deletionType,
|
|
4144
4367
|
"?",
|
|
4145
|
-
/* @__PURE__ */
|
|
4368
|
+
/* @__PURE__ */ jsx19("br", {}),
|
|
4146
4369
|
"This action cannot be undone."
|
|
4147
4370
|
] })
|
|
4148
4371
|
] }),
|
|
4149
4372
|
/* @__PURE__ */ jsxs10(AlertDialogFooter, { children: [
|
|
4150
|
-
/* @__PURE__ */
|
|
4151
|
-
/* @__PURE__ */
|
|
4373
|
+
/* @__PURE__ */ jsx19(AlertDialogCancel, { type: "button", children: "Cancel" }),
|
|
4374
|
+
/* @__PURE__ */ jsx19(
|
|
4152
4375
|
AlertDialogAction,
|
|
4153
4376
|
{
|
|
4154
4377
|
className: "bg-red-500 text-gray-50 hover:bg-red-600",
|
|
@@ -4162,17 +4385,17 @@ function DeleteAlertDialog({
|
|
|
4162
4385
|
}
|
|
4163
4386
|
|
|
4164
4387
|
// src/components/databrowser/components/item-context-menu.tsx
|
|
4165
|
-
import { Fragment as Fragment2, jsx as
|
|
4388
|
+
import { Fragment as Fragment2, jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
4166
4389
|
var ItemContextMenu = ({
|
|
4167
4390
|
children,
|
|
4168
4391
|
dataKey,
|
|
4169
4392
|
type
|
|
4170
4393
|
}) => {
|
|
4171
4394
|
const { mutate: editItem } = useEditListItem();
|
|
4172
|
-
const [isAlertOpen, setAlertOpen] =
|
|
4173
|
-
const [data, setData] =
|
|
4395
|
+
const [isAlertOpen, setAlertOpen] = useState5(false);
|
|
4396
|
+
const [data, setData] = useState5();
|
|
4174
4397
|
return /* @__PURE__ */ jsxs11(Fragment2, { children: [
|
|
4175
|
-
/* @__PURE__ */
|
|
4398
|
+
/* @__PURE__ */ jsx20(
|
|
4176
4399
|
DeleteAlertDialog,
|
|
4177
4400
|
{
|
|
4178
4401
|
deletionType: "item",
|
|
@@ -4194,7 +4417,7 @@ var ItemContextMenu = ({
|
|
|
4194
4417
|
}
|
|
4195
4418
|
),
|
|
4196
4419
|
/* @__PURE__ */ jsxs11(ContextMenu, { children: [
|
|
4197
|
-
/* @__PURE__ */
|
|
4420
|
+
/* @__PURE__ */ jsx20(
|
|
4198
4421
|
ContextMenuTrigger,
|
|
4199
4422
|
{
|
|
4200
4423
|
asChild: true,
|
|
@@ -4214,7 +4437,7 @@ var ItemContextMenu = ({
|
|
|
4214
4437
|
}
|
|
4215
4438
|
),
|
|
4216
4439
|
/* @__PURE__ */ jsxs11(ContextMenuContent, { children: [
|
|
4217
|
-
/* @__PURE__ */
|
|
4440
|
+
/* @__PURE__ */ jsx20(
|
|
4218
4441
|
ContextMenuItem,
|
|
4219
4442
|
{
|
|
4220
4443
|
onClick: () => {
|
|
@@ -4227,7 +4450,7 @@ var ItemContextMenu = ({
|
|
|
4227
4450
|
children: "Copy key"
|
|
4228
4451
|
}
|
|
4229
4452
|
),
|
|
4230
|
-
data?.value && /* @__PURE__ */
|
|
4453
|
+
data?.value && /* @__PURE__ */ jsx20(
|
|
4231
4454
|
ContextMenuItem,
|
|
4232
4455
|
{
|
|
4233
4456
|
onClick: () => {
|
|
@@ -4239,8 +4462,8 @@ var ItemContextMenu = ({
|
|
|
4239
4462
|
children: "Copy value"
|
|
4240
4463
|
}
|
|
4241
4464
|
),
|
|
4242
|
-
/* @__PURE__ */
|
|
4243
|
-
/* @__PURE__ */
|
|
4465
|
+
/* @__PURE__ */ jsx20(ContextMenuSeparator2, {}),
|
|
4466
|
+
/* @__PURE__ */ jsx20(ContextMenuItem, { disabled: type === "stream", onClick: () => setAlertOpen(true), children: "Delete item" })
|
|
4244
4467
|
] })
|
|
4245
4468
|
] })
|
|
4246
4469
|
] });
|
|
@@ -4253,36 +4476,36 @@ import { useEffect as useEffect6, useRef } from "react";
|
|
|
4253
4476
|
// src/components/ui/scroll-area.tsx
|
|
4254
4477
|
import * as React9 from "react";
|
|
4255
4478
|
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
|
|
4256
|
-
import { jsx as
|
|
4257
|
-
var ScrollArea = React9.forwardRef(({ className, children, onScroll, ...props }, ref) => /* @__PURE__ */ jsxs12(
|
|
4479
|
+
import { jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
4480
|
+
var ScrollArea = React9.forwardRef(({ className, children, onScroll, disableRoundedInherit = false, ...props }, ref) => /* @__PURE__ */ jsxs12(
|
|
4258
4481
|
ScrollAreaPrimitive.Root,
|
|
4259
4482
|
{
|
|
4260
4483
|
ref,
|
|
4261
4484
|
className: cn("relative overflow-hidden", className),
|
|
4262
4485
|
...props,
|
|
4263
4486
|
children: [
|
|
4264
|
-
/* @__PURE__ */
|
|
4487
|
+
/* @__PURE__ */ jsx21(
|
|
4265
4488
|
ScrollAreaPrimitive.Viewport,
|
|
4266
4489
|
{
|
|
4267
4490
|
onScroll,
|
|
4268
|
-
className: "h-full w-full
|
|
4491
|
+
className: cn("h-full w-full [&>div]:!block", !disableRoundedInherit && "rounded-[inherit]"),
|
|
4269
4492
|
children
|
|
4270
4493
|
}
|
|
4271
4494
|
),
|
|
4272
|
-
/* @__PURE__ */
|
|
4273
|
-
/* @__PURE__ */
|
|
4495
|
+
/* @__PURE__ */ jsx21(ScrollBar, {}),
|
|
4496
|
+
/* @__PURE__ */ jsx21(ScrollAreaPrimitive.Corner, {})
|
|
4274
4497
|
]
|
|
4275
4498
|
}
|
|
4276
4499
|
));
|
|
4277
4500
|
ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
|
|
4278
|
-
var ScrollBar = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
4501
|
+
var ScrollBar = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx21(
|
|
4279
4502
|
ScrollAreaPrimitive.ScrollAreaScrollbar,
|
|
4280
4503
|
{
|
|
4281
4504
|
ref,
|
|
4282
4505
|
orientation: "vertical",
|
|
4283
4506
|
className: cn("flex h-full w-2 touch-none select-none transition-colors", className),
|
|
4284
4507
|
...props,
|
|
4285
|
-
children: /* @__PURE__ */
|
|
4508
|
+
children: /* @__PURE__ */ jsx21(
|
|
4286
4509
|
ScrollAreaPrimitive.ScrollAreaThumb,
|
|
4287
4510
|
{
|
|
4288
4511
|
className: cn("relative flex-1 rounded-full bg-neutral-200/70 dark:bg-neutral-800")
|
|
@@ -4293,11 +4516,13 @@ var ScrollBar = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
4293
4516
|
ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
|
|
4294
4517
|
|
|
4295
4518
|
// src/components/databrowser/components/sidebar/infinite-scroll.tsx
|
|
4296
|
-
import { jsx as
|
|
4519
|
+
import { jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
4297
4520
|
var InfiniteScroll = ({
|
|
4298
4521
|
query,
|
|
4299
|
-
children
|
|
4522
|
+
children,
|
|
4523
|
+
...props
|
|
4300
4524
|
}) => {
|
|
4525
|
+
const { active } = useTab();
|
|
4301
4526
|
const scrollRef = useRef(null);
|
|
4302
4527
|
const contentRef = useRef(null);
|
|
4303
4528
|
const handleScroll = (e) => {
|
|
@@ -4319,19 +4544,24 @@ var InfiniteScroll = ({
|
|
|
4319
4544
|
}
|
|
4320
4545
|
};
|
|
4321
4546
|
useEffect6(() => {
|
|
4547
|
+
if (!active) return;
|
|
4322
4548
|
const timer = setTimeout(checkAndFetchMore, 100);
|
|
4323
4549
|
return () => clearTimeout(timer);
|
|
4324
|
-
}, [query.data]);
|
|
4325
|
-
return /* @__PURE__ */
|
|
4550
|
+
}, [active, query.data]);
|
|
4551
|
+
return /* @__PURE__ */ jsx22(
|
|
4326
4552
|
ScrollArea,
|
|
4327
4553
|
{
|
|
4328
4554
|
type: "always",
|
|
4329
|
-
className: "block h-full w-full transition-all",
|
|
4330
4555
|
onScroll: handleScroll,
|
|
4556
|
+
...props,
|
|
4557
|
+
className: cn(
|
|
4558
|
+
"block h-full w-full overflow-visible rounded-lg border border-zinc-200 bg-white p-1 pr-3 transition-all",
|
|
4559
|
+
props.className
|
|
4560
|
+
),
|
|
4331
4561
|
ref: scrollRef,
|
|
4332
4562
|
children: /* @__PURE__ */ jsxs13("div", { ref: contentRef, children: [
|
|
4333
4563
|
children,
|
|
4334
|
-
/* @__PURE__ */
|
|
4564
|
+
/* @__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 }) })
|
|
4335
4565
|
] })
|
|
4336
4566
|
}
|
|
4337
4567
|
);
|
|
@@ -4361,15 +4591,15 @@ import {
|
|
|
4361
4591
|
IconList,
|
|
4362
4592
|
IconQuote
|
|
4363
4593
|
} from "@tabler/icons-react";
|
|
4364
|
-
import { jsx as
|
|
4594
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
4365
4595
|
var iconsMap = {
|
|
4366
|
-
string: /* @__PURE__ */
|
|
4367
|
-
set: /* @__PURE__ */
|
|
4368
|
-
hash: /* @__PURE__ */
|
|
4369
|
-
json: /* @__PURE__ */
|
|
4370
|
-
zset: /* @__PURE__ */
|
|
4371
|
-
list: /* @__PURE__ */
|
|
4372
|
-
stream: /* @__PURE__ */
|
|
4596
|
+
string: /* @__PURE__ */ jsx23(IconQuote, { size: 15, stroke: 1.3 }),
|
|
4597
|
+
set: /* @__PURE__ */ jsx23(IconLayersIntersect, { size: 15, stroke: 1.3 }),
|
|
4598
|
+
hash: /* @__PURE__ */ jsx23(IconHash, { size: 15, stroke: 1.3 }),
|
|
4599
|
+
json: /* @__PURE__ */ jsx23(IconCodeDots, { size: 15, stroke: 1.3 }),
|
|
4600
|
+
zset: /* @__PURE__ */ jsx23(IconArrowsSort, { size: 15, stroke: 1.3 }),
|
|
4601
|
+
list: /* @__PURE__ */ jsx23(IconList, { size: 15, stroke: 1.3 }),
|
|
4602
|
+
stream: /* @__PURE__ */ jsx23(IconList, { size: 15, stroke: 1.3 })
|
|
4373
4603
|
};
|
|
4374
4604
|
var tagVariants = cva("inline-flex shrink-0 items-center rounded-md justify-center", {
|
|
4375
4605
|
variants: {
|
|
@@ -4393,7 +4623,7 @@ var tagVariants = cva("inline-flex shrink-0 items-center rounded-md justify-cent
|
|
|
4393
4623
|
}
|
|
4394
4624
|
});
|
|
4395
4625
|
function TypeTag({ className, variant, type }) {
|
|
4396
|
-
return /* @__PURE__ */
|
|
4626
|
+
return /* @__PURE__ */ jsx23("span", { className: cn(tagVariants({ variant, type, className })), children: type === "icon" ? iconsMap[variant] : DATA_TYPE_NAMES[variant] });
|
|
4397
4627
|
}
|
|
4398
4628
|
|
|
4399
4629
|
// src/components/databrowser/components/display/key-actions.tsx
|
|
@@ -4403,7 +4633,7 @@ import { IconDotsVertical } from "@tabler/icons-react";
|
|
|
4403
4633
|
import * as React10 from "react";
|
|
4404
4634
|
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
4405
4635
|
import { CheckIcon as CheckIcon2, ChevronRightIcon as ChevronRightIcon2, DotFilledIcon as DotFilledIcon2 } from "@radix-ui/react-icons";
|
|
4406
|
-
import { jsx as
|
|
4636
|
+
import { jsx as jsx24, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
4407
4637
|
var DropdownMenu = DropdownMenuPrimitive.Root;
|
|
4408
4638
|
var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
4409
4639
|
var DropdownMenuSubTrigger = React10.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs14(
|
|
@@ -4411,45 +4641,45 @@ var DropdownMenuSubTrigger = React10.forwardRef(({ className, inset, children, .
|
|
|
4411
4641
|
{
|
|
4412
4642
|
ref,
|
|
4413
4643
|
className: cn(
|
|
4414
|
-
"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-
|
|
4644
|
+
"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",
|
|
4415
4645
|
inset && "pl-8",
|
|
4416
4646
|
className
|
|
4417
4647
|
),
|
|
4418
4648
|
...props,
|
|
4419
4649
|
children: [
|
|
4420
4650
|
children,
|
|
4421
|
-
/* @__PURE__ */
|
|
4651
|
+
/* @__PURE__ */ jsx24(ChevronRightIcon2, { className: "ml-auto" })
|
|
4422
4652
|
]
|
|
4423
4653
|
}
|
|
4424
4654
|
));
|
|
4425
4655
|
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
|
|
4426
|
-
var DropdownMenuSubContent = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
4656
|
+
var DropdownMenuSubContent = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
4427
4657
|
DropdownMenuPrimitive.SubContent,
|
|
4428
4658
|
{
|
|
4429
4659
|
ref,
|
|
4430
4660
|
className: cn(
|
|
4431
|
-
"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",
|
|
4661
|
+
"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",
|
|
4432
4662
|
className
|
|
4433
4663
|
),
|
|
4434
4664
|
...props
|
|
4435
4665
|
}
|
|
4436
4666
|
));
|
|
4437
4667
|
DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
|
|
4438
|
-
var DropdownMenuContent = React10.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */
|
|
4668
|
+
var DropdownMenuContent = React10.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx24(DropdownMenuPrimitive.Portal, { container: portalRoot, children: /* @__PURE__ */ jsx24(
|
|
4439
4669
|
DropdownMenuPrimitive.Content,
|
|
4440
4670
|
{
|
|
4441
4671
|
ref,
|
|
4442
4672
|
sideOffset,
|
|
4443
4673
|
className: cn(
|
|
4444
|
-
"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",
|
|
4445
|
-
"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",
|
|
4674
|
+
"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",
|
|
4675
|
+
"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",
|
|
4446
4676
|
className
|
|
4447
4677
|
),
|
|
4448
4678
|
...props
|
|
4449
4679
|
}
|
|
4450
4680
|
) }));
|
|
4451
4681
|
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
4452
|
-
var DropdownMenuItem = React10.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */
|
|
4682
|
+
var DropdownMenuItem = React10.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
4453
4683
|
DropdownMenuPrimitive.Item,
|
|
4454
4684
|
{
|
|
4455
4685
|
ref,
|
|
@@ -4473,7 +4703,7 @@ var DropdownMenuCheckboxItem = React10.forwardRef(({ className, children, checke
|
|
|
4473
4703
|
checked,
|
|
4474
4704
|
...props,
|
|
4475
4705
|
children: [
|
|
4476
|
-
/* @__PURE__ */
|
|
4706
|
+
/* @__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" }) }) }),
|
|
4477
4707
|
children
|
|
4478
4708
|
]
|
|
4479
4709
|
}
|
|
@@ -4489,13 +4719,13 @@ var DropdownMenuRadioItem = React10.forwardRef(({ className, children, ...props
|
|
|
4489
4719
|
),
|
|
4490
4720
|
...props,
|
|
4491
4721
|
children: [
|
|
4492
|
-
/* @__PURE__ */
|
|
4722
|
+
/* @__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" }) }) }),
|
|
4493
4723
|
children
|
|
4494
4724
|
]
|
|
4495
4725
|
}
|
|
4496
4726
|
));
|
|
4497
4727
|
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
|
|
4498
|
-
var DropdownMenuLabel = React10.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */
|
|
4728
|
+
var DropdownMenuLabel = React10.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
4499
4729
|
DropdownMenuPrimitive.Label,
|
|
4500
4730
|
{
|
|
4501
4731
|
ref,
|
|
@@ -4504,7 +4734,7 @@ var DropdownMenuLabel = React10.forwardRef(({ className, inset, ...props }, ref)
|
|
|
4504
4734
|
}
|
|
4505
4735
|
));
|
|
4506
4736
|
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
|
|
4507
|
-
var DropdownMenuSeparator = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
4737
|
+
var DropdownMenuSeparator = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
4508
4738
|
DropdownMenuPrimitive.Separator,
|
|
4509
4739
|
{
|
|
4510
4740
|
ref,
|
|
@@ -4514,18 +4744,18 @@ var DropdownMenuSeparator = React10.forwardRef(({ className, ...props }, ref) =>
|
|
|
4514
4744
|
));
|
|
4515
4745
|
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
|
|
4516
4746
|
var DropdownMenuShortcut = ({ className, ...props }) => {
|
|
4517
|
-
return /* @__PURE__ */
|
|
4747
|
+
return /* @__PURE__ */ jsx24("span", { className: cn("ml-auto text-xs tracking-widest opacity-60", className), ...props });
|
|
4518
4748
|
};
|
|
4519
4749
|
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
4520
4750
|
|
|
4521
4751
|
// src/components/databrowser/components/display/key-actions.tsx
|
|
4522
|
-
import { jsx as
|
|
4752
|
+
import { jsx as jsx25, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
4523
4753
|
function KeyActions({ dataKey, content }) {
|
|
4524
4754
|
const { mutateAsync: deleteKey } = useDeleteKey();
|
|
4525
|
-
return /* @__PURE__ */ jsxs15(DropdownMenu, { children: [
|
|
4526
|
-
/* @__PURE__ */
|
|
4755
|
+
return /* @__PURE__ */ jsxs15(DropdownMenu, { modal: false, children: [
|
|
4756
|
+
/* @__PURE__ */ jsx25(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx25(Button, { size: "icon-sm", "aria-label": "Key actions", children: /* @__PURE__ */ jsx25(IconDotsVertical, { className: "size-4 text-zinc-500" }) }) }),
|
|
4527
4757
|
/* @__PURE__ */ jsxs15(DropdownMenuContent, { className: "", align: "end", children: [
|
|
4528
|
-
content && /* @__PURE__ */
|
|
4758
|
+
content && /* @__PURE__ */ jsx25(
|
|
4529
4759
|
DropdownMenuItem,
|
|
4530
4760
|
{
|
|
4531
4761
|
onClick: () => {
|
|
@@ -4537,12 +4767,28 @@ function KeyActions({ dataKey, content }) {
|
|
|
4537
4767
|
children: "Copy content"
|
|
4538
4768
|
}
|
|
4539
4769
|
),
|
|
4540
|
-
/* @__PURE__ */
|
|
4770
|
+
/* @__PURE__ */ jsx25(
|
|
4771
|
+
DropdownMenuItem,
|
|
4772
|
+
{
|
|
4773
|
+
onClick: () => {
|
|
4774
|
+
navigator.clipboard.writeText(dataKey);
|
|
4775
|
+
},
|
|
4776
|
+
children: "Copy key"
|
|
4777
|
+
}
|
|
4778
|
+
),
|
|
4779
|
+
/* @__PURE__ */ jsx25(
|
|
4541
4780
|
DeleteAlertDialog,
|
|
4542
4781
|
{
|
|
4543
4782
|
deletionType: "key",
|
|
4544
4783
|
onDeleteConfirm: async () => await deleteKey(dataKey),
|
|
4545
|
-
children: /* @__PURE__ */
|
|
4784
|
+
children: /* @__PURE__ */ jsx25(
|
|
4785
|
+
DropdownMenuItem,
|
|
4786
|
+
{
|
|
4787
|
+
className: "text-red-500 focus:bg-red-500 focus:text-white",
|
|
4788
|
+
onSelect: (e) => e.preventDefault(),
|
|
4789
|
+
children: "Delete key"
|
|
4790
|
+
}
|
|
4791
|
+
)
|
|
4546
4792
|
}
|
|
4547
4793
|
)
|
|
4548
4794
|
] })
|
|
@@ -4550,29 +4796,29 @@ function KeyActions({ dataKey, content }) {
|
|
|
4550
4796
|
}
|
|
4551
4797
|
|
|
4552
4798
|
// src/components/databrowser/components/display/display-header.tsx
|
|
4553
|
-
import { jsx as
|
|
4799
|
+
import { jsx as jsx26, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
4554
4800
|
var DisplayHeader = ({
|
|
4555
4801
|
dataKey,
|
|
4556
4802
|
type,
|
|
4557
4803
|
content
|
|
4558
4804
|
}) => {
|
|
4559
|
-
const { setSelectedListItem } =
|
|
4805
|
+
const { setSelectedListItem } = useTab();
|
|
4560
4806
|
const handleAddItem = () => {
|
|
4561
4807
|
setSelectedListItem({ key: type === "stream" ? "*" : "", isNew: true });
|
|
4562
4808
|
};
|
|
4563
|
-
return /* @__PURE__ */ jsxs16("div", { className: "rounded-lg bg-zinc-100
|
|
4809
|
+
return /* @__PURE__ */ jsxs16("div", { className: "rounded-lg bg-zinc-100", children: [
|
|
4564
4810
|
/* @__PURE__ */ jsxs16("div", { className: "flex min-h-10 items-center justify-between gap-4", children: [
|
|
4565
|
-
/* @__PURE__ */
|
|
4811
|
+
/* @__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 }) }),
|
|
4566
4812
|
/* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-1", children: [
|
|
4567
|
-
type !== "string" && type !== "json" && /* @__PURE__ */
|
|
4568
|
-
/* @__PURE__ */
|
|
4813
|
+
type !== "string" && type !== "json" && /* @__PURE__ */ jsx26(Button, { onClick: handleAddItem, size: "icon-sm", "aria-label": "Add item", children: /* @__PURE__ */ jsx26(IconPlus, { className: "size-4 text-zinc-500" }) }),
|
|
4814
|
+
/* @__PURE__ */ jsx26(KeyActions, { dataKey, content })
|
|
4569
4815
|
] })
|
|
4570
4816
|
] }),
|
|
4571
4817
|
/* @__PURE__ */ jsxs16("div", { className: "flex h-10 flex-wrap items-center gap-1.5", children: [
|
|
4572
|
-
/* @__PURE__ */
|
|
4573
|
-
/* @__PURE__ */
|
|
4574
|
-
/* @__PURE__ */
|
|
4575
|
-
/* @__PURE__ */
|
|
4818
|
+
/* @__PURE__ */ jsx26(TypeTag, { variant: type, type: "badge" }),
|
|
4819
|
+
/* @__PURE__ */ jsx26(SizeBadge, { dataKey }),
|
|
4820
|
+
/* @__PURE__ */ jsx26(LengthBadge, { dataKey, type, content }),
|
|
4821
|
+
/* @__PURE__ */ jsx26(HeaderTTLBadge, { dataKey })
|
|
4576
4822
|
] })
|
|
4577
4823
|
] });
|
|
4578
4824
|
};
|
|
@@ -4583,10 +4829,10 @@ import { Controller as Controller2, FormProvider, useForm as useForm2, useFormCo
|
|
|
4583
4829
|
// src/components/ui/tooltip.tsx
|
|
4584
4830
|
import * as React11 from "react";
|
|
4585
4831
|
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
4586
|
-
import { Fragment as Fragment3, jsx as
|
|
4832
|
+
import { Fragment as Fragment3, jsx as jsx27, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
4587
4833
|
var Tooltip = TooltipPrimitive.Root;
|
|
4588
4834
|
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
4589
|
-
var TooltipContent = React11.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */
|
|
4835
|
+
var TooltipContent = React11.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx27(TooltipPrimitive.Portal, { container: portalRoot, children: /* @__PURE__ */ jsx27(
|
|
4590
4836
|
TooltipPrimitive.Content,
|
|
4591
4837
|
{
|
|
4592
4838
|
ref,
|
|
@@ -4597,16 +4843,16 @@ var TooltipContent = React11.forwardRef(({ className, sideOffset = 4, ...props }
|
|
|
4597
4843
|
),
|
|
4598
4844
|
...props
|
|
4599
4845
|
}
|
|
4600
|
-
));
|
|
4846
|
+
) }));
|
|
4601
4847
|
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
4602
4848
|
var SimpleTooltip = ({
|
|
4603
4849
|
content,
|
|
4604
4850
|
children
|
|
4605
4851
|
}) => {
|
|
4606
|
-
if (!content) return /* @__PURE__ */
|
|
4852
|
+
if (!content) return /* @__PURE__ */ jsx27(Fragment3, { children });
|
|
4607
4853
|
return /* @__PURE__ */ jsxs17(Tooltip, { delayDuration: 400, children: [
|
|
4608
|
-
/* @__PURE__ */
|
|
4609
|
-
/* @__PURE__ */
|
|
4854
|
+
/* @__PURE__ */ jsx27(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx27("div", { children }) }),
|
|
4855
|
+
/* @__PURE__ */ jsx27(TooltipContent, { side: "top", children: content })
|
|
4610
4856
|
] });
|
|
4611
4857
|
};
|
|
4612
4858
|
|
|
@@ -4617,7 +4863,7 @@ var useFetchHashFieldExpires = ({
|
|
|
4617
4863
|
dataKey,
|
|
4618
4864
|
fields
|
|
4619
4865
|
}) => {
|
|
4620
|
-
const { redis } =
|
|
4866
|
+
const { redis } = useRedis();
|
|
4621
4867
|
return useQuery7({
|
|
4622
4868
|
queryKey: [FETCH_HASH_FIELD_TTLS_QUERY_KEY, dataKey, fields],
|
|
4623
4869
|
queryFn: async () => {
|
|
@@ -4648,7 +4894,7 @@ var useFetchHashFieldExpires = ({
|
|
|
4648
4894
|
// src/components/databrowser/hooks/use-set-hash-ttl.ts
|
|
4649
4895
|
import { useMutation as useMutation6 } from "@tanstack/react-query";
|
|
4650
4896
|
var useSetHashTTL = () => {
|
|
4651
|
-
const { redis } =
|
|
4897
|
+
const { redis } = useRedis();
|
|
4652
4898
|
return useMutation6({
|
|
4653
4899
|
mutationFn: async ({
|
|
4654
4900
|
dataKey,
|
|
@@ -4666,12 +4912,12 @@ var useSetHashTTL = () => {
|
|
|
4666
4912
|
};
|
|
4667
4913
|
|
|
4668
4914
|
// src/components/databrowser/components/display/hash/hash-field-ttl-badge.tsx
|
|
4669
|
-
import { jsx as
|
|
4915
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
4670
4916
|
var HashFieldTTLBadge = ({ dataKey, field }) => {
|
|
4671
4917
|
const { data } = useFetchHashFieldExpires({ dataKey, fields: [field] });
|
|
4672
4918
|
const { mutate: setTTL, isPending } = useSetHashTTL();
|
|
4673
4919
|
const expireAt = data?.[field];
|
|
4674
|
-
return /* @__PURE__ */
|
|
4920
|
+
return /* @__PURE__ */ jsx28(
|
|
4675
4921
|
TTLBadge,
|
|
4676
4922
|
{
|
|
4677
4923
|
label: "Field TTL:",
|
|
@@ -4683,23 +4929,23 @@ var HashFieldTTLBadge = ({ dataKey, field }) => {
|
|
|
4683
4929
|
};
|
|
4684
4930
|
|
|
4685
4931
|
// src/components/databrowser/components/display/input/use-field.tsx
|
|
4686
|
-
import { useEffect as useEffect8, useState as
|
|
4932
|
+
import { useEffect as useEffect8, useState as useState7 } from "react";
|
|
4687
4933
|
import { useController } from "react-hook-form";
|
|
4688
4934
|
|
|
4689
4935
|
// src/components/databrowser/components/display/input/content-type-select.tsx
|
|
4690
|
-
import { useMemo as
|
|
4691
|
-
import { jsx as
|
|
4936
|
+
import { useMemo as useMemo6 } from "react";
|
|
4937
|
+
import { jsx as jsx29, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4692
4938
|
var ContentTypeSelect = ({
|
|
4693
4939
|
value,
|
|
4694
4940
|
onChange,
|
|
4695
4941
|
data
|
|
4696
4942
|
}) => {
|
|
4697
|
-
const isValidJSON =
|
|
4943
|
+
const isValidJSON = useMemo6(() => checkIsValidJSON(data), [data]);
|
|
4698
4944
|
return /* @__PURE__ */ jsxs18(Select, { value, onValueChange: onChange, children: [
|
|
4699
|
-
/* @__PURE__ */
|
|
4700
|
-
/* @__PURE__ */
|
|
4701
|
-
/* @__PURE__ */
|
|
4702
|
-
/* @__PURE__ */
|
|
4945
|
+
/* @__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" }) }),
|
|
4946
|
+
/* @__PURE__ */ jsx29(SelectContent, { children: /* @__PURE__ */ jsxs18(SelectGroup, { children: [
|
|
4947
|
+
/* @__PURE__ */ jsx29(SelectItem, { value: "Text", children: "Text" }),
|
|
4948
|
+
/* @__PURE__ */ jsx29(SelectItem, { disabled: !isValidJSON, value: "JSON", children: "JSON" })
|
|
4703
4949
|
] }) })
|
|
4704
4950
|
] });
|
|
4705
4951
|
};
|
|
@@ -4709,12 +4955,12 @@ import { useEffect as useEffect7, useRef as useRef2 } from "react";
|
|
|
4709
4955
|
import { Editor, useMonaco } from "@monaco-editor/react";
|
|
4710
4956
|
|
|
4711
4957
|
// src/components/databrowser/copy-button.tsx
|
|
4712
|
-
import { useState as
|
|
4958
|
+
import { useState as useState6 } from "react";
|
|
4713
4959
|
import { IconCheck, IconCopy } from "@tabler/icons-react";
|
|
4714
|
-
import { jsx as
|
|
4960
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
4715
4961
|
function CopyButton({ value, ...props }) {
|
|
4716
|
-
const [copied, setCopied] =
|
|
4717
|
-
return /* @__PURE__ */
|
|
4962
|
+
const [copied, setCopied] = useState6(false);
|
|
4963
|
+
return /* @__PURE__ */ jsx30(
|
|
4718
4964
|
Button,
|
|
4719
4965
|
{
|
|
4720
4966
|
onClick: (e) => {
|
|
@@ -4731,7 +4977,7 @@ function CopyButton({ value, ...props }) {
|
|
|
4731
4977
|
variant: "secondary",
|
|
4732
4978
|
size: "icon-sm",
|
|
4733
4979
|
...props,
|
|
4734
|
-
children: copied ? /* @__PURE__ */
|
|
4980
|
+
children: copied ? /* @__PURE__ */ jsx30(IconCheck, { className: "size-4 text-green-500" }) : /* @__PURE__ */ jsx30(IconCopy, { className: "size-4 text-zinc-500" })
|
|
4735
4981
|
}
|
|
4736
4982
|
);
|
|
4737
4983
|
}
|
|
@@ -4744,7 +4990,7 @@ var handleCopyClick = async (textToCopy) => {
|
|
|
4744
4990
|
};
|
|
4745
4991
|
|
|
4746
4992
|
// src/components/databrowser/components/display/input/custom-editor.tsx
|
|
4747
|
-
import { jsx as
|
|
4993
|
+
import { jsx as jsx31, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4748
4994
|
var CustomEditor = ({
|
|
4749
4995
|
language,
|
|
4750
4996
|
value,
|
|
@@ -4753,64 +4999,60 @@ var CustomEditor = ({
|
|
|
4753
4999
|
showCopyButton,
|
|
4754
5000
|
readOnly
|
|
4755
5001
|
}) => {
|
|
5002
|
+
const { active } = useTab();
|
|
4756
5003
|
const monaco = useMonaco();
|
|
4757
5004
|
const editorRef = useRef2();
|
|
4758
5005
|
useEffect7(() => {
|
|
4759
|
-
if (!monaco || !editorRef.current) {
|
|
5006
|
+
if (!active || !monaco || !editorRef.current) {
|
|
4760
5007
|
return;
|
|
4761
5008
|
}
|
|
4762
5009
|
monaco?.editor.setModelLanguage(editorRef.current.getModel(), language);
|
|
4763
|
-
}, [monaco, language]);
|
|
5010
|
+
}, [monaco, language, active]);
|
|
5011
|
+
const editor = /* @__PURE__ */ jsx31(
|
|
5012
|
+
Editor,
|
|
5013
|
+
{
|
|
5014
|
+
loading: void 0,
|
|
5015
|
+
onMount: (editor2) => {
|
|
5016
|
+
editorRef.current = editor2;
|
|
5017
|
+
},
|
|
5018
|
+
value,
|
|
5019
|
+
onChange: (value2) => {
|
|
5020
|
+
onChange(value2 ?? "");
|
|
5021
|
+
},
|
|
5022
|
+
defaultLanguage: language,
|
|
5023
|
+
options: {
|
|
5024
|
+
readOnly,
|
|
5025
|
+
wordWrap: "on",
|
|
5026
|
+
overviewRulerBorder: false,
|
|
5027
|
+
overviewRulerLanes: 0,
|
|
5028
|
+
formatOnPaste: true,
|
|
5029
|
+
formatOnType: true,
|
|
5030
|
+
renderWhitespace: "none",
|
|
5031
|
+
smoothScrolling: true,
|
|
5032
|
+
autoIndent: "full",
|
|
5033
|
+
guides: { indentation: false },
|
|
5034
|
+
fontSize: 13,
|
|
5035
|
+
cursorBlinking: "smooth",
|
|
5036
|
+
minimap: { enabled: false },
|
|
5037
|
+
folding: false,
|
|
5038
|
+
glyphMargin: false,
|
|
5039
|
+
lineNumbers: "off",
|
|
5040
|
+
parameterHints: { enabled: false },
|
|
5041
|
+
lineDecorationsWidth: 0,
|
|
5042
|
+
automaticLayout: true,
|
|
5043
|
+
scrollBeyondLastLine: false,
|
|
5044
|
+
renderLineHighlight: "none"
|
|
5045
|
+
}
|
|
5046
|
+
}
|
|
5047
|
+
);
|
|
4764
5048
|
return /* @__PURE__ */ jsxs19(
|
|
4765
5049
|
"div",
|
|
4766
5050
|
{
|
|
4767
5051
|
className: cn("group/editor relative", height === void 0 && "h-full p-2"),
|
|
4768
|
-
style: {
|
|
4769
|
-
height
|
|
4770
|
-
},
|
|
5052
|
+
style: { height },
|
|
4771
5053
|
children: [
|
|
4772
|
-
/* @__PURE__ */
|
|
4773
|
-
|
|
4774
|
-
{
|
|
4775
|
-
loading: void 0,
|
|
4776
|
-
onMount: (editor) => {
|
|
4777
|
-
editorRef.current = editor;
|
|
4778
|
-
},
|
|
4779
|
-
value,
|
|
4780
|
-
onChange: (value2) => {
|
|
4781
|
-
onChange(value2 ?? "");
|
|
4782
|
-
},
|
|
4783
|
-
defaultLanguage: language,
|
|
4784
|
-
options: {
|
|
4785
|
-
readOnly,
|
|
4786
|
-
wordWrap: "on",
|
|
4787
|
-
overviewRulerBorder: false,
|
|
4788
|
-
overviewRulerLanes: 0,
|
|
4789
|
-
formatOnPaste: true,
|
|
4790
|
-
formatOnType: true,
|
|
4791
|
-
renderWhitespace: "none",
|
|
4792
|
-
smoothScrolling: true,
|
|
4793
|
-
autoIndent: "full",
|
|
4794
|
-
guides: {
|
|
4795
|
-
indentation: false
|
|
4796
|
-
},
|
|
4797
|
-
fontSize: 13,
|
|
4798
|
-
cursorBlinking: "smooth",
|
|
4799
|
-
minimap: {
|
|
4800
|
-
enabled: false
|
|
4801
|
-
},
|
|
4802
|
-
folding: false,
|
|
4803
|
-
glyphMargin: false,
|
|
4804
|
-
lineNumbers: "off",
|
|
4805
|
-
parameterHints: { enabled: false },
|
|
4806
|
-
lineDecorationsWidth: 0,
|
|
4807
|
-
automaticLayout: true,
|
|
4808
|
-
scrollBeyondLastLine: false,
|
|
4809
|
-
renderLineHighlight: "none"
|
|
4810
|
-
}
|
|
4811
|
-
}
|
|
4812
|
-
),
|
|
4813
|
-
showCopyButton && /* @__PURE__ */ jsx29(
|
|
5054
|
+
isTest ? /* @__PURE__ */ jsx31("input", { "aria-label": "editor", value, onChange: (e) => onChange(e.target.value) }) : editor,
|
|
5055
|
+
showCopyButton && /* @__PURE__ */ jsx31(
|
|
4814
5056
|
CopyButton,
|
|
4815
5057
|
{
|
|
4816
5058
|
value,
|
|
@@ -4823,7 +5065,7 @@ var CustomEditor = ({
|
|
|
4823
5065
|
};
|
|
4824
5066
|
|
|
4825
5067
|
// src/components/databrowser/components/display/input/use-field.tsx
|
|
4826
|
-
import { Fragment as Fragment4, jsx as
|
|
5068
|
+
import { Fragment as Fragment4, jsx as jsx32 } from "react/jsx-runtime";
|
|
4827
5069
|
var useField = ({
|
|
4828
5070
|
name,
|
|
4829
5071
|
form,
|
|
@@ -4836,7 +5078,7 @@ var useField = ({
|
|
|
4836
5078
|
name,
|
|
4837
5079
|
control: form.control
|
|
4838
5080
|
});
|
|
4839
|
-
const [contentType, setContentType] =
|
|
5081
|
+
const [contentType, setContentType] = useState7(
|
|
4840
5082
|
() => checkIsValidJSON(field.value) ? "JSON" : "Text"
|
|
4841
5083
|
);
|
|
4842
5084
|
useEffect8(() => {
|
|
@@ -4863,8 +5105,8 @@ var useField = ({
|
|
|
4863
5105
|
}
|
|
4864
5106
|
};
|
|
4865
5107
|
return {
|
|
4866
|
-
selector: /* @__PURE__ */
|
|
4867
|
-
editor: /* @__PURE__ */
|
|
5108
|
+
selector: /* @__PURE__ */ jsx32(ContentTypeSelect, { value: contentType, onChange: handleTypeChange, data: field.value }),
|
|
5109
|
+
editor: /* @__PURE__ */ jsx32(Fragment4, { children: /* @__PURE__ */ jsx32(
|
|
4868
5110
|
CustomEditor,
|
|
4869
5111
|
{
|
|
4870
5112
|
language: contentType === "JSON" ? "json" : "plaintext",
|
|
@@ -4888,13 +5130,13 @@ var checkIsValidJSON = (value) => {
|
|
|
4888
5130
|
};
|
|
4889
5131
|
|
|
4890
5132
|
// src/components/databrowser/components/display/display-list-edit.tsx
|
|
4891
|
-
import { jsx as
|
|
5133
|
+
import { jsx as jsx33, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4892
5134
|
var ListEditDisplay = ({
|
|
4893
5135
|
dataKey,
|
|
4894
5136
|
type,
|
|
4895
5137
|
item
|
|
4896
5138
|
}) => {
|
|
4897
|
-
return /* @__PURE__ */
|
|
5139
|
+
return /* @__PURE__ */ jsx33("div", { className: "grow rounded-md bg-zinc-100", children: /* @__PURE__ */ jsx33(ListEditForm, { item, type, dataKey }, item.key) });
|
|
4898
5140
|
};
|
|
4899
5141
|
var ListEditForm = ({
|
|
4900
5142
|
type,
|
|
@@ -4920,7 +5162,7 @@ var ListEditForm = ({
|
|
|
4920
5162
|
}
|
|
4921
5163
|
});
|
|
4922
5164
|
const { mutateAsync: editItem, isPending } = useEditListItem();
|
|
4923
|
-
const { setSelectedListItem } =
|
|
5165
|
+
const { setSelectedListItem } = useTab();
|
|
4924
5166
|
const [keyLabel, valueLabel] = headerLabels[type];
|
|
4925
5167
|
const onSubmit = form.handleSubmit(async ({ key, value }) => {
|
|
4926
5168
|
await editItem({
|
|
@@ -4933,9 +5175,9 @@ var ListEditForm = ({
|
|
|
4933
5175
|
});
|
|
4934
5176
|
setSelectedListItem(void 0);
|
|
4935
5177
|
});
|
|
4936
|
-
return /* @__PURE__ */
|
|
5178
|
+
return /* @__PURE__ */ jsx33(FormProvider, { ...form, children: /* @__PURE__ */ jsxs20("form", { onSubmit, className: "flex flex-col gap-2", children: [
|
|
4937
5179
|
/* @__PURE__ */ jsxs20("div", { className: "flex grow flex-col gap-2", children: [
|
|
4938
|
-
type !== "list" && /* @__PURE__ */
|
|
5180
|
+
type !== "list" && /* @__PURE__ */ jsx33(
|
|
4939
5181
|
FormItem,
|
|
4940
5182
|
{
|
|
4941
5183
|
readOnly: type === "stream",
|
|
@@ -4945,7 +5187,7 @@ var ListEditForm = ({
|
|
|
4945
5187
|
data: itemKey
|
|
4946
5188
|
}
|
|
4947
5189
|
),
|
|
4948
|
-
type === "zset" ? /* @__PURE__ */
|
|
5190
|
+
type === "zset" ? /* @__PURE__ */ jsx33(NumberFormItem, { name: "value", label: valueLabel }) : type !== "set" && /* @__PURE__ */ jsx33(
|
|
4949
5191
|
FormItem,
|
|
4950
5192
|
{
|
|
4951
5193
|
readOnly: type === "stream",
|
|
@@ -4964,9 +5206,9 @@ var ListEditForm = ({
|
|
|
4964
5206
|
type === "hash" && itemKey !== "" ? "justify-between" : "justify-end"
|
|
4965
5207
|
),
|
|
4966
5208
|
children: [
|
|
4967
|
-
type === "hash" && itemKey !== "" && /* @__PURE__ */
|
|
5209
|
+
type === "hash" && itemKey !== "" && /* @__PURE__ */ jsx33(HashFieldTTLBadge, { dataKey, field: itemKey }),
|
|
4968
5210
|
/* @__PURE__ */ jsxs20("div", { className: "flex gap-2", children: [
|
|
4969
|
-
/* @__PURE__ */
|
|
5211
|
+
/* @__PURE__ */ jsx33(
|
|
4970
5212
|
Button,
|
|
4971
5213
|
{
|
|
4972
5214
|
type: "button",
|
|
@@ -4976,17 +5218,17 @@ var ListEditForm = ({
|
|
|
4976
5218
|
children: "Cancel"
|
|
4977
5219
|
}
|
|
4978
5220
|
),
|
|
4979
|
-
/* @__PURE__ */
|
|
5221
|
+
/* @__PURE__ */ jsx33(
|
|
4980
5222
|
SimpleTooltip,
|
|
4981
5223
|
{
|
|
4982
5224
|
content: type === "stream" && !isNew ? "Streams are not mutable" : void 0,
|
|
4983
|
-
children: /* @__PURE__ */
|
|
5225
|
+
children: /* @__PURE__ */ jsx33(
|
|
4984
5226
|
Button,
|
|
4985
5227
|
{
|
|
4986
5228
|
variant: "primary",
|
|
4987
5229
|
type: "submit",
|
|
4988
5230
|
disabled: !form.formState.isValid || !form.formState.isDirty || type === "stream" && !isNew,
|
|
4989
|
-
children: /* @__PURE__ */
|
|
5231
|
+
children: /* @__PURE__ */ jsx33(Spinner, { isLoading: isPending, isLoadingText: "Saving", children: "Save" })
|
|
4990
5232
|
}
|
|
4991
5233
|
)
|
|
4992
5234
|
}
|
|
@@ -4999,12 +5241,12 @@ var ListEditForm = ({
|
|
|
4999
5241
|
};
|
|
5000
5242
|
var NumberFormItem = ({ name, label }) => {
|
|
5001
5243
|
return /* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-1", children: [
|
|
5002
|
-
/* @__PURE__ */
|
|
5003
|
-
/* @__PURE__ */
|
|
5244
|
+
/* @__PURE__ */ jsx33("div", { className: "flex", children: /* @__PURE__ */ jsx33("span", { className: "text-xs font-medium text-zinc-700", children: label }) }),
|
|
5245
|
+
/* @__PURE__ */ jsx33(
|
|
5004
5246
|
Controller2,
|
|
5005
5247
|
{
|
|
5006
5248
|
name,
|
|
5007
|
-
render: ({ field }) => /* @__PURE__ */
|
|
5249
|
+
render: ({ field }) => /* @__PURE__ */ jsx33(
|
|
5008
5250
|
"input",
|
|
5009
5251
|
{
|
|
5010
5252
|
className: "plain-input rounded-md border border-zinc-300 px-3 py-1 shadow-sm",
|
|
@@ -5034,18 +5276,18 @@ var FormItem = ({
|
|
|
5034
5276
|
});
|
|
5035
5277
|
return /* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-1", children: [
|
|
5036
5278
|
/* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-1 text-xs", children: [
|
|
5037
|
-
/* @__PURE__ */
|
|
5279
|
+
/* @__PURE__ */ jsx33("span", { className: "font-medium text-zinc-700", children: label }),
|
|
5038
5280
|
" ",
|
|
5039
|
-
/* @__PURE__ */
|
|
5281
|
+
/* @__PURE__ */ jsx33("span", { className: "text-zinc-300", children: "/" }),
|
|
5040
5282
|
selector
|
|
5041
5283
|
] }),
|
|
5042
|
-
/* @__PURE__ */
|
|
5284
|
+
/* @__PURE__ */ jsx33("div", { className: "overflow-hidden rounded-md border border-zinc-300 bg-white p-2 shadow-sm", children: editor })
|
|
5043
5285
|
] });
|
|
5044
5286
|
};
|
|
5045
5287
|
|
|
5046
5288
|
// src/components/databrowser/components/display/hash/hash-field-ttl-info.tsx
|
|
5047
|
-
import { useEffect as useEffect9, useState as
|
|
5048
|
-
import { jsx as
|
|
5289
|
+
import { useEffect as useEffect9, useState as useState8 } from "react";
|
|
5290
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
5049
5291
|
var HashFieldTTLInfo = ({
|
|
5050
5292
|
dataKey,
|
|
5051
5293
|
field,
|
|
@@ -5053,7 +5295,7 @@ var HashFieldTTLInfo = ({
|
|
|
5053
5295
|
}) => {
|
|
5054
5296
|
const { data } = useFetchHashFieldExpires({ dataKey, fields });
|
|
5055
5297
|
const expireAt = data?.[field];
|
|
5056
|
-
const [ttl, setTTL] =
|
|
5298
|
+
const [ttl, setTTL] = useState8(() => calculateTTL(expireAt));
|
|
5057
5299
|
useEffect9(() => {
|
|
5058
5300
|
setTTL(calculateTTL(expireAt));
|
|
5059
5301
|
const interval = setInterval(() => {
|
|
@@ -5062,11 +5304,11 @@ var HashFieldTTLInfo = ({
|
|
|
5062
5304
|
return () => clearInterval(interval);
|
|
5063
5305
|
}, [expireAt]);
|
|
5064
5306
|
if (!expireAt || expireAt === TTL_NOT_FOUND || expireAt === TTL_INFINITE) return;
|
|
5065
|
-
return /* @__PURE__ */
|
|
5307
|
+
return /* @__PURE__ */ jsx34("span", { className: "block min-w-[30px] whitespace-nowrap text-right text-red-600", children: formatTime(ttl ?? 0) });
|
|
5066
5308
|
};
|
|
5067
5309
|
|
|
5068
5310
|
// src/components/databrowser/components/display/display-list.tsx
|
|
5069
|
-
import { Fragment as Fragment5, jsx as
|
|
5311
|
+
import { Fragment as Fragment5, jsx as jsx35, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
5070
5312
|
var headerLabels = {
|
|
5071
5313
|
list: ["Index", "Content"],
|
|
5072
5314
|
hash: ["Field", "Value"],
|
|
@@ -5075,12 +5317,12 @@ var headerLabels = {
|
|
|
5075
5317
|
set: ["Value", ""]
|
|
5076
5318
|
};
|
|
5077
5319
|
var ListDisplay = ({ dataKey, type }) => {
|
|
5078
|
-
const { selectedListItem } =
|
|
5320
|
+
const { selectedListItem } = useTab();
|
|
5079
5321
|
const query = useFetchListItems({ dataKey, type });
|
|
5080
5322
|
return /* @__PURE__ */ jsxs21("div", { className: "flex h-full flex-col gap-2", children: [
|
|
5081
|
-
/* @__PURE__ */
|
|
5082
|
-
selectedListItem && /* @__PURE__ */
|
|
5083
|
-
/* @__PURE__ */
|
|
5323
|
+
/* @__PURE__ */ jsx35(DisplayHeader, { dataKey, type }),
|
|
5324
|
+
selectedListItem && /* @__PURE__ */ jsx35(ListEditDisplay, { dataKey, type, item: selectedListItem }),
|
|
5325
|
+
/* @__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 }) }) }) }) }) })
|
|
5084
5326
|
] });
|
|
5085
5327
|
};
|
|
5086
5328
|
var ListItems = ({
|
|
@@ -5088,11 +5330,11 @@ var ListItems = ({
|
|
|
5088
5330
|
type,
|
|
5089
5331
|
dataKey
|
|
5090
5332
|
}) => {
|
|
5091
|
-
const { setSelectedListItem } =
|
|
5092
|
-
const keys =
|
|
5093
|
-
const fields =
|
|
5333
|
+
const { setSelectedListItem } = useTab();
|
|
5334
|
+
const keys = useMemo7(() => query.data?.pages.flatMap((page) => page.keys) ?? [], [query.data]);
|
|
5335
|
+
const fields = useMemo7(() => keys.map((key) => key.key), [keys]);
|
|
5094
5336
|
const { mutate: editItem } = useEditListItem();
|
|
5095
|
-
return /* @__PURE__ */
|
|
5337
|
+
return /* @__PURE__ */ jsx35(Fragment5, { children: keys.map(({ key, value }, i) => /* @__PURE__ */ jsxs21(
|
|
5096
5338
|
"tr",
|
|
5097
5339
|
{
|
|
5098
5340
|
"data-item-key": key,
|
|
@@ -5100,9 +5342,9 @@ var ListItems = ({
|
|
|
5100
5342
|
onClick: () => {
|
|
5101
5343
|
setSelectedListItem({ key });
|
|
5102
5344
|
},
|
|
5103
|
-
className: cn("h-10 border-b border-b-zinc-100 hover:bg-zinc-100
|
|
5345
|
+
className: cn("h-10 border-b border-b-zinc-100 transition-colors hover:bg-zinc-100"),
|
|
5104
5346
|
children: [
|
|
5105
|
-
/* @__PURE__ */
|
|
5347
|
+
/* @__PURE__ */ jsx35(
|
|
5106
5348
|
"td",
|
|
5107
5349
|
{
|
|
5108
5350
|
className: cn(
|
|
@@ -5112,14 +5354,14 @@ var ListItems = ({
|
|
|
5112
5354
|
children: key
|
|
5113
5355
|
}
|
|
5114
5356
|
),
|
|
5115
|
-
value !== void 0 && /* @__PURE__ */
|
|
5357
|
+
value !== void 0 && /* @__PURE__ */ jsx35(
|
|
5116
5358
|
"td",
|
|
5117
5359
|
{
|
|
5118
5360
|
className: cn("cursor-pointer truncate px-3", type === "zset" ? "w-24" : "max-w-0"),
|
|
5119
5361
|
children: value
|
|
5120
5362
|
}
|
|
5121
5363
|
),
|
|
5122
|
-
type !== "stream" && /* @__PURE__ */
|
|
5364
|
+
type !== "stream" && /* @__PURE__ */ jsx35(
|
|
5123
5365
|
"td",
|
|
5124
5366
|
{
|
|
5125
5367
|
className: "w-0 min-w-0 p-0",
|
|
@@ -5127,8 +5369,8 @@ var ListItems = ({
|
|
|
5127
5369
|
e.stopPropagation();
|
|
5128
5370
|
},
|
|
5129
5371
|
children: /* @__PURE__ */ jsxs21("div", { className: "flex items-center justify-end gap-2", children: [
|
|
5130
|
-
type === "hash" && /* @__PURE__ */
|
|
5131
|
-
/* @__PURE__ */
|
|
5372
|
+
type === "hash" && /* @__PURE__ */ jsx35(HashFieldTTLInfo, { dataKey, field: key, fields }),
|
|
5373
|
+
/* @__PURE__ */ jsx35(
|
|
5132
5374
|
DeleteAlertDialog,
|
|
5133
5375
|
{
|
|
5134
5376
|
deletionType: "item",
|
|
@@ -5142,14 +5384,14 @@ var ListItems = ({
|
|
|
5142
5384
|
newKey: void 0
|
|
5143
5385
|
});
|
|
5144
5386
|
},
|
|
5145
|
-
children: /* @__PURE__ */
|
|
5387
|
+
children: /* @__PURE__ */ jsx35(
|
|
5146
5388
|
Button,
|
|
5147
5389
|
{
|
|
5148
5390
|
className: "",
|
|
5149
5391
|
size: "icon-sm",
|
|
5150
5392
|
variant: "secondary",
|
|
5151
5393
|
onClick: (e) => e.stopPropagation(),
|
|
5152
|
-
children: /* @__PURE__ */
|
|
5394
|
+
children: /* @__PURE__ */ jsx35(IconTrash, { className: "size-4 text-zinc-500" })
|
|
5153
5395
|
}
|
|
5154
5396
|
)
|
|
5155
5397
|
}
|
|
@@ -5166,18 +5408,12 @@ var ListItems = ({
|
|
|
5166
5408
|
// src/components/databrowser/components/display/display-simple.tsx
|
|
5167
5409
|
import { useEffect as useEffect10 } from "react";
|
|
5168
5410
|
import { useForm as useForm3 } from "react-hook-form";
|
|
5169
|
-
import { Fragment as Fragment6, jsx as
|
|
5411
|
+
import { Fragment as Fragment6, jsx as jsx36, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
5170
5412
|
var EditorDisplay = ({ dataKey, type }) => {
|
|
5171
5413
|
const { data } = useFetchSimpleKey(dataKey, type);
|
|
5172
5414
|
return /* @__PURE__ */ jsxs22("div", { className: "flex h-full w-full flex-col gap-2", children: [
|
|
5173
|
-
/* @__PURE__ */
|
|
5174
|
-
/* @__PURE__ */
|
|
5175
|
-
"div",
|
|
5176
|
-
{
|
|
5177
|
-
className: "flex h-full grow flex-col gap-2\n rounded-md bg-zinc-100 p-3",
|
|
5178
|
-
children: data === void 0 ? /* @__PURE__ */ jsx34(Spinner, { isLoadingText: "", isLoading: true }) : data === null ? /* @__PURE__ */ jsx34(Fragment6, {}) : /* @__PURE__ */ jsx34(EditorDisplayForm, { dataKey, type, data }, dataKey)
|
|
5179
|
-
}
|
|
5180
|
-
)
|
|
5415
|
+
/* @__PURE__ */ jsx36(DisplayHeader, { dataKey, type, content: data ?? void 0 }),
|
|
5416
|
+
/* @__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) })
|
|
5181
5417
|
] });
|
|
5182
5418
|
};
|
|
5183
5419
|
var EditorDisplayForm = ({
|
|
@@ -5198,12 +5434,12 @@ var EditorDisplayForm = ({
|
|
|
5198
5434
|
};
|
|
5199
5435
|
return /* @__PURE__ */ jsxs22(Fragment6, { children: [
|
|
5200
5436
|
/* @__PURE__ */ jsxs22("div", { className: "flex grow flex-col gap-1", children: [
|
|
5201
|
-
/* @__PURE__ */
|
|
5202
|
-
/* @__PURE__ */
|
|
5437
|
+
/* @__PURE__ */ jsx36("div", { className: "flex shrink-0 items-center gap-2", children: type === "json" ? /* @__PURE__ */ jsx36("div", {}) : selector }),
|
|
5438
|
+
/* @__PURE__ */ jsx36("div", { className: "grow rounded-md border border-zinc-300 bg-white p-1", children: editor })
|
|
5203
5439
|
] }),
|
|
5204
|
-
/* @__PURE__ */
|
|
5205
|
-
form.formState.isDirty && /* @__PURE__ */
|
|
5206
|
-
/* @__PURE__ */
|
|
5440
|
+
/* @__PURE__ */ jsx36("div", { className: "flex shrink-0 items-center gap-2", children: /* @__PURE__ */ jsxs22("div", { className: "ml-auto flex gap-2", children: [
|
|
5441
|
+
form.formState.isDirty && /* @__PURE__ */ jsx36(Button, { onClick: handleCancel, children: "Cancel" }),
|
|
5442
|
+
/* @__PURE__ */ jsx36(
|
|
5207
5443
|
Button,
|
|
5208
5444
|
{
|
|
5209
5445
|
variant: "primary",
|
|
@@ -5211,7 +5447,7 @@ var EditorDisplayForm = ({
|
|
|
5211
5447
|
await setKey(value);
|
|
5212
5448
|
}),
|
|
5213
5449
|
disabled: !form.formState.isValid || !form.formState.isDirty,
|
|
5214
|
-
children: /* @__PURE__ */
|
|
5450
|
+
children: /* @__PURE__ */ jsx36(Spinner, { isLoading: isSettingKey, isLoadingText: "Saving", children: "Save" })
|
|
5215
5451
|
}
|
|
5216
5452
|
)
|
|
5217
5453
|
] }) })
|
|
@@ -5219,19 +5455,19 @@ var EditorDisplayForm = ({
|
|
|
5219
5455
|
};
|
|
5220
5456
|
|
|
5221
5457
|
// src/components/databrowser/components/display/index.tsx
|
|
5222
|
-
import { Fragment as Fragment7, jsx as
|
|
5458
|
+
import { Fragment as Fragment7, jsx as jsx37 } from "react/jsx-runtime";
|
|
5223
5459
|
var DataDisplay = () => {
|
|
5224
|
-
const { selectedKey } =
|
|
5460
|
+
const { selectedKey } = useTab();
|
|
5225
5461
|
const { query } = useKeys();
|
|
5226
5462
|
const type = useKeyType(selectedKey);
|
|
5227
|
-
return /* @__PURE__ */
|
|
5463
|
+
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 }) }) });
|
|
5228
5464
|
};
|
|
5229
5465
|
|
|
5230
5466
|
// src/components/databrowser/components/sidebar/index.tsx
|
|
5231
5467
|
import { IconRefresh } from "@tabler/icons-react";
|
|
5232
5468
|
|
|
5233
5469
|
// src/components/databrowser/components/add-key-modal.tsx
|
|
5234
|
-
import { useState as
|
|
5470
|
+
import { useState as useState9 } from "react";
|
|
5235
5471
|
import { DialogDescription as DialogDescription2 } from "@radix-ui/react-dialog";
|
|
5236
5472
|
import { PlusIcon } from "@radix-ui/react-icons";
|
|
5237
5473
|
import { Controller as Controller3, useForm as useForm4 } from "react-hook-form";
|
|
@@ -5239,12 +5475,12 @@ import { Controller as Controller3, useForm as useForm4 } from "react-hook-form"
|
|
|
5239
5475
|
// src/components/ui/dialog.tsx
|
|
5240
5476
|
import * as React12 from "react";
|
|
5241
5477
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
5242
|
-
import { jsx as
|
|
5478
|
+
import { jsx as jsx38, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
5243
5479
|
var Dialog = DialogPrimitive.Root;
|
|
5244
5480
|
var DialogTrigger = DialogPrimitive.Trigger;
|
|
5245
|
-
var DialogPortal = (props) => /* @__PURE__ */
|
|
5481
|
+
var DialogPortal = (props) => /* @__PURE__ */ jsx38(DialogPrimitive.Portal, { container: portalRoot, ...props });
|
|
5246
5482
|
DialogPortal.displayName = DialogPrimitive.Portal.displayName;
|
|
5247
|
-
var DialogOverlay = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
5483
|
+
var DialogOverlay = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx38(
|
|
5248
5484
|
DialogPrimitive.Overlay,
|
|
5249
5485
|
{
|
|
5250
5486
|
ref,
|
|
@@ -5259,7 +5495,7 @@ var DialogOverlay = React12.forwardRef(({ className, ...props }, ref) => /* @__P
|
|
|
5259
5495
|
));
|
|
5260
5496
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
5261
5497
|
var DialogContent = React12.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs23(DialogPortal, { children: [
|
|
5262
|
-
/* @__PURE__ */
|
|
5498
|
+
/* @__PURE__ */ jsx38(DialogOverlay, {}),
|
|
5263
5499
|
/* @__PURE__ */ jsxs23(
|
|
5264
5500
|
DialogPrimitive.Content,
|
|
5265
5501
|
{
|
|
@@ -5281,7 +5517,7 @@ var DialogContent = React12.forwardRef(({ className, children, ...props }, ref)
|
|
|
5281
5517
|
children: [
|
|
5282
5518
|
children,
|
|
5283
5519
|
/* @__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: [
|
|
5284
|
-
/* @__PURE__ */
|
|
5520
|
+
/* @__PURE__ */ jsx38(
|
|
5285
5521
|
"svg",
|
|
5286
5522
|
{
|
|
5287
5523
|
width: "15",
|
|
@@ -5290,7 +5526,7 @@ var DialogContent = React12.forwardRef(({ className, children, ...props }, ref)
|
|
|
5290
5526
|
fill: "none",
|
|
5291
5527
|
xmlns: "http://www.w3.org/2000/svg",
|
|
5292
5528
|
className: "h-4 w-4",
|
|
5293
|
-
children: /* @__PURE__ */
|
|
5529
|
+
children: /* @__PURE__ */ jsx38(
|
|
5294
5530
|
"path",
|
|
5295
5531
|
{
|
|
5296
5532
|
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",
|
|
@@ -5301,16 +5537,16 @@ var DialogContent = React12.forwardRef(({ className, children, ...props }, ref)
|
|
|
5301
5537
|
)
|
|
5302
5538
|
}
|
|
5303
5539
|
),
|
|
5304
|
-
/* @__PURE__ */
|
|
5540
|
+
/* @__PURE__ */ jsx38("span", { className: "sr-only", children: "Close" })
|
|
5305
5541
|
] })
|
|
5306
5542
|
]
|
|
5307
5543
|
}
|
|
5308
5544
|
)
|
|
5309
5545
|
] }));
|
|
5310
5546
|
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
5311
|
-
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */
|
|
5547
|
+
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsx38("div", { className: cn("flex flex-col space-y-1.5 text-center sm:text-left", className), ...props });
|
|
5312
5548
|
DialogHeader.displayName = "DialogHeader";
|
|
5313
|
-
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */
|
|
5549
|
+
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx38(
|
|
5314
5550
|
"div",
|
|
5315
5551
|
{
|
|
5316
5552
|
className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className),
|
|
@@ -5318,7 +5554,7 @@ var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx36(
|
|
|
5318
5554
|
}
|
|
5319
5555
|
);
|
|
5320
5556
|
DialogFooter.displayName = "DialogFooter";
|
|
5321
|
-
var DialogTitle = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
5557
|
+
var DialogTitle = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx38(
|
|
5322
5558
|
DialogPrimitive.Title,
|
|
5323
5559
|
{
|
|
5324
5560
|
ref,
|
|
@@ -5327,7 +5563,7 @@ var DialogTitle = React12.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
5327
5563
|
}
|
|
5328
5564
|
));
|
|
5329
5565
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
5330
|
-
var DialogDescription = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
5566
|
+
var DialogDescription = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx38(
|
|
5331
5567
|
DialogPrimitive.Description,
|
|
5332
5568
|
{
|
|
5333
5569
|
ref,
|
|
@@ -5338,10 +5574,10 @@ var DialogDescription = React12.forwardRef(({ className, ...props }, ref) => /*
|
|
|
5338
5574
|
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
5339
5575
|
|
|
5340
5576
|
// src/components/databrowser/components/add-key-modal.tsx
|
|
5341
|
-
import { jsx as
|
|
5577
|
+
import { jsx as jsx39, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
5342
5578
|
function AddKeyModal() {
|
|
5343
|
-
const { setSelectedKey } =
|
|
5344
|
-
const [open, setOpen] =
|
|
5579
|
+
const { setSelectedKey } = useTab();
|
|
5580
|
+
const [open, setOpen] = useState9(false);
|
|
5345
5581
|
const { mutateAsync: addKey, isPending } = useAddKey();
|
|
5346
5582
|
const { control, handleSubmit, formState, reset } = useForm4({
|
|
5347
5583
|
defaultValues: {
|
|
@@ -5370,24 +5606,24 @@ function AddKeyModal() {
|
|
|
5370
5606
|
setOpen(open2);
|
|
5371
5607
|
},
|
|
5372
5608
|
children: [
|
|
5373
|
-
/* @__PURE__ */
|
|
5609
|
+
/* @__PURE__ */ jsx39(DialogTrigger, { asChild: true, children: /* @__PURE__ */ jsx39(Button, { variant: "primary", size: "icon-sm", "aria-label": "Add key", children: /* @__PURE__ */ jsx39(PlusIcon, { className: "size-4" }) }) }),
|
|
5374
5610
|
/* @__PURE__ */ jsxs24(DialogContent, { className: "max-w-[400px]", children: [
|
|
5375
|
-
/* @__PURE__ */
|
|
5376
|
-
/* @__PURE__ */
|
|
5611
|
+
/* @__PURE__ */ jsx39(DialogHeader, { children: /* @__PURE__ */ jsx39(DialogTitle, { children: "Create new key" }) }),
|
|
5612
|
+
/* @__PURE__ */ jsx39("div", { className: "sr-only", children: /* @__PURE__ */ jsx39(DialogDescription2, { children: "Create new key" }) }),
|
|
5377
5613
|
/* @__PURE__ */ jsxs24("form", { className: "mt-4", onSubmit, children: [
|
|
5378
5614
|
/* @__PURE__ */ jsxs24("div", { className: "flex gap-1", children: [
|
|
5379
|
-
/* @__PURE__ */
|
|
5615
|
+
/* @__PURE__ */ jsx39(
|
|
5380
5616
|
Controller3,
|
|
5381
5617
|
{
|
|
5382
5618
|
control,
|
|
5383
5619
|
name: "type",
|
|
5384
5620
|
render: ({ field }) => /* @__PURE__ */ jsxs24(Select, { value: field.value, onValueChange: field.onChange, children: [
|
|
5385
|
-
/* @__PURE__ */
|
|
5386
|
-
/* @__PURE__ */
|
|
5621
|
+
/* @__PURE__ */ jsx39(SelectTrigger, { className: "h-8 w-auto pl-[3px] pr-8", children: /* @__PURE__ */ jsx39(SelectValue, {}) }),
|
|
5622
|
+
/* @__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)) }) })
|
|
5387
5623
|
] })
|
|
5388
5624
|
}
|
|
5389
5625
|
),
|
|
5390
|
-
/* @__PURE__ */
|
|
5626
|
+
/* @__PURE__ */ jsx39(
|
|
5391
5627
|
Controller3,
|
|
5392
5628
|
{
|
|
5393
5629
|
rules: {
|
|
@@ -5395,14 +5631,14 @@ function AddKeyModal() {
|
|
|
5395
5631
|
},
|
|
5396
5632
|
control,
|
|
5397
5633
|
name: "key",
|
|
5398
|
-
render: ({ field }) => /* @__PURE__ */
|
|
5634
|
+
render: ({ field }) => /* @__PURE__ */ jsx39(Input, { placeholder: "mykey", ...field, className: "h-8 grow" })
|
|
5399
5635
|
}
|
|
5400
5636
|
)
|
|
5401
5637
|
] }),
|
|
5402
|
-
formState.errors.key && /* @__PURE__ */
|
|
5403
|
-
/* @__PURE__ */
|
|
5638
|
+
formState.errors.key && /* @__PURE__ */ jsx39("p", { className: "mb-3 mt-2 text-xs text-red-500", children: formState.errors.key?.message }),
|
|
5639
|
+
/* @__PURE__ */ jsx39("p", { className: "mt-2 text-xs text-zinc-500", children: "After creating the key, you can edit the value" }),
|
|
5404
5640
|
/* @__PURE__ */ jsxs24("div", { className: "mt-6 flex justify-end gap-2", children: [
|
|
5405
|
-
/* @__PURE__ */
|
|
5641
|
+
/* @__PURE__ */ jsx39(
|
|
5406
5642
|
Button,
|
|
5407
5643
|
{
|
|
5408
5644
|
type: "button",
|
|
@@ -5413,7 +5649,7 @@ function AddKeyModal() {
|
|
|
5413
5649
|
children: "Cancel"
|
|
5414
5650
|
}
|
|
5415
5651
|
),
|
|
5416
|
-
/* @__PURE__ */
|
|
5652
|
+
/* @__PURE__ */ jsx39(Button, { variant: "primary", type: "submit", children: /* @__PURE__ */ jsx39(Spinner, { isLoading: isPending, isLoadingText: "Creating", children: "Create" }) })
|
|
5417
5653
|
] })
|
|
5418
5654
|
] })
|
|
5419
5655
|
] })
|
|
@@ -5423,24 +5659,24 @@ function AddKeyModal() {
|
|
|
5423
5659
|
}
|
|
5424
5660
|
|
|
5425
5661
|
// src/components/databrowser/components/sidebar/empty.tsx
|
|
5426
|
-
import { jsx as
|
|
5662
|
+
import { jsx as jsx40, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
5427
5663
|
var Empty = () => {
|
|
5428
|
-
return /* @__PURE__ */
|
|
5429
|
-
/* @__PURE__ */
|
|
5430
|
-
/* @__PURE__ */
|
|
5664
|
+
return /* @__PURE__ */ jsx40("div", { className: "flex h-full w-full items-center justify-center rounded-md border bg-white px-4 py-6 text-center", children: /* @__PURE__ */ jsxs25("div", { className: "space-y-5", children: [
|
|
5665
|
+
/* @__PURE__ */ jsx40("p", { className: "text-md font-medium", children: "Data on a break" }),
|
|
5666
|
+
/* @__PURE__ */ jsx40("p", { className: "text-balance text-center", children: '"Quick, lure it back with some CLI magic!"' })
|
|
5431
5667
|
] }) });
|
|
5432
5668
|
};
|
|
5433
5669
|
|
|
5434
5670
|
// src/components/databrowser/components/sidebar-context-menu.tsx
|
|
5435
|
-
import { useState as
|
|
5671
|
+
import { useState as useState10 } from "react";
|
|
5436
5672
|
import { ContextMenuSeparator as ContextMenuSeparator3 } from "@radix-ui/react-context-menu";
|
|
5437
|
-
import { Fragment as Fragment8, jsx as
|
|
5673
|
+
import { Fragment as Fragment8, jsx as jsx41, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
5438
5674
|
var SidebarContextMenu = ({ children }) => {
|
|
5439
5675
|
const { mutate: deleteKey } = useDeleteKey();
|
|
5440
|
-
const [isAlertOpen, setAlertOpen] =
|
|
5441
|
-
const [dataKey, setDataKey] =
|
|
5676
|
+
const [isAlertOpen, setAlertOpen] = useState10(false);
|
|
5677
|
+
const [dataKey, setDataKey] = useState10("");
|
|
5442
5678
|
return /* @__PURE__ */ jsxs26(Fragment8, { children: [
|
|
5443
|
-
/* @__PURE__ */
|
|
5679
|
+
/* @__PURE__ */ jsx41(
|
|
5444
5680
|
DeleteAlertDialog,
|
|
5445
5681
|
{
|
|
5446
5682
|
deletionType: "key",
|
|
@@ -5454,7 +5690,7 @@ var SidebarContextMenu = ({ children }) => {
|
|
|
5454
5690
|
}
|
|
5455
5691
|
),
|
|
5456
5692
|
/* @__PURE__ */ jsxs26(ContextMenu, { children: [
|
|
5457
|
-
/* @__PURE__ */
|
|
5693
|
+
/* @__PURE__ */ jsx41(
|
|
5458
5694
|
ContextMenuTrigger,
|
|
5459
5695
|
{
|
|
5460
5696
|
onContextMenu: (e) => {
|
|
@@ -5470,7 +5706,7 @@ var SidebarContextMenu = ({ children }) => {
|
|
|
5470
5706
|
}
|
|
5471
5707
|
),
|
|
5472
5708
|
/* @__PURE__ */ jsxs26(ContextMenuContent, { children: [
|
|
5473
|
-
/* @__PURE__ */
|
|
5709
|
+
/* @__PURE__ */ jsx41(
|
|
5474
5710
|
ContextMenuItem,
|
|
5475
5711
|
{
|
|
5476
5712
|
onClick: () => {
|
|
@@ -5482,18 +5718,18 @@ var SidebarContextMenu = ({ children }) => {
|
|
|
5482
5718
|
children: "Copy key"
|
|
5483
5719
|
}
|
|
5484
5720
|
),
|
|
5485
|
-
/* @__PURE__ */
|
|
5486
|
-
/* @__PURE__ */
|
|
5721
|
+
/* @__PURE__ */ jsx41(ContextMenuSeparator3, {}),
|
|
5722
|
+
/* @__PURE__ */ jsx41(ContextMenuItem, { onClick: () => setAlertOpen(true), children: "Delete key" })
|
|
5487
5723
|
] })
|
|
5488
5724
|
] })
|
|
5489
5725
|
] });
|
|
5490
5726
|
};
|
|
5491
5727
|
|
|
5492
5728
|
// src/components/databrowser/components/sidebar/keys-list.tsx
|
|
5493
|
-
import { Fragment as Fragment9, jsx as
|
|
5729
|
+
import { Fragment as Fragment9, jsx as jsx42, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
5494
5730
|
var KeysList = () => {
|
|
5495
5731
|
const { keys } = useKeys();
|
|
5496
|
-
return /* @__PURE__ */
|
|
5732
|
+
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])) }) });
|
|
5497
5733
|
};
|
|
5498
5734
|
var keyStyles = {
|
|
5499
5735
|
string: "border-sky-400 !bg-sky-50 text-sky-900",
|
|
@@ -5505,7 +5741,7 @@ var keyStyles = {
|
|
|
5505
5741
|
stream: "border-green-400 !bg-green-50 text-green-900"
|
|
5506
5742
|
};
|
|
5507
5743
|
var KeyItem = ({ data, nextKey }) => {
|
|
5508
|
-
const { selectedKey, setSelectedKey } =
|
|
5744
|
+
const { selectedKey, setSelectedKey } = useTab();
|
|
5509
5745
|
const [dataKey, dataType] = data;
|
|
5510
5746
|
const isKeySelected = selectedKey === dataKey;
|
|
5511
5747
|
const isNextKeySelected = selectedKey === nextKey;
|
|
@@ -5515,49 +5751,125 @@ var KeyItem = ({ data, nextKey }) => {
|
|
|
5515
5751
|
"data-key": dataKey,
|
|
5516
5752
|
variant: isKeySelected ? "default" : "ghost",
|
|
5517
5753
|
className: cn(
|
|
5518
|
-
"relative flex h-10 w-full items-center justify-start gap-2 px-3 py-0 ",
|
|
5754
|
+
"relative flex h-10 w-full items-center justify-start gap-2 px-3 py-0 !ring-0 focus-visible:bg-zinc-50",
|
|
5519
5755
|
"select-none border border-transparent text-left",
|
|
5520
5756
|
isKeySelected && "shadow-sm",
|
|
5521
5757
|
isKeySelected && keyStyles[dataType]
|
|
5522
5758
|
),
|
|
5523
5759
|
onClick: () => setSelectedKey(dataKey),
|
|
5524
5760
|
children: [
|
|
5525
|
-
/* @__PURE__ */
|
|
5526
|
-
/* @__PURE__ */
|
|
5527
|
-
!isKeySelected && !isNextKeySelected && /* @__PURE__ */
|
|
5761
|
+
/* @__PURE__ */ jsx42(TypeTag, { variant: dataType, type: "icon" }),
|
|
5762
|
+
/* @__PURE__ */ jsx42("p", { className: "truncate whitespace-nowrap", children: dataKey }),
|
|
5763
|
+
!isKeySelected && !isNextKeySelected && /* @__PURE__ */ jsx42("span", { className: "absolute -bottom-px left-3 right-3 h-px bg-zinc-100" })
|
|
5528
5764
|
]
|
|
5529
5765
|
}
|
|
5530
5766
|
);
|
|
5531
5767
|
};
|
|
5532
5768
|
|
|
5533
5769
|
// src/components/databrowser/components/sidebar/search-input.tsx
|
|
5534
|
-
import { useState as
|
|
5770
|
+
import { useEffect as useEffect11, useRef as useRef3, useState as useState11 } from "react";
|
|
5535
5771
|
import { IconX } from "@tabler/icons-react";
|
|
5536
|
-
import { jsx as
|
|
5772
|
+
import { jsx as jsx43, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
5773
|
+
var dedupeSearchHistory = (history) => {
|
|
5774
|
+
const seen = /* @__PURE__ */ new Set();
|
|
5775
|
+
return history.filter((item) => {
|
|
5776
|
+
if (!item || seen.has(item)) return false;
|
|
5777
|
+
seen.add(item);
|
|
5778
|
+
return true;
|
|
5779
|
+
});
|
|
5780
|
+
};
|
|
5537
5781
|
var SearchInput = () => {
|
|
5538
|
-
const { setSearchKey, search } =
|
|
5539
|
-
const
|
|
5540
|
-
const
|
|
5782
|
+
const { setSearchKey, search } = useTab();
|
|
5783
|
+
const { searchHistory, addSearchHistory } = useDatabrowserStore();
|
|
5784
|
+
const [state, setState] = useState11(search.key);
|
|
5785
|
+
const [isFocus, setIsFocus] = useState11(false);
|
|
5786
|
+
const [focusedIndex, setFocusedIndex] = useState11(-1);
|
|
5787
|
+
const inputRef = useRef3(null);
|
|
5788
|
+
const historyItemRefs = useRef3([]);
|
|
5789
|
+
const handleSubmit = (value) => {
|
|
5541
5790
|
if (value.trim() !== "" && !value.includes("*")) value = `${value}*`;
|
|
5791
|
+
addSearchHistory(value);
|
|
5542
5792
|
setSearchKey(value);
|
|
5543
5793
|
setState(value);
|
|
5544
5794
|
};
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
|
|
5557
|
-
|
|
5558
|
-
|
|
5795
|
+
const filteredHistory = dedupeSearchHistory(
|
|
5796
|
+
searchHistory.filter((item) => item.includes(state) && item !== state)
|
|
5797
|
+
).slice(0, 5).map((item) => item.endsWith("*") ? item.slice(0, -1) : item);
|
|
5798
|
+
useEffect11(() => {
|
|
5799
|
+
setFocusedIndex(-1);
|
|
5800
|
+
}, [filteredHistory.length]);
|
|
5801
|
+
const handleKeyDown = (e) => {
|
|
5802
|
+
if (e.key === "Enter") {
|
|
5803
|
+
const text = focusedIndex >= 0 && focusedIndex < filteredHistory.length ? filteredHistory[focusedIndex] : e.currentTarget.value;
|
|
5804
|
+
handleSubmit(text);
|
|
5805
|
+
} else if (e.key === "Escape") {
|
|
5806
|
+
setState("");
|
|
5807
|
+
setFocusedIndex(-1);
|
|
5808
|
+
inputRef.current?.blur();
|
|
5809
|
+
} else if (e.key === "ArrowDown" || e.key === "Tab" && !e.shiftKey) {
|
|
5810
|
+
e.preventDefault();
|
|
5811
|
+
if (focusedIndex < filteredHistory.length - 1) {
|
|
5812
|
+
setFocusedIndex(focusedIndex + 1);
|
|
5813
|
+
} else if (filteredHistory.length > 0) {
|
|
5814
|
+
setFocusedIndex(0);
|
|
5559
5815
|
}
|
|
5560
|
-
)
|
|
5816
|
+
} else if (e.key === "ArrowUp" || e.key === "Tab" && e.shiftKey) {
|
|
5817
|
+
e.preventDefault();
|
|
5818
|
+
if (focusedIndex > 0) {
|
|
5819
|
+
setFocusedIndex(focusedIndex - 1);
|
|
5820
|
+
} else if (filteredHistory.length > 0 && focusedIndex === 0) {
|
|
5821
|
+
setFocusedIndex(-1);
|
|
5822
|
+
inputRef.current?.focus();
|
|
5823
|
+
} else if (filteredHistory.length > 0) {
|
|
5824
|
+
setFocusedIndex(filteredHistory.length - 1);
|
|
5825
|
+
}
|
|
5826
|
+
}
|
|
5827
|
+
};
|
|
5828
|
+
return /* @__PURE__ */ jsxs28("div", { className: "relative grow", children: [
|
|
5829
|
+
/* @__PURE__ */ jsxs28(Popover, { open: isFocus && filteredHistory.length > 0, children: [
|
|
5830
|
+
/* @__PURE__ */ jsx43(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx43("div", { children: /* @__PURE__ */ jsx43(
|
|
5831
|
+
Input,
|
|
5832
|
+
{
|
|
5833
|
+
ref: inputRef,
|
|
5834
|
+
placeholder: "Search",
|
|
5835
|
+
className: "rounded-l-none border-zinc-300 font-normal",
|
|
5836
|
+
onKeyDown: handleKeyDown,
|
|
5837
|
+
onChange: (e) => {
|
|
5838
|
+
setState(e.currentTarget.value);
|
|
5839
|
+
if (e.currentTarget.value.trim() === "") handleSubmit("");
|
|
5840
|
+
},
|
|
5841
|
+
value: state,
|
|
5842
|
+
onFocus: () => {
|
|
5843
|
+
setIsFocus(true);
|
|
5844
|
+
setFocusedIndex(-1);
|
|
5845
|
+
},
|
|
5846
|
+
onBlur: () => setIsFocus(false)
|
|
5847
|
+
}
|
|
5848
|
+
) }) }),
|
|
5849
|
+
/* @__PURE__ */ jsx43(
|
|
5850
|
+
PopoverContent,
|
|
5851
|
+
{
|
|
5852
|
+
className: "w-[--radix-popover-trigger-width] divide-y px-3 py-2 text-[13px] text-zinc-900",
|
|
5853
|
+
autoFocus: false,
|
|
5854
|
+
onOpenAutoFocus: (e) => {
|
|
5855
|
+
e.preventDefault();
|
|
5856
|
+
e.stopPropagation();
|
|
5857
|
+
},
|
|
5858
|
+
children: filteredHistory.map((item, index) => /* @__PURE__ */ jsx43("div", { className: "w-full py-[3px]", children: /* @__PURE__ */ jsx43(
|
|
5859
|
+
"button",
|
|
5860
|
+
{
|
|
5861
|
+
ref: (el) => {
|
|
5862
|
+
historyItemRefs.current[index] = el;
|
|
5863
|
+
},
|
|
5864
|
+
onClick: () => handleSubmit(item),
|
|
5865
|
+
onMouseEnter: () => setFocusedIndex(index),
|
|
5866
|
+
className: `block w-full truncate rounded-sm p-1 text-left transition-colors ${focusedIndex === index ? "bg-zinc-100" : "hover:bg-zinc-100"}`,
|
|
5867
|
+
children: item
|
|
5868
|
+
}
|
|
5869
|
+
) }, item))
|
|
5870
|
+
}
|
|
5871
|
+
)
|
|
5872
|
+
] }),
|
|
5561
5873
|
state && /* @__PURE__ */ jsxs28(
|
|
5562
5874
|
Button,
|
|
5563
5875
|
{
|
|
@@ -5570,27 +5882,28 @@ var SearchInput = () => {
|
|
|
5570
5882
|
setState("");
|
|
5571
5883
|
},
|
|
5572
5884
|
children: [
|
|
5573
|
-
/* @__PURE__ */
|
|
5574
|
-
/* @__PURE__ */
|
|
5885
|
+
/* @__PURE__ */ jsx43(IconX, { size: 16 }),
|
|
5886
|
+
/* @__PURE__ */ jsx43("span", { className: "sr-only", children: "Clear" })
|
|
5575
5887
|
]
|
|
5576
5888
|
}
|
|
5577
|
-
)
|
|
5889
|
+
),
|
|
5890
|
+
" "
|
|
5578
5891
|
] });
|
|
5579
5892
|
};
|
|
5580
5893
|
|
|
5581
5894
|
// src/components/databrowser/components/sidebar/skeleton-buttons.tsx
|
|
5582
|
-
import { jsx as
|
|
5895
|
+
import { jsx as jsx44, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
5583
5896
|
var DEFAULT_SKELETON_COUNT = 6;
|
|
5584
|
-
var LoadingSkeleton = () => /* @__PURE__ */
|
|
5585
|
-
/* @__PURE__ */
|
|
5586
|
-
/* @__PURE__ */
|
|
5897
|
+
var LoadingSkeleton = () => /* @__PURE__ */ jsx44("div", { className: "block h-full w-full rounded-lg border border-zinc-200 bg-white p-1 pr-3 transition-all", 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: [
|
|
5898
|
+
/* @__PURE__ */ jsx44(Skeleton, { className: "size-5 shrink-0 rounded" }),
|
|
5899
|
+
/* @__PURE__ */ jsx44(Skeleton, { className: "h-4 grow rounded" })
|
|
5587
5900
|
] }, idx)) });
|
|
5588
5901
|
|
|
5589
5902
|
// src/components/databrowser/components/sidebar/type-selector.tsx
|
|
5590
|
-
import { jsx as
|
|
5903
|
+
import { jsx as jsx45, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
5591
5904
|
var ALL_TYPES_KEY = "all";
|
|
5592
5905
|
function DataTypeSelector() {
|
|
5593
|
-
const { search, setSearchType } =
|
|
5906
|
+
const { search, setSearchType } = useTab();
|
|
5594
5907
|
return /* @__PURE__ */ jsxs30(
|
|
5595
5908
|
Select,
|
|
5596
5909
|
{
|
|
@@ -5603,9 +5916,9 @@ function DataTypeSelector() {
|
|
|
5603
5916
|
},
|
|
5604
5917
|
value: search.type === void 0 ? ALL_TYPES_KEY : search.type,
|
|
5605
5918
|
children: [
|
|
5606
|
-
/* @__PURE__ */
|
|
5607
|
-
/* @__PURE__ */
|
|
5608
|
-
([key, value]) => /* @__PURE__ */
|
|
5919
|
+
/* @__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, {}) }),
|
|
5920
|
+
/* @__PURE__ */ jsx45(SelectContent, { children: /* @__PURE__ */ jsx45(SelectGroup, { children: [[ALL_TYPES_KEY, "All Types"], ...Object.entries(DATA_TYPE_NAMES)].map(
|
|
5921
|
+
([key, value]) => /* @__PURE__ */ jsx45(SelectItem, { value: key, children: value }, key)
|
|
5609
5922
|
) }) })
|
|
5610
5923
|
]
|
|
5611
5924
|
}
|
|
@@ -5613,17 +5926,18 @@ function DataTypeSelector() {
|
|
|
5613
5926
|
}
|
|
5614
5927
|
|
|
5615
5928
|
// src/components/databrowser/components/sidebar/index.tsx
|
|
5616
|
-
import { jsx as
|
|
5929
|
+
import { jsx as jsx46, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
5617
5930
|
function Sidebar() {
|
|
5618
5931
|
const { keys, query } = useKeys();
|
|
5619
|
-
return /* @__PURE__ */ jsxs31("div", { className: "flex h-full flex-col gap-2
|
|
5620
|
-
/* @__PURE__ */ jsxs31("div", { className: "rounded-lg bg-zinc-100
|
|
5932
|
+
return /* @__PURE__ */ jsxs31("div", { className: "flex h-full flex-col gap-2 p-4", children: [
|
|
5933
|
+
/* @__PURE__ */ jsxs31("div", { className: "rounded-lg bg-zinc-100", children: [
|
|
5621
5934
|
/* @__PURE__ */ jsxs31("div", { className: "flex h-10 items-center justify-between pl-1", children: [
|
|
5622
|
-
/* @__PURE__ */
|
|
5935
|
+
/* @__PURE__ */ jsx46(DisplayDbSize, {}),
|
|
5623
5936
|
/* @__PURE__ */ jsxs31("div", { className: "flex gap-1", children: [
|
|
5624
|
-
/* @__PURE__ */
|
|
5937
|
+
/* @__PURE__ */ jsx46(
|
|
5625
5938
|
Button,
|
|
5626
5939
|
{
|
|
5940
|
+
"aria-label": "Refresh",
|
|
5627
5941
|
className: "h-7 w-7 px-0",
|
|
5628
5942
|
onClick: () => {
|
|
5629
5943
|
queryClient.invalidateQueries({
|
|
@@ -5642,32 +5956,28 @@ function Sidebar() {
|
|
|
5642
5956
|
queryKey: [FETCH_KEY_TYPE_QUERY_KEY]
|
|
5643
5957
|
});
|
|
5644
5958
|
},
|
|
5645
|
-
children: /* @__PURE__ */
|
|
5959
|
+
children: /* @__PURE__ */ jsx46(Spinner, { isLoading: query.isFetching, children: /* @__PURE__ */ jsx46(IconRefresh, { size: 16 }) })
|
|
5646
5960
|
}
|
|
5647
5961
|
),
|
|
5648
|
-
/* @__PURE__ */
|
|
5962
|
+
/* @__PURE__ */ jsx46(AddKeyModal, {})
|
|
5649
5963
|
] })
|
|
5650
5964
|
] }),
|
|
5651
5965
|
/* @__PURE__ */ jsxs31("div", { className: "flex h-10 items-center", children: [
|
|
5652
|
-
/* @__PURE__ */
|
|
5653
|
-
/* @__PURE__ */
|
|
5966
|
+
/* @__PURE__ */ jsx46(DataTypeSelector, {}),
|
|
5967
|
+
/* @__PURE__ */ jsx46(SearchInput, {})
|
|
5654
5968
|
] })
|
|
5655
5969
|
] }),
|
|
5656
|
-
query.isLoading && keys.length === 0 ? /* @__PURE__ */
|
|
5970
|
+
query.isLoading && keys.length === 0 ? /* @__PURE__ */ jsx46(LoadingSkeleton, {}) : keys.length > 0 ? (
|
|
5657
5971
|
// Infinite scroll already has a loader at the bottom
|
|
5658
|
-
/* @__PURE__ */
|
|
5659
|
-
) : /* @__PURE__ */
|
|
5972
|
+
/* @__PURE__ */ jsx46(InfiniteScroll, { query, disableRoundedInherit: true, className: "min-h-0", children: /* @__PURE__ */ jsx46(KeysList, {}) })
|
|
5973
|
+
) : /* @__PURE__ */ jsx46(Empty, {})
|
|
5660
5974
|
] });
|
|
5661
5975
|
}
|
|
5662
5976
|
|
|
5663
|
-
// src/components/databrowser/
|
|
5664
|
-
import { jsx as
|
|
5665
|
-
var
|
|
5666
|
-
|
|
5667
|
-
useEffect11(() => {
|
|
5668
|
-
queryClient.resetQueries();
|
|
5669
|
-
}, [credentials.url]);
|
|
5670
|
-
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: [
|
|
5977
|
+
// src/components/databrowser/components/databrowser-instance.tsx
|
|
5978
|
+
import { jsx as jsx47, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
5979
|
+
var DatabrowserInstance = ({ hidden }) => {
|
|
5980
|
+
return /* @__PURE__ */ jsx47(KeysProvider, { children: /* @__PURE__ */ jsxs32("div", { className: cn("min-h-0 grow rounded-md bg-zinc-100", hidden && "hidden"), children: [
|
|
5671
5981
|
/* @__PURE__ */ jsxs32(
|
|
5672
5982
|
PanelGroup,
|
|
5673
5983
|
{
|
|
@@ -5675,21 +5985,146 @@ var RedisBrowser = ({ token, url }) => {
|
|
|
5675
5985
|
direction: "horizontal",
|
|
5676
5986
|
className: "h-full w-full gap-0.5 text-sm antialiased",
|
|
5677
5987
|
children: [
|
|
5678
|
-
/* @__PURE__ */
|
|
5679
|
-
/* @__PURE__ */
|
|
5680
|
-
|
|
5681
|
-
{
|
|
5682
|
-
size: 16,
|
|
5683
|
-
stroke: 1,
|
|
5684
|
-
className: "pointer-events-none shrink-0 opacity-20"
|
|
5685
|
-
}
|
|
5686
|
-
) }),
|
|
5687
|
-
/* @__PURE__ */ jsx45(Panel, { minSize: 40, children: /* @__PURE__ */ jsx45(DataDisplay, {}) })
|
|
5988
|
+
/* @__PURE__ */ jsx47(Panel, { defaultSize: 30, minSize: 30, children: /* @__PURE__ */ jsx47(Sidebar, {}) }),
|
|
5989
|
+
/* @__PURE__ */ jsx47(PanelResizeHandle, { className: "group flex h-full w-3 justify-center", children: /* @__PURE__ */ jsx47("div", { className: "h-full border-r border-dashed border-zinc-200 transition-colors group-hover:border-zinc-500" }) }),
|
|
5990
|
+
/* @__PURE__ */ jsx47(Panel, { minSize: 40, children: /* @__PURE__ */ jsx47(DataDisplay, {}) })
|
|
5688
5991
|
]
|
|
5689
5992
|
}
|
|
5690
5993
|
),
|
|
5691
|
-
/* @__PURE__ */
|
|
5692
|
-
] }) })
|
|
5994
|
+
/* @__PURE__ */ jsx47(Toaster, {})
|
|
5995
|
+
] }) });
|
|
5996
|
+
};
|
|
5997
|
+
|
|
5998
|
+
// src/components/databrowser/components/databrowser-tabs.tsx
|
|
5999
|
+
import { IconPlus as IconPlus2 } from "@tabler/icons-react";
|
|
6000
|
+
|
|
6001
|
+
// src/components/databrowser/components/tab.tsx
|
|
6002
|
+
import { IconSearch, IconX as IconX2 } from "@tabler/icons-react";
|
|
6003
|
+
|
|
6004
|
+
// src/components/databrowser/components/tab-type-icon.tsx
|
|
6005
|
+
import { jsx as jsx48 } from "react/jsx-runtime";
|
|
6006
|
+
function TabTypeIcon({ selectedKey }) {
|
|
6007
|
+
const { data: keyType, isLoading } = useFetchKeyType(selectedKey);
|
|
6008
|
+
if (isLoading) return /* @__PURE__ */ jsx48(Skeleton, { className: "h-5 w-5 rounded" });
|
|
6009
|
+
if (!keyType || keyType === "none") return;
|
|
6010
|
+
return /* @__PURE__ */ jsx48(TypeTag, { variant: keyType, type: "icon" });
|
|
6011
|
+
}
|
|
6012
|
+
|
|
6013
|
+
// src/hooks/use-overflow.ts
|
|
6014
|
+
import { useCallback as useCallback2, useEffect as useEffect12, useRef as useRef4, useState as useState12 } from "react";
|
|
6015
|
+
var useOverflow = () => {
|
|
6016
|
+
const [isOverflow, setIsOverflow] = useState12(false);
|
|
6017
|
+
const observerRef = useRef4(null);
|
|
6018
|
+
const ref = useCallback2((node) => {
|
|
6019
|
+
if (observerRef.current) {
|
|
6020
|
+
observerRef.current.disconnect();
|
|
6021
|
+
observerRef.current = null;
|
|
6022
|
+
}
|
|
6023
|
+
if (!node) return;
|
|
6024
|
+
observerRef.current = new ResizeObserver((entries) => {
|
|
6025
|
+
const el = entries.at(0)?.target;
|
|
6026
|
+
if (!el) return;
|
|
6027
|
+
setIsOverflow(el.scrollWidth > el.clientWidth);
|
|
6028
|
+
});
|
|
6029
|
+
observerRef.current.observe(node);
|
|
6030
|
+
}, []);
|
|
6031
|
+
useEffect12(() => {
|
|
6032
|
+
return () => {
|
|
6033
|
+
observerRef.current?.disconnect();
|
|
6034
|
+
};
|
|
6035
|
+
}, []);
|
|
6036
|
+
return { ref, isOverflow };
|
|
6037
|
+
};
|
|
6038
|
+
|
|
6039
|
+
// src/components/databrowser/components/tab.tsx
|
|
6040
|
+
import { jsx as jsx49, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
6041
|
+
var Tab = ({ id }) => {
|
|
6042
|
+
const { active, search, selectedKey } = useTab();
|
|
6043
|
+
const { selectTab, removeTab, tabs } = useDatabrowserStore();
|
|
6044
|
+
const { ref, isOverflow } = useOverflow();
|
|
6045
|
+
const label = search.key || selectedKey;
|
|
6046
|
+
const iconNode = search.key ? /* @__PURE__ */ jsx49(IconSearch, { size: 15 }) : selectedKey ? /* @__PURE__ */ jsx49(TabTypeIcon, { selectedKey }) : void 0;
|
|
6047
|
+
const tabNode = /* @__PURE__ */ jsxs33(
|
|
6048
|
+
"div",
|
|
6049
|
+
{
|
|
6050
|
+
onClick: () => selectTab(id),
|
|
6051
|
+
className: cn(
|
|
6052
|
+
"flex h-9 cursor-pointer items-center gap-2 rounded-t-lg border border-zinc-200 px-3 text-[13px] transition-colors",
|
|
6053
|
+
active ? "border-b-white bg-white text-zinc-900" : "bg-zinc-100 hover:bg-zinc-50"
|
|
6054
|
+
),
|
|
6055
|
+
children: [
|
|
6056
|
+
iconNode,
|
|
6057
|
+
/* @__PURE__ */ jsx49("span", { ref, className: "max-w-32 truncate whitespace-nowrap", children: label || "New Tab" }),
|
|
6058
|
+
tabs.length > 1 && /* @__PURE__ */ jsx49(
|
|
6059
|
+
"button",
|
|
6060
|
+
{
|
|
6061
|
+
onClick: (e) => {
|
|
6062
|
+
e.stopPropagation();
|
|
6063
|
+
removeTab(id);
|
|
6064
|
+
},
|
|
6065
|
+
className: "p-1 text-zinc-300 transition-colors hover:text-zinc-500",
|
|
6066
|
+
children: /* @__PURE__ */ jsx49(IconX2, { size: 16 })
|
|
6067
|
+
}
|
|
6068
|
+
)
|
|
6069
|
+
]
|
|
6070
|
+
}
|
|
6071
|
+
);
|
|
6072
|
+
return /* @__PURE__ */ jsx49(SimpleTooltip, { content: isOverflow ? label : void 0, children: tabNode });
|
|
6073
|
+
};
|
|
6074
|
+
|
|
6075
|
+
// src/components/databrowser/components/databrowser-tabs.tsx
|
|
6076
|
+
import { jsx as jsx50, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
6077
|
+
var DatabrowserTabs = () => {
|
|
6078
|
+
const { tabs, addTab } = useDatabrowserStore();
|
|
6079
|
+
return /* @__PURE__ */ jsxs34("div", { className: "relative mb-2 shrink-0", children: [
|
|
6080
|
+
/* @__PURE__ */ jsx50("div", { className: "absolute bottom-0 left-0 right-0 -z-10 h-[1px] w-full bg-zinc-200" }),
|
|
6081
|
+
/* @__PURE__ */ jsxs34("div", { className: "scrollbar-hide flex translate-y-[1px] items-center gap-1 overflow-x-scroll pb-[1px] [&::-webkit-scrollbar]:hidden", children: [
|
|
6082
|
+
tabs.map(([id]) => /* @__PURE__ */ jsx50(TabIdProvider, { value: id, children: /* @__PURE__ */ jsx50(Tab, { id }) }, id)),
|
|
6083
|
+
/* @__PURE__ */ jsx50(
|
|
6084
|
+
Button,
|
|
6085
|
+
{
|
|
6086
|
+
variant: "secondary",
|
|
6087
|
+
size: "icon-sm",
|
|
6088
|
+
onClick: addTab,
|
|
6089
|
+
className: "mr-1 flex-shrink-0",
|
|
6090
|
+
title: "Add new tab",
|
|
6091
|
+
children: /* @__PURE__ */ jsx50(IconPlus2, { className: "text-zinc-500", size: 16 })
|
|
6092
|
+
}
|
|
6093
|
+
)
|
|
6094
|
+
] })
|
|
6095
|
+
] });
|
|
6096
|
+
};
|
|
6097
|
+
|
|
6098
|
+
// src/components/databrowser/index.tsx
|
|
6099
|
+
import { jsx as jsx51, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
6100
|
+
var RedisBrowser = ({
|
|
6101
|
+
token,
|
|
6102
|
+
url,
|
|
6103
|
+
hideTabs,
|
|
6104
|
+
storage
|
|
6105
|
+
}) => {
|
|
6106
|
+
const credentials = useMemo8(() => ({ token, url }), [token, url]);
|
|
6107
|
+
useEffect13(() => {
|
|
6108
|
+
queryClient.resetQueries();
|
|
6109
|
+
}, [credentials.url]);
|
|
6110
|
+
return /* @__PURE__ */ jsx51(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx51(RedisProvider, { redisCredentials: credentials, children: /* @__PURE__ */ jsx51(DatabrowserProvider, { storage, children: /* @__PURE__ */ jsx51(TooltipProvider, { children: /* @__PURE__ */ jsxs35(
|
|
6111
|
+
"div",
|
|
6112
|
+
{
|
|
6113
|
+
className: "ups-db",
|
|
6114
|
+
style: { height: "100%", display: "flex", flexDirection: "column" },
|
|
6115
|
+
children: [
|
|
6116
|
+
!hideTabs && /* @__PURE__ */ jsx51(DatabrowserTabs, {}),
|
|
6117
|
+
/* @__PURE__ */ jsx51(DatabrowserInstances, {})
|
|
6118
|
+
]
|
|
6119
|
+
}
|
|
6120
|
+
) }) }) }) });
|
|
6121
|
+
};
|
|
6122
|
+
var DatabrowserInstances = () => {
|
|
6123
|
+
const { tabs, selectedTab, addTab } = useDatabrowserStore();
|
|
6124
|
+
useEffect13(() => {
|
|
6125
|
+
if (tabs.length === 0) addTab();
|
|
6126
|
+
}, [tabs]);
|
|
6127
|
+
return tabs.map(([id]) => /* @__PURE__ */ jsx51(TabIdProvider, { value: id, children: /* @__PURE__ */ jsx51(DatabrowserInstance, { hidden: id !== selectedTab }) }, id));
|
|
5693
6128
|
};
|
|
5694
6129
|
export {
|
|
5695
6130
|
RedisBrowser
|