Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UIMARCAUTH-422: Update required permissions for quick export of authority records #423

Merged
merged 1 commit into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- [UIMARCAUTH-429](https://folio-org.atlassian.net/browse/UIMARCAUTH-429) *BREAKING* Upgrade `source-record-storage` to `3.3`
- [UIMARCAUTH-426](https://folio-org.atlassian.net/browse/UIMARCAUTH-426) migrate to shared CI workflows.
- [UIMARCAUTH-430](https://folio-org.atlassian.net/browse/UIMARCAUTH-430) Refactor ui-inventory permissions.
- [UIMARCAUTH-422](https://folio-org.atlassian.net/browse/UIMARCAUTH-422) Update required permissions for quick export of authority records.

## [5.0.1](https://github.com/folio-org/ui-marc-authorities/tree/v5.0.1) (2024-04-02)

Expand Down
34 changes: 19 additions & 15 deletions src/views/AuthoritiesSearch/AuthoritiesSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@
const [reportsModalOpen, setReportsModalOpen] = useState(false);
const selectedReport = useRef(null);

const canRunExport = stripes.hasPerm('ui-data-export.edit');

const uniqueAuthoritiesCount = useMemo(() => {
// determine count of unique ids in authorities array.
// this is needed to check or uncheck "Select all" checkbox in header when all rows are explicitly
Expand Down Expand Up @@ -228,7 +230,7 @@
[searchResultListColumns.HEADING_TYPE]: <FormattedMessage id="stripes-authority-components.search-results-list.headingType" />,
[searchResultListColumns.AUTHORITY_SOURCE]: intl.formatMessage({ id: 'stripes-authority-components.search-results-list.authoritySource' }),
[searchResultListColumns.NUMBER_OF_TITLES]: <FormattedMessage id="ui-marc-authorities.search-results-list.numberOfTitles" />,
}), [selectAll, selectAllLabel, toggleSelectAll]);

Check warning on line 233 in src/views/AuthoritiesSearch/AuthoritiesSearch.js

View workflow job for this annotation

GitHub Actions / ui / Install and lint / Install and lint

React Hook useMemo has a missing dependency: 'intl'. Either include it or remove the dependency array

const {
visibleColumns,
Expand Down Expand Up @@ -436,7 +438,7 @@
const redirectToAuthorityRecord = useCallback(authority => {
setSelectedAuthorityRecord(null);
history.push(formatAuthorityRecordLink(authority));
}, [history, formatAuthorityRecordLink]);

Check warning on line 441 in src/views/AuthoritiesSearch/AuthoritiesSearch.js

View workflow job for this annotation

GitHub Actions / ui / Install and lint / Install and lint

React Hook useCallback has a missing dependency: 'setSelectedAuthorityRecord'. Either include it or remove the dependency array

const urlAuthorityId = location.pathname.split('/')[3];

Expand Down Expand Up @@ -469,21 +471,23 @@
data-testid="menu-section-actions"
label={intl.formatMessage({ id: 'ui-marc-authorities.actions' })}
>
<Button
buttonStyle="dropdownItem"
id="dropdown-clickable-export-marc"
disabled={!selectedRowsCount}
onClick={() => {
exportRecords(selectedRowsIds);
onToggle();
}}
>
<Icon
icon="download"
size="medium"
/>
<FormattedMessage id="ui-marc-authorities.export-selected-records" />
</Button>
{canRunExport && (
<Button
buttonStyle="dropdownItem"
id="dropdown-clickable-export-marc"
disabled={!selectedRowsCount}
onClick={() => {
exportRecords(selectedRowsIds);
onToggle();
}}
>
<Icon
icon="download"
size="medium"
/>
<FormattedMessage id="ui-marc-authorities.export-selected-records" />
</Button>
)}
<IfPermission perm="ui-marc-authorities.authority-record.create">
<Button
buttonStyle="dropdownItem"
Expand Down Expand Up @@ -522,7 +526,7 @@
/>
</>
);
}, [

Check warning on line 529 in src/views/AuthoritiesSearch/AuthoritiesSearch.js

View workflow job for this annotation

GitHub Actions / ui / Install and lint / Install and lint

React Hook useCallback has a missing dependency: 'canRunExport'. Either include it or remove the dependency array
columnMapping,
exportRecords,
intl,
Expand Down
32 changes: 18 additions & 14 deletions src/views/AuthorityView/AuthorityView.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ const AuthorityView = ({
? hasCentralTenantPerm(centralTenantPermissions, editRecordPerm)
: stripes.hasPerm(editRecordPerm);

const canRunExport = stripes.hasPerm('ui-data-export.edit');

const onClose = useCallback(
() => {
setSelectedAuthorityRecordContext(null);
Expand Down Expand Up @@ -273,21 +275,23 @@ const AuthorityView = ({
</Icon>
</Button>
)}
<Button
buttonStyle="dropdownItem"
id="dropdown-clickable-export-marc"
onClick={() => {
exportRecords([authority.data.id]);
onToggle();
}}
>
<Icon
icon="download"
size="medium"
{canRunExport && (
<Button
buttonStyle="dropdownItem"
id="dropdown-clickable-export-marc"
onClick={() => {
exportRecords([authority.data.id]);
onToggle();
}}
>
<FormattedMessage id="ui-marc-authorities.authority-record.export" />
</Icon>
</Button>
<Icon
icon="download"
size="medium"
>
<FormattedMessage id="ui-marc-authorities.authority-record.export" />
</Icon>
</Button>
)}
<IfPermission perm="ui-marc-authorities.authority-record.view">
<Button
buttonStyle="dropdownItem"
Expand Down
Loading