🦸🏻 Integrating with Metron service
This commit is contained in:
@@ -61,6 +61,7 @@
|
||||
"react-notification-system-redux": "^2.0.1",
|
||||
"react-responsive-carousel": "^3.2.21",
|
||||
"react-select": "^5.2.1",
|
||||
"react-select-async-paginate": "^0.6.1",
|
||||
"react-sliding-pane": "^7.0.0",
|
||||
"react-stickynode": "^4.0.0",
|
||||
"react-table": "^7.7.0",
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
import axios from "axios";
|
||||
import { IFolderData, IExtractedComicBookCoverFile } from "threetwo-ui-typings";
|
||||
import { IFolderData } from "threetwo-ui-typings";
|
||||
import {
|
||||
API_BASE_URI,
|
||||
COMICBOOKINFO_SERVICE_URI,
|
||||
IMPORT_SERVICE_BASE_URI,
|
||||
} from "../constants/endpoints";
|
||||
import {
|
||||
IMS_COMICBOOK_METADATA_FETCHED,
|
||||
IMS_COMIC_BOOK_GROUPS_FETCHED,
|
||||
IMS_COMIC_BOOK_GROUPS_CALL_IN_PROGRESS,
|
||||
IMS_COMIC_BOOK_GROUPS_CALL_FAILED,
|
||||
@@ -19,8 +17,6 @@ import {
|
||||
IMS_CV_METADATA_IMPORT_FAILED,
|
||||
LS_IMPORT,
|
||||
} from "../constants/action-types";
|
||||
import { refineQuery } from "../shared/utils/filenameparser.utils";
|
||||
import sortBy from "array-sort-by";
|
||||
import { success } from "react-notification-system-redux";
|
||||
import { isNil } from "lodash";
|
||||
|
||||
@@ -208,8 +204,6 @@ export const fetchComicVineMatches =
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
/* return { issueSearchQuery, series: seriesSearchQuery.searchParams }; */
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
||||
24
src/client/actions/metron.actions.tsx
Normal file
24
src/client/actions/metron.actions.tsx
Normal file
@@ -0,0 +1,24 @@
|
||||
import axios from "axios";
|
||||
import { METRON_SERVICE_URI } from "../constants/endpoints";
|
||||
import {
|
||||
METRON_DATA_FETCH_SUCCESS,
|
||||
METRON_DATA_FETCH_IN_PROGRESS,
|
||||
} from "../constants/action-types";
|
||||
|
||||
export const fetchMetronResource = async (options) => {
|
||||
console.log(options);
|
||||
|
||||
const metronResourceResults = await axios.post(
|
||||
`${METRON_SERVICE_URI}/fetchResource`,
|
||||
options,
|
||||
);
|
||||
console.log(metronResourceResults);
|
||||
const foo = metronResourceResults.data.results.map((result) => {
|
||||
return {
|
||||
label: result.name,
|
||||
value: result.id,
|
||||
};
|
||||
});
|
||||
console.log({ options: foo, hasMore: false });
|
||||
return { options: foo, hasMore: false };
|
||||
};
|
||||
@@ -1,6 +1,11 @@
|
||||
import React, { ReactElement } from "react";
|
||||
import React, { ReactElement, useCallback, useEffect, useState } from "react";
|
||||
import { useSelector, useDispatch } from "react-redux";
|
||||
import { Form, Field } from "react-final-form";
|
||||
import DatePicker from "react-datepicker";
|
||||
import Creatable from "react-select/creatable";
|
||||
import { fetchMetronResource } from "../../actions/metron.actions";
|
||||
import { withAsyncPaginate } from "react-select-async-paginate";
|
||||
const CreatableAsyncPaginate = withAsyncPaginate(Creatable);
|
||||
|
||||
import "react-datepicker/dist/react-datepicker.css";
|
||||
export const EditMetadataPanel = (props): ReactElement => {
|
||||
@@ -9,6 +14,20 @@ export const EditMetadataPanel = (props): ReactElement => {
|
||||
const DayPickerAdapter = ({ input, ...rest }) => {
|
||||
return <DatePicker {...input} {...rest} />;
|
||||
};
|
||||
const dispatch = useDispatch();
|
||||
const [value, onChange] = useState(null);
|
||||
|
||||
const mudasir = useCallback((query) => {
|
||||
return fetchMetronResource({
|
||||
method: "GET",
|
||||
resource: "publisher",
|
||||
query: {
|
||||
name: query,
|
||||
page: 1,
|
||||
},
|
||||
});
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Form
|
||||
@@ -89,6 +108,29 @@ export const EditMetadataPanel = (props): ReactElement => {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Publisher */}
|
||||
<div className="field is-horizontal">
|
||||
<div className="field-label is-normal">
|
||||
<label className="label">Publisher</label>
|
||||
</div>
|
||||
<div className="field-body">
|
||||
<div className="field">
|
||||
<p className="control is-expanded has-icons-left">
|
||||
<CreatableAsyncPaginate
|
||||
SelectComponent={Creatable}
|
||||
debounceTimeout={3}
|
||||
// isDisabled={isAddingInProgress}
|
||||
value={value}
|
||||
loadOptions={(e) => mudasir(e)}
|
||||
// onCreateOption={onCreateOption}
|
||||
onChange={onChange}
|
||||
// cacheUniqs={[cacheUniq]}
|
||||
/>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
)}
|
||||
/>
|
||||
|
||||
@@ -69,3 +69,8 @@ export const SETTINGS_OBJECT_FETCHED = "SETTINGS_OBJECT_FETCHED";
|
||||
export const SETTINGS_CALL_FAILED = "SETTINGS_CALL_FAILED";
|
||||
export const SETTINGS_OBJECT_DELETED = "SETTINGS_OBJECT_DELETED";
|
||||
export const SETTINGS_DB_FLUSH_SUCCESS = "SETTINGS_DB_FLUSH_SUCCESS";
|
||||
|
||||
// Metron Metadata
|
||||
export const METRON_DATA_FETCH_SUCCESS = "METRON_DATA_FETCH_SUCCESS";
|
||||
export const METRON_DATA_FETCH_IN_PROGRESS = "METRON_DATA_FETCH_IN_PROGRESS";
|
||||
export const METRON_DATA_FETCH_ERROR = "METRON_DATA_FETCH_ERROR";
|
||||
|
||||
@@ -23,6 +23,13 @@ export const COMICBOOKINFO_SERVICE_URI = hostURIBuilder({
|
||||
apiPath: "/api/comicvine",
|
||||
});
|
||||
|
||||
export const METRON_SERVICE_URI = hostURIBuilder({
|
||||
protocol: "http",
|
||||
host: process.env.UNDERLYING_HOSTNAME || "localhost",
|
||||
port: "3080",
|
||||
apiPath: "/api/metron",
|
||||
});
|
||||
|
||||
export const API_BASE_URI = hostURIBuilder({
|
||||
protocol: "http",
|
||||
host: process.env.UNDERLYING_HOSTNAME || "localhost",
|
||||
|
||||
32
yarn.lock
32
yarn.lock
@@ -1045,6 +1045,13 @@
|
||||
dependencies:
|
||||
regenerator-runtime "^0.13.4"
|
||||
|
||||
"@babel/runtime@^7.16.5":
|
||||
version "7.16.7"
|
||||
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.16.7.tgz#03ff99f64106588c9c403c6ecb8c3bafbbdff1fa"
|
||||
integrity sha512-9E9FJowqAsytyOY6LG+1KuueckRL+aQW+mKvXRXnuFGyRAyepJPmEo9vgMfXUA6O9u3IeEdv9MAkppFcaQwogQ==
|
||||
dependencies:
|
||||
regenerator-runtime "^0.13.4"
|
||||
|
||||
"@babel/template@^7.15.4", "@babel/template@^7.3.3":
|
||||
version "7.15.4"
|
||||
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.15.4.tgz#51898d35dcf3faa670c4ee6afcfd517ee139f194"
|
||||
@@ -1680,6 +1687,11 @@
|
||||
domhandler "^4.2.0"
|
||||
selderee "^0.6.0"
|
||||
|
||||
"@seznam/compose-react-refs@^1.0.6":
|
||||
version "1.0.6"
|
||||
resolved "https://registry.yarnpkg.com/@seznam/compose-react-refs/-/compose-react-refs-1.0.6.tgz#6ec4e70bdd6e32f8e70b4100f27267cf306bd8df"
|
||||
integrity sha512-izzOXQfeQLonzrIQb8u6LQ8dk+ymz3WXTIXjvOlTXHq6sbzROg3NWU+9TTAOpEoK9Bth24/6F/XrfHJ5yR5n6Q==
|
||||
|
||||
"@sindresorhus/is@^0.7.0":
|
||||
version "0.7.0"
|
||||
resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.7.0.tgz#9a06f4f137ee84d7df0460c1fdb1135ffa6c50fd"
|
||||
@@ -11147,6 +11159,11 @@ react-hot-loader@^4.13.0:
|
||||
shallowequal "^1.1.0"
|
||||
source-map "^0.7.3"
|
||||
|
||||
react-is-mounted-hook@^1.1.2:
|
||||
version "1.1.2"
|
||||
resolved "https://registry.yarnpkg.com/react-is-mounted-hook/-/react-is-mounted-hook-1.1.2.tgz#0e57d237c0ed60f6a8dc0520634608a80ae864ff"
|
||||
integrity sha512-yjq3Tj34CiFcdVOS/h6JerWLOLdJqEGKMNpTHc4kWebzz2YtIpgqMRrqxdmQhewM1KJREojdAV2tsNvBsUWyhA==
|
||||
|
||||
react-is@^16.13.1, react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.1:
|
||||
version "16.13.1"
|
||||
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
|
||||
@@ -11287,6 +11304,16 @@ react-router@5.2.1, react-router@^5.2.0:
|
||||
tiny-invariant "^1.0.2"
|
||||
tiny-warning "^1.0.0"
|
||||
|
||||
react-select-async-paginate@^0.6.1:
|
||||
version "0.6.1"
|
||||
resolved "https://registry.yarnpkg.com/react-select-async-paginate/-/react-select-async-paginate-0.6.1.tgz#979810bd09829c14175441b6219280fb53959ab8"
|
||||
integrity sha512-oFdX8aciCoBEXuP0ouSSan4H/6lYw9w5eCiA3vw9eNSWdFmIU1HzyYrEQbVJDz027kp643e8pKKmO6pWbr21yA==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.16.5"
|
||||
"@seznam/compose-react-refs" "^1.0.6"
|
||||
react-is-mounted-hook "^1.1.2"
|
||||
sleep-promise "^9.1.0"
|
||||
|
||||
react-select@^5.2.1:
|
||||
version "5.2.1"
|
||||
resolved "https://registry.yarnpkg.com/react-select/-/react-select-5.2.1.tgz#416c25c6b79b94687702374e019c4f2ed9d159d6"
|
||||
@@ -12291,6 +12318,11 @@ slash@^3.0.0:
|
||||
resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634"
|
||||
integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==
|
||||
|
||||
sleep-promise@^9.1.0:
|
||||
version "9.1.0"
|
||||
resolved "https://registry.yarnpkg.com/sleep-promise/-/sleep-promise-9.1.0.tgz#101ebe65700bcd184709da95d960967b02b79d03"
|
||||
integrity sha512-UHYzVpz9Xn8b+jikYSD6bqvf754xL2uBUzDFwiU6NcdZeifPr6UfgU43xpkPu67VMS88+TI2PSI7Eohgqf2fKA==
|
||||
|
||||
slice-ansi@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-4.0.0.tgz#500e8dd0fd55b05815086255b3195adf2a45fe6b"
|
||||
|
||||
Reference in New Issue
Block a user