@@ -154,17 +154,17 @@ export default class MeasureContent extends React.PureComponent<Props, State> { | |||
this.setState({ loadingMoreComponents: true }); | |||
getComponentTree(strategy, baseComponent.key, metricKeys, opts).then( | |||
r => { | |||
if (metric === this.props.requestedMetric) { | |||
if (metric.key === this.props.requestedMetric.key) { | |||
if (this.mounted) { | |||
this.setState(state => ({ | |||
components: [ | |||
...state.components, | |||
...r.components.map(component => enhanceComponent(component, metric, metrics)) | |||
], | |||
loadingMoreComponents: false, | |||
paging: r.paging | |||
})); | |||
} | |||
this.setState({ loadingMoreComponents: false }); | |||
} | |||
}, | |||
() => { |
@@ -73,7 +73,7 @@ export default class FilesView extends React.PureComponent<Props, State> { | |||
if (this.props.selectedKey !== undefined && prevProps.selectedKey !== this.props.selectedKey) { | |||
this.scrollToElement(); | |||
} | |||
if (prevProps.metric.key !== this.props.metric.key) { | |||
if (prevProps.metric.key !== this.props.metric.key || prevProps.view !== this.props.view) { | |||
this.setState({ showBestMeasures: this.props.defaultShowBestMeasures }); | |||
} | |||
} |
@@ -104,7 +104,7 @@ export default class TreeMapView extends React.PureComponent<Props, State> { | |||
getPercentColorScale = (metric: T.Metric) => { | |||
const color = scaleLinear<string, string>().domain([0, 25, 50, 75, 100]); | |||
color.range(metric.direction === 1 ? [...COLORS].reverse() : COLORS); | |||
color.range(metric.higherValuesAreBetter ? [...COLORS].reverse() : COLORS); | |||
return color; | |||
}; | |||
@@ -166,7 +166,6 @@ export default class TreeMapView extends React.PureComponent<Props, State> { | |||
className="measure-details-treemap-legend" | |||
colorNA={theme.secondFontColor} | |||
colorScale={colorScale} | |||
direction={metric.direction} | |||
height={20} | |||
width={200} | |||
/> |
@@ -1,112 +0,0 @@ | |||
/* | |||
* SonarQube | |||
* Copyright (C) 2009-2019 SonarSource SA | |||
* mailto:info AT sonarsource DOT com | |||
* | |||
* This program is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU Lesser General Public | |||
* License as published by the Free Software Foundation; either | |||
* version 3 of the License, or (at your option) any later version. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Lesser General Public License | |||
* along with this program; if not, write to the Free Software Foundation, | |||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
*/ | |||
import * as React from 'react'; | |||
import { omit } from 'lodash'; | |||
import { Query, ReferencedComponent, Facet } from '../utils'; | |||
import QualifierIcon from '../../../components/icons-components/QualifierIcon'; | |||
import { translate } from '../../../helpers/l10n'; | |||
import ListStyleFacet from '../../../components/facet/ListStyleFacet'; | |||
import { TreeComponent, getTree } from '../../../api/components'; | |||
import { highlightTerm } from '../../../helpers/search'; | |||
interface Props { | |||
componentKey: string; | |||
fetching: boolean; | |||
loadSearchResultCount: (property: string, changes: Partial<Query>) => Promise<Facet>; | |||
modules: string[]; | |||
onChange: (changes: Partial<Query>) => void; | |||
onToggle: (property: string) => void; | |||
open: boolean; | |||
query: Query; | |||
referencedComponents: { [componentKey: string]: ReferencedComponent }; | |||
stats: { [x: string]: number } | undefined; | |||
} | |||
export default class ModuleFacet extends React.PureComponent<Props> { | |||
getModuleName = (module: string) => { | |||
const { referencedComponents } = this.props; | |||
return referencedComponents[module] ? referencedComponents[module].name : module; | |||
}; | |||
getSearchResultKey = (module: TreeComponent) => { | |||
return module.id; | |||
}; | |||
getSearchResultText = (module: TreeComponent) => { | |||
return module.name; | |||
}; | |||
handleSearch = (query: string, page: number) => { | |||
return getTree({ | |||
component: this.props.componentKey, | |||
q: query, | |||
qualifiers: 'BRC', | |||
p: page, | |||
ps: 30 | |||
}).then(({ components, paging }) => ({ paging, results: components })); | |||
}; | |||
loadSearchResultCount = (modules: TreeComponent[]) => { | |||
return this.props.loadSearchResultCount('modules', { | |||
modules: modules.map(module => module.id) | |||
}); | |||
}; | |||
renderModule = (module: React.ReactNode) => ( | |||
<> | |||
<QualifierIcon className="little-spacer-right" qualifier="BRC" /> | |||
{module} | |||
</> | |||
); | |||
renderFacetItem = (module: string) => { | |||
const name = this.getModuleName(module); | |||
return this.renderModule(name); | |||
}; | |||
renderSearchResult = (module: TreeComponent, term: string) => { | |||
return this.renderModule(highlightTerm(module.name, term)); | |||
}; | |||
render() { | |||
return ( | |||
<ListStyleFacet<TreeComponent> | |||
facetHeader={translate('issues.facet.modules')} | |||
fetching={this.props.fetching} | |||
getFacetItemText={this.getModuleName} | |||
getSearchResultKey={this.getSearchResultKey} | |||
getSearchResultText={this.getSearchResultText} | |||
loadSearchResultCount={this.loadSearchResultCount} | |||
minSearchLength={3} | |||
onChange={this.props.onChange} | |||
onSearch={this.handleSearch} | |||
onToggle={this.props.onToggle} | |||
open={this.props.open} | |||
property="modules" | |||
query={omit(this.props.query, 'modules')} | |||
renderFacetItem={this.renderFacetItem} | |||
renderSearchResult={this.renderSearchResult} | |||
searchPlaceholder={translate('search.search_for_modules')} | |||
stats={this.props.stats} | |||
values={this.props.modules} | |||
/> | |||
); | |||
} | |||
} |
@@ -24,7 +24,6 @@ import CreationDateFacet from './CreationDateFacet'; | |||
import DirectoryFacet from './DirectoryFacet'; | |||
import FileFacet from './FileFacet'; | |||
import LanguageFacet from './LanguageFacet'; | |||
import ModuleFacet from './ModuleFacet'; | |||
import ProjectFacet from './ProjectFacet'; | |||
import ResolutionFacet from './ResolutionFacet'; | |||
import RuleFacet from './RuleFacet'; | |||
@@ -77,16 +76,6 @@ export default class Sidebar extends React.PureComponent<Props> { | |||
}; | |||
return ( | |||
<> | |||
{component.qualifier !== 'DIR' && ( | |||
<ModuleFacet | |||
fetching={loadingFacets.modules === true} | |||
modules={query.modules} | |||
open={!!openFacets.modules} | |||
referencedComponents={this.props.referencedComponentsById} | |||
stats={facets.modules} | |||
{...commonProps} | |||
/> | |||
)} | |||
{component.qualifier !== 'DIR' && ( | |||
<DirectoryFacet | |||
directories={query.directories} |
@@ -12,7 +12,6 @@ Array [ | |||
"StandardFacet", | |||
"TagFacet", | |||
"ProjectFacet", | |||
"ModuleFacet", | |||
"DirectoryFacet", | |||
"FileFacet", | |||
"AssigneeFacet", | |||
@@ -64,7 +63,6 @@ Array [ | |||
"RuleFacet", | |||
"StandardFacet", | |||
"TagFacet", | |||
"ModuleFacet", | |||
"DirectoryFacet", | |||
"FileFacet", | |||
"AssigneeFacet", | |||
@@ -83,7 +81,6 @@ Array [ | |||
"RuleFacet", | |||
"StandardFacet", | |||
"TagFacet", | |||
"ModuleFacet", | |||
"DirectoryFacet", | |||
"FileFacet", | |||
"AssigneeFacet", |
@@ -27,7 +27,6 @@ interface Props { | |||
colorScale: | |||
| ScaleOrdinal<string, string> // used for LEVEL type | |||
| ScaleLinear<string, string | number>; // used for RATING or PERCENT type | |||
direction?: number; | |||
height: number; | |||
padding?: [number, number, number, number]; | |||
width: number; | |||
@@ -39,16 +38,11 @@ export default function ColorGradientLegend({ | |||
className, | |||
colorScale, | |||
colorNA, | |||
direction, | |||
padding = [12, 24, 0, 0], | |||
height, | |||
width | |||
}: Props) { | |||
const colorRange: Array<string | number> = colorScale.range(); | |||
if (direction === 1) { | |||
colorRange.reverse(); | |||
} | |||
const colorDomain: Array<string | number> = colorScale.domain(); | |||
const lastColorIdx = colorRange.length - 1; | |||
const lastDomainIdx = colorDomain.length - 1; |
@@ -929,7 +929,7 @@ property.sonar.branch.longLivedBranches.regex.description=Regular expression use | |||
#------------------------------------------------------------------------------ | |||
search.shortcut_hint=Hint: Press {shortcut} from anywhere to open this search bar. | |||
search.show_more.hint=Press {0} to display | |||
search.placeholder=Search for projects, sub-projects and files... | |||
search.placeholder=Search for projects and files... | |||
search.search_for_projects=Search for projects... | |||
search.search_for_users=Search for users... | |||
search.search_for_users_or_groups=Search for users or groups... | |||
@@ -1210,7 +1210,7 @@ quality_gates.projects=Projects | |||
quality_gates.add_condition=Add Condition | |||
quality_gates.update_condition=Update Condition | |||
quality_gates.no_conditions=No Conditions | |||
quality_gates.introduction=Only project measures are checked against thresholds. Sub-projects, directories and files are ignored. | |||
quality_gates.introduction=Only project measures are checked against thresholds. Directories and files are ignored. | |||
quality_gates.health_icons=Project health icons represent: | |||
quality_gates.projects_for_default=Every project not specifically associated to a quality gate will be associated to this one by default. | |||
quality_gates.projects.with=With | |||
@@ -2536,7 +2536,7 @@ documentation.on_this_page=On this page | |||
# | |||
#------------------------------------------------------------------------------ | |||
code.open_component_page=Open Component's Page | |||
code.search_placeholder=Search for files and sub-projects... | |||
code.search_placeholder=Search for files... | |||
code.search_placeholder.portfolio=Search for projects and sub-portfolios... | |||