// Activate rule in quality profile
await user.click(ui.activateButton.get());
await selectEvent.select(ui.qualityProfileSelect.get(), 'QP FooBar');
- await selectEvent.select(ui.severitySelect.get(), 'severity.MINOR');
- await user.type(ui.paramInput('1').get(), 'OK');
+ await user.type(ui.paramInput('1').get(), 'paramInput');
await act(() => user.click(ui.activateButton.get(ui.activateQPDialog.get())));
expect(ui.qpLink('QP FooBar').get()).toBeInTheDocument();
// Change rule details in quality profile
await user.click(ui.changeButton('QP FooBar').get());
- await selectEvent.select(ui.severitySelect.get(), 'severity.BLOCKER');
+ await user.type(ui.paramInput('1').get(), 'New');
await act(() => user.click(ui.saveButton.get(ui.changeQPDialog.get())));
- expect(screen.getByText('severity.BLOCKER')).toBeInTheDocument();
+ expect(screen.getByText('paramInputNew')).toBeInTheDocument();
// activate last java rule
await user.click(ui.activateButton.get());
import classNames from 'classnames';
import * as React from 'react';
import { activateRule, Profile } from '../../../api/quality-profiles';
+import DocLink from '../../../components/common/DocLink';
import { ResetButtonLink, SubmitButton } from '../../../components/controls/buttons';
import Modal from '../../../components/controls/Modal';
-import Select, { LabelValueSelectOption } from '../../../components/controls/Select';
+import Select from '../../../components/controls/Select';
import { Alert } from '../../../components/ui/Alert';
import { translate } from '../../../helpers/l10n';
import { sanitizeString } from '../../../helpers/sanitize';
import { Dict, Rule, RuleActivation, RuleDetails } from '../../../types/types';
import { sortProfiles } from '../../quality-profiles/utils';
-import { SeveritySelect } from './SeveritySelect';
interface Props {
activation?: RuleActivation;
interface State {
params: Dict<string>;
profile?: ProfileWithDeph;
- severity: string;
submitting: boolean;
}
this.state = {
params: this.getParams(props),
profile: profilesWithDepth.length > 0 ? profilesWithDepth[0] : undefined,
- severity: props.activation ? props.activation.severity : props.rule.severity,
submitting: false,
};
}
};
handleFormSubmit = (event: React.SyntheticEvent<HTMLFormElement>) => {
+ const { activation, rule } = this.props;
event.preventDefault();
this.setState({ submitting: true });
const data = {
key: this.state.profile?.key || '',
params: this.state.params,
rule: this.props.rule.key,
- severity: this.state.severity,
+ severity: activation ? activation.severity : rule.severity,
};
activateRule(data)
.then(() => this.props.onDone(data.severity))
this.setState({ profile });
};
- handleSeverityChange = ({ value }: LabelValueSelectOption) => {
- this.setState({ severity: value });
- };
-
render() {
const { activation, rule } = this.props;
- const { profile, severity, submitting } = this.state;
+ const { profile, submitting } = this.state;
const { params = [] } = rule;
const profilesWithDepth = this.getQualityProfilesWithDepth();
const isCustomRule = !!(rule as RuleDetails).templateKey;
<Alert variant="info">{translate('coding_rules.active_in_all_profiles')}</Alert>
)}
+ <Alert variant="info">
+ {translate('coding_rules.severity_cannot_be_modified')}
+ <DocLink className="spacer-left" to="/user-guide/clean-code/">
+ {translate('learn_more')}
+ </DocLink>
+ </Alert>
+
<div className="modal-field">
<label id="coding-rules-quality-profile-select-label">
{translate('coding_rules.quality_profile')}
value={profile}
/>
</div>
- <div className="modal-field">
- <label id="coding-rules-severity-select-label">{translate('severity')}</label>
- <SeveritySelect
- isDisabled={submitting}
- ariaLabelledby="coding-rules-severity-select-label"
- onChange={this.handleSeverityChange}
- severity={severity}
- />
- </div>
{isCustomRule ? (
<div className="modal-field">
<p className="note">{translate('coding_rules.custom_rule.activation_notice')}</p>