Browse Source

SONAR-14364 Enable project import in CE

tags/8.7.0.41497
Jeremy Davis 3 years ago
parent
commit
18a6205853
34 changed files with 565 additions and 363 deletions
  1. 4
    12
      server/sonar-web/src/main/js/apps/create/project/CreateProjectPage.tsx
  2. 1
    6
      server/sonar-web/src/main/js/apps/create/project/__tests__/CreateProjectPage-test.tsx
  3. 0
    22
      server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/CreateProjectPage-test.tsx.snap
  4. 4
    9
      server/sonar-web/src/main/js/apps/projects/components/ProjectCreationMenu.tsx
  5. 1
    8
      server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCreationMenu-test.tsx
  6. 3
    3
      server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/PageHeader-test.tsx.snap
  7. 58
    10
      server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmBindingDefinitionBox.tsx
  8. 0
    8
      server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmIntegration.tsx
  9. 8
    4
      server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmIntegrationRenderer.tsx
  10. 3
    0
      server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmTab.tsx
  11. 6
    25
      server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmTabRenderer.tsx
  12. 3
    0
      server/sonar-web/src/main/js/apps/settings/components/almIntegration/AzureTab.tsx
  13. 3
    0
      server/sonar-web/src/main/js/apps/settings/components/almIntegration/BitbucketTab.tsx
  14. 75
    0
      server/sonar-web/src/main/js/apps/settings/components/almIntegration/CreationTooltip.tsx
  15. 35
    38
      server/sonar-web/src/main/js/apps/settings/components/almIntegration/GithubTab.tsx
  16. 29
    32
      server/sonar-web/src/main/js/apps/settings/components/almIntegration/GitlabTab.tsx
  17. 11
    0
      server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmBindingDefinitionBox-test.tsx
  18. 1
    0
      server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmTab-test.tsx
  19. 1
    0
      server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmTabRenderer-test.tsx
  20. 1
    0
      server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AzureTab-test.tsx
  21. 1
    0
      server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/BitbucketTab-test.tsx
  22. 42
    0
      server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/CreationTooltip-test.tsx
  23. 0
    1
      server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/GithubTab-test.tsx
  24. 0
    1
      server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/GitlabTab-test.tsx
  25. 141
    26
      server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AlmBindingDefinitionBox-test.tsx.snap
  26. 26
    12
      server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AlmIntegrationRenderer-test.tsx.snap
  27. 1
    0
      server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AlmTab-test.tsx.snap
  28. 58
    116
      server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AlmTabRenderer-test.tsx.snap
  29. 1
    0
      server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AzureTab-test.tsx.snap
  30. 1
    0
      server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/BitbucketTab-test.tsx.snap
  31. 40
    0
      server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/CreationTooltip-test.tsx.snap
  32. 1
    15
      server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/GithubTab-test.tsx.snap
  33. 3
    15
      server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/GitlabTab-test.tsx.snap
  34. 3
    0
      sonar-core/src/main/resources/org/sonar/l10n/core.properties

+ 4
- 12
server/sonar-web/src/main/js/apps/create/project/CreateProjectPage.tsx View File

@@ -37,7 +37,7 @@ import './style.css';
import { CreateProjectModes } from './types';

interface Props extends Pick<WithRouterProps, 'router' | 'location'> {
appState: Pick<T.AppState, 'branchesEnabled' | 'canAdmin'>;
appState: Pick<T.AppState, 'canAdmin'>;
currentUser: T.LoggedInUser;
}

@@ -60,13 +60,8 @@ export class CreateProjectPage extends React.PureComponent<Props, State> {
};

componentDidMount() {
const {
appState: { branchesEnabled }
} = this.props;
this.mounted = true;
if (branchesEnabled) {
this.fetchAlmBindings();
}
this.fetchAlmBindings();
}

componentWillUnmount() {
@@ -192,10 +187,7 @@ export class CreateProjectPage extends React.PureComponent<Props, State> {
}

render() {
const {
appState: { branchesEnabled },
location
} = this.props;
const { location } = this.props;
const mode: CreateProjectModes | undefined = location.query?.mode;

return (
@@ -203,7 +195,7 @@ export class CreateProjectPage extends React.PureComponent<Props, State> {
<Helmet title={translate('my_account.create_new.TRK')} titleTemplate="%s" />
<A11ySkipTarget anchor="create_project_main" />
<div className="page page-limited huge-spacer-bottom position-relative" id="create-project">
{this.renderForm(branchesEnabled ? mode : CreateProjectModes.Manual)}
{this.renderForm(mode)}
</div>
</>
);

+ 1
- 6
server/sonar-web/src/main/js/apps/create/project/__tests__/CreateProjectPage-test.tsx View File

@@ -36,11 +36,6 @@ it('should render correctly', () => {
expect(getAlmSettings).toBeCalled();
});

it('should render correctly if no branch support', () => {
expect(shallowRender({ appState: { branchesEnabled: false } })).toMatchSnapshot();
expect(getAlmSettings).not.toBeCalled();
});

it('should render correctly if the manual method is selected', () => {
expect(
shallowRender({
@@ -82,7 +77,7 @@ it('should render correctly if the GitLab method is selected', () => {
function shallowRender(props: Partial<CreateProjectPage['props']> = {}) {
return shallow<CreateProjectPage>(
<CreateProjectPage
appState={{ branchesEnabled: true }}
appState={{}}
currentUser={mockLoggedInUser()}
location={mockLocation()}
router={mockRouter()}

+ 0
- 22
server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/CreateProjectPage-test.tsx.snap View File

@@ -31,28 +31,6 @@ exports[`should render correctly 1`] = `
</Fragment>
`;

exports[`should render correctly if no branch support 1`] = `
<Fragment>
<Helmet
defer={true}
encodeSpecialCharacters={true}
title="my_account.create_new.TRK"
titleTemplate="%s"
/>
<A11ySkipTarget
anchor="create_project_main"
/>
<div
className="page page-limited huge-spacer-bottom position-relative"
id="create-project"
>
<ManualProjectCreate
onProjectCreate={[Function]}
/>
</div>
</Fragment>
`;

exports[`should render correctly if the Azure method is selected 1`] = `
<Fragment>
<Helmet

+ 4
- 9
server/sonar-web/src/main/js/apps/projects/components/ProjectCreationMenu.tsx View File

@@ -23,14 +23,12 @@ import Dropdown from 'sonar-ui-common/components/controls/Dropdown';
import DropdownIcon from 'sonar-ui-common/components/icons/DropdownIcon';
import { translate } from 'sonar-ui-common/helpers/l10n';
import { getAlmSettings } from '../../../api/alm-settings';
import { withAppState } from '../../../components/hoc/withAppState';
import { withCurrentUser } from '../../../components/hoc/withCurrentUser';
import { hasGlobalPermission } from '../../../helpers/users';
import { AlmKeys, AlmSettingsInstance } from '../../../types/alm-settings';
import ProjectCreationMenuItem from './ProjectCreationMenuItem';

interface Props {
appState: Pick<T.AppState, 'branchesEnabled'>;
className?: string;
currentUser: T.LoggedInUser;
}
@@ -71,18 +69,15 @@ export class ProjectCreationMenu extends React.PureComponent<Props, State> {
};

fetchAlmBindings = async () => {
const {
appState: { branchesEnabled },
currentUser
} = this.props;
const { currentUser } = this.props;
const canCreateProject = hasGlobalPermission(currentUser, PROJECT_CREATION_PERMISSION);

// getAlmSettings requires branchesEnabled
if (!canCreateProject || !branchesEnabled) {
if (!canCreateProject) {
return;
}

const almSettings = await getAlmSettings();
const almSettings: AlmSettingsInstance[] = await getAlmSettings().catch(() => []);

// Import is only available if exactly one binding is configured
const boundAlms = IMPORT_COMPATIBLE_ALMS.filter(key => {
@@ -129,4 +124,4 @@ export class ProjectCreationMenu extends React.PureComponent<Props, State> {
}
}

export default withAppState(withCurrentUser(ProjectCreationMenu));
export default withCurrentUser(ProjectCreationMenu);

+ 1
- 8
server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCreationMenu-test.tsx View File

@@ -21,7 +21,7 @@ import { shallow } from 'enzyme';
import * as React from 'react';
import { waitAndUpdate } from 'sonar-ui-common/helpers/testUtils';
import { getAlmSettings } from '../../../../api/alm-settings';
import { mockAppState, mockLoggedInUser } from '../../../../helpers/testMocks';
import { mockLoggedInUser } from '../../../../helpers/testMocks';
import { AlmKeys } from '../../../../types/alm-settings';
import { ProjectCreationMenu } from '../ProjectCreationMenu';

@@ -52,12 +52,6 @@ it('should not fetch alm bindings if user cannot create projects', async () => {
expect(getAlmSettings).not.toBeCalled();
});

it('should not fetch alm bindings if branches are not enabled', async () => {
const wrapper = shallowRender({ appState: mockAppState({ branchesEnabled: false }) });
await waitAndUpdate(wrapper);
expect(getAlmSettings).not.toBeCalled();
});

it('should filter alm bindings appropriately', async () => {
(getAlmSettings as jest.Mock).mockResolvedValueOnce([
{ alm: AlmKeys.Azure },
@@ -77,7 +71,6 @@ it('should filter alm bindings appropriately', async () => {
function shallowRender(overrides: Partial<ProjectCreationMenu['props']> = {}) {
return shallow<ProjectCreationMenu>(
<ProjectCreationMenu
appState={mockAppState({ branchesEnabled: true })}
currentUser={mockLoggedInUser({ permissions: { global: ['provisioning'] } })}
{...overrides}
/>

+ 3
- 3
server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/PageHeader-test.tsx.snap View File

@@ -18,7 +18,7 @@ exports[`should render correctly 1`] = `
<div
className="display-flex-center"
>
<Connect(withAppState(Connect(withCurrentUser(ProjectCreationMenu))))
<Connect(withCurrentUser(ProjectCreationMenu))
className="little-spacer-right"
/>
<Connect(withAppState(Connect(withCurrentUser(withRouter(ApplicationCreation)))))
@@ -96,7 +96,7 @@ exports[`should render correctly while loading 1`] = `
<div
className="display-flex-center"
>
<Connect(withAppState(Connect(withCurrentUser(ProjectCreationMenu))))
<Connect(withCurrentUser(ProjectCreationMenu))
className="little-spacer-right"
/>
<Connect(withAppState(Connect(withCurrentUser(withRouter(ApplicationCreation)))))
@@ -174,7 +174,7 @@ exports[`should render disabled sorting options for visualizations 1`] = `
<div
className="display-flex-center"
>
<Connect(withAppState(Connect(withCurrentUser(ProjectCreationMenu))))
<Connect(withCurrentUser(ProjectCreationMenu))
className="little-spacer-right"
/>
<Connect(withAppState(Connect(withCurrentUser(withRouter(ApplicationCreation)))))

+ 58
- 10
server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmBindingDefinitionBox.tsx View File

@@ -18,6 +18,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
import { Button } from 'sonar-ui-common/components/controls/buttons';
import HelpTooltip from 'sonar-ui-common/components/controls/HelpTooltip';
import Tooltip from 'sonar-ui-common/components/controls/Tooltip';
@@ -27,15 +28,18 @@ import DeleteIcon from 'sonar-ui-common/components/icons/DeleteIcon';
import EditIcon from 'sonar-ui-common/components/icons/EditIcon';
import { Alert } from 'sonar-ui-common/components/ui/Alert';
import { translate } from 'sonar-ui-common/helpers/l10n';
import { getEdition, getEditionUrl } from '../../../../helpers/editions';
import {
AlmBindingDefinition,
AlmKeys,
AlmSettingsBindingStatus,
AlmSettingsBindingStatusType
} from '../../../../types/alm-settings';
import { EditionKey } from '../../../../types/editions';

export interface AlmBindingDefinitionBoxProps {
alm: AlmKeys;
branchesEnabled: boolean;
definition: AlmBindingDefinition;
multipleDefinitions: boolean;
onCheck: (definitionKey: string) => void;
@@ -55,6 +59,48 @@ const STATUS_ICON = {
[AlmSettingsBindingStatusType.Success]: <AlertSuccessIcon className="spacer-left" />
};

function getPRDecorationFeatureStatus(
branchesEnabled: boolean,
type: AlmSettingsBindingStatusType.Success | AlmSettingsBindingStatusType.Failure
) {
if (branchesEnabled) {
return STATUS_ICON[type];
}

return (
<div className="display-inline-flex-center">
<strong className="spacer-left">
{translate('settings.almintegration.feature.pr_decoration.disabled')}
</strong>
<HelpTooltip
className="little-spacer-left"
overlay={
<FormattedMessage
id="settings.almintegration.feature.pr_decoration.disabled.no_branches"
defaultMessage={translate(
'settings.almintegration.feature.pr_decoration.disabled.no_branches'
)}
values={{
link: (
<a
href={getEditionUrl(getEdition(EditionKey.developer), {
sourceEdition: EditionKey.community
})}
rel="noopener noreferrer"
target="_blank">
{translate(
'settings.almintegration.feature.pr_decoration.disabled.no_branches.link'
)}
</a>
)
}}
/>
}
/>
</div>
);
}

function getImportFeatureStatus(
definition: AlmBindingDefinition,
multipleDefinitions: boolean,
@@ -72,7 +118,9 @@ function getImportFeatureStatus(
/>
</div>
);
} else if (!definition.url) {
}

if (!definition.url) {
return (
<div className="display-inline-flex-center">
<strong className="spacer-left">
@@ -84,13 +132,13 @@ function getImportFeatureStatus(
/>
</div>
);
} else {
return STATUS_ICON[type];
}

return STATUS_ICON[type];
}

export default function AlmBindingDefinitionBox(props: AlmBindingDefinitionBoxProps) {
const { alm, definition, multipleDefinitions, status = DEFAULT_STATUS } = props;
const { alm, branchesEnabled, definition, multipleDefinitions, status = DEFAULT_STATUS } = props;

const importFeatureTitle =
alm === AlmKeys.GitLab
@@ -129,12 +177,12 @@ export default function AlmBindingDefinitionBox(props: AlmBindingDefinitionBoxPr
<>
{status.type !== AlmSettingsBindingStatusType.Warning && (
<div className="display-flex-row spacer-bottom">
<Tooltip overlay={importFeatureDescription}>
<div className="huge-spacer-right">
{importFeatureTitle}
{STATUS_ICON[status.type]}
</div>
</Tooltip>
<div className="huge-spacer-right">
<Tooltip overlay={importFeatureDescription}>
<span>{importFeatureTitle}</span>
</Tooltip>
{getPRDecorationFeatureStatus(branchesEnabled, status.type)}
</div>
<div>
<Tooltip
overlay={translate(

+ 0
- 8
server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmIntegration.tsx View File

@@ -101,14 +101,6 @@ export class AlmIntegration extends React.PureComponent<Props, State> {
};

fetchPullRequestDecorationSetting = () => {
const {
appState: { branchesEnabled }
} = this.props;

if (!branchesEnabled) {
return Promise.resolve();
}

this.setState({ loadingAlmDefinitions: true });
return getAlmDefinitions()
.then(definitions => {

+ 8
- 4
server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmIntegrationRenderer.tsx View File

@@ -64,7 +64,8 @@ const tabs = [
/>
GitHub
</>
)
),
requiresBranchesEnabled: false
},
{
key: AlmKeys.Bitbucket,
@@ -79,7 +80,7 @@ const tabs = [
Bitbucket Server
</>
),
requiresBranchesEnabled: true
requiresBranchesEnabled: false
},
{
key: AlmKeys.Azure,
@@ -94,7 +95,7 @@ const tabs = [
Azure DevOps Server
</>
),
requiresBranchesEnabled: true
requiresBranchesEnabled: false
},
{
key: AlmKeys.GitLab,
@@ -108,7 +109,8 @@ const tabs = [
/>
GitLab
</>
)
),
requiresBranchesEnabled: false
}
];

@@ -143,6 +145,7 @@ export default function AlmIntegrationRenderer(props: AlmIntegrationRendererProp

{currentAlm === AlmKeys.Azure && (
<AzureTab
branchesEnabled={branchesEnabled}
definitions={definitions.azure}
definitionStatus={definitionStatus}
loadingAlmDefinitions={loadingAlmDefinitions}
@@ -155,6 +158,7 @@ export default function AlmIntegrationRenderer(props: AlmIntegrationRendererProp
)}
{currentAlm === AlmKeys.Bitbucket && (
<BitbucketTab
branchesEnabled={branchesEnabled}
definitions={definitions.bitbucket}
definitionStatus={definitionStatus}
loadingAlmDefinitions={loadingAlmDefinitions}

+ 3
- 0
server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmTab.tsx View File

@@ -28,6 +28,7 @@ import AlmTabRenderer from './AlmTabRenderer';

interface Props<B> {
alm: AlmKeys;
branchesEnabled: boolean;
createConfiguration: (data: B) => Promise<void>;
defaultBinding: B;
definitions: B[];
@@ -109,6 +110,7 @@ export default class AlmTab<B extends AlmBindingDefinition> extends React.PureCo
render() {
const {
alm,
branchesEnabled,
defaultBinding,
definitions,
definitionStatus,
@@ -124,6 +126,7 @@ export default class AlmTab<B extends AlmBindingDefinition> extends React.PureCo
return (
<AlmTabRenderer
alm={alm}
branchesEnabled={branchesEnabled}
defaultBinding={defaultBinding}
definitions={definitions}
definitionStatus={definitionStatus}

+ 6
- 25
server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmTabRenderer.tsx View File

@@ -18,25 +18,23 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
import { Button } from 'sonar-ui-common/components/controls/buttons';
import Tooltip from 'sonar-ui-common/components/controls/Tooltip';
import DeferredSpinner from 'sonar-ui-common/components/ui/DeferredSpinner';
import { translate } from 'sonar-ui-common/helpers/l10n';
import { getEdition, getEditionUrl } from '../../../../helpers/editions';
import {
AlmBindingDefinition,
AlmKeys,
AlmSettingsBindingStatus
} from '../../../../types/alm-settings';
import { EditionKey } from '../../../../types/editions';
import AlmBindingDefinitionBox from './AlmBindingDefinitionBox';
import AlmBindingDefinitionForm, {
AlmBindingDefinitionFormChildrenProps
} from './AlmBindingDefinitionForm';
import CreationTooltip from './CreationTooltip';

export interface AlmTabRendererProps<B> {
alm: AlmKeys;
branchesEnabled: boolean;
definitionStatus: T.Dict<AlmSettingsBindingStatus>;
editedDefinition?: B;
defaultBinding: B;
@@ -62,6 +60,7 @@ export default function AlmTabRenderer<B extends AlmBindingDefinition>(
) {
const {
alm,
branchesEnabled,
definitions,
definitionStatus,
editedDefinition,
@@ -74,25 +73,6 @@ export default function AlmTabRenderer<B extends AlmBindingDefinition>(
} = props;

const preventCreation = loadingProjectCount || (!multipleAlmEnabled && definitions.length > 0);
const creationTooltip = preventCreation ? (
<FormattedMessage
id="settings.almintegration.create.tooltip"
defaultMessage={translate('settings.almintegration.create.tooltip')}
values={{
link: (
<a
href={getEditionUrl(getEdition(EditionKey.enterprise), {
sourceEdition: EditionKey.developer
})}
rel="noopener noreferrer"
target="_blank">
{translate('settings.almintegration.create.tooltip.link')}
</a>
),
alm: translate('alm', alm)
}}
/>
) : null;

return (
<div className="big-padded">
@@ -102,18 +82,19 @@ export default function AlmTabRenderer<B extends AlmBindingDefinition>(
)}

<div className={definitions.length > 0 ? 'spacer-bottom text-right' : 'big-spacer-top'}>
<Tooltip overlay={creationTooltip} mouseLeaveDelay={0.25}>
<CreationTooltip alm={alm} preventCreation={preventCreation}>
<Button
data-test="settings__alm-create"
disabled={preventCreation}
onClick={props.onCreate}>
{translate('settings.almintegration.create')}
</Button>
</Tooltip>
</CreationTooltip>
</div>
{definitions.map(def => (
<AlmBindingDefinitionBox
alm={alm}
branchesEnabled={branchesEnabled}
definition={def}
key={def.key}
multipleDefinitions={definitions.length > 1}

+ 3
- 0
server/sonar-web/src/main/js/apps/settings/components/almIntegration/AzureTab.tsx View File

@@ -32,6 +32,7 @@ import AlmTab from './AlmTab';
import AzureForm from './AzureForm';

export interface AzureTabProps {
branchesEnabled: boolean;
definitions: AzureBindingDefinition[];
definitionStatus: T.Dict<AlmSettingsBindingStatus>;
loadingAlmDefinitions: boolean;
@@ -44,6 +45,7 @@ export interface AzureTabProps {

export default function AzureTab(props: AzureTabProps) {
const {
branchesEnabled,
multipleAlmEnabled,
definitions,
definitionStatus,
@@ -55,6 +57,7 @@ export default function AzureTab(props: AzureTabProps) {
<div className="bordered">
<AlmTab
alm={AlmKeys.Azure}
branchesEnabled={branchesEnabled}
createConfiguration={createAzureConfiguration}
defaultBinding={{ key: '', personalAccessToken: '', url: '' }}
definitions={definitions}

+ 3
- 0
server/sonar-web/src/main/js/apps/settings/components/almIntegration/BitbucketTab.tsx View File

@@ -34,6 +34,7 @@ import AlmTab from './AlmTab';
import BitbucketForm from './BitbucketForm';

export interface BitbucketTabProps {
branchesEnabled: boolean;
definitions: BitbucketBindingDefinition[];
definitionStatus: T.Dict<AlmSettingsBindingStatus>;
loadingAlmDefinitions: boolean;
@@ -46,6 +47,7 @@ export interface BitbucketTabProps {

export default function BitbucketTab(props: BitbucketTabProps) {
const {
branchesEnabled,
multipleAlmEnabled,
definitions,
definitionStatus,
@@ -57,6 +59,7 @@ export default function BitbucketTab(props: BitbucketTabProps) {
<div className="bordered">
<AlmTab
alm={AlmKeys.Bitbucket}
branchesEnabled={branchesEnabled}
createConfiguration={createBitbucketConfiguration}
defaultBinding={{ key: '', url: '', personalAccessToken: '' }}
definitions={definitions}

+ 75
- 0
server/sonar-web/src/main/js/apps/settings/components/almIntegration/CreationTooltip.tsx View File

@@ -0,0 +1,75 @@
/*
* SonarQube
* Copyright (C) 2009-2021 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
import Tooltip from 'sonar-ui-common/components/controls/Tooltip';
import { translate } from 'sonar-ui-common/helpers/l10n';
import { withAppState } from '../../../../components/hoc/withAppState';
import { getEdition, getEditionUrl } from '../../../../helpers/editions';
import { AlmKeys } from '../../../../types/alm-settings';
import { EditionKey } from '../../../../types/editions';

export interface CreationTooltipProps {
alm: AlmKeys;
appState: T.AppState;
children: React.ReactElement<{}>;
preventCreation: boolean;
}

export function CreationTooltip(props: CreationTooltipProps) {
const {
alm,
appState: { edition },
children,
preventCreation
} = props;

const sourceEdition = edition ? EditionKey[edition] : undefined;

return (
<Tooltip
overlay={
preventCreation ? (
<FormattedMessage
id="settings.almintegration.create.tooltip"
defaultMessage={translate('settings.almintegration.create.tooltip')}
values={{
link: (
<a
href={getEditionUrl(getEdition(EditionKey.enterprise), {
sourceEdition
})}
rel="noopener noreferrer"
target="_blank">
{translate('settings.almintegration.create.tooltip.link')}
</a>
),
alm: translate('alm', alm)
}}
/>
) : null
}
mouseLeaveDelay={0.25}>
{children}
</Tooltip>
);
}

export default withAppState(CreationTooltip);

+ 35
- 38
server/sonar-web/src/main/js/apps/settings/components/almIntegration/GithubTab.tsx View File

@@ -59,47 +59,44 @@ export default function GithubTab(props: GithubTabProps) {

return (
<div className="bordered">
{branchesEnabled && (
<>
<AlmTab
alm={AlmKeys.GitHub}
createConfiguration={createGithubConfiguration}
defaultBinding={{
key: '',
appId: '',
clientId: '',
clientSecret: '',
url: '',
privateKey: ''
<AlmTab
alm={AlmKeys.GitHub}
branchesEnabled={branchesEnabled}
createConfiguration={createGithubConfiguration}
defaultBinding={{
key: '',
appId: '',
clientId: '',
clientSecret: '',
url: '',
privateKey: ''
}}
definitions={definitions}
definitionStatus={definitionStatus}
form={childProps => <GithubForm {...childProps} />}
help={
<FormattedMessage
defaultMessage={translate(`settings.almintegration.github.info`)}
id="settings.almintegration.github.info"
values={{
link: (
<Link target="_blank" to={ALM_DOCUMENTATION_PATHS[AlmKeys.GitHub]}>
{translate('learn_more')}
</Link>
)
}}
definitions={definitions}
definitionStatus={definitionStatus}
form={childProps => <GithubForm {...childProps} />}
help={
<FormattedMessage
defaultMessage={translate(`settings.almintegration.github.info`)}
id="settings.almintegration.github.info"
values={{
link: (
<Link target="_blank" to={ALM_DOCUMENTATION_PATHS[AlmKeys.GitHub]}>
{translate('learn_more')}
</Link>
)
}}
/>
}
loadingAlmDefinitions={loadingAlmDefinitions}
loadingProjectCount={loadingProjectCount}
multipleAlmEnabled={multipleAlmEnabled}
onCheck={props.onCheck}
onDelete={props.onDelete}
onUpdateDefinitions={props.onUpdateDefinitions}
updateConfiguration={updateGithubConfiguration}
/>
}
loadingAlmDefinitions={loadingAlmDefinitions}
loadingProjectCount={loadingProjectCount}
multipleAlmEnabled={multipleAlmEnabled}
onCheck={props.onCheck}
onDelete={props.onDelete}
onUpdateDefinitions={props.onUpdateDefinitions}
updateConfiguration={updateGithubConfiguration}
/>

<div className="huge-spacer-top huge-spacer-bottom bordered-top" />
</>
)}
<div className="huge-spacer-top huge-spacer-bottom bordered-top" />

<div className="big-padded">
<CategoryDefinitionsList

+ 29
- 32
server/sonar-web/src/main/js/apps/settings/components/almIntegration/GitlabTab.tsx View File

@@ -59,40 +59,37 @@ export default function GitlabTab(props: GitlabTabProps) {

return (
<div className="bordered">
{branchesEnabled && (
<>
<AlmTab
alm={AlmKeys.GitLab}
createConfiguration={createGitlabConfiguration}
defaultBinding={{ key: '', personalAccessToken: '', url: '' }}
definitions={definitions}
definitionStatus={definitionStatus}
form={childProps => <GitlabForm {...childProps} />}
help={
<FormattedMessage
defaultMessage={translate(`settings.almintegration.gitlab.info`)}
id="settings.almintegration.gitlab.info"
values={{
link: (
<Link target="_blank" to={ALM_DOCUMENTATION_PATHS[AlmKeys.GitLab]}>
{translate('learn_more')}
</Link>
)
}}
/>
}
loadingAlmDefinitions={loadingAlmDefinitions}
loadingProjectCount={loadingProjectCount}
multipleAlmEnabled={multipleAlmEnabled}
onCheck={props.onCheck}
onDelete={props.onDelete}
onUpdateDefinitions={props.onUpdateDefinitions}
updateConfiguration={updateGitlabConfiguration}
<AlmTab
alm={AlmKeys.GitLab}
branchesEnabled={branchesEnabled}
createConfiguration={createGitlabConfiguration}
defaultBinding={{ key: '', personalAccessToken: '', url: '' }}
definitions={definitions}
definitionStatus={definitionStatus}
form={childProps => <GitlabForm {...childProps} />}
help={
<FormattedMessage
defaultMessage={translate(`settings.almintegration.gitlab.info`)}
id="settings.almintegration.gitlab.info"
values={{
link: (
<Link target="_blank" to={ALM_DOCUMENTATION_PATHS[AlmKeys.GitLab]}>
{translate('learn_more')}
</Link>
)
}}
/>
}
loadingAlmDefinitions={loadingAlmDefinitions}
loadingProjectCount={loadingProjectCount}
multipleAlmEnabled={multipleAlmEnabled}
onCheck={props.onCheck}
onDelete={props.onDelete}
onUpdateDefinitions={props.onUpdateDefinitions}
updateConfiguration={updateGitlabConfiguration}
/>

<div className="huge-spacer-top huge-spacer-bottom bordered-top" />
</>
)}
<div className="huge-spacer-top huge-spacer-bottom bordered-top" />

<div className="big-padded">
<CategoryDefinitionsList

+ 11
- 0
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmBindingDefinitionBox-test.tsx View File

@@ -66,12 +66,23 @@ it('should render correctly', () => {
expect(
shallowRender({ alm: AlmKeys.Azure, definition: mockAzureBindingDefinition() })
).toMatchSnapshot('Azure DevOps');

expect(
shallowRender({
branchesEnabled: false,
status: mockAlmSettingsBindingStatus({
alertSuccess: true,
type: AlmSettingsBindingStatusType.Success
})
})
).toMatchSnapshot('success with branches disabled');
});

function shallowRender(props: Partial<AlmBindingDefinitionBoxProps> = {}) {
return shallow(
<AlmBindingDefinitionBox
alm={AlmKeys.GitHub}
branchesEnabled={true}
definition={mockGithubBindingDefinition()}
multipleDefinitions={false}
onCheck={jest.fn()}

+ 1
- 0
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmTab-test.tsx View File

@@ -95,6 +95,7 @@ function shallowRender(props: Partial<AlmTab<AzureBindingDefinition>['props']> =
return shallow<AlmTab<AzureBindingDefinition>>(
<AlmTab
alm={AlmKeys.Azure}
branchesEnabled={true}
createConfiguration={jest.fn()}
defaultBinding={DEFAULT_BINDING}
definitions={[mockAzureBindingDefinition()]}

+ 1
- 0
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmTabRenderer-test.tsx View File

@@ -93,6 +93,7 @@ function shallowRender<B extends AlmBindingDefinition>(
return shallow(
<AlmTabRenderer
alm={AlmKeys.Azure}
branchesEnabled={true}
defaultBinding={{} as any}
definitions={[]}
definitionStatus={{}}

+ 1
- 0
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AzureTab-test.tsx View File

@@ -29,6 +29,7 @@ it('should render correctly', () => {
function shallowRender(props: Partial<AzureTabProps> = {}) {
return shallow(
<AzureTab
branchesEnabled={true}
definitions={[mockAzureBindingDefinition()]}
definitionStatus={{}}
loadingAlmDefinitions={false}

+ 1
- 0
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/BitbucketTab-test.tsx View File

@@ -29,6 +29,7 @@ it('should render correctly', () => {
function shallowRender(props: Partial<BitbucketTabProps> = {}) {
return shallow(
<BitbucketTab
branchesEnabled={true}
definitions={[mockBitbucketBindingDefinition()]}
definitionStatus={{}}
loadingAlmDefinitions={false}

+ 42
- 0
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/CreationTooltip-test.tsx View File

@@ -0,0 +1,42 @@
/*
* SonarQube
* Copyright (C) 2009-2021 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { shallow } from 'enzyme';
import * as React from 'react';
import { mockAppState } from '../../../../../helpers/testMocks';
import { AlmKeys } from '../../../../../types/alm-settings';
import { EditionKey } from '../../../../../types/editions';
import { CreationTooltip, CreationTooltipProps } from '../CreationTooltip';

it('should render correctly', () => {
expect(shallowRender()).toMatchSnapshot();
expect(shallowRender({ preventCreation: false })).toMatchSnapshot();
});

function shallowRender(props: Partial<CreationTooltipProps> = {}) {
return shallow(
<CreationTooltip
alm={AlmKeys.Azure}
appState={mockAppState({ edition: EditionKey.community })}
preventCreation={true}
{...props}>
<span>Child</span>
</CreationTooltip>
);
}

+ 0
- 1
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/GithubTab-test.tsx View File

@@ -24,7 +24,6 @@ import GithubTab, { GithubTabProps } from '../GithubTab';

it('should render correctly', () => {
expect(shallowRender()).toMatchSnapshot('with branch support');
expect(shallowRender({ branchesEnabled: false })).toMatchSnapshot('without branch support');
});

function shallowRender(props: Partial<GithubTabProps> = {}) {

+ 0
- 1
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/GitlabTab-test.tsx View File

@@ -24,7 +24,6 @@ import GitlabTab, { GitlabTabProps } from '../GitlabTab';

it('should render correctly', () => {
expect(shallowRender()).toMatchSnapshot('with branch support');
expect(shallowRender({ branchesEnabled: false })).toMatchSnapshot('without branch support');
expect(
shallowRender({
definitions: [mockGitlabBindingDefinition({ url: 'https://gitlab.com/api/v4' })]

+ 141
- 26
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AlmBindingDefinitionBox-test.tsx.snap View File

@@ -119,18 +119,20 @@ exports[`should render correctly: error 1`] = `
<div
className="display-flex-row spacer-bottom"
>
<Tooltip
overlay="settings.almintegration.feature.pr_decoration.description"
<div
className="huge-spacer-right"
>
<div
className="huge-spacer-right"
<Tooltip
overlay="settings.almintegration.feature.pr_decoration.description"
>
settings.almintegration.feature.pr_decoration.title
<AlertErrorIcon
className="spacer-left"
/>
</div>
</Tooltip>
<span>
settings.almintegration.feature.pr_decoration.title
</span>
</Tooltip>
<AlertErrorIcon
className="spacer-left"
/>
</div>
<div>
<Tooltip
overlay="settings.almintegration.feature.alm_repo_import.description"
@@ -242,18 +244,20 @@ exports[`should render correctly: success 1`] = `
<div
className="display-flex-row spacer-bottom"
>
<Tooltip
overlay="settings.almintegration.feature.pr_decoration.description"
<div
className="huge-spacer-right"
>
<div
className="huge-spacer-right"
<Tooltip
overlay="settings.almintegration.feature.pr_decoration.description"
>
settings.almintegration.feature.pr_decoration.title
<AlertSuccessIcon
className="spacer-left"
/>
</div>
</Tooltip>
<span>
settings.almintegration.feature.pr_decoration.title
</span>
</Tooltip>
<AlertSuccessIcon
className="spacer-left"
/>
</div>
<div>
<Tooltip
overlay="settings.almintegration.feature.alm_repo_import.description"
@@ -317,18 +321,129 @@ exports[`should render correctly: success with alert 1`] = `
<div
className="display-flex-row spacer-bottom"
>
<Tooltip
overlay="settings.almintegration.feature.pr_decoration.description"
<div
className="huge-spacer-right"
>
<Tooltip
overlay="settings.almintegration.feature.pr_decoration.description"
>
<span>
settings.almintegration.feature.pr_decoration.title
</span>
</Tooltip>
<AlertSuccessIcon
className="spacer-left"
/>
</div>
<div>
<Tooltip
overlay="settings.almintegration.feature.alm_repo_import.description"
>
<span>
settings.almintegration.feature.alm_repo_import.title
</span>
</Tooltip>
<AlertSuccessIcon
className="spacer-left"
/>
</div>
</div>
<div
className="width-50"
>
<Alert
variant="success"
>
settings.almintegration.configuration_valid
</Alert>
</div>
<Button
className="big-spacer-top"
onClick={[Function]}
>
settings.almintegration.check_configuration
</Button>
</div>
`;

exports[`should render correctly: success with branches disabled 1`] = `
<div
className="boxed-group-inner bordered spacer-top spacer-bottom it__alm-binding-definition"
>
<div
className="actions pull-right"
>
<Button
onClick={[Function]}
>
<EditIcon
className="spacer-right"
/>
edit
</Button>
<Button
className="button-red spacer-left"
onClick={[Function]}
>
<DeleteIcon
className="spacer-right"
/>
delete
</Button>
</div>
<div
className="big-spacer-bottom"
>
<h3>
key
</h3>
<span>
http://github.enterprise.com
</span>
</div>
<div
className="display-flex-row spacer-bottom"
>
<div
className="huge-spacer-right"
>
<Tooltip
overlay="settings.almintegration.feature.pr_decoration.description"
>
<span>
settings.almintegration.feature.pr_decoration.title
</span>
</Tooltip>
<div
className="huge-spacer-right"
className="display-inline-flex-center"
>
settings.almintegration.feature.pr_decoration.title
<AlertSuccessIcon
<strong
className="spacer-left"
>
settings.almintegration.feature.pr_decoration.disabled
</strong>
<HelpTooltip
className="little-spacer-left"
overlay={
<FormattedMessage
defaultMessage="settings.almintegration.feature.pr_decoration.disabled.no_branches"
id="settings.almintegration.feature.pr_decoration.disabled.no_branches"
values={
Object {
"link": <a
href="https://redirect.sonarsource.com/editions/developer.html?sourceEdition=community"
rel="noopener noreferrer"
target="_blank"
>
settings.almintegration.feature.pr_decoration.disabled.no_branches.link
</a>,
}
}
/>
}
/>
</div>
</Tooltip>
</div>
<div>
<Tooltip
overlay="settings.almintegration.feature.alm_repo_import.description"

+ 26
- 12
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AlmIntegrationRenderer-test.tsx.snap View File

@@ -32,6 +32,7 @@ exports[`should render correctly: azure 1`] = `
/>
GitHub
</React.Fragment>,
"requiresBranchesEnabled": false,
},
Object {
"key": "bitbucket",
@@ -44,7 +45,7 @@ exports[`should render correctly: azure 1`] = `
/>
Bitbucket Server
</React.Fragment>,
"requiresBranchesEnabled": true,
"requiresBranchesEnabled": false,
},
Object {
"key": "azure",
@@ -57,7 +58,7 @@ exports[`should render correctly: azure 1`] = `
/>
Azure DevOps Server
</React.Fragment>,
"requiresBranchesEnabled": true,
"requiresBranchesEnabled": false,
},
Object {
"key": "gitlab",
@@ -70,11 +71,13 @@ exports[`should render correctly: azure 1`] = `
/>
GitLab
</React.Fragment>,
"requiresBranchesEnabled": false,
},
]
}
/>
<AzureTab
branchesEnabled={true}
definitionStatus={Object {}}
definitions={Array []}
loadingAlmDefinitions={false}
@@ -119,6 +122,7 @@ exports[`should render correctly: bitbucket 1`] = `
/>
GitHub
</React.Fragment>,
"requiresBranchesEnabled": false,
},
Object {
"key": "bitbucket",
@@ -131,7 +135,7 @@ exports[`should render correctly: bitbucket 1`] = `
/>
Bitbucket Server
</React.Fragment>,
"requiresBranchesEnabled": true,
"requiresBranchesEnabled": false,
},
Object {
"key": "azure",
@@ -144,7 +148,7 @@ exports[`should render correctly: bitbucket 1`] = `
/>
Azure DevOps Server
</React.Fragment>,
"requiresBranchesEnabled": true,
"requiresBranchesEnabled": false,
},
Object {
"key": "gitlab",
@@ -157,11 +161,13 @@ exports[`should render correctly: bitbucket 1`] = `
/>
GitLab
</React.Fragment>,
"requiresBranchesEnabled": false,
},
]
}
/>
<BitbucketTab
branchesEnabled={true}
definitionStatus={Object {}}
definitions={Array []}
loadingAlmDefinitions={false}
@@ -206,6 +212,7 @@ exports[`should render correctly: default 1`] = `
/>
GitHub
</React.Fragment>,
"requiresBranchesEnabled": false,
},
Object {
"key": "bitbucket",
@@ -218,7 +225,7 @@ exports[`should render correctly: default 1`] = `
/>
Bitbucket Server
</React.Fragment>,
"requiresBranchesEnabled": true,
"requiresBranchesEnabled": false,
},
Object {
"key": "azure",
@@ -231,7 +238,7 @@ exports[`should render correctly: default 1`] = `
/>
Azure DevOps Server
</React.Fragment>,
"requiresBranchesEnabled": true,
"requiresBranchesEnabled": false,
},
Object {
"key": "gitlab",
@@ -244,6 +251,7 @@ exports[`should render correctly: default 1`] = `
/>
GitLab
</React.Fragment>,
"requiresBranchesEnabled": false,
},
]
}
@@ -294,6 +302,7 @@ exports[`should render correctly: delete modal 1`] = `
/>
GitHub
</React.Fragment>,
"requiresBranchesEnabled": false,
},
Object {
"key": "bitbucket",
@@ -306,7 +315,7 @@ exports[`should render correctly: delete modal 1`] = `
/>
Bitbucket Server
</React.Fragment>,
"requiresBranchesEnabled": true,
"requiresBranchesEnabled": false,
},
Object {
"key": "azure",
@@ -319,7 +328,7 @@ exports[`should render correctly: delete modal 1`] = `
/>
Azure DevOps Server
</React.Fragment>,
"requiresBranchesEnabled": true,
"requiresBranchesEnabled": false,
},
Object {
"key": "gitlab",
@@ -332,6 +341,7 @@ exports[`should render correctly: delete modal 1`] = `
/>
GitLab
</React.Fragment>,
"requiresBranchesEnabled": false,
},
]
}
@@ -387,6 +397,7 @@ exports[`should render correctly: gitlab 1`] = `
/>
GitHub
</React.Fragment>,
"requiresBranchesEnabled": false,
},
Object {
"key": "bitbucket",
@@ -399,7 +410,7 @@ exports[`should render correctly: gitlab 1`] = `
/>
Bitbucket Server
</React.Fragment>,
"requiresBranchesEnabled": true,
"requiresBranchesEnabled": false,
},
Object {
"key": "azure",
@@ -412,7 +423,7 @@ exports[`should render correctly: gitlab 1`] = `
/>
Azure DevOps Server
</React.Fragment>,
"requiresBranchesEnabled": true,
"requiresBranchesEnabled": false,
},
Object {
"key": "gitlab",
@@ -425,6 +436,7 @@ exports[`should render correctly: gitlab 1`] = `
/>
GitLab
</React.Fragment>,
"requiresBranchesEnabled": false,
},
]
}
@@ -475,6 +487,7 @@ exports[`should render correctly: loading 1`] = `
/>
GitHub
</React.Fragment>,
"requiresBranchesEnabled": false,
},
Object {
"key": "bitbucket",
@@ -487,7 +500,7 @@ exports[`should render correctly: loading 1`] = `
/>
Bitbucket Server
</React.Fragment>,
"requiresBranchesEnabled": true,
"requiresBranchesEnabled": false,
},
Object {
"key": "azure",
@@ -500,7 +513,7 @@ exports[`should render correctly: loading 1`] = `
/>
Azure DevOps Server
</React.Fragment>,
"requiresBranchesEnabled": true,
"requiresBranchesEnabled": false,
},
Object {
"key": "gitlab",
@@ -513,6 +526,7 @@ exports[`should render correctly: loading 1`] = `
/>
GitLab
</React.Fragment>,
"requiresBranchesEnabled": false,
},
]
}

+ 1
- 0
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AlmTab-test.tsx.snap View File

@@ -3,6 +3,7 @@
exports[`should render correctly 1`] = `
<AlmTabRenderer
alm="azure"
branchesEnabled={true}
defaultBinding={
Object {
"key": "",

+ 58
- 116
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AlmTabRenderer-test.tsx.snap View File

@@ -10,9 +10,9 @@ exports[`should render correctly for multi-ALM binding: editing a definition 1`]
<div
className="spacer-bottom text-right"
>
<Tooltip
mouseLeaveDelay={0.25}
overlay={null}
<Connect(withAppState(CreationTooltip))
alm="azure"
preventCreation={false}
>
<Button
data-test="settings__alm-create"
@@ -21,10 +21,11 @@ exports[`should render correctly for multi-ALM binding: editing a definition 1`]
>
settings.almintegration.create
</Button>
</Tooltip>
</Connect(withAppState(CreationTooltip))>
</div>
<AlmBindingDefinitionBox
alm="azure"
branchesEnabled={true}
definition={
Object {
"key": "key",
@@ -65,9 +66,9 @@ exports[`should render correctly for multi-ALM binding: loaded 1`] = `
<div
className="spacer-bottom text-right"
>
<Tooltip
mouseLeaveDelay={0.25}
overlay={null}
<Connect(withAppState(CreationTooltip))
alm="azure"
preventCreation={false}
>
<Button
data-test="settings__alm-create"
@@ -76,10 +77,11 @@ exports[`should render correctly for multi-ALM binding: loaded 1`] = `
>
settings.almintegration.create
</Button>
</Tooltip>
</Connect(withAppState(CreationTooltip))>
</div>
<AlmBindingDefinitionBox
alm="azure"
branchesEnabled={true}
definition={
Object {
"key": "key",
@@ -106,9 +108,9 @@ exports[`should render correctly for multi-ALM binding: loading ALM definitions
<div
className="spacer-bottom text-right"
>
<Tooltip
mouseLeaveDelay={0.25}
overlay={null}
<Connect(withAppState(CreationTooltip))
alm="azure"
preventCreation={false}
>
<Button
data-test="settings__alm-create"
@@ -117,10 +119,11 @@ exports[`should render correctly for multi-ALM binding: loading ALM definitions
>
settings.almintegration.create
</Button>
</Tooltip>
</Connect(withAppState(CreationTooltip))>
</div>
<AlmBindingDefinitionBox
alm="azure"
branchesEnabled={true}
definition={
Object {
"key": "key",
@@ -147,26 +150,9 @@ exports[`should render correctly for multi-ALM binding: loading project count 1`
<div
className="spacer-bottom text-right"
>
<Tooltip
mouseLeaveDelay={0.25}
overlay={
<FormattedMessage
defaultMessage="settings.almintegration.create.tooltip"
id="settings.almintegration.create.tooltip"
values={
Object {
"alm": "alm.azure",
"link": <a
href="https://redirect.sonarsource.com/editions/enterprise.html?sourceEdition=developer"
rel="noopener noreferrer"
target="_blank"
>
settings.almintegration.create.tooltip.link
</a>,
}
}
/>
}
<Connect(withAppState(CreationTooltip))
alm="azure"
preventCreation={true}
>
<Button
data-test="settings__alm-create"
@@ -175,10 +161,11 @@ exports[`should render correctly for multi-ALM binding: loading project count 1`
>
settings.almintegration.create
</Button>
</Tooltip>
</Connect(withAppState(CreationTooltip))>
</div>
<AlmBindingDefinitionBox
alm="azure"
branchesEnabled={true}
definition={
Object {
"key": "key",
@@ -205,9 +192,9 @@ exports[`should render correctly for multi-ALM binding: submitting 1`] = `
<div
className="spacer-bottom text-right"
>
<Tooltip
mouseLeaveDelay={0.25}
overlay={null}
<Connect(withAppState(CreationTooltip))
alm="azure"
preventCreation={false}
>
<Button
data-test="settings__alm-create"
@@ -216,10 +203,11 @@ exports[`should render correctly for multi-ALM binding: submitting 1`] = `
>
settings.almintegration.create
</Button>
</Tooltip>
</Connect(withAppState(CreationTooltip))>
</div>
<AlmBindingDefinitionBox
alm="azure"
branchesEnabled={true}
definition={
Object {
"key": "key",
@@ -246,26 +234,9 @@ exports[`should render correctly for single-ALM binding 1`] = `
<div
className="spacer-bottom text-right"
>
<Tooltip
mouseLeaveDelay={0.25}
overlay={
<FormattedMessage
defaultMessage="settings.almintegration.create.tooltip"
id="settings.almintegration.create.tooltip"
values={
Object {
"alm": "alm.azure",
"link": <a
href="https://redirect.sonarsource.com/editions/enterprise.html?sourceEdition=developer"
rel="noopener noreferrer"
target="_blank"
>
settings.almintegration.create.tooltip.link
</a>,
}
}
/>
}
<Connect(withAppState(CreationTooltip))
alm="azure"
preventCreation={true}
>
<Button
data-test="settings__alm-create"
@@ -274,10 +245,11 @@ exports[`should render correctly for single-ALM binding 1`] = `
>
settings.almintegration.create
</Button>
</Tooltip>
</Connect(withAppState(CreationTooltip))>
</div>
<AlmBindingDefinitionBox
alm="azure"
branchesEnabled={true}
definition={
Object {
"key": "key",
@@ -304,26 +276,9 @@ exports[`should render correctly for single-ALM binding 2`] = `
<div
className="spacer-bottom text-right"
>
<Tooltip
mouseLeaveDelay={0.25}
overlay={
<FormattedMessage
defaultMessage="settings.almintegration.create.tooltip"
id="settings.almintegration.create.tooltip"
values={
Object {
"alm": "alm.azure",
"link": <a
href="https://redirect.sonarsource.com/editions/enterprise.html?sourceEdition=developer"
rel="noopener noreferrer"
target="_blank"
>
settings.almintegration.create.tooltip.link
</a>,
}
}
/>
}
<Connect(withAppState(CreationTooltip))
alm="azure"
preventCreation={true}
>
<Button
data-test="settings__alm-create"
@@ -332,10 +287,11 @@ exports[`should render correctly for single-ALM binding 2`] = `
>
settings.almintegration.create
</Button>
</Tooltip>
</Connect(withAppState(CreationTooltip))>
</div>
<AlmBindingDefinitionBox
alm="azure"
branchesEnabled={true}
definition={
Object {
"key": "key",
@@ -362,26 +318,9 @@ exports[`should render correctly for single-ALM binding 3`] = `
<div
className="spacer-bottom text-right"
>
<Tooltip
mouseLeaveDelay={0.25}
overlay={
<FormattedMessage
defaultMessage="settings.almintegration.create.tooltip"
id="settings.almintegration.create.tooltip"
values={
Object {
"alm": "alm.azure",
"link": <a
href="https://redirect.sonarsource.com/editions/enterprise.html?sourceEdition=developer"
rel="noopener noreferrer"
target="_blank"
>
settings.almintegration.create.tooltip.link
</a>,
}
}
/>
}
<Connect(withAppState(CreationTooltip))
alm="azure"
preventCreation={true}
>
<Button
data-test="settings__alm-create"
@@ -390,10 +329,11 @@ exports[`should render correctly for single-ALM binding 3`] = `
>
settings.almintegration.create
</Button>
</Tooltip>
</Connect(withAppState(CreationTooltip))>
</div>
<AlmBindingDefinitionBox
alm="azure"
branchesEnabled={true}
definition={
Object {
"key": "key",
@@ -420,9 +360,9 @@ exports[`should render correctly with validation 1`] = `
<div
className="spacer-bottom text-right"
>
<Tooltip
mouseLeaveDelay={0.25}
overlay={null}
<Connect(withAppState(CreationTooltip))
alm="github"
preventCreation={false}
>
<Button
data-test="settings__alm-create"
@@ -431,10 +371,11 @@ exports[`should render correctly with validation 1`] = `
>
settings.almintegration.create
</Button>
</Tooltip>
</Connect(withAppState(CreationTooltip))>
</div>
<AlmBindingDefinitionBox
alm="github"
branchesEnabled={true}
definition={
Object {
"appId": "123456",
@@ -470,9 +411,9 @@ exports[`should render correctly with validation: create a first 1`] = `
<div
className="big-spacer-top"
>
<Tooltip
mouseLeaveDelay={0.25}
overlay={null}
<Connect(withAppState(CreationTooltip))
alm="github"
preventCreation={false}
>
<Button
data-test="settings__alm-create"
@@ -481,7 +422,7 @@ exports[`should render correctly with validation: create a first 1`] = `
>
settings.almintegration.create
</Button>
</Tooltip>
</Connect(withAppState(CreationTooltip))>
</div>
<AlmBindingDefinitionForm
bindingDefinition={
@@ -515,9 +456,9 @@ exports[`should render correctly with validation: create a second 1`] = `
<div
className="spacer-bottom text-right"
>
<Tooltip
mouseLeaveDelay={0.25}
overlay={null}
<Connect(withAppState(CreationTooltip))
alm="github"
preventCreation={false}
>
<Button
data-test="settings__alm-create"
@@ -526,10 +467,11 @@ exports[`should render correctly with validation: create a second 1`] = `
>
settings.almintegration.create
</Button>
</Tooltip>
</Connect(withAppState(CreationTooltip))>
</div>
<AlmBindingDefinitionBox
alm="github"
branchesEnabled={true}
definition={
Object {
"appId": "123456",
@@ -583,9 +525,9 @@ exports[`should render correctly with validation: empty 1`] = `
<div
className="big-spacer-top"
>
<Tooltip
mouseLeaveDelay={0.25}
overlay={null}
<Connect(withAppState(CreationTooltip))
alm="github"
preventCreation={false}
>
<Button
data-test="settings__alm-create"
@@ -594,7 +536,7 @@ exports[`should render correctly with validation: empty 1`] = `
>
settings.almintegration.create
</Button>
</Tooltip>
</Connect(withAppState(CreationTooltip))>
</div>
</DeferredSpinner>
</div>

+ 1
- 0
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AzureTab-test.tsx.snap View File

@@ -6,6 +6,7 @@ exports[`should render correctly 1`] = `
>
<AlmTab
alm="azure"
branchesEnabled={true}
createConfiguration={[Function]}
defaultBinding={
Object {

+ 1
- 0
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/BitbucketTab-test.tsx.snap View File

@@ -6,6 +6,7 @@ exports[`should render correctly 1`] = `
>
<AlmTab
alm="bitbucket"
branchesEnabled={true}
createConfiguration={[Function]}
defaultBinding={
Object {

+ 40
- 0
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/CreationTooltip-test.tsx.snap View File

@@ -0,0 +1,40 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`should render correctly 1`] = `
<Tooltip
mouseLeaveDelay={0.25}
overlay={
<FormattedMessage
defaultMessage="settings.almintegration.create.tooltip"
id="settings.almintegration.create.tooltip"
values={
Object {
"alm": "alm.azure",
"link": <a
href="https://redirect.sonarsource.com/editions/enterprise.html?sourceEdition=community"
rel="noopener noreferrer"
target="_blank"
>
settings.almintegration.create.tooltip.link
</a>,
}
}
/>
}
>
<span>
Child
</span>
</Tooltip>
`;

exports[`should render correctly 2`] = `
<Tooltip
mouseLeaveDelay={0.25}
overlay={null}
>
<span>
Child
</span>
</Tooltip>
`;

+ 1
- 15
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/GithubTab-test.tsx.snap View File

@@ -6,6 +6,7 @@ exports[`should render correctly: with branch support 1`] = `
>
<AlmTab
alm="github"
branchesEnabled={true}
createConfiguration={[Function]}
defaultBinding={
Object {
@@ -70,18 +71,3 @@ exports[`should render correctly: with branch support 1`] = `
</div>
</div>
`;

exports[`should render correctly: without branch support 1`] = `
<div
className="bordered"
>
<div
className="big-padded"
>
<Connect(SubCategoryDefinitionsList)
category="almintegration"
subCategory="github"
/>
</div>
</div>
`;

+ 3
- 15
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/GitlabTab-test.tsx.snap View File

@@ -6,6 +6,7 @@ exports[`should render correctly: with URL 1`] = `
>
<AlmTab
alm="gitlab"
branchesEnabled={true}
createConfiguration={[Function]}
defaultBinding={
Object {
@@ -71,6 +72,7 @@ exports[`should render correctly: with branch support 1`] = `
>
<AlmTab
alm="gitlab"
branchesEnabled={true}
createConfiguration={[Function]}
defaultBinding={
Object {
@@ -135,6 +137,7 @@ exports[`should render correctly: with no definitions 1`] = `
>
<AlmTab
alm="gitlab"
branchesEnabled={true}
createConfiguration={[Function]}
defaultBinding={
Object {
@@ -185,18 +188,3 @@ exports[`should render correctly: with no definitions 1`] = `
</div>
</div>
`;

exports[`should render correctly: without branch support 1`] = `
<div
className="bordered"
>
<div
className="big-padded"
>
<Connect(SubCategoryDefinitionsList)
category="almintegration"
subCategory="gitlab"
/>
</div>
</div>
`;

+ 3
- 0
sonar-core/src/main/resources/org/sonar/l10n/core.properties View File

@@ -1126,6 +1126,9 @@ settings.almintegration.feature.pr_decoration.title=Pull Request Decoration
settings.almintegration.feature.pr_decoration.description=Add analysis and a Quality Gate to your Pull Requests directly in your ALM provider's interface.
settings.almintegration.feature.mr_decoration.title=Merge Request Decoration
settings.almintegration.feature.mr_decoration.description=Add analysis and a Quality Gate to your Merge Requests directly in your ALM provider's interface.
settings.almintegration.feature.pr_decoration.disabled=Disabled
settings.almintegration.feature.pr_decoration.disabled.no_branches=Upgrade to {link} to enable this feature.
settings.almintegration.feature.pr_decoration.disabled.no_branches.link=Developer Edition
settings.almintegration.feature.alm_repo_import.title=Import repositories from your ALM
settings.almintegration.feature.alm_repo_import.description=Select repositories from your ALM, and import them into SonarQube.
settings.almintegration.feature.alm_repo_import.disabled=Disabled

Loading…
Cancel
Save