From: David Cho-Lerat Date: Thu, 20 Jul 2023 14:23:33 +0000 (+0200) Subject: SONAR-19986 Block tag editing while re-indexing X-Git-Tag: 10.2.0.77647~323 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a4054f29fde9adf9b1cba21b4b13adae85f5505e;p=sonarqube.git SONAR-19986 Block tag editing while re-indexing --- diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueTags.tsx b/server/sonar-web/src/main/js/components/issue/components/IssueTags.tsx index 7ba43208c0f..88d7f6fbb11 100644 --- a/server/sonar-web/src/main/js/components/issue/components/IssueTags.tsx +++ b/server/sonar-web/src/main/js/components/issue/components/IssueTags.tsx @@ -17,31 +17,35 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + import { PopupPlacement, Tags } from 'design-system'; import * as React from 'react'; import { setIssueTags } from '../../../api/issues'; +import withComponentContext from '../../../app/components/componentContext/withComponentContext'; import { translate } from '../../../helpers/l10n'; +import { ComponentContextShape } from '../../../types/component'; import { Issue } from '../../../types/types'; import Tooltip from '../../controls/Tooltip'; import { updateIssue } from '../actions'; import IssueTagsPopup from '../popups/IssueTagsPopup'; -interface Props { +interface Props extends ComponentContextShape { canSetTags: boolean; issue: Pick; onChange: (issue: Issue) => void; - togglePopup: (popup: string, show?: boolean) => void; open?: boolean; + togglePopup: (popup: string, show?: boolean) => void; } -export default class IssueTags extends React.PureComponent { - toggleSetTags = (open?: boolean) => { +export class IssueTags extends React.PureComponent { + toggleSetTags = (open = false) => { this.props.togglePopup('edit-tags', open); }; setTags = (tags: string[]) => { const { issue } = this.props; const newIssue = { ...issue, tags }; + updateIssue( this.props.onChange, setIssueTags({ issue: issue.key, tags: tags.join(',') }), @@ -55,24 +59,26 @@ export default class IssueTags extends React.PureComponent { }; render() { - const { issue, open } = this.props; + const { component, issue, open } = this.props; const { tags = [] } = issue; return ( } popupPlacement={PopupPlacement.Bottom} tags={tags} tagsToDisplay={2} tooltip={Tooltip} - open={open} - onClose={this.handleClose} /> ); } } + +export default withComponentContext(IssueTags);