@sfxcode/nuxt-ui-mongocamp 1.3.4 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/module.d.mts +8 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +6 -0
- package/dist/runtime/components/MongocampAggregationBuilder.vue +302 -3
- package/dist/runtime/components/MongocampAggregationChart.d.vue.ts +6 -0
- package/dist/runtime/components/MongocampAggregationChart.vue +93 -0
- package/dist/runtime/components/MongocampAggregationChart.vue.d.ts +6 -0
- package/dist/runtime/components/MongocampAggregationStagePreview.d.vue.ts +9 -0
- package/dist/runtime/components/MongocampAggregationStagePreview.vue +148 -0
- package/dist/runtime/components/MongocampAggregationStagePreview.vue.d.ts +9 -0
- package/dist/runtime/components/MongocampBucketFiles.vue +169 -48
- package/dist/runtime/components/MongocampBulkDelete.d.vue.ts +19 -0
- package/dist/runtime/components/MongocampBulkDelete.vue +118 -23
- package/dist/runtime/components/MongocampBulkDelete.vue.d.ts +19 -0
- package/dist/runtime/components/MongocampBulkEdit.d.vue.ts +6 -0
- package/dist/runtime/components/MongocampBulkEdit.vue +23 -2
- package/dist/runtime/components/MongocampBulkEdit.vue.d.ts +6 -0
- package/dist/runtime/components/MongocampChart.d.vue.ts +29 -0
- package/dist/runtime/components/MongocampChart.vue +129 -0
- package/dist/runtime/components/MongocampChart.vue.d.ts +29 -0
- package/dist/runtime/components/MongocampCollectionCharts.d.vue.ts +15 -0
- package/dist/runtime/components/MongocampCollectionCharts.vue +199 -0
- package/dist/runtime/components/MongocampCollectionCharts.vue.d.ts +15 -0
- package/dist/runtime/components/MongocampCollectionCopy.d.vue.ts +23 -0
- package/dist/runtime/components/MongocampCollectionCopy.vue +445 -0
- package/dist/runtime/components/MongocampCollectionCopy.vue.d.ts +23 -0
- package/dist/runtime/components/MongocampCollectionData.d.vue.ts +4 -0
- package/dist/runtime/components/MongocampCollectionData.vue +343 -146
- package/dist/runtime/components/MongocampCollectionData.vue.d.ts +4 -0
- package/dist/runtime/components/MongocampCollectionInfos.vue +106 -238
- package/dist/runtime/components/MongocampCollections.vue +62 -0
- package/dist/runtime/components/MongocampCommandPalette.d.vue.ts +40 -0
- package/dist/runtime/components/MongocampCommandPalette.vue +135 -0
- package/dist/runtime/components/MongocampCommandPalette.vue.d.ts +40 -0
- package/dist/runtime/components/MongocampConfirmByName.vue +2 -2
- package/dist/runtime/components/MongocampDashboard.d.vue.ts +3 -1
- package/dist/runtime/components/MongocampDashboard.vue +21 -2
- package/dist/runtime/components/MongocampDashboard.vue.d.ts +3 -1
- package/dist/runtime/components/MongocampDatabases.vue +22 -0
- package/dist/runtime/components/MongocampDocumentCompare.d.vue.ts +20 -0
- package/dist/runtime/components/MongocampDocumentCompare.vue +146 -0
- package/dist/runtime/components/MongocampDocumentCompare.vue.d.ts +20 -0
- package/dist/runtime/components/MongocampDocumentView.d.vue.ts +22 -0
- package/dist/runtime/components/MongocampDocumentView.vue +202 -0
- package/dist/runtime/components/MongocampDocumentView.vue.d.ts +22 -0
- package/dist/runtime/components/MongocampErrorAlert.vue +12 -16
- package/dist/runtime/components/MongocampExportAll.d.vue.ts +18 -0
- package/dist/runtime/components/MongocampExportAll.vue +204 -0
- package/dist/runtime/components/MongocampExportAll.vue.d.ts +18 -0
- package/dist/runtime/components/MongocampFilePreview.d.vue.ts +16 -0
- package/dist/runtime/components/MongocampFilePreview.vue +162 -0
- package/dist/runtime/components/MongocampFilePreview.vue.d.ts +16 -0
- package/dist/runtime/components/MongocampFilterBuilder.vue +11 -0
- package/dist/runtime/components/MongocampImport.vue +2 -10
- package/dist/runtime/components/MongocampIndexes.d.vue.ts +18 -0
- package/dist/runtime/components/MongocampIndexes.vue +455 -0
- package/dist/runtime/components/MongocampIndexes.vue.d.ts +18 -0
- package/dist/runtime/components/MongocampJobs.d.vue.ts +6 -1
- package/dist/runtime/components/MongocampJobs.vue +24 -4
- package/dist/runtime/components/MongocampJobs.vue.d.ts +6 -1
- package/dist/runtime/components/MongocampPermissionMatrix.d.vue.ts +12 -0
- package/dist/runtime/components/MongocampPermissionMatrix.vue +301 -0
- package/dist/runtime/components/MongocampPermissionMatrix.vue.d.ts +12 -0
- package/dist/runtime/components/MongocampQueryBar.d.vue.ts +26 -0
- package/dist/runtime/components/MongocampQueryBar.vue +398 -0
- package/dist/runtime/components/MongocampQueryBar.vue.d.ts +26 -0
- package/dist/runtime/components/MongocampRoleGrants.vue +2 -2
- package/dist/runtime/components/MongocampRoles.vue +3 -3
- package/dist/runtime/components/MongocampServerOverview.d.vue.ts +20 -0
- package/dist/runtime/components/MongocampServerOverview.vue +443 -0
- package/dist/runtime/components/MongocampServerOverview.vue.d.ts +20 -0
- package/dist/runtime/components/MongocampSettings.d.vue.ts +25 -1
- package/dist/runtime/components/MongocampSettings.vue +70 -9
- package/dist/runtime/components/MongocampSettings.vue.d.ts +25 -1
- package/dist/runtime/components/MongocampUsers.vue +3 -3
- package/dist/runtime/composables/useMongocampAdmin.d.ts +2 -1
- package/dist/runtime/composables/useMongocampAdmin.js +7 -15
- package/dist/runtime/composables/useMongocampAggregation.d.ts +12 -1
- package/dist/runtime/composables/useMongocampAggregation.js +33 -25
- package/dist/runtime/composables/useMongocampAutoRefresh.d.ts +26 -0
- package/dist/runtime/composables/useMongocampAutoRefresh.js +78 -0
- package/dist/runtime/composables/useMongocampBucket.d.ts +13 -1
- package/dist/runtime/composables/useMongocampBucket.js +34 -0
- package/dist/runtime/composables/useMongocampClientApi.d.ts +1 -1
- package/dist/runtime/composables/useMongocampClientApi.js +2 -1
- package/dist/runtime/composables/useMongocampCollectionCopy.d.ts +85 -0
- package/dist/runtime/composables/useMongocampCollectionCopy.js +105 -0
- package/dist/runtime/composables/useMongocampCollectionStats.d.ts +10 -0
- package/dist/runtime/composables/useMongocampCollectionStats.js +17 -0
- package/dist/runtime/composables/useMongocampError.d.ts +2 -1
- package/dist/runtime/composables/useMongocampError.js +16 -1
- package/dist/runtime/composables/useMongocampExportAll.d.ts +47 -0
- package/dist/runtime/composables/useMongocampExportAll.js +27 -0
- package/dist/runtime/composables/useMongocampExtendedJson.d.ts +5 -1
- package/dist/runtime/composables/useMongocampExtendedJson.js +12 -6
- package/dist/runtime/composables/useMongocampFetchAll.d.ts +25 -0
- package/dist/runtime/composables/useMongocampFetchAll.js +27 -0
- package/dist/runtime/composables/useMongocampPermissions.d.ts +14 -0
- package/dist/runtime/composables/useMongocampPermissions.js +21 -0
- package/dist/runtime/composables/useMongocampPersistedState.d.ts +15 -0
- package/dist/runtime/composables/useMongocampPersistedState.js +21 -0
- package/dist/runtime/composables/useMongocampProxyApi.d.ts +1 -1
- package/dist/runtime/composables/useMongocampProxyApi.js +2 -1
- package/dist/runtime/composables/useMongocampQuery.d.ts +50 -2
- package/dist/runtime/composables/useMongocampQuery.js +72 -1
- package/dist/runtime/composables/useMongocampSavedPipelines.d.ts +25 -0
- package/dist/runtime/composables/useMongocampSavedPipelines.js +23 -0
- package/dist/runtime/composables/useMongocampSavedQueries.d.ts +37 -0
- package/dist/runtime/composables/useMongocampSavedQueries.js +50 -0
- package/dist/runtime/composables/useMongocampServerOverview.d.ts +42 -0
- package/dist/runtime/composables/useMongocampServerOverview.js +61 -0
- package/dist/runtime/composables/useMongocampSession.d.ts +3 -2
- package/dist/runtime/composables/useMongocampSession.js +14 -22
- package/dist/runtime/composables/useMongocampSystem.d.ts +7 -2
- package/dist/runtime/composables/useMongocampSystem.js +6 -2
- package/dist/runtime/locales/de.json +495 -10
- package/dist/runtime/locales/en.json +495 -10
- package/dist/runtime/plugin.js +8 -5
- package/dist/runtime/utils/aggregationPipeline.d.ts +5 -4
- package/dist/runtime/utils/aggregationPipeline.js +23 -9
- package/dist/runtime/utils/aggregationPreview.d.ts +13 -0
- package/dist/runtime/utils/aggregationPreview.js +10 -0
- package/dist/runtime/utils/aggregationResult.d.ts +5 -0
- package/dist/runtime/utils/aggregationResult.js +4 -0
- package/dist/runtime/utils/aggregationTemplates.d.ts +34 -0
- package/dist/runtime/utils/aggregationTemplates.js +47 -0
- package/dist/runtime/utils/analyzeSamples.d.ts +1 -0
- package/dist/runtime/utils/analyzeSamples.js +1 -1
- package/dist/runtime/utils/autoRefresh.d.ts +14 -0
- package/dist/runtime/utils/autoRefresh.js +15 -0
- package/dist/runtime/utils/bigIntJson.d.ts +15 -0
- package/dist/runtime/utils/bigIntJson.js +55 -0
- package/dist/runtime/utils/bulkDelete.d.ts +9 -1
- package/dist/runtime/utils/bulkDelete.js +15 -3
- package/dist/runtime/utils/bulkEdit.d.ts +6 -0
- package/dist/runtime/utils/bulkEdit.js +7 -0
- package/dist/runtime/utils/chartData.d.ts +11 -0
- package/dist/runtime/utils/chartData.js +9 -0
- package/dist/runtime/utils/collectionChart.d.ts +36 -0
- package/dist/runtime/utils/collectionChart.js +73 -0
- package/dist/runtime/utils/collectionCopy.d.ts +26 -0
- package/dist/runtime/utils/collectionCopy.js +38 -0
- package/dist/runtime/utils/collectionStats.d.ts +31 -0
- package/dist/runtime/utils/collectionStats.js +42 -0
- package/dist/runtime/utils/commandPalette.d.ts +48 -0
- package/dist/runtime/utils/commandPalette.js +39 -0
- package/dist/runtime/utils/createProxyMongocampApis.d.ts +2 -2
- package/dist/runtime/utils/createProxyMongocampApis.js +2 -2
- package/dist/runtime/utils/documentCompare.d.ts +31 -0
- package/dist/runtime/utils/documentCompare.js +70 -0
- package/dist/runtime/utils/documentDiff.d.ts +19 -0
- package/dist/runtime/utils/documentDiff.js +71 -0
- package/dist/runtime/utils/documentPaths.d.ts +44 -0
- package/dist/runtime/utils/documentPaths.js +144 -0
- package/dist/runtime/utils/documentTree.d.ts +40 -0
- package/dist/runtime/utils/documentTree.js +94 -0
- package/dist/runtime/utils/exportDocuments.d.ts +35 -0
- package/dist/runtime/utils/exportDocuments.js +54 -0
- package/dist/runtime/utils/exportRows.js +1 -1
- package/dist/runtime/utils/filePreview.d.ts +27 -0
- package/dist/runtime/utils/filePreview.js +50 -0
- package/dist/runtime/utils/filterBuilder.d.ts +6 -1
- package/dist/runtime/utils/filterBuilder.js +6 -5
- package/dist/runtime/utils/formatBytes.d.ts +2 -0
- package/dist/runtime/utils/formatBytes.js +11 -0
- package/dist/runtime/utils/grantMatching.d.ts +8 -0
- package/dist/runtime/utils/grantMatching.js +15 -0
- package/dist/runtime/utils/importRows.js +12 -2
- package/dist/runtime/utils/indexCopy.d.ts +26 -0
- package/dist/runtime/utils/indexCopy.js +22 -0
- package/dist/runtime/utils/indexForm.d.ts +69 -0
- package/dist/runtime/utils/indexForm.js +63 -0
- package/dist/runtime/utils/limitedMap.d.ts +17 -0
- package/dist/runtime/utils/limitedMap.js +19 -0
- package/dist/runtime/utils/luceneExpression.d.ts +15 -0
- package/dist/runtime/utils/luceneExpression.js +74 -0
- package/dist/runtime/utils/pagedFetch.d.ts +46 -0
- package/dist/runtime/utils/pagedFetch.js +58 -0
- package/dist/runtime/utils/paginationHeaders.d.ts +4 -0
- package/dist/runtime/utils/paginationHeaders.js +4 -0
- package/dist/runtime/utils/permissionDenied.d.ts +10 -0
- package/dist/runtime/utils/permissionDenied.js +23 -0
- package/dist/runtime/utils/permissionMatrix.d.ts +55 -0
- package/dist/runtime/utils/permissionMatrix.js +85 -0
- package/dist/runtime/utils/persistedState.d.ts +25 -0
- package/dist/runtime/utils/persistedState.js +47 -0
- package/dist/runtime/utils/queryState.d.ts +45 -0
- package/dist/runtime/utils/queryState.js +75 -0
- package/dist/runtime/utils/requestLimits.d.ts +2 -0
- package/dist/runtime/utils/requestLimits.js +4 -0
- package/dist/runtime/utils/resultChart.d.ts +32 -0
- package/dist/runtime/utils/resultChart.js +59 -0
- package/dist/runtime/utils/savedPipelines.d.ts +22 -0
- package/dist/runtime/utils/savedPipelines.js +46 -0
- package/dist/runtime/utils/savedQueries.d.ts +60 -0
- package/dist/runtime/utils/savedQueries.js +143 -0
- package/dist/runtime/utils/schemaAnalysis.d.ts +16 -0
- package/dist/runtime/utils/schemaAnalysis.js +57 -0
- package/dist/runtime/utils/serverError.d.ts +19 -0
- package/dist/runtime/utils/serverError.js +19 -0
- package/dist/runtime/utils/serverOverview.d.ts +47 -0
- package/dist/runtime/utils/serverOverview.js +40 -0
- package/dist/runtime/utils/sessionGuard.d.ts +3 -0
- package/dist/runtime/utils/sessionGuard.js +18 -1
- package/package.json +13 -12
- package/dist/runtime/utils/failureKind.d.ts +0 -3
- package/dist/runtime/utils/failureKind.js +0 -11
- package/dist/runtime/utils/serverProbe.d.ts +0 -10
- package/dist/runtime/utils/serverProbe.js +0 -25
- package/dist/runtime/utils/throttled.d.ts +0 -6
- package/dist/runtime/utils/throttled.js +0 -16
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, ref, watch } from "vue";
|
|
3
|
+
import { useI18n } from "#imports";
|
|
4
|
+
import MongocampFilterBuilder from "./MongocampFilterBuilder.vue";
|
|
5
|
+
import { useMongocampSavedQueries } from "../composables/useMongocampSavedQueries";
|
|
6
|
+
import { buildCondition, buildFilterQuery, conditionValueText, countActiveConditions, operatorLabelKey } from "../utils/filterBuilder";
|
|
7
|
+
import {
|
|
8
|
+
addSort,
|
|
9
|
+
describeQuery,
|
|
10
|
+
emptyGroup,
|
|
11
|
+
fromSavedQuery,
|
|
12
|
+
isEmptyQuery,
|
|
13
|
+
MAX_SORT_ENTRIES,
|
|
14
|
+
parseSortEntry,
|
|
15
|
+
removeSort,
|
|
16
|
+
setSortField,
|
|
17
|
+
toggleProjectionField,
|
|
18
|
+
toggleSortDirection,
|
|
19
|
+
toSavedQuery,
|
|
20
|
+
usableProjection
|
|
21
|
+
} from "../utils/queryState";
|
|
22
|
+
const props = defineProps({
|
|
23
|
+
fields: { type: Array, required: true },
|
|
24
|
+
columns: { type: Array, required: true },
|
|
25
|
+
collection: { type: String, required: true },
|
|
26
|
+
loadDistinct: { type: Function, required: false }
|
|
27
|
+
});
|
|
28
|
+
const model = defineModel({ type: Object, ...{ required: true } });
|
|
29
|
+
const emit = defineEmits(["apply"]);
|
|
30
|
+
const { t } = useI18n();
|
|
31
|
+
const { saved, recent, save, remove, record, clearRecent } = useMongocampSavedQueries(() => props.collection);
|
|
32
|
+
const fieldTypes = computed(() => Object.fromEntries(props.fields.map((f) => [f.key, f.type])));
|
|
33
|
+
const projectable = computed(() => props.columns.filter((c) => c !== "_id"));
|
|
34
|
+
const filtersOpen = ref(false);
|
|
35
|
+
const draft = ref(emptyGroup());
|
|
36
|
+
const cloneGroup = (g) => ({ match: g.match, negate: g.negate, conditions: g.conditions.map((c) => ({ ...c })) });
|
|
37
|
+
watch(() => model.value.filterGroup, (g) => draft.value = cloneGroup(g), { immediate: true });
|
|
38
|
+
watch(() => props.collection, () => filtersOpen.value = false);
|
|
39
|
+
defineExpose({ closePanel: () => filtersOpen.value = false });
|
|
40
|
+
function commit(next, options = {}) {
|
|
41
|
+
model.value = next;
|
|
42
|
+
emit("apply", next);
|
|
43
|
+
if (options.remember !== false && !isEmptyQuery(next)) record(toSavedQuery(next));
|
|
44
|
+
}
|
|
45
|
+
function onBuilderApply(lucene) {
|
|
46
|
+
commit({ ...model.value, filterGroup: cloneGroup(draft.value), lucene });
|
|
47
|
+
}
|
|
48
|
+
const activeFilterCount = computed(() => {
|
|
49
|
+
const count = countActiveConditions(model.value.filterGroup, fieldTypes.value);
|
|
50
|
+
return count > 0 ? count : model.value.lucene !== "" ? 1 : 0;
|
|
51
|
+
});
|
|
52
|
+
const filterChips = computed(() => {
|
|
53
|
+
const chips = model.value.filterGroup.conditions.filter((c) => buildCondition(c, fieldTypes.value[c.field] ?? "string") !== "").map((c) => ({
|
|
54
|
+
id: c.id,
|
|
55
|
+
label: [c.field, t(operatorLabelKey(c.operator, fieldTypes.value[c.field] ?? "string")), conditionValueText(c)].filter(Boolean).join(" ")
|
|
56
|
+
}));
|
|
57
|
+
if (chips.length === 0 && model.value.lucene !== "") chips.push({ id: "__lucene", label: t("nuxtUiMongocamp.queryBar.customFilter", { query: model.value.lucene }) });
|
|
58
|
+
return chips;
|
|
59
|
+
});
|
|
60
|
+
function removeChip(id) {
|
|
61
|
+
if (id === "__lucene") return clearFilter();
|
|
62
|
+
const group = { ...model.value.filterGroup, conditions: model.value.filterGroup.conditions.filter((c) => c.id !== id) };
|
|
63
|
+
commit({ ...model.value, filterGroup: group, lucene: buildFilterQuery(group, fieldTypes.value) });
|
|
64
|
+
}
|
|
65
|
+
function clearFilter() {
|
|
66
|
+
commit({ ...model.value, filterGroup: emptyGroup(), lucene: "" }, { remember: false });
|
|
67
|
+
}
|
|
68
|
+
const sortFieldItems = computed(() => props.columns.map((c) => ({ label: c, value: c })));
|
|
69
|
+
const sortEntries = computed(() => model.value.sort.map(parseSortEntry));
|
|
70
|
+
const canAddSort = computed(() => model.value.sort.length < MAX_SORT_ENTRIES && props.columns.some((c) => !sortEntries.value.some((e) => e.field === c)));
|
|
71
|
+
function setSort(sort) {
|
|
72
|
+
commit({ ...model.value, sort });
|
|
73
|
+
}
|
|
74
|
+
function addSortRow() {
|
|
75
|
+
const next = props.columns.find((c) => !sortEntries.value.some((e) => e.field === c));
|
|
76
|
+
if (next) setSort(addSort(model.value.sort, next));
|
|
77
|
+
}
|
|
78
|
+
const projection = computed(() => usableProjection(model.value.projection, projectable.value));
|
|
79
|
+
const fieldMenuItems = computed(() => {
|
|
80
|
+
const chosen = projection.value.length > 0 ? projection.value : projectable.value;
|
|
81
|
+
return projectable.value.map((key) => ({
|
|
82
|
+
label: key,
|
|
83
|
+
type: "checkbox",
|
|
84
|
+
checked: chosen.includes(key),
|
|
85
|
+
onUpdateChecked: () => commit({ ...model.value, projection: toggleProjectionField(projection.value, key, projectable.value) }),
|
|
86
|
+
onSelect: (e) => e.preventDefault()
|
|
87
|
+
}));
|
|
88
|
+
});
|
|
89
|
+
const labels = computed(() => ({
|
|
90
|
+
filter: t("nuxtUiMongocamp.queryBar.wordFilter"),
|
|
91
|
+
sort: t("nuxtUiMongocamp.queryBar.wordSort"),
|
|
92
|
+
fields: t("nuxtUiMongocamp.queryBar.wordFields")
|
|
93
|
+
}));
|
|
94
|
+
const describe = (q) => describeQuery(q, labels.value, fieldTypes.value) || "\u2014";
|
|
95
|
+
const saveName = ref("");
|
|
96
|
+
const saveError = ref("");
|
|
97
|
+
const canSave = computed(() => !isEmptyQuery(model.value));
|
|
98
|
+
function restore(query) {
|
|
99
|
+
const state = fromSavedQuery(query, fieldTypes.value);
|
|
100
|
+
state.projection = usableProjection(state.projection, projectable.value);
|
|
101
|
+
commit(state);
|
|
102
|
+
}
|
|
103
|
+
function saveCurrent() {
|
|
104
|
+
saveError.value = "";
|
|
105
|
+
const result = save(saveName.value, toSavedQuery(model.value));
|
|
106
|
+
if (result.ok) {
|
|
107
|
+
saveName.value = "";
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
const key = { "invalid-name": "saveFailedName", "invalid-query": "saveFailedQuery", "limit": "saveFailedLimit", "too-large": "saveFailedSize" }[result.reason];
|
|
111
|
+
saveError.value = t(`nuxtUiMongocamp.queryBar.${key}`);
|
|
112
|
+
}
|
|
113
|
+
</script>
|
|
114
|
+
|
|
115
|
+
<template>
|
|
116
|
+
<div class="flex flex-col gap-3">
|
|
117
|
+
<div class="flex flex-wrap items-center gap-1">
|
|
118
|
+
<UChip
|
|
119
|
+
:text="activeFilterCount"
|
|
120
|
+
:show="activeFilterCount > 0"
|
|
121
|
+
size="sm"
|
|
122
|
+
>
|
|
123
|
+
<UButton
|
|
124
|
+
icon="i-lucide-list-filter"
|
|
125
|
+
color="neutral"
|
|
126
|
+
:variant="filtersOpen ? 'subtle' : 'ghost'"
|
|
127
|
+
size="sm"
|
|
128
|
+
:disabled="fields.length === 0"
|
|
129
|
+
:aria-pressed="filtersOpen"
|
|
130
|
+
:aria-label="t('nuxtUiMongocamp.collectionData.filtersTooltip')"
|
|
131
|
+
@click="filtersOpen = !filtersOpen"
|
|
132
|
+
/>
|
|
133
|
+
</UChip>
|
|
134
|
+
|
|
135
|
+
<UPopover>
|
|
136
|
+
<UChip
|
|
137
|
+
:text="model.sort.length"
|
|
138
|
+
:show="model.sort.length > 0"
|
|
139
|
+
size="sm"
|
|
140
|
+
>
|
|
141
|
+
<UButton
|
|
142
|
+
icon="i-lucide-arrow-up-down"
|
|
143
|
+
color="neutral"
|
|
144
|
+
variant="ghost"
|
|
145
|
+
size="sm"
|
|
146
|
+
:disabled="columns.length === 0"
|
|
147
|
+
:aria-label="t('nuxtUiMongocamp.queryBar.sortButton')"
|
|
148
|
+
/>
|
|
149
|
+
</UChip>
|
|
150
|
+
<template #content>
|
|
151
|
+
<div
|
|
152
|
+
class="flex w-80 flex-col gap-2 p-3"
|
|
153
|
+
data-test="sort-panel"
|
|
154
|
+
>
|
|
155
|
+
<p class="text-sm font-semibold">
|
|
156
|
+
{{ t("nuxtUiMongocamp.queryBar.sortTitle") }}
|
|
157
|
+
</p>
|
|
158
|
+
<p
|
|
159
|
+
v-if="model.sort.length === 0"
|
|
160
|
+
class="text-sm text-dimmed"
|
|
161
|
+
>
|
|
162
|
+
{{ t("nuxtUiMongocamp.queryBar.sortNone") }}
|
|
163
|
+
</p>
|
|
164
|
+
<div
|
|
165
|
+
v-for="(entry, index) in sortEntries"
|
|
166
|
+
:key="entry.field"
|
|
167
|
+
class="flex items-center gap-1"
|
|
168
|
+
>
|
|
169
|
+
<USelect
|
|
170
|
+
:model-value="entry.field"
|
|
171
|
+
:items="sortFieldItems"
|
|
172
|
+
size="sm"
|
|
173
|
+
class="min-w-0 flex-1"
|
|
174
|
+
:aria-label="t('nuxtUiMongocamp.queryBar.sortField', { position: index + 1 })"
|
|
175
|
+
@update:model-value="(v) => setSort(setSortField(model.sort, index, v))"
|
|
176
|
+
/>
|
|
177
|
+
<UButton
|
|
178
|
+
:icon="entry.desc ? 'i-lucide-arrow-down-wide-narrow' : 'i-lucide-arrow-up-narrow-wide'"
|
|
179
|
+
color="neutral"
|
|
180
|
+
variant="ghost"
|
|
181
|
+
size="sm"
|
|
182
|
+
:label="entry.desc ? t('nuxtUiMongocamp.queryBar.sortDescending') : t('nuxtUiMongocamp.queryBar.sortAscending')"
|
|
183
|
+
:aria-label="t('nuxtUiMongocamp.queryBar.toggleSortDirection', { field: entry.field })"
|
|
184
|
+
@click="setSort(toggleSortDirection(model.sort, index))"
|
|
185
|
+
/>
|
|
186
|
+
<UButton
|
|
187
|
+
icon="i-lucide-x"
|
|
188
|
+
color="neutral"
|
|
189
|
+
variant="ghost"
|
|
190
|
+
size="sm"
|
|
191
|
+
:aria-label="t('nuxtUiMongocamp.queryBar.removeSort', { field: entry.field })"
|
|
192
|
+
@click="setSort(removeSort(model.sort, index))"
|
|
193
|
+
/>
|
|
194
|
+
</div>
|
|
195
|
+
<UButton
|
|
196
|
+
icon="i-lucide-plus"
|
|
197
|
+
color="neutral"
|
|
198
|
+
variant="soft"
|
|
199
|
+
size="sm"
|
|
200
|
+
:label="t('nuxtUiMongocamp.queryBar.addSort')"
|
|
201
|
+
:disabled="!canAddSort"
|
|
202
|
+
@click="addSortRow"
|
|
203
|
+
/>
|
|
204
|
+
</div>
|
|
205
|
+
</template>
|
|
206
|
+
</UPopover>
|
|
207
|
+
|
|
208
|
+
<UDropdownMenu :items="fieldMenuItems">
|
|
209
|
+
<UChip
|
|
210
|
+
:text="projection.length"
|
|
211
|
+
:show="projection.length > 0"
|
|
212
|
+
size="sm"
|
|
213
|
+
>
|
|
214
|
+
<UButton
|
|
215
|
+
icon="i-lucide-columns-3"
|
|
216
|
+
color="neutral"
|
|
217
|
+
variant="ghost"
|
|
218
|
+
size="sm"
|
|
219
|
+
:disabled="projectable.length === 0"
|
|
220
|
+
:title="projection.length > 0 ? t('nuxtUiMongocamp.queryBar.fieldsSome', { count: projection.length, total: projectable.length }) : t('nuxtUiMongocamp.queryBar.fieldsAll')"
|
|
221
|
+
:aria-label="t('nuxtUiMongocamp.queryBar.fieldsButton')"
|
|
222
|
+
/>
|
|
223
|
+
</UChip>
|
|
224
|
+
</UDropdownMenu>
|
|
225
|
+
|
|
226
|
+
<UPopover>
|
|
227
|
+
<UButton
|
|
228
|
+
icon="i-lucide-history"
|
|
229
|
+
color="neutral"
|
|
230
|
+
variant="ghost"
|
|
231
|
+
size="sm"
|
|
232
|
+
:aria-label="t('nuxtUiMongocamp.queryBar.historyButton')"
|
|
233
|
+
/>
|
|
234
|
+
<template #content>
|
|
235
|
+
<div
|
|
236
|
+
class="flex w-96 max-w-[90vw] flex-col gap-3 p-3"
|
|
237
|
+
data-test="history-panel"
|
|
238
|
+
>
|
|
239
|
+
<section class="flex flex-col gap-1">
|
|
240
|
+
<h3 class="text-sm font-semibold">
|
|
241
|
+
{{ t("nuxtUiMongocamp.queryBar.saved") }}
|
|
242
|
+
</h3>
|
|
243
|
+
<p
|
|
244
|
+
v-if="saved.length === 0"
|
|
245
|
+
class="text-sm text-dimmed"
|
|
246
|
+
>
|
|
247
|
+
{{ t("nuxtUiMongocamp.queryBar.noSaved") }}
|
|
248
|
+
</p>
|
|
249
|
+
<div
|
|
250
|
+
v-for="entry in saved"
|
|
251
|
+
:key="entry.name"
|
|
252
|
+
class="flex items-center gap-1"
|
|
253
|
+
>
|
|
254
|
+
<UButton
|
|
255
|
+
color="neutral"
|
|
256
|
+
variant="ghost"
|
|
257
|
+
size="sm"
|
|
258
|
+
class="min-w-0 flex-1 justify-start"
|
|
259
|
+
:title="describe(entry.query)"
|
|
260
|
+
@click="restore(entry.query)"
|
|
261
|
+
>
|
|
262
|
+
<span class="truncate font-medium">{{ entry.name }}</span>
|
|
263
|
+
<span class="truncate text-xs text-dimmed">{{ describe(entry.query) }}</span>
|
|
264
|
+
</UButton>
|
|
265
|
+
<UButton
|
|
266
|
+
icon="i-lucide-trash-2"
|
|
267
|
+
color="error"
|
|
268
|
+
variant="ghost"
|
|
269
|
+
size="sm"
|
|
270
|
+
:aria-label="t('nuxtUiMongocamp.queryBar.deleteSaved', { name: entry.name })"
|
|
271
|
+
@click="remove(entry.name)"
|
|
272
|
+
/>
|
|
273
|
+
</div>
|
|
274
|
+
<form
|
|
275
|
+
class="mt-1 flex items-center gap-1"
|
|
276
|
+
@submit.prevent="saveCurrent"
|
|
277
|
+
>
|
|
278
|
+
<UInput
|
|
279
|
+
v-model="saveName"
|
|
280
|
+
size="sm"
|
|
281
|
+
class="min-w-0 flex-1"
|
|
282
|
+
:placeholder="t('nuxtUiMongocamp.queryBar.saveNamePlaceholder')"
|
|
283
|
+
:aria-label="t('nuxtUiMongocamp.queryBar.saveName')"
|
|
284
|
+
maxlength="80"
|
|
285
|
+
/>
|
|
286
|
+
<UButton
|
|
287
|
+
type="submit"
|
|
288
|
+
icon="i-lucide-save"
|
|
289
|
+
size="sm"
|
|
290
|
+
:label="t('nuxtUiMongocamp.queryBar.save')"
|
|
291
|
+
:disabled="!canSave || saveName.trim() === ''"
|
|
292
|
+
:title="canSave ? void 0 : t('nuxtUiMongocamp.queryBar.nothingToSave')"
|
|
293
|
+
/>
|
|
294
|
+
</form>
|
|
295
|
+
<p
|
|
296
|
+
v-if="saveError"
|
|
297
|
+
class="text-xs text-error"
|
|
298
|
+
role="alert"
|
|
299
|
+
>
|
|
300
|
+
{{ saveError }}
|
|
301
|
+
</p>
|
|
302
|
+
</section>
|
|
303
|
+
<section class="flex flex-col gap-1">
|
|
304
|
+
<div class="flex items-center justify-between">
|
|
305
|
+
<h3 class="text-sm font-semibold">
|
|
306
|
+
{{ t("nuxtUiMongocamp.queryBar.recent") }}
|
|
307
|
+
</h3>
|
|
308
|
+
<UButton
|
|
309
|
+
v-if="recent.length > 0"
|
|
310
|
+
color="neutral"
|
|
311
|
+
variant="link"
|
|
312
|
+
size="xs"
|
|
313
|
+
:label="t('nuxtUiMongocamp.queryBar.clearHistory')"
|
|
314
|
+
@click="clearRecent"
|
|
315
|
+
/>
|
|
316
|
+
</div>
|
|
317
|
+
<p
|
|
318
|
+
v-if="recent.length === 0"
|
|
319
|
+
class="text-sm text-dimmed"
|
|
320
|
+
>
|
|
321
|
+
{{ t("nuxtUiMongocamp.queryBar.noRecent") }}
|
|
322
|
+
</p>
|
|
323
|
+
<UButton
|
|
324
|
+
v-for="(query, index) in recent"
|
|
325
|
+
:key="index"
|
|
326
|
+
color="neutral"
|
|
327
|
+
variant="ghost"
|
|
328
|
+
size="sm"
|
|
329
|
+
class="justify-start"
|
|
330
|
+
:label="describe(query)"
|
|
331
|
+
data-test="recent-query"
|
|
332
|
+
@click="restore(query)"
|
|
333
|
+
/>
|
|
334
|
+
</section>
|
|
335
|
+
</div>
|
|
336
|
+
</template>
|
|
337
|
+
</UPopover>
|
|
338
|
+
</div>
|
|
339
|
+
|
|
340
|
+
<MongocampFilterBuilder
|
|
341
|
+
v-if="filtersOpen"
|
|
342
|
+
v-model="draft"
|
|
343
|
+
:fields="fields"
|
|
344
|
+
:load-distinct="loadDistinct"
|
|
345
|
+
@apply="onBuilderApply"
|
|
346
|
+
/>
|
|
347
|
+
|
|
348
|
+
<div
|
|
349
|
+
v-if="filterChips.length > 0"
|
|
350
|
+
class="flex flex-wrap items-center gap-2"
|
|
351
|
+
>
|
|
352
|
+
<UBadge
|
|
353
|
+
v-if="model.filterGroup.negate"
|
|
354
|
+
color="warning"
|
|
355
|
+
variant="subtle"
|
|
356
|
+
:label="t('nuxtUiMongocamp.collectionData.filterExcluding')"
|
|
357
|
+
/>
|
|
358
|
+
<UBadge
|
|
359
|
+
v-for="chip in filterChips"
|
|
360
|
+
:key="chip.id"
|
|
361
|
+
color="neutral"
|
|
362
|
+
variant="subtle"
|
|
363
|
+
class="gap-1"
|
|
364
|
+
>
|
|
365
|
+
{{ chip.label }}
|
|
366
|
+
<UButton
|
|
367
|
+
icon="i-lucide-x"
|
|
368
|
+
color="neutral"
|
|
369
|
+
variant="link"
|
|
370
|
+
size="xs"
|
|
371
|
+
class="p-0"
|
|
372
|
+
:aria-label="t('nuxtUiMongocamp.collectionData.removeFilter', { filter: chip.label })"
|
|
373
|
+
@click="removeChip(chip.id)"
|
|
374
|
+
/>
|
|
375
|
+
</UBadge>
|
|
376
|
+
<UButton
|
|
377
|
+
color="neutral"
|
|
378
|
+
variant="link"
|
|
379
|
+
size="xs"
|
|
380
|
+
:label="t('nuxtUiMongocamp.collectionData.clearFilters')"
|
|
381
|
+
@click="clearFilter"
|
|
382
|
+
/>
|
|
383
|
+
</div>
|
|
384
|
+
<p
|
|
385
|
+
v-if="projection.length > 0"
|
|
386
|
+
class="text-xs text-dimmed"
|
|
387
|
+
>
|
|
388
|
+
{{ t("nuxtUiMongocamp.queryBar.fieldsSome", { count: projection.length, total: projectable.length }) }}.
|
|
389
|
+
<UButton
|
|
390
|
+
color="neutral"
|
|
391
|
+
variant="link"
|
|
392
|
+
size="xs"
|
|
393
|
+
:label="t('nuxtUiMongocamp.queryBar.fieldsReset')"
|
|
394
|
+
@click="commit({ ...model, projection: [] })"
|
|
395
|
+
/>
|
|
396
|
+
</p>
|
|
397
|
+
</div>
|
|
398
|
+
</template>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { FilterFieldType } from '../utils/filterBuilder.js';
|
|
2
|
+
import type { QueryState } from '../utils/queryState.js';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
fields: {
|
|
5
|
+
key: string;
|
|
6
|
+
type: FilterFieldType;
|
|
7
|
+
}[];
|
|
8
|
+
columns: string[];
|
|
9
|
+
collection: string;
|
|
10
|
+
loadDistinct?: (field: string) => Promise<string[]>;
|
|
11
|
+
};
|
|
12
|
+
type __VLS_ModelProps = {
|
|
13
|
+
modelValue: QueryState;
|
|
14
|
+
};
|
|
15
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
16
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
17
|
+
closePanel: () => boolean;
|
|
18
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
19
|
+
"update:modelValue": (value: QueryState) => any;
|
|
20
|
+
apply: (state: QueryState) => any;
|
|
21
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
22
|
+
"onUpdate:modelValue"?: ((value: QueryState) => any) | undefined;
|
|
23
|
+
onApply?: ((state: QueryState) => any) | undefined;
|
|
24
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
25
|
+
declare const _default: typeof __VLS_export;
|
|
26
|
+
export default _default;
|
|
@@ -6,7 +6,7 @@ const props = defineProps({
|
|
|
6
6
|
roleName: { type: String, required: true }
|
|
7
7
|
});
|
|
8
8
|
const { t } = useI18n();
|
|
9
|
-
const {
|
|
9
|
+
const { describeServerError } = useMongocampError();
|
|
10
10
|
const { listRoles, updateRole, listCollections } = useMongocampAdmin();
|
|
11
11
|
const grants = ref([]);
|
|
12
12
|
const allCollections = ref([]);
|
|
@@ -91,7 +91,7 @@ async function saveGrants(next) {
|
|
|
91
91
|
try {
|
|
92
92
|
await updateRole(props.roleName, isAdmin.value, next);
|
|
93
93
|
} catch (e) {
|
|
94
|
-
saveError.value =
|
|
94
|
+
saveError.value = (await describeServerError(e, "nuxtUiMongocamp.roleGrants.errorSave")).message;
|
|
95
95
|
return false;
|
|
96
96
|
} finally {
|
|
97
97
|
saving.value = false;
|
|
@@ -62,7 +62,7 @@ const cloneRoleSchema = reactive([
|
|
|
62
62
|
}
|
|
63
63
|
]);
|
|
64
64
|
const loadError = ref(null);
|
|
65
|
-
const { describeError } = useMongocampError();
|
|
65
|
+
const { describeError, describeServerError } = useMongocampError();
|
|
66
66
|
const rowSelection = ref({});
|
|
67
67
|
const selectedRoleNames = computed(() => Object.keys(rowSelection.value).filter((name) => rowSelection.value[name]));
|
|
68
68
|
const bulkDeleting = ref(false);
|
|
@@ -140,7 +140,7 @@ async function handleCloneRole() {
|
|
|
140
140
|
isCloneModalOpen.value = false;
|
|
141
141
|
await fetchRoles();
|
|
142
142
|
} catch (e) {
|
|
143
|
-
cloneError.value =
|
|
143
|
+
cloneError.value = (await describeServerError(e, "nuxtUiMongocamp.roles.errorClone")).message;
|
|
144
144
|
} finally {
|
|
145
145
|
cloning.value = false;
|
|
146
146
|
}
|
|
@@ -160,7 +160,7 @@ async function handleDeleteRole() {
|
|
|
160
160
|
isDeleteModalOpen.value = false;
|
|
161
161
|
await fetchRoles();
|
|
162
162
|
} catch (e) {
|
|
163
|
-
deleteError.value =
|
|
163
|
+
deleteError.value = (await describeServerError(e, "nuxtUiMongocamp.roles.errorDelete")).message;
|
|
164
164
|
} finally {
|
|
165
165
|
deleting.value = false;
|
|
166
166
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
infoPath?: string;
|
|
3
|
+
dataPath?: string;
|
|
4
|
+
jobsPath?: string;
|
|
5
|
+
topN?: number;
|
|
6
|
+
maxCollections?: number;
|
|
7
|
+
autoRefresh?: number;
|
|
8
|
+
hideCharts?: boolean;
|
|
9
|
+
};
|
|
10
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
11
|
+
infoPath: string;
|
|
12
|
+
dataPath: string;
|
|
13
|
+
jobsPath: string;
|
|
14
|
+
autoRefresh: number;
|
|
15
|
+
maxCollections: number;
|
|
16
|
+
topN: number;
|
|
17
|
+
hideCharts: boolean;
|
|
18
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
19
|
+
declare const _default: typeof __VLS_export;
|
|
20
|
+
export default _default;
|