expect(screen.getAllByText('Releasability rating').length).toBeGreaterThan(0);
});
+ it('should render issues measures when query by open_issues', async () => {
+ const { ui } = getPageObject();
+ renderMeasuresApp('component_measures?id=foo&metric=open_issues');
+ await ui.appLoaded();
+
+ expect(screen.getAllByText('Issues').length).toBeGreaterThan(1);
+ });
+
it('should render correctly if there are no measures', async () => {
componentsHandler.registerComponentMeasures({});
measuresHandler.registerComponentMeasures({});
it('should exclude banned measures', () => {
expect(
utils.filterMeasures([
- { metric: { id: '1', key: MetricKey.bugs, name: 'Bugs', type: 'INT' } },
+ { metric: { id: '1', key: MetricKey.open_issues, name: 'Bugs', type: 'INT' } },
{
metric: {
id: '2',
import {
Query,
banQualityGateMeasure,
+ filterMeasures,
getMeasuresPageMetricKeys,
groupByDomains,
hasBubbleChart,
getMeasuresWithPeriod(componentKey, filteredKeys, getBranchLikeQuery(branchLike)).then(
({ component, period }) => {
if (this.mounted) {
- const measures = banQualityGateMeasure(component).map((measure) =>
- enhanceMeasure(measure, metrics),
+ const measures = filterMeasures(
+ banQualityGateMeasure(component).map((measure) => enhanceMeasure(measure, metrics)),
);
-
const leakPeriod =
component.qualifier === ComponentQualifier.Project ? period : undefined;
import { groupBy, memoize, sortBy, toPairs } from 'lodash';
import { enhanceMeasure } from '../../components/measure/utils';
import { isBranch, isPullRequest } from '../../helpers/branch-like';
+import { HIDDEN_METRICS } from '../../helpers/constants';
import { getLocalizedMetricName } from '../../helpers/l10n';
import { MEASURES_REDIRECTION, getDisplayMetrics, isDiffMetric } from '../../helpers/measures';
import {
'Size',
'Complexity',
];
-const BANNED_MEASURES = [
- MetricKey.blocker_violations,
- MetricKey.new_blocker_violations,
- MetricKey.critical_violations,
- MetricKey.new_critical_violations,
- MetricKey.major_violations,
- MetricKey.new_major_violations,
- MetricKey.minor_violations,
- MetricKey.new_minor_violations,
- MetricKey.info_violations,
- MetricKey.new_info_violations,
-];
export function filterMeasures(measures: MeasureEnhanced[]): MeasureEnhanced[] {
- return measures.filter((measure) => !BANNED_MEASURES.includes(measure.metric.key as MetricKey));
+ return measures.filter((measure) => !HIDDEN_METRICS.includes(measure.metric.key as MetricKey));
}
export function sortMeasures(
} from '../../../components/activity-graph/utils';
import { Location, Router, withRouter } from '../../../components/hoc/withRouter';
import { getBranchLikeQuery } from '../../../helpers/branch-like';
+import { HIDDEN_METRICS } from '../../../helpers/constants';
import { parseDate } from '../../../helpers/dates';
import { serializeStringArray } from '../../../helpers/query';
import { withBranchLikes } from '../../../queries/branch';
}
return Object.values(metrics).filter(
- (metric) => metric.key !== MetricKey.security_review_rating,
+ (metric) =>
+ ![...HIDDEN_METRICS, MetricKey.security_review_rating].includes(metric.key as MetricKey),
);
};
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { startOfDay } from 'date-fns';
-import { isEqual } from 'lodash';
+import { isEqual, uniq } from 'lodash';
import { DEFAULT_GRAPH } from '../../components/activity-graph/utils';
import { parseDate } from '../../helpers/dates';
import { MEASURES_REDIRECTION } from '../../helpers/measures';
export function parseQuery(urlQuery: RawQuery): Query {
const parsedMetrics = parseAsArray(urlQuery['custom_metrics'], parseAsString<MetricKey>);
- const customMetrics = parsedMetrics.map((metric) => MEASURES_REDIRECTION[metric] ?? metric);
+ const customMetrics = uniq(parsedMetrics.map((metric) => MEASURES_REDIRECTION[metric] ?? metric));
return {
category: parseAsString(urlQuery['category']),
IssueStatus,
IssueType,
} from '../types/issues';
+import { MetricKey } from '../types/metrics';
import { RuleType } from '../types/types';
export const SEVERITIES = Object.values(IssueSeverity);
{ fill: colors.error400, fillTransparent: colors.error400a20, stroke: colors.error700 },
];
+export const HIDDEN_METRICS = [MetricKey.open_issues, MetricKey.reopened_issues];
+
export const PROJECT_KEY_MAX_LEN = 400;
export const ALM_DOCUMENTATION_PATHS = {
export const MEASURES_REDIRECTION: Partial<Record<MetricKey, MetricKey>> = {
[MetricKey.wont_fix_issues]: MetricKey.accepted_issues,
+ [MetricKey.open_issues]: MetricKey.violations,
+ [MetricKey.reopened_issues]: MetricKey.violations,
};
export function enhanceMeasuresWithMetrics(
component_measures.files=files
component_measures.tab.tree=Tree
component_measures.tab.list=List
+component_measures.show_metric_history=Show history of this metric
component_measures.tab.treemap=Treemap
component_measures.view_as=View as
component_measures.legend.color=Color: