diff options
Diffstat (limited to 'server/sonar-web')
-rw-r--r-- | server/sonar-web/src/main/js/apps/tutorials/onboarding/AnalysisStep.js | 15 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/helpers/urls.ts | 4 |
2 files changed, 11 insertions, 8 deletions
diff --git a/server/sonar-web/src/main/js/apps/tutorials/onboarding/AnalysisStep.js b/server/sonar-web/src/main/js/apps/tutorials/onboarding/AnalysisStep.js index 51d5195fc4b..885ec7e2754 100644 --- a/server/sonar-web/src/main/js/apps/tutorials/onboarding/AnalysisStep.js +++ b/server/sonar-web/src/main/js/apps/tutorials/onboarding/AnalysisStep.js @@ -29,6 +29,7 @@ import Msvc from './commands/Msvc'; import ClangGCC from './commands/ClangGCC'; import Other from './commands/Other'; import { translate } from '../../../helpers/l10n'; +import { getHostUrl } from '../../../helpers/urls'; /*:: type Props = {| @@ -63,8 +64,6 @@ export default class AnalysisStep extends React.PureComponent { this.props.onReset(); }; - getHost = () => window.location.origin + window.baseUrl; - renderForm = () => { return ( <div className="boxed-group-inner"> @@ -111,7 +110,7 @@ export default class AnalysisStep extends React.PureComponent { renderCommandForMaven = () => ( <JavaMaven - host={this.getHost()} + host={getHostUrl()} organization={this.props.organization} token={this.props.token} /> @@ -119,7 +118,7 @@ export default class AnalysisStep extends React.PureComponent { renderCommandForGradle = () => ( <JavaGradle - host={this.getHost()} + host={getHostUrl()} organization={this.props.organization} token={this.props.token} /> @@ -128,7 +127,7 @@ export default class AnalysisStep extends React.PureComponent { renderCommandForDotNet = () => { return ( <DotNet - host={this.getHost()} + host={getHostUrl()} organization={this.props.organization} // $FlowFixMe projectKey={this.state.result.projectKey} @@ -140,7 +139,7 @@ export default class AnalysisStep extends React.PureComponent { renderCommandForMSVC = () => { return ( <Msvc - host={this.getHost()} + host={getHostUrl()} organization={this.props.organization} // $FlowFixMe projectKey={this.state.result.projectKey} @@ -151,7 +150,7 @@ export default class AnalysisStep extends React.PureComponent { renderCommandForClangGCC = () => ( <ClangGCC - host={this.getHost()} + host={getHostUrl()} organization={this.props.organization} // $FlowFixMe os={this.state.result.os} @@ -163,7 +162,7 @@ export default class AnalysisStep extends React.PureComponent { renderCommandForOther = () => ( <Other - host={this.getHost()} + host={getHostUrl()} organization={this.props.organization} // $FlowFixMe os={this.state.result.os} diff --git a/server/sonar-web/src/main/js/helpers/urls.ts b/server/sonar-web/src/main/js/helpers/urls.ts index be7d4b660dc..51666283ff8 100644 --- a/server/sonar-web/src/main/js/helpers/urls.ts +++ b/server/sonar-web/src/main/js/helpers/urls.ts @@ -36,6 +36,10 @@ export function getBaseUrl(): string { return (window as any).baseUrl; } +export function getHostUrl(): string { + return window.location.origin + getBaseUrl(); +} + export function getPathUrlAsString(path: Location): string { return `${getBaseUrl()}${path.pathname}?${stringify(omitBy(path.query, isNil))}`; } |