diff options
Diffstat (limited to 'server/sonar-web/src/main/js/components/issue')
24 files changed, 59 insertions, 89 deletions
diff --git a/server/sonar-web/src/main/js/components/issue/Issue.tsx b/server/sonar-web/src/main/js/components/issue/Issue.tsx index e08b886fff2..663105633eb 100644 --- a/server/sonar-web/src/main/js/components/issue/Issue.tsx +++ b/server/sonar-web/src/main/js/components/issue/Issue.tsx @@ -22,19 +22,18 @@ import * as key from 'keymaster'; import IssueView from './IssueView'; import { updateIssue } from './actions'; import { setIssueAssignee } from '../../api/issues'; -import { BranchLike, Issue as IssueType } from '../../app/types'; import './Issue.css'; interface Props { - branchLike?: BranchLike; + branchLike?: T.BranchLike; checked?: boolean; displayLocationsCount?: boolean; displayLocationsLink?: boolean; - issue: IssueType; - onChange: (issue: IssueType) => void; + issue: T.Issue; + onChange: (issue: T.Issue) => void; onCheck?: (issue: string, event: { shiftKey?: boolean }) => void; onClick: (issueKey: string) => void; - onFilter?: (property: string, issue: IssueType) => void; + onFilter?: (property: string, issue: T.Issue) => void; onPopupToggle: (issue: string, popupName: string, open?: boolean) => void; openPopup?: string; selected: boolean; diff --git a/server/sonar-web/src/main/js/components/issue/IssueView.tsx b/server/sonar-web/src/main/js/components/issue/IssueView.tsx index 932d51a9176..486b2ac4b66 100644 --- a/server/sonar-web/src/main/js/components/issue/IssueView.tsx +++ b/server/sonar-web/src/main/js/components/issue/IssueView.tsx @@ -24,20 +24,19 @@ import IssueActionsBar from './components/IssueActionsBar'; import IssueCommentLine from './components/IssueCommentLine'; import { updateIssue } from './actions'; import { deleteIssueComment, editIssueComment } from '../../api/issues'; -import { Issue, BranchLike } from '../../app/types'; interface Props { - branchLike?: BranchLike; + branchLike?: T.BranchLike; checked?: boolean; currentPopup?: string; displayLocationsCount?: boolean; displayLocationsLink?: boolean; - issue: Issue; + issue: T.Issue; onAssign: (login: string) => void; - onChange: (issue: Issue) => void; + onChange: (issue: T.Issue) => void; onCheck?: (issue: string, event: { shiftKey?: boolean }) => void; onClick: (issueKey: string) => void; - onFilter?: (property: string, issue: Issue) => void; + onFilter?: (property: string, issue: T.Issue) => void; selected: boolean; togglePopup: (popup: string, show: boolean | void) => void; } diff --git a/server/sonar-web/src/main/js/components/issue/actions.ts b/server/sonar-web/src/main/js/components/issue/actions.ts index 763c3b2baca..f00f6599d77 100644 --- a/server/sonar-web/src/main/js/components/issue/actions.ts +++ b/server/sonar-web/src/main/js/components/issue/actions.ts @@ -18,14 +18,13 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import { parseIssueFromResponse } from '../../helpers/issues'; -import { Issue } from '../../app/types'; import { IssueResponse } from '../../api/issues'; export const updateIssue = ( - onChange: (issue: Issue) => void, + onChange: (issue: T.Issue) => void, resultPromise: Promise<IssueResponse>, - oldIssue?: Issue, - newIssue?: Issue + oldIssue?: T.Issue, + newIssue?: T.Issue ) => { const optimisticUpdate = oldIssue !== undefined && newIssue !== undefined; if (optimisticUpdate) { diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueActionsBar.tsx b/server/sonar-web/src/main/js/components/issue/components/IssueActionsBar.tsx index ae74f0131f9..a800041b208 100644 --- a/server/sonar-web/src/main/js/components/issue/components/IssueActionsBar.tsx +++ b/server/sonar-web/src/main/js/components/issue/components/IssueActionsBar.tsx @@ -25,16 +25,15 @@ import IssueTags from './IssueTags'; import IssueTransition from './IssueTransition'; import IssueType from './IssueType'; import { updateIssue } from '../actions'; -import { IssueType as IssueTypes, Issue } from '../../../app/types'; import { translate, translateWithParameters } from '../../../helpers/l10n'; import { RawQuery } from '../../../helpers/query'; import { IssueResponse } from '../../../api/issues'; interface Props { - issue: Issue; + issue: T.Issue; currentPopup?: string; onAssign: (login: string) => void; - onChange: (issue: Issue) => void; + onChange: (issue: T.Issue) => void; togglePopup: (popup: string, show?: boolean) => void; } @@ -48,7 +47,7 @@ export default class IssueActionsBar extends React.PureComponent<Props, State> { }; setIssueProperty = ( - property: keyof Issue, + property: keyof T.Issue, popup: string, apiCall: (query: RawQuery) => Promise<IssueResponse>, value: string @@ -71,11 +70,11 @@ export default class IssueActionsBar extends React.PureComponent<Props, State> { this.props.togglePopup('comment', open); }; - handleTransition = (issue: Issue) => { + handleTransition = (issue: T.Issue) => { this.props.onChange(issue); if ( issue.resolution === 'FALSE-POSITIVE' || - (issue.resolution === 'WONTFIX' && issue.type !== IssueTypes.Hotspot) + (issue.resolution === 'WONTFIX' && issue.type !== 'SECURITY_HOTSPOT') ) { this.toggleComment(true, translate('issue.comment.tell_why')); } @@ -89,7 +88,7 @@ export default class IssueActionsBar extends React.PureComponent<Props, State> { const canSetType = issue.actions.includes('set_type'); const canSetTags = issue.actions.includes('set_tags'); const hasTransitions = issue.transitions && issue.transitions.length > 0; - const isSecurityHotspot = issue.type === IssueTypes.Hotspot; + const isSecurityHotspot = issue.type === 'SECURITY_HOTSPOT'; return ( <div className="issue-actions"> diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueAssign.tsx b/server/sonar-web/src/main/js/components/issue/components/IssueAssign.tsx index 34072ed3d2c..b65e3c2e53d 100644 --- a/server/sonar-web/src/main/js/components/issue/components/IssueAssign.tsx +++ b/server/sonar-web/src/main/js/components/issue/components/IssueAssign.tsx @@ -24,11 +24,10 @@ import Toggler from '../../controls/Toggler'; import DropdownIcon from '../../icons-components/DropdownIcon'; import { Button } from '../../ui/buttons'; import { translate } from '../../../helpers/l10n'; -import { Issue } from '../../../app/types'; interface Props { isOpen: boolean; - issue: Pick<Issue, 'assignee' | 'assigneeAvatar' | 'assigneeName' | 'projectOrganization'>; + issue: Pick<T.Issue, 'assignee' | 'assigneeAvatar' | 'assigneeName' | 'projectOrganization'>; canAssign: boolean; onAssign: (login: string) => void; togglePopup: (popup: string, show?: boolean) => void; diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueChangelog.tsx b/server/sonar-web/src/main/js/components/issue/components/IssueChangelog.tsx index 19e8b1a3ca5..70d4c8ee1dc 100644 --- a/server/sonar-web/src/main/js/components/issue/components/IssueChangelog.tsx +++ b/server/sonar-web/src/main/js/components/issue/components/IssueChangelog.tsx @@ -25,11 +25,10 @@ import DateTimeFormatter from '../../intl/DateTimeFormatter'; import Toggler from '../../controls/Toggler'; import Tooltip from '../../controls/Tooltip'; import { Button } from '../../ui/buttons'; -import { Issue } from '../../../app/types'; interface Props { isOpen: boolean; - issue: Pick<Issue, 'author' | 'creationDate' | 'key'>; + issue: Pick<T.Issue, 'author' | 'creationDate' | 'key'>; creationDate: string; togglePopup: (popup: string, show?: boolean) => void; } diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueCommentAction.tsx b/server/sonar-web/src/main/js/components/issue/components/IssueCommentAction.tsx index 950c88e89ae..39ab83ff97a 100644 --- a/server/sonar-web/src/main/js/components/issue/components/IssueCommentAction.tsx +++ b/server/sonar-web/src/main/js/components/issue/components/IssueCommentAction.tsx @@ -24,13 +24,12 @@ import { Button } from '../../ui/buttons'; import CommentPopup from '../popups/CommentPopup'; import { addIssueComment } from '../../../api/issues'; import { translate } from '../../../helpers/l10n'; -import { Issue } from '../../../app/types'; interface Props { commentPlaceholder: string; currentPopup?: string; issueKey: string; - onChange: (issue: Issue) => void; + onChange: (issue: T.Issue) => void; toggleComment: (open?: boolean, placeholder?: string) => void; } diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueCommentLine.tsx b/server/sonar-web/src/main/js/components/issue/components/IssueCommentLine.tsx index ce516d1775a..9e3c10690b0 100644 --- a/server/sonar-web/src/main/js/components/issue/components/IssueCommentLine.tsx +++ b/server/sonar-web/src/main/js/components/issue/components/IssueCommentLine.tsx @@ -24,10 +24,9 @@ import { EditButton, DeleteButton } from '../../ui/buttons'; import CommentDeletePopup from '../popups/CommentDeletePopup'; import CommentPopup from '../popups/CommentPopup'; import DateFromNow from '../../intl/DateFromNow'; -import { IssueComment } from '../../../app/types'; interface Props { - comment: IssueComment; + comment: T.IssueComment; onDelete: (comment: string) => void; onEdit: (comment: string, text: string) => void; } diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueSeverity.tsx b/server/sonar-web/src/main/js/components/issue/components/IssueSeverity.tsx index 3913c36af51..8823284000e 100644 --- a/server/sonar-web/src/main/js/components/issue/components/IssueSeverity.tsx +++ b/server/sonar-web/src/main/js/components/issue/components/IssueSeverity.tsx @@ -24,15 +24,14 @@ import Toggler from '../../controls/Toggler'; import DropdownIcon from '../../icons-components/DropdownIcon'; import SeverityHelper from '../../shared/SeverityHelper'; import { Button } from '../../ui/buttons'; -import { Issue } from '../../../app/types'; import { RawQuery } from '../../../helpers/query'; interface Props { canSetSeverity: boolean; isOpen: boolean; - issue: Pick<Issue, 'severity'>; + issue: Pick<T.Issue, 'severity'>; setIssueProperty: ( - property: keyof Issue, + property: keyof T.Issue, popup: string, apiCall: (query: RawQuery) => Promise<IssueResponse>, value: string 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 c0b8cb68f40..d0ae952a225 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 @@ -25,13 +25,12 @@ import Toggler from '../../controls/Toggler'; import TagsList from '../../tags/TagsList'; import { Button } from '../../ui/buttons'; import { translate } from '../../../helpers/l10n'; -import { Issue } from '../../../app/types'; interface Props { canSetTags: boolean; isOpen: boolean; - issue: Pick<Issue, 'key' | 'projectOrganization' | 'tags'>; - onChange: (issue: Issue) => void; + issue: Pick<T.Issue, 'key' | 'projectOrganization' | 'tags'>; + onChange: (issue: T.Issue) => void; togglePopup: (popup: string, show?: boolean) => void; } @@ -46,8 +45,8 @@ export default class IssueTags extends React.PureComponent<Props> { updateIssue( this.props.onChange, setIssueTags({ issue: issue.key, tags: tags.join(',') }), - issue as Issue, - newIssue as Issue + issue as T.Issue, + newIssue as T.Issue ); }; diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueTitleBar.tsx b/server/sonar-web/src/main/js/components/issue/components/IssueTitleBar.tsx index 11a869003e9..25739813227 100644 --- a/server/sonar-web/src/main/js/components/issue/components/IssueTitleBar.tsx +++ b/server/sonar-web/src/main/js/components/issue/components/IssueTitleBar.tsx @@ -29,15 +29,14 @@ import { getBranchLikeQuery } from '../../../helpers/branches'; import { getComponentIssuesUrl } from '../../../helpers/urls'; import { formatMeasure } from '../../../helpers/measures'; import { translate, translateWithParameters } from '../../../helpers/l10n'; -import { IssueType, BranchLike, Issue } from '../../../app/types'; interface Props { - branchLike?: BranchLike; + branchLike?: T.BranchLike; currentPopup?: string; displayLocationsCount?: boolean; displayLocationsLink?: boolean; - issue: Issue; - onFilter?: (property: string, issue: Issue) => void; + issue: T.Issue; + onFilter?: (property: string, issue: T.Issue) => void; togglePopup: (popup: string, show?: boolean) => void; } @@ -71,7 +70,7 @@ export default function IssueTitleBar(props: Props) { <div className="issue-row"> <IssueMessage engine={issue.externalRuleEngine} - manualVulnerability={issue.fromHotspot && issue.type === IssueType.Vulnerability} + manualVulnerability={issue.fromHotspot && issue.type === 'VULNERABILITY'} message={issue.message} organization={issue.organization} rule={issue.rule} diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueTransition.tsx b/server/sonar-web/src/main/js/components/issue/components/IssueTransition.tsx index 1bb4bde8f59..ad5e2938522 100644 --- a/server/sonar-web/src/main/js/components/issue/components/IssueTransition.tsx +++ b/server/sonar-web/src/main/js/components/issue/components/IssueTransition.tsx @@ -25,13 +25,12 @@ import Toggler from '../../controls/Toggler'; import DropdownIcon from '../../icons-components/DropdownIcon'; import StatusHelper from '../../shared/StatusHelper'; import { Button } from '../../ui/buttons'; -import { Issue } from '../../../app/types'; interface Props { hasTransitions: boolean; isOpen: boolean; - issue: Pick<Issue, 'key' | 'resolution' | 'status' | 'transitions'>; - onChange: (issue: Issue) => void; + issue: Pick<T.Issue, 'key' | 'resolution' | 'status' | 'transitions'>; + onChange: (issue: T.Issue) => void; togglePopup: (popup: string, show?: boolean) => void; } diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueType.tsx b/server/sonar-web/src/main/js/components/issue/components/IssueType.tsx index 6d38647517a..b99f152e9a4 100644 --- a/server/sonar-web/src/main/js/components/issue/components/IssueType.tsx +++ b/server/sonar-web/src/main/js/components/issue/components/IssueType.tsx @@ -25,15 +25,14 @@ import DropdownIcon from '../../icons-components/DropdownIcon'; import { Button } from '../../ui/buttons'; import IssueTypeIcon from '../../ui/IssueTypeIcon'; import { translate } from '../../../helpers/l10n'; -import { Issue } from '../../../app/types'; import { RawQuery } from '../../../helpers/query'; interface Props { canSetType: boolean; isOpen: boolean; - issue: Pick<Issue, 'type'>; + issue: Pick<T.Issue, 'type'>; setIssueProperty: ( - property: keyof Issue, + property: keyof T.Issue, popup: string, apiCall: (query: RawQuery) => Promise<IssueResponse>, value: string diff --git a/server/sonar-web/src/main/js/components/issue/components/SimilarIssuesFilter.tsx b/server/sonar-web/src/main/js/components/issue/components/SimilarIssuesFilter.tsx index 2af9d3a8ff3..60fb22dfe6c 100644 --- a/server/sonar-web/src/main/js/components/issue/components/SimilarIssuesFilter.tsx +++ b/server/sonar-web/src/main/js/components/issue/components/SimilarIssuesFilter.tsx @@ -24,17 +24,16 @@ import DropdownIcon from '../../icons-components/DropdownIcon'; import FilterIcon from '../../icons-components/FilterIcon'; import { Button } from '../../ui/buttons'; import { translate } from '../../../helpers/l10n'; -import { Issue } from '../../../app/types'; interface Props { isOpen: boolean; - issue: Issue; + issue: T.Issue; togglePopup: (popup: string, show?: boolean) => void; - onFilter?: (property: string, issue: Issue) => void; + onFilter?: (property: string, issue: T.Issue) => void; } export default class SimilarIssuesFilter extends React.PureComponent<Props> { - handleFilter = (property: string, issue: Issue) => { + handleFilter = (property: string, issue: T.Issue) => { this.togglePopup(false); if (this.props.onFilter) { this.props.onFilter(property, issue); diff --git a/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueCommentLine-test.tsx b/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueCommentLine-test.tsx index ce358423f35..0ce8f9f43d7 100644 --- a/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueCommentLine-test.tsx +++ b/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueCommentLine-test.tsx @@ -21,9 +21,8 @@ import * as React from 'react'; import { shallow } from 'enzyme'; import IssueCommentLine from '../IssueCommentLine'; import { click } from '../../../../helpers/testUtils'; -import { IssueComment } from '../../../../app/types'; -const comment: IssueComment = { +const comment: T.IssueComment = { authorAvatar: 'gravatarhash', authorName: 'John Doe', createdAt: '2017-03-01T09:36:01+0100', diff --git a/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueTitleBar-test.tsx b/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueTitleBar-test.tsx index 43b0c9a8f21..6dcfe67f543 100644 --- a/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueTitleBar-test.tsx +++ b/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueTitleBar-test.tsx @@ -20,15 +20,8 @@ import * as React from 'react'; import { shallow } from 'enzyme'; import IssueTitleBar from '../IssueTitleBar'; -import { - ShortLivingBranch, - Issue, - BranchType, - IssueType, - FlowLocation -} from '../../../../app/types'; -const issue: Issue = { +const issue: T.Issue = { actions: [], component: 'main.js', componentLongName: 'main.js', @@ -52,16 +45,16 @@ const issue: Issue = { status: 'OPEN', textRange: { startLine: 25, endLine: 26, startOffset: 0, endOffset: 15 }, transitions: [], - type: IssueType.Bug + type: 'BUG' }; -const issueWithLocations: Issue = { +const issueWithLocations: T.Issue = { ...issue, flows: [[loc(), loc(), loc()], [loc(), loc()]], secondaryLocations: [loc(), loc()] }; -function loc(): FlowLocation { +function loc(): T.FlowLocation { return { component: 'main.js', textRange: { startLine: 1, startOffset: 1, endLine: 2, endOffset: 2 } @@ -69,11 +62,11 @@ function loc(): FlowLocation { } it('should render the titlebar correctly', () => { - const branch: ShortLivingBranch = { + const branch: T.ShortLivingBranch = { isMain: false, mergeBranch: 'master', name: 'feature-1.0', - type: BranchType.SHORT + type: 'SHORT' }; const element = shallow( <IssueTitleBar branchLike={branch} issue={issue} togglePopup={jest.fn()} /> diff --git a/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueType-test.tsx b/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueType-test.tsx index a7d62b447c1..e078ebb237e 100644 --- a/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueType-test.tsx +++ b/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueType-test.tsx @@ -21,10 +21,9 @@ import * as React from 'react'; import { shallow } from 'enzyme'; import IssueType from '../IssueType'; import { click } from '../../../../helpers/testUtils'; -import { IssueType as Type } from '../../../../app/types'; -const issue = { - type: Type.Bug +const issue: Pick<T.Issue, 'type'> = { + type: 'BUG' }; it('should render without the action when the correct rights are missing', () => { diff --git a/server/sonar-web/src/main/js/components/issue/popups/ChangelogPopup.tsx b/server/sonar-web/src/main/js/components/issue/popups/ChangelogPopup.tsx index 394fa2567d1..d8ee5dcd763 100644 --- a/server/sonar-web/src/main/js/components/issue/popups/ChangelogPopup.tsx +++ b/server/sonar-web/src/main/js/components/issue/popups/ChangelogPopup.tsx @@ -24,7 +24,6 @@ import Avatar from '../../ui/Avatar'; import DateTimeFormatter from '../../intl/DateTimeFormatter'; import IssueChangelogDiff, { ChangelogDiff } from '../components/IssueChangelogDiff'; import { DropdownOverlay } from '../../controls/Dropdown'; -import { Issue } from '../../../app/types'; interface Changelog { avatar?: string; @@ -35,7 +34,7 @@ interface Changelog { } interface Props { - issue: Pick<Issue, 'author' | 'creationDate' | 'key'>; + issue: Pick<T.Issue, 'author' | 'creationDate' | 'key'>; } interface State { diff --git a/server/sonar-web/src/main/js/components/issue/popups/CommentPopup.tsx b/server/sonar-web/src/main/js/components/issue/popups/CommentPopup.tsx index fe399cd8d4c..68d3933ee06 100644 --- a/server/sonar-web/src/main/js/components/issue/popups/CommentPopup.tsx +++ b/server/sonar-web/src/main/js/components/issue/popups/CommentPopup.tsx @@ -22,10 +22,9 @@ import MarkdownTips from '../../common/MarkdownTips'; import { Button, ResetButtonLink } from '../../ui/buttons'; import { translate } from '../../../helpers/l10n'; import { DropdownOverlay } from '../../controls/Dropdown'; -import { IssueComment } from '../../../app/types'; interface Props { - comment?: Pick<IssueComment, 'markdown'>; + comment?: Pick<T.IssueComment, 'markdown'>; onComment: (text: string) => void; toggleComment: (visible: boolean) => void; placeholder: string; diff --git a/server/sonar-web/src/main/js/components/issue/popups/SetAssigneePopup.tsx b/server/sonar-web/src/main/js/components/issue/popups/SetAssigneePopup.tsx index 6d4e9744ebd..872760f182a 100644 --- a/server/sonar-web/src/main/js/components/issue/popups/SetAssigneePopup.tsx +++ b/server/sonar-web/src/main/js/components/issue/popups/SetAssigneePopup.tsx @@ -29,7 +29,6 @@ import { searchUsers } from '../../../api/users'; import { translate } from '../../../helpers/l10n'; import { getCurrentUser, Store } from '../../../store/rootReducer'; import { DropdownOverlay } from '../../controls/Dropdown'; -import { Issue, CurrentUser, OrganizationMember } from '../../../app/types'; import { isSonarCloud } from '../../../helpers/system'; import { isLoggedIn } from '../../../helpers/users'; @@ -41,8 +40,8 @@ interface User { } interface Props { - currentUser: CurrentUser; - issue: Pick<Issue, 'projectOrganization'>; + currentUser: T.CurrentUser; + issue: Pick<T.Issue, 'projectOrganization'>; onSelect: (login: string) => void; } @@ -84,7 +83,7 @@ class SetAssigneePopup extends React.PureComponent<Props, State> { searchUsers({ q: query, ps: LIST_SIZE }).then(this.handleSearchResult, () => {}); }; - handleSearchResult = (response: { users: OrganizationMember[] }) => { + handleSearchResult = (response: { users: T.OrganizationMember[] }) => { this.setState({ users: response.users, currentUser: response.users.length > 0 ? response.users[0].login : '' diff --git a/server/sonar-web/src/main/js/components/issue/popups/SetSeverityPopup.tsx b/server/sonar-web/src/main/js/components/issue/popups/SetSeverityPopup.tsx index dbefb623d92..49e4534f987 100644 --- a/server/sonar-web/src/main/js/components/issue/popups/SetSeverityPopup.tsx +++ b/server/sonar-web/src/main/js/components/issue/popups/SetSeverityPopup.tsx @@ -23,10 +23,9 @@ import SelectList from '../../common/SelectList'; import SelectListItem from '../../common/SelectListItem'; import SeverityIcon from '../../icons-components/SeverityIcon'; import { DropdownOverlay } from '../../controls/Dropdown'; -import { Issue } from '../../../app/types'; type Props = { - issue: Pick<Issue, 'severity'>; + issue: Pick<T.Issue, 'severity'>; onSelect: (severity: string) => void; }; diff --git a/server/sonar-web/src/main/js/components/issue/popups/SetTypePopup.tsx b/server/sonar-web/src/main/js/components/issue/popups/SetTypePopup.tsx index 9deb10ced76..35db527ed9d 100644 --- a/server/sonar-web/src/main/js/components/issue/popups/SetTypePopup.tsx +++ b/server/sonar-web/src/main/js/components/issue/popups/SetTypePopup.tsx @@ -23,14 +23,13 @@ import IssueTypeIcon from '../../ui/IssueTypeIcon'; import SelectList from '../../common/SelectList'; import SelectListItem from '../../common/SelectListItem'; import { DropdownOverlay } from '../../controls/Dropdown'; -import { Issue, IssueType } from '../../../app/types'; interface Props { - issue: Pick<Issue, 'type'>; - onSelect: (type: IssueType) => void; + issue: Pick<T.Issue, 'type'>; + onSelect: (type: T.IssueType) => void; } -const TYPES = [IssueType.Bug, IssueType.Vulnerability, IssueType.CodeSmell]; +const TYPES = ['BUG', 'VULNERABILITY', 'CODE_SMELL']; export default function SetTypePopup({ issue, onSelect }: Props) { return ( diff --git a/server/sonar-web/src/main/js/components/issue/popups/SimilarIssuesPopup.tsx b/server/sonar-web/src/main/js/components/issue/popups/SimilarIssuesPopup.tsx index 85f8a606ab1..c75c01b1b65 100644 --- a/server/sonar-web/src/main/js/components/issue/popups/SimilarIssuesPopup.tsx +++ b/server/sonar-web/src/main/js/components/issue/popups/SimilarIssuesPopup.tsx @@ -29,11 +29,10 @@ import IssueTypeIcon from '../../ui/IssueTypeIcon'; import Avatar from '../../ui/Avatar'; import { translate } from '../../../helpers/l10n'; import { fileFromPath, limitComponentName } from '../../../helpers/path'; -import { Issue } from '../../../app/types'; interface Props { - issue: Issue; - onFilter: (property: string, issue: Issue) => void; + issue: T.Issue; + onFilter: (property: string, issue: T.Issue) => void; } export default class SimilarIssuesPopup extends React.PureComponent<Props> { diff --git a/server/sonar-web/src/main/js/components/issue/popups/__tests__/SetTypePopup-test.tsx b/server/sonar-web/src/main/js/components/issue/popups/__tests__/SetTypePopup-test.tsx index 20d17bb4fbf..3de436bf1c3 100644 --- a/server/sonar-web/src/main/js/components/issue/popups/__tests__/SetTypePopup-test.tsx +++ b/server/sonar-web/src/main/js/components/issue/popups/__tests__/SetTypePopup-test.tsx @@ -20,9 +20,8 @@ import * as React from 'react'; import { shallow } from 'enzyme'; import SetTypePopup from '../SetTypePopup'; -import { IssueType } from '../../../../app/types'; it('should render tags popup correctly', () => { - const element = shallow(<SetTypePopup issue={{ type: IssueType.Bug }} onSelect={jest.fn()} />); + const element = shallow(<SetTypePopup issue={{ type: 'BUG' }} onSelect={jest.fn()} />); expect(element).toMatchSnapshot(); }); |