Skip to content

Commit

Permalink
UIU-3202 Change import of exportToCsv from stripes-util to `strip…
Browse files Browse the repository at this point in the history
…es-components` (#2842)
  • Loading branch information
BogdanDenis authored Jan 15, 2025
1 parent e87d54b commit 30aa052
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* Add HTML page title to add/edit patron block page. Refs UIU-3302.
* Update fee/fine actions column UX for accessibility. Refs UIU-3027.
* Rename permission after BE changes. Refs UIU-3309.
* Change import of `exportToCsv` from `stripes-util` to `stripes-components`. Refs UIU-3202.

## [11.0.10](https://github.com/folio-org/ui-users/tree/v11.0.10) (2025-01-10)
[Full Changelog](https://github.com/folio-org/ui-users/compare/v11.0.9...v11.0.10)
Expand Down
2 changes: 1 addition & 1 deletion src/components/Loans/ClosedLoans/ClosedLoans.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class ClosedLoans extends React.Component {
'item.copyNumber', 'item.contributors', 'item.holdingsRecordId', 'item.instanceId', 'item.status.name', 'item.title', 'item.materialType.name',
'item.location.name', 'metaData.createdByUserId', 'metadata.updatedDate', 'metadata.updatedByUserId', 'loanPolicyId'];

// Map to pass into exportCsv
// Map to pass into exportToCsv
this.columnHeadersMap = this.headers.map(item => {
return {
label: this.props.intl.formatMessage({ id: `ui-users.${item}` }),
Expand Down
6 changes: 4 additions & 2 deletions src/components/data/reports/CsvReport.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { forOwn, get } from 'lodash';
import { exportCsv } from '@folio/stripes/util';

import { exportToCsv } from '@folio/stripes/components';

import settings from './settings';
import { reportColumns } from '../../../constants';
import { formatDateAndTime } from '../../util';
Expand Down Expand Up @@ -103,7 +105,7 @@ class CsvReport {
toCSV(records) {
const onlyFields = this.columnsMap;
const parsedRecords = this.parse(records);
exportCsv(parsedRecords, { onlyFields });
exportToCsv(parsedRecords, { onlyFields });
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/components/data/reports/FeeFineReport.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
map,
} from 'lodash';

import { exportCsv } from '@folio/stripes/util';
import { exportToCsv } from '@folio/stripes/components';

import { feeFineReportColumns } from '../../../constants';
import {
Expand Down Expand Up @@ -161,7 +161,7 @@ class FeeFineReport {
const onlyFields = this.columnsMap;
const parsedData = this.parse();

exportCsv(parsedData, {
exportToCsv(parsedData, {
onlyFields,
filename: 'export-fees-fines-spreadsheet'
});
Expand Down
4 changes: 2 additions & 2 deletions src/components/data/reports/FinancialTransactionsReport.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import moment from 'moment';
import { isEmpty } from 'lodash';

import { exportCsv } from '@folio/stripes/util';
import { exportToCsv } from '@folio/stripes/components';

import { financialTransactionsMainReportColumns } from '../../../constants';
import {
Expand Down Expand Up @@ -199,7 +199,7 @@ class FinancialTransactionsReport {
toCSV() {
const parsedData = this.parse();

exportCsv(parsedData, {
exportToCsv(parsedData, {
onlyFields: this.columnsMap,
filename: this.buildDocumentName(),
});
Expand Down
5 changes: 3 additions & 2 deletions src/components/data/reports/RefundReport.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { exportCsv } from '@folio/stripes/util';
import { exportToCsv } from '@folio/stripes/components';

import { refundReportColumns } from '../../../constants';

class RefundsReport {
Expand Down Expand Up @@ -26,7 +27,7 @@ class RefundsReport {
toCSV() {
const parsedData = this.parse();

exportCsv(parsedData, {
exportToCsv(parsedData, {
onlyFields: this.columnsMap,
filename: 'refunds-to-process-manually'
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { isEmpty } from 'lodash';

import { exportCsv } from '@folio/stripes/util';
import { exportToCsv } from '@folio/stripes/components';

import { cashMainReportColumnsCSV } from '../../../constants';
import {
Expand Down Expand Up @@ -120,7 +120,7 @@ class CashDrawerReconciliationReportCSV extends CashDrawerReconciliationReport {
toCSV() {
const parsedData = this.parse();

exportCsv(parsedData, {
exportToCsv(parsedData, {
onlyFields: this.columnsMap,
filename: this.buildDocumentName(),
});
Expand Down
1 change: 1 addition & 0 deletions test/jest/__mock__/stripesComponents.mock.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,4 +263,5 @@ jest.mock('@folio/stripes/components', () => ({
</div>
);
}),
exportToCsv: jest.fn(),
}));
1 change: 0 additions & 1 deletion test/jest/__mock__/stripesUtils.mock.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';

jest.mock('@folio/stripes/util', () => ({
exportCsv: jest.fn(),
getSourceSuppressor: jest.fn(() => () => false),
getHeaderWithCredentials: jest.fn(() => ({
headers: {}
Expand Down

0 comments on commit 30aa052

Please sign in to comment.