diff --git a/platform/settings/SubscriptionWizard.test.tsx b/platform/settings/SubscriptionWizard.test.tsx index 32d8f96898..02cd385f0b 100644 --- a/platform/settings/SubscriptionWizard.test.tsx +++ b/platform/settings/SubscriptionWizard.test.tsx @@ -34,7 +34,6 @@ describe('SubscriptionWizard Component', () => { // Check that all three steps are present in navigation const navigation = screen.getByRole('navigation', { name: 'Steps' }); expect(navigation).toHaveTextContent('Ansible Automation Platform Subscription'); - expect(navigation).toHaveTextContent('Optional: Automation Analytics'); expect(navigation).toHaveTextContent('End User License Agreement'); expect(navigation).toHaveTextContent('Review'); @@ -45,11 +44,9 @@ describe('SubscriptionWizard Component', () => { expect(currentStep).toHaveClass('pf-m-current'); // Other steps should be disabled - const analyticsStep = screen.getByRole('button', { name: 'Optional: Automation Analytics' }); const licenseStep = screen.getByRole('button', { name: 'End User License Agreement' }); const reviewStep = screen.getByRole('button', { name: 'Review' }); - expect(analyticsStep).toBeDisabled(); expect(licenseStep).toBeDisabled(); expect(reviewStep).toBeDisabled(); @@ -246,94 +243,4 @@ describe('SubscriptionWizard Component', () => { }); }, 10000); }); - - describe('Automation Analytics Step', () => { - const navigateToAnalyticsStep = async () => { - const user = userEvent.setup(); - renderWithRouter(); - await user.click(screen.getByRole('button', { name: 'Subscription manifest' })); - const file = new File(['mock manifest content'], 'manifest.zip', { - type: 'application/zip', - }); - const fileInput = document.querySelector('input[type="file"]') as HTMLInputElement; - await user.upload(fileInput, file); - const nextButton = screen.getByRole('button', { name: /next/i }); - await user.click(nextButton); - - return user; - }; - - it('renders automation analytics step with correct content', async () => { - await navigateToAnalyticsStep(); - - await waitFor( - () => { - expect( - screen.getByRole('heading', { name: /Optional: Automation Analytics/i }) - ).toBeInTheDocument(); - }, - { timeout: 10000 } - ); - - expect( - screen.getByText(/Enter client ID and client secret to enable Analytics/i) - ).toBeInTheDocument(); - expect(screen.getByLabelText(/Client ID/i)).toBeInTheDocument(); - expect(screen.getByLabelText(/Client secret/i)).toBeInTheDocument(); - expect(screen.getByAltText(/Automation Analytics/i)).toBeInTheDocument(); - }, 15000); - - it('allows proceeding to next step with filled analytics fields', async () => { - const user = await navigateToAnalyticsStep(); - - await waitFor( - () => { - expect(screen.getByLabelText(/Client ID/i)).toBeInTheDocument(); - }, - { timeout: 10000 } - ); - - const clientIdField = screen.getByLabelText(/Client ID/i); - const clientSecretField = screen.getByLabelText(/Client secret/i); - await user.type(clientIdField, 'test-client-id'); - await user.type(clientSecretField, 'test-client-secret'); - // Should be able to proceed to next step - const nextButton = screen.getByRole('button', { name: /next/i }); - expect(nextButton).toBeEnabled(); - await user.click(nextButton); - - await waitFor( - () => { - expect( - screen.getByRole('checkbox', { name: /I agree to the terms of the license agreement/i }) - ).toBeInTheDocument(); - }, - { timeout: 10000 } - ); - }, 15000); - - it('allows proceeding to next step with empty analytics fields (optional)', async () => { - const user = await navigateToAnalyticsStep(); - - await waitFor( - () => { - expect(screen.getByRole('button', { name: /next/i })).toBeInTheDocument(); - }, - { timeout: 10000 } - ); - - const nextButton = screen.getByRole('button', { name: /next/i }); - expect(nextButton).toBeEnabled(); - await user.click(nextButton); - - await waitFor( - () => { - expect( - screen.getByRole('checkbox', { name: /I agree to the terms of the license agreement/i }) - ).toBeInTheDocument(); - }, - { timeout: 10000 } - ); - }, 15000); - }); }); diff --git a/platform/settings/SubscriptionWizard.tsx b/platform/settings/SubscriptionWizard.tsx index 161ea34be5..7b1fea7b6e 100644 --- a/platform/settings/SubscriptionWizard.tsx +++ b/platform/settings/SubscriptionWizard.tsx @@ -11,9 +11,8 @@ import { PageFormHidden } from '@ansible/ansible-ui-framework/PageForm/Utils/Pag import { awxErrorAdapter } from '@ansible/awx-ui/common/adapters/awxErrorAdapter'; import { awxAPI } from '@ansible/awx-ui/common/api/awx-utils'; import { useAwxConfig, useAwxConfigState } from '@ansible/awx-ui/common/useAwxConfig'; -import { postRequest, requestPatch } from '@ansible/common-ui/crud/Data'; +import { postRequest } from '@ansible/common-ui/crud/Data'; import { ILicenseInfo } from '@ansible/common-ui/interfaces/Config'; -import { useGetDocsUrl } from '@ansible/common-ui/utils/useGetDocsUrl'; import { ExternalLink } from '@ansible/hub-ui//common/ExternalLink'; import { Content, @@ -26,7 +25,6 @@ import { import { useCallback, useEffect, useMemo } from 'react'; import { useFormContext } from 'react-hook-form'; import { useTranslation } from 'react-i18next'; -import AnalyticsGraphic from '../assets/AAGraphic 1.svg?url'; interface SubscriptionWizardData { subscriptionSelection: 'manifest' | 'service_account' | 'username' | 'satellite'; @@ -38,8 +36,6 @@ interface SubscriptionWizardData { satellite_username: string; satellite_password: string; subscription_id?: string; - analytics_client_id: string; - analytics_client_secret: string; agree: boolean; } @@ -54,11 +50,6 @@ export function SubscriptionWizard(props: { onSuccess: () => void }) { label: t('Ansible Automation Platform Subscription'), inputs: , }, - { - id: 'analytics', - label: t('Optional: Automation Analytics'), - inputs: , - }, { id: 'license-agreement', label: t('End User License Agreement'), @@ -98,15 +89,6 @@ export function SubscriptionWizard(props: { onSuccess: () => void }) { break; } refreshAwxConfig?.(); - - // Set up analytics if client credentials are provided in automation analytics step - if (data.analytics_client_id && data.analytics_client_secret) { - await requestPatch(awxAPI`/settings/all/`, { - REDHAT_USERNAME: data.analytics_client_id, - REDHAT_PASSWORD: data.analytics_client_secret, - INSIGHTS_TRACKING_STATE: true, - }); - } props.onSuccess(); }, [props, refreshAwxConfig] @@ -338,52 +320,6 @@ function SubscriptionStep() { ); } -function AutomationAnalyticsStep() { - const { t } = useTranslation(); - const config = useAwxConfig(); - const docsUrl = useGetDocsUrl(config, 'configureAnalytics'); - - return ( - <> - - {t('Optional: Automation Analytics')} - - {t( - 'Enter client ID and client secret to enable Analytics. This collects and transmits analytics on the service usage to Red Hat. For more information, see ' - )} - {t('documentation')} - {t('.')} - - -
- {t('Automation -
-
-
- - name="analytics_client_id" - label={t`Client ID`} - labelHelp={t('Client ID used to send data to Automation Analytics')} - /> - - name="analytics_client_secret" - label={t`Client secret`} - type="password" - labelHelp={t('Client secret used to send data to Automation Analytics')} - /> - - ); -} - function LicenseAgreementStep() { const { t } = useTranslation(); const config = useAwxConfig();