diff --git a/ui/src/api/companySkills.ts b/ui/src/api/companySkills.ts index bbdb2e60..f72c64c3 100644 --- a/ui/src/api/companySkills.ts +++ b/ui/src/api/companySkills.ts @@ -64,8 +64,4 @@ export const companySkillsApi = { `/companies/${encodeURIComponent(companyId)}/skills/${encodeURIComponent(skillId)}/install-update`, {}, ), - delete: (companyId: string, skillId: string) => - api.delete( - `/companies/${encodeURIComponent(companyId)}/skills/${encodeURIComponent(skillId)}`, - ), }; diff --git a/ui/src/pages/CompanySkills.tsx b/ui/src/pages/CompanySkills.tsx index 5b1530ec..d2124b03 100644 --- a/ui/src/pages/CompanySkills.tsx +++ b/ui/src/pages/CompanySkills.tsx @@ -890,6 +890,7 @@ export function CompanySkills() { const [deleteOpen, setDeleteOpen] = useState(false); const [deleteTargetSkillId, setDeleteTargetSkillId] = useState(null); const [deleteTargetDetail, setDeleteTargetDetail] = useState(null); + const [deleteTargetSourceLocator, setDeleteTargetSourceLocator] = useState(null); const parsedRoute = useMemo(() => parseSkillRoute(routePath), [routePath]); const routeSkillId = parsedRoute.skillId; const selectedPath = parsedRoute.filePath; @@ -998,12 +999,16 @@ export function CompanySkills() { if (!open) { setDeleteTargetSkillId(null); setDeleteTargetDetail(null); + setDeleteTargetSourceLocator(null); } } function handleDeleteSkill(sourceLocator?: string | null) { if (sourceLocator) { - deleteSkill.mutate(sourceLocator); + setDeleteTargetSourceLocator(sourceLocator); + setDeleteTargetSkillId(null); + setDeleteTargetDetail(null); + setDeleteOpen(true); } else { openDeleteDialog(); } @@ -1212,30 +1217,40 @@ export function CompanySkills() { - Remove skill + {deleteTargetSourceLocator ? "Remove skills from source" : "Remove skill"} - Remove this skill from the company library. If any agents still use it, removal will be blocked until it is detached. + {deleteTargetSourceLocator + ? `All skills imported from this source will be permanently removed from the company library.` + : "Remove this skill from the company library. If any agents still use it, removal will be blocked until it is detached."}
-

- {deleteTargetDetail - ? `You are about to remove ${deleteTargetDetail.name}.` - : "You are about to remove this skill."} -

- {deleteTargetDetail?.usedByAgents?.length ? ( -
- Currently used by {deleteTargetDetail.usedByAgents.map((agent) => agent.name).join(", ")}. -
- ) : null} - {(deleteTargetDetail?.usedByAgents.length ?? 0) > 0 ? ( -

- Detach this skill from all agents to enable removal. + {deleteTargetSourceLocator ? ( +

+ {deleteTargetSourceLocator}

- ) : null} + ) : ( + <> +

+ {deleteTargetDetail + ? `You are about to remove ${deleteTargetDetail.name}.` + : "You are about to remove this skill."} +

+ {deleteTargetDetail?.usedByAgents?.length ? ( +
+ Currently used by {deleteTargetDetail.usedByAgents.map((agent) => agent.name).join(", ")}. +
+ ) : null} + {(deleteTargetDetail?.usedByAgents.length ?? 0) > 0 ? ( +

+ Detach this skill from all agents to enable removal. +

+ ) : null} + + )}
- {(deleteTargetDetail?.usedByAgents.length ?? 0) > 0 ? ( + {(deleteTargetDetail?.usedByAgents.length ?? 0) > 0 && !deleteTargetSourceLocator ? ( @@ -1246,10 +1261,10 @@ export function CompanySkills() { )}