};
function getImportFeatureStatus(
+ definition: AlmBindingDefinition,
multipleDefinitions: boolean,
type: AlmSettingsBindingStatusType.Success | AlmSettingsBindingStatusType.Failure
) {
</strong>
<HelpTooltip
className="little-spacer-left"
- overlay={translate('settings.almintegration.feature.alm_repo_import.help')}
+ overlay={translate('settings.almintegration.feature.alm_repo_import.disabled.multiple')}
+ />
+ </div>
+ );
+ } else if (!definition.url) {
+ return (
+ <div className="display-inline-flex-center">
+ <strong className="spacer-left">
+ {translate('settings.almintegration.feature.alm_repo_import.disabled')}
+ </strong>
+ <HelpTooltip
+ className="little-spacer-left"
+ overlay={translate('settings.almintegration.feature.alm_repo_import.disabled.no_url')}
/>
</div>
);
{!VALIDATED_ALMS.includes(alm) && (
<>
<div className="display-flex-row spacer-bottom">
- <Tooltip overlay={importFeatureDescription}>
- <span>{importFeatureTitle}</span>
- </Tooltip>
- <AlertSuccessIcon className="spacer-left" />
+ <div className="huge-spacer-right">
+ <Tooltip overlay={importFeatureDescription}>
+ <span>{importFeatureTitle}</span>
+ </Tooltip>
+ <AlertSuccessIcon className="spacer-left" />
+ </div>
+ <div>
+ <Tooltip
+ overlay={translate('settings.almintegration.feature.alm_repo_import.description')}>
+ <span>{translate('settings.almintegration.feature.alm_repo_import.title')}</span>
+ </Tooltip>
+ {getImportFeatureStatus(
+ definition,
+ multipleDefinitions,
+ AlmSettingsBindingStatusType.Success
+ )}
+ </div>
</div>
<div className="width-50">
{translate('settings.almintegration.feature.alm_repo_import.title')}
</span>
</Tooltip>
- {getImportFeatureStatus(multipleDefinitions, status.type)}
+ {getImportFeatureStatus(definition, multipleDefinitions, status.type)}
</div>
</div>
)}
value={formData.key}
/>
)}
+ <AlmBindingDefinitionFormField
+ help={
+ <>
+ {translate('settings.almintegration.form.url.azure.help')}
+ <br />
+ <em>https://ado.your-company.com/DefaultCollection</em>
+ </>
+ }
+ id="url.azure"
+ maxLength={2000}
+ onFieldChange={onFieldChange}
+ propKey="url"
+ readOnly={readOnly}
+ value={formData.url || ''}
+ />
<AlmBindingDefinitionFormField
help={translate('settings.almintegration.form.personal_access_token.azure.help')}
id="personal_access_token"
<AlmTab
alm={AlmKeys.Azure}
createConfiguration={createAzureConfiguration}
- defaultBinding={{ key: '', personalAccessToken: '' }}
+ defaultBinding={{ key: '', personalAccessToken: '', url: '' }}
definitions={definitions}
definitionStatus={definitionStatus}
form={childProps => <AzureForm {...childProps} />}
import AzureForm, { AzureFormProps } from '../AzureForm';
it('should render correctly', () => {
- expect(shallowRender()).toMatchSnapshot();
- expect(shallowRender({ formData: mockAzureBindingDefinition() })).toMatchSnapshot();
+ expect(shallowRender()).toMatchSnapshot('create');
+ expect(shallowRender({ formData: mockAzureBindingDefinition() })).toMatchSnapshot('edit');
});
function shallowRender(props: Partial<AzureFormProps> = {}) {
<div
className="display-flex-row spacer-bottom"
>
- <Tooltip
- overlay="settings.almintegration.feature.pr_decoration.description"
+ <div
+ className="huge-spacer-right"
>
- <span>
- settings.almintegration.feature.pr_decoration.title
- </span>
- </Tooltip>
- <AlertSuccessIcon
- className="spacer-left"
- />
+ <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>
+ <div
+ className="display-inline-flex-center"
+ >
+ <strong
+ className="spacer-left"
+ >
+ settings.almintegration.feature.alm_repo_import.disabled
+ </strong>
+ <HelpTooltip
+ className="little-spacer-left"
+ overlay="settings.almintegration.feature.alm_repo_import.disabled.no_url"
+ />
+ </div>
+ </div>
</div>
<div
className="width-50"
// Jest Snapshot v1, https://goo.gl/fbAQLP
-exports[`should render correctly 1`] = `
+exports[`should render correctly: create 1`] = `
<Fragment>
<AlmBindingDefinitionFormField
autoFocus={true}
propKey="key"
value=""
/>
+ <AlmBindingDefinitionFormField
+ help={
+ <React.Fragment>
+ settings.almintegration.form.url.azure.help
+ <br />
+ <em>
+ https://ado.your-company.com/
+ </em>
+ </React.Fragment>
+ }
+ id="url.azure"
+ maxLength={2000}
+ onFieldChange={[MockFunction]}
+ propKey="url"
+ value=""
+ />
<AlmBindingDefinitionFormField
help="settings.almintegration.form.personal_access_token.azure.help"
id="personal_access_token"
</Fragment>
`;
-exports[`should render correctly 2`] = `
+exports[`should render correctly: edit 1`] = `
<Fragment>
<AlmBindingDefinitionFormField
autoFocus={true}
propKey="key"
value="key"
/>
+ <AlmBindingDefinitionFormField
+ help={
+ <React.Fragment>
+ settings.almintegration.form.url.azure.help
+ <br />
+ <em>
+ https://ado.your-company.com/
+ </em>
+ </React.Fragment>
+ }
+ id="url.azure"
+ maxLength={2000}
+ onFieldChange={[MockFunction]}
+ propKey="url"
+ value=""
+ />
<AlmBindingDefinitionFormField
help="settings.almintegration.form.personal_access_token.azure.help"
id="personal_access_token"
Object {
"key": "",
"personalAccessToken": "",
+ "url": "",
}
}
definitionStatus={Object {}}
export interface AzureBindingDefinition extends AlmBindingDefinition {
personalAccessToken: string;
+ url?: string;
}
export interface BitbucketBindingDefinition extends AlmBindingDefinition {
settings.almintegration.checking_configuration=Checking configuration
settings.almintegration.configuration_valid=Configuration valid
settings.almintegration.could_not_validate=Could not validate this configuration.
-settings.almintegration.no_validation=Pull Request decoration is enabled. However, SonarQube doesn't currently validate Azure DevOps Server configurations.
+settings.almintegration.no_validation=SonarQube doesn't currently validate Azure DevOps Server configurations.
settings.almintegration.delete.header=Delete configuration
settings.almintegration.delete.message=Are you sure you want to delete the {id} configuration?
settings.almintegration.delete.info={0} projects will no longer get Pull Request Decorations.
settings.almintegration.form.name.github.help=Give your configuration a clear and succinct name. This name will be used at project level to identify the correct configured GitHub App for a project.
settings.almintegration.form.name.gitlab=Configuration name
settings.almintegration.form.name.gitlab.help=Give your configuration a clear and succinct name. This name will be used at project level to identify the correct configured GitLab instance for a project.
+settings.almintegration.form.url.azure=Azure DevOps Server collection URL
+settings.almintegration.form.url.azure.help=Provide the full Azure DevOps Server collection URL. For example:
settings.almintegration.form.url.bitbucket=Bitbucket Server URL
settings.almintegration.form.url.bitbucket.help=Example: {example}
settings.almintegration.form.url.github=GitHub API URL
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
-settings.almintegration.feature.alm_repo_import.help=This feature is disabled because you have 2 or more integration instances configured.
+settings.almintegration.feature.alm_repo_import.disabled.multiple=This feature is disabled because you have 2 or more integration instances configured.
+settings.almintegration.feature.alm_repo_import.disabled.no_url=This feature is disabled because your configured instance has no URL.
settings.pr_decoration.binding.category=Pull Request Decoration
settings.pr_decoration.binding.no_bindings=This feature must first be enabled in the global settings. {link}