Skip to content

Commit

Permalink
Disable 'Hide downstream / reassigned to / invalid' when selected sta… (
Browse files Browse the repository at this point in the history
#8356)

* Disable 'Hide downstream / reassigned to / invalid' when selected status is downstream/reassigned/invalid

* run yarn lint

* Fix change status filter function

* add logic for all statuses
  • Loading branch information
florinbilt authored Dec 18, 2024
1 parent 9490ea9 commit 1f352be
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
19 changes: 18 additions & 1 deletion ui/perfherder/alerts/AlertsViewControls.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ export default class AlertsViewControls extends React.Component {
.fill(null)
.map(() => React.createRef());
this.state = {
disableHideDownstream: ['invalid', 'reassigned', 'downstream'].includes(
props.filters.status,
),
currentAlert: -1,
alertsLength: this.props.alertSummaries.length,
disableButtons: {
Expand Down Expand Up @@ -58,7 +61,19 @@ export default class AlertsViewControls extends React.Component {

updateStatus = (status) => {
const { setFiltersState, updateViewState } = this.props;
setFiltersState({ status });

const isInvalidStatus = [
'invalid',
'reassigned',
'downstream',
'all statuses',
].includes(status);

this.setState({
disableHideDownstream:
status === 'all statuses' ? false : isInvalidStatus,
});
setFiltersState({ status, hideDownstream: !isInvalidStatus });
updateViewState({ page: 1 });
};

Expand Down Expand Up @@ -160,6 +175,7 @@ export default class AlertsViewControls extends React.Component {
text: 'Hide downstream / reassigned to / invalid',
state: hideDownstream,
stateName: 'hideDownstream',
disable: this.state.disableHideDownstream,
},
];

Expand All @@ -168,6 +184,7 @@ export default class AlertsViewControls extends React.Component {
text: 'My alerts',
state: hideAssignedToOthers,
stateName: 'hideAssignedToOthers',
disable: false,
});
}

Expand Down
1 change: 1 addition & 0 deletions ui/shared/FilterControls.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ const FilterControls = ({
outline
onClick={() => updateFilter(filter.stateName)}
active={filter.state}
disabled={filter.disable}
>
{filter.text}
</Button>
Expand Down

0 comments on commit 1f352be

Please sign in to comment.