Skip to content

feat: support editing Drupal MySQL connection details#1089

Open
yashin4112 wants to merge 4 commits into
devfrom
bugfix/delta
Open

feat: support editing Drupal MySQL connection details#1089
yashin4112 wants to merge 4 commits into
devfrom
bugfix/delta

Conversation

@yashin4112

Copy link
Copy Markdown
Contributor

🔗 Jira Ticket

. CMG-993
· CMG-994
· CMG-995
· CMG-996


📋 PR Type

  • ✨ Feature
  • 🐛 Bug Fix

📝 Description

What changed?

Feature — Drupal MySQL connection editing

  • LoadUploadFile: made Host/Database/User editable for SQL format, mirroring the local-path edit flow
  • upload.service / fileValidation: forward mysql details as mysql_host/mysql_database/mysql_user headers for drupal validation
  • upload-api: persist UI-entered mysql details into config.mysql; keep localPath as the "sql" sentinel instead of resolving it to a filesystem path

Bug Fix — content mapper & migration CTA

  • ContentMapper: update the content type status icon on entry selection (Updated/green vs Mapped/blue); hide the Save footer when there are no fields/entries; fix the empty-state ("No Records Found") layout to fill the viewport
  • MigrationFlowHeader: disable the CTA only while migration is actively in progress, re-enabling as "Restart Migration" once completed

Why?

Drupal sources connect via MySQL rather than a file, but the connection details were read-only, so users couldn't correct them across iterations. The content mapper status icons and Save footer didn't reflect actual entry/field state, and the migration CTA stayed disabled even after completion.


🧩 Affected Areas

  • api — Node.js backend
  • ui — React frontend
  • upload-api — Upload API server
  • docker / docker-compose
  • CI / GitHub Actions workflows
  • Environment variables / config
  • Other:

🧪 How to Test

  1. Start a Drupal migration; on the upload step, edit the Host/Database/User fields and run validation — confirm the values persist and reach config.mysql.
  2. On the Content Mapper step, select/deselect entries for a content type and save — confirm the status icon turns green (Updated) when selected, blue (Mapped) when cleared.
  3. Open a content type with no fields and an entry view with no records — confirm the Save footer is hidden and the empty state fills the viewport.
  4. Start a migration — confirm the header CTA is disabled while running and re-enables as "Restart Migration" once complete.

Expected result: Drupal MySQL details are editable and persisted; content mapper icons/footer reflect real state; CTA only disables during active migration.


📸 Screenshots / Recordings

Before After

🔗 Related PRs / Dependencies


✅ Author Checklist

  • Branch follows naming convention: feature/, bugfix/, or hotfix/ + 5–30 lowercase chars
  • Jira ticket linked above
  • Self-reviewed the diff — no debug logs, commented-out code, or TODOs left in
  • .env / example.env updated if new environment variables were added
  • No sensitive credentials or secrets committed
  • Existing tests pass locally (npm test)
  • [] New tests written (or not applicable — explain why)
  • [] README.md / docs updated if behaviour changed
  • Talisman pre-push scan passes (no secrets flagged)

👀 Reviewer Notes

  • Focus on upload-api/src/helper/index.tsupdateConfigFile now branches on drupal to persist config.mysql and to keep localPath as "sql". Confirm non-drupal flows are unaffected.
  • The package.json override swapped the top-level diff constraint for a nested @wordpress/block-editor override pinning diff@4.0.2 — please confirm that's intended.

Migration v2 · Docs
· Issues

- LoadUploadFile: make Host/Database/User editable for SQL format; forward to validation
- upload.service: send mysql details as headers for drupal validation
- upload-api: persist UI-entered mysql details into config.mysql; keep localPath as "sql"

fix: correct content mapper status icons and migration CTA state

- ContentMapper: update status icon on entry selection; hide Save footer when empty; fix empty-state layout
- MigrationFlowHeader: disable CTA only while migration is in progress, re-enable as Restart once complete
@yashin4112 yashin4112 requested a review from a team as a code owner June 9, 2026 15:52
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 15 334 25 ✅ Passed
🟡 Medium Severity 21 3 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

⚠️ Warning: The following vulnerabilities have exceeded their SLA thresholds (days since publication).

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 1 2 90 / 365 days ❌ Failed / ⚠️ Warning
🔵 Low 0 0 180 / 365 days ✅ Passed

🟡 Medium Severity - SLA Breached Issues (with fixes)

Showing 1 issue(s) that have exceeded the 90-day SLA threshold:

  1. Regular Expression Denial of Service (ReDoS)
    • ID: SNYK-JS-DIFF-14917201
    • Package: diff@4.0.2
    • Published: 138 days ago (SLA: 90 days)
    • CVSS Score: 6.3
    • CVE: CVE-2026-24001

ℹ️ Vulnerabilities Without Available Fixes (Informational Only)

The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:

  • Critical without fixes: 0
  • High without fixes: 334
  • Medium without fixes: 3
  • Low without fixes: 0

❌ BUILD FAILED - Security checks failed

Please review and fix the security vulnerabilities before merging.

1 similar comment
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 15 334 25 ✅ Passed
🟡 Medium Severity 21 3 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

⚠️ Warning: The following vulnerabilities have exceeded their SLA thresholds (days since publication).

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 1 2 90 / 365 days ❌ Failed / ⚠️ Warning
🔵 Low 0 0 180 / 365 days ✅ Passed

🟡 Medium Severity - SLA Breached Issues (with fixes)

Showing 1 issue(s) that have exceeded the 90-day SLA threshold:

  1. Regular Expression Denial of Service (ReDoS)
    • ID: SNYK-JS-DIFF-14917201
    • Package: diff@4.0.2
    • Published: 138 days ago (SLA: 90 days)
    • CVSS Score: 6.3
    • CVE: CVE-2026-24001

ℹ️ Vulnerabilities Without Available Fixes (Informational Only)

The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:

  • Critical without fixes: 0
  • High without fixes: 334
  • Medium without fixes: 3
  • Low without fixes: 0

❌ BUILD FAILED - Security checks failed

Please review and fix the security vulnerabilities before merging.

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 14 336 25 ✅ Passed
🟡 Medium Severity 16 3 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

⚠️ Warning: The following vulnerabilities have exceeded their SLA thresholds (days since publication).

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 1 2 90 / 365 days ❌ Failed / ⚠️ Warning
🔵 Low 0 0 180 / 365 days ✅ Passed

🟡 Medium Severity - SLA Breached Issues (with fixes)

Showing 1 issue(s) that have exceeded the 90-day SLA threshold:

  1. Regular Expression Denial of Service (ReDoS)
    • ID: SNYK-JS-DIFF-14917201
    • Package: diff@4.0.2
    • Published: 138 days ago (SLA: 90 days)
    • CVSS Score: 6.3
    • CVE: CVE-2026-24001

ℹ️ Vulnerabilities Without Available Fixes (Informational Only)

The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:

  • Critical without fixes: 0
  • High without fixes: 336
  • Medium without fixes: 3
  • Low without fixes: 0

❌ BUILD FAILED - Security checks failed

Please review and fix the security vulnerabilities before merging.

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 14 336 25 ✅ Passed
🟡 Medium Severity 15 3 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

⚠️ Warning: The following vulnerabilities have exceeded their SLA thresholds (days since publication).

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 2 90 / 365 days ⚠️ Warning
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ Vulnerabilities Without Available Fixes (Informational Only)

The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:

  • Critical without fixes: 0
  • High without fixes: 336
  • Medium without fixes: 3
  • Low without fixes: 0

⚠️ BUILD PASSED WITH WARNINGS - SLA breaches detected for issues without available fixes

Consider reviewing these vulnerabilities when fixes become available.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds end-to-end support for editing Drupal MySQL connection details from the UI during “Check Connection” validation, and includes UI fixes to better reflect Content Mapper selection state and migration CTA availability.

Changes:

  • Forward UI-entered Drupal MySQL connection fields to upload-api and persist them into config.mysql while keeping "sql" as the SQL-mode sentinel.
  • Update Content Mapper UI to reflect entry selection status via content type icons and hide Save footers when there’s nothing to save; improve empty-state layout.
  • Fix Migration header CTA disabling logic to disable only while a migration is actively running.

Reviewed changes

Copilot reviewed 12 out of 15 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
upload-api/src/routes/index.ts Reads MySQL connection fields from request headers and passes them into config update during validation.
upload-api/src/helper/index.ts Extends updateConfigFile to persist Drupal MySQL edits and preserve the "sql" sentinel behavior.
upload-api/package.json Adjusts npm overrides related to diff (scoped to @wordpress/block-editor).
upload-api/migration-drupal/libs/createInitialMapper.js Adds extractEntries dependency import for Drupal mapper generation.
ui/src/services/api/upload.service.ts Sends optional MySQL fields as headers during validation requests.
ui/src/services/api/service.interface.ts Extends FileValidationParams with optional mysql details.
ui/src/components/MigrationFlowHeader/index.tsx Updates CTA disabled logic to only block while migration is in progress.
ui/src/components/LegacyCms/legacyCms.scss Adds layout styling for grouped SQL edit inputs.
ui/src/components/LegacyCms/Actions/LoadUploadFile.tsx Adds UI editing flow for SQL MySQL fields and forwards values into validation.
ui/src/components/ContentMapper/index.tsx Updates content type status icon based on entry selection and conditionally hides the footer when empty.
ui/src/components/ContentMapper/index.scss Ensures empty state fills available viewport space.
ui/src/components/ContentMapper/entryMapper.tsx Emits entry-selection changes upward and hides footer when there are no entries.
ui/package-lock.json Lockfile updates from dependency resolution changes.
api/package-lock.json Lockfile updates from dependency resolution changes.
Files not reviewed (2)
  • api/package-lock.json: Language not supported
  • ui/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +248 to +249
const resolvedFilePath =
isDrupal || trimmed.toLowerCase() === 'sql' ? 'sql' : path.resolve(trimmed);
Comment on lines +262 to +266
// No filePath, but drupal mysql details changed — persist them and return updated config.
if (isDrupal && mysqlDetails && typeof mysqlDetails === 'object') {
const configContent = JSON.stringify(config, null, 2);
await fs.promises.writeFile(configFilePath, configContent, 'utf8');
}
Comment on lines +151 to +175
<TextInput
value={sqlDetails.host}
onChange={(e: React.ChangeEvent<HTMLInputElement>) => setSqlDetails((prev) => ({ ...prev, host: e.target.value }))}
width="full"
version="v2"
placeholder="Enter host"
aria-label="host"
autoFocus
/>
<TextInput
value={sqlDetails.database}
onChange={(e: React.ChangeEvent<HTMLInputElement>) => setSqlDetails((prev) => ({ ...prev, database: e.target.value }))}
width="full"
version="v2"
placeholder="Enter database"
aria-label="database"
/>
<TextInput
value={sqlDetails.user}
onChange={(e: React.ChangeEvent<HTMLInputElement>) => setSqlDetails((prev) => ({ ...prev, user: e.target.value }))}
width="full"
version="v2"
placeholder="Enter user"
aria-label="user"
/>
Comment thread upload-api/package.json
Comment on lines +92 to +94
"@wordpress/block-editor": {
"diff": "4.0.4"
},
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.

2 participants