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