From dad575ede34afe1d248c6e21c33eda9e9590c3b5 Mon Sep 17 00:00:00 2001 From: Taher Lakdawala <78196491+taherkl@users.noreply.github.com> Date: Mon, 2 Dec 2024 13:22:58 +0530 Subject: [PATCH] Feat/fe check contraints (#10) * Add the UI changes for supporting check constraints --------- Co-authored-by: Vivek Yadav Co-authored-by: taherkl --- ui/package-lock.json | 45 +++++++++++++++++++ ui/package.json | 1 + .../object-detail.component.spec.ts | 1 - .../object-detail/object-detail.component.ts | 7 --- ui/src/app/services/fetch/fetch.service.ts | 1 - 5 files changed, 46 insertions(+), 9 deletions(-) diff --git a/ui/package-lock.json b/ui/package-lock.json index e59acbb3b..4352cd035 100644 --- a/ui/package-lock.json +++ b/ui/package-lock.json @@ -22,6 +22,7 @@ "babel-loader": "^9.1.3", "jszip": "^3.10.1", "loader-utils": "^3.2.1", + "node-sql-parser": "^5.3.5", "rxjs": "~7.8.1", "terser": "^5.22.0", "tslib": "^2.6.2", @@ -4765,6 +4766,11 @@ "@types/node": "*" } }, + "node_modules/@types/pegjs": { + "version": "0.10.6", + "resolved": "https://registry.npmjs.org/@types/pegjs/-/pegjs-0.10.6.tgz", + "integrity": "sha512-eLYXDbZWXh2uxf+w8sXS8d6KSoXTswfps6fvCUuVAGN8eRpfe7h9eSRydxiSJvo9Bf+GzifsDOr9TMQlmJdmkw==" + }, "node_modules/@types/qs": { "version": "6.9.11", "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.11.tgz", @@ -5508,6 +5514,14 @@ "tweetnacl": "^0.14.3" } }, + "node_modules/big-integer": { + "version": "1.6.52", + "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.52.tgz", + "integrity": "sha512-QxD8cf2eVqJOOz63z6JIN9BzvVs/dlySa5HGSBH5xtR8dPteIRQnBxxKqkNTiT6jbDTF6jAfrd4oMcND9RGbQg==", + "engines": { + "node": ">=0.6" + } + }, "node_modules/big.js": { "version": "5.2.2", "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", @@ -10656,6 +10670,18 @@ "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz", "integrity": "sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==" }, + "node_modules/node-sql-parser": { + "version": "5.3.5", + "resolved": "https://registry.npmjs.org/node-sql-parser/-/node-sql-parser-5.3.5.tgz", + "integrity": "sha512-DOR2PAe3gY5/fXmSvpTOpyv8+HkQ5jA9KShAEy7fVLaV8kVbeg8aa7qo0MdfqCDskwqjcakp0lS/Rnmg+iY/XQ==", + "dependencies": { + "@types/pegjs": "^0.10.0", + "big-integer": "^1.6.48" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/nopt": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/nopt/-/nopt-6.0.0.tgz", @@ -18440,6 +18466,11 @@ "@types/node": "*" } }, + "@types/pegjs": { + "version": "0.10.6", + "resolved": "https://registry.npmjs.org/@types/pegjs/-/pegjs-0.10.6.tgz", + "integrity": "sha512-eLYXDbZWXh2uxf+w8sXS8d6KSoXTswfps6fvCUuVAGN8eRpfe7h9eSRydxiSJvo9Bf+GzifsDOr9TMQlmJdmkw==" + }, "@types/qs": { "version": "6.9.11", "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.11.tgz", @@ -19026,6 +19057,11 @@ "tweetnacl": "^0.14.3" } }, + "big-integer": { + "version": "1.6.52", + "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.52.tgz", + "integrity": "sha512-QxD8cf2eVqJOOz63z6JIN9BzvVs/dlySa5HGSBH5xtR8dPteIRQnBxxKqkNTiT6jbDTF6jAfrd4oMcND9RGbQg==" + }, "big.js": { "version": "5.2.2", "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", @@ -22897,6 +22933,15 @@ "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz", "integrity": "sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==" }, + "node-sql-parser": { + "version": "5.3.5", + "resolved": "https://registry.npmjs.org/node-sql-parser/-/node-sql-parser-5.3.5.tgz", + "integrity": "sha512-DOR2PAe3gY5/fXmSvpTOpyv8+HkQ5jA9KShAEy7fVLaV8kVbeg8aa7qo0MdfqCDskwqjcakp0lS/Rnmg+iY/XQ==", + "requires": { + "@types/pegjs": "^0.10.0", + "big-integer": "^1.6.48" + } + }, "nopt": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/nopt/-/nopt-6.0.0.tgz", diff --git a/ui/package.json b/ui/package.json index f78d1033b..694a6f48b 100644 --- a/ui/package.json +++ b/ui/package.json @@ -24,6 +24,7 @@ "babel-loader": "^9.1.3", "jszip": "^3.10.1", "loader-utils": "^3.2.1", + "node-sql-parser": "^5.3.5", "rxjs": "~7.8.1", "terser": "^5.22.0", "tslib": "^2.6.2", diff --git a/ui/src/app/components/object-detail/object-detail.component.spec.ts b/ui/src/app/components/object-detail/object-detail.component.spec.ts index 278313fcd..8b53451d8 100644 --- a/ui/src/app/components/object-detail/object-detail.component.spec.ts +++ b/ui/src/app/components/object-detail/object-detail.component.spec.ts @@ -377,5 +377,4 @@ describe('ObjectDetailComponent', () => { }) - }); diff --git a/ui/src/app/components/object-detail/object-detail.component.ts b/ui/src/app/components/object-detail/object-detail.component.ts index cec83baa3..91cf12675 100644 --- a/ui/src/app/components/object-detail/object-detail.component.ts +++ b/ui/src/app/components/object-detail/object-detail.component.ts @@ -592,20 +592,17 @@ export class ObjectDetailComponent implements OnInit { } else if (this.checkIfCcColumn(colId)) { let message = `Column ${spColName} is a part of`; const dependencies = []; - if (this.checkIfPkColumn(colId)) { dependencies.push(' Primary key'); } if (associatedIndexes.length !== 0) { dependencies.push(` Index ${associatedIndexes}`); } - // Join dependencies with appropriate punctuation if (dependencies.length > 0) { message += `${dependencies.join(' ,')} and`; } message += ' check constraints. Remove the dependencies from respective tabs before dropping the Column.'; - this.dialog.open(InfodialogComponent, { data: { message, @@ -874,7 +871,6 @@ export class ObjectDetailComponent implements OnInit { this.ccArray = this.fb.array([]); const srcArr: ICcTabData[] = []; const spArr: ICcTabData[] = []; - // Populate srcArr and spArr this.ccData.forEach((cc, index) => { const baseObject : ICcTabData = { @@ -893,7 +889,6 @@ export class ObjectDetailComponent implements OnInit { spArr.push(baseObject); } }); - const createFormGroup = (data : ICcTabData) => new FormGroup({ srcSno: new FormControl(data.srcSno || ''), srcConstraintName: new FormControl(data.srcConstraintName || ''), @@ -912,7 +907,6 @@ export class ObjectDetailComponent implements OnInit { for (let i = 0; i < Math.min(srcArr.length, spArr.length); i++) { this.ccArray.push(createFormGroup(srcArr[i])); } - for (let i = Math.min(srcArr.length, spArr.length); i < srcArr.length; i++) { this.ccArray.push(createFormGroup(srcArr[i])); } @@ -936,7 +930,6 @@ export class ObjectDetailComponent implements OnInit { if (this.isCcEditMode) { this.setCCRows(); } - this.isCcEditMode = !this.isCcEditMode; } diff --git a/ui/src/app/services/fetch/fetch.service.ts b/ui/src/app/services/fetch/fetch.service.ts index 85b6c9c79..e93f248d2 100644 --- a/ui/src/app/services/fetch/fetch.service.ts +++ b/ui/src/app/services/fetch/fetch.service.ts @@ -212,7 +212,6 @@ export class FetchService { } verifyCheckConstraintExpression() { - debugger return this.http.get(`${this.url}/verifyCheckConstraintExpression`) }