Skip to content

enhance: migrate admin Vendors table to Plugin UI DataViews#3195

Open
MdAsifHossainNadim wants to merge 2 commits into
enhance/update-admin-dashboard-list-tables-using-plugin-uifrom
enhance/update-admin-dashboard-vendors-list-tables
Open

enhance: migrate admin Vendors table to Plugin UI DataViews#3195
MdAsifHossainNadim wants to merge 2 commits into
enhance/update-admin-dashboard-list-tables-using-plugin-uifrom
enhance/update-admin-dashboard-vendors-list-tables

Conversation

@MdAsifHossainNadim

Copy link
Copy Markdown
Contributor

All Submissions:

  • My code follow the WordPress' coding standards
  • My code satisfies feature requirements
  • My code is tested
  • My code passes the PHPCS tests
  • My code has proper inline documentation
  • I've included related pull request(s) (optional)
  • I've included developer documentation (optional)
  • I've added proper labels to this pull request

Changes proposed in this Pull Request:

Migrates the admin Vendors list table (dokan/src/admin/dashboard/pages/vendors.tsx) from the legacy AdminDataViews wrapper to the unified DataViews component re-exported from @dokan/components.

  • Drops the AdminDataViews as DataViews alias in favour of the direct DataViews import.
  • Moves status into view.status; deletes the activeTab mirror effect.
  • Tabs reshape: { tabs: [{ name, title, icon }] }{ items: [{ value, label, count }] } (counts move into the clean count field).
  • Wraps every row + bulk action label with the shared getActionLabel helper (6 actions: Edit, Approve, Disable, Delete, View Store, Switch To Vendor) so icons keep rendering in the dropdown menu and the desktop bulk-action toolbar.
  • Confirms bulk Approve / Disable / Delete still flow through the existing inline modals via actions[].supportsBulk: true.
  • Filter prop unchanged.
  • Preserves all 4 applyFilters callsites the page emits — Pro hooks into them, so timing must not change.
  • Wraps <DataViews> in <div className="dokan-admin-dashboard-datatable"> so existing SCSS keeps applying.

Wrapper-component swap, not a redesign — tabs, filter, search, pagination, all 6 row + bulk actions with icons, inline approve/disable modals, Pro hooks all preserved.

Related Pull Request(s)

Closes

How to test the changes in this Pull Request:

  1. Build assets: npm run build.
  2. WP Admin → Dokan → Vendors.
  3. Switch tabs (All / Approved / Pending) — URL syncs, counts refresh.
  4. Filter by Store Category / search — filter chips render, Reset clears.
  5. Open the row action menu — Edit, Approve / Disable, Delete, View Store, Switch To Vendor all show their icons + labels.
  6. Bulk-select vendors and run Approve / Disable / Delete — inline confirmation modals appear and the action completes.
  7. Resize to mobile width — table collapses to list view.
  8. Confirm Pro features hooked via applyFilters (e.g. extra columns / actions) still render.
  9. Confirm tabs + filter + table all share a single white card.

Changelog entry

Migrate admin Vendors table to Plugin UI DataViews

Replaces the legacy AdminDataViews wrapper on the admin Vendors page with the unified DataViews component already used by the vendor dashboard. Tab counts move into the clean count field, status lives in view.status, and all 6 row + bulk actions keep their icons via the shared getActionLabel helper. Inline approve/disable modals and the 4 Pro-extension applyFilters callsites are preserved unchanged.

Before Changes

Vendors used the in-house AdminDataViews wrapper. Tab counts were rendered inside an icon JSX hack. Action icons were buried inside the label callback.

After Changes

Vendors uses DataViews from @wedevs/plugin-ui. Counts use the clean count field. Row + bulk action icons render via getActionLabel inside the label callback so @wordpress/dataviews keeps showing them in the dropdown menu and bulk-action toolbar.

Feature Video (optional)

n/a

PR Self Review Checklist:

  • Follows WPCS / project conventions.
  • Naming consistent with existing patterns.
  • KISS: diff concentrated in tabs reshape + action label wrapping.
  • DRY: shared getActionLabel from parent branch.

FOR PR REVIEWER ONLY:

  • Correct — tabs, filter, search, pagination, Approve/Disable/Delete modals (single + bulk), Pro hooks all still work.
  • Secure — no new escaping concerns; reuses existing vendor REST endpoints.
  • Readable — diff is well-scoped to tabs, actions, and the wrapper class.
  • Elegant — relies on shared infrastructure from the parent PR; no duplication.

MdAsifHossainNadim and others added 2 commits May 8, 2026 11:59
Switch vendors.tsx from the legacy AdminDataViews wrapper to the unified
DataViews component already exported from @dokan/components.

- Reshape tabs prop: tabs.tabs (icon JSX with count baked in) → tabs.items
  with {value,label,count}; preserves All / Approved / Pending tabs
- Move action icons (Pencil/Box/ShoppingBag/ArrowLeftRight/Check/Ban) from
  the getActionLabel JSX-label helper and the duplicate icon-callback hack
  into the dedicated icon prop on each action; replace the wildcard
  LucideIcons import with explicit named imports
- Move external SearchInput from additionalComponents to tabs.headerContent
  with a stable key and drop the redundant search={true} prop (the page's
  own debounced search state stays the source of truth)
- Tab selection clears current selection (parity with the wrapper)
- Drop isDestructive on disable-selling — the action already opens a
  custom confirmation modal, and the new wrapper would double-confirm
- Wrap migrated DataViews in <div className="dokan-admin-dashboard-datatable">
  so existing scoped admin table styles continue to apply
- Preserve the four critical applyFilters hooks PRO depends on
  (dokan_admin_vendors_list_filters, dokan_admin_vendors_before_request,
  dokan-admin-vendors-list-column-fields, dokan-admin-vendors-list-view),
  the two slot fills around the Add Vendor button, and the page-level
  PluginArea
- Drop the now-unused DokanLink import

Refs getdokan/plugin-internal-tasks#1849

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented May 12, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fe2e0548-6faf-4cd7-b4c7-7d22ce80be30

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch enhance/update-admin-dashboard-vendors-list-tables

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant