Browse Source

SONAR-20356 Add built-in QP encouragement flag message in quality profile page

tags/10.3.0.82913
7PH 9 months ago
parent
commit
57df52f084

+ 14
- 2
server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileInheritance.tsx View File

@@ -18,7 +18,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import classNames from 'classnames';
import { ButtonSecondary, Spinner, SubTitle, Table } from 'design-system';
import { ButtonSecondary, FlagMessage, Spinner, SubTitle, Table } from 'design-system';
import * as React from 'react';
import { getProfileInheritance } from '../../../api/quality-profiles';
import { translate } from '../../../helpers/l10n';
@@ -136,6 +136,19 @@ export default class ProfileInheritance extends React.PureComponent<Props, State
)}
</div>

{!extendsBuiltIn && (
<FlagMessage variant="info" className="sw-mb-4">
<div className="sw-flex sw-flex-col">
{translate('quality_profiles.no_built_in_updates_warning')}
{profile.actions?.edit && (
<span className="sw-mt-1">
{translate('quality_profiles.no_built_in_updates_warning_admin')}
</span>
)}
</div>
</FlagMessage>
)}

<Spinner loading={loading}>
<Table columnCount={3} noSidePadding>
{ancestors?.map((ancestor, index) => (
@@ -155,7 +168,6 @@ export default class ProfileInheritance extends React.PureComponent<Props, State
})}
depth={ancestors ? ancestors.length : 0}
displayLink={false}
extendsBuiltIn={extendsBuiltIn}
language={profile.language}
profile={this.state.profile}
/>

+ 3
- 18
server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileInheritanceBox.tsx View File

@@ -18,10 +18,9 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import classNames from 'classnames';
import { ContentCell, HelperHintIcon, TableRow } from 'design-system';
import { ContentCell, TableRow } from 'design-system';
import * as React from 'react';
import HelpTooltip from '../../../components/controls/HelpTooltip';
import { translate, translateWithParameters } from '../../../helpers/l10n';
import { translateWithParameters } from '../../../helpers/l10n';
import { ProfileInheritanceDetails } from '../../../types/types';
import BuiltInQualityProfileBadge from '../components/BuiltInQualityProfileBadge';
import ProfileLink from '../components/ProfileLink';
@@ -30,22 +29,13 @@ interface Props {
className?: string;
depth: number;
displayLink?: boolean;
extendsBuiltIn?: boolean;
language: string;
profile: ProfileInheritanceDetails;
type?: string;
}

export default function ProfileInheritanceBox(props: Props) {
const {
className,
depth,
extendsBuiltIn,
language,
profile,
displayLink = true,
type = 'current',
} = props;
const { className, depth, language, profile, displayLink = true, type = 'current' } = props;
const offset = 25 * depth;

return (
@@ -60,11 +50,6 @@ export default function ProfileInheritanceBox(props: Props) {
<span>{profile.name}</span>
)}
{profile.isBuiltIn && <BuiltInQualityProfileBadge />}
{extendsBuiltIn && (
<HelpTooltip overlay={translate('quality_profiles.extends_built_in')}>
<HelperHintIcon aria-label="help-tooltip" />
</HelpTooltip>
)}
</div>
</ContentCell>


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

@@ -2035,6 +2035,8 @@ quality_profiles.used_=Used:
quality_profiles.built_in=Built-in
quality_profiles.built_in.description=This is a built-in quality profile that might be updated automatically.
quality_profiles.extends_built_in=Because this quality profile inherits from a built-in quality profile, it might be updated automatically.
quality_profiles.no_built_in_updates_warning=This quality profile does not inherit from a built-in profile. It will not benefit from automatic updates when new rules are introduced.
quality_profiles.no_built_in_updates_warning_admin=To benefit from automatic updates, set the corresponding built-in profile as the parent of your quality profile.
quality_profiles.default_permissions=Users with the global "Administer Quality Profiles" permission and those listed below can manage this quality profile.
quality_profiles.grant_permissions_to_more_users=Grant permissions to more users
quality_profiles.grant_permissions_to_user_or_group=Grant permissions to a user or a group

Loading…
Cancel
Save