Bug 1724866 - Remove 'Hide improvements' button from Alerts View (#7236)

* Bug 1724866 - Remove 'Hide improvements' button from Alerts View

* Bug 1724866 -Modified alert filtering

* Bug 1724866 - Address requested changes
This commit is contained in:
Sorin Toma 2021-08-12 10:24:58 +03:00 коммит произвёл GitHub
Родитель c60a4bcc0d
Коммит 5ec0fae12e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 3 добавлений и 34 удалений

Просмотреть файл

@ -114,7 +114,6 @@ const alertsViewControls = ({
<AlertsViewControls
validated={{
hideDwnToInv: undefined,
hideImprovements: undefined,
filter: undefined,
updateParams: () => {},
}}
@ -136,7 +135,6 @@ const alertsViewControls = ({
location={history.location}
filters={{
filterText: '',
hideImprovements: false,
hideDownstream: false,
hideAssignedToOthers: false,
framework: { name: 'talos', id: 1 },
@ -185,7 +183,6 @@ beforeAll(() => {
test('toggle buttons should filter alert summary and alerts by selected filter', async () => {
const { getByText, getByTestId } = alertsView();
const hideImprovements = getByText('Hide improvements');
const hideDownstream = getByText('Hide downstream / reassigned to / invalid');
const alertSummary1 = await waitFor(() =>
@ -205,21 +202,12 @@ test('toggle buttons should filter alert summary and alerts by selected filter',
expect(alert1).toBeInTheDocument();
expect(alert2).toBeInTheDocument();
expect(hideImprovements).not.toHaveClass('active');
expect(hideDownstream).not.toHaveClass('active');
// one filter selected
fireEvent.click(hideImprovements);
expect(hideImprovements).toHaveClass('active');
expect(alertSummary1).not.toBeInTheDocument();
expect(alertSummary2).toBeInTheDocument();
expect(alert1).toBeInTheDocument();
expect(alert2).toBeInTheDocument();
// second filter selected
// filter selected
fireEvent.click(hideDownstream);
expect(alertSummary1).not.toBeInTheDocument();
expect(alertSummary1).toBeInTheDocument();
expect(alertSummary2).toBeInTheDocument();
expect(alert1).toBeInTheDocument();
expect(alert2).not.toBeInTheDocument();

Просмотреть файл

@ -122,7 +122,6 @@ export default class AlertTable extends React.Component {
filterAlert = (alert) => {
const {
hideImprovements,
hideDownstream,
hideAssignedToOthers,
filterText,
@ -130,7 +129,6 @@ export default class AlertTable extends React.Component {
const { username } = this.props.user;
const { alertSummary } = this.state;
const unconcealableRegression = !hideImprovements || alert.is_regression;
const notRelatedDownstream =
alert.summary_id === alertSummary.id ||
alert.status !== alertStatusMap.downstream;
@ -146,7 +144,6 @@ export default class AlertTable extends React.Component {
hideAssignedToOthers && alertSummary.assignee_username !== username;
const matchesFilters =
unconcealableRegression &&
notRelatedDownstream &&
!concealableReassigned &&
!concealableDownstream &&
@ -455,7 +452,6 @@ AlertTable.propTypes = {
filters: PropTypes.shape({
filterText: PropTypes.string,
hideDownstream: PropTypes.bool,
hideImprovements: PropTypes.bool,
hideAssignedToOthers: PropTypes.bool,
}).isRequired,
fetchAlertSummaries: PropTypes.func.isRequired,

Просмотреть файл

@ -76,7 +76,6 @@ class AlertsView extends React.Component {
params.status !== prevParams.status ||
params.framework !== prevParams.framework ||
params.filterText !== prevParams.filterText ||
params.hideImprovements !== prevParams.hideImprovements ||
params.hideDwnToInv !== prevParams.hideDwnToInv ||
params.hideAssignedToOthers !== prevParams.hideAssignedToOthers
) {
@ -102,7 +101,6 @@ class AlertsView extends React.Component {
frameworks: frameworkOptions,
}),
filterText: this.getDefaultFilterText(validated),
hideImprovements: convertParams(validated, 'hideImprovements'),
hideDownstream: convertParams(validated, 'hideDwnToInv'),
hideAssignedToOthers: convertParams(validated, 'hideAssignedToOthers'),
};
@ -166,7 +164,6 @@ class AlertsView extends React.Component {
return [filterName, summaryStatusMap[filterValue]];
case 'hideDownstream':
return ['hideDwnToInv', +filterValue];
case 'hideImprovements':
case 'hideAssignedToOthers':
return [filterName, +filterValue];
default:
@ -250,7 +247,6 @@ class AlertsView extends React.Component {
status,
framework,
filterText,
hideImprovements,
hideDownstream,
hideAssignedToOthers,
} = filters;
@ -263,9 +259,6 @@ class AlertsView extends React.Component {
if (filterText) {
params.filter_text = filterText;
}
if (hideImprovements) {
params.hide_improvements = hideImprovements;
}
if (hideDownstream) {
params.hide_related_and_invalid = hideDownstream;
}

Просмотреть файл

@ -114,7 +114,6 @@ export default class AlertsViewControls extends React.Component {
} = this.props;
const {
filterText,
hideImprovements,
hideDownstream,
hideAssignedToOthers,
framework,
@ -142,11 +141,6 @@ export default class AlertsViewControls extends React.Component {
];
const alertCheckboxes = [
{
text: 'Hide improvements',
state: hideImprovements,
stateName: 'hideImprovements',
},
{
text: 'Hide downstream / reassigned to / invalid',
state: hideDownstream,
@ -218,7 +212,6 @@ export default class AlertsViewControls extends React.Component {
<AlertTable
filters={{
filterText,
hideImprovements,
hideDownstream,
hideAssignedToOthers,
}}
@ -253,7 +246,6 @@ AlertsViewControls.propTypes = {
isListMode: PropTypes.bool.isRequired,
filters: PropTypes.shape({
filterText: PropTypes.string.isRequired,
hideImprovements: PropTypes.bool.isRequired,
hideDownstream: PropTypes.bool.isRequired,
hideAssignedToOthers: PropTypes.bool.isRequired,
framework: PropTypes.shape({}).isRequired,