AlmSettingsBindingStatus,
AlmSettingsBindingStatusType
} from '../../../../types/alm-settings';
-import { VALIDATED_ALMS } from './utils';
export interface AlmBindingDefinitionBoxProps {
alm: AlmKeys;
{definition.url && <span>{definition.url}</span>}
</div>
- {!VALIDATED_ALMS.includes(alm) && (
+ {status.type === AlmSettingsBindingStatusType.Validating ? (
<>
- <div className="display-flex-row spacer-bottom">
- <div className="huge-spacer-right">
+ <i className="spinner spacer-right" />
+ {translate('settings.almintegration.checking_configuration')}
+ </>
+ ) : (
+ <>
+ {status.type !== AlmSettingsBindingStatusType.Warning && (
+ <div className="display-flex-row spacer-bottom">
<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>
+ <div className="huge-spacer-right">
+ {importFeatureTitle}
+ {STATUS_ICON[status.type]}
+ </div>
</Tooltip>
- {getImportFeatureStatus(
- definition,
- multipleDefinitions,
- AlmSettingsBindingStatusType.Success
- )}
+ <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, status.type)}
+ </div>
</div>
- </div>
+ )}
<div className="width-50">
- <Alert variant="info">{translate('settings.almintegration.no_validation')}</Alert>
- </div>
- </>
- )}
-
- {VALIDATED_ALMS.includes(alm) &&
- (status.type === AlmSettingsBindingStatusType.Validating ? (
- <>
- <i className="spinner spacer-right" />
- {translate('settings.almintegration.checking_configuration')}
- </>
- ) : (
- <>
- {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>
- <Tooltip
- overlay={translate(
- 'settings.almintegration.feature.alm_repo_import.description'
- )}>
- <span>
- {translate('settings.almintegration.feature.alm_repo_import.title')}
- </span>
- </Tooltip>
- {getImportFeatureStatus(definition, multipleDefinitions, status.type)}
- </div>
- </div>
+ {status.type === AlmSettingsBindingStatusType.Warning && (
+ <Alert variant="warning">
+ {translate('settings.almintegration.could_not_validate')}
+ </Alert>
)}
- <div className="width-50">
- {status.type === AlmSettingsBindingStatusType.Warning && (
- <Alert variant="warning">
- {translate('settings.almintegration.could_not_validate')}
- </Alert>
- )}
-
- {status.type === AlmSettingsBindingStatusType.Failure && (
- <Alert variant="error">{status.failureMessage}</Alert>
- )}
+ {status.type === AlmSettingsBindingStatusType.Failure && (
+ <Alert variant="error">{status.failureMessage}</Alert>
+ )}
- {status.type === AlmSettingsBindingStatusType.Success && status.alertSuccess && (
- <Alert variant="success">
- {translate('settings.almintegration.configuration_valid')}
- </Alert>
- )}
- </div>
+ {status.type === AlmSettingsBindingStatusType.Success && status.alertSuccess && (
+ <Alert variant="success">
+ {translate('settings.almintegration.configuration_valid')}
+ </Alert>
+ )}
+ </div>
- <Button className="big-spacer-top" onClick={() => props.onCheck(definition.key)}>
- {translate('settings.almintegration.check_configuration')}
- </Button>
- </>
- ))}
+ <Button className="big-spacer-top" onClick={() => props.onCheck(definition.key)}>
+ {translate('settings.almintegration.check_configuration')}
+ </Button>
+ </>
+ )}
</div>
);
}
jest.mock('../../../../../api/alm-settings', () => ({
countBindedProjects: jest.fn().mockResolvedValue(0),
deleteConfiguration: jest.fn().mockResolvedValue(undefined),
- getAlmDefinitions: jest.fn().mockResolvedValue({ bitbucket: [], github: [], gitlab: [] }),
+ getAlmDefinitions: jest
+ .fn()
+ .mockResolvedValue({ azure: [], bitbucket: [], github: [], gitlab: [] }),
validateAlmSettings: jest.fn().mockResolvedValue('')
}));
await waitAndUpdate(wrapper);
- expect(validateAlmSettings).toBeCalledTimes(4);
+ expect(validateAlmSettings).toBeCalledTimes(5);
+ expect(validateAlmSettings).toBeCalledWith('a1');
expect(validateAlmSettings).toBeCalledWith('b1');
expect(validateAlmSettings).toBeCalledWith('gh1');
expect(validateAlmSettings).toBeCalledWith('gh2');
key
</h3>
</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>
- <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"
- >
- <Alert
- variant="info"
- >
- settings.almintegration.no_validation
- </Alert>
- </div>
+ <i
+ className="spinner spacer-right"
+ />
+ settings.almintegration.checking_configuration
</div>
`;