Custom Filter improvements

Fixed: Removing Custom Filter left spinner visible
Fixed: Custom filter/tag input being cutoff on iOS
This commit is contained in:
Mark McDowall 2019-07-04 19:10:59 -07:00
parent 7503ce62af
commit 3199fe08e8
7 changed files with 31 additions and 11 deletions

View File

@ -3,16 +3,21 @@ import { connect } from 'react-redux';
import { createSelector } from 'reselect'; import { createSelector } from 'reselect';
import sortByName from 'Utilities/Array/sortByName'; import sortByName from 'Utilities/Array/sortByName';
import { filterBuilderTypes } from 'Helpers/Props'; import { filterBuilderTypes } from 'Helpers/Props';
import * as filterTypes from 'Helpers/Props/filterTypes';
import FilterBuilderRowValue from './FilterBuilderRowValue'; import FilterBuilderRowValue from './FilterBuilderRowValue';
function createTagListSelector() { function createTagListSelector() {
return createSelector( return createSelector(
(state, { filterType }) => filterType,
(state, { sectionItems }) => sectionItems, (state, { sectionItems }) => sectionItems,
(state, { selectedFilterBuilderProp }) => selectedFilterBuilderProp, (state, { selectedFilterBuilderProp }) => selectedFilterBuilderProp,
(sectionItems, selectedFilterBuilderProp) => { (filterType, sectionItems, selectedFilterBuilderProp) => {
if ( if (
selectedFilterBuilderProp.type === filterBuilderTypes.NUMBER || (selectedFilterBuilderProp.type === filterBuilderTypes.NUMBER ||
selectedFilterBuilderProp.type === filterBuilderTypes.STRING selectedFilterBuilderProp.type === filterBuilderTypes.STRING) &&
filterType !== filterTypes.EQUAL &&
filterType !== filterBuilderTypes.NOT_EQUAL ||
!selectedFilterBuilderProp.optionsSelector
) { ) {
return []; return [];
} }

View File

@ -1,4 +1,6 @@
.tag { .tag {
height: 21px;
&.isLastTag { &.isLastTag {
.or { .or {
display: none; display: none;
@ -7,7 +9,7 @@
} }
.label { .label {
composes: label from '~Components/Label.css'; composes: label from "~Components/Label.css";
border-style: none; border-style: none;
font-size: 13px; font-size: 13px;

View File

@ -29,10 +29,10 @@ function CustomFiltersModalContent(props) {
<ModalBody> <ModalBody>
{ {
customFilters.map((customFilter, index) => { customFilters.map((customFilter) => {
return ( return (
<CustomFilter <CustomFilter
key={index} key={customFilter.id}
id={customFilter.id} id={customFilter.id}
label={customFilter.label} label={customFilter.label}
filters={customFilter.filters} filters={customFilter.filters}

View File

@ -1,13 +1,13 @@
.input { .input {
composes: input from '~Components/Form/Input.css'; composes: input from "~Components/Form/Input.css";
} }
.hasError { .hasError {
composes: hasError from '~Components/Form/Input.css'; composes: hasError from "~Components/Form/Input.css";
} }
.hasWarning { .hasWarning {
composes: hasWarning from '~Components/Form/Input.css'; composes: hasWarning from "~Components/Form/Input.css";
} }
.inputContainer { .inputContainer {
@ -37,6 +37,7 @@
.suggestionsList { .suggestionsList {
margin: 5px 0; margin: 5px 0;
padding-left: 0; padding-left: 0;
max-height: 200px;
list-style-type: none; list-style-type: none;
} }

View File

@ -14,10 +14,11 @@
.internalInput { .internalInput {
flex: 1 1 0%; flex: 1 1 0%;
margin-top: -6px;
margin-left: 3px; margin-left: 3px;
min-width: 20%; min-width: 20%;
max-width: 100%; max-width: 100%;
width: 0%; width: 0%;
height: 21px; height: 31px;
border: none; border: none;
} }

View File

@ -6,5 +6,6 @@
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
padding: 6px 16px; padding: 6px 16px;
height: 33px;
cursor: default; cursor: default;
} }

View File

@ -270,7 +270,17 @@ export const defaultState = {
{ {
name: 'network', name: 'network',
label: 'Network', label: 'Network',
type: filterBuilderTypes.STRING type: filterBuilderTypes.STRING,
optionsSelector: function(items) {
const tagList = items.map((series) => {
return {
id: series.network,
name: series.network
};
});
return tagList.sort(sortByName);
}
}, },
{ {
name: 'qualityProfileId', name: 'qualityProfileId',