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

Removed Table and StatusAlert deprecation of Paragon #899

Closed

Conversation

abdullahwaheed
Copy link
Contributor

Ticket

Migrate off deprecated Paragon components

What has changed

Removed deprecated Table component of paragon and updated it with DataTable
Removed deprecated StatusAlert component of paragon and updated it with Alert

References

Paragon Table
Paragon DataTable

Paragon Alert
Paragon StatusAlert

Based on #798

@codecov
Copy link

codecov bot commented Nov 18, 2022

Codecov Report

Patch coverage: 94.44% and project coverage change: +0.19 🎉

Comparison is base (0c8671b) 83.13% compared to head (2ae51e2) 83.33%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #899      +/-   ##
==========================================
+ Coverage   83.13%   83.33%   +0.19%     
==========================================
  Files         399      398       -1     
  Lines        8653     8628      -25     
  Branches     1790     1780      -10     
==========================================
- Hits         7194     7190       -4     
+ Misses       1421     1400      -21     
  Partials       38       38              
Impacted Files Coverage Δ
src/components/Admin/index.jsx 97.16% <ø> (ø)
...ponents/BulkEnrollmentPage/CourseSearchResults.jsx 95.83% <ø> (ø)
src/components/CompletedLearnersTable/index.jsx 100.00% <ø> (ø)
src/components/CouponDetails/constants.js 100.00% <ø> (ø)
.../EnrolledLearnersForInactiveCoursesTable/index.jsx 100.00% <ø> (ø)
src/components/EnrolledLearnersTable/index.jsx 100.00% <ø> (ø)
src/components/EnterpriseList/index.jsx 80.70% <ø> (ø)
src/components/LearnerActivityTable/index.jsx 100.00% <ø> (ø)
...c/components/PastWeekPassedLearnersTable/index.jsx 100.00% <ø> (ø)
...components/PlotlyAnalytics/PlotlyAnalyticsPage.jsx 30.76% <0.00%> (ø)
... and 7 more

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@arbrandes
Copy link

@abdullahwaheed, looks like this needs a rebase.

@adamstankiewicz, you might want to take a look here as well.

@arbrandes
Copy link

@adamstankiewicz, another enterprisey one we need eyes on.

@arbrandes arbrandes requested a review from a team January 31, 2023 15:10
src/components/Admin/index.jsx Show resolved Hide resolved
src/components/Admin/index.jsx Show resolved Hide resolved
variant="danger"
icon={Error}
>
{`${ERROR_MESSAGE} ${error.message}`}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Render the alert message within a <p>, e.g.:

<p>Try refreshing your screen ({this.props.error.message})</p>

src/index.scss Show resolved Hide resolved
});
sortTable(ordering);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, our tables throughout the app would no longer need to dispatch Redux actions to do pagination/sorting/filtering, etc. but instead use what DataTable offers you via fetchData directly.

);

const renderLoadingMessage = () => (
<TableLoadingSkeleton />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'd ideally rely on DataTable's isLoading prop rather than defining our own loading state for the table at this point.

className="table-sm table-striped"
columns={columns}
data={formatData(data)}
isSortable={tableSortable}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that some tables support row selection (e.g., code management), I'm not seeing anything regarding the isSelectable prop here, which implies the selection logic is custom outside of DataTable; ideally, we'd rely on DataTable's selection logic rather than defining our own.

import { updateUrl } from '../../utils';

class TableComponent extends React.Component {
Copy link
Member

@adamstankiewicz adamstankiewicz Feb 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Long term, I'm not entirely sure the benefit of keeping TableComponent/TableContainer now that DataTable exists and am considering whether this refactor should move away from these components in favor of implementing DataTable directly where needed.

That way, we don't need to refactor/maintain a complex, single table that supports every single possible table use case throughout the application vs. just implementing the bits and pieces of DataTable as needed for each individual use case instead.

Comment on lines +112 to +113
{!loading && !error && data && data.length === 0
&& renderEmptyDataMessage()}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we instead rely on DataTable.EmptyTable for the empty state messaging?

@@ -241,7 +241,7 @@ class CouponDetails extends React.Component {

getNewColumns(selectedToggle) {
const selectColumn = {
label: (
Header: (
<CheckBox
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checkbox is deprecated in favor of Form.Checkbox

Comment on lines +35 to +39
useEffect(() => {
// Get initial data
paginateTable();
return clearTable;
}, []);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DataTable calls fetchData on initial component mount to fetch any initial data. We shouldn't need a useEffect to trigger fetching initial data here.

return clearTable;
}, []);

const handlePageChange = (page) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned else, pagination changes for DataTable should also come through the fetchData callback function rather than our existing custom implementation.

@arbrandes
Copy link

@abdullahwaheed, I think there are still un-addressed comments in this one, right?

@jmbowman jmbowman added waiting on author PR author needs to resolve review requests, answer questions, fix tests, etc. and removed engineering review labels Jun 26, 2023
… into abdullahwaheed/remove-paragon-table-deprecation
@abdullahwaheed
Copy link
Contributor Author

this PR is outdated and there are a lot of merge conflicts. closing this one and create a new PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting on author PR author needs to resolve review requests, answer questions, fix tests, etc.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants