From: Jeremy Davis Date: Thu, 9 Jan 2020 13:08:12 +0000 (+0100) Subject: SONAR-12719 Handle labels in actions X-Git-Tag: 8.2.0.32929~133 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3f980781b807da928130b472f51cc9a7af8a2eae;p=sonarqube.git SONAR-12719 Handle labels in actions --- diff --git a/server/sonar-web/src/main/js/apps/securityHotspots/components/HotspotActionsFormRenderer.tsx b/server/sonar-web/src/main/js/apps/securityHotspots/components/HotspotActionsFormRenderer.tsx index 829df46d1a0..e6a382828db 100644 --- a/server/sonar-web/src/main/js/apps/securityHotspots/components/HotspotActionsFormRenderer.tsx +++ b/server/sonar-web/src/main/js/apps/securityHotspots/components/HotspotActionsFormRenderer.tsx @@ -21,6 +21,7 @@ import * as classnames from 'classnames'; import * as React from 'react'; import { SubmitButton } from 'sonar-ui-common/components/controls/buttons'; import Radio from 'sonar-ui-common/components/controls/Radio'; +import Tooltip from 'sonar-ui-common/components/controls/Tooltip'; import { translate } from 'sonar-ui-common/helpers/l10n'; import MarkdownTips from '../../../components/common/MarkdownTips'; import { @@ -50,7 +51,11 @@ export default function HotspotActionsFormRenderer(props: HotspotActionsFormRend return (
-

{translate('hotspots.form.title')}

+

+ {disableStatusChange + ? translate('hotspots.form.title.disabled') + : translate('hotspots.form.title')} +

{renderOption({ disabled: disableStatusChange, @@ -140,7 +145,8 @@ function renderOption(params: { selectedOption: HotspotStatusOption; }) { const { disabled, onClick, option, selectedOption } = params; - return ( + + const optionRender = (
); + + return disabled ? ( + + {optionRender} + + ) : ( + optionRender + ); } diff --git a/server/sonar-web/src/main/js/apps/securityHotspots/components/__tests__/__snapshots__/HotspotActionsFormRenderer-test.tsx.snap b/server/sonar-web/src/main/js/apps/securityHotspots/components/__tests__/__snapshots__/HotspotActionsFormRenderer-test.tsx.snap index 25f5ec0e7a5..3aec0f39980 100644 --- a/server/sonar-web/src/main/js/apps/securityHotspots/components/__tests__/__snapshots__/HotspotActionsFormRenderer-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/securityHotspots/components/__tests__/__snapshots__/HotspotActionsFormRenderer-test.tsx.snap @@ -219,74 +219,89 @@ exports[`should render correctly: restricted access 1`] = ` onSubmit={[MockFunction]} >

- hotspots.form.title + hotspots.form.title.disabled

-
- -

- hotspots.status_option.FIXED -

-
- hotspots.status_option.FIXED.description + +

+ hotspots.status_option.FIXED +

+
+
+ hotspots.status_option.FIXED.description +
-
-
+ - -

- hotspots.status_option.SAFE -

-
- hotspots.status_option.SAFE.description + +

+ hotspots.status_option.SAFE +

+
+
+ hotspots.status_option.SAFE.description +
-
-
+ - -

- hotspots.status_option.ADDITIONAL_REVIEW -

-
- hotspots.status_option.ADDITIONAL_REVIEW.description + +

+ hotspots.status_option.ADDITIONAL_REVIEW +

+
+
+ hotspots.status_option.ADDITIONAL_REVIEW.description +
-
+