10000 Add unsaved changes confirmation dialog for Add/Edit field modal by codegen-sh[bot] · Pull Request #11608 · nocodb/nocodb · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add unsaved changes confirmation dialog for Add/Edit field modal #11608

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

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
codegen-sh[bot]
Copy link
Contributor
@codegen-sh codegen-sh bot commented Jun 7, 2025

This PR adds a confirmation dialog when users try to navigate out of the Add/Edit field modal by clicking outside after making changes.

Changes:

  1. Created a new confirmation dialog component: UnsavedChangesConfirm.vue
  2. Added state tracking for unsaved changes in the EditOrAdd component
  3. Implemented a handleCancel function that checks for unsaved changes before closing
  4. Modified the EditOrAddProvider to expose the handleCancel method
  5. Updated the InfiniteTable component to use the handleCancel method when clicking outside the modal

Behavior:

  • When a user makes changes to a field in the Add/Edit modal and tries to close it by clicking outside:
    • If there are unsaved changes, a confirmation dialog appears asking "You have unsaved changes. Would you like to save them before closing?"
    • If the user selects "Yes, Save Changes", the changes are saved and the modal closes
    • If the user selects "No, Cancel", the changes are discarded and the modal closes
    • If there are no changes, the modal closes immediately without a confirmation

This improves the user experience by preventing accidental data loss when users click outside the modal.


💻 View my workAbout Codegen

@dstala
Copy link
Member
dstala commented Jun 7, 2025

@codegen-sh the following errors are noticed

ERROR in ./src/helpers/attachmentHelpers.ts:23:29
TS2339: Property 'getType' does not exist on type 'Mime'.
21 |
22 | if (extWithoutQuery) {

23 | const mimeType = mime.getType(extWithoutQuery);
| ^^^^^^^
24 | return previewableMimeTypes.some((type) => mimeType?.includes(type));
25 | }
26 | }

ERROR in ./src/modules/jobs/migration-jobs/nc_job_001_attachment.ts:343:32
TS2339: Property 'getType' does not exist on type 'Mime'.
341 | const mimetype =
342 | attachment.mimetype ||

343 | mime.getType(path.extname(fileNameWithExt).slice(1));
| ^^^^^^^
344 |
345 | await ncMeta
346 | .knexConnection(temp_file_references_table)

ERROR in ./src/modules/jobs/migration-jobs/nc_job_002_thumbnail.ts:73:33
TS2339: Property 'getType' does not exist on type 'Mime'.
71 | const fileNameWithExt = path.basename(file);
72 |

73 | const mimetype = mime.getType(path.extname(fileNameWithExt).slice(1));
| ^^^^^^^
74 |
75 | fileReferenceBuffer.push({
76 | file_path: file,

ERROR in ./src/services/attachments.service.ts:326:29
TS2339: Property 'getType' does not exist on type 'Mime'.
324 |
325 | if (!mimeType) {

326 | mimeType = mime.getType(path.extname(fileNameWithExt).slice(1));
| ^^^^^^^
327 | }
328 |
329 | let attachmentUrl, file;

ERROR in ./src/services/attachments.service.ts:453:12
TS2339: Property 'getType' does not exist on type 'Mime'.
451 | }> {
452 | const type =

453 | mime.getType(path.extname(param.path).split('/').pop().slice(1)) ||
| ^^^^^^^
454 | 'text/plain';
455 |
456 | const filePath = validateAndNormaliseLocalPath(param.path, true);

Found 5 errors in 7781 ms.

Thanks for sharing the errors! I'll investigate the 'getType' issue and suggest a fix. 🛠️

💻 View my work

Copy link
Contributor Author
codegen-sh bot commented Jun 7, 2025

🛠️ View PR #11609 codegen-bot/fix-mime-type-errors on Github 🛠️

I've fixed the TypeScript errors by adding a type declaration file for the mime package that properly defines the getType and getExtension methods.

This resolves all 5 TypeScript errors without requiring a package update, which could potentially introduce compatibility issues with other dependencies.

💻 View my work • React 👍 or 👎

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
0