feat: add pin resource type, view and table - #1505
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds new pin resource types (Table and View) along with associated frontend components, API schema updates, and backend service enhancements to support listing, pinning, and unpinning these new resource types.
- Updated the PinType enum and OpenAPI schemas to include Table and View.
- Added UI components (PinViewItem, StarButton, etc.) to handle pin interactions for Table and View.
- Enhanced backend logic in the PinService and added e2e tests to ensure proper pin list retrieval and order updates.
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/openapi/src/pin/types.ts | Added new enum values for Table and View. |
| packages/openapi/src/pin/get-list.ts | Updated the schema to include additional properties (name, icon, parentBaseId, viewMeta). |
| apps/nextjs-app/src/features/app/blocks/view/list/ViewListItem.tsx | Added pin status display and incorporated a PinViewItem component for views. |
| apps/nextjs-app/src/features/app/blocks/view/list/PinViewItem.tsx | New component to toggle view pin state with loading states and query invalidation. |
| apps/nextjs-app/src/features/app/blocks/table-list/TableOperation.tsx | Integrated StarButton for table pins. |
| apps/nextjs-app/src/features/app/blocks/space/space-side-bar/PinList.tsx | Removed unused maps to streamline pin list rendering. |
| apps/nextjs-app/src/features/app/blocks/space/space-side-bar/PinItem.tsx | Adjusted rendering logic for new pin types (Table and View) and refactored navigation links. |
| apps/nestjs-backend/test/pin.e2e-spec.ts | Introduced comprehensive tests covering all pin types and order updates. |
| apps/nestjs-backend/src/features/pin/pin.service.ts | Extended resource lookup logic to aggregate metadata for Table and View pins and added event listeners for resource deletion. |
Comments suppressed due to low confidence (1)
apps/nextjs-app/src/features/app/blocks/space/space-side-bar/PinItem.tsx:115
- [nitpick] Consider handling unknown pin types more gracefully rather than rendering the text 'unknown'. Returning null or a dedicated fallback component might improve the user experience.
default:
return <div>unknown</div>;
| parentBaseId: view.baseId, | ||
| viewMeta: { | ||
| type: view.type, | ||
| pluginLogo: view.options ? JSON.parse(view.options)?.pluginLogo : undefined, |
There was a problem hiding this comment.
Parsing JSON from view.options without a try-catch may lead to runtime errors if the options string is not valid JSON. Consider wrapping the JSON.parse call in a try-catch block to safely handle malformed input.
| pluginLogo: view.options ? JSON.parse(view.options)?.pluginLogo : undefined, | |
| pluginLogo: (() => { | |
| if (!view.options) return undefined; | |
| try { | |
| return JSON.parse(view.options)?.pluginLogo; | |
| } catch (error) { | |
| return undefined; | |
| } | |
| })(), |
|
Deployment Status: ✅ Success |
|
Deployment Status: ✅ Success |
Pull Request Test Coverage Report for Build 14923417214Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
|
Deployment Status: ✅ Success |
🧹 Preview Environment Cleanup
|
…2816) Synced from teableio/teable-ee@f7689c3 Co-authored-by: nichenqin <nichenqin@hotmail.com>
No description provided.