[FIX] Delete SQL agent connection bug fix (#1635)

fix update agent settings button not appearing when deleting sql connection
This commit is contained in:
Sean Hatfield 2024-06-07 12:03:48 -07:00 committed by GitHub
parent 3434bf4686
commit 48b7d54b52
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 2 deletions

View File

@ -9,7 +9,7 @@ export const DB_LOGOS = {
"sql-server": MSSQLLogo, "sql-server": MSSQLLogo,
}; };
export default function DBConnection({ connection, onRemove }) { export default function DBConnection({ connection, onRemove, setHasChanges }) {
const { database_id, engine } = connection; const { database_id, engine } = connection;
function removeConfirmation() { function removeConfirmation() {
if ( if (
@ -20,6 +20,7 @@ export default function DBConnection({ connection, onRemove }) {
return false; return false;
} }
onRemove(database_id); onRemove(database_id);
setHasChanges(true);
} }
return ( return (

View File

@ -9,6 +9,7 @@ export default function AgentSQLConnectorSelection({
settings, settings,
toggleSkill, toggleSkill,
enabled = false, enabled = false,
setHasChanges,
}) { }) {
const { isOpen, openModal, closeModal } = useModal(); const { isOpen, openModal, closeModal } = useModal();
const [connections, setConnections] = useState( const [connections, setConnections] = useState(
@ -72,6 +73,7 @@ export default function AgentSQLConnectorSelection({
}) })
); );
}} }}
setHasChanges={setHasChanges}
/> />
))} ))}
<button <button

View File

@ -100,6 +100,7 @@ export default function WorkspaceAgentConfiguration({ workspace }) {
skills={agentSkills} skills={agentSkills}
toggleAgentSkill={toggleAgentSkill} toggleAgentSkill={toggleAgentSkill}
settings={settings} settings={settings}
setHasChanges={setHasChanges}
/> />
{hasChanges && ( {hasChanges && (
<button <button
@ -143,7 +144,7 @@ function LoadingSkeleton() {
); );
} }
function AvailableAgentSkills({ skills, settings, toggleAgentSkill }) { function AvailableAgentSkills({ skills, settings, toggleAgentSkill, setHasChanges }) {
return ( return (
<div> <div>
<div className="flex flex-col mb-8"> <div className="flex flex-col mb-8">
@ -211,6 +212,7 @@ function AvailableAgentSkills({ skills, settings, toggleAgentSkill }) {
settings={settings} settings={settings}
toggleSkill={toggleAgentSkill} toggleSkill={toggleAgentSkill}
enabled={skills.includes("sql-agent")} enabled={skills.includes("sql-agent")}
setHasChanges={setHasChanges}
/> />
</div> </div>
</div> </div>