diff --git a/package-lock.json b/package-lock.json index 34450b74..cf0b49ff 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,6 +5,7 @@ "requires": true, "packages": { "": { + "name": "Polypheny-UI", "version": "1.0.0", "license": "MIT", "dependencies": { @@ -66,6 +67,7 @@ "@types/hammerjs": "^2.0.36", "@types/jasmine": "^3.5.10", "@types/jasminewd2": "^2.0.8", + "@types/jest": "^27.4.1", "@types/node": "^12.11.1", "codelyzer": "^5.1.2", "cypress": "^7.6.0", @@ -2906,6 +2908,16 @@ "@types/jasmine": "*" } }, + "node_modules/@types/jest": { + "version": "27.4.1", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-27.4.1.tgz", + "integrity": "sha512-23iPJADSmicDVrWk+HT58LMJtzLAnB2AgIzplQuq/bSrGaxCrlvRFjGbXmamnnk/mAmCdLStiGqggu28ocUyiw==", + "dev": true, + "dependencies": { + "jest-matcher-utils": "^27.0.0", + "pretty-format": "^27.0.0" + } + }, "node_modules/@types/json-schema": { "version": "7.0.6", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.6.tgz", @@ -6686,6 +6698,15 @@ "node": ">=0.3.1" } }, + "node_modules/diff-sequences": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-27.5.1.tgz", + "integrity": "sha512-k1gCAXAsNgLwEL+Y8Wvl+M6oEFj5bgazfZULpS5CneoPPXRaCCW7dm+q21Ky2VEE5X+VeRDBVg1Pcvvsr4TtNQ==", + "dev": true, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, "node_modules/diffie-hellman": { "version": "5.0.3", "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", @@ -9950,6 +9971,173 @@ "node": ">= 6.9.x" } }, + "node_modules/jest-diff": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-27.5.1.tgz", + "integrity": "sha512-m0NvkX55LDt9T4mctTEgnZk3fmEg3NRYutvMPWM/0iPnkFj2wIeF45O1718cMSOFO1vINkqmxqD8vE37uTEbqw==", + "dev": true, + "dependencies": { + "chalk": "^4.0.0", + "diff-sequences": "^27.5.1", + "jest-get-type": "^27.5.1", + "pretty-format": "^27.5.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/jest-diff/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jest-diff/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/jest-diff/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/jest-diff/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-diff/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-get-type": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-27.5.1.tgz", + "integrity": "sha512-2KY95ksYSaK7DMBWQn6dQz3kqAf3BB64y2udeG+hv4KfSOb9qwcYQstTJc1KCbsix+wLZWZYN8t7nwX3GOBLRw==", + "dev": true, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/jest-matcher-utils": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-27.5.1.tgz", + "integrity": "sha512-z2uTx/T6LBaCoNWNFWwChLBKYxTMcGBRjAt+2SbP929/Fflb9aa5LGma654Rz8z9HLxsrUaYzxE9T/EFIL/PAw==", + "dev": true, + "dependencies": { + "chalk": "^4.0.0", + "jest-diff": "^27.5.1", + "jest-get-type": "^27.5.1", + "pretty-format": "^27.5.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/jest-matcher-utils/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jest-matcher-utils/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/jest-matcher-utils/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/jest-matcher-utils/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-matcher-utils/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/jest-worker": { "version": "26.3.0", "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-26.3.0.tgz", @@ -13700,6 +13888,41 @@ "utila": "~0.4" } }, + "node_modules/pretty-format": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz", + "integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1", + "ansi-styles": "^5.0.0", + "react-is": "^17.0.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/pretty-format/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/pretty-format/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, "node_modules/process": { "version": "0.11.10", "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", @@ -14245,6 +14468,12 @@ "url": "https://opencollective.com/webpack" } }, + "node_modules/react-is": { + "version": "17.0.2", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", + "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", + "dev": true + }, "node_modules/read-cache": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", @@ -20997,6 +21226,16 @@ "@types/jasmine": "*" } }, + "@types/jest": { + "version": "27.4.1", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-27.4.1.tgz", + "integrity": "sha512-23iPJADSmicDVrWk+HT58LMJtzLAnB2AgIzplQuq/bSrGaxCrlvRFjGbXmamnnk/mAmCdLStiGqggu28ocUyiw==", + "dev": true, + "requires": { + "jest-matcher-utils": "^27.0.0", + "pretty-format": "^27.0.0" + } + }, "@types/json-schema": { "version": "7.0.6", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.6.tgz", @@ -24144,6 +24383,12 @@ "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", "dev": true }, + "diff-sequences": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-27.5.1.tgz", + "integrity": "sha512-k1gCAXAsNgLwEL+Y8Wvl+M6oEFj5bgazfZULpS5CneoPPXRaCCW7dm+q21Ky2VEE5X+VeRDBVg1Pcvvsr4TtNQ==", + "dev": true + }, "diffie-hellman": { "version": "5.0.3", "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", @@ -26841,6 +27086,126 @@ "integrity": "sha1-43zwsX8ZnM4jvqcbIDk5Uka07E4=", "dev": true }, + "jest-diff": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-27.5.1.tgz", + "integrity": "sha512-m0NvkX55LDt9T4mctTEgnZk3fmEg3NRYutvMPWM/0iPnkFj2wIeF45O1718cMSOFO1vINkqmxqD8vE37uTEbqw==", + "dev": true, + "requires": { + "chalk": "^4.0.0", + "diff-sequences": "^27.5.1", + "jest-get-type": "^27.5.1", + "pretty-format": "^27.5.1" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "jest-get-type": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-27.5.1.tgz", + "integrity": "sha512-2KY95ksYSaK7DMBWQn6dQz3kqAf3BB64y2udeG+hv4KfSOb9qwcYQstTJc1KCbsix+wLZWZYN8t7nwX3GOBLRw==", + "dev": true + }, + "jest-matcher-utils": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-27.5.1.tgz", + "integrity": "sha512-z2uTx/T6LBaCoNWNFWwChLBKYxTMcGBRjAt+2SbP929/Fflb9aa5LGma654Rz8z9HLxsrUaYzxE9T/EFIL/PAw==", + "dev": true, + "requires": { + "chalk": "^4.0.0", + "jest-diff": "^27.5.1", + "jest-get-type": "^27.5.1", + "pretty-format": "^27.5.1" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, "jest-worker": { "version": "26.3.0", "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-26.3.0.tgz", @@ -29959,6 +30324,31 @@ "utila": "~0.4" } }, + "pretty-format": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz", + "integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1", + "ansi-styles": "^5.0.0", + "react-is": "^17.0.1" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true + }, + "ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true + } + } + }, "process": { "version": "0.11.10", "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", @@ -30399,6 +30789,12 @@ } } }, + "react-is": { + "version": "17.0.2", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", + "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", + "dev": true + }, "read-cache": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", diff --git a/package.json b/package.json index 00008856..f1ab2188 100644 --- a/package.json +++ b/package.json @@ -70,6 +70,7 @@ "@types/hammerjs": "^2.0.36", "@types/jasmine": "^3.5.10", "@types/jasminewd2": "^2.0.8", + "@types/jest": "^27.4.1", "@types/node": "^12.11.1", "codelyzer": "^5.1.2", "cypress": "^7.6.0", diff --git a/src/app/components/data-view/data-view.component.ts b/src/app/components/data-view/data-view.component.ts index 8c101abe..109caca2 100644 --- a/src/app/components/data-view/data-view.component.ts +++ b/src/app/components/data-view/data-view.component.ts @@ -15,7 +15,7 @@ import {WebuiSettingsService} from '../../services/webui-settings.service'; import {WebSocket} from '../../services/webSocket'; import {HttpEventType} from '@angular/common/http'; import * as $ from 'jquery'; -import {DbTable} from '../../views/uml/uml.model'; +import {DbTable} from '../../views/uml/api/uml.model'; import {TableModel} from '../../views/schema-editing/edit-tables/edit-tables.component'; import {Store} from '../../views/adapters/adapter.model'; import {LeftSidebarService} from '../left-sidebar/left-sidebar.service'; diff --git a/src/app/pipes/pipes.ts b/src/app/pipes/pipes.ts index e3da7b3e..8509fce5 100644 --- a/src/app/pipes/pipes.ts +++ b/src/app/pipes/pipes.ts @@ -3,6 +3,9 @@ import {Pipe, PipeTransform} from '@angular/core'; @Pipe({ name: 'value' }) export class ValuePipe implements PipeTransform { transform(value: any): any { + if(!value){ + return value; + } return Object.values( value ); } } diff --git a/src/app/services/crud.service.ts b/src/app/services/crud.service.ts index 42f280ee..db88f8c3 100644 --- a/src/app/services/crud.service.ts +++ b/src/app/services/crud.service.ts @@ -4,7 +4,7 @@ import {WebuiSettingsService} from './webui-settings.service'; import {Index, ModifyPartitionRequest, PartitionFunctionModel, PartitioningRequest} from '../components/data-view/models/result-set.model'; import {webSocket} from 'rxjs/webSocket'; import {ColumnRequest, ConstraintRequest, DeleteRequest, EditCollectionRequest, EditTableRequest, ExploreTable, MaterializedRequest, MonitoringRequest, QueryRequest, RelAlgRequest, Schema, SchemaRequest, StatisticRequest, TableRequest} from '../models/ui-request.model'; -import {ForeignKey} from '../views/uml/uml.model'; +import {ForeignKey} from '../views/uml/api/uml.model'; import {Validators} from '@angular/forms'; import {HubService} from './hub.service'; import {Adapter} from '../views/adapters/adapter.model'; @@ -501,6 +501,9 @@ export class CrudService { }); } + /** + * @deprecated use utils/validation.ts instead + */ getNameValidator ( required: boolean = false ) { if ( required ){ return [Validators.pattern('^[a-zA-Z_][a-zA-Z0-9_]*$'), Validators.required, Validators.max(100)]; @@ -509,20 +512,32 @@ export class CrudService { } } + /** + * @deprecated use utils/validation.ts instead + */ invalidNameMessage ( type: string = '' ) { type = type + ' '; return `Please provide a valid ${type}name`; } + /** + * @deprecated use utils/validation.ts instead + */ getValidationRegex(){ return new RegExp( '^[a-zA-Z_][a-zA-Z0-9_]*$' ); } + /** + * @deprecated use utils/validation.ts instead + */ nameIsValid( name: string ) { const regex = this.getValidationRegex(); return regex.test( name ) && name.length <= 100; } + /** + * @deprecated use utils/validation.ts instead + */ getValidationClass( name: string ){ const regex = this.getValidationRegex(); if( name === '' ){ diff --git a/src/app/utils/validation.ts b/src/app/utils/validation.ts new file mode 100644 index 00000000..33f4d987 --- /dev/null +++ b/src/app/utils/validation.ts @@ -0,0 +1,43 @@ +import { Validators } from "@angular/forms"; + +const getNameValidator = (required: boolean = false) => { + if (required) { + return [Validators.pattern('^[a-zA-Z_][a-zA-Z0-9_]*$'), Validators.required, Validators.max(100)]; + } else { + return [Validators.pattern('^[a-zA-Z_][a-zA-Z0-9_]*$'), Validators.max(100)]; + } +} + +const invalidNameMessage = (type: string = '') => { + type = type + ' '; + return `Please provide a valid ${type}name`; +} + +const getValidationRegex = () => { + return new RegExp('^[a-zA-Z_][a-zA-Z0-9_]*$'); +} + +const nameIsValid = (name: string) => { + const regex = getValidationRegex(); + return regex.test(name) && name.length <= 100; +} + +const getValidationClass = (name: string) => { + const regex = getValidationRegex(); + if (name === '') { + return ''; + } + else if (regex.test(name) && name.length <= 100) { + return 'is-valid'; + } else { + return 'is-invalid'; + } +} + +export { + getNameValidator, + invalidNameMessage, + getValidationRegex, + nameIsValid, + getValidationClass, +}; diff --git a/src/app/views/querying/explore-by-example/explore-by-example.component.ts b/src/app/views/querying/explore-by-example/explore-by-example.component.ts index 5279e7ff..808f28a0 100644 --- a/src/app/views/querying/explore-by-example/explore-by-example.component.ts +++ b/src/app/views/querying/explore-by-example/explore-by-example.component.ts @@ -7,7 +7,7 @@ import {ResultSet} from '../../../components/data-view/models/result-set.model'; import {ToastService} from '../../../components/toast/toast.service'; import {DataTableComponent} from '../../../components/data-view/data-table/data-table.component'; import {SidebarNode} from '../../../models/sidebar-node.model'; -import {ForeignKey, Uml} from '../../uml/uml.model'; +import {ForeignKey, Uml} from '../../uml/api/uml.model'; import {BsModalRef, BsModalService} from 'ngx-bootstrap/modal'; import {Subscription} from 'rxjs'; import {TableConfig} from '../../../components/data-view/data-table/table-config'; diff --git a/src/app/views/querying/graphical-querying/graphical-querying.component.ts b/src/app/views/querying/graphical-querying/graphical-querying.component.ts index 6bf70b8a..75c29693 100644 --- a/src/app/views/querying/graphical-querying/graphical-querying.component.ts +++ b/src/app/views/querying/graphical-querying/graphical-querying.component.ts @@ -9,7 +9,7 @@ import {LeftSidebarService} from '../../../components/left-sidebar/left-sidebar. import {ToastService} from '../../../components/toast/toast.service'; import {EditTableRequest, QueryRequest, SchemaRequest} from '../../../models/ui-request.model'; import {SidebarNode} from '../../../models/sidebar-node.model'; -import {ForeignKey, Uml} from '../../uml/uml.model'; +import {ForeignKey, Uml} from '../../uml/api/uml.model'; import {Router} from '@angular/router'; import {Subscription} from 'rxjs'; import {WebuiSettingsService} from '../../../services/webui-settings.service'; diff --git a/src/app/views/querying/relational-algebra/relational-algebra.component.ts b/src/app/views/querying/relational-algebra/relational-algebra.component.ts index b471dc62..089443c1 100644 --- a/src/app/views/querying/relational-algebra/relational-algebra.component.ts +++ b/src/app/views/querying/relational-algebra/relational-algebra.component.ts @@ -7,7 +7,7 @@ import * as $ from 'jquery'; import 'jquery-ui/ui/widget'; import 'jquery-ui/ui/widgets/draggable'; import 'jquery-ui/ui/widgets/droppable'; -import {SvgLine} from '../../uml/uml.model'; +import {SvgLine} from '../../uml/api/uml.model'; import {SchemaRequest} from '../../../models/ui-request.model'; import {SidebarNode} from '../../../models/sidebar-node.model'; import {WebSocketService} from '../../../services/web-socket.service'; diff --git a/src/app/views/schema-editing/document-edit-collection/document-edit-collection.component.ts b/src/app/views/schema-editing/document-edit-collection/document-edit-collection.component.ts index 675e4a23..408b1262 100644 --- a/src/app/views/schema-editing/document-edit-collection/document-edit-collection.component.ts +++ b/src/app/views/schema-editing/document-edit-collection/document-edit-collection.component.ts @@ -19,7 +19,7 @@ import {CatalogColumnPlacement, Placements, PlacementType, Store} from '../../ad import {ModalDirective} from 'ngx-bootstrap/modal'; import * as _ from 'lodash'; import {Subscription} from 'rxjs'; -import {DbTable, ForeignKey, SvgLine, Uml} from '../../../views/uml/uml.model'; +import {DbTable, ForeignKey, SvgLine, Uml} from '../../uml/api/uml.model'; @Component({ selector: 'app-document-edit-collection', diff --git a/src/app/views/schema-editing/document-edit-collections/document-edit-collections.component.ts b/src/app/views/schema-editing/document-edit-collections/document-edit-collections.component.ts index aa15c042..08e562f8 100644 --- a/src/app/views/schema-editing/document-edit-collections/document-edit-collections.component.ts +++ b/src/app/views/schema-editing/document-edit-collections/document-edit-collections.component.ts @@ -13,7 +13,7 @@ import {Subscription} from 'rxjs'; import {ModalDirective} from 'ngx-bootstrap/modal'; import {UtilService} from '../../../services/util.service'; import * as $ from 'jquery'; -import {DbTable} from '../../uml/uml.model'; +import {DbTable} from '../../uml/api/uml.model'; @Component({ selector: 'app-document-edit-collections', diff --git a/src/app/views/schema-editing/edit-columns/edit-columns.component.ts b/src/app/views/schema-editing/edit-columns/edit-columns.component.ts index e0b68ef5..8f71023e 100644 --- a/src/app/views/schema-editing/edit-columns/edit-columns.component.ts +++ b/src/app/views/schema-editing/edit-columns/edit-columns.component.ts @@ -12,7 +12,7 @@ import {CatalogColumnPlacement, MaterializedInfos, Placements, PlacementType, St import {ModalDirective} from 'ngx-bootstrap/modal'; import * as _ from 'lodash'; import {Subscription} from 'rxjs'; -import {ForeignKey, Uml} from '../../../views/uml/uml.model'; +import {ForeignKey, Uml} from '../../uml/api/uml.model'; @Component({ selector: 'app-edit-columns', diff --git a/src/app/views/schema-editing/edit-source-columns/edit-source-columns.component.ts b/src/app/views/schema-editing/edit-source-columns/edit-source-columns.component.ts index 99c72035..d317b17e 100644 --- a/src/app/views/schema-editing/edit-source-columns/edit-source-columns.component.ts +++ b/src/app/views/schema-editing/edit-source-columns/edit-source-columns.component.ts @@ -8,7 +8,7 @@ import {ToastService} from '../../../components/toast/toast.service'; import {Placements, UnderlyingTables} from '../../adapters/adapter.model'; import {Subscription} from 'rxjs'; import {DbmsTypesService} from '../../../services/dbms-types.service'; -import {ForeignKey, Uml} from '../../../views/uml/uml.model'; +import {ForeignKey, Uml} from '../../uml/api/uml.model'; @Component({ selector: 'app-edit-source-columns', diff --git a/src/app/views/schema-editing/edit-tables/edit-tables.component.ts b/src/app/views/schema-editing/edit-tables/edit-tables.component.ts index 6472dd5d..0dd44667 100644 --- a/src/app/views/schema-editing/edit-tables/edit-tables.component.ts +++ b/src/app/views/schema-editing/edit-tables/edit-tables.component.ts @@ -13,7 +13,7 @@ import {Subscription} from 'rxjs'; import {ModalDirective} from 'ngx-bootstrap/modal'; import {UtilService} from '../../../services/util.service'; import * as $ from 'jquery'; -import {DbTable} from '../../uml/uml.model'; +import {DbTable} from '../../uml/api/uml.model'; @Component({ selector: 'app-edit-tables', diff --git a/src/app/views/uml/uml.model.ts b/src/app/views/uml/api/uml.model.ts similarity index 93% rename from src/app/views/uml/uml.model.ts rename to src/app/views/uml/api/uml.model.ts index 27a28267..0524f94b 100644 --- a/src/app/views/uml/uml.model.ts +++ b/src/app/views/uml/api/uml.model.ts @@ -1,4 +1,4 @@ -import {DbColumn} from '../../components/data-view/models/result-set.model'; +import {DbColumn} from '../../../components/data-view/models/result-set.model'; export class Uml { constructor( diff --git a/src/app/views/uml/uml.component.spec.ts b/src/app/views/uml/component/specs/uml.component.spec.ts similarity index 91% rename from src/app/views/uml/uml.component.spec.ts rename to src/app/views/uml/component/specs/uml.component.spec.ts index 6ad75e91..f4f12527 100644 --- a/src/app/views/uml/uml.component.spec.ts +++ b/src/app/views/uml/component/specs/uml.component.spec.ts @@ -1,6 +1,6 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { UmlComponent } from './uml.component'; +import { UmlComponent } from '../uml.component'; describe('UmlComponent', () => { let component: UmlComponent; diff --git a/src/app/views/uml/uml.component.html b/src/app/views/uml/component/uml.component.html similarity index 95% rename from src/app/views/uml/uml.component.html rename to src/app/views/uml/component/uml.component.html index aebe8552..6a04dd91 100644 --- a/src/app/views/uml/uml.component.html +++ b/src/app/views/uml/component/uml.component.html @@ -4,10 +4,10 @@
Drag a connection from a column to a primary key or unique column to create a new foreign key.
Please select a schema in the left sidebar. Document schemas and tables originating from a data source are not supported. - Document schemas do not support the UML builder. + Document schemas do not support the UML builder.