зеркало из https://github.com/mozilla/treeherder.git
Bug 1766972 - Add graph link to the Ratio column of the regression template (#7433)
* Add graph link to ration * Bug 1766972 - add constant for treeherder base url
This commit is contained in:
Родитель
ac457e31f4
Коммит
00607c7981
|
@ -7,6 +7,10 @@ export const uiJobsUrlBase = '/jobs';
|
|||
|
||||
export const uiPushHealthBase = '/push-health';
|
||||
|
||||
export const uiPerfherderBase = '/perfherder';
|
||||
|
||||
export const thBaseUrl = 'https://treeherder.mozilla.org/';
|
||||
|
||||
export const bzBaseUrl = 'https://bugzilla.mozilla.org/';
|
||||
|
||||
export const bzComponentEndpoint = '/bugzilla-component/';
|
||||
|
|
|
@ -22,6 +22,7 @@ import {
|
|||
modifyAlert,
|
||||
formatNumber,
|
||||
getFrameworkName,
|
||||
getTimeRange,
|
||||
} from '../perf-helpers/helpers';
|
||||
import SimpleTooltip from '../../shared/SimpleTooltip';
|
||||
import {
|
||||
|
@ -29,8 +30,6 @@ import {
|
|||
alertBackfillResultStatusMap,
|
||||
alertBackfillResultVisual,
|
||||
backfillRetriggeredTitle,
|
||||
phDefaultTimeRangeValue,
|
||||
phTimeRanges,
|
||||
noiseProfiles,
|
||||
} from '../perf-helpers/constants';
|
||||
import { Perfdocs } from '../perf-helpers/perfdocs';
|
||||
|
@ -72,25 +71,6 @@ export default class AlertTableRow extends React.Component {
|
|||
}
|
||||
}
|
||||
|
||||
getTimeRange = () => {
|
||||
const { alertSummary } = this.props;
|
||||
|
||||
const defaultTimeRange =
|
||||
alertSummary.repository === 'mozilla-beta'
|
||||
? 7776000
|
||||
: phDefaultTimeRangeValue;
|
||||
const timeRange = Math.max(
|
||||
defaultTimeRange,
|
||||
phTimeRanges
|
||||
.map((time) => time.value)
|
||||
.find(
|
||||
(value) => Date.now() / 1000.0 - alertSummary.push_timestamp <= value,
|
||||
),
|
||||
);
|
||||
// default value of one year, for one a push_timestamp exceeds the one year value slightly
|
||||
return timeRange || 31536000;
|
||||
};
|
||||
|
||||
toggleStar = async () => {
|
||||
const { starred } = this.state;
|
||||
const { alert, fetchAlertSummaries, alertSummary } = this.props;
|
||||
|
@ -369,7 +349,7 @@ export default class AlertTableRow extends React.Component {
|
|||
tagAndOption: tags.includes(element) && options.includes(element),
|
||||
}));
|
||||
|
||||
const timeRange = this.getTimeRange();
|
||||
const timeRange = getTimeRange(alertSummary);
|
||||
|
||||
const alertStatus = getStatus(alert.status, alertStatusMap);
|
||||
const tooltipText = alert.classifier_email
|
||||
|
|
|
@ -21,6 +21,7 @@ import {
|
|||
alertStatusMap,
|
||||
phFrameworksWithRelatedBranches,
|
||||
phTimeRanges,
|
||||
phDefaultTimeRangeValue,
|
||||
unknownFrameworkMessage,
|
||||
permaLinkPrefix,
|
||||
} from './constants';
|
||||
|
@ -383,6 +384,23 @@ const Alert = (alertData, optionCollectionMap) => ({
|
|||
}),
|
||||
});
|
||||
|
||||
export const getTimeRange = (alertSummary) => {
|
||||
const defaultTimeRange =
|
||||
alertSummary.repository === 'mozilla-beta'
|
||||
? 7776000
|
||||
: phDefaultTimeRangeValue;
|
||||
const timeRange = Math.max(
|
||||
defaultTimeRange,
|
||||
phTimeRanges
|
||||
.map((time) => time.value)
|
||||
.find(
|
||||
(value) => Date.now() / 1000.0 - alertSummary.push_timestamp <= value,
|
||||
),
|
||||
);
|
||||
// default value of one year, for one a push_timestamp exceeds the one year value slightly
|
||||
return timeRange || 31536000;
|
||||
};
|
||||
|
||||
// TODO change usage of signature_hash to signature.id
|
||||
export const getGraphsURL = (
|
||||
alert,
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
import numeral from 'numeral';
|
||||
import sortBy from 'lodash/sortBy';
|
||||
|
||||
import { thBaseUrl, uiPerfherderBase } from '../../helpers/url';
|
||||
|
||||
import { alertStatusMap } from './constants';
|
||||
import { getFrameworkName } from './helpers';
|
||||
import { getFrameworkName, getGraphsURL, getTimeRange } from './helpers';
|
||||
import { Perfdocs } from './perfdocs';
|
||||
|
||||
export default class TextualSummary {
|
||||
|
@ -63,7 +65,11 @@ export default class TextualSummary {
|
|||
formatAlert(alert) {
|
||||
const numFormat = '0,0.00';
|
||||
let amountPct;
|
||||
|
||||
const { repository, framework } = this.alertSummary;
|
||||
const timeRange = getTimeRange(this.alertSummary);
|
||||
const baseURL = thBaseUrl + uiPerfherderBase.slice(1);
|
||||
const graphLink =
|
||||
baseURL + getGraphsURL(alert, timeRange, repository, framework).slice(1);
|
||||
if (alert.amount_pct.toFixed(0) === '0') {
|
||||
// have extra fraction digits when rounding ends up with 0%
|
||||
amountPct = alert.amount_pct.toFixed(2);
|
||||
|
@ -94,9 +100,9 @@ export default class TextualSummary {
|
|||
updatedAlert.results_link &&
|
||||
updatedAlert.prev_results_link
|
||||
) {
|
||||
return `| ${amountPct}% | ${suiteTestName} | ${platform} | ${extraOptions} | [${prevValue}](${updatedAlert.prev_results_link}) -> [${newValue}](${updatedAlert.results_link}) |`;
|
||||
return `| [${amountPct}%](${graphLink}) | ${suiteTestName} | ${platform} | ${extraOptions} | [${prevValue}](${updatedAlert.prev_results_link}) -> [${newValue}](${updatedAlert.results_link}) |`;
|
||||
}
|
||||
return `| ${amountPct}% | ${suiteTestName} | ${platform} | ${extraOptions} | ${prevValue} -> ${newValue} |`;
|
||||
return `| [${amountPct}%](${graphLink}) | ${suiteTestName} | ${platform} | ${extraOptions} | ${prevValue} -> ${newValue} |`;
|
||||
}
|
||||
|
||||
formatAlertBulk(alerts) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче