@sfxcode/nuxt-ui-mongocamp 1.4.0 → 1.5.1
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 +1 -1
- package/dist/module.json +2 -2
- package/dist/runtime/components/MongocampAggregationBuilder.d.vue.ts +1 -0
- package/dist/runtime/components/MongocampAggregationBuilder.vue +29 -2
- package/dist/runtime/components/MongocampAggregationBuilder.vue.d.ts +1 -0
- package/dist/runtime/components/MongocampAggregationStagePreview.d.vue.ts +1 -0
- package/dist/runtime/components/MongocampAggregationStagePreview.vue +4 -3
- package/dist/runtime/components/MongocampAggregationStagePreview.vue.d.ts +1 -0
- package/dist/runtime/components/MongocampBucketFiles.vue +61 -0
- package/dist/runtime/components/MongocampBulkDelete.d.vue.ts +2 -12
- package/dist/runtime/components/MongocampBulkDelete.vue +14 -40
- package/dist/runtime/components/MongocampBulkDelete.vue.d.ts +2 -12
- package/dist/runtime/components/MongocampBulkEdit.d.vue.ts +5 -6
- package/dist/runtime/components/MongocampBulkEdit.vue +43 -26
- package/dist/runtime/components/MongocampBulkEdit.vue.d.ts +5 -6
- package/dist/runtime/components/MongocampChart.vue +1 -4
- package/dist/runtime/components/MongocampCollectionCharts.d.vue.ts +2 -0
- package/dist/runtime/components/MongocampCollectionCharts.vue +9 -8
- package/dist/runtime/components/MongocampCollectionCharts.vue.d.ts +2 -0
- package/dist/runtime/components/MongocampCollectionCopy.vue +19 -258
- package/dist/runtime/components/MongocampCollectionData.d.vue.ts +2 -0
- package/dist/runtime/components/MongocampCollectionData.vue +206 -126
- package/dist/runtime/components/MongocampCollectionData.vue.d.ts +2 -0
- package/dist/runtime/components/MongocampCollectionRename.d.vue.ts +22 -0
- package/dist/runtime/components/MongocampCollectionRename.vue +116 -0
- package/dist/runtime/components/MongocampCollectionRename.vue.d.ts +22 -0
- package/dist/runtime/components/MongocampCollections.vue +31 -12
- package/dist/runtime/components/MongocampCommandPalette.vue +2 -2
- package/dist/runtime/components/MongocampDashboard.vue +19 -4
- package/dist/runtime/components/MongocampDatabases.vue +13 -2
- package/dist/runtime/components/MongocampExportAll.vue +13 -26
- package/dist/runtime/components/MongocampImport.vue +169 -3
- package/dist/runtime/components/MongocampIndexes.vue +54 -13
- package/dist/runtime/components/MongocampJobs.vue +14 -3
- package/dist/runtime/components/MongocampRoleGrants.vue +16 -3
- package/dist/runtime/components/MongocampRoles.vue +13 -2
- package/dist/runtime/components/MongocampServerInfo.d.vue.ts +24 -0
- package/dist/runtime/components/MongocampServerInfo.vue +331 -0
- package/dist/runtime/components/MongocampServerInfo.vue.d.ts +24 -0
- package/dist/runtime/components/MongocampServerOverview.vue +16 -39
- package/dist/runtime/components/MongocampSettings.d.vue.ts +3 -0
- package/dist/runtime/components/MongocampSettings.vue +14 -2
- package/dist/runtime/components/MongocampSettings.vue.d.ts +3 -0
- package/dist/runtime/components/MongocampUsers.vue +16 -3
- package/dist/runtime/components/MongocampVersion.d.vue.ts +7 -1
- package/dist/runtime/components/MongocampVersion.vue +49 -19
- package/dist/runtime/components/MongocampVersion.vue.d.ts +7 -1
- package/dist/runtime/composables/useMongocampAdminGate.d.ts +12 -0
- package/dist/runtime/composables/useMongocampAdminGate.js +12 -0
- package/dist/runtime/composables/useMongocampAggregation.d.ts +11 -0
- package/dist/runtime/composables/useMongocampAggregation.js +12 -5
- package/dist/runtime/composables/useMongocampBulkByFilter.d.ts +15 -0
- package/dist/runtime/composables/useMongocampBulkByFilter.js +32 -0
- package/dist/runtime/composables/useMongocampCollectionCopy.d.ts +25 -65
- package/dist/runtime/composables/useMongocampCollectionCopy.js +27 -84
- package/dist/runtime/composables/useMongocampExportAll.d.ts +27 -21
- package/dist/runtime/composables/useMongocampExportAll.js +51 -21
- package/dist/runtime/composables/useMongocampExtendedJson.d.ts +2 -1
- package/dist/runtime/composables/useMongocampExtendedJson.js +32 -5
- package/dist/runtime/composables/useMongocampFetchAll.js +1 -1
- package/dist/runtime/composables/useMongocampFieldTypes.d.ts +24 -0
- package/dist/runtime/composables/useMongocampFieldTypes.js +44 -0
- package/dist/runtime/composables/useMongocampImport.d.ts +4 -0
- package/dist/runtime/composables/useMongocampImport.js +5 -2
- package/dist/runtime/composables/useMongocampIndex.d.ts +6 -1
- package/dist/runtime/composables/useMongocampIndex.js +7 -1
- package/dist/runtime/composables/useMongocampPermissions.d.ts +8 -5
- package/dist/runtime/composables/useMongocampPermissions.js +24 -2
- package/dist/runtime/composables/useMongocampQuery.d.ts +3 -3
- package/dist/runtime/composables/useMongocampServerOverview.d.ts +4 -11
- package/dist/runtime/composables/useMongocampServerOverview.js +12 -22
- package/dist/runtime/composables/useMongocampSystem.d.ts +10 -1
- package/dist/runtime/composables/useMongocampSystem.js +11 -1
- package/dist/runtime/locales/de.json +104 -71
- package/dist/runtime/locales/en.json +104 -71
- package/dist/runtime/plugin.d.ts +2 -2
- package/dist/runtime/utils/aggregationErrors.d.ts +4 -0
- package/dist/runtime/utils/aggregationErrors.js +7 -0
- package/dist/runtime/utils/batchInsert.d.ts +6 -0
- package/dist/runtime/utils/batchInsert.js +31 -3
- package/dist/runtime/utils/bsonTypes.d.ts +10 -0
- package/dist/runtime/utils/bsonTypes.js +42 -0
- package/dist/runtime/utils/collectionCopy.d.ts +0 -2
- package/dist/runtime/utils/collectionCopy.js +0 -1
- package/dist/runtime/utils/configRows.d.ts +7 -0
- package/dist/runtime/utils/configRows.js +4 -0
- package/dist/runtime/utils/documentCompare.js +2 -1
- package/dist/runtime/utils/documentPaths.d.ts +5 -8
- package/dist/runtime/utils/documentPaths.js +5 -10
- package/dist/runtime/utils/documentTree.js +9 -1
- package/dist/runtime/utils/exportDocuments.d.ts +0 -2
- package/dist/runtime/utils/exportDocuments.js +0 -1
- package/dist/runtime/utils/exportRows.d.ts +2 -0
- package/dist/runtime/utils/exportRows.js +5 -2
- package/dist/runtime/utils/fieldDetails.d.ts +51 -0
- package/dist/runtime/utils/fieldDetails.js +113 -0
- package/dist/runtime/utils/indexForm.d.ts +47 -33
- package/dist/runtime/utils/indexForm.js +32 -21
- package/dist/runtime/utils/serverInfo.d.ts +8 -0
- package/dist/runtime/utils/serverInfo.js +21 -0
- package/package.json +11 -11
- package/dist/runtime/utils/indexCopy.d.ts +0 -26
- package/dist/runtime/utils/indexCopy.js +0 -22
- package/dist/runtime/utils/limitedMap.d.ts +0 -17
- package/dist/runtime/utils/limitedMap.js +0 -19
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, onMounted, ref, watch } from "vue";
|
|
3
|
+
import { useI18n, useMongocampSystem } from "#imports";
|
|
4
|
+
import { useNuxtApp } from "#app";
|
|
5
|
+
import { useMongocampAutoRefresh } from "../composables/useMongocampAutoRefresh";
|
|
6
|
+
import { formatBytes } from "../utils/formatBytes";
|
|
7
|
+
import { connectionUsage, formatCount, formatUptime, OP_COUNTER_KEYS } from "../utils/serverInfo";
|
|
8
|
+
const props = defineProps({
|
|
9
|
+
hideHeading: { type: Boolean, required: false, default: false },
|
|
10
|
+
hideRefresh: { type: Boolean, required: false, default: false },
|
|
11
|
+
hideStats: { type: Boolean, required: false, default: false },
|
|
12
|
+
hideCapabilities: { type: Boolean, required: false, default: false },
|
|
13
|
+
autoRefresh: { type: Number, required: false, default: 0 }
|
|
14
|
+
});
|
|
15
|
+
const { t } = useI18n();
|
|
16
|
+
const { $mongocampVersion } = useNuxtApp();
|
|
17
|
+
const { getServerInfo, getStats, getCapabilities } = useMongocampSystem();
|
|
18
|
+
const version = computed(() => $mongocampVersion.value);
|
|
19
|
+
const mongoDbVersion = ref(null);
|
|
20
|
+
const stats = ref(null);
|
|
21
|
+
const capabilities = ref(null);
|
|
22
|
+
const loading = ref(false);
|
|
23
|
+
const failed = ref({ info: false, stats: false, capabilities: false });
|
|
24
|
+
const olderServer = ref(false);
|
|
25
|
+
function statusOf(error) {
|
|
26
|
+
return error?.response?.status;
|
|
27
|
+
}
|
|
28
|
+
async function load() {
|
|
29
|
+
const [info, loadedStats, loadedCapabilities] = await Promise.allSettled([
|
|
30
|
+
getServerInfo(),
|
|
31
|
+
props.hideStats ? Promise.resolve(null) : getStats(),
|
|
32
|
+
props.hideCapabilities ? Promise.resolve(null) : getCapabilities()
|
|
33
|
+
]);
|
|
34
|
+
mongoDbVersion.value = info.status === "fulfilled" ? info.value.mongoDbVersion || null : mongoDbVersion.value;
|
|
35
|
+
stats.value = loadedStats.status === "fulfilled" ? loadedStats.value : stats.value;
|
|
36
|
+
capabilities.value = loadedCapabilities.status === "fulfilled" ? loadedCapabilities.value : capabilities.value;
|
|
37
|
+
const missing = loadedCapabilities.status === "rejected" && [404, 405].includes(statusOf(loadedCapabilities.reason) ?? 0);
|
|
38
|
+
olderServer.value = missing;
|
|
39
|
+
failed.value = {
|
|
40
|
+
info: info.status === "rejected",
|
|
41
|
+
stats: loadedStats.status === "rejected",
|
|
42
|
+
capabilities: loadedCapabilities.status === "rejected" && !missing
|
|
43
|
+
};
|
|
44
|
+
if ([info, loadedStats, loadedCapabilities].every((r) => r.status === "rejected")) throw info.reason;
|
|
45
|
+
}
|
|
46
|
+
async function refresh() {
|
|
47
|
+
loading.value = true;
|
|
48
|
+
try {
|
|
49
|
+
await load();
|
|
50
|
+
} catch {
|
|
51
|
+
} finally {
|
|
52
|
+
loading.value = false;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
const { start, stop } = useMongocampAutoRefresh(load, { intervalMs: () => props.autoRefresh * 1e3 });
|
|
56
|
+
watch(() => props.autoRefresh, (seconds) => {
|
|
57
|
+
stop();
|
|
58
|
+
if (seconds > 0) start();
|
|
59
|
+
});
|
|
60
|
+
onMounted(() => {
|
|
61
|
+
refresh();
|
|
62
|
+
if (props.autoRefresh > 0) start();
|
|
63
|
+
});
|
|
64
|
+
const usage = computed(() => connectionUsage(stats.value?.connections?.current, stats.value?.connections?.available));
|
|
65
|
+
function opCount(counters2, key) {
|
|
66
|
+
return key === "delete" ? counters2._delete : counters2[key];
|
|
67
|
+
}
|
|
68
|
+
const counters = computed(() => OP_COUNTER_KEYS.map((key) => ({
|
|
69
|
+
key,
|
|
70
|
+
label: t(`nuxtUiMongocamp.serverInfo.op_${key}`),
|
|
71
|
+
value: stats.value?.opcounters ? formatCount(opCount(stats.value.opcounters, key)) : "-"
|
|
72
|
+
})));
|
|
73
|
+
const hasLoad = computed(() => !!stats.value && !stats.value.partial);
|
|
74
|
+
defineExpose({ refresh });
|
|
75
|
+
</script>
|
|
76
|
+
|
|
77
|
+
<template>
|
|
78
|
+
<div class="flex flex-col gap-4">
|
|
79
|
+
<div
|
|
80
|
+
v-if="!hideHeading || !hideRefresh"
|
|
81
|
+
class="flex items-center justify-between gap-4"
|
|
82
|
+
>
|
|
83
|
+
<h2 class="text-xl font-semibold">
|
|
84
|
+
<template v-if="!hideHeading">
|
|
85
|
+
{{ t("nuxtUiMongocamp.serverInfo.heading") }}
|
|
86
|
+
</template>
|
|
87
|
+
</h2>
|
|
88
|
+
<UTooltip
|
|
89
|
+
v-if="!hideRefresh"
|
|
90
|
+
:text="t('nuxtUiMongocamp.common.refresh')"
|
|
91
|
+
>
|
|
92
|
+
<UButton
|
|
93
|
+
icon="i-lucide-refresh-cw"
|
|
94
|
+
color="neutral"
|
|
95
|
+
variant="ghost"
|
|
96
|
+
:loading="loading"
|
|
97
|
+
:aria-label="t('nuxtUiMongocamp.common.refresh')"
|
|
98
|
+
@click="refresh"
|
|
99
|
+
/>
|
|
100
|
+
</UTooltip>
|
|
101
|
+
</div>
|
|
102
|
+
|
|
103
|
+
<UAlert
|
|
104
|
+
v-if="failed.info"
|
|
105
|
+
color="warning"
|
|
106
|
+
variant="subtle"
|
|
107
|
+
data-testid="info-failed"
|
|
108
|
+
:description="t('nuxtUiMongocamp.serverInfo.partFailed', { part: t('nuxtUiMongocamp.serverInfo.partInfo') })"
|
|
109
|
+
/>
|
|
110
|
+
<UAlert
|
|
111
|
+
v-if="failed.stats && !hideStats"
|
|
112
|
+
color="warning"
|
|
113
|
+
variant="subtle"
|
|
114
|
+
data-testid="stats-failed"
|
|
115
|
+
:description="t('nuxtUiMongocamp.serverInfo.partFailed', { part: t('nuxtUiMongocamp.serverInfo.partStats') })"
|
|
116
|
+
/>
|
|
117
|
+
<UAlert
|
|
118
|
+
v-if="failed.capabilities && !hideCapabilities"
|
|
119
|
+
color="warning"
|
|
120
|
+
variant="subtle"
|
|
121
|
+
data-testid="capabilities-failed"
|
|
122
|
+
:description="t('nuxtUiMongocamp.serverInfo.partFailed', { part: t('nuxtUiMongocamp.serverInfo.partCapabilities') })"
|
|
123
|
+
/>
|
|
124
|
+
|
|
125
|
+
<UCard>
|
|
126
|
+
<template #header>
|
|
127
|
+
<span class="font-semibold">{{ t("nuxtUiMongocamp.serverInfo.serverHeading") }}</span>
|
|
128
|
+
</template>
|
|
129
|
+
<dl class="grid grid-cols-1 gap-x-6 gap-y-2 text-sm sm:grid-cols-2">
|
|
130
|
+
<div class="flex justify-between gap-4">
|
|
131
|
+
<dt class="text-dimmed">
|
|
132
|
+
{{ t("nuxtUiMongocamp.serverInfo.mongocampVersion") }}
|
|
133
|
+
</dt>
|
|
134
|
+
<dd data-testid="mongocamp-version">
|
|
135
|
+
{{ version ? `${version.name} v${version.version}` : "-" }}
|
|
136
|
+
</dd>
|
|
137
|
+
</div>
|
|
138
|
+
<div class="flex justify-between gap-4">
|
|
139
|
+
<dt class="text-dimmed">
|
|
140
|
+
{{ t("nuxtUiMongocamp.serverInfo.mongoDbVersion") }}
|
|
141
|
+
</dt>
|
|
142
|
+
<dd data-testid="mongodb-version">
|
|
143
|
+
{{ mongoDbVersion ?? "-" }}
|
|
144
|
+
</dd>
|
|
145
|
+
</div>
|
|
146
|
+
<div
|
|
147
|
+
v-if="capabilities?.mongoDbMajor != null"
|
|
148
|
+
class="flex justify-between gap-4"
|
|
149
|
+
>
|
|
150
|
+
<dt class="text-dimmed">
|
|
151
|
+
{{ t("nuxtUiMongocamp.serverInfo.mongoDbMajor") }}
|
|
152
|
+
</dt>
|
|
153
|
+
<dd>{{ capabilities.mongoDbMajor }}</dd>
|
|
154
|
+
</div>
|
|
155
|
+
<div
|
|
156
|
+
v-if="hasLoad && stats?.uptimeSeconds != null"
|
|
157
|
+
class="flex justify-between gap-4"
|
|
158
|
+
>
|
|
159
|
+
<dt class="text-dimmed">
|
|
160
|
+
{{ t("nuxtUiMongocamp.serverInfo.uptime") }}
|
|
161
|
+
</dt>
|
|
162
|
+
<dd data-testid="uptime">
|
|
163
|
+
{{ formatUptime(stats.uptimeSeconds) }}
|
|
164
|
+
</dd>
|
|
165
|
+
</div>
|
|
166
|
+
<div
|
|
167
|
+
v-if="stats?.replicaSet"
|
|
168
|
+
class="flex justify-between gap-4"
|
|
169
|
+
>
|
|
170
|
+
<dt class="text-dimmed">
|
|
171
|
+
{{ t("nuxtUiMongocamp.serverInfo.replicaSet") }}
|
|
172
|
+
</dt>
|
|
173
|
+
<dd class="flex flex-wrap items-center justify-end gap-2">
|
|
174
|
+
<span>{{ stats.replicaSet.name }}</span>
|
|
175
|
+
<UBadge
|
|
176
|
+
:label="stats.replicaSet.state"
|
|
177
|
+
color="neutral"
|
|
178
|
+
variant="subtle"
|
|
179
|
+
/>
|
|
180
|
+
<span class="text-dimmed">{{ t("nuxtUiMongocamp.serverInfo.replicaMembers", { healthy: stats.replicaSet.healthyMembers, count: stats.replicaSet.memberCount }) }}</span>
|
|
181
|
+
</dd>
|
|
182
|
+
</div>
|
|
183
|
+
</dl>
|
|
184
|
+
</UCard>
|
|
185
|
+
|
|
186
|
+
<UCard v-if="!hideStats && stats">
|
|
187
|
+
<template #header>
|
|
188
|
+
<span class="font-semibold">{{ t("nuxtUiMongocamp.serverInfo.statsHeading") }}</span>
|
|
189
|
+
</template>
|
|
190
|
+
<UAlert
|
|
191
|
+
v-if="stats.partial"
|
|
192
|
+
color="info"
|
|
193
|
+
variant="subtle"
|
|
194
|
+
data-testid="stats-partial"
|
|
195
|
+
:description="t('nuxtUiMongocamp.serverInfo.partialNote')"
|
|
196
|
+
/>
|
|
197
|
+
<div
|
|
198
|
+
v-else
|
|
199
|
+
class="flex flex-col gap-4"
|
|
200
|
+
>
|
|
201
|
+
<div
|
|
202
|
+
v-if="stats.connections"
|
|
203
|
+
class="flex flex-col gap-2"
|
|
204
|
+
>
|
|
205
|
+
<div class="text-sm font-medium">
|
|
206
|
+
{{ t("nuxtUiMongocamp.serverInfo.connections") }}
|
|
207
|
+
</div>
|
|
208
|
+
<UProgress
|
|
209
|
+
v-if="usage != null"
|
|
210
|
+
:model-value="usage"
|
|
211
|
+
:aria-label="t('nuxtUiMongocamp.serverInfo.connections')"
|
|
212
|
+
/>
|
|
213
|
+
<dl class="grid grid-cols-1 gap-2 text-sm sm:grid-cols-3">
|
|
214
|
+
<div class="flex justify-between gap-4">
|
|
215
|
+
<dt class="text-dimmed">
|
|
216
|
+
{{ t("nuxtUiMongocamp.serverInfo.connectionsCurrent") }}
|
|
217
|
+
</dt>
|
|
218
|
+
<dd data-testid="connections-current">
|
|
219
|
+
{{ formatCount(stats.connections.current) }}
|
|
220
|
+
</dd>
|
|
221
|
+
</div>
|
|
222
|
+
<div class="flex justify-between gap-4">
|
|
223
|
+
<dt class="text-dimmed">
|
|
224
|
+
{{ t("nuxtUiMongocamp.serverInfo.connectionsAvailable") }}
|
|
225
|
+
</dt>
|
|
226
|
+
<dd>{{ formatCount(stats.connections.available) }}</dd>
|
|
227
|
+
</div>
|
|
228
|
+
<div class="flex justify-between gap-4">
|
|
229
|
+
<dt class="text-dimmed">
|
|
230
|
+
{{ t("nuxtUiMongocamp.serverInfo.connectionsTotal") }}
|
|
231
|
+
</dt>
|
|
232
|
+
<dd>{{ formatCount(stats.connections.totalCreated) }}</dd>
|
|
233
|
+
</div>
|
|
234
|
+
</dl>
|
|
235
|
+
</div>
|
|
236
|
+
<div v-if="stats.opcounters">
|
|
237
|
+
<div class="mb-2 text-sm font-medium">
|
|
238
|
+
{{ t("nuxtUiMongocamp.serverInfo.opCounters") }}
|
|
239
|
+
</div>
|
|
240
|
+
<dl class="grid grid-cols-2 gap-2 text-sm sm:grid-cols-3">
|
|
241
|
+
<div
|
|
242
|
+
v-for="counter in counters"
|
|
243
|
+
:key="counter.key"
|
|
244
|
+
class="flex justify-between gap-4"
|
|
245
|
+
>
|
|
246
|
+
<dt class="text-dimmed">
|
|
247
|
+
{{ counter.label }}
|
|
248
|
+
</dt>
|
|
249
|
+
<dd :data-testid="`op-${counter.key}`">
|
|
250
|
+
{{ counter.value }}
|
|
251
|
+
</dd>
|
|
252
|
+
</div>
|
|
253
|
+
</dl>
|
|
254
|
+
</div>
|
|
255
|
+
</div>
|
|
256
|
+
</UCard>
|
|
257
|
+
|
|
258
|
+
<UAlert
|
|
259
|
+
v-if="olderServer && !hideCapabilities"
|
|
260
|
+
color="neutral"
|
|
261
|
+
variant="subtle"
|
|
262
|
+
data-testid="older-server"
|
|
263
|
+
:description="t('nuxtUiMongocamp.serverInfo.olderServer')"
|
|
264
|
+
/>
|
|
265
|
+
<UCard v-if="!hideCapabilities && capabilities">
|
|
266
|
+
<template #header>
|
|
267
|
+
<span class="font-semibold">{{ t("nuxtUiMongocamp.serverInfo.capabilitiesHeading") }}</span>
|
|
268
|
+
</template>
|
|
269
|
+
<div class="flex flex-col gap-4">
|
|
270
|
+
<div v-if="capabilities.features?.length">
|
|
271
|
+
<div class="mb-2 text-sm font-medium">
|
|
272
|
+
{{ t("nuxtUiMongocamp.serverInfo.features") }}
|
|
273
|
+
</div>
|
|
274
|
+
<div
|
|
275
|
+
class="flex flex-wrap gap-1.5"
|
|
276
|
+
data-testid="features"
|
|
277
|
+
>
|
|
278
|
+
<UBadge
|
|
279
|
+
v-for="feature in capabilities.features"
|
|
280
|
+
:key="feature"
|
|
281
|
+
:label="feature"
|
|
282
|
+
color="primary"
|
|
283
|
+
variant="subtle"
|
|
284
|
+
/>
|
|
285
|
+
</div>
|
|
286
|
+
</div>
|
|
287
|
+
<div>
|
|
288
|
+
<div class="mb-2 text-sm font-medium">
|
|
289
|
+
{{ t("nuxtUiMongocamp.serverInfo.limits") }}
|
|
290
|
+
</div>
|
|
291
|
+
<dl class="grid grid-cols-1 gap-2 text-sm sm:grid-cols-2">
|
|
292
|
+
<div class="flex justify-between gap-4">
|
|
293
|
+
<dt class="text-dimmed">
|
|
294
|
+
{{ t("nuxtUiMongocamp.serverInfo.importMaxBytes") }}
|
|
295
|
+
</dt>
|
|
296
|
+
<dd data-testid="import-max">
|
|
297
|
+
{{ formatBytes(capabilities.limits.importMaxBytes) }}
|
|
298
|
+
</dd>
|
|
299
|
+
</div>
|
|
300
|
+
<div class="flex justify-between gap-4">
|
|
301
|
+
<dt class="text-dimmed">
|
|
302
|
+
{{ t("nuxtUiMongocamp.serverInfo.grantDeniedStatus") }}
|
|
303
|
+
</dt>
|
|
304
|
+
<dd data-testid="grant-denied">
|
|
305
|
+
{{ capabilities.limits.grantDeniedStatus }}
|
|
306
|
+
</dd>
|
|
307
|
+
</div>
|
|
308
|
+
</dl>
|
|
309
|
+
</div>
|
|
310
|
+
<div v-if="capabilities.aggregationStagesDenied?.length">
|
|
311
|
+
<div class="mb-2 text-sm font-medium">
|
|
312
|
+
{{ t("nuxtUiMongocamp.serverInfo.deniedStages") }}
|
|
313
|
+
</div>
|
|
314
|
+
<div
|
|
315
|
+
class="flex flex-wrap gap-1.5"
|
|
316
|
+
data-testid="denied-stages"
|
|
317
|
+
>
|
|
318
|
+
<UBadge
|
|
319
|
+
v-for="stage in capabilities.aggregationStagesDenied"
|
|
320
|
+
:key="stage"
|
|
321
|
+
:label="stage"
|
|
322
|
+
color="error"
|
|
323
|
+
variant="subtle"
|
|
324
|
+
class="font-mono"
|
|
325
|
+
/>
|
|
326
|
+
</div>
|
|
327
|
+
</div>
|
|
328
|
+
</div>
|
|
329
|
+
</UCard>
|
|
330
|
+
</div>
|
|
331
|
+
</template>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
/** Hide the "Server information" heading. */
|
|
3
|
+
hideHeading?: boolean;
|
|
4
|
+
/** Hide the refresh button. */
|
|
5
|
+
hideRefresh?: boolean;
|
|
6
|
+
/** Hide the database load card (uptime, connections, counters, replica set — the request is skipped too). */
|
|
7
|
+
hideStats?: boolean;
|
|
8
|
+
/** Hide the capabilities card (features, limits, refused operators — the request is skipped too). */
|
|
9
|
+
hideCapabilities?: boolean;
|
|
10
|
+
/** Reload the numbers every N seconds (at least 1; 0 = off). Pauses while the tab is hidden and slows down after failures. */
|
|
11
|
+
autoRefresh?: number;
|
|
12
|
+
};
|
|
13
|
+
declare function refresh(): Promise<void>;
|
|
14
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
|
|
15
|
+
refresh: typeof refresh;
|
|
16
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
17
|
+
autoRefresh: number;
|
|
18
|
+
hideHeading: boolean;
|
|
19
|
+
hideRefresh: boolean;
|
|
20
|
+
hideStats: boolean;
|
|
21
|
+
hideCapabilities: boolean;
|
|
22
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
23
|
+
declare const _default: typeof __VLS_export;
|
|
24
|
+
export default _default;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { computed, onBeforeUnmount, onMounted, ref, watch } from "vue";
|
|
3
3
|
import { useI18n } from "#imports";
|
|
4
4
|
import { useMongocampAutoRefresh } from "../composables/useMongocampAutoRefresh";
|
|
5
|
+
import { useMongocampAdminGate } from "../composables/useMongocampAdminGate";
|
|
5
6
|
import { useMongocampServerOverview } from "../composables/useMongocampServerOverview";
|
|
6
7
|
import { formatBytes } from "../utils/formatBytes";
|
|
7
8
|
import { BYTE_METRICS, nextJobs, overviewTotals, rankCollections, RANK_METRICS, shareSlices } from "../utils/serverOverview";
|
|
@@ -18,44 +19,34 @@ const { t, locale } = useI18n();
|
|
|
18
19
|
const { loadOverview } = useMongocampServerOverview();
|
|
19
20
|
const overview = ref(null);
|
|
20
21
|
const loading = ref(false);
|
|
21
|
-
const progress = ref(null);
|
|
22
22
|
const rankBy = ref("storageSize");
|
|
23
23
|
let controller;
|
|
24
|
-
async function load(
|
|
24
|
+
async function load() {
|
|
25
25
|
controller?.abort();
|
|
26
26
|
const own = new AbortController();
|
|
27
27
|
controller = own;
|
|
28
28
|
loading.value = true;
|
|
29
|
-
if (!options.silent) progress.value = null;
|
|
30
29
|
try {
|
|
31
30
|
const result = await loadOverview({
|
|
32
31
|
maxCollections: props.maxCollections,
|
|
33
|
-
signal: own.signal
|
|
34
|
-
onProgress: (p) => {
|
|
35
|
-
if (controller === own && !options.silent) progress.value = p;
|
|
36
|
-
}
|
|
32
|
+
signal: own.signal
|
|
37
33
|
});
|
|
38
34
|
if (controller === own) overview.value = result;
|
|
39
35
|
} catch (e) {
|
|
40
36
|
if (own.signal.aborted) return;
|
|
41
37
|
throw e;
|
|
42
38
|
} finally {
|
|
43
|
-
if (controller === own)
|
|
44
|
-
loading.value = false;
|
|
45
|
-
progress.value = null;
|
|
46
|
-
}
|
|
39
|
+
if (controller === own) loading.value = false;
|
|
47
40
|
}
|
|
48
41
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
const auto = useMongocampAutoRefresh(() => load({ silent: true }), { intervalMs: () => props.autoRefresh * 1e3 });
|
|
42
|
+
const { blocked, message } = useMongocampAdminGate();
|
|
43
|
+
const auto = useMongocampAutoRefresh(() => load(), { intervalMs: () => props.autoRefresh * 1e3 });
|
|
53
44
|
function syncAutoRefresh() {
|
|
54
45
|
auto.stop();
|
|
55
|
-
if (props.autoRefresh > 0) auto.start();
|
|
46
|
+
if (!blocked.value && props.autoRefresh > 0) auto.start();
|
|
56
47
|
}
|
|
57
48
|
onMounted(() => {
|
|
58
|
-
void load();
|
|
49
|
+
if (!blocked.value) void load();
|
|
59
50
|
syncAutoRefresh();
|
|
60
51
|
});
|
|
61
52
|
watch(() => props.autoRefresh, syncAutoRefresh);
|
|
@@ -89,7 +80,14 @@ const seriesMetric = computed(() => [{ key: "value", label: metricLabel.value }]
|
|
|
89
80
|
</script>
|
|
90
81
|
|
|
91
82
|
<template>
|
|
83
|
+
<MongocampEmptyState
|
|
84
|
+
v-if="blocked"
|
|
85
|
+
icon="i-lucide-shield-alert"
|
|
86
|
+
:title="message"
|
|
87
|
+
data-test="admin-only"
|
|
88
|
+
/>
|
|
92
89
|
<div
|
|
90
|
+
v-else
|
|
93
91
|
class="flex flex-col gap-6"
|
|
94
92
|
data-test="server-overview"
|
|
95
93
|
>
|
|
@@ -106,33 +104,12 @@ const seriesMetric = computed(() => [{ key: "value", label: metricLabel.value }]
|
|
|
106
104
|
icon="i-lucide-refresh-cw"
|
|
107
105
|
color="neutral"
|
|
108
106
|
variant="ghost"
|
|
109
|
-
:loading="loading
|
|
107
|
+
:loading="loading"
|
|
110
108
|
:aria-label="t('nuxtUiMongocamp.common.refresh')"
|
|
111
109
|
@click="load()"
|
|
112
110
|
/>
|
|
113
111
|
</div>
|
|
114
112
|
|
|
115
|
-
<div
|
|
116
|
-
v-if="progress"
|
|
117
|
-
class="flex items-center gap-3"
|
|
118
|
-
role="status"
|
|
119
|
-
data-test="overview-progress"
|
|
120
|
-
>
|
|
121
|
-
<UProgress
|
|
122
|
-
:model-value="progress.done"
|
|
123
|
-
:max="progress.total"
|
|
124
|
-
class="flex-1"
|
|
125
|
-
/>
|
|
126
|
-
<span class="text-sm text-dimmed">{{ t("nuxtUiMongocamp.serverOverview.reading", progress) }}</span>
|
|
127
|
-
<UButton
|
|
128
|
-
:label="t('nuxtUiMongocamp.serverOverview.stop')"
|
|
129
|
-
color="neutral"
|
|
130
|
-
variant="soft"
|
|
131
|
-
size="sm"
|
|
132
|
-
@click="stop"
|
|
133
|
-
/>
|
|
134
|
-
</div>
|
|
135
|
-
|
|
136
113
|
<UAlert
|
|
137
114
|
v-for="part in failedParts"
|
|
138
115
|
:key="part"
|
|
@@ -13,6 +13,8 @@ type __VLS_Props = {
|
|
|
13
13
|
hideSearch?: boolean;
|
|
14
14
|
/** Hide the note that secret values are masked. */
|
|
15
15
|
hideMaskedNote?: boolean;
|
|
16
|
+
/** Hide the hint that the server answers a missing grant with 401 (`AUTH_GRANT_DENIED_STATUS`). */
|
|
17
|
+
hideGrantHint?: boolean;
|
|
16
18
|
};
|
|
17
19
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
18
20
|
hideHeading: boolean;
|
|
@@ -22,6 +24,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
22
24
|
hideConfigurations: boolean;
|
|
23
25
|
hideSearch: boolean;
|
|
24
26
|
hideMaskedNote: boolean;
|
|
27
|
+
hideGrantHint: boolean;
|
|
25
28
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
26
29
|
declare const _default: typeof __VLS_export;
|
|
27
30
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed, h, ref, resolveComponent, watch } from "vue";
|
|
3
3
|
import { useI18n, useMongocampRoles, useMongocampSystem } from "#imports";
|
|
4
|
-
import { MASKED_VALUE } from "../utils/configRows";
|
|
4
|
+
import { grantStatusHint, MASKED_VALUE } from "../utils/configRows";
|
|
5
5
|
const PAGE_SIZE = 10;
|
|
6
6
|
const props = defineProps({
|
|
7
7
|
hideHeading: { type: Boolean, required: false, default: false },
|
|
@@ -10,7 +10,8 @@ const props = defineProps({
|
|
|
10
10
|
hideCluster: { type: Boolean, required: false, default: false },
|
|
11
11
|
hideConfigurations: { type: Boolean, required: false, default: false },
|
|
12
12
|
hideSearch: { type: Boolean, required: false, default: false },
|
|
13
|
-
hideMaskedNote: { type: Boolean, required: false, default: false }
|
|
13
|
+
hideMaskedNote: { type: Boolean, required: false, default: false },
|
|
14
|
+
hideGrantHint: { type: Boolean, required: false, default: false }
|
|
14
15
|
});
|
|
15
16
|
const { t } = useI18n();
|
|
16
17
|
const { getSettings, listConfigurations, getCluster } = useMongocampSystem();
|
|
@@ -21,6 +22,7 @@ const cluster = ref(null);
|
|
|
21
22
|
const loading = ref(false);
|
|
22
23
|
const loadError = ref(null);
|
|
23
24
|
const search = ref("");
|
|
25
|
+
const showGrantHint = computed(() => grantStatusHint(configurations.value));
|
|
24
26
|
const page = ref(1);
|
|
25
27
|
async function fetchSettings() {
|
|
26
28
|
if (!isAdmin.value) return;
|
|
@@ -214,6 +216,16 @@ fetchSettings();
|
|
|
214
216
|
</p>
|
|
215
217
|
</div>
|
|
216
218
|
|
|
219
|
+
<UAlert
|
|
220
|
+
v-if="!hideConfigurations && !hideGrantHint && showGrantHint"
|
|
221
|
+
color="info"
|
|
222
|
+
variant="subtle"
|
|
223
|
+
icon="i-lucide-info"
|
|
224
|
+
:title="t('nuxtUiMongocamp.settings.grantHintTitle')"
|
|
225
|
+
:description="t('nuxtUiMongocamp.settings.grantHint')"
|
|
226
|
+
data-test="grant-hint"
|
|
227
|
+
/>
|
|
228
|
+
|
|
217
229
|
<UTable
|
|
218
230
|
v-if="!hideConfigurations"
|
|
219
231
|
:data="pageRows"
|
|
@@ -13,6 +13,8 @@ type __VLS_Props = {
|
|
|
13
13
|
hideSearch?: boolean;
|
|
14
14
|
/** Hide the note that secret values are masked. */
|
|
15
15
|
hideMaskedNote?: boolean;
|
|
16
|
+
/** Hide the hint that the server answers a missing grant with 401 (`AUTH_GRANT_DENIED_STATUS`). */
|
|
17
|
+
hideGrantHint?: boolean;
|
|
16
18
|
};
|
|
17
19
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
18
20
|
hideHeading: boolean;
|
|
@@ -22,6 +24,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
22
24
|
hideConfigurations: boolean;
|
|
23
25
|
hideSearch: boolean;
|
|
24
26
|
hideMaskedNote: boolean;
|
|
27
|
+
hideGrantHint: boolean;
|
|
25
28
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
26
29
|
declare const _default: typeof __VLS_export;
|
|
27
30
|
export default _default;
|
|
@@ -4,6 +4,7 @@ import { useI18n, useMongocampError, useMongocampStorage, useToast } from "#impo
|
|
|
4
4
|
import useMongocampAdmin from "../composables/useMongocampAdmin";
|
|
5
5
|
import { runBulkDelete } from "../utils/bulkDelete";
|
|
6
6
|
import { createSelectColumn } from "../utils/createSelectColumn";
|
|
7
|
+
import { useMongocampAdminGate } from "../composables/useMongocampAdminGate";
|
|
7
8
|
const { t } = useI18n();
|
|
8
9
|
const { listUsers, addUser, deleteUser, updateUserRoles, updateUserPassword, listRoles, regenerateUserApiKey } = useMongocampAdmin();
|
|
9
10
|
const toast = useToast();
|
|
@@ -107,6 +108,7 @@ async function handleBulkDelete() {
|
|
|
107
108
|
bulkDeleting.value = false;
|
|
108
109
|
}
|
|
109
110
|
}
|
|
111
|
+
const { blocked, message } = useMongocampAdminGate();
|
|
110
112
|
async function fetchUsers() {
|
|
111
113
|
loading.value = true;
|
|
112
114
|
loadError.value = null;
|
|
@@ -327,12 +329,23 @@ const columns = computed(() => [
|
|
|
327
329
|
])
|
|
328
330
|
}
|
|
329
331
|
]);
|
|
330
|
-
|
|
331
|
-
|
|
332
|
+
if (!blocked.value) {
|
|
333
|
+
fetchUsers();
|
|
334
|
+
fetchRoles();
|
|
335
|
+
}
|
|
332
336
|
</script>
|
|
333
337
|
|
|
334
338
|
<template>
|
|
335
|
-
<
|
|
339
|
+
<MongocampEmptyState
|
|
340
|
+
v-if="blocked"
|
|
341
|
+
icon="i-lucide-shield-alert"
|
|
342
|
+
:title="message"
|
|
343
|
+
data-test="admin-only"
|
|
344
|
+
/>
|
|
345
|
+
<div
|
|
346
|
+
v-else
|
|
347
|
+
class="flex flex-col gap-4"
|
|
348
|
+
>
|
|
336
349
|
<div class="flex items-center justify-between gap-4">
|
|
337
350
|
<h2 class="text-xl font-semibold">
|
|
338
351
|
{{ t("nuxtUiMongocamp.users.heading") }}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
/** Hide the MongoDB version badge (it is also hidden while the server cannot tell, e.g. before login or below server 1.9.0). */
|
|
3
|
+
hideDatabase?: boolean;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
6
|
+
hideDatabase: boolean;
|
|
7
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
2
8
|
declare const _default: typeof __VLS_export;
|
|
3
9
|
export default _default;
|
|
@@ -1,27 +1,57 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed } from "vue";
|
|
3
|
-
import { useI18n } from "#imports";
|
|
4
|
-
import { useNuxtApp } from "#app";
|
|
2
|
+
import { computed, ref, watch } from "vue";
|
|
3
|
+
import { useI18n, useMongocampStorage, useMongocampSystem } from "#imports";
|
|
4
|
+
import { useNuxtApp, useRuntimeConfig } from "#app";
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
hideDatabase: { type: Boolean, required: false, default: false }
|
|
7
|
+
});
|
|
5
8
|
const { t } = useI18n();
|
|
6
9
|
const { $mongocampVersion } = useNuxtApp();
|
|
10
|
+
const { getServerInfo } = useMongocampSystem();
|
|
11
|
+
const state = useMongocampStorage();
|
|
12
|
+
const isProxyMode = useRuntimeConfig().public.nuxtUiMongocampOptions?.useServerProxy ?? false;
|
|
7
13
|
const version = computed(() => $mongocampVersion.value);
|
|
14
|
+
const mongoDbVersion = ref(null);
|
|
15
|
+
const canAsk = computed(() => !props.hideDatabase && (isProxyMode || !!state.value?.profile));
|
|
16
|
+
watch(canAsk, async (ask) => {
|
|
17
|
+
if (!ask) {
|
|
18
|
+
mongoDbVersion.value = null;
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
mongoDbVersion.value = (await getServerInfo()).mongoDbVersion || null;
|
|
23
|
+
} catch {
|
|
24
|
+
mongoDbVersion.value = null;
|
|
25
|
+
}
|
|
26
|
+
}, { immediate: true });
|
|
8
27
|
</script>
|
|
9
28
|
|
|
10
29
|
<template>
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
30
|
+
<span class="inline-flex items-center gap-1.5">
|
|
31
|
+
<UBadge
|
|
32
|
+
v-if="version"
|
|
33
|
+
color="primary"
|
|
34
|
+
variant="subtle"
|
|
35
|
+
icon="i-lucide-database"
|
|
36
|
+
>
|
|
37
|
+
{{ version.name }} v{{ version.version }}
|
|
38
|
+
</UBadge>
|
|
39
|
+
<UBadge
|
|
40
|
+
v-else
|
|
41
|
+
color="neutral"
|
|
42
|
+
variant="subtle"
|
|
43
|
+
icon="i-lucide-database-zap"
|
|
44
|
+
>
|
|
45
|
+
{{ t("nuxtUiMongocamp.version.unavailable") }}
|
|
46
|
+
</UBadge>
|
|
47
|
+
<UBadge
|
|
48
|
+
v-if="mongoDbVersion"
|
|
49
|
+
color="neutral"
|
|
50
|
+
variant="subtle"
|
|
51
|
+
icon="i-simple-icons-mongodb"
|
|
52
|
+
data-testid="mongodb-version"
|
|
53
|
+
>
|
|
54
|
+
MongoDB {{ mongoDbVersion }}
|
|
55
|
+
</UBadge>
|
|
56
|
+
</span>
|
|
27
57
|
</template>
|