Skip to content

Commit

Permalink
Fixed: Selection of last added custom filter
Browse files Browse the repository at this point in the history
Plus some translations and typos
  • Loading branch information
mynameisbogdan committed Feb 23, 2024
1 parent 5f0d6e2 commit 007601c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
@@ -1,3 +1,4 @@
import { maxBy } from 'lodash';
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import FormInputGroup from 'Components/Form/FormInputGroup';
Expand Down Expand Up @@ -50,7 +51,7 @@ class FilterBuilderModalContent extends Component {
if (id) {
dispatchSetFilter({ selectedFilterKey: id });
} else {
const last = customFilters[customFilters.length -1];
const last = maxBy(customFilters, 'id');
dispatchSetFilter({ selectedFilterKey: last.id });
}

Expand Down Expand Up @@ -108,7 +109,7 @@ class FilterBuilderModalContent extends Component {
this.setState({
labelErrors: [
{
message: 'Label is required'
message: translate('LabelIsRequired')
}
]
});
Expand Down Expand Up @@ -146,13 +147,13 @@ class FilterBuilderModalContent extends Component {
return (
<ModalContent onModalClose={onModalClose}>
<ModalHeader>
Custom Filter
{translate('CustomFilter')}
</ModalHeader>

<ModalBody>
<div className={styles.labelContainer}>
<div className={styles.label}>
Label
{translate('Label')}
</div>

<div className={styles.labelInputContainer}>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/Components/Filter/CustomFilters/CustomFilter.js
Expand Up @@ -37,8 +37,8 @@ class CustomFilter extends Component {
dispatchSetFilter
} = this.props;

// Assume that delete and then unmounting means the delete was successful.
// Moving this check to a ancestor would be more accurate, but would have
// Assume that delete and then unmounting means the deletion was successful.
// Moving this check to an ancestor would be more accurate, but would have
// more boilerplate.
if (this.state.isDeleting && id === selectedFilterKey) {
dispatchSetFilter({ selectedFilterKey: 'all' });
Expand Down
2 changes: 2 additions & 0 deletions src/NzbDrone.Core/Localization/Core/en.json
Expand Up @@ -134,6 +134,7 @@
"CountIndexersAvailable": "{count} indexer(s) available",
"CountIndexersSelected": "{count} indexer(s) selected",
"Custom": "Custom",
"CustomFilter": "Custom Filter",
"CustomFilters": "Custom Filters",
"Database": "Database",
"DatabaseMigration": "Database Migration",
Expand Down Expand Up @@ -422,6 +423,7 @@
"InvalidUILanguage": "Your UI is set to an invalid language, correct it and save your settings",
"KeyboardShortcuts": "Keyboard Shortcuts",
"Label": "Label",
"LabelIsRequired": "Label is required",
"Language": "Language",
"LastDuration": "Last Duration",
"LastExecution": "Last Execution",
Expand Down

0 comments on commit 007601c

Please sign in to comment.