From: Jeremy Davis Date: Tue, 17 Dec 2019 15:50:50 +0000 (+0100) Subject: SONAR-12753 Conditional display for the action button X-Git-Tag: 8.2.0.32929~177 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4b17d6b79e4d77414f6241e330bf8520efdb0a1b;p=sonarqube.git SONAR-12753 Conditional display for the action button --- diff --git a/server/sonar-web/src/main/js/apps/securityHotspots/components/HotspotActions.tsx b/server/sonar-web/src/main/js/apps/securityHotspots/components/HotspotActions.tsx index 2a59969b48f..783129cf176 100644 --- a/server/sonar-web/src/main/js/apps/securityHotspots/components/HotspotActions.tsx +++ b/server/sonar-web/src/main/js/apps/securityHotspots/components/HotspotActions.tsx @@ -24,17 +24,18 @@ import OutsideClickHandler from 'sonar-ui-common/components/controls/OutsideClic import DropdownIcon from 'sonar-ui-common/components/icons/DropdownIcon'; import { PopupPlacement } from 'sonar-ui-common/components/ui/popups'; import { translate } from 'sonar-ui-common/helpers/l10n'; -import { HotspotUpdateFields } from '../../../types/security-hotspots'; +import { DetailedHotspot, HotspotUpdateFields } from '../../../types/security-hotspots'; import HotspotActionsForm from './HotspotActionsForm'; export interface HotspotActionsProps { - hotspotKey: string; + hotspot: DetailedHotspot; onSubmit: (hotspot: HotspotUpdateFields) => void; } const ESCAPE_KEY = 'Escape'; export default function HotspotActions(props: HotspotActionsProps) { + const { hotspot } = props; const [open, setOpen] = React.useState(false); React.useEffect(() => { @@ -54,7 +55,7 @@ export default function HotspotActions(props: HotspotActionsProps) { return (
@@ -62,7 +63,7 @@ export default function HotspotActions(props: HotspotActionsProps) { setOpen(false)}> { setOpen(false); props.onSubmit(data); diff --git a/server/sonar-web/src/main/js/apps/securityHotspots/components/HotspotViewerRenderer.tsx b/server/sonar-web/src/main/js/apps/securityHotspots/components/HotspotViewerRenderer.tsx index 163693de895..21a55063138 100644 --- a/server/sonar-web/src/main/js/apps/securityHotspots/components/HotspotViewerRenderer.tsx +++ b/server/sonar-web/src/main/js/apps/securityHotspots/components/HotspotViewerRenderer.tsx @@ -48,7 +48,7 @@ export function HotspotViewerRenderer(props: HotspotViewerRendererProps) {

{hotspot.message}

{isLoggedIn(currentUser) && ( - + )}
diff --git a/server/sonar-web/src/main/js/apps/securityHotspots/components/__tests__/HotspotActions-test.tsx b/server/sonar-web/src/main/js/apps/securityHotspots/components/__tests__/HotspotActions-test.tsx index aa92a004488..b1ce8cf1cbd 100644 --- a/server/sonar-web/src/main/js/apps/securityHotspots/components/__tests__/HotspotActions-test.tsx +++ b/server/sonar-web/src/main/js/apps/securityHotspots/components/__tests__/HotspotActions-test.tsx @@ -21,6 +21,7 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import { Button } from 'sonar-ui-common/components/controls/buttons'; import { waitAndUpdate } from 'sonar-ui-common/helpers/testUtils'; +import { HotspotStatus } from '../../../../types/security-hotspots'; import HotspotActions, { HotspotActionsProps } from '../HotspotActions'; it('should render correctly', () => { @@ -66,5 +67,12 @@ it('should register an eventlistener', () => { }); function shallowRender(props: Partial = {}) { - return shallow(); + return shallow( + + ); } diff --git a/server/sonar-web/src/main/js/apps/securityHotspots/components/__tests__/__snapshots__/HotspotActions-test.tsx.snap b/server/sonar-web/src/main/js/apps/securityHotspots/components/__tests__/__snapshots__/HotspotActions-test.tsx.snap index efa3d92c629..4ba0565be9a 100644 --- a/server/sonar-web/src/main/js/apps/securityHotspots/components/__tests__/__snapshots__/HotspotActions-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/securityHotspots/components/__tests__/__snapshots__/HotspotActions-test.tsx.snap @@ -7,7 +7,7 @@ exports[`should open when clicked 1`] = `
diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties index 9cebe11abfb..e9a6699355c 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -659,7 +659,8 @@ hotspot.assigned_to=Assigned to: hotspot.tabs.risk_description=What's the risk? hotspot.tabs.vulnerability_description=Are you vulnerable? hotspot.tabs.fix_recommendations=How can you fix it? -hotspots.review_hotspot=Review Hotspot +hotspot.change_status.REVIEWED=Change status +hotspot.change_status.TO_REVIEW=Review Hotspot hotspot.status.TO_REVIEW=To review hotspot.status.FIXED=Fixed