feat(nacos): namespace production protection and sidebar visibility

This commit is contained in:
二丫讲梵 authored and GitHub committed 2026-08-08 10:55:21 +08:00
1 parent 9057be0e78
commit efd0c381ad
25 files changed
+492 -26

No files matched your search

@@ -59,6 +59,7 @@ describe("Nacos namespace creation cache invalidation", () => {
connectionStore: {
treeNodes: [],
loadNacosNamespaces: mocks.loadNacosNamespaces,
getConfig: () => undefined,
} as any,
});
@@ -81,6 +82,7 @@ describe("Nacos namespace creation cache invalidation", () => {
connectionStore: {
treeNodes: [],
loadNacosNamespaces: mocks.loadNacosNamespaces,
getConfig: () => undefined,
} as any,
});
@@ -23,6 +23,7 @@ import {
} from "@/lib/sidebar/mongoCollectionMutation";
import { supportsMongoAllDriverMutations, supportsMongoIndexMutations, supportsNativeMongoDriverMutations } from "@/lib/mongo/mongoCapabilities";
import { runMongoSidebarMutation } from "@/lib/sidebar/runMongoSidebarMutation";
import { executeWithProductionContextGuard } from "@/lib/database/productionExecutionGuard";
import { refreshLoadedMongoIndexes } from "@/lib/mongo/mongoIndexMetadata";
import {
sidebarDangerTarget,
@@ -280,10 +281,19 @@ export function useSidebarDatabaseSpecificMutationRuntime(options: SidebarDataba
const node = sidebarFormTarget.value ?? activeNode.value;
const namespaceName = createNacosNamespaceName.value.trim();
if (!node.connectionId || !namespaceName || createNacosNamespaceLoading.value) return;
const namespaceId = createNacosNamespaceId.value.trim();
const confirmed = await executeWithProductionContextGuard({
connection: connectionStore.getConfig(node.connectionId),
database: namespaceId || undefined,
reviewText: t("nacos.createNamespace"),
source: t("production.sourceSidebar"),
execute: async () => true,
});
if (confirmed !== true) return;
createNacosNamespaceLoading.value = true;
try {
await api.nacosCreateNamespace(node.connectionId, {
namespaceId: createNacosNamespaceId.value.trim() || undefined,
namespaceId: namespaceId || undefined,
namespaceName,
namespaceDesc: createNacosNamespaceDesc.value.trim() || namespaceName,
});
@@ -311,6 +321,14 @@ export function useSidebarDatabaseSpecificMutationRuntime(options: SidebarDataba
const namespaceId = node.nacosNamespace?.trim() || "";
const namespaceName = editNacosNamespaceName.value.trim();
if (!node.connectionId || !namespaceId || !namespaceName || editNacosNamespaceLoading.value) return;
const confirmed = await executeWithProductionContextGuard({
connection: connectionStore.getConfig(node.connectionId),
database: namespaceId,
reviewText: t("nacos.editNamespace"),
source: t("production.sourceSidebar"),
execute: async () => true,
});
if (confirmed !== true) return;
editNacosNamespaceLoading.value = true;
try {
await api.nacosUpdateNamespace(node.connectionId, {