Skip to content

Commit

Permalink
UIQM-580: Move QuickMarcView, PrintPopup, useAuthorityLinkingRules an…
Browse files Browse the repository at this point in the history
…d getHeaders to stripes-marc-components. (#613)
  • Loading branch information
Dmytro-Melnyshyn authored Oct 31, 2023
1 parent 45d0972 commit e9bf65c
Show file tree
Hide file tree
Showing 28 changed files with 34 additions and 781 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change history for ui-quick-marc

## [8.0.0] (IN PROGRESS)

* [UIQM-580](https://issues.folio.org/browse/UIQM-580) *BREAKING* Move QuickMarcView, PrintPopup and getHeaders to stripes-marc-components.

## [7.1.0] (IN PROGRESS)

* [UIQM-543](https://issues.folio.org/browse/UIQM-543) Remove eslint deps that are already listed in eslint-config-stripes.
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@folio/quick-marc",
"version": "7.0.2",
"version": "8.0.0",
"description": "Quick MARC editor",
"main": "index.js",
"repository": "",
Expand Down Expand Up @@ -155,6 +155,7 @@
"@folio/stripes": "^9.0.0",
"@folio/stripes-cli": "^3.0.0",
"@folio/stripes-core": "^10.0.0",
"@folio/stripes-marc-components": "^1.0.0",
"@folio/stripes-testing": "^4.2.0",
"@formatjs/cli": "^6.1.3",
"core-js": "^3.6.1",
Expand All @@ -181,11 +182,11 @@
"react-final-form-listeners": "^1.0.2",
"react-query": "^3.39.2",
"react-router-prop-types": "^1.0.4",
"react-to-print": "^2.14.11",
"uuid": "^8.3.2"
},
"peerDependencies": {
"@folio/stripes": "^9.0.0",
"@folio/stripes-marc-components": "^1.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-intl": "^6.4.4",
Expand Down
2 changes: 1 addition & 1 deletion src/QuickMarcEditor/QuickMarcEditWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
useStripes,
} from '@folio/stripes/core';
import { useShowCallout } from '@folio/stripes-acq-components';
import { getHeaders } from '@folio/stripes-marc-components';

import QuickMarcEditor from './QuickMarcEditor';
import { useAuthorityLinking } from '../hooks';
Expand All @@ -36,7 +37,6 @@ import {
autopopulateFixedField,
autopopulatePhysDescriptionField,
autopopulateMaterialCharsField,
getHeaders,
applyCentralTenantInHeaders,
} from './utils';
import {
Expand Down
6 changes: 5 additions & 1 deletion src/QuickMarcEditor/QuickMarcEditor.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,14 @@ jest.mock('react-router', () => ({

jest.mock('../queries', () => ({
...jest.requireActual('../queries'),
useAuthorityLinkingRules: jest.fn().mockReturnValue({ linkingRules: [] }),
useLinkSuggestions: jest.fn().mockReturnValue({ isLoading: false, fetchLinkSuggestions: jest.fn() }),
}));

jest.mock('@folio/stripes-marc-components', () => ({
...jest.requireActual('@folio/stripes-marc-components'),
useAuthorityLinkingRules: jest.fn().mockReturnValue({ linkingRules: [] }),
}));

jest.mock('@folio/stripes-acq-components', () => ({
...jest.requireActual('@folio/stripes-acq-components'),
useShowCallout: jest.fn(),
Expand Down
2 changes: 1 addition & 1 deletion src/QuickMarcEditor/QuickMarcEditorContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
baseManifest,
useShowCallout,
} from '@folio/stripes-acq-components';
import { getHeaders } from '@folio/stripes-marc-components';

import {
EXTERNAL_INSTANCE_APIS,
Expand All @@ -36,7 +37,6 @@ import {
splitFields,
getCreateBibMarcRecordResponse,
getCreateAuthorityMarcRecordResponse,
getHeaders,
applyCentralTenantInHeaders,
} from './utils';
import { QUICK_MARC_ACTIONS } from './constants';
Expand Down
8 changes: 6 additions & 2 deletions src/QuickMarcEditor/QuickMarcEditorContainer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,16 @@ jest.mock('react-router', () => ({
withRouter: Component => props => <Component match={match} location={location} history={mockHistory} {...props} />,
}));

jest.mock('../queries', () => ({
...jest.requireActual('../queries'),
jest.mock('@folio/stripes-marc-components', () => ({
...jest.requireActual('@folio/stripes-marc-components'),
useAuthorityLinkingRules: jest.fn().mockReturnValue({
linkingRules: [],
isLoading: false,
}),
}));

jest.mock('../queries', () => ({
...jest.requireActual('../queries'),
useAuthoritySourceFiles: jest.fn().mockReturnValue({
sourceFiles: [],
isLoading: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,16 @@ jest.mock('../../hooks', () => ({
}),
}));

jest.mock('../../queries', () => ({
...jest.requireActual('../../queries'),
jest.mock('@folio/stripes-marc-components', () => ({
...jest.requireActual('@folio/stripes-marc-components'),
useAuthorityLinkingRules: jest.fn().mockReturnValue({
linkingRules: [],
isLoading: false,
}),
}));

jest.mock('../../queries', () => ({
...jest.requireActual('../../queries'),
useAuthoritySourceFiles: jest.fn().mockResolvedValue({
sourceFiles: [],
isLoading: false,
Expand Down
26 changes: 0 additions & 26 deletions src/QuickMarcEditor/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -1529,32 +1529,6 @@ export const hydrateForLinkSuggestions = (marcRecord, fields) => ({
_actionType: 'view',
});

export const getHeaders = (tenant, token, locale, method = 'GET') => {
// This is taken from stripes-connect/OkapiResource.js
const headers = {
POST: {
Accept: 'application/json',
},
DELETE: {
Accept: 'text/plain',
},
GET: {
Accept: 'application/json',
},
PUT: {
Accept: 'text/plain',
},
};

return {
...headers[method],
'Accept-Language': locale,
'Content-Type': 'application/json',
'X-Okapi-Tenant': tenant,
...(token && { 'X-Okapi-Token': token }),
};
};

export const changeTenantHeader = (ky, tenantId) => {
return ky.extend({
hooks: {
Expand Down
14 changes: 0 additions & 14 deletions src/QuickMarcView/MarcContent/MarcContent.css

This file was deleted.

69 changes: 0 additions & 69 deletions src/QuickMarcView/MarcContent/MarcContent.js

This file was deleted.

67 changes: 0 additions & 67 deletions src/QuickMarcView/MarcContent/MarcContent.test.js

This file was deleted.

1 change: 0 additions & 1 deletion src/QuickMarcView/MarcContent/index.js

This file was deleted.

3 changes: 0 additions & 3 deletions src/QuickMarcView/MarcField.css

This file was deleted.

Loading

0 comments on commit e9bf65c

Please sign in to comment.