Fix for elasticsearch upgrade breakage (#66)
* 🔧 Fixed the response object in reducers and components https://github.com/rishighan/threetwo/issues/64 Signed-off-by: Rishi Ghan <rishi.ghan@gmail.com> * #️⃣ Added a key prop to MetadataPanel in global search results Signed-off-by: Rishi Ghan <rishi.ghan@gmail.com> * 🔧 Fixed DOMNesting issues Signed-off-by: Rishi Ghan <rishi.ghan@gmail.com> * 🔧 Fixed the response in wanted reducer action Signed-off-by: Rishi Ghan <rishi.ghan@gmail.com> * ➕ Committing the reducer Signed-off-by: Rishi Ghan <rishi.ghan@gmail.com> * 🔧 Fixes for DOMNesting issues on the Downloads page Signed-off-by: Rishi Ghan <rishi.ghan@gmail.com> --------- Signed-off-by: Rishi Ghan <rishi.ghan@gmail.com>
This commit was merged in pull request #66.
This commit is contained in:
@@ -301,7 +301,7 @@ export const searchIssue = (query, options) => async (dispatch) => {
|
|||||||
case "wantedComicsPage":
|
case "wantedComicsPage":
|
||||||
dispatch({
|
dispatch({
|
||||||
type: WANTED_COMICS_FETCHED,
|
type: WANTED_COMICS_FETCHED,
|
||||||
data: response.data.body,
|
data: response.data.hits,
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case "globalSearchBar":
|
case "globalSearchBar":
|
||||||
@@ -314,13 +314,13 @@ export const searchIssue = (query, options) => async (dispatch) => {
|
|||||||
case "libraryPage":
|
case "libraryPage":
|
||||||
dispatch({
|
dispatch({
|
||||||
type: SS_SEARCH_RESULTS_FETCHED,
|
type: SS_SEARCH_RESULTS_FETCHED,
|
||||||
data: response.data.body,
|
data: response.data.hits,
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case "volumesPage":
|
case "volumesPage":
|
||||||
dispatch({
|
dispatch({
|
||||||
type: VOLUMES_FETCHED,
|
type: VOLUMES_FETCHED,
|
||||||
data: response.data.body,
|
data: response.data.hits,
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import { getTransfers } from "../../actions/airdcpp.actions";
|
|||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
import { AirDCPPSocketContext } from "../../context/AirDCPPSocket";
|
import { AirDCPPSocketContext } from "../../context/AirDCPPSocket";
|
||||||
import { isEmpty, isNil, isUndefined } from "lodash";
|
import { isEmpty, isNil, isUndefined } from "lodash";
|
||||||
import { searchIssue } from "../../actions/fileops.actions";
|
|
||||||
import { determineCoverFile } from "../../shared/utils/metadata.utils";
|
import { determineCoverFile } from "../../shared/utils/metadata.utils";
|
||||||
import MetadataPanel from "../shared/MetadataPanel";
|
import MetadataPanel from "../shared/MetadataPanel";
|
||||||
|
|
||||||
@@ -47,7 +46,6 @@ export const Downloads = (props: IDownloadsProps): ReactElement => {
|
|||||||
})
|
})
|
||||||
setBundles(foo);
|
setBundles(foo);
|
||||||
}
|
}
|
||||||
|
|
||||||
}, [issueBundles])
|
}, [issueBundles])
|
||||||
|
|
||||||
return !isNil(bundles) ?
|
return !isNil(bundles) ?
|
||||||
@@ -56,9 +54,9 @@ export const Downloads = (props: IDownloadsProps): ReactElement => {
|
|||||||
<h1 className="title">Downloads</h1>
|
<h1 className="title">Downloads</h1>
|
||||||
<div className="columns">
|
<div className="columns">
|
||||||
<div className="column is-half">
|
<div className="column is-half">
|
||||||
{bundles.map(bundle => {
|
{bundles.map((bundle, idx) => {
|
||||||
console.log(bundle);
|
console.log(bundle);
|
||||||
return <>
|
return <div key={idx}>
|
||||||
<MetadataPanel
|
<MetadataPanel
|
||||||
data={bundle}
|
data={bundle}
|
||||||
imageStyle={{ maxWidth: 80 }}
|
imageStyle={{ maxWidth: 80 }}
|
||||||
@@ -70,30 +68,33 @@ export const Downloads = (props: IDownloadsProps): ReactElement => {
|
|||||||
margin: "0 0 8px 0",
|
margin: "0 0 8px 0",
|
||||||
}} />
|
}} />
|
||||||
|
|
||||||
<table className="table is-size-7">
|
<table className="table is-size-7">
|
||||||
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Size</th>
|
<th>Size</th>
|
||||||
<th>Type</th>
|
<th>Type</th>
|
||||||
<th>Bundle ID</th>
|
<th>Bundle ID</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
</thead>
|
||||||
{bundle.acquisition.directconnect.downloads.map((bundle) => {
|
<tbody>
|
||||||
return(<tr>
|
{bundle.acquisition.directconnect.downloads.map((bundle, idx) => {
|
||||||
|
return (<tr key={idx}>
|
||||||
<td>{bundle.name}</td>
|
<td>{bundle.name}</td>
|
||||||
<td>{bundle.size}</td>
|
<td>{bundle.size}</td>
|
||||||
<td>{bundle.type.str}</td>
|
<td>{bundle.type.str}</td>
|
||||||
<td><span className="tag is-warning">{bundle.bundleId}</span></td>
|
<td><span className="tag is-warning">{bundle.bundleId}</span></td>
|
||||||
</tr>)
|
</tr>)
|
||||||
})}
|
})}
|
||||||
</table>
|
</tbody>
|
||||||
|
</table>
|
||||||
{/* <pre>{JSON.stringify(bundle.acquisition.directconnect.downloads, null, 2)}</pre> */}
|
{/* <pre>{JSON.stringify(bundle.acquisition.directconnect.downloads, null, 2)}</pre> */}
|
||||||
</>
|
</div>
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</div> : <div>asd</div>;
|
</div> : <div>There are no downloads.</div>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Downloads;
|
export default Downloads;
|
||||||
|
|||||||
@@ -61,9 +61,10 @@ export const SearchBar = (data: ISearchBarProps): ReactElement => {
|
|||||||
margin: "60px 0 0 350px",
|
margin: "60px 0 0 350px",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{map(searchResults, (result) => (
|
{map(searchResults, (result, idx) => (
|
||||||
<MetadataPanel
|
<MetadataPanel
|
||||||
data={result}
|
data={result}
|
||||||
|
key={idx}
|
||||||
imageStyle={{ maxWidth: 70 }}
|
imageStyle={{ maxWidth: 70 }}
|
||||||
titleStyle={{ fontSize: "0.8rem" }}
|
titleStyle={{ fontSize: "0.8rem" }}
|
||||||
tagsStyle={{ fontSize: "0.7rem" }}
|
tagsStyle={{ fontSize: "0.7rem" }}
|
||||||
|
|||||||
@@ -19,10 +19,7 @@ export const Library = (): ReactElement => {
|
|||||||
const searchResults = useSelector(
|
const searchResults = useSelector(
|
||||||
(state: RootState) => state.fileOps.libraryComics,
|
(state: RootState) => state.fileOps.libraryComics,
|
||||||
);
|
);
|
||||||
const searchError = useSelector((state: RootState) => {
|
const searchError = useSelector((state: RootState) => state.fileOps.librarySearchError);
|
||||||
console.log(state);
|
|
||||||
return state.fileOps.librarySearchError;
|
|
||||||
});
|
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
dispatch(
|
dispatch(
|
||||||
@@ -221,9 +218,9 @@ export const Library = (): ReactElement => {
|
|||||||
<div>
|
<div>
|
||||||
<div className="library">
|
<div className="library">
|
||||||
<T2Table
|
<T2Table
|
||||||
totalPages={searchResults.hits.total.value}
|
totalPages={searchResults.total.value}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
sourceData={searchResults?.hits?.hits}
|
sourceData={searchResults?.hits}
|
||||||
rowClickHandler={navigateToComicDetail}
|
rowClickHandler={navigateToComicDetail}
|
||||||
paginationHandlers={{
|
paginationHandlers={{
|
||||||
nextPage,
|
nextPage,
|
||||||
|
|||||||
@@ -166,8 +166,8 @@ export const Volumes = (props): ReactElement => {
|
|||||||
<div>
|
<div>
|
||||||
<div className="library">
|
<div className="library">
|
||||||
<T2Table
|
<T2Table
|
||||||
sourceData={volumes?.hits?.hits}
|
sourceData={volumes?.hits}
|
||||||
totalPages={volumes.hits.hits.length}
|
totalPages={volumes.hits.length}
|
||||||
paginationHandlers={{
|
paginationHandlers={{
|
||||||
nextPage: () => {},
|
nextPage: () => {},
|
||||||
previousPage: () => {},
|
previousPage: () => {},
|
||||||
|
|||||||
@@ -73,8 +73,8 @@ export const WantedComics = (props): ReactElement => {
|
|||||||
id: "downloadDetails",
|
id: "downloadDetails",
|
||||||
accessorKey: "acquisition",
|
accessorKey: "acquisition",
|
||||||
cell: data => <ol>
|
cell: data => <ol>
|
||||||
{data.getValue().directconnect.downloads.map(download => {
|
{data.getValue().directconnect.downloads.map((download, idx) => {
|
||||||
return <li className="is-size-7">{download.name}</li>;
|
return <li className="is-size-7" key={idx}>{download.name}</li>;
|
||||||
})}
|
})}
|
||||||
</ol>
|
</ol>
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -20,8 +20,6 @@ export const T2Table = (tableOptions): ReactElement => {
|
|||||||
pageIndex: 1,
|
pageIndex: 1,
|
||||||
pageSize: 15,
|
pageSize: 15,
|
||||||
});
|
});
|
||||||
console.log(sourceData)
|
|
||||||
|
|
||||||
|
|
||||||
const pagination = useMemo(
|
const pagination = useMemo(
|
||||||
() => ({
|
() => ({
|
||||||
@@ -81,12 +79,12 @@ export const T2Table = (tableOptions): ReactElement => {
|
|||||||
{/* <p>{totalPages} comics in all</p> */}
|
{/* <p>{totalPages} comics in all</p> */}
|
||||||
</div>
|
</div>
|
||||||
<div className="field has-addons">
|
<div className="field has-addons">
|
||||||
<p className="control">
|
<div className="control">
|
||||||
<div className="button" onClick={() => goToPreviousPage()}> <i className="fas fa-chevron-left"></i></div>
|
<div className="button" onClick={() => goToPreviousPage()}> <i className="fas fa-chevron-left"></i></div>
|
||||||
</p>
|
</div>
|
||||||
<p className="control">
|
<div className="control">
|
||||||
<div className="button" onClick={() => goToNextPage()}> <i className="fas fa-chevron-right"></i> </div>
|
<div className="button" onClick={() => goToNextPage()}> <i className="fas fa-chevron-right"></i> </div>
|
||||||
</p>
|
</div>
|
||||||
|
|
||||||
<div className="field has-addons ml-5">
|
<div className="field has-addons ml-5">
|
||||||
<p className="control">
|
<p className="control">
|
||||||
|
|||||||
@@ -246,7 +246,7 @@ function fileOpsReducer(state = initialState, action) {
|
|||||||
case WANTED_COMICS_FETCHED: {
|
case WANTED_COMICS_FETCHED: {
|
||||||
const foo = [];
|
const foo = [];
|
||||||
if (!isUndefined(action.data.hits)) {
|
if (!isUndefined(action.data.hits)) {
|
||||||
map(action.data.hits.hits, ({ _source }) => {
|
map(action.data.hits, ({ _source }) => {
|
||||||
foo.push(_source);
|
foo.push(_source);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user