mirror of
https://github.com/eigent-ai/eigent.git
synced 2026-06-01 22:50:35 +00:00
chore: ensure install status when success
This commit is contained in:
parent
ad73a7d2f7
commit
3e2e961e90
1 changed files with 30 additions and 5 deletions
|
|
@ -63,15 +63,40 @@ export function useIntegrationManagement(items: IntegrationItem[]) {
|
|||
const map: { [key: string]: boolean } = {};
|
||||
|
||||
items.forEach((item) => {
|
||||
if (item.key === "Google Calendar" || item.key === "Google Gmail") {
|
||||
// Only mark installed when refresh token is present (auth completed)
|
||||
if (item.key === "Google Calendar") {
|
||||
// Mark as installed when either:
|
||||
// 1. Refresh token has value (auth completed), OR
|
||||
// 2. Client credentials are present (configured but auth pending/completed)
|
||||
const hasRefreshToken = configs.some(
|
||||
(c: any) =>
|
||||
c.config_group?.toLowerCase() === item.key.toLowerCase() &&
|
||||
["GOOGLE_REFRESH_TOKEN", "GMAIL_GOOGLE_REFRESH_TOKEN"].includes(c.config_name) &&
|
||||
c.config_group?.toLowerCase() === "google calendar" &&
|
||||
c.config_name === "GOOGLE_REFRESH_TOKEN" &&
|
||||
c.config_value && String(c.config_value).length > 0
|
||||
);
|
||||
map[item.key] = hasRefreshToken;
|
||||
const hasClientCredentials = configs.some(
|
||||
(c: any) =>
|
||||
c.config_group?.toLowerCase() === "google calendar" &&
|
||||
c.config_name === "GOOGLE_CLIENT_ID" &&
|
||||
c.config_value && String(c.config_value).length > 0
|
||||
);
|
||||
map[item.key] = hasRefreshToken || hasClientCredentials;
|
||||
} else if (item.key === "Google Gmail") {
|
||||
// Mark as installed when either:
|
||||
// 1. Refresh token has value (auth completed), OR
|
||||
// 2. Client credentials are present (configured but auth pending/completed)
|
||||
const hasRefreshToken = configs.some(
|
||||
(c: any) =>
|
||||
c.config_group?.toLowerCase() === "google gmail" &&
|
||||
c.config_name === "GMAIL_GOOGLE_REFRESH_TOKEN" &&
|
||||
c.config_value && String(c.config_value).length > 0
|
||||
);
|
||||
const hasClientCredentials = configs.some(
|
||||
(c: any) =>
|
||||
c.config_group?.toLowerCase() === "google gmail" &&
|
||||
c.config_name === "GMAIL_GOOGLE_CLIENT_ID" &&
|
||||
c.config_value && String(c.config_value).length > 0
|
||||
);
|
||||
map[item.key] = hasRefreshToken || hasClientCredentials;
|
||||
} else {
|
||||
// For other integrations, use config_group presence
|
||||
const hasConfig = configs.some(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue