diff --git a/.jhipster/Dependency.json b/.jhipster/Dependency.json new file mode 100644 index 0000000..02a38a4 --- /dev/null +++ b/.jhipster/Dependency.json @@ -0,0 +1,46 @@ +{ + "name": "Dependency", + "fields": [ + { + "fieldName": "name", + "fieldType": "String", + "fieldValidateRules": [ + "required" + ] + }, + { + "fieldName": "description", + "fieldType": "byte[]", + "fieldTypeBlobContent": "text" + } + ], + "relationships": [ + { + "relationshipType": "many-to-one", + "otherEntityName": "microservice", + "otherEntityRelationshipName": "dependency", + "relationshipValidateRules": "required", + "relationshipName": "source", + "otherEntityField": "id" + }, + { + "relationshipType": "many-to-one", + "otherEntityName": "microservice", + "otherEntityRelationshipName": "dependency", + "relationshipValidateRules": "required", + "relationshipName": "target", + "otherEntityField": "id" + } + ], + "changelogDate": "20201005051343", + "entityTableName": "dependency", + "dto": "no", + "pagination": "no", + "service": "no", + "jpaMetamodelFiltering": false, + "fluentMethods": true, + "readOnly": false, + "embedded": false, + "clientRootFolder": "", + "applications": "*" +} diff --git a/microcatalog.jdl b/microcatalog.jdl index 7becdb2..0b861a8 100644 --- a/microcatalog.jdl +++ b/microcatalog.jdl @@ -17,8 +17,15 @@ entity Microservice { gitUrl String required } +entity Dependency { + name String required + description TextBlob +} + relationship ManyToOne { Microservice{team required} to Team Microservice{status required} to Status + Dependency{source required} to Microservice + Dependency{target required} to Microservice } diff --git a/package-lock.json b/package-lock.json index 9d8e52a..f78656e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1221,6 +1221,14 @@ "minimist": "^1.2.0" } }, + "@egjs/hammerjs": { + "version": "2.0.17", + "resolved": "https://registry.npmjs.org/@egjs/hammerjs/-/hammerjs-2.0.17.tgz", + "integrity": "sha512-XQsZgjm2EcVUiZQf11UBJQfmZeEmOW8DpI1gsFeln6w0ae0ii4dMQEQ0kjl6DspdWX1aGY1/loyXnP0JS06e/A==", + "requires": { + "@types/hammerjs": "^2.0.36" + } + }, "@fortawesome/angular-fontawesome": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/@fortawesome/angular-fontawesome/-/angular-fontawesome-0.6.1.tgz", @@ -2502,6 +2510,11 @@ "@types/node": "*" } }, + "@types/hammerjs": { + "version": "2.0.36", + "resolved": "https://registry.npmjs.org/@types/hammerjs/-/hammerjs-2.0.36.tgz", + "integrity": "sha512-7TUK/k2/QGpEAv/BCwSHlYu3NXZhQ9ZwBYpzr9tjlPIL2C5BeGhH3DmVavRx3ZNyELX5TLC91JTz/cen6AAtIQ==" + }, "@types/html-minifier-terser": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/@types/html-minifier-terser/-/html-minifier-terser-5.1.1.tgz", @@ -3983,16 +3996,16 @@ "dev": true }, "browser-sync": { - "version": "2.26.7", - "resolved": "https://registry.npmjs.org/browser-sync/-/browser-sync-2.26.7.tgz", - "integrity": "sha512-lY3emme0OyvA2ujEMpRmyRy9LY6gHLuTr2/ABxhIm3lADOiRXzP4dgekvnDrQqZ/Ec2Fz19lEjm6kglSG5766w==", + "version": "2.26.12", + "resolved": "https://registry.npmjs.org/browser-sync/-/browser-sync-2.26.12.tgz", + "integrity": "sha512-1GjAe+EpZQJgtKhWsxklEjpaMV0DrRylpHRvZWgOphDQt+bfLZjfynl/j1WjSFIx8ozj9j78g6Yk4TqD3gKaMA==", "dev": true, "requires": { - "browser-sync-client": "^2.26.6", - "browser-sync-ui": "^2.26.4", + "browser-sync-client": "^2.26.12", + "browser-sync-ui": "^2.26.12", "bs-recipes": "1.3.4", "bs-snippet-injector": "^2.0.1", - "chokidar": "^2.0.4", + "chokidar": "^3.4.1", "connect": "3.6.6", "connect-history-api-fallback": "^1", "dev-ip": "^1.0.1", @@ -4001,10 +4014,10 @@ "etag": "^1.8.1", "fresh": "^0.5.2", "fs-extra": "3.0.1", - "http-proxy": "1.15.2", + "http-proxy": "^1.18.1", "immutable": "^3", - "localtunnel": "1.9.2", - "micromatch": "^3.1.10", + "localtunnel": "^2.0.0", + "micromatch": "^4.0.2", "opn": "5.3.0", "portscanner": "2.1.1", "qs": "6.2.3", @@ -4016,119 +4029,10 @@ "serve-static": "1.13.2", "server-destroy": "1.0.1", "socket.io": "2.1.1", - "ua-parser-js": "0.7.17", - "yargs": "6.4.0" + "ua-parser-js": "^0.7.18", + "yargs": "^15.4.1" }, "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true - }, - "anymatch": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", - "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", - "dev": true, - "requires": { - "micromatch": "^3.1.4", - "normalize-path": "^2.1.1" - }, - "dependencies": { - "normalize-path": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", - "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", - "dev": true, - "requires": { - "remove-trailing-separator": "^1.0.1" - } - } - } - }, - "binary-extensions": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz", - "integrity": "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw==", - "dev": true - }, - "braces": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", - "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", - "dev": true, - "requires": { - "arr-flatten": "^1.1.0", - "array-unique": "^0.3.2", - "extend-shallow": "^2.0.1", - "fill-range": "^4.0.0", - "isobject": "^3.0.1", - "repeat-element": "^1.1.2", - "snapdragon": "^0.8.1", - "snapdragon-node": "^2.0.1", - "split-string": "^3.0.2", - "to-regex": "^3.0.1" - } - }, - "camelcase": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", - "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=", - "dev": true - }, - "chokidar": { - "version": "2.1.8", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz", - "integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==", - "dev": true, - "requires": { - "anymatch": "^2.0.0", - "async-each": "^1.0.1", - "braces": "^2.3.2", - "fsevents": "^1.2.7", - "glob-parent": "^3.1.0", - "inherits": "^2.0.3", - "is-binary-path": "^1.0.0", - "is-glob": "^4.0.0", - "normalize-path": "^3.0.0", - "path-is-absolute": "^1.0.0", - "readdirp": "^2.2.1", - "upath": "^1.1.1" - } - }, - "cliui": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", - "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", - "dev": true, - "requires": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wrap-ansi": "^2.0.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "fill-range": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", - "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", - "dev": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-number": "^3.0.0", - "repeat-string": "^1.6.1", - "to-regex-range": "^2.1.0" - } - }, "fs-extra": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-3.0.1.tgz", @@ -4140,67 +4044,6 @@ "universalify": "^0.1.0" } }, - "fsevents": { - "version": "1.2.13", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", - "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", - "dev": true, - "optional": true - }, - "get-caller-file": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", - "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==", - "dev": true - }, - "glob-parent": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", - "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", - "dev": true, - "requires": { - "is-glob": "^3.1.0", - "path-dirname": "^1.0.0" - }, - "dependencies": { - "is-glob": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", - "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", - "dev": true, - "requires": { - "is-extglob": "^2.1.0" - } - } - } - }, - "is-binary-path": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", - "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=", - "dev": true, - "requires": { - "binary-extensions": "^1.0.0" - } - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "dev": true, - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - } - }, "jsonfile": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-3.0.1.tgz", @@ -4210,13 +4053,14 @@ "graceful-fs": "^4.1.6" } }, - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "micromatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", + "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", "dev": true, "requires": { - "is-buffer": "^1.1.5" + "braces": "^3.0.1", + "picomatch": "^2.0.5" } }, "qs": { @@ -4225,104 +4069,23 @@ "integrity": "sha1-HPyyXBCpsrSDBT/zn138kjOQjP4=", "dev": true }, - "readdirp": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.2.1.tgz", - "integrity": "sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.11", - "micromatch": "^3.1.10", - "readable-stream": "^2.0.2" - } - }, - "require-main-filename": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", - "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", - "dev": true - }, - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "dev": true, - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "to-regex-range": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", - "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", - "dev": true, - "requires": { - "is-number": "^3.0.0", - "repeat-string": "^1.6.1" - } - }, - "which-module": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-1.0.0.tgz", - "integrity": "sha1-u6Y8qGGUiZT/MHc2CJ47lgJsKk8=", - "dev": true - }, - "wrap-ansi": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", - "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", - "dev": true, - "requires": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1" - } - }, - "y18n": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", - "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", - "dev": true - }, "yargs": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-6.4.0.tgz", - "integrity": "sha1-gW4ahm1VmMzzTlWW3c4i2S2kkNQ=", + "version": "15.4.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", + "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", "dev": true, "requires": { - "camelcase": "^3.0.0", - "cliui": "^3.2.0", - "decamelize": "^1.1.1", - "get-caller-file": "^1.0.1", - "os-locale": "^1.4.0", - "read-pkg-up": "^1.0.1", + "cliui": "^6.0.0", + "decamelize": "^1.2.0", + "find-up": "^4.1.0", + "get-caller-file": "^2.0.1", "require-directory": "^2.1.1", - "require-main-filename": "^1.0.1", + "require-main-filename": "^2.0.0", "set-blocking": "^2.0.0", - "string-width": "^1.0.2", - "which-module": "^1.0.0", - "window-size": "^0.2.0", - "y18n": "^3.2.1", - "yargs-parser": "^4.1.0" - } - }, - "yargs-parser": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-4.2.1.tgz", - "integrity": "sha1-KczqwNxPA8bIe0qfIX3RjJ90hxw=", - "dev": true, - "requires": { - "camelcase": "^3.0.0" + "string-width": "^4.2.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^18.1.2" } } } @@ -7331,9 +7094,9 @@ "dev": true }, "eventemitter3": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-1.2.0.tgz", - "integrity": "sha1-HIaZHYFq0eUEdQ5zh0Ik7PO+xQg=", + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", + "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", "dev": true }, "events": { @@ -9288,13 +9051,14 @@ } }, "http-proxy": { - "version": "1.15.2", - "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.15.2.tgz", - "integrity": "sha1-ZC/cr/5S00SNK9o7AHnpQJBk2jE=", + "version": "1.18.1", + "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz", + "integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==", "dev": true, "requires": { - "eventemitter3": "1.x.x", - "requires-port": "1.x.x" + "eventemitter3": "^4.0.0", + "follow-redirects": "^1.0.0", + "requires-port": "^1.0.0" } }, "http-proxy-agent": { @@ -10029,12 +9793,6 @@ "loose-envify": "^1.0.0" } }, - "invert-kv": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", - "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", - "dev": true - }, "ip": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", @@ -13312,6 +13070,11 @@ "verror": "1.10.0" } }, + "keycharm": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/keycharm/-/keycharm-0.3.1.tgz", + "integrity": "sha512-zn47Ti4FJT9zdF+YBBLWJsfKF/fYQHkrYlBeB5Ez5e2PjW7SoIxr43yehAne2HruulIoid4NKZZxO0dHBygCtQ==" + }, "killable": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/killable/-/killable-1.0.1.tgz", @@ -13358,15 +13121,6 @@ "set-getter": "^0.1.0" } }, - "lcid": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", - "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", - "dev": true, - "requires": { - "invert-kv": "^1.0.0" - } - }, "leven": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", @@ -13677,19 +13431,6 @@ } } }, - "load-json-file": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", - "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "parse-json": "^2.2.0", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0", - "strip-bom": "^2.0.0" - } - }, "loader-runner": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-2.4.0.tgz", @@ -13708,38 +13449,32 @@ } }, "localtunnel": { - "version": "1.9.2", - "resolved": "https://registry.npmjs.org/localtunnel/-/localtunnel-1.9.2.tgz", - "integrity": "sha512-NEKF7bDJE9U3xzJu3kbayF0WTvng6Pww7tzqNb/XtEARYwqw7CKEX7BvOMg98FtE9es2CRizl61gkV3hS8dqYg==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/localtunnel/-/localtunnel-2.0.0.tgz", + "integrity": "sha512-g6E0aLgYYDvQDxIjIXkgJo2+pHj3sGg4Wz/XP3h2KtZnRsWPbOQY+hw1H8Z91jep998fkcVE9l+kghO+97vllg==", "dev": true, "requires": { "axios": "0.19.0", "debug": "4.1.1", "openurl": "1.1.1", - "yargs": "6.6.0" + "yargs": "13.3.0" }, "dependencies": { "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true - }, - "camelcase": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", - "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", "dev": true }, "cliui": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", - "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", + "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", "dev": true, "requires": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wrap-ansi": "^2.0.0" + "string-width": "^3.1.0", + "strip-ansi": "^5.2.0", + "wrap-ansi": "^5.1.0" } }, "debug": { @@ -13751,97 +13486,109 @@ "ms": "^2.1.1" } }, - "get-caller-file": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", - "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==", + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", "dev": true }, + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + }, "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", "dev": true, "requires": { - "number-is-nan": "^1.0.0" + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" } }, - "require-main-filename": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", - "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", "dev": true }, "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", "dev": true, "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" } }, "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", "dev": true, "requires": { - "ansi-regex": "^2.0.0" + "ansi-regex": "^4.1.0" } }, - "which-module": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-1.0.0.tgz", - "integrity": "sha1-u6Y8qGGUiZT/MHc2CJ47lgJsKk8=", - "dev": true - }, "wrap-ansi": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", - "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", + "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", "dev": true, "requires": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1" + "ansi-styles": "^3.2.0", + "string-width": "^3.0.0", + "strip-ansi": "^5.0.0" } }, - "y18n": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", - "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", - "dev": true - }, "yargs": { - "version": "6.6.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-6.6.0.tgz", - "integrity": "sha1-eC7CHvQDNF+DCoCMo9UTr1YGUgg=", + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.0.tgz", + "integrity": "sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA==", "dev": true, "requires": { - "camelcase": "^3.0.0", - "cliui": "^3.2.0", - "decamelize": "^1.1.1", - "get-caller-file": "^1.0.1", - "os-locale": "^1.4.0", - "read-pkg-up": "^1.0.1", + "cliui": "^5.0.0", + "find-up": "^3.0.0", + "get-caller-file": "^2.0.1", "require-directory": "^2.1.1", - "require-main-filename": "^1.0.1", + "require-main-filename": "^2.0.0", "set-blocking": "^2.0.0", - "string-width": "^1.0.2", - "which-module": "^1.0.0", - "y18n": "^3.2.1", - "yargs-parser": "^4.2.0" + "string-width": "^3.0.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^13.1.1" } }, "yargs-parser": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-4.2.1.tgz", - "integrity": "sha1-KczqwNxPA8bIe0qfIX3RjJ90hxw=", + "version": "13.1.2", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", + "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", "dev": true, "requires": { - "camelcase": "^3.0.0" + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" } } } @@ -15912,15 +15659,6 @@ "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "dev": true }, - "os-locale": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", - "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", - "dev": true, - "requires": { - "lcid": "^1.0.0" - } - }, "os-name": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/os-name/-/os-name-3.1.0.tgz", @@ -16227,15 +15965,6 @@ "integrity": "sha512-UGyowyjtx26n65kdAMWhm6/3uy5uSrpcuH7tt+QEVudiBoVS+eqHxD5kbi9oWVRwj7sCzXqwuM+rUGw7earl6A==", "dev": true }, - "parse-json": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", - "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", - "dev": true, - "requires": { - "error-ex": "^1.2.0" - } - }, "parse-passwd": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz", @@ -16341,17 +16070,6 @@ "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=", "dev": true }, - "path-type": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", - "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" - } - }, "pbkdf2": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.1.tgz", @@ -17599,48 +17317,6 @@ "util-promisify": "^2.1.0" } }, - "read-pkg": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", - "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", - "dev": true, - "requires": { - "load-json-file": "^1.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^1.0.0" - } - }, - "read-pkg-up": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", - "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", - "dev": true, - "requires": { - "find-up": "^1.0.0", - "read-pkg": "^1.0.0" - }, - "dependencies": { - "find-up": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", - "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", - "dev": true, - "requires": { - "path-exists": "^2.0.0", - "pinkie-promise": "^2.0.0" - } - }, - "path-exists": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", - "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", - "dev": true, - "requires": { - "pinkie-promise": "^2.0.0" - } - } - } - }, "readable-stream": { "version": "2.3.7", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", @@ -21035,9 +20711,9 @@ "dev": true }, "ua-parser-js": { - "version": "0.7.17", - "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.17.tgz", - "integrity": "sha512-uRdSdu1oA1rncCQL7sCj8vSyZkgtL7faaw9Tc9rZ3mGgraQ7+Pdx7w5mnOSF3gw9ZNG6oc+KXfkon3bKuROm0g==", + "version": "0.7.22", + "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.22.tgz", + "integrity": "sha512-YUxzMjJ5T71w6a8WWVcMGM6YWOTX27rCoIQgLXiWaxqXSx9D7DNjiGWn1aJIRSQ5qr0xuhra77bSIh6voR/46Q==", "dev": true }, "ultron": { @@ -21449,6 +21125,21 @@ "vinyl": "^2.0.1" } }, + "vis-data": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/vis-data/-/vis-data-7.0.0.tgz", + "integrity": "sha512-qKpyAQ9UMT0QygLbCulgabKkgfo8aVkuWSqhvEiaah/iy/Dvj17iMFChUU+UIioorWlweXcp5ziXoMLIl7hTAg==" + }, + "vis-network": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/vis-network/-/vis-network-8.3.2.tgz", + "integrity": "sha512-vJDctP2gZzZbpgpB+MJxNudsqRGdkRablwdLOWd6yZKZQuEBZltOJSBaSCsyQVMD1gY8mjuYhNRoIcy7g+PDvQ==" + }, + "vis-util": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/vis-util/-/vis-util-4.3.4.tgz", + "integrity": "sha512-hJIZNrwf4ML7FYjs+m+zjJfaNvhjk3/1hbMdQZVnwwpOFJS/8dMG8rdbOHXcKoIEM6U5VOh3HNpaDXxGkOZGpw==" + }, "vm-browserify": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-1.1.2.tgz", @@ -22930,12 +22621,6 @@ "integrity": "sha1-Zws6+8VS4LVd9rd4DKdGFfI60cs=", "dev": true }, - "window-size": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.2.0.tgz", - "integrity": "sha1-tDFbtCFKPXBY6+7okuE/ok2YsHU=", - "dev": true - }, "windows-release": { "version": "3.3.3", "resolved": "https://registry.npmjs.org/windows-release/-/windows-release-3.3.3.tgz", diff --git a/package.json b/package.json index 2b66498..3ab1235 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "@angular/platform-browser": "10.0.0", "@angular/platform-browser-dynamic": "10.0.0", "@angular/router": "10.0.0", + "@egjs/hammerjs": "^2.0.17", "@fortawesome/angular-fontawesome": "0.6.1", "@fortawesome/fontawesome-svg-core": "1.2.29", "@fortawesome/free-solid-svg-icons": "5.13.1", @@ -24,6 +25,7 @@ "@ngx-translate/http-loader": "5.0.0", "bootstrap": "4.5.0", "bootswatch": "4.5.0", + "keycharm": "^0.3.1", "moment": "2.27.0", "ng-jhipster": "0.15.0", "ngx-cookie-service": "3.0.4", @@ -32,6 +34,9 @@ "rxjs": "6.5.5", "swagger-ui-dist": "3.25.1", "tslib": "2.0.0", + "vis-data": "^7.0.0", + "vis-network": "^8.3.2", + "vis-util": "^4.3.4", "zone.js": "0.10.3" }, "devDependencies": { @@ -45,7 +50,7 @@ "@typescript-eslint/eslint-plugin-tslint": "2.30.0", "@typescript-eslint/parser": "2.30.0", "autoprefixer": "9.8.4", - "browser-sync": "2.26.7", + "browser-sync": "^2.26.12", "browser-sync-webpack-plugin": "2.2.2", "codelyzer": "5.2.2", "copy-webpack-plugin": "6.0.2", diff --git a/src/main/java/com/github/microcatalog/config/CacheConfiguration.java b/src/main/java/com/github/microcatalog/config/CacheConfiguration.java index 8bf8d02..3dc3cad 100644 --- a/src/main/java/com/github/microcatalog/config/CacheConfiguration.java +++ b/src/main/java/com/github/microcatalog/config/CacheConfiguration.java @@ -51,6 +51,7 @@ public JCacheManagerCustomizer cacheManagerCustomizer() { createCache(cm, com.github.microcatalog.domain.Microservice.class.getName()); createCache(cm, com.github.microcatalog.domain.Team.class.getName()); createCache(cm, com.github.microcatalog.domain.Status.class.getName()); + createCache(cm, com.github.microcatalog.domain.Dependency.class.getName()); // jhipster-needle-ehcache-add-entry }; } diff --git a/src/main/java/com/github/microcatalog/domain/Dependency.java b/src/main/java/com/github/microcatalog/domain/Dependency.java new file mode 100644 index 0000000..1eb92a3 --- /dev/null +++ b/src/main/java/com/github/microcatalog/domain/Dependency.java @@ -0,0 +1,134 @@ +package com.github.microcatalog.domain; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import org.hibernate.annotations.Cache; +import org.hibernate.annotations.CacheConcurrencyStrategy; +import org.hibernate.annotations.Type; + +import javax.persistence.*; +import javax.validation.constraints.*; + +import java.io.Serializable; + +/** + * A Dependency. + */ +@Entity +@Table(name = "dependency") +@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) +public class Dependency implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator") + @SequenceGenerator(name = "sequenceGenerator") + private Long id; + + @NotNull + @Column(name = "name", nullable = false) + private String name; + + @Lob + @Type(type = "org.hibernate.type.TextType") + @Column(name = "description") + private String description; + + @ManyToOne(optional = false) + @NotNull + @JsonIgnoreProperties(value = "dependencies", allowSetters = true) + private Microservice source; + + @ManyToOne(optional = false) + @NotNull + @JsonIgnoreProperties(value = "dependencies", allowSetters = true) + private Microservice target; + + // jhipster-needle-entity-add-field - JHipster will add fields here + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public Dependency name(String name) { + this.name = name; + return this; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public Dependency description(String description) { + this.description = description; + return this; + } + + public void setDescription(String description) { + this.description = description; + } + + public Microservice getSource() { + return source; + } + + public Dependency source(Microservice microservice) { + this.source = microservice; + return this; + } + + public void setSource(Microservice microservice) { + this.source = microservice; + } + + public Microservice getTarget() { + return target; + } + + public Dependency target(Microservice microservice) { + this.target = microservice; + return this; + } + + public void setTarget(Microservice microservice) { + this.target = microservice; + } + // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof Dependency)) { + return false; + } + return id != null && id.equals(((Dependency) o).id); + } + + @Override + public int hashCode() { + return 31; + } + + // prettier-ignore + @Override + public String toString() { + return "Dependency{" + + "id=" + getId() + + ", name='" + getName() + "'" + + ", description='" + getDescription() + "'" + + "}"; + } +} diff --git a/src/main/java/com/github/microcatalog/repository/DependencyRepository.java b/src/main/java/com/github/microcatalog/repository/DependencyRepository.java new file mode 100644 index 0000000..9729198 --- /dev/null +++ b/src/main/java/com/github/microcatalog/repository/DependencyRepository.java @@ -0,0 +1,14 @@ +package com.github.microcatalog.repository; + +import com.github.microcatalog.domain.Dependency; + +import org.springframework.data.jpa.repository.*; +import org.springframework.stereotype.Repository; + +/** + * Spring Data repository for the Dependency entity. + */ +@SuppressWarnings("unused") +@Repository +public interface DependencyRepository extends JpaRepository { +} diff --git a/src/main/java/com/github/microcatalog/web/rest/DependencyResource.java b/src/main/java/com/github/microcatalog/web/rest/DependencyResource.java new file mode 100644 index 0000000..2aec08e --- /dev/null +++ b/src/main/java/com/github/microcatalog/web/rest/DependencyResource.java @@ -0,0 +1,119 @@ +package com.github.microcatalog.web.rest; + +import com.github.microcatalog.domain.Dependency; +import com.github.microcatalog.repository.DependencyRepository; +import com.github.microcatalog.web.rest.errors.BadRequestAlertException; + +import io.github.jhipster.web.util.HeaderUtil; +import io.github.jhipster.web.util.ResponseUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.ResponseEntity; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.List; +import java.util.Optional; + +/** + * REST controller for managing {@link com.github.microcatalog.domain.Dependency}. + */ +@RestController +@RequestMapping("/api") +@Transactional +public class DependencyResource { + + private final Logger log = LoggerFactory.getLogger(DependencyResource.class); + + private static final String ENTITY_NAME = "dependency"; + + @Value("${jhipster.clientApp.name}") + private String applicationName; + + private final DependencyRepository dependencyRepository; + + public DependencyResource(DependencyRepository dependencyRepository) { + this.dependencyRepository = dependencyRepository; + } + + /** + * {@code POST /dependencies} : Create a new dependency. + * + * @param dependency the dependency to create. + * @return the {@link ResponseEntity} with status {@code 201 (Created)} and with body the new dependency, or with status {@code 400 (Bad Request)} if the dependency has already an ID. + * @throws URISyntaxException if the Location URI syntax is incorrect. + */ + @PostMapping("/dependencies") + public ResponseEntity createDependency(@Valid @RequestBody Dependency dependency) throws URISyntaxException { + log.debug("REST request to save Dependency : {}", dependency); + if (dependency.getId() != null) { + throw new BadRequestAlertException("A new dependency cannot already have an ID", ENTITY_NAME, "idexists"); + } + Dependency result = dependencyRepository.save(dependency); + return ResponseEntity.created(new URI("/api/dependencies/" + result.getId())) + .headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId().toString())) + .body(result); + } + + /** + * {@code PUT /dependencies} : Updates an existing dependency. + * + * @param dependency the dependency to update. + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated dependency, + * or with status {@code 400 (Bad Request)} if the dependency is not valid, + * or with status {@code 500 (Internal Server Error)} if the dependency couldn't be updated. + * @throws URISyntaxException if the Location URI syntax is incorrect. + */ + @PutMapping("/dependencies") + public ResponseEntity updateDependency(@Valid @RequestBody Dependency dependency) throws URISyntaxException { + log.debug("REST request to update Dependency : {}", dependency); + if (dependency.getId() == null) { + throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull"); + } + Dependency result = dependencyRepository.save(dependency); + return ResponseEntity.ok() + .headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, dependency.getId().toString())) + .body(result); + } + + /** + * {@code GET /dependencies} : get all the dependencies. + * + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and the list of dependencies in body. + */ + @GetMapping("/dependencies") + public List getAllDependencies() { + log.debug("REST request to get all Dependencies"); + return dependencyRepository.findAll(); + } + + /** + * {@code GET /dependencies/:id} : get the "id" dependency. + * + * @param id the id of the dependency to retrieve. + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the dependency, or with status {@code 404 (Not Found)}. + */ + @GetMapping("/dependencies/{id}") + public ResponseEntity getDependency(@PathVariable Long id) { + log.debug("REST request to get Dependency : {}", id); + Optional dependency = dependencyRepository.findById(id); + return ResponseUtil.wrapOrNotFound(dependency); + } + + /** + * {@code DELETE /dependencies/:id} : delete the "id" dependency. + * + * @param id the id of the dependency to delete. + * @return the {@link ResponseEntity} with status {@code 204 (NO_CONTENT)}. + */ + @DeleteMapping("/dependencies/{id}") + public ResponseEntity deleteDependency(@PathVariable Long id) { + log.debug("REST request to delete Dependency : {}", id); + dependencyRepository.deleteById(id); + return ResponseEntity.noContent().headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, ENTITY_NAME, id.toString())).build(); + } +} diff --git a/src/main/resources/config/liquibase/changelog/20201005051343_added_entity_Dependency.xml b/src/main/resources/config/liquibase/changelog/20201005051343_added_entity_Dependency.xml new file mode 100644 index 0000000..8299390 --- /dev/null +++ b/src/main/resources/config/liquibase/changelog/20201005051343_added_entity_Dependency.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/config/liquibase/changelog/20201005051343_added_entity_constraints_Dependency.xml b/src/main/resources/config/liquibase/changelog/20201005051343_added_entity_constraints_Dependency.xml new file mode 100644 index 0000000..fcad019 --- /dev/null +++ b/src/main/resources/config/liquibase/changelog/20201005051343_added_entity_constraints_Dependency.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + diff --git a/src/main/resources/config/liquibase/fake-data/dependency.csv b/src/main/resources/config/liquibase/fake-data/dependency.csv new file mode 100644 index 0000000..b15b98f --- /dev/null +++ b/src/main/resources/config/liquibase/fake-data/dependency.csv @@ -0,0 +1,11 @@ +id;name;description;source_id;target_id +1;Associate;../fake-data/blob/hipster.txt;1;1 +2;Consultant system Sleek Soft Bike;../fake-data/blob/hipster.txt;2;2 +3;Cambridgeshire;../fake-data/blob/hipster.txt;3;3 +4;South Dakota azure;../fake-data/blob/hipster.txt;4;4 +5;copy;../fake-data/blob/hipster.txt;5;5 +6;Chicken Rubber;../fake-data/blob/hipster.txt;6;6 +7;Frozen Suriname Gorgeous;../fake-data/blob/hipster.txt;7;7 +8;Lao People's Democratic Republic;../fake-data/blob/hipster.txt;8;8 +9;Qatar Wisconsin Product;../fake-data/blob/hipster.txt;9;9 +10;Cuba application;../fake-data/blob/hipster.txt;10;10 diff --git a/src/main/resources/config/liquibase/master.xml b/src/main/resources/config/liquibase/master.xml index 8fc028c..45dc1c2 100644 --- a/src/main/resources/config/liquibase/master.xml +++ b/src/main/resources/config/liquibase/master.xml @@ -17,8 +17,10 @@ + + diff --git a/src/main/webapp/app/app-routing.module.ts b/src/main/webapp/app/app-routing.module.ts index a5dbceb..1014793 100644 --- a/src/main/webapp/app/app-routing.module.ts +++ b/src/main/webapp/app/app-routing.module.ts @@ -13,6 +13,14 @@ const LAYOUT_ROUTES = [navbarRoute, ...errorRoute]; imports: [ RouterModule.forRoot( [ + { + path: 'dashboard', + data: { + authorities: [Authority.USER], + }, + canActivate: [UserRouteAccessService], + loadChildren: () => import('./dashboard/dashboard-routing.module').then(m => m.DashboardRoutingModule), + }, { path: 'admin', data: { diff --git a/src/main/webapp/app/core/icons/font-awesome-icons.ts b/src/main/webapp/app/core/icons/font-awesome-icons.ts index 6c4872c..2707913 100644 --- a/src/main/webapp/app/core/icons/font-awesome-icons.ts +++ b/src/main/webapp/app/core/icons/font-awesome-icons.ts @@ -1,4 +1,5 @@ import { + faCubes, faUser, faSort, faSortUp, @@ -37,6 +38,7 @@ import { } from '@fortawesome/free-solid-svg-icons'; export const fontAwesomeIcons = [ + faCubes, faUser, faSort, faSortUp, diff --git a/src/main/webapp/app/dashboard/dashboard-routing.module.ts b/src/main/webapp/app/dashboard/dashboard-routing.module.ts new file mode 100644 index 0000000..e29f124 --- /dev/null +++ b/src/main/webapp/app/dashboard/dashboard-routing.module.ts @@ -0,0 +1,14 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { + path: 'dependencies', + loadChildren: () => import('./dependency-dashboard/dependency-dashboard.module').then(m => m.DependencyDashboardModule), + }, + ]), + ], +}) +export class DashboardRoutingModule {} diff --git a/src/main/webapp/app/dashboard/dependency-dashboard/dependency-dashboard.component.html b/src/main/webapp/app/dashboard/dependency-dashboard/dependency-dashboard.component.html new file mode 100644 index 0000000..cfdc7fd --- /dev/null +++ b/src/main/webapp/app/dashboard/dependency-dashboard/dependency-dashboard.component.html @@ -0,0 +1,2 @@ +
+ diff --git a/src/main/webapp/app/dashboard/dependency-dashboard/dependency-dashboard.component.scss b/src/main/webapp/app/dashboard/dependency-dashboard/dependency-dashboard.component.scss new file mode 100644 index 0000000..6d9f831 --- /dev/null +++ b/src/main/webapp/app/dashboard/dependency-dashboard/dependency-dashboard.component.scss @@ -0,0 +1,3 @@ +.vis-network-full-height { + height: 80vh; +} diff --git a/src/main/webapp/app/dashboard/dependency-dashboard/dependency-dashboard.component.ts b/src/main/webapp/app/dashboard/dependency-dashboard/dependency-dashboard.component.ts new file mode 100644 index 0000000..8cf39d2 --- /dev/null +++ b/src/main/webapp/app/dashboard/dependency-dashboard/dependency-dashboard.component.ts @@ -0,0 +1,77 @@ +import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core'; +import { DataSet } from 'vis-data/peer'; +import { Network } from 'vis-network/peer'; +import { DependencyService } from '../../entities/dependency/dependency.service'; +import { IDependency } from '../../shared/model/dependency.model'; +import { map } from 'rxjs/operators'; + +@Component({ + selector: 'jhi-dependency-dashboard', + templateUrl: './dependency-dashboard.component.html', + styleUrls: ['./dependency-dashboard.component.scss'], +}) +export class DependencyDashboardComponent implements OnInit, AfterViewInit { + @ViewChild('visNetwork', { static: false }) + visNetwork!: ElementRef; + + networkInstance: any; + + constructor(protected dependencyService: DependencyService) {} + + ngOnInit(): void {} + + ngAfterViewInit(): void { + const container = this.visNetwork; + + const data = {}; + this.networkInstance = new Network(container.nativeElement, data, { + height: '100%', + width: '100%', + nodes: { + shape: 'hexagon', + font: { + color: 'white', + }, + }, + edges: { + smooth: false, + arrows: { + to: { + enabled: true, + type: 'vee', + }, + }, + }, + }); + + this.loadAll(); + } + + loadAll(): void { + this.dependencyService + .query() + .pipe(map(httpResponse => httpResponse.body)) + .subscribe(dependencies => this.refreshGraph(dependencies || [])); + } + + refreshGraph(dependencies: IDependency[]): void { + const nodes = new DataSet(); + const edges = new DataSet(); + + dependencies.forEach(d => { + nodes.add({ + id: d.id, + label: d.name, + }); + + edges.add({ + from: d.source?.id, + to: d.target?.id, + }); + }); + + const data = { nodes, edges }; + + this.networkInstance.setData(data); + } +} diff --git a/src/main/webapp/app/dashboard/dependency-dashboard/dependency-dashboard.module.ts b/src/main/webapp/app/dashboard/dependency-dashboard/dependency-dashboard.module.ts new file mode 100644 index 0000000..fdda86c --- /dev/null +++ b/src/main/webapp/app/dashboard/dependency-dashboard/dependency-dashboard.module.ts @@ -0,0 +1,11 @@ +import { NgModule } from '@angular/core'; +import { DependencyDashboardComponent } from './dependency-dashboard.component'; +import { RouterModule } from '@angular/router'; +import { dependencyDashboardRoute } from './dependency-dashboard.route'; +import { MicrocatalogSharedModule } from '../../shared/shared.module'; + +@NgModule({ + imports: [MicrocatalogSharedModule, RouterModule.forChild(dependencyDashboardRoute)], + declarations: [DependencyDashboardComponent], +}) +export class DependencyDashboardModule {} diff --git a/src/main/webapp/app/dashboard/dependency-dashboard/dependency-dashboard.route.ts b/src/main/webapp/app/dashboard/dependency-dashboard/dependency-dashboard.route.ts new file mode 100644 index 0000000..a7e5f8e --- /dev/null +++ b/src/main/webapp/app/dashboard/dependency-dashboard/dependency-dashboard.route.ts @@ -0,0 +1,9 @@ +import { Routes } from '@angular/router'; +import { DependencyDashboardComponent } from './dependency-dashboard.component'; + +export const dependencyDashboardRoute: Routes = [ + { + path: '', + component: DependencyDashboardComponent, + }, +]; diff --git a/src/main/webapp/app/entities/dependency/dependency-delete-dialog.component.html b/src/main/webapp/app/entities/dependency/dependency-delete-dialog.component.html new file mode 100644 index 0000000..58de9e3 --- /dev/null +++ b/src/main/webapp/app/entities/dependency/dependency-delete-dialog.component.html @@ -0,0 +1,24 @@ +
+ + + + + +
diff --git a/src/main/webapp/app/entities/dependency/dependency-delete-dialog.component.ts b/src/main/webapp/app/entities/dependency/dependency-delete-dialog.component.ts new file mode 100644 index 0000000..765bc26 --- /dev/null +++ b/src/main/webapp/app/entities/dependency/dependency-delete-dialog.component.ts @@ -0,0 +1,30 @@ +import { Component } from '@angular/core'; +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; +import { JhiEventManager } from 'ng-jhipster'; + +import { IDependency } from 'app/shared/model/dependency.model'; +import { DependencyService } from './dependency.service'; + +@Component({ + templateUrl: './dependency-delete-dialog.component.html', +}) +export class DependencyDeleteDialogComponent { + dependency?: IDependency; + + constructor( + protected dependencyService: DependencyService, + public activeModal: NgbActiveModal, + protected eventManager: JhiEventManager + ) {} + + cancel(): void { + this.activeModal.dismiss(); + } + + confirmDelete(id: number): void { + this.dependencyService.delete(id).subscribe(() => { + this.eventManager.broadcast('dependencyListModification'); + this.activeModal.close(); + }); + } +} diff --git a/src/main/webapp/app/entities/dependency/dependency-detail.component.html b/src/main/webapp/app/entities/dependency/dependency-detail.component.html new file mode 100644 index 0000000..4f4bc04 --- /dev/null +++ b/src/main/webapp/app/entities/dependency/dependency-detail.component.html @@ -0,0 +1,46 @@ +
+
+
+

Dependency {{ dependency.id }}

+ +
+ + + +
+
Name
+
+ {{ dependency.name }} +
+
Description
+
+ {{ dependency.description }} +
+
Source
+
+ +
+
Target
+
+ +
+
+ + + + +
+
+
diff --git a/src/main/webapp/app/entities/dependency/dependency-detail.component.ts b/src/main/webapp/app/entities/dependency/dependency-detail.component.ts new file mode 100644 index 0000000..f2b89dc --- /dev/null +++ b/src/main/webapp/app/entities/dependency/dependency-detail.component.ts @@ -0,0 +1,31 @@ +import { Component, OnInit } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; +import { JhiDataUtils } from 'ng-jhipster'; + +import { IDependency } from 'app/shared/model/dependency.model'; + +@Component({ + selector: 'jhi-dependency-detail', + templateUrl: './dependency-detail.component.html', +}) +export class DependencyDetailComponent implements OnInit { + dependency: IDependency | null = null; + + constructor(protected dataUtils: JhiDataUtils, protected activatedRoute: ActivatedRoute) {} + + ngOnInit(): void { + this.activatedRoute.data.subscribe(({ dependency }) => (this.dependency = dependency)); + } + + byteSize(base64String: string): string { + return this.dataUtils.byteSize(base64String); + } + + openFile(contentType = '', base64String: string): void { + this.dataUtils.openFile(contentType, base64String); + } + + previousState(): void { + window.history.back(); + } +} diff --git a/src/main/webapp/app/entities/dependency/dependency-update.component.html b/src/main/webapp/app/entities/dependency/dependency-update.component.html new file mode 100644 index 0000000..cd19549 --- /dev/null +++ b/src/main/webapp/app/entities/dependency/dependency-update.component.html @@ -0,0 +1,72 @@ +
+
+
+

Create or edit a Dependency

+ +
+ + +
+ + +
+ +
+ + +
+ + This field is required. + +
+
+ +
+ + +
+ +
+ + +
+
+ + This field is required. + +
+ +
+ + +
+
+ + This field is required. + +
+
+ +
+ + + +
+
+
+
diff --git a/src/main/webapp/app/entities/dependency/dependency-update.component.ts b/src/main/webapp/app/entities/dependency/dependency-update.component.ts new file mode 100644 index 0000000..7baf5ff --- /dev/null +++ b/src/main/webapp/app/entities/dependency/dependency-update.component.ts @@ -0,0 +1,118 @@ +import { Component, OnInit } from '@angular/core'; +import { HttpResponse } from '@angular/common/http'; +// eslint-disable-next-line @typescript-eslint/no-unused-vars +import { FormBuilder, Validators } from '@angular/forms'; +import { ActivatedRoute } from '@angular/router'; +import { Observable } from 'rxjs'; +import { JhiDataUtils, JhiFileLoadError, JhiEventManager, JhiEventWithContent } from 'ng-jhipster'; + +import { IDependency, Dependency } from 'app/shared/model/dependency.model'; +import { DependencyService } from './dependency.service'; +import { AlertError } from 'app/shared/alert/alert-error.model'; +import { IMicroservice } from 'app/shared/model/microservice.model'; +import { MicroserviceService } from 'app/entities/microservice/microservice.service'; + +@Component({ + selector: 'jhi-dependency-update', + templateUrl: './dependency-update.component.html', +}) +export class DependencyUpdateComponent implements OnInit { + isSaving = false; + microservices: IMicroservice[] = []; + + editForm = this.fb.group({ + id: [], + name: [null, [Validators.required]], + description: [], + source: [null, Validators.required], + target: [null, Validators.required], + }); + + constructor( + protected dataUtils: JhiDataUtils, + protected eventManager: JhiEventManager, + protected dependencyService: DependencyService, + protected microserviceService: MicroserviceService, + protected activatedRoute: ActivatedRoute, + private fb: FormBuilder + ) {} + + ngOnInit(): void { + this.activatedRoute.data.subscribe(({ dependency }) => { + this.updateForm(dependency); + + this.microserviceService.query().subscribe((res: HttpResponse) => (this.microservices = res.body || [])); + }); + } + + updateForm(dependency: IDependency): void { + this.editForm.patchValue({ + id: dependency.id, + name: dependency.name, + description: dependency.description, + source: dependency.source, + target: dependency.target, + }); + } + + byteSize(base64String: string): string { + return this.dataUtils.byteSize(base64String); + } + + openFile(contentType: string, base64String: string): void { + this.dataUtils.openFile(contentType, base64String); + } + + setFileData(event: any, field: string, isImage: boolean): void { + this.dataUtils.loadFileToForm(event, this.editForm, field, isImage).subscribe(null, (err: JhiFileLoadError) => { + this.eventManager.broadcast( + new JhiEventWithContent('microcatalogApp.error', { ...err, key: 'error.file.' + err.key }) + ); + }); + } + + previousState(): void { + window.history.back(); + } + + save(): void { + this.isSaving = true; + const dependency = this.createFromForm(); + if (dependency.id !== undefined) { + this.subscribeToSaveResponse(this.dependencyService.update(dependency)); + } else { + this.subscribeToSaveResponse(this.dependencyService.create(dependency)); + } + } + + private createFromForm(): IDependency { + return { + ...new Dependency(), + id: this.editForm.get(['id'])!.value, + name: this.editForm.get(['name'])!.value, + description: this.editForm.get(['description'])!.value, + source: this.editForm.get(['source'])!.value, + target: this.editForm.get(['target'])!.value, + }; + } + + protected subscribeToSaveResponse(result: Observable>): void { + result.subscribe( + () => this.onSaveSuccess(), + () => this.onSaveError() + ); + } + + protected onSaveSuccess(): void { + this.isSaving = false; + this.previousState(); + } + + protected onSaveError(): void { + this.isSaving = false; + } + + trackById(index: number, item: IMicroservice): any { + return item.id; + } +} diff --git a/src/main/webapp/app/entities/dependency/dependency.component.html b/src/main/webapp/app/entities/dependency/dependency.component.html new file mode 100644 index 0000000..b521985 --- /dev/null +++ b/src/main/webapp/app/entities/dependency/dependency.component.html @@ -0,0 +1,75 @@ +
+

+ Dependencies + + +

+ + + + + +
+ No dependencies found +
+ +
+ + + + + + + + + + + + + + + + + + + + + +
IDNameDescriptionSourceTarget
{{ dependency.id }}{{ dependency.name }}{{ dependency.description }} + + + + +
+ + + + + +
+
+
+
diff --git a/src/main/webapp/app/entities/dependency/dependency.component.ts b/src/main/webapp/app/entities/dependency/dependency.component.ts new file mode 100644 index 0000000..3ab4588 --- /dev/null +++ b/src/main/webapp/app/entities/dependency/dependency.component.ts @@ -0,0 +1,62 @@ +import { Component, OnInit, OnDestroy } from '@angular/core'; +import { HttpResponse } from '@angular/common/http'; +import { Subscription } from 'rxjs'; +import { JhiEventManager, JhiDataUtils } from 'ng-jhipster'; +import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; + +import { IDependency } from 'app/shared/model/dependency.model'; +import { DependencyService } from './dependency.service'; +import { DependencyDeleteDialogComponent } from './dependency-delete-dialog.component'; + +@Component({ + selector: 'jhi-dependency', + templateUrl: './dependency.component.html', +}) +export class DependencyComponent implements OnInit, OnDestroy { + dependencies?: IDependency[]; + eventSubscriber?: Subscription; + + constructor( + protected dependencyService: DependencyService, + protected dataUtils: JhiDataUtils, + protected eventManager: JhiEventManager, + protected modalService: NgbModal + ) {} + + loadAll(): void { + this.dependencyService.query().subscribe((res: HttpResponse) => (this.dependencies = res.body || [])); + } + + ngOnInit(): void { + this.loadAll(); + this.registerChangeInDependencies(); + } + + ngOnDestroy(): void { + if (this.eventSubscriber) { + this.eventManager.destroy(this.eventSubscriber); + } + } + + trackId(index: number, item: IDependency): number { + // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion + return item.id!; + } + + byteSize(base64String: string): string { + return this.dataUtils.byteSize(base64String); + } + + openFile(contentType = '', base64String: string): void { + return this.dataUtils.openFile(contentType, base64String); + } + + registerChangeInDependencies(): void { + this.eventSubscriber = this.eventManager.subscribe('dependencyListModification', () => this.loadAll()); + } + + delete(dependency: IDependency): void { + const modalRef = this.modalService.open(DependencyDeleteDialogComponent, { size: 'lg', backdrop: 'static' }); + modalRef.componentInstance.dependency = dependency; + } +} diff --git a/src/main/webapp/app/entities/dependency/dependency.module.ts b/src/main/webapp/app/entities/dependency/dependency.module.ts new file mode 100644 index 0000000..007b0f1 --- /dev/null +++ b/src/main/webapp/app/entities/dependency/dependency.module.ts @@ -0,0 +1,16 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import { MicrocatalogSharedModule } from 'app/shared/shared.module'; +import { DependencyComponent } from './dependency.component'; +import { DependencyDetailComponent } from './dependency-detail.component'; +import { DependencyUpdateComponent } from './dependency-update.component'; +import { DependencyDeleteDialogComponent } from './dependency-delete-dialog.component'; +import { dependencyRoute } from './dependency.route'; + +@NgModule({ + imports: [MicrocatalogSharedModule, RouterModule.forChild(dependencyRoute)], + declarations: [DependencyComponent, DependencyDetailComponent, DependencyUpdateComponent, DependencyDeleteDialogComponent], + entryComponents: [DependencyDeleteDialogComponent], +}) +export class MicrocatalogDependencyModule {} diff --git a/src/main/webapp/app/entities/dependency/dependency.route.ts b/src/main/webapp/app/entities/dependency/dependency.route.ts new file mode 100644 index 0000000..5352e3c --- /dev/null +++ b/src/main/webapp/app/entities/dependency/dependency.route.ts @@ -0,0 +1,83 @@ +import { Injectable } from '@angular/core'; +import { HttpResponse } from '@angular/common/http'; +import { Resolve, ActivatedRouteSnapshot, Routes, Router } from '@angular/router'; +import { Observable, of, EMPTY } from 'rxjs'; +import { flatMap } from 'rxjs/operators'; + +import { Authority } from 'app/shared/constants/authority.constants'; +import { UserRouteAccessService } from 'app/core/auth/user-route-access-service'; +import { IDependency, Dependency } from 'app/shared/model/dependency.model'; +import { DependencyService } from './dependency.service'; +import { DependencyComponent } from './dependency.component'; +import { DependencyDetailComponent } from './dependency-detail.component'; +import { DependencyUpdateComponent } from './dependency-update.component'; + +@Injectable({ providedIn: 'root' }) +export class DependencyResolve implements Resolve { + constructor(private service: DependencyService, private router: Router) {} + + resolve(route: ActivatedRouteSnapshot): Observable | Observable { + const id = route.params['id']; + if (id) { + return this.service.find(id).pipe( + flatMap((dependency: HttpResponse) => { + if (dependency.body) { + return of(dependency.body); + } else { + this.router.navigate(['404']); + return EMPTY; + } + }) + ); + } + return of(new Dependency()); + } +} + +export const dependencyRoute: Routes = [ + { + path: '', + component: DependencyComponent, + data: { + authorities: [Authority.USER], + pageTitle: 'microcatalogApp.dependency.home.title', + }, + canActivate: [UserRouteAccessService], + }, + { + path: ':id/view', + component: DependencyDetailComponent, + resolve: { + dependency: DependencyResolve, + }, + data: { + authorities: [Authority.USER], + pageTitle: 'microcatalogApp.dependency.home.title', + }, + canActivate: [UserRouteAccessService], + }, + { + path: 'new', + component: DependencyUpdateComponent, + resolve: { + dependency: DependencyResolve, + }, + data: { + authorities: [Authority.USER], + pageTitle: 'microcatalogApp.dependency.home.title', + }, + canActivate: [UserRouteAccessService], + }, + { + path: ':id/edit', + component: DependencyUpdateComponent, + resolve: { + dependency: DependencyResolve, + }, + data: { + authorities: [Authority.USER], + pageTitle: 'microcatalogApp.dependency.home.title', + }, + canActivate: [UserRouteAccessService], + }, +]; diff --git a/src/main/webapp/app/entities/dependency/dependency.service.ts b/src/main/webapp/app/entities/dependency/dependency.service.ts new file mode 100644 index 0000000..7eb893f --- /dev/null +++ b/src/main/webapp/app/entities/dependency/dependency.service.ts @@ -0,0 +1,38 @@ +import { Injectable } from '@angular/core'; +import { HttpClient, HttpResponse } from '@angular/common/http'; +import { Observable } from 'rxjs'; + +import { SERVER_API_URL } from 'app/app.constants'; +import { createRequestOption } from 'app/shared/util/request-util'; +import { IDependency } from 'app/shared/model/dependency.model'; + +type EntityResponseType = HttpResponse; +type EntityArrayResponseType = HttpResponse; + +@Injectable({ providedIn: 'root' }) +export class DependencyService { + public resourceUrl = SERVER_API_URL + 'api/dependencies'; + + constructor(protected http: HttpClient) {} + + create(dependency: IDependency): Observable { + return this.http.post(this.resourceUrl, dependency, { observe: 'response' }); + } + + update(dependency: IDependency): Observable { + return this.http.put(this.resourceUrl, dependency, { observe: 'response' }); + } + + find(id: number): Observable { + return this.http.get(`${this.resourceUrl}/${id}`, { observe: 'response' }); + } + + query(req?: any): Observable { + const options = createRequestOption(req); + return this.http.get(this.resourceUrl, { params: options, observe: 'response' }); + } + + delete(id: number): Observable> { + return this.http.delete(`${this.resourceUrl}/${id}`, { observe: 'response' }); + } +} diff --git a/src/main/webapp/app/entities/entity.module.ts b/src/main/webapp/app/entities/entity.module.ts index f9fac28..c212877 100644 --- a/src/main/webapp/app/entities/entity.module.ts +++ b/src/main/webapp/app/entities/entity.module.ts @@ -16,6 +16,10 @@ import { RouterModule } from '@angular/router'; path: 'status', loadChildren: () => import('./status/status.module').then(m => m.MicrocatalogStatusModule), }, + { + path: 'dependency', + loadChildren: () => import('./dependency/dependency.module').then(m => m.MicrocatalogDependencyModule), + }, /* jhipster-needle-add-entity-route - JHipster will add entity modules routes here */ ]), ], diff --git a/src/main/webapp/app/layouts/navbar/navbar.component.html b/src/main/webapp/app/layouts/navbar/navbar.component.html index c785223..30f7d69 100644 --- a/src/main/webapp/app/layouts/navbar/navbar.component.html +++ b/src/main/webapp/app/layouts/navbar/navbar.component.html @@ -16,6 +16,16 @@ + +
  • + + + Dependency + +
  • diff --git a/src/main/webapp/app/shared/model/dependency.model.ts b/src/main/webapp/app/shared/model/dependency.model.ts new file mode 100644 index 0000000..40f3126 --- /dev/null +++ b/src/main/webapp/app/shared/model/dependency.model.ts @@ -0,0 +1,19 @@ +import { IMicroservice } from 'app/shared/model/microservice.model'; + +export interface IDependency { + id?: number; + name?: string; + description?: any; + source?: IMicroservice; + target?: IMicroservice; +} + +export class Dependency implements IDependency { + constructor( + public id?: number, + public name?: string, + public description?: any, + public source?: IMicroservice, + public target?: IMicroservice + ) {} +} diff --git a/src/main/webapp/content/scss/vendor.scss b/src/main/webapp/content/scss/vendor.scss index 8f778b2..be28389 100644 --- a/src/main/webapp/content/scss/vendor.scss +++ b/src/main/webapp/content/scss/vendor.scss @@ -4,6 +4,7 @@ put Sass variables here: eg $input-color: red; ****************************/ +@import '~vis-network/styles/vis-network.css'; @import '~bootswatch/dist/solar/variables'; // Override Bootstrap variables @import 'bootstrap-variables'; diff --git a/src/main/webapp/i18n/de/dependency.json b/src/main/webapp/i18n/de/dependency.json new file mode 100644 index 0000000..dc6303e --- /dev/null +++ b/src/main/webapp/i18n/de/dependency.json @@ -0,0 +1,25 @@ +{ + "microcatalogApp": { + "dependency": { + "home": { + "title": "Dependencies", + "createLabel": "Dependency erstellen", + "createOrEditLabel": "Dependency erstellen oder bearbeiten", + "notFound": "No Dependencies found" + }, + "created": "Dependency erstellt mit ID {{ param }}", + "updated": "Dependency aktualisiert mit ID {{ param }}", + "deleted": "Dependency gelöscht mit ID {{ param }}", + "delete": { + "question": "Soll Dependency {{ id }} wirklich dauerhaft gelöscht werden?" + }, + "detail": { + "title": "Dependency" + }, + "name": "Name", + "description": "Description", + "source": "Source", + "target": "Target" + } + } +} diff --git a/src/main/webapp/i18n/de/global.json b/src/main/webapp/i18n/de/global.json index a80626c..8d4b26d 100644 --- a/src/main/webapp/i18n/de/global.json +++ b/src/main/webapp/i18n/de/global.json @@ -4,12 +4,16 @@ "browsehappy": "Sie benutzen einen veralteten Browser. Bitte aktualisieren Sie Ihren Browser, um die Benutzerfreundlichkeit zu erhöhen.", "menu": { "home": "Startseite", + "dashboard": { + "dependencies": "Abhängigkeiten" + }, "jhipster-needle-menu-add-element": "JHipster will add additional menu entries here (do not translate!)", "entities": { "main": "Entitäten", "microservice": "Microservice", "team": "Team", "status": "Status", + "dependency": "Dependency", "jhipster-needle-menu-add-entry": "JHipster will add additional entities here (do not translate!)" }, "account": { diff --git a/src/main/webapp/i18n/en/dependency.json b/src/main/webapp/i18n/en/dependency.json new file mode 100644 index 0000000..09d3432 --- /dev/null +++ b/src/main/webapp/i18n/en/dependency.json @@ -0,0 +1,25 @@ +{ + "microcatalogApp": { + "dependency": { + "home": { + "title": "Dependencies", + "createLabel": "Create a new Dependency", + "createOrEditLabel": "Create or edit a Dependency", + "notFound": "No Dependencies found" + }, + "created": "A new Dependency is created with identifier {{ param }}", + "updated": "A Dependency is updated with identifier {{ param }}", + "deleted": "A Dependency is deleted with identifier {{ param }}", + "delete": { + "question": "Are you sure you want to delete Dependency {{ id }}?" + }, + "detail": { + "title": "Dependency" + }, + "name": "Name", + "description": "Description", + "source": "Source", + "target": "Target" + } + } +} diff --git a/src/main/webapp/i18n/en/global.json b/src/main/webapp/i18n/en/global.json index 5a839d6..7801eed 100644 --- a/src/main/webapp/i18n/en/global.json +++ b/src/main/webapp/i18n/en/global.json @@ -4,12 +4,16 @@ "browsehappy": "You are using an outdated browser. Please upgrade your browser to improve your experience.", "menu": { "home": "Home", + "dashboard": { + "dependencies": "Dependencies" + }, "jhipster-needle-menu-add-element": "JHipster will add additional menu entries here (do not translate!)", "entities": { "main": "Entities", "microservice": "Microservice", "team": "Team", "status": "Status", + "dependency": "Dependency", "jhipster-needle-menu-add-entry": "JHipster will add additional entities here (do not translate!)" }, "account": { diff --git a/src/test/java/com/github/microcatalog/domain/DependencyTest.java b/src/test/java/com/github/microcatalog/domain/DependencyTest.java new file mode 100644 index 0000000..6dc41d2 --- /dev/null +++ b/src/test/java/com/github/microcatalog/domain/DependencyTest.java @@ -0,0 +1,22 @@ +package com.github.microcatalog.domain; + +import org.junit.jupiter.api.Test; +import static org.assertj.core.api.Assertions.assertThat; +import com.github.microcatalog.web.rest.TestUtil; + +public class DependencyTest { + + @Test + public void equalsVerifier() throws Exception { + TestUtil.equalsVerifier(Dependency.class); + Dependency dependency1 = new Dependency(); + dependency1.setId(1L); + Dependency dependency2 = new Dependency(); + dependency2.setId(dependency1.getId()); + assertThat(dependency1).isEqualTo(dependency2); + dependency2.setId(2L); + assertThat(dependency1).isNotEqualTo(dependency2); + dependency1.setId(null); + assertThat(dependency1).isNotEqualTo(dependency2); + } +} diff --git a/src/test/java/com/github/microcatalog/web/rest/DependencyResourceIT.java b/src/test/java/com/github/microcatalog/web/rest/DependencyResourceIT.java new file mode 100644 index 0000000..503994d --- /dev/null +++ b/src/test/java/com/github/microcatalog/web/rest/DependencyResourceIT.java @@ -0,0 +1,261 @@ +package com.github.microcatalog.web.rest; + +import com.github.microcatalog.MicrocatalogApp; +import com.github.microcatalog.domain.Dependency; +import com.github.microcatalog.domain.Microservice; +import com.github.microcatalog.repository.DependencyRepository; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.http.MediaType; +import org.springframework.security.test.context.support.WithMockUser; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.Base64Utils; +import javax.persistence.EntityManager; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.hamcrest.Matchers.hasItem; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; + +/** + * Integration tests for the {@link DependencyResource} REST controller. + */ +@SpringBootTest(classes = MicrocatalogApp.class) +@AutoConfigureMockMvc +@WithMockUser +public class DependencyResourceIT { + + private static final String DEFAULT_NAME = "AAAAAAAAAA"; + private static final String UPDATED_NAME = "BBBBBBBBBB"; + + private static final String DEFAULT_DESCRIPTION = "AAAAAAAAAA"; + private static final String UPDATED_DESCRIPTION = "BBBBBBBBBB"; + + @Autowired + private DependencyRepository dependencyRepository; + + @Autowired + private EntityManager em; + + @Autowired + private MockMvc restDependencyMockMvc; + + private Dependency dependency; + + /** + * Create an entity for this test. + * + * This is a static method, as tests for other entities might also need it, + * if they test an entity which requires the current entity. + */ + public static Dependency createEntity(EntityManager em) { + Dependency dependency = new Dependency() + .name(DEFAULT_NAME) + .description(DEFAULT_DESCRIPTION); + // Add required entity + Microservice microservice; + if (TestUtil.findAll(em, Microservice.class).isEmpty()) { + microservice = MicroserviceResourceIT.createEntity(em); + em.persist(microservice); + em.flush(); + } else { + microservice = TestUtil.findAll(em, Microservice.class).get(0); + } + dependency.setSource(microservice); + // Add required entity + dependency.setTarget(microservice); + return dependency; + } + /** + * Create an updated entity for this test. + * + * This is a static method, as tests for other entities might also need it, + * if they test an entity which requires the current entity. + */ + public static Dependency createUpdatedEntity(EntityManager em) { + Dependency dependency = new Dependency() + .name(UPDATED_NAME) + .description(UPDATED_DESCRIPTION); + // Add required entity + Microservice microservice; + if (TestUtil.findAll(em, Microservice.class).isEmpty()) { + microservice = MicroserviceResourceIT.createUpdatedEntity(em); + em.persist(microservice); + em.flush(); + } else { + microservice = TestUtil.findAll(em, Microservice.class).get(0); + } + dependency.setSource(microservice); + // Add required entity + dependency.setTarget(microservice); + return dependency; + } + + @BeforeEach + public void initTest() { + dependency = createEntity(em); + } + + @Test + @Transactional + public void createDependency() throws Exception { + int databaseSizeBeforeCreate = dependencyRepository.findAll().size(); + // Create the Dependency + restDependencyMockMvc.perform(post("/api/dependencies") + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(dependency))) + .andExpect(status().isCreated()); + + // Validate the Dependency in the database + List dependencyList = dependencyRepository.findAll(); + assertThat(dependencyList).hasSize(databaseSizeBeforeCreate + 1); + Dependency testDependency = dependencyList.get(dependencyList.size() - 1); + assertThat(testDependency.getName()).isEqualTo(DEFAULT_NAME); + assertThat(testDependency.getDescription()).isEqualTo(DEFAULT_DESCRIPTION); + } + + @Test + @Transactional + public void createDependencyWithExistingId() throws Exception { + int databaseSizeBeforeCreate = dependencyRepository.findAll().size(); + + // Create the Dependency with an existing ID + dependency.setId(1L); + + // An entity with an existing ID cannot be created, so this API call must fail + restDependencyMockMvc.perform(post("/api/dependencies") + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(dependency))) + .andExpect(status().isBadRequest()); + + // Validate the Dependency in the database + List dependencyList = dependencyRepository.findAll(); + assertThat(dependencyList).hasSize(databaseSizeBeforeCreate); + } + + + @Test + @Transactional + public void checkNameIsRequired() throws Exception { + int databaseSizeBeforeTest = dependencyRepository.findAll().size(); + // set the field null + dependency.setName(null); + + // Create the Dependency, which fails. + + + restDependencyMockMvc.perform(post("/api/dependencies") + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(dependency))) + .andExpect(status().isBadRequest()); + + List dependencyList = dependencyRepository.findAll(); + assertThat(dependencyList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + public void getAllDependencies() throws Exception { + // Initialize the database + dependencyRepository.saveAndFlush(dependency); + + // Get all the dependencyList + restDependencyMockMvc.perform(get("/api/dependencies?sort=id,desc")) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) + .andExpect(jsonPath("$.[*].id").value(hasItem(dependency.getId().intValue()))) + .andExpect(jsonPath("$.[*].name").value(hasItem(DEFAULT_NAME))) + .andExpect(jsonPath("$.[*].description").value(hasItem(DEFAULT_DESCRIPTION.toString()))); + } + + @Test + @Transactional + public void getDependency() throws Exception { + // Initialize the database + dependencyRepository.saveAndFlush(dependency); + + // Get the dependency + restDependencyMockMvc.perform(get("/api/dependencies/{id}", dependency.getId())) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) + .andExpect(jsonPath("$.id").value(dependency.getId().intValue())) + .andExpect(jsonPath("$.name").value(DEFAULT_NAME)) + .andExpect(jsonPath("$.description").value(DEFAULT_DESCRIPTION.toString())); + } + @Test + @Transactional + public void getNonExistingDependency() throws Exception { + // Get the dependency + restDependencyMockMvc.perform(get("/api/dependencies/{id}", Long.MAX_VALUE)) + .andExpect(status().isNotFound()); + } + + @Test + @Transactional + public void updateDependency() throws Exception { + // Initialize the database + dependencyRepository.saveAndFlush(dependency); + + int databaseSizeBeforeUpdate = dependencyRepository.findAll().size(); + + // Update the dependency + Dependency updatedDependency = dependencyRepository.findById(dependency.getId()).get(); + // Disconnect from session so that the updates on updatedDependency are not directly saved in db + em.detach(updatedDependency); + updatedDependency + .name(UPDATED_NAME) + .description(UPDATED_DESCRIPTION); + + restDependencyMockMvc.perform(put("/api/dependencies") + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(updatedDependency))) + .andExpect(status().isOk()); + + // Validate the Dependency in the database + List dependencyList = dependencyRepository.findAll(); + assertThat(dependencyList).hasSize(databaseSizeBeforeUpdate); + Dependency testDependency = dependencyList.get(dependencyList.size() - 1); + assertThat(testDependency.getName()).isEqualTo(UPDATED_NAME); + assertThat(testDependency.getDescription()).isEqualTo(UPDATED_DESCRIPTION); + } + + @Test + @Transactional + public void updateNonExistingDependency() throws Exception { + int databaseSizeBeforeUpdate = dependencyRepository.findAll().size(); + + // If the entity doesn't have an ID, it will throw BadRequestAlertException + restDependencyMockMvc.perform(put("/api/dependencies") + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(dependency))) + .andExpect(status().isBadRequest()); + + // Validate the Dependency in the database + List dependencyList = dependencyRepository.findAll(); + assertThat(dependencyList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + public void deleteDependency() throws Exception { + // Initialize the database + dependencyRepository.saveAndFlush(dependency); + + int databaseSizeBeforeDelete = dependencyRepository.findAll().size(); + + // Delete the dependency + restDependencyMockMvc.perform(delete("/api/dependencies/{id}", dependency.getId()) + .accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isNoContent()); + + // Validate the database contains one less item + List dependencyList = dependencyRepository.findAll(); + assertThat(dependencyList).hasSize(databaseSizeBeforeDelete - 1); + } +} diff --git a/src/test/javascript/spec/app/entities/dependency/dependency-delete-dialog.component.spec.ts b/src/test/javascript/spec/app/entities/dependency/dependency-delete-dialog.component.spec.ts new file mode 100644 index 0000000..e0e0a4c --- /dev/null +++ b/src/test/javascript/spec/app/entities/dependency/dependency-delete-dialog.component.spec.ts @@ -0,0 +1,65 @@ +import { ComponentFixture, TestBed, inject, fakeAsync, tick } from '@angular/core/testing'; +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; +import { of } from 'rxjs'; +import { JhiEventManager } from 'ng-jhipster'; + +import { MicrocatalogTestModule } from '../../../test.module'; +import { MockEventManager } from '../../../helpers/mock-event-manager.service'; +import { MockActiveModal } from '../../../helpers/mock-active-modal.service'; +import { DependencyDeleteDialogComponent } from 'app/entities/dependency/dependency-delete-dialog.component'; +import { DependencyService } from 'app/entities/dependency/dependency.service'; + +describe('Component Tests', () => { + describe('Dependency Management Delete Component', () => { + let comp: DependencyDeleteDialogComponent; + let fixture: ComponentFixture; + let service: DependencyService; + let mockEventManager: MockEventManager; + let mockActiveModal: MockActiveModal; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [MicrocatalogTestModule], + declarations: [DependencyDeleteDialogComponent], + }) + .overrideTemplate(DependencyDeleteDialogComponent, '') + .compileComponents(); + fixture = TestBed.createComponent(DependencyDeleteDialogComponent); + comp = fixture.componentInstance; + service = fixture.debugElement.injector.get(DependencyService); + mockEventManager = TestBed.get(JhiEventManager); + mockActiveModal = TestBed.get(NgbActiveModal); + }); + + describe('confirmDelete', () => { + it('Should call delete service on confirmDelete', inject( + [], + fakeAsync(() => { + // GIVEN + spyOn(service, 'delete').and.returnValue(of({})); + + // WHEN + comp.confirmDelete(123); + tick(); + + // THEN + expect(service.delete).toHaveBeenCalledWith(123); + expect(mockActiveModal.closeSpy).toHaveBeenCalled(); + expect(mockEventManager.broadcastSpy).toHaveBeenCalled(); + }) + )); + + it('Should not call delete service on clear', () => { + // GIVEN + spyOn(service, 'delete'); + + // WHEN + comp.cancel(); + + // THEN + expect(service.delete).not.toHaveBeenCalled(); + expect(mockActiveModal.dismissSpy).toHaveBeenCalled(); + }); + }); + }); +}); diff --git a/src/test/javascript/spec/app/entities/dependency/dependency-detail.component.spec.ts b/src/test/javascript/spec/app/entities/dependency/dependency-detail.component.spec.ts new file mode 100644 index 0000000..4f0c697 --- /dev/null +++ b/src/test/javascript/spec/app/entities/dependency/dependency-detail.component.spec.ts @@ -0,0 +1,69 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { ActivatedRoute } from '@angular/router'; +import { of } from 'rxjs'; +import { JhiDataUtils } from 'ng-jhipster'; + +import { MicrocatalogTestModule } from '../../../test.module'; +import { DependencyDetailComponent } from 'app/entities/dependency/dependency-detail.component'; +import { Dependency } from 'app/shared/model/dependency.model'; + +describe('Component Tests', () => { + describe('Dependency Management Detail Component', () => { + let comp: DependencyDetailComponent; + let fixture: ComponentFixture; + let dataUtils: JhiDataUtils; + const route = ({ data: of({ dependency: new Dependency(123) }) } as any) as ActivatedRoute; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [MicrocatalogTestModule], + declarations: [DependencyDetailComponent], + providers: [{ provide: ActivatedRoute, useValue: route }], + }) + .overrideTemplate(DependencyDetailComponent, '') + .compileComponents(); + fixture = TestBed.createComponent(DependencyDetailComponent); + comp = fixture.componentInstance; + dataUtils = fixture.debugElement.injector.get(JhiDataUtils); + }); + + describe('OnInit', () => { + it('Should load dependency on init', () => { + // WHEN + comp.ngOnInit(); + + // THEN + expect(comp.dependency).toEqual(jasmine.objectContaining({ id: 123 })); + }); + }); + + describe('byteSize', () => { + it('Should call byteSize from JhiDataUtils', () => { + // GIVEN + spyOn(dataUtils, 'byteSize'); + const fakeBase64 = 'fake base64'; + + // WHEN + comp.byteSize(fakeBase64); + + // THEN + expect(dataUtils.byteSize).toBeCalledWith(fakeBase64); + }); + }); + + describe('openFile', () => { + it('Should call openFile from JhiDataUtils', () => { + // GIVEN + spyOn(dataUtils, 'openFile'); + const fakeContentType = 'fake content type'; + const fakeBase64 = 'fake base64'; + + // WHEN + comp.openFile(fakeContentType, fakeBase64); + + // THEN + expect(dataUtils.openFile).toBeCalledWith(fakeContentType, fakeBase64); + }); + }); + }); +}); diff --git a/src/test/javascript/spec/app/entities/dependency/dependency-update.component.spec.ts b/src/test/javascript/spec/app/entities/dependency/dependency-update.component.spec.ts new file mode 100644 index 0000000..b229357 --- /dev/null +++ b/src/test/javascript/spec/app/entities/dependency/dependency-update.component.spec.ts @@ -0,0 +1,61 @@ +import { ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing'; +import { HttpResponse } from '@angular/common/http'; +import { FormBuilder } from '@angular/forms'; +import { of } from 'rxjs'; + +import { MicrocatalogTestModule } from '../../../test.module'; +import { DependencyUpdateComponent } from 'app/entities/dependency/dependency-update.component'; +import { DependencyService } from 'app/entities/dependency/dependency.service'; +import { Dependency } from 'app/shared/model/dependency.model'; + +describe('Component Tests', () => { + describe('Dependency Management Update Component', () => { + let comp: DependencyUpdateComponent; + let fixture: ComponentFixture; + let service: DependencyService; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [MicrocatalogTestModule], + declarations: [DependencyUpdateComponent], + providers: [FormBuilder], + }) + .overrideTemplate(DependencyUpdateComponent, '') + .compileComponents(); + + fixture = TestBed.createComponent(DependencyUpdateComponent); + comp = fixture.componentInstance; + service = fixture.debugElement.injector.get(DependencyService); + }); + + describe('save', () => { + it('Should call update service on save for existing entity', fakeAsync(() => { + // GIVEN + const entity = new Dependency(123); + spyOn(service, 'update').and.returnValue(of(new HttpResponse({ body: entity }))); + comp.updateForm(entity); + // WHEN + comp.save(); + tick(); // simulate async + + // THEN + expect(service.update).toHaveBeenCalledWith(entity); + expect(comp.isSaving).toEqual(false); + })); + + it('Should call create service on save for new entity', fakeAsync(() => { + // GIVEN + const entity = new Dependency(); + spyOn(service, 'create').and.returnValue(of(new HttpResponse({ body: entity }))); + comp.updateForm(entity); + // WHEN + comp.save(); + tick(); // simulate async + + // THEN + expect(service.create).toHaveBeenCalledWith(entity); + expect(comp.isSaving).toEqual(false); + })); + }); + }); +}); diff --git a/src/test/javascript/spec/app/entities/dependency/dependency.component.spec.ts b/src/test/javascript/spec/app/entities/dependency/dependency.component.spec.ts new file mode 100644 index 0000000..0f591cb --- /dev/null +++ b/src/test/javascript/spec/app/entities/dependency/dependency.component.spec.ts @@ -0,0 +1,49 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { of } from 'rxjs'; +import { HttpHeaders, HttpResponse } from '@angular/common/http'; + +import { MicrocatalogTestModule } from '../../../test.module'; +import { DependencyComponent } from 'app/entities/dependency/dependency.component'; +import { DependencyService } from 'app/entities/dependency/dependency.service'; +import { Dependency } from 'app/shared/model/dependency.model'; + +describe('Component Tests', () => { + describe('Dependency Management Component', () => { + let comp: DependencyComponent; + let fixture: ComponentFixture; + let service: DependencyService; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [MicrocatalogTestModule], + declarations: [DependencyComponent], + }) + .overrideTemplate(DependencyComponent, '') + .compileComponents(); + + fixture = TestBed.createComponent(DependencyComponent); + comp = fixture.componentInstance; + service = fixture.debugElement.injector.get(DependencyService); + }); + + it('Should call load all on init', () => { + // GIVEN + const headers = new HttpHeaders().append('link', 'link;link'); + spyOn(service, 'query').and.returnValue( + of( + new HttpResponse({ + body: [new Dependency(123)], + headers, + }) + ) + ); + + // WHEN + comp.ngOnInit(); + + // THEN + expect(service.query).toHaveBeenCalled(); + expect(comp.dependencies && comp.dependencies[0]).toEqual(jasmine.objectContaining({ id: 123 })); + }); + }); +}); diff --git a/src/test/javascript/spec/app/entities/dependency/dependency.service.spec.ts b/src/test/javascript/spec/app/entities/dependency/dependency.service.spec.ts new file mode 100644 index 0000000..3c75ac7 --- /dev/null +++ b/src/test/javascript/spec/app/entities/dependency/dependency.service.spec.ts @@ -0,0 +1,104 @@ +import { TestBed, getTestBed } from '@angular/core/testing'; +import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; +import { DependencyService } from 'app/entities/dependency/dependency.service'; +import { IDependency, Dependency } from 'app/shared/model/dependency.model'; + +describe('Service Tests', () => { + describe('Dependency Service', () => { + let injector: TestBed; + let service: DependencyService; + let httpMock: HttpTestingController; + let elemDefault: IDependency; + let expectedResult: IDependency | IDependency[] | boolean | null; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule], + }); + expectedResult = null; + injector = getTestBed(); + service = injector.get(DependencyService); + httpMock = injector.get(HttpTestingController); + + elemDefault = new Dependency(0, 'AAAAAAA', 'AAAAAAA'); + }); + + describe('Service methods', () => { + it('should find an element', () => { + const returnedFromService = Object.assign({}, elemDefault); + + service.find(123).subscribe(resp => (expectedResult = resp.body)); + + const req = httpMock.expectOne({ method: 'GET' }); + req.flush(returnedFromService); + expect(expectedResult).toMatchObject(elemDefault); + }); + + it('should create a Dependency', () => { + const returnedFromService = Object.assign( + { + id: 0, + }, + elemDefault + ); + + const expected = Object.assign({}, returnedFromService); + + service.create(new Dependency()).subscribe(resp => (expectedResult = resp.body)); + + const req = httpMock.expectOne({ method: 'POST' }); + req.flush(returnedFromService); + expect(expectedResult).toMatchObject(expected); + }); + + it('should update a Dependency', () => { + const returnedFromService = Object.assign( + { + name: 'BBBBBB', + description: 'BBBBBB', + }, + elemDefault + ); + + const expected = Object.assign({}, returnedFromService); + + service.update(expected).subscribe(resp => (expectedResult = resp.body)); + + const req = httpMock.expectOne({ method: 'PUT' }); + req.flush(returnedFromService); + expect(expectedResult).toMatchObject(expected); + }); + + it('should return a list of Dependency', () => { + const returnedFromService = Object.assign( + { + name: 'BBBBBB', + description: 'BBBBBB', + }, + elemDefault + ); + + const expected = Object.assign({}, returnedFromService); + + service.query().subscribe(resp => (expectedResult = resp.body)); + + const req = httpMock.expectOne({ method: 'GET' }); + req.flush([returnedFromService]); + httpMock.verify(); + expect(expectedResult).toContainEqual(expected); + }); + + it('should delete a Dependency', () => { + service.delete(123).subscribe(resp => (expectedResult = resp.ok)); + + const req = httpMock.expectOne({ method: 'DELETE' }); + req.flush({ status: 200 }); + expect(expectedResult); + }); + }); + + afterEach(() => { + httpMock.verify(); + }); + }); +});