diff options
author | Philippe Perrin <philippe.perrin@sonarsource.com> | 2021-08-18 11:41:00 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2021-08-20 20:03:08 +0000 |
commit | 935f48195e80db893220d81cda8e547c13a2a143 (patch) | |
tree | 4e22cb7975069889be5ee3f464170cf3013bd9fb /server/sonar-web/src/main/js | |
parent | 452ac90e82213563e36cfc1f50828858018ec120 (diff) | |
download | sonarqube-935f48195e80db893220d81cda8e547c13a2a143.tar.gz sonarqube-935f48195e80db893220d81cda8e547c13a2a143.zip |
SONAR-15119 Tutorials shouldn't always mention that the page will automatically reload
Diffstat (limited to 'server/sonar-web/src/main/js')
19 files changed, 146 insertions, 61 deletions
diff --git a/server/sonar-web/src/main/js/apps/overview/components/EmptyOverview.tsx b/server/sonar-web/src/main/js/apps/overview/components/EmptyOverview.tsx index 60514ea6101..a17ec366fa0 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/EmptyOverview.tsx +++ b/server/sonar-web/src/main/js/apps/overview/components/EmptyOverview.tsx @@ -94,6 +94,7 @@ export function EmptyOverview(props: EmptyOverviewProps) { component={component} currentUser={currentUser} projectBinding={projectBinding} + willRefreshAutomatically={true} /> )} </> diff --git a/server/sonar-web/src/main/js/apps/overview/components/__tests__/__snapshots__/EmptyOverview-test.tsx.snap b/server/sonar-web/src/main/js/apps/overview/components/__tests__/__snapshots__/EmptyOverview-test.tsx.snap index 9e3e14188d3..0feced6e7c7 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/__tests__/__snapshots__/EmptyOverview-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/overview/components/__tests__/__snapshots__/EmptyOverview-test.tsx.snap @@ -37,6 +37,7 @@ exports[`renders correctly 1`] = ` "scmAccounts": Array [], } } + willRefreshAutomatically={true} /> </div> `; @@ -112,6 +113,7 @@ exports[`renders correctly 4`] = ` "repository": "PROJECT_KEY", } } + willRefreshAutomatically={true} /> </div> `; diff --git a/server/sonar-web/src/main/js/components/tutorials/TutorialSelection.tsx b/server/sonar-web/src/main/js/components/tutorials/TutorialSelection.tsx index 903fdd3c242..2dd1d3851c9 100644 --- a/server/sonar-web/src/main/js/components/tutorials/TutorialSelection.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/TutorialSelection.tsx @@ -32,6 +32,7 @@ interface Props extends Pick<WithRouterProps, 'router' | 'location'> { component: T.Component; currentUser: T.LoggedInUser; projectBinding?: ProjectAlmBindingResponse; + willRefreshAutomatically?: boolean; } interface State { @@ -97,7 +98,13 @@ export class TutorialSelection extends React.PureComponent<Props, State> { }; render() { - const { component, currentUser, location, projectBinding } = this.props; + const { + component, + currentUser, + location, + projectBinding, + willRefreshAutomatically + } = this.props; const { almBinding, baseUrl, loading } = this.state; const selectedTutorial: TutorialModes | undefined = location.query?.selectedTutorial; @@ -112,6 +119,7 @@ export class TutorialSelection extends React.PureComponent<Props, State> { onSelectTutorial={this.handleSelectTutorial} projectBinding={projectBinding} selectedTutorial={selectedTutorial} + willRefreshAutomatically={willRefreshAutomatically} /> ); } diff --git a/server/sonar-web/src/main/js/components/tutorials/TutorialSelectionRenderer.tsx b/server/sonar-web/src/main/js/components/tutorials/TutorialSelectionRenderer.tsx index 28b272f0452..08445cc67fb 100644 --- a/server/sonar-web/src/main/js/components/tutorials/TutorialSelectionRenderer.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/TutorialSelectionRenderer.tsx @@ -39,6 +39,7 @@ export interface TutorialSelectionRendererProps { onSelectTutorial: (mode: TutorialModes) => void; projectBinding?: ProjectAlmBindingResponse; selectedTutorial?: TutorialModes; + willRefreshAutomatically?: boolean; } const DEFAULT_ICON_SIZE = 80; @@ -72,7 +73,8 @@ export default function TutorialSelectionRenderer(props: TutorialSelectionRender currentUser, loading, projectBinding, - selectedTutorial + selectedTutorial, + willRefreshAutomatically } = props; if (loading) { @@ -195,6 +197,7 @@ export default function TutorialSelectionRenderer(props: TutorialSelectionRender component={component} currentUser={currentUser} projectBinding={projectBinding} + willRefreshAutomatically={willRefreshAutomatically} /> )} @@ -205,6 +208,7 @@ export default function TutorialSelectionRenderer(props: TutorialSelectionRender component={component} currentUser={currentUser} projectBinding={projectBinding} + willRefreshAutomatically={willRefreshAutomatically} /> )} @@ -214,6 +218,7 @@ export default function TutorialSelectionRenderer(props: TutorialSelectionRender baseUrl={baseUrl} component={component} projectBinding={projectBinding} + willRefreshAutomatically={willRefreshAutomatically} /> )} diff --git a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/BitbucketPipelinesTutorial.tsx b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/BitbucketPipelinesTutorial.tsx index b41b7749e41..76f314de563 100644 --- a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/BitbucketPipelinesTutorial.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/BitbucketPipelinesTutorial.tsx @@ -43,10 +43,18 @@ export interface BitbucketPipelinesTutorialProps { component: T.Component; currentUser: T.LoggedInUser; projectBinding?: ProjectAlmBindingResponse; + willRefreshAutomatically?: boolean; } export default function BitbucketPipelinesTutorial(props: BitbucketPipelinesTutorialProps) { - const { almBinding, baseUrl, currentUser, component, projectBinding } = props; + const { + almBinding, + baseUrl, + currentUser, + component, + projectBinding, + willRefreshAutomatically + } = props; const [step, setStep] = React.useState<Steps>(Steps.REPOSITORY_VARIABLES); return ( @@ -89,6 +97,7 @@ export default function BitbucketPipelinesTutorial(props: BitbucketPipelinesTuto alm={almBinding?.alm || AlmKeys.BitbucketCloud} open={step === Steps.ALL_SET} stepNumber={Steps.ALL_SET} + willRefreshAutomatically={willRefreshAutomatically} /> </> ); diff --git a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/BitbucketPipelinesTutorial-test.tsx b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/BitbucketPipelinesTutorial-test.tsx index 8200ad27904..8d070b65f31 100644 --- a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/BitbucketPipelinesTutorial-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/BitbucketPipelinesTutorial-test.tsx @@ -79,6 +79,7 @@ function shallowRender(props: Partial<BitbucketPipelinesTutorialProps> = {}) { currentUser={mockLoggedInUser()} component={mockComponent()} projectBinding={mockProjectBitbucketCloudBindingResponse()} + willRefreshAutomatically={true} {...props} /> ); diff --git a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/__snapshots__/BitbucketPipelinesTutorial-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/__snapshots__/BitbucketPipelinesTutorial-test.tsx.snap index 819ee58c015..d4841cd4a6c 100644 --- a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/__snapshots__/BitbucketPipelinesTutorial-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/__snapshots__/BitbucketPipelinesTutorial-test.tsx.snap @@ -22,6 +22,7 @@ exports[`should render correctly: default 1`] = ` alm="github" open={false} stepNumber={3} + willRefreshAutomatically={true} /> </Fragment> `; @@ -48,6 +49,7 @@ exports[`should render correctly: no binding 1`] = ` alm="bitbucketcloud" open={false} stepNumber={3} + willRefreshAutomatically={true} /> </Fragment> `; diff --git a/server/sonar-web/src/main/js/components/tutorials/components/AllSet.tsx b/server/sonar-web/src/main/js/components/tutorials/components/AllSet.tsx index ad3e794c589..1721c3d3f84 100644 --- a/server/sonar-web/src/main/js/components/tutorials/components/AllSet.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/components/AllSet.tsx @@ -27,12 +27,14 @@ import SentenceWithHighlights from './SentenceWithHighlights'; export interface AllSetProps { alm: AlmKeys; appState: T.AppState; + willRefreshAutomatically?: boolean; } export function AllSet(props: AllSetProps) { const { alm, - appState: { branchesEnabled } + appState: { branchesEnabled }, + willRefreshAutomatically } = props; return ( @@ -64,27 +66,31 @@ export function AllSet(props: AllSetProps) { </p> </div> </div> - <div className="display-flex-row"> - <div> - <img - alt="" // Should be ignored by screen readers - className="big-spacer-right" - width={30} - src={`${getBaseUrl()}/images/tutorials/refresh.svg`} - /> + {willRefreshAutomatically && ( + <div className="display-flex-row"> + <div> + <img + alt="" // Should be ignored by screen readers + className="big-spacer-right" + width={30} + src={`${getBaseUrl()}/images/tutorials/refresh.svg`} + /> + </div> + <div> + <p className="little-spacer-bottom"> + <strong>{translate('onboarding.tutorial.ci_outro.refresh')}</strong> + </p> + <p>{translate('onboarding.tutorial.ci_outro.refresh.why')}</p> + </div> </div> - <div> - <p className="little-spacer-bottom"> - <strong>{translate('onboarding.tutorial.ci_outro.refresh')}</strong> - </p> - <p>{translate('onboarding.tutorial.ci_outro.refresh.why')}</p> - </div> - </div> - </div> - <div className="huge-spacer-bottom huge-spacer-top big-padded-top text-muted display-flex-center display-flex-justify-center"> - <i className="spinner spacer-right" /> - {translate('onboarding.tutorial.ci_outro.waiting_for_fist_analysis')} + )} </div> + {willRefreshAutomatically && ( + <div className="huge-spacer-bottom huge-spacer-top big-padded-top text-muted display-flex-center display-flex-justify-center"> + <i className="spinner spacer-right" /> + {translate('onboarding.tutorial.ci_outro.waiting_for_fist_analysis')} + </div> + )} </> ); } diff --git a/server/sonar-web/src/main/js/components/tutorials/components/AllSetStep.tsx b/server/sonar-web/src/main/js/components/tutorials/components/AllSetStep.tsx index b18fcbf767f..0146f4968b3 100644 --- a/server/sonar-web/src/main/js/components/tutorials/components/AllSetStep.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/components/AllSetStep.tsx @@ -27,17 +27,18 @@ export interface AllSetStepProps { alm: AlmKeys; open: boolean; stepNumber: number; + willRefreshAutomatically?: boolean; } export default function AllSetStep(props: AllSetStepProps) { - const { alm, open, stepNumber } = props; + const { alm, open, stepNumber, willRefreshAutomatically } = props; return ( <Step finished={false} open={open} renderForm={() => ( <div className="boxed-group-inner"> - <AllSet alm={alm} /> + <AllSet alm={alm} willRefreshAutomatically={willRefreshAutomatically} /> </div> )} stepNumber={stepNumber} diff --git a/server/sonar-web/src/main/js/components/tutorials/components/__tests__/AllSet-test.tsx b/server/sonar-web/src/main/js/components/tutorials/components/__tests__/AllSet-test.tsx index ad59543f79b..6d1d2ac58c0 100644 --- a/server/sonar-web/src/main/js/components/tutorials/components/__tests__/AllSet-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/components/__tests__/AllSet-test.tsx @@ -28,6 +28,7 @@ it('should render correctly', () => { expect(shallowRender({ appState: mockAppState({ branchesEnabled: false }) })).toMatchSnapshot( 'without branch' ); + expect(shallowRender({ willRefreshAutomatically: true })).toMatchSnapshot('with auto refresh'); }); function shallowRender(props: Partial<AllSetProps> = {}) { diff --git a/server/sonar-web/src/main/js/components/tutorials/components/__tests__/AllSetStep-test.tsx b/server/sonar-web/src/main/js/components/tutorials/components/__tests__/AllSetStep-test.tsx index 99823160b42..388812ec825 100644 --- a/server/sonar-web/src/main/js/components/tutorials/components/__tests__/AllSetStep-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/components/__tests__/AllSetStep-test.tsx @@ -31,6 +31,12 @@ it('should render correctly', () => { function shallowRender(props: Partial<AllSetStepProps> = {}) { return shallow<AllSetStepProps>( - <AllSetStep alm={AlmKeys.Azure} open={true} stepNumber={1} {...props} /> + <AllSetStep + alm={AlmKeys.Azure} + open={true} + stepNumber={1} + willRefreshAutomatically={true} + {...props} + /> ); } diff --git a/server/sonar-web/src/main/js/components/tutorials/components/__tests__/__snapshots__/AllSet-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/components/__tests__/__snapshots__/AllSet-test.tsx.snap index 5b3d13d45d1..b34ae3f4df4 100644 --- a/server/sonar-web/src/main/js/components/tutorials/components/__tests__/__snapshots__/AllSet-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/components/__tests__/__snapshots__/AllSet-test.tsx.snap @@ -41,6 +41,51 @@ exports[`should render correctly 1`] = ` </p> </div> </div> + </div> +</Fragment> +`; + +exports[`should render correctly: with auto refresh 1`] = ` +<Fragment> + <div + className="abs-width-600" + > + <p + className="big-spacer-bottom" + > + <SentenceWithHighlights + highlightKeys={ + Array [ + "all_set", + ] + } + translationKey="onboarding.tutorial.ci_outro.all_set" + /> + </p> + <div + className="display-flex-row big-spacer-bottom" + > + <div> + <img + alt="" + className="big-spacer-right" + src="/images/tutorials/commit.svg" + width={30} + /> + </div> + <div> + <p + className="little-spacer-bottom" + > + <strong> + onboarding.tutorial.ci_outro.commit + </strong> + </p> + <p> + onboarding.tutorial.ci_outro.commit.why.github + </p> + </div> + </div> <div className="display-flex-row" > @@ -118,38 +163,6 @@ exports[`should render correctly: without branch 1`] = ` </p> </div> </div> - <div - className="display-flex-row" - > - <div> - <img - alt="" - className="big-spacer-right" - src="/images/tutorials/refresh.svg" - width={30} - /> - </div> - <div> - <p - className="little-spacer-bottom" - > - <strong> - onboarding.tutorial.ci_outro.refresh - </strong> - </p> - <p> - onboarding.tutorial.ci_outro.refresh.why - </p> - </div> - </div> - </div> - <div - className="huge-spacer-bottom huge-spacer-top big-padded-top text-muted display-flex-center display-flex-justify-center" - > - <i - className="spinner spacer-right" - /> - onboarding.tutorial.ci_outro.waiting_for_fist_analysis </div> </Fragment> `; diff --git a/server/sonar-web/src/main/js/components/tutorials/components/__tests__/__snapshots__/AllSetStep-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/components/__tests__/__snapshots__/AllSetStep-test.tsx.snap index 12deb834a0e..81965c60b99 100644 --- a/server/sonar-web/src/main/js/components/tutorials/components/__tests__/__snapshots__/AllSetStep-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/components/__tests__/__snapshots__/AllSetStep-test.tsx.snap @@ -16,6 +16,7 @@ exports[`should render correctly: step content 1`] = ` > <Connect(withAppState(AllSet)) alm="azure" + willRefreshAutomatically={true} /> </div> `; diff --git a/server/sonar-web/src/main/js/components/tutorials/github-action/GitHubActionTutorial.tsx b/server/sonar-web/src/main/js/components/tutorials/github-action/GitHubActionTutorial.tsx index 03647bf12c0..7be0f3252a0 100644 --- a/server/sonar-web/src/main/js/components/tutorials/github-action/GitHubActionTutorial.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/github-action/GitHubActionTutorial.tsx @@ -42,10 +42,18 @@ export interface GitHubActionTutorialProps { component: T.Component; currentUser: T.LoggedInUser; projectBinding?: ProjectAlmBindingResponse; + willRefreshAutomatically?: boolean; } export default function GitHubActionTutorial(props: GitHubActionTutorialProps) { - const { almBinding, baseUrl, currentUser, component, projectBinding } = props; + const { + almBinding, + baseUrl, + currentUser, + component, + projectBinding, + willRefreshAutomatically + } = props; const [step, setStep] = React.useState<Steps>(Steps.CREATE_SECRET); return ( @@ -89,6 +97,7 @@ export default function GitHubActionTutorial(props: GitHubActionTutorialProps) { alm={almBinding?.alm || AlmKeys.GitHub} open={step === Steps.ALL_SET} stepNumber={Steps.ALL_SET} + willRefreshAutomatically={willRefreshAutomatically} /> </> ); diff --git a/server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/GitHubActionTutorial-test.tsx b/server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/GitHubActionTutorial-test.tsx index 891c84a1e1d..e656347bebc 100644 --- a/server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/GitHubActionTutorial-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/GitHubActionTutorial-test.tsx @@ -77,6 +77,7 @@ function shallowRender(props: Partial<GitHubActionTutorialProps> = {}) { currentUser={mockLoggedInUser()} component={mockComponent()} projectBinding={mockProjectGithubBindingResponse()} + willRefreshAutomatically={true} {...props} /> ); diff --git a/server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/__snapshots__/GitHubActionTutorial-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/__snapshots__/GitHubActionTutorial-test.tsx.snap index bea7818d24e..1294b757150 100644 --- a/server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/__snapshots__/GitHubActionTutorial-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/__snapshots__/GitHubActionTutorial-test.tsx.snap @@ -22,6 +22,7 @@ exports[`should render correctly: default 1`] = ` alm="github" open={false} stepNumber={3} + willRefreshAutomatically={true} /> </Fragment> `; @@ -48,6 +49,7 @@ exports[`should render correctly: no binding 1`] = ` alm="github" open={false} stepNumber={3} + willRefreshAutomatically={true} /> </Fragment> `; diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/JenkinsTutorial.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/JenkinsTutorial.tsx index 443bc98e516..0af21063e28 100644 --- a/server/sonar-web/src/main/js/components/tutorials/jenkins/JenkinsTutorial.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/JenkinsTutorial.tsx @@ -43,6 +43,7 @@ export interface JenkinsTutorialProps { projectBinding?: ProjectAlmBindingResponse; setCurrentUserSetting: (setting: T.CurrentUserSetting) => void; skipPreReqs: boolean; + willRefreshAutomatically?: boolean; } enum Steps { @@ -57,7 +58,15 @@ enum Steps { const USER_SETTING_SKIP_BITBUCKET_PREREQS = 'tutorials.jenkins.skipBitbucketPreReqs'; export function JenkinsTutorial(props: JenkinsTutorialProps) { - const { almBinding, baseUrl, branchesEnabled, component, projectBinding, skipPreReqs } = props; + const { + almBinding, + baseUrl, + branchesEnabled, + component, + projectBinding, + skipPreReqs, + willRefreshAutomatically + } = props; const hasSelectAlmStep = projectBinding?.alm === undefined; const [alm, setAlm] = React.useState<AlmKeys | undefined>(projectBinding?.alm); @@ -145,7 +154,12 @@ export function JenkinsTutorial(props: JenkinsTutorialProps) { open={step === Steps.Jenkinsfile} /> - <AllSetStep alm={alm} open={step === Steps.AllSet} stepNumber={4} /> + <AllSetStep + alm={alm} + open={step === Steps.AllSet} + stepNumber={4} + willRefreshAutomatically={willRefreshAutomatically} + /> </> )} </> diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/JenkinsTutorial-test.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/JenkinsTutorial-test.tsx index b01c8d7e8d4..9e48708164f 100644 --- a/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/JenkinsTutorial-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/JenkinsTutorial-test.tsx @@ -138,6 +138,7 @@ function shallowRender(props: Partial<JenkinsTutorialProps> = {}) { projectBinding={mockProjectBitbucketBindingResponse()} setCurrentUserSetting={jest.fn()} skipPreReqs={false} + willRefreshAutomatically={true} {...props} /> ); diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/__snapshots__/JenkinsTutorial-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/__snapshots__/JenkinsTutorial-test.tsx.snap index e8c3dfb49ce..7858029d190 100644 --- a/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/__snapshots__/JenkinsTutorial-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/__snapshots__/JenkinsTutorial-test.tsx.snap @@ -78,6 +78,7 @@ exports[`should render correctly: branches not enabled 1`] = ` alm="bitbucket" open={false} stepNumber={4} + willRefreshAutomatically={true} /> </Fragment> `; @@ -169,6 +170,7 @@ exports[`should render correctly: default 1`] = ` alm="bitbucket" open={false} stepNumber={4} + willRefreshAutomatically={true} /> </Fragment> `; |