fix(nacos): allow manual scope when namespace directory is missing

This commit is contained in:
二丫讲梵 authored and GitHub committed 2026-08-28 15:10:25 +08:00
1 parent bcc64274e8
commit c237ecbfca
5 files changed
+138 -41

No files matched your search

@@ -5,10 +5,10 @@ const dialogSource = readFileSync(new URL("../../../components/connection/Connec
describe("connection dialog scrolling", () => {
it("keeps every configuration tab inside a shrinkable form viewport", () => {
expect(dialogSource).toContain("return `${widthClass} connection-dialog-content--config`;");
expect(dialogSource).toContain('connection-dialog-content--config${scrollableAdvancedNacos ? " connection-dialog-content--scrollable" : ""}');
expect(dialogSource.match(/<TabsContent[^>]*class="m-0 flex min-h-0 flex-1 flex-col overflow-hidden">/g)).toHaveLength(4);
expect(dialogSource.match(/class="connection-form-body grid min-h-0 flex-1 scroll-pb-6 gap-4 overflow-y-auto/g)).toHaveLength(4);
expect(dialogSource).not.toMatch(/\.connection-dialog-content--config\s*\{[\s\S]*?height:\s*min\(720px/);
expect(dialogSource).toMatch(/\.connection-dialog-content--scrollable\s*\{[\s\S]*?height:\s*min\(720px, calc\(var\(--dbx-viewport-height\) - 2rem\)\);/);
expect(dialogSource).toMatch(/@media \(max-height: 720px\)[\s\S]*?height:\s*calc\(var\(--dbx-viewport-height\) - 2rem\);/);
expect(dialogSource).toMatch(/\.connection-dialog-content--config \.connection-form-body\s*\{[\s\S]*?align-content:\s*start;/);
});
@@ -18,8 +18,8 @@ describe("connection dialog scrolling", () => {
expect(dialogSource).toContain('class="connection-form-body grid min-h-0 flex-1 scroll-pb-6 gap-4 overflow-y-auto overflow-x-hidden pt-4 pr-2 pb-6"');
});
it("keeps conditional Nacos authentication fields from shrinking earlier cards", () => {
expect(dialogSource).toContain(":class=\"{ 'connection-form-body--nacos': form.db_type === 'nacos' }\"");
it("keeps Nacos cards at their content height on both form tabs", () => {
expect(dialogSource.match(/:class="\{ 'connection-form-body--nacos': form\.db_type === 'nacos' \}"/g)).toHaveLength(2);
expect(dialogSource).toMatch(/\.connection-form-body--nacos\s*\{[\s\S]*?grid-auto-rows:\s*max-content;/);
});
});
@@ -87,6 +87,7 @@ describe("Nacos connection dialog layout", () => {
it("guides namespace listing permission failures to manual scope entry", () => {
expect(source).toContain("function isNacosNamespaceListingPermissionError(error: unknown): boolean");
expect(source).toContain("NACOS_ERROR\\[rnacosNamespaceDirectoryUnavailable\\]");
expect(source).toContain("NACOS_ERROR\\[(?:v3ManagedNamespacesRequired|managedNamespacesRequired)\\]");
expect(source).toContain("/\\/v3\\/(?:admin|console)\\/core\\/namespace\\/list/");
expect(source).toContain("visibleNacosNamespaceListingPermissionDenied.value = isNacosNamespaceListingPermissionError(e)");
@@ -110,7 +111,9 @@ describe("Nacos connection dialog layout", () => {
expect(source).toContain('if (isNacosV3AdminPlane.value) return "nacos.nacosV3AdminManagedNamespacesHint"');
expect(source).toContain('if (isNacosV3ConsolePlane.value) return "nacos.nacosV3ConsoleManagedNamespacesHint"');
expect(source).toContain('v-if="isNacosV3AdminPlane" class="flex gap-2 rounded-md border border-amber-500/30');
expect(source).toMatch(/const resolvedNamespaces = isNacosV3AdminPlane\.value\s*\?\s*manualNamespaces\s*:\s*await resolveManualNacosNamespaceNames\(manualNamespaces\);/);
expect(source).toContain('isNacosV3AdminPlane.value || nacosImplementation.value === "rnacos"');
expect(source).toContain("? manualNamespaces");
expect(source).toContain(": await resolveManualNacosNamespaceNames(manualNamespaces)");
});
it("opens namespace access setup instead of showing a save validation error", () => {