mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 12:54:38 +03:00
Fix list filter default values and error state
This commit is contained in:
@@ -75,14 +75,13 @@ export const AddFilter: React.FC<IAddFilterProps> = (
|
||||
}
|
||||
|
||||
function onAddFilter() {
|
||||
if (!Array.isArray(criterion.value) && defaultValue.current) {
|
||||
if (!Array.isArray(criterion.value) && defaultValue.current !== undefined) {
|
||||
const value = defaultValue.current;
|
||||
if (
|
||||
criterion.options &&
|
||||
!Array.isArray(criterion.options) &&
|
||||
(value === undefined || value === "" || typeof value === "number")
|
||||
) {
|
||||
criterion.value = criterion.options[0];
|
||||
criterion.value = criterion.options[0].toString();
|
||||
} else if (typeof value === "number" && value === undefined) {
|
||||
criterion.value = 0;
|
||||
} else if (value === undefined) {
|
||||
@@ -191,7 +190,7 @@ export const AddFilter: React.FC<IAddFilterProps> = (
|
||||
type={criterion.inputType}
|
||||
onChange={onChangedInput}
|
||||
onBlur={onBlurInput}
|
||||
value={criterion.value.toString()}
|
||||
defaultValue={criterion.value ? criterion.value.toString() : ''}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -342,13 +342,7 @@ const useList = <QueryResult extends IQueryResult, QueryData extends IDataItem>(
|
||||
})
|
||||
: undefined;
|
||||
|
||||
let template;
|
||||
if (result.loading || !forageInitialised) {
|
||||
template = <LoadingIndicator />;
|
||||
} else if (result.error) {
|
||||
template = <h1>{result.error.message}</h1>;
|
||||
} else {
|
||||
template = (
|
||||
const template = (
|
||||
<div>
|
||||
<ListFilter
|
||||
onChangePageSize={onChangePageSize}
|
||||
@@ -369,6 +363,8 @@ const useList = <QueryResult extends IQueryResult, QueryData extends IDataItem>(
|
||||
? options.renderSelectedOptions(result, selectedIds)
|
||||
: undefined}
|
||||
{options.renderContent(result, filter, selectedIds, zoomIndex)}
|
||||
{ (result.loading || !forageInitialised) && <LoadingIndicator /> }
|
||||
{ result.error && <h1>{result.error.message}</h1> }
|
||||
<Pagination
|
||||
itemsPerPage={filter.itemsPerPage}
|
||||
currentPage={filter.currentPage}
|
||||
@@ -377,7 +373,6 @@ const useList = <QueryResult extends IQueryResult, QueryData extends IDataItem>(
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return { filter, template, onSelectChange };
|
||||
};
|
||||
|
||||
@@ -35,7 +35,7 @@ code {
|
||||
|
||||
.table-list td,
|
||||
.table-list th {
|
||||
border-left: 1px solid rgba(255, 255, 255, .15);
|
||||
border-left: 1px solid #414c53;
|
||||
font-size: 1rem;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
|
||||
@@ -110,8 +110,7 @@ hr {
|
||||
|
||||
thead {
|
||||
th {
|
||||
border-bottom: 1px solid rgba(255, 255, 255, .15);
|
||||
border-color: rgba(255, 255, 255, .15);
|
||||
border-bottom: 1px solid #414c53;
|
||||
border-right: none;
|
||||
border-top: none;
|
||||
}
|
||||
@@ -119,7 +118,7 @@ hr {
|
||||
|
||||
td {
|
||||
border: none;
|
||||
border-color: rgba(255, 255, 255, .15);
|
||||
border-color: #414c53;
|
||||
padding: .25rem .75rem;
|
||||
|
||||
&:first-child {
|
||||
|
||||
Reference in New Issue
Block a user