Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 21 additions & 7 deletions ui/perfherder/alerts/StatusDropdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
import { Dropdown, Col, Form } from 'react-bootstrap';
import template from 'lodash/template';
import templateSettings from 'lodash/templateSettings';
import { alertStatusMap } from '../perf-helpers/constants';

import {
getFilledBugSummary,
Expand Down Expand Up @@ -82,12 +83,21 @@ export default class StatusDropdown extends React.Component {
};
};

filterValidAlerts = () => {
const { filteredAlerts = [], alertSummary } = this.props;
return filteredAlerts.filter(
(alert) =>
alert.status === alertStatusMap.acknowledged ||
alert.status === alertStatusMap.untriaged ||
(alert.status === alertStatusMap.reassigned && alert.summary_id !== alertSummary.id),
);
};

fileBug = async (culpritId) => {
const {
alertSummary,
repoModel,
updateViewState,
filteredAlerts = [],
frameworks,
user,
} = this.props;
Expand All @@ -106,9 +116,11 @@ export default class StatusDropdown extends React.Component {
updateViewState,
);

const validAlerts = this.filterValidAlerts();

const textualSummary = new TextualSummary(
frameworks,
filteredAlerts,
validAlerts,
alertSummary,
null,
await browsertimeAlertsExtraData.enrichAndRetrieveAlerts(),
Expand Down Expand Up @@ -214,7 +226,6 @@ export default class StatusDropdown extends React.Component {
const {
alertSummary,
repoModel,
filteredAlerts = [],
frameworks,
updateViewState,
user,
Expand All @@ -234,9 +245,11 @@ export default class StatusDropdown extends React.Component {
updateViewState,
);

const validAlerts = this.filterValidAlerts();

const textualSummary = new TextualSummary(
frameworks,
filteredAlerts,
validAlerts,
alertSummary,
null,
await browsertimeAlertsExtraData.enrichAndRetrieveAlerts(),
Expand Down Expand Up @@ -268,7 +281,7 @@ export default class StatusDropdown extends React.Component {

// can't access the clipboardData on event unless it's done from react's
// onCopy, onCut or onPaste props so using this workaround
navigator.clipboard.writeText(commentText).then(() => {});
navigator.clipboard.writeText(commentText).then(() => { });
};

async getBugTemplate(framework, updateViewState) {
Expand Down Expand Up @@ -324,7 +337,6 @@ export default class StatusDropdown extends React.Component {
alertSummary,
repoModel,
updateViewState,
filteredAlerts = [],
frameworks,
user,
} = this.props;
Expand All @@ -346,9 +358,11 @@ export default class StatusDropdown extends React.Component {
return { failureStatus: 'Failed to retrieve bug template' };
}

const validAlerts = this.filterValidAlerts();

const textualSummary = new TextualSummary(
frameworks,
filteredAlerts,
validAlerts,
alertSummary,
null,
await browsertimeAlertsExtraData.enrichAndRetrieveAlerts(),
Expand Down