branch={this.props.branch}
component={openIssue.component}
displayAllIssues={true}
+ displayIssueLocationsCount={false}
+ displayIssueLocationsLink={false}
highlightedLocations={locations}
highlightedLocationMessage={locationMessage}
loadIssues={this.props.loadIssues}
)}
<Issue
checked={this.props.checked}
+ displayLocationsLink={false}
issue={issue}
onChange={this.props.onChange}
onCheck={this.props.onCheck}
branch?: string,
component: string,
displayAllIssues: boolean,
+ displayIssueLocationsCount?: boolean;
+ displayIssueLocationsLink?: boolean;
filterLine?: (line: SourceLine) => boolean,
highlightedLine?: number,
highlightedLocations?: Array<FlowLocation>,
static defaultProps = {
displayAllIssues: false,
+ displayIssueLocationsCount: true,
+ displayIssueLocationsLink: true,
loadComponent,
loadIssues,
loadSources
return (
<SourceViewerCode
displayAllIssues={this.props.displayAllIssues}
+ displayIssueLocationsCount={this.props.displayIssueLocationsCount}
+ displayIssueLocationsLink={this.props.displayIssueLocationsLink}
duplications={this.state.duplications}
duplicationsByLine={this.state.duplicationsByLine}
duplicatedFiles={this.state.duplicatedFiles}
export default class SourceViewerCode extends React.PureComponent {
/*:: props: {|
displayAllIssues: boolean,
+ displayIssueLocationsCount?: boolean;
+ displayIssueLocationsLink?: boolean;
duplications?: Array<Duplication>,
duplicationsByLine: { [number]: Array<number> },
duplicatedFiles?: Array<{ key: string }>,
displayDuplications={displayDuplications}
displayFiltered={displayFiltered}
displayIssues={displayIssues}
+ displayIssueLocationsCount={this.props.displayIssueLocationsCount}
+ displayIssueLocationsLink={this.props.displayIssueLocationsLink}
duplications={this.getDuplicationsForLine(line)}
duplicationsCount={duplicationsCount}
filtered={filtered}
displayDuplications: boolean,
displayFiltered: boolean,
displayIssues: boolean,
+ displayIssueLocationsCount?: boolean;
+ displayIssueLocationsLink?: boolean;
duplications: Array<number>,
duplicationsCount: number,
filtered: boolean | null,
)}
<LineCode
+ displayIssueLocationsCount={this.props.displayIssueLocationsCount}
+ displayIssueLocationsLink={this.props.displayIssueLocationsLink}
highlightedLocationMessage={this.props.highlightedLocationMessage}
highlightedSymbols={this.props.highlightedSymbols}
issues={this.props.issues}
/*::
type Props = {|
+ displayIssueLocationsCount?: boolean,
+ displayIssueLocationsLink?: boolean,
highlightedLocationMessage?: { index: number, text: string },
highlightedSymbols?: Array<string>,
issues: Array<Issue>,
{showIssues &&
issues.length > 0 && (
<LineIssuesList
+ displayIssueLocationsCount={this.props.displayIssueLocationsCount}
+ displayIssueLocationsLink={this.props.displayIssueLocationsLink}
issues={issues}
onIssueChange={this.props.onIssueChange}
onIssueClick={onIssueSelect}
/*::
type Props = {
+ displayIssueLocationsCount?: boolean;
+ displayIssueLocationsLink?: boolean;
issues: Array<IssueType>,
onIssueChange: IssueType => void,
onIssueClick: (issueKey: string) => void,
<div className="issue-list">
{issues.map(issue => (
<Issue
+ displayLocationsCount={this.props.displayIssueLocationsCount}
+ displayLocationsLink={this.props.displayIssueLocationsLink}
issue={issue}
key={issue.key}
onChange={this.props.onIssueChange}
<div
className="issue-list"
>
- <BaseIssue
+ <Issue
+ displayLocationsCount={true}
+ displayLocationsLink={true}
issue={
Object {
"key": "foo",
openPopup={null}
selected={true}
/>
- <BaseIssue
+ <Issue
+ displayLocationsCount={true}
+ displayLocationsLink={true}
issue={
Object {
"key": "bar",
import { onFail } from '../../store/rootActions';
import { setIssueAssignee } from '../../api/issues';
import { updateIssue } from './actions';
-/*:: import type { Issue } from './types'; */
+/*:: import type { Issue as IssueType } from './types'; */
/*::
type Props = {|
checked?: boolean,
- issue: Issue,
- onChange: Issue => void,
+ displayLocationsCount?: boolean;
+ displayLocationsLink?: boolean;
+ issue: IssueType,
+ onChange: IssueType => void,
onCheck?: string => void,
onClick: string => void,
- onFilter?: (property: string, issue: Issue) => void,
- onPopupToggle: (issue: string, popupName: string, open: ?boolean ) => void,
+ onFilter?: (property: string, issue: IssueType) => void,
+ onPopupToggle: (issue: string, popupName: string, open: ?boolean) => void,
openPopup: ?string,
selected: boolean
|};
*/
-export default class BaseIssue extends React.PureComponent {
+export default class Issue extends React.PureComponent {
/*:: props: Props; */
static contextTypes = {
};
static defaultProps = {
+ displayLocationsCount: true,
+ displayLocationsLink: true,
selected: false
};
render() {
return (
<IssueView
- issue={this.props.issue}
checked={this.props.checked}
+ currentPopup={this.props.openPopup}
+ displayLocationsCount={this.props.displayLocationsCount}
+ displayLocationsLink={this.props.displayLocationsLink}
+ issue={this.props.issue}
onAssign={this.handleAssignement}
onCheck={this.props.onCheck}
onClick={this.props.onClick}
onFail={this.handleFail}
onFilter={this.props.onFilter}
onChange={this.props.onChange}
- togglePopup={this.togglePopup}
- currentPopup={this.props.openPopup}
selected={this.props.selected}
+ togglePopup={this.togglePopup}
/>
);
}
type Props = {|
checked?: boolean,
currentPopup: ?string,
+ displayLocationsCount?: boolean;
+ displayLocationsLink?: boolean;
issue: Issue,
onAssign: string => void,
onChange: Issue => void,
role="listitem"
tabIndex={0}>
<IssueTitleBar
- issue={issue}
currentPopup={this.props.currentPopup}
+ displayLocationsCount={this.props.displayLocationsCount}
+ displayLocationsLink={this.props.displayLocationsLink}
+ issue={issue}
onFail={this.props.onFail}
onFilter={this.props.onFilter}
togglePopup={this.props.togglePopup}
/*::
type Props = {|
- issue: Issue,
currentPopup: ?string,
+ displayLocationsCount?: boolean;
+ displayLocationsLink?: boolean;
+ issue: Issue,
onFail: Error => void,
onFilter?: (property: string, issue: Issue) => void,
togglePopup: (string, boolean | void) => void
</Tooltip>
);
- // dirty trick :(
- const onIssuesPage = document.getElementById('issues-page') != null;
+ const displayLocations = props.displayLocationsCount && locationsCount > 0;
const issueUrl = getComponentIssuesUrl(issue.project, { issues: issue.key, open: issue.key });
</span>
</li>
)}
- {locationsCount > 0 && (
+ {displayLocations && (
<li className="issue-meta">
- {onIssuesPage ? (
- locationsBadge
- ) : (
+ {props.displayLocationsLink ? (
<Link onClick={stopPropagation} target="_blank" to={issueUrl}>
{locationsBadge}
</Link>
+ ) : (
+ locationsBadge
)}
</li>
)}
secondaryLocations: []
};
+const issueWithLocations = {
+ ...issue,
+ flows: [[{}, {}, {}], [{}, {}]],
+ secondaryLocations: [{}, {}]
+};
+
it('should render the titlebar correctly', () => {
const element = shallow(
<IssueTitleBar issue={issue} currentPopup={null} onFail={jest.fn()} togglePopup={jest.fn()} />
});
it('should count all code locations', () => {
- const issueWithLocations = {
- ...issue,
- flows: [[{}, {}, {}], [{}, {}]],
- secondaryLocations: [{}, {}]
- };
- const element = shallow(<IssueTitleBar issue={issueWithLocations} />);
- expect(
- element
- .find('LocationIndex')
- .children()
- .text()
- ).toBe('7');
+ const element = shallow(
+ <IssueTitleBar displayLocationsCount={true} issue={issueWithLocations} />
+ );
+ expect(element.find('LocationIndex')).toMatchSnapshot();
});
// Jest Snapshot v1, https://goo.gl/fbAQLP
+exports[`should count all code locations 1`] = `
+<LocationIndex
+ selected={false}
+>
+ 7
+</LocationIndex>
+`;
+
exports[`should render the titlebar correctly 1`] = `
<table
className="issue-table"