diff --git a/apps/console-v5/src/routes/_authenticated/organization/$organizationId/settings/ai-copilot.tsx b/apps/console-v5/src/routes/_authenticated/organization/$organizationId/settings/ai-copilot.tsx index 08da6994cdb..404a137f1a1 100644 --- a/apps/console-v5/src/routes/_authenticated/organization/$organizationId/settings/ai-copilot.tsx +++ b/apps/console-v5/src/routes/_authenticated/organization/$organizationId/settings/ai-copilot.tsx @@ -1,9 +1,20 @@ -import { createFileRoute } from '@tanstack/react-router' +import { createFileRoute, useParams } from '@tanstack/react-router' +import { useOrganization } from '@qovery/domains/organizations/feature' +import { AICopilotSettings } from '@qovery/shared/devops-copilot/feature' +import { useDocumentTitle } from '@qovery/shared/util-hooks' export const Route = createFileRoute('/_authenticated/organization/$organizationId/settings/ai-copilot')({ component: RouteComponent, }) function RouteComponent() { - return
Hello "/_authenticated/organization/$organizationId/settings/ai-copilot"!
+ const { organizationId = '' } = useParams({ strict: false }) + useDocumentTitle('AI Copilot - Organization settings') + const { data: organization } = useOrganization({ organizationId }) + + if (!organization) { + return null + } + + return } diff --git a/libs/pages/settings/src/lib/feature/page-organization-ai-copilot-feature/page-organization-ai-copilot-feature.tsx b/libs/pages/settings/src/lib/feature/page-organization-ai-copilot-feature/page-organization-ai-copilot-feature.tsx deleted file mode 100644 index 255a5e2d72b..00000000000 --- a/libs/pages/settings/src/lib/feature/page-organization-ai-copilot-feature/page-organization-ai-copilot-feature.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { useParams } from 'react-router-dom' -import { useOrganization } from '@qovery/domains/organizations/feature' -import { AICopilotSettings } from '@qovery/shared/devops-copilot/feature' -import { useDocumentTitle } from '@qovery/shared/util-hooks' - -export function PageOrganizationAICopilotFeature() { - const { organizationId = '' } = useParams() - useDocumentTitle('AI Copilot - Organization settings') - - const { data: organization } = useOrganization({ organizationId }) - - if (!organization) { - return null - } - - return -} - -export default PageOrganizationAICopilotFeature diff --git a/libs/shared/devops-copilot/feature/src/lib/ai-copilot-settings/ai-copilot-settings.tsx b/libs/shared/devops-copilot/feature/src/lib/ai-copilot-settings/ai-copilot-settings.tsx index 418511bb964..c4cb5bb505a 100644 --- a/libs/shared/devops-copilot/feature/src/lib/ai-copilot-settings/ai-copilot-settings.tsx +++ b/libs/shared/devops-copilot/feature/src/lib/ai-copilot-settings/ai-copilot-settings.tsx @@ -1,7 +1,9 @@ import { useFeatureFlagVariantKey } from 'posthog-js/react' import { type Organization } from 'qovery-typescript-axios' import { useAuth } from '@qovery/shared/auth' +import { SettingsHeading } from '@qovery/shared/console-shared' import { useUserAccount } from '@qovery/shared/iam/feature' +import { Callout, Icon, Section } from '@qovery/shared/ui' import { useAICopilotConfig } from '../hooks/use-ai-copilot-config/use-ai-copilot-config' import { useAICopilotRecurringTasks } from '../hooks/use-ai-copilot-recurring-tasks/use-ai-copilot-recurring-tasks' import { useDeleteAICopilotRecurringTask } from '../hooks/use-delete-ai-copilot-recurring-task/use-delete-ai-copilot-recurring-task' @@ -54,31 +56,46 @@ export function AICopilotSettings(props: AICopilotSettingsProps) { return (
- {!isEnabled && !isLoadingConfig ? ( - handleToggleCopilot(true)} - /> - ) : ( - <> - + + + + + + + Beta Feature + + The AI Copilot is currently in beta. This is an experimental feature and functionality may change. + Billing terms are not final and will be communicated before any charges apply. + + + + {!isEnabled && !isLoadingConfig ? ( + updateConfigMutation.mutate({ enabled: true, readOnly: mode === 'read-only' })} - onDisable={() => handleToggleCopilot(false)} + isLoading={isLoadingConfig} + onEnable={() => handleToggleCopilot(true)} /> + ) : ( +
+ updateConfigMutation.mutate({ enabled: true, readOnly: mode === 'read-only' })} + onDisable={() => handleToggleCopilot(false)} + /> - toggleTaskMutation.mutate({ taskId })} - onDeleteTask={(taskId) => deleteTaskMutation.mutate({ taskId })} - /> - - )} + toggleTaskMutation.mutate({ taskId })} + onDeleteTask={(taskId) => deleteTaskMutation.mutate({ taskId })} + /> +
+ )} +
) diff --git a/libs/shared/devops-copilot/feature/src/lib/ai-copilot-settings/section-ai-copilot-configuration/section-ai-copilot-configuration.spec.tsx b/libs/shared/devops-copilot/feature/src/lib/ai-copilot-settings/section-ai-copilot-configuration/section-ai-copilot-configuration.spec.tsx index c4e26da17f2..61ec9dbd974 100644 --- a/libs/shared/devops-copilot/feature/src/lib/ai-copilot-settings/section-ai-copilot-configuration/section-ai-copilot-configuration.spec.tsx +++ b/libs/shared/devops-copilot/feature/src/lib/ai-copilot-settings/section-ai-copilot-configuration/section-ai-copilot-configuration.spec.tsx @@ -36,13 +36,6 @@ describe('SectionAICopilotConfiguration', () => { mockUseFeatureFlagVariantKey.mockReturnValue('control') }) - it('should render section heading', () => { - render() - - expect(screen.getByText('AI Copilot Configuration')).toBeInTheDocument() - expect(screen.getByText('Configure your Copilot')).toBeInTheDocument() - }) - it('should show loader when loading', () => { const { container } = render() diff --git a/libs/shared/devops-copilot/feature/src/lib/ai-copilot-settings/section-ai-copilot-configuration/section-ai-copilot-configuration.tsx b/libs/shared/devops-copilot/feature/src/lib/ai-copilot-settings/section-ai-copilot-configuration/section-ai-copilot-configuration.tsx index 71e113ef97d..3b565eb5132 100644 --- a/libs/shared/devops-copilot/feature/src/lib/ai-copilot-settings/section-ai-copilot-configuration/section-ai-copilot-configuration.tsx +++ b/libs/shared/devops-copilot/feature/src/lib/ai-copilot-settings/section-ai-copilot-configuration/section-ai-copilot-configuration.tsx @@ -26,8 +26,8 @@ export interface SectionAICopilotConfigurationProps { function getDisableConfirmationModal(closeModal: () => void, onDisable: () => void) { return (
-

Disable AI Copilot

-

+

Disable AI Copilot

+

Are you sure you want to disable AI Copilot? This will stop all AI-powered assistance for your organization.

@@ -85,37 +85,21 @@ export function SectionAICopilotConfiguration({ return (
-
- AI Copilot Configuration -

Configure your Copilot

-
- - - - - - Beta Feature - - The AI Copilot is currently in beta. This is an experimental feature and functionality may change. Billing - terms are not final and will be communicated before any charges apply. - - - - + {isLoading ? (
) : (
-
+
- -

AI Copilot for {organization?.name}

+ +

AI Copilot for {organization?.name}

-

AI-powered assistance is currently active

+

AI-powered assistance is currently active