diff --git a/package-lock.json b/package-lock.json index 9222a261c..e0177e232 100644 --- a/package-lock.json +++ b/package-lock.json @@ -48,7 +48,6 @@ "jsonc-parser": "^3.2.0", "prettier": "^2.7.1", "prettier-stylelint": "^0.4.2", - "react-syntax-highlighter": "^15.5.0", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-import-css": "^3.1.0", "stylelint": "^14.9.1", @@ -61,9 +60,6 @@ "typescript": "^4.7.4", "webpack": "^5.79.0", "webpack-merge": "^5.8.0" - }, - "engines": { - "node": ">=16" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -7136,9 +7132,9 @@ } }, "node_modules/@tsconfig/node10": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", - "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.10.tgz", + "integrity": "sha512-PiaIWIoPvO6qm6t114ropMCagj6YAF24j9OkCA2mJDXFnlionEwhsBCJ8yek4aib575BI3OkART/90WsgHgLWw==", "dev": true }, "node_modules/@tsconfig/node12": { @@ -7403,12 +7399,12 @@ } }, "node_modules/@types/hast": { - "version": "2.3.10", - "resolved": "https://registry.npmjs.org/@types/hast/-/hast-2.3.10.tgz", - "integrity": "sha512-McWspRw8xx8J9HurkVBfYj0xKoE25tOFlHGdx4MJ5xORQrMGZNqJhVQWaIbm6Oyla5kYOXtDiopzKRJzEOkwJw==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz", + "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==", "dev": true, "dependencies": { - "@types/unist": "^2" + "@types/unist": "*" } }, "node_modules/@types/html-minifier-terser": { @@ -7555,9 +7551,9 @@ "dev": true }, "node_modules/@types/mdx": { - "version": "2.0.11", - "resolved": "https://registry.npmjs.org/@types/mdx/-/mdx-2.0.11.tgz", - "integrity": "sha512-HM5bwOaIQJIQbAYfax35HCKxx7a3KrK3nBtIqJgSOitivTD1y3oW9P3rxY9RkXYPUk7y/AjAohfHKmFpGE79zw==", + "version": "2.0.12", + "resolved": "https://registry.npmjs.org/@types/mdx/-/mdx-2.0.12.tgz", + "integrity": "sha512-H9VZ9YqE+H28FQVchC83RCs5xQ2J7mAAv6qdDEaWmXEVl3OpdH+xfrSUzQ1lp7U7oSTRZ0RvW08ASPJsYBi7Cw==", "dev": true }, "node_modules/@types/mime": { @@ -7625,9 +7621,9 @@ "dev": true }, "node_modules/@types/prop-types": { - "version": "15.7.11", - "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.11.tgz", - "integrity": "sha512-ga8y9v9uyeiLdpKddhxYQkxNDrfvuPrlFb0N1qnZZByvcElJaXthF1UhvCh9TLWJBEHeNtdnbysW7Y6Uq8CVng==", + "version": "15.7.12", + "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.12.tgz", + "integrity": "sha512-5zvhXYtRNRluoE/jAp4GVsSduVUzNWKkOZrCDBWYtE7biZywwdC2AcEzg+cSMLFRfVgeAFqpfNabiPjxFddV1Q==", "dev": true }, "node_modules/@types/qs": { @@ -7765,9 +7761,9 @@ "dev": true }, "node_modules/@types/unist": { - "version": "2.0.10", - "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.10.tgz", - "integrity": "sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.2.tgz", + "integrity": "sha512-dqId9J8K/vGi5Zr7oo212BGii5m3q5Hxlkwy3WpYuKPklmBEvsbMYYyLxAQpSffdLl/gdW0XUpKWFvYmyoWCoQ==", "dev": true }, "node_modules/@types/uuid": { @@ -10503,9 +10499,9 @@ } }, "node_modules/cli-table3": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.3.tgz", - "integrity": "sha512-w5Jac5SykAeZJKntOxJCrm63Eg5/4dhMWIcuTbo9rpE+brgaSZo0RuNJZeOyMgsUdhDeojvgyQLmjI+K50ZGyg==", + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.4.tgz", + "integrity": "sha512-Lm3L0p+/npIQWNIiyF/nAn7T5dnOwR3xNTHXYEBFBFVPXzCVNZ5lqEC/1eo/EVfpDsQ1I+TX4ORPQgp+UI0CRw==", "dev": true, "dependencies": { "string-width": "^4.2.0" @@ -10743,16 +10739,6 @@ "node": ">= 0.8" } }, - "node_modules/comma-separated-tokens": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-1.0.8.tgz", - "integrity": "sha512-GHuDRO12Sypu2cV70d1dkA2EUmXHgntrzbpvOB+Qy+49ypNfGgFQIC2fhhXbnyrJRynDCAARsT7Ou0M6hirpfw==", - "dev": true, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, "node_modules/commander": { "version": "9.5.0", "resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz", @@ -13723,19 +13709,6 @@ "reusify": "^1.0.4" } }, - "node_modules/fault": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/fault/-/fault-1.0.4.tgz", - "integrity": "sha512-CJ0HCB5tL5fYTEA7ToAq5+kTwd++Borf1/bifxd9iT70QcXr4MRrO3Llf8Ifs70q+SJcGHFtnIE/Nw6giCtECA==", - "dev": true, - "dependencies": { - "format": "^0.2.0" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, "node_modules/faye-websocket": { "version": "0.11.4", "resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.11.4.tgz", @@ -14243,15 +14216,6 @@ "node": ">= 0.12" } }, - "node_modules/format": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/format/-/format-0.2.2.tgz", - "integrity": "sha512-wzsgA6WOq+09wrU1tsJ09udeR/YZRaeArL9e1wPbFg3GG2yDnC2ldKpxs4xunpFF9DgqCqOIra3bc1HWrJ37Ww==", - "dev": true, - "engines": { - "node": ">=0.4.x" - } - }, "node_modules/forwarded": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", @@ -15199,15 +15163,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/hast-util-heading-rank/node_modules/@types/hast": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz", - "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==", - "dev": true, - "dependencies": { - "@types/unist": "*" - } - }, "node_modules/hast-util-is-element": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/hast-util-is-element/-/hast-util-is-element-3.0.0.tgz", @@ -15221,25 +15176,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/hast-util-is-element/node_modules/@types/hast": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz", - "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==", - "dev": true, - "dependencies": { - "@types/unist": "*" - } - }, - "node_modules/hast-util-parse-selector": { - "version": "2.2.5", - "resolved": "https://registry.npmjs.org/hast-util-parse-selector/-/hast-util-parse-selector-2.2.5.tgz", - "integrity": "sha512-7j6mrk/qqkSehsM92wQjdIgWM2/BW61u/53G6xmC8i1OmEdKLHbk419QKQUjz6LglWsfqoiHmyMRkP1BGjecNQ==", - "dev": true, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/hast-util-to-string": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/hast-util-to-string/-/hast-util-to-string-3.0.0.tgz", @@ -15253,32 +15189,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/hast-util-to-string/node_modules/@types/hast": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz", - "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==", - "dev": true, - "dependencies": { - "@types/unist": "*" - } - }, - "node_modules/hastscript": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/hastscript/-/hastscript-6.0.0.tgz", - "integrity": "sha512-nDM6bvd7lIqDUiYEiu5Sl/+6ReP0BMk/2f4U/Rooccxkj0P5nm+acM5PrGJ/t5I8qPGiqZSE6hVAwZEdZIvP4w==", - "dev": true, - "dependencies": { - "@types/hast": "^2.0.0", - "comma-separated-tokens": "^1.0.0", - "hast-util-parse-selector": "^2.0.0", - "property-information": "^5.0.0", - "space-separated-tokens": "^1.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/he": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", @@ -15328,15 +15238,6 @@ "integrity": "sha512-Rf4YVNYpKjZ6ASAmibcwTNciQ5Co5Ztq6iZPEykHpkoflnD/K5ryE/rHehFsTm4NJj8nKDhbi3eKBWGogmNnkg==", "dev": true }, - "node_modules/highlight.js": { - "version": "10.7.3", - "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.7.3.tgz", - "integrity": "sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A==", - "dev": true, - "engines": { - "node": "*" - } - }, "node_modules/history": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/history/-/history-5.3.0.tgz", @@ -19600,20 +19501,6 @@ "node": ">=0.10.0" } }, - "node_modules/lowlight": { - "version": "1.20.0", - "resolved": "https://registry.npmjs.org/lowlight/-/lowlight-1.20.0.tgz", - "integrity": "sha512-8Ktj+prEb1RoCPkEOrPMYUN/nCggB7qAWe3a7OpMjWQkh3l2RD5wKRQ+o8Q8YuI9RG/xs95waaI/E6ym/7NsTw==", - "dev": true, - "dependencies": { - "fault": "^1.0.0", - "highlight.js": "~10.7.0" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, "node_modules/lru-cache": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", @@ -20709,13 +20596,17 @@ } }, "node_modules/object.hasown": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/object.hasown/-/object.hasown-1.1.3.tgz", - "integrity": "sha512-fFI4VcYpRHvSLXxP7yiZOMAd331cPfd2p7PFDVbgUsYOfCT3tICVqXWngbjr4m49OvsBwUBQ6O2uQoJvy3RexA==", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/object.hasown/-/object.hasown-1.1.4.tgz", + "integrity": "sha512-FZ9LZt9/RHzGySlBARE3VF+gE26TxR38SdmqOqliuTnl9wrKulaQs+4dee1V+Io8VfxqzAfHu6YuRgUy8OHoTg==", "dev": true, "dependencies": { - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1" + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -21190,9 +21081,9 @@ } }, "node_modules/parse-entities": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-2.0.0.tgz", - "integrity": "sha512-kkywGpCcRYhqQIchaWqZ875wzpS/bMKhz5HnN3p7wveJTkTtyAB/AlnS0f8DFSqYW1T82t6yEAkEcB+A1I3MbQ==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-1.2.2.tgz", + "integrity": "sha512-NzfpbxW/NPrzZ/yYSoQxyqUZMZXIdCfE0OIN4ESsnptHJECoUk3FZktxNuzQf4tjt5UEopnxpYJbvYuxIFDdsg==", "dev": true, "dependencies": { "character-entities": "^1.0.0", @@ -21201,10 +21092,6 @@ "is-alphanumerical": "^1.0.0", "is-decimal": "^1.0.0", "is-hexadecimal": "^1.0.0" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" } }, "node_modules/parse-glob": { @@ -23301,15 +23188,6 @@ "node": ">= 0.8" } }, - "node_modules/prismjs": { - "version": "1.29.0", - "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.29.0.tgz", - "integrity": "sha512-Kx/1w86q/epKcmte75LNrEoT+lX8pBpavuAbvJWRXar7Hz8jrtF+e3vY751p0R8H9HdArwaCTNDDzHg/ScJK1Q==", - "dev": true, - "engines": { - "node": ">=6" - } - }, "node_modules/process": { "version": "0.11.10", "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", @@ -23376,19 +23254,6 @@ "integrity": "sha512-SVtmxhRE/CGkn3eZY1T6pC8Nln6Fr/lu1mKSgRud0eC73whjGfoAogbn78LkD8aFL0zz3bAFerKSnOl7NlErBA==", "peer": true }, - "node_modules/property-information": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/property-information/-/property-information-5.6.0.tgz", - "integrity": "sha512-YUHSPk+A30YPv+0Qf8i9Mbfe/C0hdPXk1s1jPVToV8pk8BQtpw10ct89Eo7OWkutrwqvT0eicAxlOg3dOAu8JA==", - "dev": true, - "dependencies": { - "xtend": "^4.0.0" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, "node_modules/proxy-addr": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", @@ -24037,22 +23902,6 @@ "react": "^16.3.0 || ^17.0.0 || ^18.0.0" } }, - "node_modules/react-syntax-highlighter": { - "version": "15.5.0", - "resolved": "https://registry.npmjs.org/react-syntax-highlighter/-/react-syntax-highlighter-15.5.0.tgz", - "integrity": "sha512-+zq2myprEnQmH5yw6Gqc8lD55QHnpKaU8TOcFeC/Lg/MQSs8UknEA0JC4nTZGFAXC2J2Hyj/ijJ7NlabyPi2gg==", - "dev": true, - "dependencies": { - "@babel/runtime": "^7.3.1", - "highlight.js": "^10.4.1", - "lowlight": "^1.17.0", - "prismjs": "^1.27.0", - "refractor": "^3.6.0" - }, - "peerDependencies": { - "react": ">= 0.14.0" - } - }, "node_modules/read-pkg": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", @@ -24248,30 +24097,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/refractor": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/refractor/-/refractor-3.6.0.tgz", - "integrity": "sha512-MY9W41IOWxxk31o+YvFCNyNzdkc9M20NoZK5vq6jkv4I/uh2zkWcfudj0Q1fovjUQJrNewS9NMzeTtqPf+n5EA==", - "dev": true, - "dependencies": { - "hastscript": "^6.0.0", - "parse-entities": "^2.0.0", - "prismjs": "~1.27.0" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/refractor/node_modules/prismjs": { - "version": "1.27.0", - "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.27.0.tgz", - "integrity": "sha512-t13BGPUlFDR7wRB5kQDG4jjl7XeuH6jbJGt11JHPL96qwsEHNX2+68tFXqc1/k+/jALsbSWJKUOT/hcYAZ5LkA==", - "dev": true, - "engines": { - "node": ">=6" - } - }, "node_modules/regenerate": { "version": "1.4.2", "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz", @@ -24412,31 +24237,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/rehype-external-links/node_modules/@types/hast": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz", - "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==", - "dev": true, - "dependencies": { - "@types/unist": "*" - } - }, - "node_modules/rehype-external-links/node_modules/@types/unist": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.2.tgz", - "integrity": "sha512-dqId9J8K/vGi5Zr7oo212BGii5m3q5Hxlkwy3WpYuKPklmBEvsbMYYyLxAQpSffdLl/gdW0XUpKWFvYmyoWCoQ==", - "dev": true - }, - "node_modules/rehype-external-links/node_modules/space-separated-tokens": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz", - "integrity": "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==", - "dev": true, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, "node_modules/rehype-external-links/node_modules/unist-util-is": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.0.tgz", @@ -24496,21 +24296,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/rehype-slug/node_modules/@types/hast": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz", - "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==", - "dev": true, - "dependencies": { - "@types/unist": "*" - } - }, - "node_modules/rehype-slug/node_modules/@types/unist": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.2.tgz", - "integrity": "sha512-dqId9J8K/vGi5Zr7oo212BGii5m3q5Hxlkwy3WpYuKPklmBEvsbMYYyLxAQpSffdLl/gdW0XUpKWFvYmyoWCoQ==", - "dev": true - }, "node_modules/rehype-slug/node_modules/unist-util-is": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.0.tgz", @@ -24596,20 +24381,6 @@ "xtend": "^4.0.1" } }, - "node_modules/remark-parse/node_modules/parse-entities": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-1.2.2.tgz", - "integrity": "sha512-NzfpbxW/NPrzZ/yYSoQxyqUZMZXIdCfE0OIN4ESsnptHJECoUk3FZktxNuzQf4tjt5UEopnxpYJbvYuxIFDdsg==", - "dev": true, - "dependencies": { - "character-entities": "^1.0.0", - "character-entities-legacy": "^1.0.0", - "character-reference-invalid": "^1.0.0", - "is-alphanumerical": "^1.0.0", - "is-decimal": "^1.0.0", - "is-hexadecimal": "^1.0.0" - } - }, "node_modules/remark-stringify": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/remark-stringify/-/remark-stringify-4.0.0.tgz", @@ -24632,20 +24403,6 @@ "xtend": "^4.0.1" } }, - "node_modules/remark-stringify/node_modules/parse-entities": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-1.2.2.tgz", - "integrity": "sha512-NzfpbxW/NPrzZ/yYSoQxyqUZMZXIdCfE0OIN4ESsnptHJECoUk3FZktxNuzQf4tjt5UEopnxpYJbvYuxIFDdsg==", - "dev": true, - "dependencies": { - "character-entities": "^1.0.0", - "character-entities-legacy": "^1.0.0", - "character-reference-invalid": "^1.0.0", - "is-alphanumerical": "^1.0.0", - "is-decimal": "^1.0.0", - "is-hexadecimal": "^1.0.0" - } - }, "node_modules/remove-accents": { "version": "0.5.0", "resolved": "https://registry.npmjs.org/remove-accents/-/remove-accents-0.5.0.tgz", @@ -25990,9 +25747,9 @@ } }, "node_modules/space-separated-tokens": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-1.1.5.tgz", - "integrity": "sha512-q/JSVd1Lptzhf5bkYm4ob4iWPjx0KiRe3sRFBNrVqbJkFaBm5vbbowy1mymoPNLRa52+oadOhJ+K49wsSeSjTA==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz", + "integrity": "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==", "dev": true, "funding": { "type": "github", diff --git a/package.json b/package.json index 0905be19f..c431efd9c 100644 --- a/package.json +++ b/package.json @@ -89,10 +89,6 @@ "type-fest": "^3.10.0", "typescript": "^4.7.4", "webpack": "^5.79.0", - "webpack-merge": "^5.8.0", - "react-syntax-highlighter": "^15.5.0" - }, - "engines": { - "node": ">=16" + "webpack-merge": "^5.8.0" } } diff --git a/packages/forklift-console-plugin/locales/en/plugin__forklift-console-plugin.json b/packages/forklift-console-plugin/locales/en/plugin__forklift-console-plugin.json index d54d72235..56d836ee8 100644 --- a/packages/forklift-console-plugin/locales/en/plugin__forklift-console-plugin.json +++ b/packages/forklift-console-plugin/locales/en/plugin__forklift-console-plugin.json @@ -26,7 +26,6 @@ "Actions": "Actions", "Add mapping": "Add mapping", "Add source and target providers for the migration.": "Add source and target providers for the migration.", - "Adding hooks to the plan is optional. Hooks are contained in Ansible playbooks that can be run before or after the migration.": "Adding hooks to the plan is optional. Hooks are contained in Ansible playbooks that can be run before or after the migration.", "All discovered networks have been mapped to the default network.": "All discovered networks have been mapped to the default network.", "All discovered storages have been mapped to the default storage.": "All discovered storages have been mapped to the default storage.", "All networks detected on the selected VMs require a mapping.": "All networks detected on the selected VMs require a mapping.", @@ -57,7 +56,6 @@ "Category": "Category", "Certificate change detected": "Certificate change detected", "Clear all filters": "Clear all filters", - "Click the relevant buttons within the table for managing the plan hooks.": "Click the relevant buttons within the table for managing the plan hooks.", "Click the update credentials button to save your changes, button is disabled until a change is detected.": "Click the update credentials button to save your changes, button is disabled until a change is detected.", "Click the update mappings button to save your changes, button is disabled until a change is detected.": "Click the update mappings button to save your changes, button is disabled until a change is detected.", "Cluster": "Cluster", @@ -119,7 +117,6 @@ "Edit Controller Memory limit": "Edit Controller Memory limit", "Edit credentials": "Edit credentials", "Edit Default Transfer Network": "Edit Default Transfer Network", - "Edit hooks": "Edit hooks", "Edit mappings": "Edit mappings", "Edit Maximum concurrent VM migrations": "Edit Maximum concurrent VM migrations", "Edit migration plan target namespace": "Edit migration plan target namespace", @@ -174,7 +171,6 @@ "Hide from view": "Hide from view", "Hide values": "Hide values", "Hooks": "Hooks", - "Hooks data is loading, please wait.": "Hooks data is loading, please wait.", "Hooks for virtualization": "Hooks for virtualization", "Host": "Host", "Host cluster": "Host cluster", @@ -249,7 +245,6 @@ "New name was generated for the Storage Map due to naming conflict.": "New name was generated for the Storage Map due to naming conflict.", "NICs with empty NIC profile": "NICs with empty NIC profile", "No credentials found.": "No credentials found.", - "No hooks have been added to this migration plan.": "No hooks have been added to this migration plan.", "No inventory data available.": "No inventory data available.", "No Mapping found.": "No Mapping found.", "No NetworkMaps found.": "No NetworkMaps found.", @@ -320,12 +315,10 @@ "Pods": "Pods", "Pods not found": "Pods not found", "Post migration hook": "Post migration hook", - "Post-migration": "Post-migration", "Power state": "Power state", "Powered off": "Powered off", "Powered on": "Powered on", "Pre migration hook": "Pre migration hook", - "Pre-migration": "Pre-migration", "Precopy interval (minutes)": "Precopy interval (minutes)", "Preserve CPU model": "Preserve CPU model", "Preserve the CPU model and flags the VM runs with in its oVirt cluster.": "Preserve the CPU model and flags the VM runs with in its oVirt cluster.", @@ -381,7 +374,6 @@ "Skip certificate validation": "Skip certificate validation", "Snapshot polling interval (seconds)": "Snapshot polling interval (seconds)", "Something is wrong, the data was not loaded due to an error, please try to reload the page.": "Something is wrong, the data was not loaded due to an error, please try to reload the page.", - "Something is wrong, the hooks data was not loaded due to an error, please try to reload the page.": "Something is wrong, the hooks data was not loaded due to an error, please try to reload the page.", "Something is wrong, the secret was not loaded, please try to reload the page.": "Something is wrong, the secret was not loaded, please try to reload the page.", "source": "source", "Source Only": "Source Only", @@ -415,7 +407,6 @@ "The certificate is not a valid PEM-encoded X.509 certificate": "The certificate is not a valid PEM-encoded X.509 certificate", "The chosen provider is no longer available.": "The chosen provider is no longer available.", "The current certificate does not match the certificate fetched from URL. Manually validate the fingerprint before proceeding.": "The current certificate does not match the certificate fetched from URL. Manually validate the fingerprint before proceeding.", - "The edit hooks button is disabled if the plan started running and at least one virtual machine was migrated successfully.": "The edit hooks button is disabled if the plan started running and at least one virtual machine was migrated successfully.", "The edit mappings button is disabled if the plan started running and at least one virtual machine was migrated successfully.": "The edit mappings button is disabled if the plan started running and at least one virtual machine was migrated successfully.", "The interval in minutes for precopy. Default value is 60.": "The interval in minutes for precopy. Default value is 60.", "The interval in seconds for snapshot pooling. Default value is 10.": "The interval in seconds for snapshot pooling. Default value is 10.", diff --git a/packages/forklift-console-plugin/src/modules/NetworkMaps/componenets/NetworkMapsEmptyState.tsx b/packages/forklift-console-plugin/src/modules/NetworkMaps/componenets/NetworkMapsEmptyState.tsx index 621717378..53f56eea9 100644 --- a/packages/forklift-console-plugin/src/modules/NetworkMaps/componenets/NetworkMapsEmptyState.tsx +++ b/packages/forklift-console-plugin/src/modules/NetworkMaps/componenets/NetworkMapsEmptyState.tsx @@ -3,7 +3,6 @@ import { Link } from 'react-router-dom'; import ForkliftEmptyState from 'src/components/empty-states/ForkliftEmptyState'; import automationIcon from 'src/components/empty-states/images/automation.svg'; import { getResourceUrl } from 'src/modules/Providers/utils'; -import { HELP_LINK_HREF } from 'src/utils/constants'; import { useHasSufficientProviders } from 'src/utils/fetch'; import { ForkliftTrans, useForkliftTranslation } from 'src/utils/i18n'; @@ -13,6 +12,9 @@ import { Button, Flex, FlexItem } from '@patternfly/react-core'; import { NetworkMapsAddButton } from './NetworkMapsAddButton'; +const HELP_LINK_HREF = + 'https://access.redhat.com/documentation/en-us/migration_toolkit_for_virtualization/'; + const AutomationIcon = () => ; const EmptyStatePlans: React.FC<{ namespace: string }> = ({ namespace }) => { diff --git a/packages/forklift-console-plugin/src/modules/NetworkMaps/utils/helpers/deepCopy.ts b/packages/forklift-console-plugin/src/modules/NetworkMaps/utils/helpers/deepCopy.ts deleted file mode 100644 index 2376783e5..000000000 --- a/packages/forklift-console-plugin/src/modules/NetworkMaps/utils/helpers/deepCopy.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function deepCopy(obj: T): T { - return JSON.parse(JSON.stringify(obj)); -} diff --git a/packages/forklift-console-plugin/src/modules/NetworkMaps/utils/helpers/index.ts b/packages/forklift-console-plugin/src/modules/NetworkMaps/utils/helpers/index.ts index 1e0f7481f..d6ef647b7 100644 --- a/packages/forklift-console-plugin/src/modules/NetworkMaps/utils/helpers/index.ts +++ b/packages/forklift-console-plugin/src/modules/NetworkMaps/utils/helpers/index.ts @@ -1,4 +1,3 @@ // @index(['./*', /style/g], f => `export * from '${f.path}';`) -export * from './deepCopy'; export * from './getNetworkMapPhase'; // @endindex diff --git a/packages/forklift-console-plugin/src/modules/NetworkMaps/views/details/components/MapsSection/state/reducer.ts b/packages/forklift-console-plugin/src/modules/NetworkMaps/views/details/components/MapsSection/state/reducer.ts index 323b1a74e..e5dabdedc 100644 --- a/packages/forklift-console-plugin/src/modules/NetworkMaps/views/details/components/MapsSection/state/reducer.ts +++ b/packages/forklift-console-plugin/src/modules/NetworkMaps/views/details/components/MapsSection/state/reducer.ts @@ -1,4 +1,4 @@ -import { deepCopy } from 'src/modules/NetworkMaps/utils'; +import { deepCopy } from 'src/utils'; import { V1beta1NetworkMap, V1beta1NetworkMapSpecMap } from '@kubev2v/types'; diff --git a/packages/forklift-console-plugin/src/modules/NetworkMaps/views/details/components/ProvidersSection/state/reducer.ts b/packages/forklift-console-plugin/src/modules/NetworkMaps/views/details/components/ProvidersSection/state/reducer.ts index cd8b289e7..456e6cd91 100644 --- a/packages/forklift-console-plugin/src/modules/NetworkMaps/views/details/components/ProvidersSection/state/reducer.ts +++ b/packages/forklift-console-plugin/src/modules/NetworkMaps/views/details/components/ProvidersSection/state/reducer.ts @@ -1,4 +1,4 @@ -import { deepCopy } from 'src/modules/NetworkMaps/utils'; +import { deepCopy } from 'src/utils'; import { V1beta1NetworkMap, V1beta1Provider } from '@kubev2v/types'; diff --git a/packages/forklift-console-plugin/src/modules/Plans/componenets/PlansEmptyState.tsx b/packages/forklift-console-plugin/src/modules/Plans/componenets/PlansEmptyState.tsx index 240fb8fe1..5e1866418 100644 --- a/packages/forklift-console-plugin/src/modules/Plans/componenets/PlansEmptyState.tsx +++ b/packages/forklift-console-plugin/src/modules/Plans/componenets/PlansEmptyState.tsx @@ -3,7 +3,6 @@ import { Link } from 'react-router-dom'; import ForkliftEmptyState from 'src/components/empty-states/ForkliftEmptyState'; import digitalTransformation from 'src/modules/Overview/images/digitalTransormation.svg'; import { getResourceUrl } from 'src/modules/Providers/utils'; -import { HELP_LINK_HREF } from 'src/utils/constants'; import { useHasSufficientProviders } from 'src/utils/fetch'; import { ForkliftTrans, useForkliftTranslation } from 'src/utils/i18n'; @@ -13,6 +12,9 @@ import { Button, Flex, FlexItem } from '@patternfly/react-core'; import PlansAddButton from './PlansAddButton'; +const HELP_LINK_HREF = + 'https://access.redhat.com/documentation/en-us/migration_toolkit_for_virtualization/'; + const AutomationIcon = () => ( ); diff --git a/packages/forklift-console-plugin/src/modules/Plans/utils/helpers/index.ts b/packages/forklift-console-plugin/src/modules/Plans/utils/helpers/index.ts index 2021bd039..d2865d95b 100644 --- a/packages/forklift-console-plugin/src/modules/Plans/utils/helpers/index.ts +++ b/packages/forklift-console-plugin/src/modules/Plans/utils/helpers/index.ts @@ -1,5 +1,4 @@ // @index(['./*', /style/g], f => `export * from '${f.path}';`) -export * from './deepCopy'; export * from './getMigrationPhase'; export * from './getMigrationVmsCounts'; export * from './getPhaseLabel'; diff --git a/packages/forklift-console-plugin/src/modules/Plans/views/details/PlanDetailsPage.tsx b/packages/forklift-console-plugin/src/modules/Plans/views/details/PlanDetailsPage.tsx index 499bf2fa1..ab3920c2b 100644 --- a/packages/forklift-console-plugin/src/modules/Plans/views/details/PlanDetailsPage.tsx +++ b/packages/forklift-console-plugin/src/modules/Plans/views/details/PlanDetailsPage.tsx @@ -6,11 +6,11 @@ import { HorizontalNav, K8sModel } from '@openshift-console/dynamic-plugin-sdk'; import { PlanPageHeadings } from './components'; import { PlanDetails, + PlanHooks, PlanMappings, PlanResources, PlanVirtualMachines, PlanYAML, - SimpleHooks, } from './tabs'; import './PlanDetailsPage.style.css'; @@ -55,7 +55,7 @@ const PlanDetailsPage_: React.FC<{ name: string; namespace: string }> = ({ name, { href: 'hooks', name: t('Hooks'), - component: () => , + component: () => , }, ]; diff --git a/packages/forklift-console-plugin/src/modules/Plans/views/details/components/ProvidersSection/state/reducer.ts b/packages/forklift-console-plugin/src/modules/Plans/views/details/components/ProvidersSection/state/reducer.ts index 93b37d3a8..4027f7d8a 100644 --- a/packages/forklift-console-plugin/src/modules/Plans/views/details/components/ProvidersSection/state/reducer.ts +++ b/packages/forklift-console-plugin/src/modules/Plans/views/details/components/ProvidersSection/state/reducer.ts @@ -1,4 +1,4 @@ -import { deepCopy } from 'src/modules/NetworkMaps/utils'; +import { deepCopy } from 'src/utils'; import { V1beta1Plan, V1beta1Provider } from '@kubev2v/types'; diff --git a/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Hooks/PlanHooks.tsx b/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Hooks/PlanHooks.tsx index b48c4cd38..60635ff68 100644 --- a/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Hooks/PlanHooks.tsx +++ b/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Hooks/PlanHooks.tsx @@ -1,87 +1,195 @@ -import React from 'react'; +import React, { useEffect, useReducer } from 'react'; +import { Base64 } from 'js-base64'; import SectionHeading from 'src/components/headers/SectionHeading'; import { useForkliftTranslation } from 'src/utils/i18n'; +import { CodeEditor } from '@openshift-console/dynamic-plugin-sdk'; import { - HookModelGroupVersionKind, - PlanModelGroupVersionKind, - V1beta1Hook, - V1beta1Plan, -} from '@kubev2v/types'; -import { useK8sWatchResource } from '@openshift-console/dynamic-plugin-sdk'; -import { PageSection } from '@patternfly/react-core'; - -import { PlanHooksSection } from './PlanHooksSection'; - -export type PlanHooksInitSectionProps = { - plan: V1beta1Plan; - loaded: boolean; - loadError: unknown; -}; + Button, + Divider, + Flex, + FlexItem, + Form, + FormGroup, + HelperText, + HelperTextItem, + PageSection, + Switch, + TextInput, +} from '@patternfly/react-core'; + +import { Suspend } from '../../components'; + +import { usePlanHooks } from './hooks'; +import { formReducer, initialState } from './state'; +import { onUpdatePlanHooks } from './utils'; export const PlanHooks: React.FC<{ name: string; namespace: string }> = ({ name, namespace }) => { const { t } = useForkliftTranslation(); - const [plan, loaded, loadError] = useK8sWatchResource({ - groupVersionKind: PlanModelGroupVersionKind, - namespaced: true, + const [plan, preHookResource, postHookResource, loaded, loadError] = usePlanHooks( name, namespace, - }); + ); - return ( - <> -
- - - - -
- + const [state, dispatch] = useReducer( + formReducer, + initialState(plan, preHookResource, postHookResource), ); -}; -const PlanHooksInitSection: React.FC = (props) => { - const { t } = useForkliftTranslation(); - const { plan } = props; - - // Retrieve all k8s Hooks - const [hooks, hooksLoaded, hooksLoadError] = useK8sWatchResource({ - groupVersionKind: HookModelGroupVersionKind, - namespaced: true, - isList: true, - namespace: plan.metadata?.namespace, - }); - - if (!hooksLoaded) - return ( -
- {t('Hooks data is loading, please wait.')} -
- ); - - if (hooksLoadError) - return ( -
- - {t( - 'Something is wrong, the hooks data was not loaded due to an error, please try to reload the page.', + // Init state on outside changes + useEffect(() => { + dispatch({ + type: 'INIT', + payload: initialState(plan, preHookResource, postHookResource), + }); + }, [plan, preHookResource, postHookResource]); + + // Handle user clicking "save" + async function onUpdate() { + onUpdatePlanHooks({ plan, preHookResource, postHookResource, dispatch, state }); + } + + const HooksTabAction = ( + + + + + + + + + + ); + + return ( + + {state.alertMessage && {state.alertMessage}} + + + + {HooksTabAction} + + + + + +
+ + dispatch({ type: 'PRE_HOOK_SET', payload: value })} + /> + + + {state.preHookSet && ( + <> + + dispatch({ type: 'PRE_HOOK_IMAGE', payload: value })} + aria-label="pre hook image" + /> + + + You can use a custom hook-runner image or specify a custom image, for example + quay.io/konveyor/hook-runner . + + + + + dispatch({ type: 'PRE_HOOK_PLAYBOOK', payload: value })} + minHeight="400px" + showMiniMap={false} + /> + + + Optional: Ansible playbook. If you specify a playbook, the image must be + hook-runner. + + + + )} - -
- ); - - // Search for the Plan k8s Hooks - const planHooks = - hooks?.filter((hook) => - plan?.spec?.vms?.find((vm) => - vm.hooks?.find( - (VMHook) => - VMHook.hook.name === hook.metadata?.name && - VMHook.hook.namespace === hook.metadata?.namespace, - ), - ), - ) || []; - - return ; + + + + + +
+ + dispatch({ type: 'POST_HOOK_SET', payload: value })} + /> + + + {state.postHookSet && ( + <> + + dispatch({ type: 'POST_HOOK_IMAGE', payload: value })} + aria-label="pre hook image" + /> + + + You can use a custom hook-runner image or specify a custom image, for example + quay.io/konveyor/hook-runner . + + + + + dispatch({ type: 'POST_HOOK_PLAYBOOK', payload: value })} + minHeight="400px" + showMiniMap={false} + /> + + + Optional: Ansible playbook. If you specify a playbook, the image must be + hook-runner. + + + + + )} +
+
+ + ); }; diff --git a/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Hooks/PlanHooksSection.tsx b/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Hooks/PlanHooksSection.tsx deleted file mode 100644 index 345484263..000000000 --- a/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Hooks/PlanHooksSection.tsx +++ /dev/null @@ -1,274 +0,0 @@ -import React, { ReactNode, useReducer } from 'react'; -import { Light as SyntaxHighlighter } from 'react-syntax-highlighter'; -import yaml from 'react-syntax-highlighter/dist/cjs/languages/hljs/yaml'; -import a11yLight from 'react-syntax-highlighter/dist/cjs/styles/hljs/a11y-light'; -import { Base64 } from 'js-base64'; -import { useForkliftTranslation } from 'src/utils/i18n'; - -import { TableComposable, Tbody, Td, Th, Thead, Tr } from '@kubev2v/common'; -import { - HookModelGroupVersionKind, - V1beta1Hook, - V1beta1Plan, - V1beta1PlanSpecVms, - V1beta1PlanSpecVmsHooks, -} from '@kubev2v/types'; -import { ResourceLink } from '@openshift-console/dynamic-plugin-sdk'; -import { - Alert, - Button, - Divider, - Drawer, - Flex, - FlexItem, - HelperText, - HelperTextItem, - Popover, -} from '@patternfly/react-core'; -import Pencil from '@patternfly/react-icons/dist/esm/icons/pencil-alt-icon'; - -import { hasPlanEditable } from '../../utils'; -import { canDeleteAndPatchPlanHooks } from '../../utils/canDeleteAndPatchPlan'; - -SyntaxHighlighter.registerLanguage('yaml', yaml); - -interface planHook { - hook: V1beta1Hook; - step: 'PreHook' | 'PostHook'; -} - -interface PlanHooksSectionState { - edit: boolean; - dataChanged: boolean; - alertMessage: ReactNode; -} - -type PlanHooksSectionProps = { - plan: V1beta1Plan; - planHooks: V1beta1Hook[]; -}; - -export const PlanHooksSection: React.FC = ({ plan, planHooks }) => { - const { t } = useForkliftTranslation(); - - const initialState: PlanHooksSectionState = { - edit: false, - dataChanged: false, - alertMessage: null, - }; - - const [state, dispatch] = useReducer(reducer, initialState); - - function reducer( - state: PlanHooksSectionState, - action: { type: string; payload? }, - ): PlanHooksSectionState { - switch (action.type) { - case 'TOGGLE_EDIT': { - return { ...state, edit: !state.edit }; - } - case 'SET_CANCEL': { - const dataChanged = false; - - return { - ...state, - dataChanged, - alertMessage: null, - }; - } - case 'SET_ALERT_MESSAGE': { - return { ...state, alertMessage: action.payload }; - } - default: - return state; - } - } - - // Toggles between view and edit modes - function onToggleEdit() { - dispatch({ type: 'TOGGLE_EDIT' }); - } - - // Handle user clicking "cancel" - function onCancel() { - // clear changes and return to view mode - dispatch({ type: 'SET_CANCEL' }); - dispatch({ type: 'TOGGLE_EDIT' }); - } - - const AddVmHookToList = ( - VmHook: V1beta1PlanSpecVmsHooks, - planHooks: V1beta1Hook[], - planHooksList: planHook[], - ): boolean => { - const foundVmHookInPlan = planHooks.find( - (hook) => - hook.metadata?.name === VmHook.hook.name && - hook.metadata?.namespace === VmHook.hook.namespace, - ); - const alreadyExistInList = planHooksList.find( - (hook) => - hook.hook.metadata?.name === VmHook.hook.name && - hook.hook.metadata?.namespace === VmHook.hook.namespace && - hook.step === VmHook.step, - ); - - if (!foundVmHookInPlan || alreadyExistInList) return false; // TODO: set an error message to state.alertMessage for this invalid state - if (VmHook.step !== 'PreHook' && VmHook.step !== 'PostHook') return false; // TODO: set an error message to state.alertMessage for this invalid state - - planHooksList.push({ hook: foundVmHookInPlan, step: VmHook.step }); - return true; - }; - - const getPlanHooksList = ( - planVms: V1beta1PlanSpecVms[], - planHooks: V1beta1Hook[], - ): planHook[] => { - const planHooksList: planHook[] = []; - - planVms?.filter((vm) => - vm.hooks?.filter((VmHook) => AddVmHookToList(VmHook, planHooks, planHooksList)), - ); - return planHooksList.sort((a, b) => (a.step === 'PreHook' && b.step === 'PostHook' ? -1 : 1)); - }; - - const PlanMappingsSectionEditMode: React.FC = () => { - return ( - <> - - - ); - }; - - const PlanHooksSectionViewMode: React.FC = () => { - const { t } = useForkliftTranslation(); - const DisableEditHooks = !hasPlanEditable(plan); - - return ( - <> - - {canDeleteAndPatchPlanHooks(plan) && ( - - - - - {DisableEditHooks - ? t( - 'The edit hooks button is disabled if the plan started running and at least one virtual machine was migrated successfully.', - ) - : t( - 'Adding hooks to the plan is optional. Hooks are contained in Ansible playbooks that can be run before or after the migration.', - )} - - - - - )} - {planHooks.length === 0 ? ( - - - {t('No hooks have been added to this migration plan.')} - - - ) : ( - - - - Hook - Migration step - Type - Definition - - - - {getPlanHooksList(plan?.spec?.vms, planHooks).map((planHook, i) => ( - - - - - - {planHook.step === 'PreHook' ? t(`Pre-migration`) : t(`Post-migration`)} - - - - {planHook.hook.spec?.playbook ? 'Ansible playbook' : 'Custom container image'} - - - - {planHook.hook.spec?.playbook ? ( - - {Base64.decode(planHook.hook.spec.playbook)} - - } - > - - - ) : ( - planHook.hook.spec?.image - )} - - - ))} - - - )} - - - ); - }; - - return state.edit ? ( - // Edit mode - <> - - - - - - - - {t('Click the relevant buttons within the table for managing the plan hooks.')} - - - - {state.alertMessage ? ( - <> - - {state.alertMessage?.toString()} - - - ) : null} - - - ) : ( - // View mode - <> - - - ); -}; diff --git a/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/SimpleHooks/hooks/index.ts b/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Hooks/hooks/index.ts similarity index 100% rename from packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/SimpleHooks/hooks/index.ts rename to packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Hooks/hooks/index.ts diff --git a/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/SimpleHooks/hooks/usePlanHooks.ts b/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Hooks/hooks/usePlanHooks.ts similarity index 100% rename from packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/SimpleHooks/hooks/usePlanHooks.ts rename to packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Hooks/hooks/usePlanHooks.ts diff --git a/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Hooks/index.ts b/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Hooks/index.ts index 27e4d6e96..83c625dcd 100644 --- a/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Hooks/index.ts +++ b/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Hooks/index.ts @@ -1,4 +1,6 @@ // @index(['./*', /style/g], f => `export * from '${f.path}';`) +export * from './hooks'; export * from './PlanHooks'; -export * from './PlanHooksSection'; +export * from './state'; +export * from './utils'; // @endindex diff --git a/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/SimpleHooks/state/index.ts b/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Hooks/state/index.ts similarity index 76% rename from packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/SimpleHooks/state/index.ts rename to packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Hooks/state/index.ts index d79f304c6..f7ef78e31 100644 --- a/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/SimpleHooks/state/index.ts +++ b/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Hooks/state/index.ts @@ -1,3 +1,4 @@ // @index(['./*', /style/g], f => `export * from '${f.path}';`) +export * from './initialState'; export * from './reducer'; // @endindex diff --git a/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Hooks/state/initialState.ts b/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Hooks/state/initialState.ts new file mode 100644 index 000000000..95b801310 --- /dev/null +++ b/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Hooks/state/initialState.ts @@ -0,0 +1,55 @@ +import { deepCopy } from 'src/utils'; + +import { V1beta1Hook, V1beta1Plan } from '@kubev2v/types'; + +import { FormState } from './reducer'; + +const preHookTemplate = (plan: V1beta1Plan) => ({ + spec: { image: 'quay.io/konveyor/hook-runner', playbook: '' }, + apiVersion: 'forklift.konveyor.io/v1beta1', + kind: 'Hook', + metadata: { + name: `${plan?.metadata?.name}-pre-hook`, + namespace: plan?.metadata?.namespace, + ownerReferences: [ + { + apiVersion: plan?.apiVersion, + kind: plan?.kind, + name: plan?.metadata?.name, + uid: plan?.metadata?.uid, + }, + ], + }, +}); + +const postHookTemplate = (plan: V1beta1Plan) => ({ + spec: { image: 'quay.io/konveyor/hook-runner', playbook: '' }, + apiVersion: 'forklift.konveyor.io/v1beta1', + kind: 'Hook', + metadata: { + name: `${plan?.metadata?.name}-post-hook`, + namespace: plan?.metadata?.namespace, + ownerReferences: [ + { + apiVersion: plan?.apiVersion, + kind: plan?.kind, + name: plan?.metadata?.name, + uid: plan?.metadata?.uid, + }, + ], + }, +}); + +export const initialState = ( + plan: V1beta1Plan, + preHookResource: V1beta1Hook, + postHookResource: V1beta1Hook, +): FormState => ({ + preHookSet: !!preHookResource, + postHookSet: !!postHookResource, + preHook: deepCopy(preHookResource) || preHookTemplate(plan), + postHook: deepCopy(postHookResource) || postHookTemplate(plan), + hasChanges: false, + isLoading: false, + alertMessage: undefined, +}); diff --git a/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/SimpleHooks/state/reducer.ts b/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Hooks/state/reducer.ts similarity index 97% rename from packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/SimpleHooks/state/reducer.ts rename to packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Hooks/state/reducer.ts index 9910d91bd..4da6be1a5 100644 --- a/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/SimpleHooks/state/reducer.ts +++ b/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Hooks/state/reducer.ts @@ -1,5 +1,5 @@ import { Base64 } from 'js-base64'; -import { deepCopy } from 'src/modules/Plans/utils'; +import { deepCopy } from 'src/utils'; import { V1beta1Hook } from '@kubev2v/types'; diff --git a/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/SimpleHooks/utils/createHook.ts b/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Hooks/utils/createHook.ts similarity index 100% rename from packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/SimpleHooks/utils/createHook.ts rename to packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Hooks/utils/createHook.ts diff --git a/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/SimpleHooks/utils/deleteHook.ts b/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Hooks/utils/deleteHook.ts similarity index 100% rename from packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/SimpleHooks/utils/deleteHook.ts rename to packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Hooks/utils/deleteHook.ts diff --git a/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/SimpleHooks/utils/index.ts b/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Hooks/utils/index.ts similarity index 100% rename from packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/SimpleHooks/utils/index.ts rename to packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Hooks/utils/index.ts diff --git a/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/SimpleHooks/utils/onUpdatePlanHooks.tsx b/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Hooks/utils/onUpdatePlanHooks.tsx similarity index 82% rename from packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/SimpleHooks/utils/onUpdatePlanHooks.tsx rename to packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Hooks/utils/onUpdatePlanHooks.tsx index 4e7661fad..91f4d6872 100644 --- a/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/SimpleHooks/utils/onUpdatePlanHooks.tsx +++ b/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Hooks/utils/onUpdatePlanHooks.tsx @@ -1,6 +1,6 @@ import React from 'react'; -import { deepCopy } from 'src/modules/Plans/utils'; import { AlertMessageForModals } from 'src/modules/Providers/modals'; +import { deepCopy } from 'src/utils'; import { V1beta1Hook, V1beta1Plan } from '@kubev2v/types'; @@ -35,11 +35,9 @@ export async function onUpdatePlanHooks(props: onUpdatePlanHooksProps) { // Create hook newPlan = await createHook(newPlan, state.preHook, 'PreHook'); } - } else { - if (preHookResource) { - // Delete hook - newPlan = await deleteHook(newPlan, preHookResource, 'PreHook'); - } + } else if (preHookResource) { + // Delete hook + newPlan = await deleteHook(newPlan, preHookResource, 'PreHook'); } if (state.postHookSet) { @@ -50,11 +48,9 @@ export async function onUpdatePlanHooks(props: onUpdatePlanHooksProps) { // Create hook await createHook(newPlan, state.postHook, 'PostHook'); } - } else { - if (postHookResource) { - // Delete hook - await deleteHook(newPlan, postHookResource, 'PostHook'); - } + } else if (postHookResource) { + // Delete hook + await deleteHook(newPlan, postHookResource, 'PostHook'); } dispatch({ type: 'SET_LOADING', payload: false }); diff --git a/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/SimpleHooks/utils/updateHook.ts b/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Hooks/utils/updateHook.ts similarity index 100% rename from packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/SimpleHooks/utils/updateHook.ts rename to packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Hooks/utils/updateHook.ts diff --git a/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/SimpleHooks/SimpleHooks.tsx b/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/SimpleHooks/SimpleHooks.tsx deleted file mode 100644 index d75d7a456..000000000 --- a/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/SimpleHooks/SimpleHooks.tsx +++ /dev/null @@ -1,247 +0,0 @@ -import React, { useEffect, useReducer } from 'react'; -import { Base64 } from 'js-base64'; -import SectionHeading from 'src/components/headers/SectionHeading'; -import { deepCopy } from 'src/modules/Plans/utils'; -import { useForkliftTranslation } from 'src/utils/i18n'; - -import { V1beta1Hook, V1beta1Plan } from '@kubev2v/types'; -import { CodeEditor } from '@openshift-console/dynamic-plugin-sdk'; -import { - Button, - Divider, - Flex, - FlexItem, - Form, - FormGroup, - HelperText, - HelperTextItem, - PageSection, - Switch, - TextInput, -} from '@patternfly/react-core'; - -import { Suspend } from '../../components'; - -import { usePlanHooks } from './hooks'; -import { formReducer, FormState } from './state'; -import { onUpdatePlanHooks } from './utils'; - -const preHookTemplate = (plan: V1beta1Plan) => ({ - spec: { image: 'quay.io/konveyor/hook-runner', playbook: '' }, - apiVersion: 'forklift.konveyor.io/v1beta1', - kind: 'Hook', - metadata: { - name: `${plan?.metadata?.name}-pre-hook`, - namespace: plan?.metadata?.namespace, - ownerReferences: [ - { - apiVersion: plan.apiVersion, - kind: plan.kind, - name: plan.metadata.name, - uid: plan.metadata.uid, - }, - ], - }, -}); - -const postHookTemplate = (plan: V1beta1Plan) => ({ - spec: { image: 'quay.io/konveyor/hook-runner', playbook: '' }, - apiVersion: 'forklift.konveyor.io/v1beta1', - kind: 'Hook', - metadata: { - name: `${plan?.metadata?.name}-post-hook`, - namespace: plan?.metadata?.namespace, - ownerReferences: [ - { - apiVersion: plan.apiVersion, - kind: plan.kind, - name: plan.metadata.name, - uid: plan.metadata.uid, - }, - ], - }, -}); - -const initialState = ( - plan: V1beta1Plan, - preHookResource: V1beta1Hook, - postHookResource: V1beta1Hook, -): FormState => ({ - preHookSet: !!preHookResource, - postHookSet: !!postHookResource, - preHook: deepCopy(preHookResource) || preHookTemplate(plan), - postHook: deepCopy(postHookResource) || postHookTemplate(plan), - hasChanges: false, - isLoading: false, - alertMessage: undefined, -}); - -export const SimpleHooks: React.FC<{ name: string; namespace: string }> = ({ name, namespace }) => { - const { t } = useForkliftTranslation(); - - const [plan, preHookResource, postHookResource, loaded, loadError] = usePlanHooks( - name, - namespace, - ); - - const [state, dispatch] = useReducer( - formReducer, - initialState(plan, preHookResource, postHookResource), - ); - - // Init state on outside changes - useEffect(() => { - dispatch({ - type: 'INIT', - payload: initialState(plan, preHookResource, postHookResource), - }); - }, [plan, preHookResource, postHookResource]); - - // Handle user clicking "save" - async function onUpdate() { - onUpdatePlanHooks({ plan, preHookResource, postHookResource, dispatch, state }); - } - - const HooksTabAction = ( - - - - - - - - - - ); - - return ( - - {state.alertMessage && {state.alertMessage}} - - - - {HooksTabAction} - - - - - -
- - dispatch({ type: 'PRE_HOOK_SET', payload: value })} - /> - - - {state.preHookSet && ( - <> - - dispatch({ type: 'PRE_HOOK_IMAGE', payload: value })} - aria-label="pre hook image" - /> - - - You can use a custom hook-runner image or specify a custom image, for example - quay.io/konveyor/hook-runner . - - - - - dispatch({ type: 'PRE_HOOK_PLAYBOOK', payload: value })} - minHeight="400px" - showMiniMap={false} - /> - - - Optional: Ansible playbook. If you specify a playbook, the image must be - hook-runner. - - - - - )} -
-
- - - -
- - dispatch({ type: 'POST_HOOK_SET', payload: value })} - /> - - - {state.postHookSet && ( - <> - - dispatch({ type: 'POST_HOOK_IMAGE', payload: value })} - aria-label="pre hook image" - /> - - - You can use a custom hook-runner image or specify a custom image, for example - quay.io/konveyor/hook-runner . - - - - - dispatch({ type: 'POST_HOOK_PLAYBOOK', payload: value })} - minHeight="400px" - showMiniMap={false} - /> - - - Optional: Ansible playbook. If you specify a playbook, the image must be - hook-runner. - - - - - )} -
-
-
- ); -}; diff --git a/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/SimpleHooks/index.ts b/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/SimpleHooks/index.ts deleted file mode 100644 index 72ab2d5dc..000000000 --- a/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/SimpleHooks/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -// @index(['./*', /style/g], f => `export * from '${f.path}';`) -export * from './SimpleHooks'; -export * from './state'; -export * from './utils'; -// @endindex diff --git a/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/index.ts b/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/index.ts index 55295c9f9..e647a965d 100644 --- a/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/index.ts +++ b/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/index.ts @@ -3,7 +3,6 @@ export * from './Details'; export * from './Hooks'; export * from './Mappings'; export * from './Resources'; -export * from './SimpleHooks'; export * from './VirtualMachines'; export * from './YAML'; // @endindex diff --git a/packages/forklift-console-plugin/src/modules/Providers/views/list/components/ProvidersEmptyState.tsx b/packages/forklift-console-plugin/src/modules/Providers/views/list/components/ProvidersEmptyState.tsx index f8e98401b..72e66c80b 100644 --- a/packages/forklift-console-plugin/src/modules/Providers/views/list/components/ProvidersEmptyState.tsx +++ b/packages/forklift-console-plugin/src/modules/Providers/views/list/components/ProvidersEmptyState.tsx @@ -1,5 +1,4 @@ import React, { ComponentType, ReactNode } from 'react'; -import { HELP_LINK_HREF } from 'src/utils/constants'; import { ForkliftTrans, useForkliftTranslation } from 'src/utils/i18n'; import { ExternalLink } from '@kubev2v/common'; @@ -17,6 +16,9 @@ import { Title, } from '@patternfly/react-core'; +const HELP_LINK_HREF = + 'https://access.redhat.com/documentation/en-us/migration_toolkit_for_virtualization/'; + interface ProvidersEmptyStateProps { AddButton: ReactNode; title: ReactNode; diff --git a/packages/forklift-console-plugin/src/modules/StorageMaps/componenets/StorageMapsEmptyState.tsx b/packages/forklift-console-plugin/src/modules/StorageMaps/componenets/StorageMapsEmptyState.tsx index bcb2795dc..22409cc41 100644 --- a/packages/forklift-console-plugin/src/modules/StorageMaps/componenets/StorageMapsEmptyState.tsx +++ b/packages/forklift-console-plugin/src/modules/StorageMaps/componenets/StorageMapsEmptyState.tsx @@ -3,7 +3,6 @@ import { Link } from 'react-router-dom'; import ForkliftEmptyState from 'src/components/empty-states/ForkliftEmptyState'; import automationIcon from 'src/components/empty-states/images/automation.svg'; import { getResourceUrl } from 'src/modules/Providers/utils'; -import { HELP_LINK_HREF } from 'src/utils/constants'; import { useHasSufficientProviders } from 'src/utils/fetch'; import { ForkliftTrans, useForkliftTranslation } from 'src/utils/i18n'; @@ -13,6 +12,9 @@ import { Button, Flex, FlexItem } from '@patternfly/react-core'; import { StorageMapsAddButton } from './StorageMapsAddButton'; +const HELP_LINK_HREF = + 'https://access.redhat.com/documentation/en-us/migration_toolkit_for_virtualization/'; + const AutomationIcon = () => ; const EmptyStatePlans: React.FC<{ namespace: string }> = ({ namespace }) => { diff --git a/packages/forklift-console-plugin/src/modules/StorageMaps/utils/helpers/deepCopy.ts b/packages/forklift-console-plugin/src/modules/StorageMaps/utils/helpers/deepCopy.ts deleted file mode 100644 index 2376783e5..000000000 --- a/packages/forklift-console-plugin/src/modules/StorageMaps/utils/helpers/deepCopy.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function deepCopy(obj: T): T { - return JSON.parse(JSON.stringify(obj)); -} diff --git a/packages/forklift-console-plugin/src/modules/StorageMaps/utils/helpers/index.ts b/packages/forklift-console-plugin/src/modules/StorageMaps/utils/helpers/index.ts index 1dc991c2a..2418fc036 100644 --- a/packages/forklift-console-plugin/src/modules/StorageMaps/utils/helpers/index.ts +++ b/packages/forklift-console-plugin/src/modules/StorageMaps/utils/helpers/index.ts @@ -1,4 +1,3 @@ // @index(['./*', /style/g], f => `export * from '${f.path}';`) -export * from './deepCopy'; export * from './getStorageMapPhase'; // @endindex diff --git a/packages/forklift-console-plugin/src/modules/StorageMaps/views/details/components/MapsSection/state/reducer.ts b/packages/forklift-console-plugin/src/modules/StorageMaps/views/details/components/MapsSection/state/reducer.ts index 1fd1bfe4d..b57da78cb 100644 --- a/packages/forklift-console-plugin/src/modules/StorageMaps/views/details/components/MapsSection/state/reducer.ts +++ b/packages/forklift-console-plugin/src/modules/StorageMaps/views/details/components/MapsSection/state/reducer.ts @@ -1,4 +1,4 @@ -import { deepCopy } from 'src/modules/StorageMaps/utils'; +import { deepCopy } from 'src/utils'; import { V1beta1StorageMap, V1beta1StorageMapSpecMap } from '@kubev2v/types'; diff --git a/packages/forklift-console-plugin/src/modules/StorageMaps/views/details/components/ProvidersSection/state/reducer.ts b/packages/forklift-console-plugin/src/modules/StorageMaps/views/details/components/ProvidersSection/state/reducer.ts index 993b06464..93cf53207 100644 --- a/packages/forklift-console-plugin/src/modules/StorageMaps/views/details/components/ProvidersSection/state/reducer.ts +++ b/packages/forklift-console-plugin/src/modules/StorageMaps/views/details/components/ProvidersSection/state/reducer.ts @@ -1,4 +1,4 @@ -import { deepCopy } from 'src/modules/StorageMaps/utils'; +import { deepCopy } from 'src/utils'; import { V1beta1Provider, V1beta1StorageMap } from '@kubev2v/types'; diff --git a/packages/forklift-console-plugin/src/utils/constants.ts b/packages/forklift-console-plugin/src/utils/constants.ts deleted file mode 100644 index ba58915b7..000000000 --- a/packages/forklift-console-plugin/src/utils/constants.ts +++ /dev/null @@ -1,54 +0,0 @@ -export const ACTIONS = 'actions'; -export const ALL_NAMESPACES = 'all-namespaces'; -export const API_VERSION = 'apiVersion'; -export const ARCHIVED = 'archived'; -export const CLUSTER_COUNT = 'clusterCount'; -export const CONNECTED = 'connected'; -export const CUTOVER = 'cutover'; -export const DEFAULT_TRANSFER_NETWORK_ANNOTATION = 'forklift.konveyor.io/defaultTransferNetwork'; -export const DEFAULT_TRANSFER_NETWORK = 'defaultTransferNetwork'; -export const DESCRIPTION = 'description'; -export const FROM = 'from'; -export const GVK = 'gvk'; // group version kind -export const HOST_COUNT = 'hostCount'; -export const INVENTORY = 'inventory'; -export const IS_OWNED_BY_CONTROLLER = 'isOwnedByController'; -export const KIND = 'kind'; -export const LATEST_MIGRATION = 'latestMigration'; -export const MIGRATION_COMPLETED = 'migrationCompleted'; -export const MIGRATION_STARTED = 'migrationStarted'; -export const NAME = 'name'; -export const NAMESPACE = 'namespace'; -export const NETWORK_COUNT = 'networkCount'; -export const OBJECT = 'object'; -export const OWNER = 'owner'; -export const OWNER_GVK = 'ownerGvk'; -export const MANAGED = 'managed'; -export const READY = 'ready'; -export const PHASE = 'phase'; -export const OWNER_REFERENCES = 'ownerReferences'; -export const SECRET_NAME = 'secretName'; -export const SHARED_MAPPING_ANNOTATION = 'forklift.konveyor.io/shared'; -export const SOURCE = 'source'; -export const SOURCE_GVK = 'sourceGvk'; -export const SOURCE_READY = 'sourceReady'; -export const SOURCE_RESOLVED = 'sourceResolved'; -export const STATUS = 'status'; -export const STORAGE_COUNT = 'storageCount'; -export const TARGET = 'target'; -export const TARGET_GVK = 'targetGvk'; -export const TARGET_READY = 'targetReady'; -export const TARGET_RESOLVED = 'targetResolved'; -export const TEMPLATE = 'template'; -export const TO = 'to'; -export const TYPE = 'type'; -export const UID = 'uid'; -export const URL = 'url'; -export const VALIDATED = 'validated'; -export const VM_COUNT = 'vmCount'; -export const VM_DONE = 'vmDone'; - -export const HELP_LINK_HREF = - process.env.BRAND_TYPE !== 'RedHat' - ? 'https://konveyor.github.io/forklift/' - : 'https://access.redhat.com/documentation/en-us/migration_toolkit_for_virtualization/'; diff --git a/packages/forklift-console-plugin/src/modules/Plans/utils/helpers/deepCopy.ts b/packages/forklift-console-plugin/src/utils/deepCopy.ts similarity index 100% rename from packages/forklift-console-plugin/src/modules/Plans/utils/helpers/deepCopy.ts rename to packages/forklift-console-plugin/src/utils/deepCopy.ts diff --git a/packages/forklift-console-plugin/src/utils/enums.ts b/packages/forklift-console-plugin/src/utils/enums.ts index 1d117e158..ac80fc1c9 100644 --- a/packages/forklift-console-plugin/src/utils/enums.ts +++ b/packages/forklift-console-plugin/src/utils/enums.ts @@ -1,7 +1,6 @@ -import { K8sConditionStatus } from '@kubev2v/common'; import { ProviderType } from '@kubev2v/types'; -import { MappingStatus, ProviderStatus } from './types'; +import { ProviderStatus } from './types'; export const PROVIDERS: Record = process.env.BRAND_TYPE === 'RedHat' @@ -20,17 +19,6 @@ export const PROVIDERS: Record = ova: 'OVA', }; -export const CONDITIONS: Record = { - True: 'True', - False: 'False', - Unknown: 'Unknown', -}; - -export const MAPPING_STATUS = (t: (k: string) => string): Record => ({ - Ready: t('Ready'), - NotReady: t('Not Ready'), -}); - export const PROVIDER_STATUS: Record = { Ready: 'Ready', ConnectionFailed: 'Connection Failed', @@ -38,8 +26,3 @@ export const PROVIDER_STATUS: Record = { ValidationFailed: 'Validation Failed', Unknown: 'Unknown', }; - -export const PLAN_TYPE: Record = { - Warm: 'Warm', - Cold: 'Cold', -}; diff --git a/packages/forklift-console-plugin/src/utils/index.ts b/packages/forklift-console-plugin/src/utils/index.ts new file mode 100644 index 000000000..114d532ee --- /dev/null +++ b/packages/forklift-console-plugin/src/utils/index.ts @@ -0,0 +1,8 @@ +// @index(['./*', /style/g], f => `export * from '${f.path}';`) +export * from './deepCopy'; +export * from './enums'; +export * from './fetch'; +export * from './i18n'; +export * from './resources'; +export * from './types'; +// @endindex diff --git a/packages/forklift-console-plugin/src/utils/resources.ts b/packages/forklift-console-plugin/src/utils/resources.ts index fd4b043cf..4bcfea937 100644 --- a/packages/forklift-console-plugin/src/utils/resources.ts +++ b/packages/forklift-console-plugin/src/utils/resources.ts @@ -41,16 +41,6 @@ export const referenceForObj = (obj: K8sResourceCommon) => { return referenceFor(group, version, kind); }; -export enum ResourceKind { - Provider = 'Provider', - NetworkMap = 'NetworkMap', - StorageMap = 'StorageMap', - Plan = 'Plan', - Migration = 'Migration', - Host = 'Host', - Hook = 'Hook', -} - /** * Can this provider be considered a local target provider? */ diff --git a/packages/forklift-console-plugin/src/utils/types.ts b/packages/forklift-console-plugin/src/utils/types.ts index 073d099d7..ef71f7d7a 100644 --- a/packages/forklift-console-plugin/src/utils/types.ts +++ b/packages/forklift-console-plugin/src/utils/types.ts @@ -1,34 +1,3 @@ -import { K8sGroupVersionKind } from '@openshift-console/dynamic-plugin-sdk'; - -export type Condition = { - /** identification string for the condition */ - type: string; - /** 'True' | 'False' indication for this condition */ - status: string; - /** human readable message */ - message: string; - /** higher order category this condition relates to */ - category?: string; - /** Items related to this conditions */ - items?: string[]; - /** timestamp RFC 3339 */ - lastTransitionTime?: string; - /** shorter computer friendly version of message */ - reason?: string; -}; - -export type ResourceConsolePageProps = { - kind: string; - namespace: string; -}; - -export interface ProviderRef { - name: string; - gvk: K8sGroupVersionKind; - ready: boolean; - resolved: boolean; -} - export const ProviderStatusValues = [ 'ValidationFailed', 'ConnectionFailed',