Skip to content

Commit

Permalink
Merge branch 'master' into UIREQMED-27
Browse files Browse the repository at this point in the history
  • Loading branch information
artem-blazhko committed Jul 11, 2024
2 parents 008d18a + 038128b commit 2e7dbb9
Show file tree
Hide file tree
Showing 36 changed files with 133 additions and 146 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
import { effectiveCallNumber } from '@folio/stripes/util';
import { ClipCopy } from '@folio/stripes/smart-components';

import { isValidRequest } from '../../../../utils';
import {
ITEM_STATUS_TRANSLATIONS,
OPEN_REQUEST_STATUS_FILTERS,
Expand Down Expand Up @@ -51,16 +50,7 @@ const ItemDetail = ({
)
: count;
const itemLabel = item.barcode ? 'ui-requests-mediated.itemDetails.barcode' : 'ui-requests-mediated.itemDetails.id';
const isRequestValid = isValidRequest({ instanceId, holdingsRecordId });
const getRecordLink = () => {
if (itemId) {
return isRequestValid
? <Link to={`/inventory/view/${instanceId}/${holdingsRecordId}/${itemId}`}>{item.barcode || itemId}</Link>
: (item.barcode || itemId);
}

return <NoValue />;
};
const recordLink = itemId ? <Link to={`/inventory/view/${instanceId}/${holdingsRecordId}/${itemId}`}>{item.barcode || itemId}</Link> : <NoValue />;

return (
<>
Expand All @@ -71,7 +61,7 @@ const ItemDetail = ({
label={<FormattedMessage id={itemLabel} />}
value={
<>
{getRecordLink()}
{recordLink}
{
Boolean(item.barcode) && (
<ClipCopy text={item.barcode} />
Expand Down
2 changes: 0 additions & 2 deletions src/constants/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ export const REQUEST_FORM_FIELD_NAMES = {
KEY_OF_USER_BARCODE_FIELD: 'keyOfUserBarcodeField',
};

export const INVALID_REQUEST_HARDCODED_ID = '00000000-0000-4000-8000-000000000000';

export const REQUEST_STATUSES = {
AWAITING_DELIVERY: 'Open - Awaiting delivery',
AWAITING_PICKUP: 'Open - Awaiting pickup',
Expand Down
7 changes: 0 additions & 7 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import {
isObject,
} from 'lodash';

import { INVALID_REQUEST_HARDCODED_ID } from './constants';

export const transformRequestFilterOptions = (formatMessage, source = []) => (
source.map(({ label, value }) => ({
label: formatMessage({ id: label }),
Expand Down Expand Up @@ -54,11 +52,6 @@ export const memoizeValidation = (fn) => {
};
};

export const isValidRequest = ({
instanceId,
holdingsRecordId,
}) => instanceId !== INVALID_REQUEST_HARDCODED_ID && holdingsRecordId !== INVALID_REQUEST_HARDCODED_ID;

export const getInstanceQueryString = (hrid, id) => `("hrid"=="${hrid}" or "id"=="${id || hrid}")`;

export const getStatusQuery = (statuses = []) => statuses.reduce((acc, val) => `${acc ? acc + ' or ' : acc}status=="${val}"`, '');
Expand Down
26 changes: 0 additions & 26 deletions src/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
handleKeyCommand,
isFormEditing,
memoizeValidation,
isValidRequest,
getTlrSettings,
getPatronGroup,
isSubmittingButtonDisabled,
Expand All @@ -12,7 +11,6 @@ import {
getInstanceQueryString,
getFullName,
} from './utils';
import { INVALID_REQUEST_HARDCODED_ID } from './constants';

describe('utils', () => {
describe('transformRequestFilterOptions', () => {
Expand Down Expand Up @@ -137,30 +135,6 @@ describe('utils', () => {
});
});

describe('isValidRequest', () => {
describe('When request is valid', () => {
it('should return true', () => {
const request = {
instanceId: 'instanceId',
holdingsRecordId: 'holdingRecordId',
};

expect(isValidRequest(request)).toBe(true);
});
});

describe('When request is not valid', () => {
it('should return false', () => {
const request = {
instanceId: INVALID_REQUEST_HARDCODED_ID,
holdingsRecordId: INVALID_REQUEST_HARDCODED_ID,
};

expect(isValidRequest(request)).toBe(false);
});
});
});

describe('getInstanceQueryString', () => {
const hrid = 'hrid';
const id = 'instanceId';
Expand Down
7 changes: 4 additions & 3 deletions translations/ui-requests-mediated/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"settings.general": "General",
"settings.general.message": "These are your general app settings.",
"permission.view": "Mediated requests: View",
"permission.view-create": "Mediated requests: View, create",
"permission.view-create-edit": "Mediated requests: View, edit, cancel",
"permission.view-create-edit": "Mediated requests: View, create, edit",
"permission.all": "Mediated requests: All permissions",
"app.filterPane.selectActivity": "Select activity",
"app.confirmItemArrival.navigation": "Confirm item arrival",
Expand All @@ -24,5 +23,7 @@
"filters.mediatedRequestStatus.openItemArrived": "Open - Item arrived",
"filters.mediatedRequestLevel.accordionTitle": "Mediated request level",
"filters.mediatedRequestLevel.item": "Item",
"filters.mediatedRequestLevel.title": "Title"
"filters.mediatedRequestLevel.title": "Title",
"permission.view-decline": "Mediated requests: View, decline",
"permission.view-edit-decline": "Mediated requests: View, edit, decline"
}
7 changes: 4 additions & 3 deletions translations/ui-requests-mediated/ber.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"settings.general": "General",
"settings.general.message": "These are your general app settings.",
"permission.view": "Mediated requests: View",
"permission.view-create": "Mediated requests: View, create",
"permission.view-create-edit": "Mediated requests: View, edit, cancel",
"permission.view-create-edit": "Mediated requests: View, create, edit",
"permission.all": "Mediated requests: All permissions",
"app.filterPane.selectActivity": "Select activity",
"app.confirmItemArrival.navigation": "Confirm item arrival",
Expand All @@ -24,5 +23,7 @@
"filters.mediatedRequestStatus.openItemArrived": "Open - Item arrived",
"filters.mediatedRequestLevel.accordionTitle": "Mediated request level",
"filters.mediatedRequestLevel.item": "Item",
"filters.mediatedRequestLevel.title": "Title"
"filters.mediatedRequestLevel.title": "Title",
"permission.view-decline": "Mediated requests: View, decline",
"permission.view-edit-decline": "Mediated requests: View, edit, decline"
}
7 changes: 4 additions & 3 deletions translations/ui-requests-mediated/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"settings.general": "General",
"settings.general.message": "These are your general app settings.",
"permission.view": "Mediated requests: View",
"permission.view-create": "Mediated requests: View, create",
"permission.view-create-edit": "Mediated requests: View, edit, cancel",
"permission.view-create-edit": "Mediated requests: View, create, edit",
"permission.all": "Mediated requests: All permissions",
"app.filterPane.selectActivity": "Select activity",
"app.confirmItemArrival.navigation": "Confirm item arrival",
Expand All @@ -24,5 +23,7 @@
"filters.mediatedRequestStatus.openItemArrived": "Open - Item arrived",
"filters.mediatedRequestLevel.accordionTitle": "Mediated request level",
"filters.mediatedRequestLevel.item": "Item",
"filters.mediatedRequestLevel.title": "Title"
"filters.mediatedRequestLevel.title": "Title",
"permission.view-decline": "Mediated requests: View, decline",
"permission.view-edit-decline": "Mediated requests: View, edit, decline"
}
17 changes: 9 additions & 8 deletions translations/ui-requests-mediated/cs_CZ.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"settings.general": "Obecné",
"settings.general.message": "Toto jsou obecná nastavení aplikace.",
"permission.view": "Zprostředkované žádanky: Zobrazit",
"permission.view-create": "Zprostředkované žádanky: Zobrazit, vytvořit",
"permission.view-create-edit": "Zprostředkované žádanky: Zobrazit, upravit, zrušit",
"permission.view-create-edit": "Zprostředkované žádanky: Zobrazit, vytvořit, upravit",
"permission.all": "Zprostředkované žádanky: Všechna oprávnění",
"app.filterPane.selectActivity": "Zvolte aktivitu",
"app.confirmItemArrival.navigation": "Potvrdit příchod jednotky",
Expand All @@ -14,15 +13,17 @@
"app.confirmItemArrival.paneTitle": "Potvrdit příchod jednotky",
"app.mediatedRequestsActivities.paneTitle": "Zprostředkované žádanky",
"app.sendItemInTransit.paneTitle": "Odeslat jednotku v přepravě",
"filters.mediatedRequestStatus.accordionTitle": "Mediated request status",
"filters.mediatedRequestStatus.closedDeclined": "Closed - Declined",
"filters.mediatedRequestStatus.accordionTitle": "Stav zprostředkované žádanky",
"filters.mediatedRequestStatus.closedDeclined": "Uzavřeno - odmítnuto",
"filters.mediatedRequestStatus.closedFilled": "Uzavřená - Vyřízená",
"filters.mediatedRequestStatus.newAwaitingConfirmation": "New - Awaiting confirmation",
"filters.mediatedRequestStatus.openAwaitingPickup": "Open - Awaiting pickup",
"filters.mediatedRequestStatus.openInProgress": "Open - In progress",
"filters.mediatedRequestStatus.openInTransit": "Open - In transits",
"filters.mediatedRequestStatus.openAwaitingPickup": "Otevřená - Čeká na vyzvednutí",
"filters.mediatedRequestStatus.openInProgress": "Otevřená – probíhá",
"filters.mediatedRequestStatus.openInTransit": "Otevřená - V přepravách",
"filters.mediatedRequestStatus.openItemArrived": "Open - Item arrived",
"filters.mediatedRequestLevel.accordionTitle": "Mediated request level",
"filters.mediatedRequestLevel.item": "Jednotka",
"filters.mediatedRequestLevel.title": "Název"
"filters.mediatedRequestLevel.title": "Název",
"permission.view-decline": "Zprostředkované žádanky: Zobrazit, odmítnout",
"permission.view-edit-decline": "Zprostředkované žádanky: Zobrazit, upravit, odmítnout"
}
7 changes: 4 additions & 3 deletions translations/ui-requests-mediated/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"settings.general": "General",
"settings.general.message": "These are your general app settings.",
"permission.view": "Mediated requests: View",
"permission.view-create": "Mediated requests: View, create",
"permission.view-create-edit": "Mediated requests: View, edit, cancel",
"permission.view-create-edit": "Mediated requests: View, create, edit",
"permission.all": "Mediated requests: All permissions",
"app.filterPane.selectActivity": "Select activity",
"app.confirmItemArrival.navigation": "Confirm item arrival",
Expand All @@ -24,5 +23,7 @@
"filters.mediatedRequestStatus.openItemArrived": "Open - Item arrived",
"filters.mediatedRequestLevel.accordionTitle": "Mediated request level",
"filters.mediatedRequestLevel.item": "Item",
"filters.mediatedRequestLevel.title": "Title"
"filters.mediatedRequestLevel.title": "Title",
"permission.view-decline": "Mediated requests: View, decline",
"permission.view-edit-decline": "Mediated requests: View, edit, decline"
}
7 changes: 4 additions & 3 deletions translations/ui-requests-mediated/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"settings.general": "General",
"settings.general.message": "These are your general app settings.",
"permission.view": "Mediated requests: View",
"permission.view-create": "Mediated requests: View, create",
"permission.view-create-edit": "Mediated requests: View, edit, cancel",
"permission.view-create-edit": "Mediated requests: View, create, edit",
"permission.all": "Mediated requests: All permissions",
"app.filterPane.selectActivity": "Select activity",
"app.confirmItemArrival.navigation": "Confirm item arrival",
Expand All @@ -24,5 +23,7 @@
"filters.mediatedRequestStatus.openItemArrived": "Open - Item arrived",
"filters.mediatedRequestLevel.accordionTitle": "Mediated request level",
"filters.mediatedRequestLevel.item": "Item",
"filters.mediatedRequestLevel.title": "Title"
"filters.mediatedRequestLevel.title": "Title",
"permission.view-decline": "Mediated requests: View, decline",
"permission.view-edit-decline": "Mediated requests: View, edit, decline"
}
7 changes: 4 additions & 3 deletions translations/ui-requests-mediated/en_GB.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"settings.general": "General",
"settings.general.message": "These are your general app settings.",
"permission.view": "Mediated requests: View",
"permission.view-create": "Mediated requests: View, create",
"permission.view-create-edit": "Mediated requests: View, edit, cancel",
"permission.view-create-edit": "Mediated requests: View, create, edit",
"permission.all": "Mediated requests: All permissions",
"app.filterPane.selectActivity": "Select activity",
"app.confirmItemArrival.navigation": "Confirm item arrival",
Expand All @@ -24,5 +23,7 @@
"filters.mediatedRequestStatus.openItemArrived": "Open - Item arrived",
"filters.mediatedRequestLevel.accordionTitle": "Mediated request level",
"filters.mediatedRequestLevel.item": "Item",
"filters.mediatedRequestLevel.title": "Title"
"filters.mediatedRequestLevel.title": "Title",
"permission.view-decline": "Mediated requests: View, decline",
"permission.view-edit-decline": "Mediated requests: View, edit, decline"
}
7 changes: 4 additions & 3 deletions translations/ui-requests-mediated/en_SE.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"settings.general": "General",
"settings.general.message": "These are your general app settings.",
"permission.view": "Mediated requests: View",
"permission.view-create": "Mediated requests: View, create",
"permission.view-create-edit": "Mediated requests: View, edit, cancel",
"permission.view-create-edit": "Mediated requests: View, create, edit",
"permission.all": "Mediated requests: All permissions",
"app.filterPane.selectActivity": "Select activity",
"app.confirmItemArrival.navigation": "Confirm item arrival",
Expand All @@ -24,5 +23,7 @@
"filters.mediatedRequestStatus.openItemArrived": "Open - Item arrived",
"filters.mediatedRequestLevel.accordionTitle": "Mediated request level",
"filters.mediatedRequestLevel.item": "Item",
"filters.mediatedRequestLevel.title": "Title"
"filters.mediatedRequestLevel.title": "Title",
"permission.view-decline": "Mediated requests: View, decline",
"permission.view-edit-decline": "Mediated requests: View, edit, decline"
}
7 changes: 4 additions & 3 deletions translations/ui-requests-mediated/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"settings.general": "General",
"settings.general.message": "These are your general app settings.",
"permission.view": "Mediated requests: View",
"permission.view-create": "Mediated requests: View, create",
"permission.view-create-edit": "Mediated requests: View, edit, cancel",
"permission.view-create-edit": "Mediated requests: View, create, edit",
"permission.all": "Mediated requests: All permissions",
"app.filterPane.selectActivity": "Select activity",
"app.confirmItemArrival.navigation": "Confirm item arrival",
Expand All @@ -24,5 +23,7 @@
"filters.mediatedRequestStatus.openItemArrived": "Open - Item arrived",
"filters.mediatedRequestLevel.accordionTitle": "Mediated request level",
"filters.mediatedRequestLevel.item": "Item",
"filters.mediatedRequestLevel.title": "Title"
"filters.mediatedRequestLevel.title": "Title",
"permission.view-decline": "Mediated requests: View, decline",
"permission.view-edit-decline": "Mediated requests: View, edit, decline"
}
7 changes: 4 additions & 3 deletions translations/ui-requests-mediated/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"settings.general": "General",
"settings.general.message": "These are your general app settings.",
"permission.view": "Mediated requests: View",
"permission.view-create": "Mediated requests: View, create",
"permission.view-create-edit": "Mediated requests: View, edit, cancel",
"permission.view-create-edit": "Mediated requests: View, create, edit",
"permission.all": "Mediated requests: All permissions",
"app.filterPane.selectActivity": "Select activity",
"app.confirmItemArrival.navigation": "Confirm item arrival",
Expand All @@ -24,5 +23,7 @@
"filters.mediatedRequestStatus.openItemArrived": "Open - Item arrived",
"filters.mediatedRequestLevel.accordionTitle": "Mediated request level",
"filters.mediatedRequestLevel.item": "Item",
"filters.mediatedRequestLevel.title": "Title"
"filters.mediatedRequestLevel.title": "Title",
"permission.view-decline": "Mediated requests: View, decline",
"permission.view-edit-decline": "Mediated requests: View, edit, decline"
}
7 changes: 4 additions & 3 deletions translations/ui-requests-mediated/es_419.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"settings.general": "General",
"settings.general.message": "These are your general app settings.",
"permission.view": "Mediated requests: View",
"permission.view-create": "Mediated requests: View, create",
"permission.view-create-edit": "Mediated requests: View, edit, cancel",
"permission.view-create-edit": "Mediated requests: View, create, edit",
"permission.all": "Mediated requests: All permissions",
"app.filterPane.selectActivity": "Select activity",
"app.confirmItemArrival.navigation": "Confirm item arrival",
Expand All @@ -24,5 +23,7 @@
"filters.mediatedRequestStatus.openItemArrived": "Open - Item arrived",
"filters.mediatedRequestLevel.accordionTitle": "Mediated request level",
"filters.mediatedRequestLevel.item": "Item",
"filters.mediatedRequestLevel.title": "Title"
"filters.mediatedRequestLevel.title": "Title",
"permission.view-decline": "Mediated requests: View, decline",
"permission.view-edit-decline": "Mediated requests: View, edit, decline"
}
7 changes: 4 additions & 3 deletions translations/ui-requests-mediated/es_ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"settings.general": "General",
"settings.general.message": "These are your general app settings.",
"permission.view": "Mediated requests: View",
"permission.view-create": "Mediated requests: View, create",
"permission.view-create-edit": "Mediated requests: View, edit, cancel",
"permission.view-create-edit": "Mediated requests: View, create, edit",
"permission.all": "Mediated requests: All permissions",
"app.filterPane.selectActivity": "Select activity",
"app.confirmItemArrival.navigation": "Confirm item arrival",
Expand All @@ -24,5 +23,7 @@
"filters.mediatedRequestStatus.openItemArrived": "Open - Item arrived",
"filters.mediatedRequestLevel.accordionTitle": "Mediated request level",
"filters.mediatedRequestLevel.item": "Item",
"filters.mediatedRequestLevel.title": "Title"
"filters.mediatedRequestLevel.title": "Title",
"permission.view-decline": "Mediated requests: View, decline",
"permission.view-edit-decline": "Mediated requests: View, edit, decline"
}
7 changes: 4 additions & 3 deletions translations/ui-requests-mediated/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"settings.general": "General",
"settings.general.message": "These are your general app settings.",
"permission.view": "Mediated requests: View",
"permission.view-create": "Mediated requests: View, create",
"permission.view-create-edit": "Mediated requests: View, edit, cancel",
"permission.view-create-edit": "Mediated requests: View, create, edit",
"permission.all": "Mediated requests: All permissions",
"app.filterPane.selectActivity": "Select activity",
"app.confirmItemArrival.navigation": "Confirm item arrival",
Expand All @@ -24,5 +23,7 @@
"filters.mediatedRequestStatus.openItemArrived": "Open - Item arrived",
"filters.mediatedRequestLevel.accordionTitle": "Mediated request level",
"filters.mediatedRequestLevel.item": "Item",
"filters.mediatedRequestLevel.title": "Title"
"filters.mediatedRequestLevel.title": "Title",
"permission.view-decline": "Mediated requests: View, decline",
"permission.view-edit-decline": "Mediated requests: View, edit, decline"
}
Loading

0 comments on commit 2e7dbb9

Please sign in to comment.