teable icon indicating copy to clipboard operation
teable copied to clipboard

duplicate rows

Open AliceLanniste opened this issue 1 year ago • 10 comments

related #587

AliceLanniste avatar Aug 06 '24 09:08 AliceLanniste

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
8 out of 10 committers have signed the CLA.

:white_check_mark: tea-artist
:white_check_mark: AliceLanniste
:white_check_mark: caoxing9
:white_check_mark: boris-w
:white_check_mark: Sky-FE
:white_check_mark: spiritanand
:white_check_mark: tkymmm
:white_check_mark: simon-moulin
:x: solankimihir
:x: cosark
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar Aug 16 '24 06:08 CLAassistant

For API e2e testing:

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

tea-artist avatar Aug 20 '24 04:08 tea-artist

Pull Request Test Coverage Report for Build 10474103032

Warning: 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

  • 6 of 24 (25.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+65.2%) to 82.979%

Changes Missing Coverage Covered Lines Changed/Added Lines %
apps/nestjs-backend/src/features/selection/selection.controller.ts 3 10 30.0%
apps/nestjs-backend/src/features/selection/selection.service.ts 3 14 21.43%
<!-- Total: 6 24
Totals Coverage Status
Change from base Build 10242225492: 65.2%
Covered Lines: 30557
Relevant Lines: 36825

💛 - Coveralls

coveralls avatar Aug 21 '24 01:08 coveralls

Hi @AliceLanniste , I think you might be heading in the wrong direction. The API for copying a row shouldn’t be designed the same way as the selection-related API. Copying a row is an action for a single row, and only the recordId of the current row is needed, and copy line api tag should belong to record.

boris-w avatar Aug 21 '24 08:08 boris-w

For API e2e testing:

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

hi, I run pnpm test-e2e to setup test envrionment. I get error:

> @teable/[email protected] prisma-db-seed /root/program/teable/packages/db-main-prisma
> dotenv-flow -p ../../apps/nextjs-app -- pnpm prisma db seed "--" "--e2e"

Running seed command `tsx ./prisma/seed.ts --e2e` ...
node:internal/modules/cjs/loader:415
      const err = new Error(
                  ^

Error: Cannot find module '/root/program/teable/packages/db-main-prisma/dist/index.js'. Please verify that the package.json has a valid "main" entry
    at tryPackage (node:internal/modules/cjs/loader:415:19)
    at Module._findPath (node:internal/modules/cjs/loader:665:18)
    at Module._resolveFilename (node:internal/modules/cjs/loader:1034:27)
    at a._resolveFilename (/root/program/teable/node_modules/.pnpm/[email protected]/node_modules/tsx/dist/cjs/index.cjs:1:1729)
    at Module._load (node:internal/modules/cjs/loader:901:27)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at require (node:internal/modules/helpers:130:18)
    at parse (/root/program/teable/packages/db-main-prisma/prisma/seed.ts:6:30)
    at Object.<anonymous> (/root/program/teable/packages/db-main-prisma/prisma/seed.ts:68:4)
    at Module._compile (node:internal/modules/cjs/loader:1241:14) {
  code: 'MODULE_NOT_FOUND',
  path: '/root/program/teable/packages/db-main-prisma/package.json',
  requestPath: '../'
}

AliceLanniste avatar Aug 27 '24 09:08 AliceLanniste

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

hi, I run pnpm test-e2e to setup test envrionment. I get error:

> @teable/[email protected] prisma-db-seed /root/program/teable/packages/db-main-prisma
> dotenv-flow -p ../../apps/nextjs-app -- pnpm prisma db seed "--" "--e2e"

Running seed command `tsx ./prisma/seed.ts --e2e` ...
node:internal/modules/cjs/loader:415
      const err = new Error(
                  ^

Error: Cannot find module '/root/program/teable/packages/db-main-prisma/dist/index.js'. Please verify that the package.json has a valid "main" entry
    at tryPackage (node:internal/modules/cjs/loader:415:19)
    at Module._findPath (node:internal/modules/cjs/loader:665:18)
    at Module._resolveFilename (node:internal/modules/cjs/loader:1034:27)
    at a._resolveFilename (/root/program/teable/node_modules/.pnpm/[email protected]/node_modules/tsx/dist/cjs/index.cjs:1:1729)
    at Module._load (node:internal/modules/cjs/loader:901:27)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at require (node:internal/modules/helpers:130:18)
    at parse (/root/program/teable/packages/db-main-prisma/prisma/seed.ts:6:30)
    at Object.<anonymous> (/root/program/teable/packages/db-main-prisma/prisma/seed.ts:68:4)
    at Module._compile (node:internal/modules/cjs/loader:1241:14) {
  code: 'MODULE_NOT_FOUND',
  path: '/root/program/teable/packages/db-main-prisma/package.json',
  requestPath: '../'
}

run pnpm build in packages/db-main-prisma can solve this problem

tea-artist avatar Aug 27 '24 10:08 tea-artist

@boris-w has a good suggestion. Since we only allowed duplicates one record at a time, you should put the api under the record controller and use the recordId as a param.

tea-artist avatar Aug 28 '24 08:08 tea-artist

Ok,I GET IT

AliceLanniste avatar Aug 28 '24 10:08 AliceLanniste

It would be great to put the button in the edit form dropdown menu so that the user can perform a duplicate on any view.

image

And Kanban view context menu image

tea-artist avatar Aug 28 '24 11:08 tea-artist

It would be great to put the button in the edit form dropdown menu so that the user can perform a duplicate on any view.

image And Kanban view context menu image

completed it

AliceLanniste avatar Sep 01 '24 06:09 AliceLanniste

Hi @AliceLanniste,

Thank you for your work on the duplicate_row branch. To streamline your PR, we need to recreate your branch, including only the changes relevant to the duplicate row functionality. Here's a step-by-step guide:

  1. Ensure you have the latest develop branch:

    git fetch origin
    git checkout -b duplicate_row_new origin/develop
    
  2. Identify all your commits:

    git log origin/develop..duplicate_row --oneline
    

    This will display all commits on your duplicate_row branch that aren't in the develop branch.

  3. Apply all your commits using cherry-pick:

    git cherry-pick <oldest-commit-hash>..<newest-commit-hash>
    

    Alternatively, if you want to select specific commits:

    git cherry-pick <commit-hash1> <commit-hash2> <commit-hash3>
    

    If you encounter conflicts, resolve them and then use:

    git add <conflicted-file>
    git cherry-pick --continue
    
  4. Verify that all changes are included:

    git diff duplicate_row duplicate_row_new
    

    If any changes are missing, add them manually.

  5. Squash all changes into a single commit:

    git reset --soft origin/develop
    git commit -m "feat: implement duplicate row functionality"
    
  6. Push the new branch to your remote repository:

    git push -f origin duplicate_row_new
    
  7. On GitHub, close the original PR and create a new one based on this duplicate_row_new branch.

tea-artist avatar Sep 18 '24 08:09 tea-artist