feat(domain): improve domain form UX

- Make name field optional (defaults to domain if empty)
- Simplify domain placeholder and error messages
- Add test connection button for credential validation before save
This commit is contained in:
2026-03-12 11:03:52 +08:00
parent 8b0805bebf
commit c903733f2c
7 changed files with 289 additions and 36 deletions

View File

@@ -24,6 +24,7 @@ import type { Result } from "@renderer/types/ipc";
import type {
CreateDomainParams,
UpdateDomainParams,
TestDomainConnectionParams,
GetSpacesParams,
GetAppsParams,
GetAppDetailParams,
@@ -206,6 +207,37 @@ function registerTestConnection(): void {
});
}
/**
* Test domain connection with temporary credentials
*/
function registerTestDomainConnection(): void {
handleWithParams<TestDomainConnectionParams, boolean>(
"testDomainConnection",
async (params) => {
const tempDomain: DomainWithPassword = {
id: "temp",
name: "temp",
domain: params.domain,
username: params.username,
password: params.password || "",
authType: params.authType,
apiToken: params.apiToken,
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
};
const client = new KintoneClient(tempDomain);
const result = await client.testConnection();
if (!result.success) {
throw new Error(result.error || "Connection failed");
}
return true;
},
);
}
// ==================== Browse IPC Handlers ====================
/**
@@ -521,6 +553,7 @@ export function registerIpcHandlers(): void {
registerUpdateDomain();
registerDeleteDomain();
registerTestConnection();
registerTestDomainConnection();
// Browse
registerGetSpaces();