teableio / teable

✨ The Next Gen Airtable Alternative: No-Code Postgres
https://teable.io
Other
11.38k stars 519 forks source link

[Feature Request] Duplicate Views #586

Open solankimihir opened 5 months ago

solankimihir commented 5 months ago

Is your feature request related to a problem? Please describe. No. Feature request is not related to a problem.

Describe the solution you'd like I would like to create duplicate of existing views. I have monthly tasks that I create for my team. For creating 1 view, I have to apply multiple nested filters. I am creating 1 view for each of my team member. The only difference in filter criteria for each of this view is that I change the "Mapped To" user from "Team Member 1" to "Team Member 2".

It would be great if I can duplicate the view created for Team Member 1 and in the duplicated view just change the filter of "Mapped To" from "Team member 1" to "Team member 2".

Describe alternatives you've considered None. Currently I need to define all filter-criteria from scratch for each team-member view.

Additional context None.

tea-artist commented 4 months ago

We'll make it happen when the time is right

Virajjai commented 1 month ago

Hi @solankimihir @tea-artist , I would like to contribute to it so could you please explain me little bit more and help me out from where to start.

solankimihir commented 1 month ago

Basically, if I have a view created in teable with multiple filters, groupings etc. then I want to be able to duplicate the view into a new one.

Example: Current view with filters and groupings configured: image

I want an option to create a new view with same filter and groupings (so that I can modify it further) image

Virajjai commented 1 month ago

Ohhh, got it and thanks for elaborating ,@solankimihir could you please tell me the stating point in code base from where i can start.

Virajjai commented 1 month ago

Hi there, I'm new open source contributor so please could help me out and guide me for this I'm trying to figure out from where to start and firstly what to do .

tea-artist commented 1 month ago

Hi @Virajjai Thank you for your contribution to our open-source project. Here's a response addressing the development of the view duplication feature:

To implement the view duplication functionality, you can utilize the existing 'create view' API. This API supports specifying any view attributes during the creation process. For detailed parameter definitions, please refer to the file located at packages/openapi/src/view/create.ts.

To access all view properties, you can use the useView hook from our SDK. When duplicating a view, it's important to focus on copying only the attributes that control the view's display, such as columnMeta, filter, sort, and group. Please note that these attributes may vary slightly for different view types, particularly due to columnMeta. For precise details, you'll need to consult the source code.

For API e2e testing:

  1. First, run pnpm test-e2e in the backend directory to initialize the testing environment.
  2. Once successful, add the duplication test logic to the apps/nestjs-backend/test/view.e2e-spec.ts file.
  3. Execute the test using the command: pnpm test-e2e apps/nestjs-backend/test/view.e2e-spec.ts.

Regarding the frontend UI: The duplicate button should only be displayed when the user has view|create permissions. During the creation process, ensure that the necessary checks and validations are in place.

If you need any further clarification or assistance, please don't hesitate to ask. We appreciate your efforts in contributing to our project!

Virajjai commented 1 month ago

Thank you @tea-artist for the detailed explanation! I'll start implementing the duplication feature using the create view API and focus on the key attributes for display. I'll also make sure to handle the frontend UI and permission checks as suggested. If I encounter any issues or need further clarification, I'll reach out. Thanks again for the support!