@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,301 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, ref } from "vue";
|
|
3
|
+
import { useI18n } from "#imports";
|
|
4
|
+
import useMongocampAdmin from "../composables/useMongocampAdmin";
|
|
5
|
+
import {
|
|
6
|
+
buildPermissionMatrix,
|
|
7
|
+
cellLetters,
|
|
8
|
+
collectionsNobodyCan,
|
|
9
|
+
filterMatrix,
|
|
10
|
+
matrixToCsvRows,
|
|
11
|
+
QUICK_VIEWS,
|
|
12
|
+
usersWithoutRoles
|
|
13
|
+
} from "../utils/permissionMatrix";
|
|
14
|
+
import { downloadTextFile, rowsToCsv } from "../utils/exportRows";
|
|
15
|
+
import { isBucketMemberCollection } from "../utils/collectionProtection";
|
|
16
|
+
const props = defineProps({
|
|
17
|
+
grantsPath: { type: String, required: false, default: "/secured/admin/roles" },
|
|
18
|
+
maxCollections: { type: Number, required: false, default: 60 },
|
|
19
|
+
maxUsers: { type: Number, required: false, default: 200 }
|
|
20
|
+
});
|
|
21
|
+
const { t } = useI18n();
|
|
22
|
+
const { listUsers, listRoles, listCollections } = useMongocampAdmin();
|
|
23
|
+
const matrix = ref(null);
|
|
24
|
+
const roleNames = ref([]);
|
|
25
|
+
const loading = ref(false);
|
|
26
|
+
const loadError = ref(null);
|
|
27
|
+
async function load() {
|
|
28
|
+
loading.value = true;
|
|
29
|
+
loadError.value = null;
|
|
30
|
+
try {
|
|
31
|
+
const [users2, roles, collections2] = await Promise.all([listUsers(), listRoles(), listCollections()]);
|
|
32
|
+
matrix.value = buildPermissionMatrix(users2, roles, collections2.filter((name) => !name.startsWith("mc_")));
|
|
33
|
+
roleNames.value = roles.map((role2) => role2.name).sort((a, b) => a.localeCompare(b));
|
|
34
|
+
} catch (e) {
|
|
35
|
+
loadError.value = e;
|
|
36
|
+
matrix.value = null;
|
|
37
|
+
} finally {
|
|
38
|
+
loading.value = false;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
void load();
|
|
42
|
+
const ALL_ROLES = "__all__";
|
|
43
|
+
const text = ref("");
|
|
44
|
+
const role = ref(ALL_ROLES);
|
|
45
|
+
const view = ref("all");
|
|
46
|
+
const swapped = ref(false);
|
|
47
|
+
const filter = computed(() => ({ text: text.value, role: role.value === ALL_ROLES ? void 0 : role.value, view: view.value }));
|
|
48
|
+
const shown = computed(() => matrix.value ? filterMatrix(matrix.value, filter.value) : null);
|
|
49
|
+
const users = computed(() => shown.value?.users.slice(0, props.maxUsers) ?? []);
|
|
50
|
+
const collections = computed(() => shown.value?.collections.slice(0, props.maxCollections) ?? []);
|
|
51
|
+
const roleItems = computed(() => [{ value: ALL_ROLES, label: t("nuxtUiMongocamp.permissionMatrix.roleAll") }, ...roleNames.value.map((name) => ({ value: name, label: name }))]);
|
|
52
|
+
const viewCounts = computed(() => {
|
|
53
|
+
const m = matrix.value;
|
|
54
|
+
if (!m) return { "all": void 0, "users-without-roles": void 0, "collections-nobody-writes": void 0, "collections-nobody-reads": void 0 };
|
|
55
|
+
return {
|
|
56
|
+
"all": void 0,
|
|
57
|
+
"users-without-roles": usersWithoutRoles(m).length,
|
|
58
|
+
"collections-nobody-writes": collectionsNobodyCan(m, "write").length,
|
|
59
|
+
"collections-nobody-reads": collectionsNobodyCan(m, "read").length
|
|
60
|
+
};
|
|
61
|
+
});
|
|
62
|
+
const VIEW_KEYS = { "all": "viewAll", "users-without-roles": "viewNoRoles", "collections-nobody-writes": "viewNobodyWrites", "collections-nobody-reads": "viewNobodyReads" };
|
|
63
|
+
const viewLabel = (v) => t(`nuxtUiMongocamp.permissionMatrix.${VIEW_KEYS[v]}`);
|
|
64
|
+
function cellOf(userName, collection) {
|
|
65
|
+
return matrix.value?.cells[userName]?.[collection];
|
|
66
|
+
}
|
|
67
|
+
function cellTitle(cell) {
|
|
68
|
+
if (cell.admin) return t("nuxtUiMongocamp.permissionMatrix.cellAdmin");
|
|
69
|
+
const allowed = ["read", "write", "administrate"].filter((p) => cell[p] === true).map((p) => t(`nuxtUiMongocamp.permissionMatrix.cell${p.charAt(0).toUpperCase()}${p.slice(1)}`));
|
|
70
|
+
if (cell.read === void 0 && cell.write === void 0 && cell.administrate === void 0) return t("nuxtUiMongocamp.permissionMatrix.cellUnknown");
|
|
71
|
+
if (allowed.length === 0) return t("nuxtUiMongocamp.permissionMatrix.cellNone");
|
|
72
|
+
const via = cell.via.length > 0 ? t("nuxtUiMongocamp.permissionMatrix.via", { roles: cell.via.join(", ") }) : t("nuxtUiMongocamp.permissionMatrix.viaDirect");
|
|
73
|
+
return `${allowed.join(", ")} \u2014 ${via}`;
|
|
74
|
+
}
|
|
75
|
+
function cellClass(cell) {
|
|
76
|
+
if (cell.admin) return "font-semibold text-highlighted";
|
|
77
|
+
const any = cell.read === true || cell.write === true || cell.administrate === true;
|
|
78
|
+
return any ? "text-default" : "text-dimmed";
|
|
79
|
+
}
|
|
80
|
+
const rowLabels = computed(() => swapped.value ? collections.value : users.value.map((u) => u.name));
|
|
81
|
+
const columnLabels = computed(() => swapped.value ? users.value.map((u) => u.name) : collections.value);
|
|
82
|
+
function cellAtRowColumn(row, column) {
|
|
83
|
+
return swapped.value ? cellOf(column, row) : cellOf(row, column);
|
|
84
|
+
}
|
|
85
|
+
const userByName = computed(() => new Map((matrix.value?.users ?? []).map((u) => [u.name, u])));
|
|
86
|
+
const hasBucketParts = computed(() => collections.value.some(isBucketMemberCollection));
|
|
87
|
+
function exportCsv() {
|
|
88
|
+
if (!shown.value) return;
|
|
89
|
+
const { keys, rows } = matrixToCsvRows({ ...shown.value, users: users.value, collections: collections.value });
|
|
90
|
+
downloadTextFile(`permissions-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.csv`, rowsToCsv(rows, keys), "text/csv");
|
|
91
|
+
}
|
|
92
|
+
</script>
|
|
93
|
+
|
|
94
|
+
<template>
|
|
95
|
+
<div
|
|
96
|
+
class="flex flex-col gap-4"
|
|
97
|
+
data-test="permission-matrix"
|
|
98
|
+
>
|
|
99
|
+
<div class="flex flex-wrap items-start justify-between gap-2">
|
|
100
|
+
<div class="flex flex-col gap-1">
|
|
101
|
+
<h2 class="text-xl font-semibold">
|
|
102
|
+
{{ t("nuxtUiMongocamp.permissionMatrix.heading") }}
|
|
103
|
+
</h2>
|
|
104
|
+
<p class="text-sm text-dimmed">
|
|
105
|
+
{{ t("nuxtUiMongocamp.permissionMatrix.subtitle") }}
|
|
106
|
+
</p>
|
|
107
|
+
</div>
|
|
108
|
+
<div class="flex items-center gap-1">
|
|
109
|
+
<UButton
|
|
110
|
+
icon="i-lucide-arrow-left-right"
|
|
111
|
+
color="neutral"
|
|
112
|
+
variant="ghost"
|
|
113
|
+
:aria-pressed="swapped"
|
|
114
|
+
:aria-label="t('nuxtUiMongocamp.permissionMatrix.swap')"
|
|
115
|
+
:disabled="!matrix"
|
|
116
|
+
@click="swapped = !swapped"
|
|
117
|
+
/>
|
|
118
|
+
<UButton
|
|
119
|
+
icon="i-lucide-download"
|
|
120
|
+
color="neutral"
|
|
121
|
+
variant="ghost"
|
|
122
|
+
:aria-label="t('nuxtUiMongocamp.permissionMatrix.exportCsv')"
|
|
123
|
+
:disabled="!shown || users.length === 0 || collections.length === 0"
|
|
124
|
+
@click="exportCsv"
|
|
125
|
+
/>
|
|
126
|
+
<UButton
|
|
127
|
+
icon="i-lucide-refresh-cw"
|
|
128
|
+
color="neutral"
|
|
129
|
+
variant="ghost"
|
|
130
|
+
:loading="loading"
|
|
131
|
+
:aria-label="t('nuxtUiMongocamp.permissionMatrix.refresh')"
|
|
132
|
+
@click="load"
|
|
133
|
+
/>
|
|
134
|
+
</div>
|
|
135
|
+
</div>
|
|
136
|
+
|
|
137
|
+
<MongocampErrorAlert
|
|
138
|
+
:error="loadError"
|
|
139
|
+
@retry="load"
|
|
140
|
+
/>
|
|
141
|
+
|
|
142
|
+
<template v-if="matrix">
|
|
143
|
+
<div class="flex flex-wrap items-center gap-2">
|
|
144
|
+
<UInput
|
|
145
|
+
v-model="text"
|
|
146
|
+
icon="i-lucide-search"
|
|
147
|
+
size="sm"
|
|
148
|
+
class="w-64"
|
|
149
|
+
:placeholder="t('nuxtUiMongocamp.permissionMatrix.filterPlaceholder')"
|
|
150
|
+
:aria-label="t('nuxtUiMongocamp.permissionMatrix.filterPlaceholder')"
|
|
151
|
+
/>
|
|
152
|
+
<USelect
|
|
153
|
+
v-model="role"
|
|
154
|
+
:items="roleItems"
|
|
155
|
+
size="sm"
|
|
156
|
+
class="w-44"
|
|
157
|
+
:aria-label="t('nuxtUiMongocamp.permissionMatrix.roleLabel')"
|
|
158
|
+
/>
|
|
159
|
+
<div
|
|
160
|
+
class="flex flex-wrap items-center gap-1"
|
|
161
|
+
role="group"
|
|
162
|
+
:aria-label="t('nuxtUiMongocamp.permissionMatrix.viewLabel')"
|
|
163
|
+
>
|
|
164
|
+
<UButton
|
|
165
|
+
v-for="v in QUICK_VIEWS"
|
|
166
|
+
:key="v"
|
|
167
|
+
size="xs"
|
|
168
|
+
color="neutral"
|
|
169
|
+
:variant="view === v ? 'subtle' : 'ghost'"
|
|
170
|
+
:aria-pressed="view === v"
|
|
171
|
+
:label="viewCounts[v] === void 0 ? viewLabel(v) : `${viewLabel(v)} (${viewCounts[v]})`"
|
|
172
|
+
:data-test="`view-${v}`"
|
|
173
|
+
@click="view = v"
|
|
174
|
+
/>
|
|
175
|
+
</div>
|
|
176
|
+
</div>
|
|
177
|
+
|
|
178
|
+
<p class="text-xs text-dimmed">
|
|
179
|
+
<span data-test="matrix-summary">{{ t("nuxtUiMongocamp.permissionMatrix.summary", { users: users.length, collections: collections.length }) }}</span>
|
|
180
|
+
· {{ t("nuxtUiMongocamp.permissionMatrix.legend") }}
|
|
181
|
+
</p>
|
|
182
|
+
<p
|
|
183
|
+
v-if="view === 'collections-nobody-writes' || view === 'collections-nobody-reads'"
|
|
184
|
+
class="text-xs text-dimmed"
|
|
185
|
+
>
|
|
186
|
+
{{ t("nuxtUiMongocamp.permissionMatrix.nobodyNote") }}
|
|
187
|
+
</p>
|
|
188
|
+
<p
|
|
189
|
+
v-if="shown && shown.collections.length > collections.length"
|
|
190
|
+
class="text-sm text-warning"
|
|
191
|
+
data-test="capped-collections"
|
|
192
|
+
>
|
|
193
|
+
{{ t("nuxtUiMongocamp.permissionMatrix.cappedCollections", { shown: collections.length, total: shown.collections.length }) }}
|
|
194
|
+
</p>
|
|
195
|
+
<p
|
|
196
|
+
v-if="shown && shown.users.length > users.length"
|
|
197
|
+
class="text-sm text-warning"
|
|
198
|
+
data-test="capped-users"
|
|
199
|
+
>
|
|
200
|
+
{{ t("nuxtUiMongocamp.permissionMatrix.cappedUsers", { shown: users.length, total: shown.users.length }) }}
|
|
201
|
+
</p>
|
|
202
|
+
|
|
203
|
+
<p
|
|
204
|
+
v-if="matrix.users.length === 0 && matrix.collections.length === 0"
|
|
205
|
+
class="text-sm text-dimmed"
|
|
206
|
+
>
|
|
207
|
+
{{ t("nuxtUiMongocamp.permissionMatrix.nothingLoaded") }}
|
|
208
|
+
</p>
|
|
209
|
+
<p
|
|
210
|
+
v-else-if="rowLabels.length === 0 || columnLabels.length === 0"
|
|
211
|
+
class="text-sm text-dimmed"
|
|
212
|
+
data-test="matrix-empty"
|
|
213
|
+
>
|
|
214
|
+
{{ users.length === 0 ? t("nuxtUiMongocamp.permissionMatrix.noUsers") : t("nuxtUiMongocamp.permissionMatrix.noCollections") }}
|
|
215
|
+
</p>
|
|
216
|
+
<div
|
|
217
|
+
v-else
|
|
218
|
+
class="overflow-auto rounded-md border border-default"
|
|
219
|
+
>
|
|
220
|
+
<table
|
|
221
|
+
class="w-max min-w-full border-collapse text-sm"
|
|
222
|
+
data-test="matrix-table"
|
|
223
|
+
>
|
|
224
|
+
<thead>
|
|
225
|
+
<tr class="bg-elevated/50">
|
|
226
|
+
<th class="sticky left-0 z-10 bg-default px-3 py-2 text-left font-medium">
|
|
227
|
+
{{ swapped ? t("nuxtUiMongocamp.permissionMatrix.columnCollection") : t("nuxtUiMongocamp.permissionMatrix.columnUser") }}
|
|
228
|
+
</th>
|
|
229
|
+
<th
|
|
230
|
+
v-for="column in columnLabels"
|
|
231
|
+
:key="column"
|
|
232
|
+
class="max-w-40 truncate px-2 py-2 text-center font-medium"
|
|
233
|
+
:title="column"
|
|
234
|
+
scope="col"
|
|
235
|
+
>
|
|
236
|
+
{{ column }}
|
|
237
|
+
</th>
|
|
238
|
+
</tr>
|
|
239
|
+
</thead>
|
|
240
|
+
<tbody>
|
|
241
|
+
<tr
|
|
242
|
+
v-for="row in rowLabels"
|
|
243
|
+
:key="row"
|
|
244
|
+
class="border-t border-default"
|
|
245
|
+
:data-row="row"
|
|
246
|
+
>
|
|
247
|
+
<th
|
|
248
|
+
class="sticky left-0 z-10 bg-default px-3 py-1.5 text-left font-medium"
|
|
249
|
+
scope="row"
|
|
250
|
+
>
|
|
251
|
+
<div class="flex flex-wrap items-center gap-1">
|
|
252
|
+
<span>{{ row }}</span>
|
|
253
|
+
<template v-if="!swapped && userByName.get(row)">
|
|
254
|
+
<UBadge
|
|
255
|
+
v-if="userByName.get(row).admin"
|
|
256
|
+
:label="t('nuxtUiMongocamp.permissionMatrix.adminBadge')"
|
|
257
|
+
color="primary"
|
|
258
|
+
variant="subtle"
|
|
259
|
+
size="sm"
|
|
260
|
+
/>
|
|
261
|
+
<NuxtLink
|
|
262
|
+
v-for="roleName in userByName.get(row).roles"
|
|
263
|
+
:key="roleName"
|
|
264
|
+
:to="`${grantsPath}/${roleName}`"
|
|
265
|
+
class="rounded bg-elevated px-1.5 py-0.5 text-xs hover:underline"
|
|
266
|
+
:class="userByName.get(row).unknownRoles.includes(roleName) ? 'text-warning' : 'text-dimmed'"
|
|
267
|
+
:title="userByName.get(row).unknownRoles.includes(roleName) ? t('nuxtUiMongocamp.permissionMatrix.unknownRoleNote') : t('nuxtUiMongocamp.permissionMatrix.openRole', { role: roleName })"
|
|
268
|
+
>
|
|
269
|
+
{{ roleName }}
|
|
270
|
+
</NuxtLink>
|
|
271
|
+
</template>
|
|
272
|
+
</div>
|
|
273
|
+
</th>
|
|
274
|
+
<td
|
|
275
|
+
v-for="column in columnLabels"
|
|
276
|
+
:key="column"
|
|
277
|
+
class="px-2 py-1.5 text-center"
|
|
278
|
+
>
|
|
279
|
+
<template v-if="cellAtRowColumn(row, column)">
|
|
280
|
+
<span
|
|
281
|
+
class="font-mono text-xs"
|
|
282
|
+
:class="cellClass(cellAtRowColumn(row, column))"
|
|
283
|
+
:title="cellTitle(cellAtRowColumn(row, column))"
|
|
284
|
+
:data-cell="`${swapped ? column : row}|${swapped ? row : column}`"
|
|
285
|
+
>{{ cellLetters(cellAtRowColumn(row, column)) }}</span>
|
|
286
|
+
<span class="sr-only">{{ cellTitle(cellAtRowColumn(row, column)) }}</span>
|
|
287
|
+
</template>
|
|
288
|
+
</td>
|
|
289
|
+
</tr>
|
|
290
|
+
</tbody>
|
|
291
|
+
</table>
|
|
292
|
+
</div>
|
|
293
|
+
<p
|
|
294
|
+
v-if="hasBucketParts"
|
|
295
|
+
class="text-xs text-dimmed"
|
|
296
|
+
>
|
|
297
|
+
{{ t("nuxtUiMongocamp.permissionMatrix.bucketNote") }}
|
|
298
|
+
</p>
|
|
299
|
+
</template>
|
|
300
|
+
</div>
|
|
301
|
+
</template>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
grantsPath?: string;
|
|
3
|
+
maxCollections?: number;
|
|
4
|
+
maxUsers?: number;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
7
|
+
grantsPath: string;
|
|
8
|
+
maxCollections: number;
|
|
9
|
+
maxUsers: number;
|
|
10
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
declare const _default: typeof __VLS_export;
|
|
12
|
+
export default _default;
|
|
@@ -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;
|