Skip to content

Commit

Permalink
Merge pull request #421 from openedx/knguyen2/ent-9458
Browse files Browse the repository at this point in the history
feat: update expand all text on enterprise customer datatable
  • Loading branch information
katrinan029 authored Sep 16, 2024
2 parents 8dba940 + b6d96e5 commit df46942
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion src/Configuration/Customers/CustomerDataTable/CustomersPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import React, {
useCallback,
useEffect,
} from 'react';
import PropTypes from 'prop-types';
import debounce from 'lodash.debounce';
import {
Container, DataTable, TextFilter,
Expand All @@ -20,6 +21,12 @@ import {
import LmsApiService from '../../../data/services/EnterpriseApiService';
import CustomerDetailRowSubComponent from './CustomerDetailSubComponent';

const expandAllRowsHandler = ({ getToggleAllRowsExpandedProps }) => (
<button type="button" className="btn btn-link btn-inline font-weight-bold" {...getToggleAllRowsExpandedProps()}>
View subsidies
</button>
);

const CustomersPage = () => {
const [enterpriseList, setEnterpriseList] = useState([]);
const [isLoading, setIsLoading] = useState(true);
Expand Down Expand Up @@ -67,7 +74,7 @@ const CustomersPage = () => {
columns={[
{
id: 'expander',
Header: DataTable.ExpandAll,
Header: expandAllRowsHandler,
Cell: DataTable.ExpandRow,
},
{
Expand Down Expand Up @@ -104,4 +111,8 @@ const CustomersPage = () => {
);
};

expandAllRowsHandler.propTypes = {
getToggleAllRowsExpandedProps: PropTypes.func.isRequired,
};

export default CustomersPage;
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('CustomersPage', () => {
expect(screen.getByText('SSO Check')).toBeInTheDocument();
expect(screen.getByText('API Check')).toBeInTheDocument();
});

expect(screen.getByText('View subsidies')).toBeInTheDocument();
expect(screen.getByText('Customers')).toBeInTheDocument();
expect(screen.getByText('Customer details')).toBeInTheDocument();
expect(screen.getByText('SSO')).toBeInTheDocument();
Expand Down

0 comments on commit df46942

Please sign in to comment.