Skip to content

Commit

Permalink
Merge pull request #6361 from tomachalek/ext_hist_srch_loader_fix_b
Browse files Browse the repository at this point in the history
Fix ajax loader for extended search in query history
  • Loading branch information
tomachalek authored Nov 15, 2024
2 parents f768650 + c7a165a commit 346e219
Showing 1 changed file with 50 additions and 8 deletions.
58 changes: 50 additions & 8 deletions public/files/js/views/searchHistory/full/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,48 @@ export function init(
);
};

// -------------------- <SrchResult /> --------------------------------------

const SrchResult:React.FC<{
searchFormView:'extended'|'quick';
data:Array<QueryHistoryItem>;
isBusy:boolean;
offset:number;
hasMoreItems:boolean;
itemsToolbars:Array<[boolean, boolean]>;
searched:boolean;

}> = (props) => {
if (props.searchFormView === 'quick') {
return <>
{props.data.length > 0 ?
<DataTable data={props.data} offset={props.offset}
modelIsBusy={props.isBusy}
hasMoreItems={props.hasMoreItems}
itemsToolbars={props.itemsToolbars}
searched={props.searched} /> :
null
}
{props.isBusy ?
<div className="loader"><layoutViews.AjaxLoaderImage /></div> :
null
}
</>;

} else {
return <>
{props.isBusy ?
<div className="loader"><layoutViews.AjaxLoaderImage /></div> :
<DataTable data={props.data} offset={props.offset}
modelIsBusy={props.isBusy}
hasMoreItems={props.hasMoreItems}
itemsToolbars={props.itemsToolbars}
searched={props.searched} />
}
</>;
}
};

// -------------------- <RecentQueriesPageList /> ------------------------

const RecentQueriesPageList:React.FC<
Expand Down Expand Up @@ -856,14 +898,14 @@ export function init(
archivedOnly={props.archivedOnly}
supportsFulltext={props.supportsFulltext}
searchFormView={props.searchFormView} />
{props.data.length === 0 && props.isBusy ?
<div className="loader"><layoutViews.AjaxLoaderImage /></div> :
<DataTable data={props.data} offset={props.offset}
modelIsBusy={props.isBusy}
hasMoreItems={props.hasMoreItems}
itemsToolbars={props.itemsToolbars}
searched={props.searched} />
}
<SrchResult
searchFormView={props.searchFormView}
data={props.data}
isBusy={props.isBusy}
offset={props.offset}
hasMoreItems={props.hasMoreItems}
itemsToolbars={props.itemsToolbars}
searched={props.searched} />
</S.RecentQueriesPageList>
}
</layoutViews.CloseableFrame>
Expand Down

0 comments on commit 346e219

Please sign in to comment.