diff --git a/app/jenkins-for-jira-ui/src/components/JenkinsSetup/JenkinsSetup.tsx b/app/jenkins-for-jira-ui/src/components/JenkinsSetup/JenkinsSetup.tsx index ccb77c94..15afd2df 100644 --- a/app/jenkins-for-jira-ui/src/components/JenkinsSetup/JenkinsSetup.tsx +++ b/app/jenkins-for-jira-ui/src/components/JenkinsSetup/JenkinsSetup.tsx @@ -267,7 +267,7 @@ const JenkinsSetup = (): JSX.Element => { const secretRef = useRef(null); const siteNameRef = useRef(null); const webhookUrlRef = useRef(null); - const { id: uuid, settings } = useParams(); + const { id: uuid } = useParams(); const [serverName, setServerName] = useState(''); const [showMyJenkinsAdmin, setShowMyJenkinsAdmin] = useState(false); const [showIAmTheJenkinsAdmin, setShowIAmTheJenkinsAdmin] = useState(false); @@ -280,7 +280,6 @@ const JenkinsSetup = (): JSX.Element => { const [globalPageUrl, setGlobalPageUrl] = useState(''); const [primaryCopyButtonName, setPrimaryCopyButtonName] = useState('nonAdminWebhook'); - const connectionSettings = settings === 'connection-settings'; const updateAdminCopyButtonState = (key: CopyButtonNameEnum, isClicked: boolean) => { const existingItemIndex = copyAdminButtonStates.findIndex((item) => item.name === key); @@ -434,26 +433,13 @@ const JenkinsSetup = (): JSX.Element => { ); }; - const handleNavigateToConnectionCompleteScreen = (e: React.MouseEvent) => { + const handleNavigateToConnectionServerManagementScreen = (e: React.MouseEvent) => { e.preventDefault(); - let pathParam = ''; - - if (showMyJenkinsAdmin) { - pathParam = 'requires-jenkins-admin'; - } else { - pathParam = 'is-admin'; - } - - if (connectionSettings) { - if (path === 'admin') { - history.push('/'); -} else { - router.navigate(globalPageUrl); - } - } else { - history.push(`/connection-complete/${uuid}/${pathParam}/${path}`); + if (path === 'global') { + router.navigate(globalPageUrl); } + history.push('/'); }; const isFetchingData = !serverName || !webhookUrl || !secret; @@ -533,7 +519,7 @@ const JenkinsSetup = (): JSX.Element => { type="button" appearance="primary" isDisabled={!isAllRequiredButtonsClicked} - onClick={(e) => handleNavigateToConnectionCompleteScreen(e)} + onClick={(e) => handleNavigateToConnectionServerManagementScreen(e)} testId="jenkins-set-up-next-btn" > Finish diff --git a/app/jenkins-for-jira-ui/src/components/SharePage/SharePage.test.tsx b/app/jenkins-for-jira-ui/src/components/SharePage/SharePage.test.tsx index ac27dff6..c087d27b 100644 --- a/app/jenkins-for-jira-ui/src/components/SharePage/SharePage.test.tsx +++ b/app/jenkins-for-jira-ui/src/components/SharePage/SharePage.test.tsx @@ -8,32 +8,32 @@ import { AnalyticsScreenEventsEnum } from '../../common/analytics/analytics-even import { SharePage } from './SharePage'; const testJenkinsServer: JenkinsServer = { - name: 'server four', - uuid: '56046af9-d0eb-4efb-8896-sjnd893rsd', - pluginConfig: { - ipAddress: '10.10.10.12', - lastUpdatedOn: new Date() - }, - pipelines: [ - { - name: '#3456', - lastEventType: EventType.BUILD, - lastEventStatus: 'successful', - lastEventDate: new Date() - } - ] -} + name: 'server four', + uuid: '56046af9-d0eb-4efb-8896-sjnd893rsd', + pluginConfig: { + ipAddress: '10.10.10.12', + lastUpdatedOn: new Date() + }, + pipelines: [ + { + name: '#3456', + lastEventType: EventType.BUILD, + lastEventStatus: 'successful', + lastEventDate: new Date() + } + ] +}; jest.mock('../../api/fetchGlobalPageUrl'); jest.mock('../../api/redirectFromGetStarted'); describe('SharePage Component', () => { - test('should copy to clipboard when "Copy to clipboard" is clicked', async () => { + test('should copy to clipboard when "Copy to clipboard" is clicked', async () => { const mockWriteText = jest.fn().mockResolvedValueOnce(undefined); Object.defineProperty(navigator, 'clipboard', { - value: { - writeText: mockWriteText, - }, + value: { + writeText: mockWriteText + } }); jest.spyOn(getAllJenkinsServersModule, 'getAllJenkinsServers').mockResolvedValueOnce([testJenkinsServer]); jest.spyOn(fetchGlobalPageUrlModule, 'fetchGlobalPageUrl').mockResolvedValueOnce('https://somesite.atlassian.net/blah'); @@ -45,7 +45,7 @@ describe('SharePage Component', () => { expect(navigator.clipboard.writeText).toBeCalled(); }); - test('should close the share modal when "Close" is clicked', async () => { + test('should close the share modal when "Close" is clicked', async () => { jest.spyOn(getAllJenkinsServersModule, 'getAllJenkinsServers').mockResolvedValueOnce([testJenkinsServer]); jest.spyOn(fetchGlobalPageUrlModule, 'fetchGlobalPageUrl').mockResolvedValueOnce('https://somesite.atlassian.net/blah'); @@ -62,4 +62,4 @@ describe('SharePage Component', () => { expect(screen.queryByText('Copy to clipboard')).not.toBeInTheDocument(); }); }); -}) \ No newline at end of file +});