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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user