Skip to content

Commit

Permalink
global: react-searchkit axios config and snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
topless committed Apr 2, 2020
1 parent 736ed19 commit c51d111
Show file tree
Hide file tree
Showing 23 changed files with 736 additions and 1,271 deletions.
14 changes: 4 additions & 10 deletions ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"format": "prettier --config ./.prettierrc --ignore-path ./.prettierignore --write \"**/*.js\""
},
"dependencies": {
"axios": "^0.19.0",
"axios": "^0.19.2",
"extract-text-webpack-plugin": "^3.0.2",
"formik": "^2.0.6",
"less": "^3.10.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ beforeEach(() => {
});

const searchApi = new InvenioSearchApi({
url: documentApi.searchBaseURL,
withCredentials: true,
axios: {
url: documentApi.searchBaseURL,
withCredentials: true,
},
});

describe('SearchControls tests', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,23 @@ exports[`SearchControls tests should mount SearchControls component 1`] = `
}
>
<ReactSearchKit
appName="RSK"
defaultSortByOnEmptyQuery={null}
history={null}
eventListenerEnabled={false}
searchApi={
InvenioSearchApi {
"axiosConfig": Object {
"url": "https://localhost:5000/api/documents/",
"withCredentials": true,
},
"http": [Function],
"requestInterceptor": undefined,
"requestSerializer": InvenioRequestSerializer {
"_addFilter": [Function],
"_addFilters": [Function],
"serialize": [Function],
},
"responseInterceptor": undefined,
"responseSerializer": InvenioResponseSerializer {
"serialize": [Function],
},
Expand Down Expand Up @@ -139,15 +146,17 @@ exports[`SearchControls tests should mount SearchControls component 1`] = `
}
>
<Connect(Bootstrap)
historyListen={null}
appName="RSK"
eventListenerEnabled={false}
searchOnInit={true}
>
<Bootstrap
historyListen={null}
appName="RSK"
eventListenerEnabled={false}
onAppInitialized={[Function]}
onBrowserHistoryExternallyChanged={[Function]}
searchOnInit={true}
searchOnUrlQueryStringChanged={[Function]}
updateQueryState={[Function]}
>
<SearchControls
layoutToggle={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,13 @@ class OrderResponseSerializer {

export class OrderSearch extends Component {
searchApi = new InvenioSearchApi({
axios: {
url: orderApi.searchBaseURL,
withCredentials: true,
},
invenio: {
responseSerializer: OrderResponseSerializer,
},
url: orderApi.searchBaseURL,
withCredentials: true,
});

renderSearchBar = (_, queryString, onInputChange, executeSearch) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ import history from '@history';

export class VendorSearch extends Component {
searchApi = new InvenioSearchApi({
url: vendorApi.searchBaseURL,
withCredentials: true,
axios: {
url: vendorApi.searchBaseURL,
withCredentials: true,
},
});
searchConfig = getSearchConfig('vendors');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ import history from '@history';

export class DocumentSearch extends Component {
searchApi = new InvenioSearchApi({
url: documentApi.searchBaseURL,
withCredentials: true,
axios: {
url: documentApi.searchBaseURL,
withCredentials: true,
},
});
searchConfig = getSearchConfig('documents');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ import { responseRejectInterceptor } from '@api/base';

export class DocumentRequestSearch extends Component {
searchApi = new InvenioSearchApi({
url: documentRequestApi.searchBaseURL,
withCredentials: true,
axios: {
url: documentRequestApi.searchBaseURL,
withCredentials: true,
},
interceptors: {
response: { reject: responseRejectInterceptor },
},
Expand Down
6 changes: 4 additions & 2 deletions ui/src/pages/backoffice/EItem/EItemSearch/EItemSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ import history from '@history';

export class EItemSearch extends Component {
searchApi = new InvenioSearchApi({
url: eitemApi.searchBaseURL,
withCredentials: true,
axios: {
url: eitemApi.searchBaseURL,
withCredentials: true,
},
interceptors: {
response: { reject: responseRejectInterceptor },
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ import { BorrowingRequestListEntry } from './components';

export class BorrowingRequestSearch extends Component {
searchApi = new InvenioSearchApi({
url: borrowingRequestApi.searchBaseURL,
withCredentials: true,
axios: {
url: borrowingRequestApi.searchBaseURL,
withCredentials: true,
},
});

renderSearchBar = (_, queryString, onInputChange, executeSearch) => {
Expand Down
6 changes: 4 additions & 2 deletions ui/src/pages/backoffice/ILL/LibrarySearch/LibrarySearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ import { LibraryListEntry } from './components/LibraryListEntry';

export class LibrarySearch extends Component {
searchApi = new InvenioSearchApi({
url: libraryApi.searchBaseURL,
withCredentials: true,
axios: {
url: libraryApi.searchBaseURL,
withCredentials: true,
},
});
searchConfig = getSearchConfig('libraries');

Expand Down
6 changes: 4 additions & 2 deletions ui/src/pages/backoffice/Item/ItemSearch/ItemSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ import {

export class ItemSearch extends Component {
searchApi = new InvenioSearchApi({
url: itemApi.searchBaseURL,
withCredentials: true,
axios: {
url: itemApi.searchBaseURL,
withCredentials: true,
},
interceptors: {
response: { reject: responseRejectInterceptor },
},
Expand Down
6 changes: 4 additions & 2 deletions ui/src/pages/backoffice/Patron/PatronSearch/PatronSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ import { ExportReactSearchKitResults } from '../../components';

export class PatronSearch extends Component {
searchApi = new InvenioSearchApi({
url: patronApi.searchBaseURL,
withCredentials: true,
axios: {
url: patronApi.searchBaseURL,
withCredentials: true,
},
interceptors: {
response: { reject: responseRejectInterceptor },
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ exports[`SeriesDetails tests should load the details component 1`] = `
<div
id="series-relations"
>
<UNDEFINED />
<Memo(Connect(SeriesSiblings)) />
</div>
</AccordionContent>,
"key": "series-relations",
Expand Down
6 changes: 4 additions & 2 deletions ui/src/pages/backoffice/Series/SeriesSearch/SeriesSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ import history from '@history';

export class SeriesSearch extends Component {
searchApi = new InvenioSearchApi({
url: seriesApi.searchBaseURL,
withCredentials: true,
axios: {
url: seriesApi.searchBaseURL,
withCredentials: true,
},
interceptors: {
response: { reject: responseRejectInterceptor },
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ exports[`MostLoanedDocumentsList tests should render show a message with no docu
className="field"
>
<Input
aria-describedby={null}
autoComplete="off"
data-test=""
icon={true}
Expand Down Expand Up @@ -270,7 +269,6 @@ exports[`MostLoanedDocumentsList tests should render show a message with no docu
/>
</Icon>
<input
aria-describedby={null}
autoComplete="off"
key=".1"
name="selectedDate"
Expand Down Expand Up @@ -422,7 +420,6 @@ exports[`MostLoanedDocumentsList tests should render show a message with no docu
className="field"
>
<Input
aria-describedby={null}
autoComplete="off"
data-test=""
icon={true}
Expand Down Expand Up @@ -453,7 +450,6 @@ exports[`MostLoanedDocumentsList tests should render show a message with no docu
/>
</Icon>
<input
aria-describedby={null}
autoComplete="off"
key=".1"
name="selectedDate"
Expand Down
Loading

0 comments on commit c51d111

Please sign in to comment.