From: Tiago Melo Date: Wed, 6 May 2020 17:11:19 +0000 (+0000) Subject: mgr/dashboard: Use $localize and locl for TS translations X-Git-Tag: wip-pdonnell-testing-20200918.022351~634^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=d3436f068b51a1cc82a0e76d43d92663f5c461f7;p=ceph-ci.git mgr/dashboard: Use $localize and locl for TS translations Fixes: https://tracker.ceph.com/issues/45950 Signed-off-by: Tiago Melo --- diff --git a/src/pybind/mgr/dashboard/frontend/angular.json b/src/pybind/mgr/dashboard/frontend/angular.json index a29f222f01c..3ebca753a2b 100644 --- a/src/pybind/mgr/dashboard/frontend/angular.json +++ b/src/pybind/mgr/dashboard/frontend/angular.json @@ -54,9 +54,7 @@ "node_modules/ngx-toastr/toastr.css", "src/styles.scss" ], - "scripts": [ - "node_modules/chart.js/dist/Chart.bundle.js" - ], + "scripts": ["node_modules/chart.js/dist/Chart.bundle.js"], "stylePreprocessorOptions": { "includePaths": [ "src" diff --git a/src/pybind/mgr/dashboard/frontend/ngcc.config.js b/src/pybind/mgr/dashboard/frontend/ngcc.config.js index 2d0a64d82a6..dff8d9b7fb3 100644 --- a/src/pybind/mgr/dashboard/frontend/ngcc.config.js +++ b/src/pybind/mgr/dashboard/frontend/ngcc.config.js @@ -1,9 +1,10 @@ module.exports = { packages: { 'simplebar-angular': { - ignorableDeepImportMatchers: [ - /simplebar-core\.esm/, - ] + ignorableDeepImportMatchers: [/simplebar-core\.esm/] }, - }, + '@locl/cli': { + ignorableDeepImportMatchers: [/@angular\/localize/] + } + } }; diff --git a/src/pybind/mgr/dashboard/frontend/package-lock.json b/src/pybind/mgr/dashboard/frontend/package-lock.json index 69459333e85..7eeb202fed7 100644 --- a/src/pybind/mgr/dashboard/frontend/package-lock.json +++ b/src/pybind/mgr/dashboard/frontend/package-lock.json @@ -474,9 +474,9 @@ } }, "@babel/compat-data": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.10.4.tgz", - "integrity": "sha512-t+rjExOrSVvjQQXNp5zAIYDp00KjdvGl/TpDX5REPr0S9IAIPQMTilcfG6q8c0QFmj9lSTVySV2VTsyggvtNIw==", + "version": "7.10.5", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.10.5.tgz", + "integrity": "sha512-mPVoWNzIpYJHbWje0if7Ck36bpbtTvIxOi9+6WSK9wjGEXearAqlwBoTQvVjsAY2VIwgcs8V940geY3okzRCEw==", "dev": true, "requires": { "browserslist": "^4.12.0", @@ -512,19 +512,13 @@ } }, "@babel/generator": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.10.4.tgz", - "integrity": "sha512-toLIHUIAgcQygFZRAQcsLQV3CBuX6yOIru1kJk/qqqvcRmZrYe6WavZTSG+bB8MxhnL9YPf+pKQfuiP161q7ng==", + "version": "7.10.5", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.10.5.tgz", + "integrity": "sha512-3vXxr3FEW7E7lJZiWQ3bM4+v/Vyr9C+hpolQ8BGFr9Y8Ri2tFLWTixmwKBafDujO1WVah4fhZBeU1bieKdghig==", "requires": { - "@babel/types": "^7.10.4", + "@babel/types": "^7.10.5", "jsesc": "^2.5.1", - "lodash": "4.17.19", "source-map": "^0.5.0" - }, - "dependencies": { - "lodash": { - "version": "4.17.19" - } } }, "@babel/helper-annotate-as-pure": { @@ -571,13 +565,13 @@ } }, "@babel/helper-define-map": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-define-map/-/helper-define-map-7.10.4.tgz", - "integrity": "sha512-nIij0oKErfCnLUCWaCaHW0Bmtl2RO9cN7+u2QT8yqTywgALKlyUVOvHDElh+b5DwVC6YB1FOYFOTWcN/+41EDA==", + "version": "7.10.5", + "resolved": "https://registry.npmjs.org/@babel/helper-define-map/-/helper-define-map-7.10.5.tgz", + "integrity": "sha512-fMw4kgFB720aQFXSVaXr79pjjcW5puTCM16+rECJ/plGS+zByelE8l9nCpV1GibxTnFVmUuYG9U8wYfQHdzOEQ==", "dev": true, "requires": { "@babel/helper-function-name": "^7.10.4", - "@babel/types": "^7.10.4", + "@babel/types": "^7.10.5", "lodash": "4.17.19" }, "dependencies": { @@ -624,12 +618,12 @@ } }, "@babel/helper-member-expression-to-functions": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.10.4.tgz", - "integrity": "sha512-m5j85pK/KZhuSdM/8cHUABQTAslV47OjfIB9Cc7P+PvlAoBzdb79BGNfw8RhT5Mq3p+xGd0ZfAKixbrUZx0C7A==", + "version": "7.10.5", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.10.5.tgz", + "integrity": "sha512-HiqJpYD5+WopCXIAbQDG0zye5XYVvcO9w/DHp5GsaGkRUaamLj2bEtu6i8rnGGprAhHM3qidCMgp71HF4endhA==", "dev": true, "requires": { - "@babel/types": "^7.10.4" + "@babel/types": "^7.10.5" } }, "@babel/helper-module-imports": { @@ -642,9 +636,9 @@ } }, "@babel/helper-module-transforms": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.10.4.tgz", - "integrity": "sha512-Er2FQX0oa3nV7eM1o0tNCTx7izmQtwAQsIiaLRWtavAAEcskb0XJ5OjJbVrYXWOTr8om921Scabn4/tzlx7j1Q==", + "version": "7.10.5", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.10.5.tgz", + "integrity": "sha512-4P+CWMJ6/j1W915ITJaUkadLObmCRRSC234uctJfn/vHrsLNxsR8dwlcXv9ZhJWzl77awf+mWXSZEKt5t0OnlA==", "dev": true, "requires": { "@babel/helper-module-imports": "^7.10.4", @@ -652,7 +646,7 @@ "@babel/helper-simple-access": "^7.10.4", "@babel/helper-split-export-declaration": "^7.10.4", "@babel/template": "^7.10.4", - "@babel/types": "^7.10.4", + "@babel/types": "^7.10.5", "lodash": "4.17.19" }, "dependencies": { @@ -677,9 +671,9 @@ "dev": true }, "@babel/helper-regex": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-regex/-/helper-regex-7.10.4.tgz", - "integrity": "sha512-inWpnHGgtg5NOF0eyHlC0/74/VkdRITY9dtTpB2PrxKKn+AkVMRiZz/Adrx+Ssg+MLDesi2zohBW6MVq6b4pOQ==", + "version": "7.10.5", + "resolved": "https://registry.npmjs.org/@babel/helper-regex/-/helper-regex-7.10.5.tgz", + "integrity": "sha512-68kdUAzDrljqBrio7DYAEgCoJHxppJOERHOgOrDN7WjOzP0ZQ1LsSDRXcemzVZaLvjaJsJEESb6qt+znNuENDg==", "dev": true, "requires": { "lodash": "4.17.19" @@ -771,14 +765,14 @@ } }, "@babel/parser": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.10.4.tgz", - "integrity": "sha512-8jHII4hf+YVDsskTF6WuMB3X4Eh+PsUkC2ljq22so5rHvH+T8BzyL94VOdyFLNR8tBSVXOTbNHOKpR4TfRxVtA==" + "version": "7.10.5", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.10.5.tgz", + "integrity": "sha512-wfryxy4bE1UivvQKSQDU4/X6dr+i8bctjUjj8Zyt3DQy7NtPizJXT8M52nqpNKL+nq2PW8lxk4ZqLj0fD4B4hQ==" }, "@babel/plugin-proposal-async-generator-functions": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.10.4.tgz", - "integrity": "sha512-MJbxGSmejEFVOANAezdO39SObkURO5o/8b6fSH6D1pi9RZQt+ldppKPXfqgUWpSQ9asM6xaSaSJIaeWMDRP0Zg==", + "version": "7.10.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.10.5.tgz", + "integrity": "sha512-cNMCVezQbrRGvXJwm9fu/1sJj9bHdGAgKodZdLqOQIpfoH3raqmRPBM17+lh7CzhiKRRBrGtZL9WcjxSoGYUSg==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.10.4", @@ -1014,18 +1008,12 @@ } }, "@babel/plugin-transform-block-scoping": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.10.4.tgz", - "integrity": "sha512-J3b5CluMg3hPUii2onJDRiaVbPtKFPLEaV5dOPY5OeAbDi1iU/UbbFFTgwb7WnanaDy7bjU35kc26W3eM5Qa0A==", + "version": "7.10.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.10.5.tgz", + "integrity": "sha512-6Ycw3hjpQti0qssQcA6AMSFDHeNJ++R6dIMnpRqUjFeBBTmTDPa8zgF90OVfTvAo11mXZTlVUViY1g8ffrURLg==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.10.4", - "lodash": "4.17.19" - }, - "dependencies": { - "lodash": { - "version": "4.17.19" - } + "@babel/helper-plugin-utils": "^7.10.4" } }, "@babel/plugin-transform-classes": { @@ -1129,12 +1117,12 @@ } }, "@babel/plugin-transform-modules-amd": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.10.4.tgz", - "integrity": "sha512-3Fw+H3WLUrTlzi3zMiZWp3AR4xadAEMv6XRCYnd5jAlLM61Rn+CRJaZMaNvIpcJpQ3vs1kyifYvEVPFfoSkKOA==", + "version": "7.10.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.10.5.tgz", + "integrity": "sha512-elm5uruNio7CTLFItVC/rIzKLfQ17+fX7EVz5W0TMgIHFo1zY0Ozzx+lgwhL4plzl8OzVn6Qasx5DeEFyoNiRw==", "dev": true, "requires": { - "@babel/helper-module-transforms": "^7.10.4", + "@babel/helper-module-transforms": "^7.10.5", "@babel/helper-plugin-utils": "^7.10.4", "babel-plugin-dynamic-import-node": "^2.3.3" } @@ -1152,13 +1140,13 @@ } }, "@babel/plugin-transform-modules-systemjs": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.10.4.tgz", - "integrity": "sha512-Tb28LlfxrTiOTGtZFsvkjpyjCl9IoaRI52AEU/VIwOwvDQWtbNJsAqTXzh+5R7i74e/OZHH2c2w2fsOqAfnQYQ==", + "version": "7.10.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.10.5.tgz", + "integrity": "sha512-f4RLO/OL14/FP1AEbcsWMzpbUz6tssRaeQg11RH1BP/XnPpRoVwgeYViMFacnkaw4k4wjRSjn3ip1Uw9TaXuMw==", "dev": true, "requires": { "@babel/helper-hoist-variables": "^7.10.4", - "@babel/helper-module-transforms": "^7.10.4", + "@babel/helper-module-transforms": "^7.10.5", "@babel/helper-plugin-utils": "^7.10.4", "babel-plugin-dynamic-import-node": "^2.3.3" } @@ -1202,9 +1190,9 @@ } }, "@babel/plugin-transform-parameters": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.10.4.tgz", - "integrity": "sha512-RurVtZ/D5nYfEg0iVERXYKEgDFeesHrHfx8RT05Sq57ucj2eOYAP6eu5fynL4Adju4I/mP/I6SO0DqNWAXjfLQ==", + "version": "7.10.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.10.5.tgz", + "integrity": "sha512-xPHwUj5RdFV8l1wuYiu5S9fqWGM2DrYc24TMvUiRrPVm+SM3XeqU9BcokQX/kEUe+p2RBwy+yoiR1w/Blq6ubw==", "dev": true, "requires": { "@babel/helper-get-function-arity": "^7.10.4", @@ -1267,9 +1255,9 @@ } }, "@babel/plugin-transform-template-literals": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.10.4.tgz", - "integrity": "sha512-4NErciJkAYe+xI5cqfS8pV/0ntlY5N5Ske/4ImxAVX7mk9Rxt2bwDTGv1Msc2BRJvWQcmYEC+yoMLdX22aE4VQ==", + "version": "7.10.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.10.5.tgz", + "integrity": "sha512-V/lnPGIb+KT12OQikDvgSuesRX14ck5FfJXt6+tXhdkJ+Vsd0lDCVtF6jcB4rNClYFzaB2jusZ+lNISDk2mMMw==", "dev": true, "requires": { "@babel/helper-annotate-as-pure": "^7.10.4", @@ -1377,9 +1365,9 @@ } }, "@babel/runtime": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.10.4.tgz", - "integrity": "sha512-UpTN5yUJr9b4EX2CnGNWIvER7Ab83ibv0pcvvHc4UOdrBI5jb8bj+32cCwPX6xu0mt2daFNjYhoi+X7beH0RSw==", + "version": "7.10.5", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.10.5.tgz", + "integrity": "sha512-otddXKhdNn7d0ptoFRHtMLa8LqDxLYwTjB4nYgM1yy5N6gU/MUf8zqyyLltCH3yAVitBzmwK4us+DD0l/MauAg==", "dev": true, "requires": { "regenerator-runtime": "^0.13.4" @@ -1396,16 +1384,16 @@ } }, "@babel/traverse": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.10.4.tgz", - "integrity": "sha512-aSy7p5THgSYm4YyxNGz6jZpXf+Ok40QF3aA2LyIONkDHpAcJzDUqlCKXv6peqYUs2gmic849C/t2HKw2a2K20Q==", + "version": "7.10.5", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.10.5.tgz", + "integrity": "sha512-yc/fyv2gUjPqzTz0WHeRJH2pv7jA9kA7mBX2tXl/x5iOE81uaVPuGPtaYk7wmkx4b67mQ7NqI8rmT2pF47KYKQ==", "requires": { "@babel/code-frame": "^7.10.4", - "@babel/generator": "^7.10.4", + "@babel/generator": "^7.10.5", "@babel/helper-function-name": "^7.10.4", "@babel/helper-split-export-declaration": "^7.10.4", - "@babel/parser": "^7.10.4", - "@babel/types": "^7.10.4", + "@babel/parser": "^7.10.5", + "@babel/types": "^7.10.5", "debug": "^4.1.0", "globals": "^11.1.0", "lodash": "4.17.19" @@ -1417,9 +1405,9 @@ } }, "@babel/types": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.10.4.tgz", - "integrity": "sha512-UTCFOxC3FsFHb7lkRMVvgLzaRVamXuAs2Tz4wajva4WxtVY82eZeaUBtC2Zt95FU9TiznuC0Zk35tsim8jeVpg==", + "version": "7.10.5", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.10.5.tgz", + "integrity": "sha512-ixV66KWfCI6GKoA/2H9v6bQdbfXEwwpOdQ8cRvb4F+eyvhlaHxWFMQB4+3d9QFJXZsiiiqVrewNV0DFEQpyT4Q==", "requires": { "@babel/helper-validator-identifier": "^7.10.4", "lodash": "4.17.19", @@ -2655,235 +2643,284 @@ } } }, - "@mrmlnc/readdir-enhanced": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz", - "integrity": "sha512-bPHp6Ji8b41szTOcaP63VlnbbO5Ny6dwAATtY6JTjh5N2OLrb5Qk/Th5cRkRQhkWCt+EJsYrNB0MiL+Gpn6e3g==", - "dev": true, - "requires": { - "call-me-maybe": "^1.0.1", - "glob-to-regexp": "^0.3.0" - } - }, - "@ng-bootstrap/ng-bootstrap": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/@ng-bootstrap/ng-bootstrap/-/ng-bootstrap-6.1.0.tgz", - "integrity": "sha512-2GzkNJBKdeHkaUqaCAqSILPft0IzzHjMfAlAuGY6/ZLlVQ0glt5MTbIXtIhSbjR+OvlrljoXFLrvzs1LGdmE+A==" - }, - "@ngtools/webpack": { - "version": "9.1.7", - "resolved": "https://registry.npmjs.org/@ngtools/webpack/-/webpack-9.1.7.tgz", - "integrity": "sha512-A7VB2I42Kn+7jl0tDKzGNLAoZLWSqkKo9Hg1bmKpvAAIz+DSbq3uV+JWgGgTprM3tn0lfkVgmqk4H17HKwAOcg==", + "@locl/cli": { + "version": "0.0.1-beta.9", + "resolved": "https://registry.npmjs.org/@locl/cli/-/cli-0.0.1-beta.9.tgz", + "integrity": "sha512-sTYl4q585AftySMct/qNF4i3bTsnVxAN6g1STOUinpfx84s4JYWW9WL0sgl0bdM4sL7+AjxlYg21RxCDc6JUkg==", "dev": true, "requires": { - "@angular-devkit/core": "9.1.7", - "enhanced-resolve": "4.1.1", - "rxjs": "6.5.4", - "webpack-sources": "1.4.3" + "@babel/core": "^7.8.6", + "chalk": "^3.0.0", + "find-up": "^4.1.0", + "glob": "^7.1.2", + "yargs": "^13.1.0" }, "dependencies": { - "rxjs": { - "version": "6.5.4", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.4.tgz", - "integrity": "sha512-naMQXcgEo3csAEGvw/NydRA0fuS2nDZJiw1YUWFKU7aPPAPGZEsD4Iimit96qwCieH6y614MCLYwdkrWx7z/7Q==", + "@babel/core": { + "version": "7.10.5", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.10.5.tgz", + "integrity": "sha512-O34LQooYVDXPl7QWCdW9p4NR+QlzOr7xShPPJz8GsuCU3/8ua/wqTr7gmnxXv+WBESiGU/G5s16i6tUvHkNb+w==", "dev": true, "requires": { - "tslib": "^1.9.0" + "@babel/code-frame": "^7.10.4", + "@babel/generator": "^7.10.5", + "@babel/helper-module-transforms": "^7.10.5", + "@babel/helpers": "^7.10.4", + "@babel/parser": "^7.10.5", + "@babel/template": "^7.10.4", + "@babel/traverse": "^7.10.5", + "@babel/types": "^7.10.5", + "convert-source-map": "^1.7.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.1", + "json5": "^2.1.2", + "lodash": "4.17.19", + "resolve": "^1.3.2", + "semver": "^5.4.1", + "source-map": "^0.5.0" + }, + "dependencies": { + "lodash": { + "version": "4.17.19" + } } - } - } - }, - "@ngx-translate/i18n-polyfill": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@ngx-translate/i18n-polyfill/-/i18n-polyfill-1.0.0.tgz", - "integrity": "sha512-+UKmSr6cWBJiMDex6w2FwVjEeVnlEsINDGYvTgRaFRI3/IKZrsSVcfISDcBX2wWr6m4jumfOyCcimIl2TxcaoA==", - "requires": { - "glob": "7.1.2", - "tslib": "^1.9.0", - "yargs": "10.0.3" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" }, - "camelcase": { + "ansi-regex": { "version": "4.1.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", - "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=" + "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=", + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, "requires": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wrap-ansi": "^2.0.0" - }, - "dependencies": { - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - } + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" } }, - "find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, "requires": { - "locate-path": "^2.0.0" + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" } }, - "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==" - }, - "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=", + "cliui": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", + "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", + "dev": true, "requires": { - "number-is-nan": "^1.0.0" + "string-width": "^3.1.0", + "strip-ansi": "^5.2.0", + "wrap-ansi": "^5.1.0" } }, - "locate-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", - "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, "requires": { - "p-locate": "^2.0.0", - "path-exists": "^3.0.0" + "color-name": "~1.1.4" } }, - "p-limit": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", - "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "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 + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "is-fullwidth-code-point": { + "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": { - "p-try": "^1.0.0" + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" } }, "p-locate": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", - "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "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": "^1.1.0" + "p-limit": "^2.0.0" } }, - "p-try": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", - "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=" - }, "path-exists": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=" - }, - "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=" + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true }, "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "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": { + "emoji-regex": "^7.0.1", "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=" - }, - "is-fullwidth-code-point": { - "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=" - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "requires": { - "ansi-regex": "^3.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" + } + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" } }, "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" }, "dependencies": { - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" + "color-convert": "^1.9.0" } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true } } }, - "y18n": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", - "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=" - }, "yargs": { - "version": "10.0.3", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-10.0.3.tgz", - "integrity": "sha512-DqBpQ8NAUX4GyPP/ijDGHsJya4tYqLQrjPr95HNsr1YwL3+daCfvBwg7+gIC6IdJhR2kATh3hb61vjzMWEtjdw==", + "version": "13.3.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", + "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", + "dev": true, "requires": { - "cliui": "^3.2.0", - "decamelize": "^1.1.1", - "find-up": "^2.1.0", - "get-caller-file": "^1.0.1", - "os-locale": "^2.0.0", + "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": "^2.0.0", + "string-width": "^3.0.0", "which-module": "^2.0.0", - "y18n": "^3.2.1", - "yargs-parser": "^8.0.0" + "y18n": "^4.0.0", + "yargs-parser": "^13.1.2" + }, + "dependencies": { + "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" + } + } } }, "yargs-parser": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-8.1.0.tgz", - "integrity": "sha512-yP+6QqN8BmrgW2ggLtTbdrOyBNSI7zBa4IykmiV5R1wl1JWNxQvWhMfMdmzIYtKU7oP3OOInY/tl2ov3BDjnJQ==", + "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": "^4.1.0" + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + } + } + }, + "@mrmlnc/readdir-enhanced": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz", + "integrity": "sha512-bPHp6Ji8b41szTOcaP63VlnbbO5Ny6dwAATtY6JTjh5N2OLrb5Qk/Th5cRkRQhkWCt+EJsYrNB0MiL+Gpn6e3g==", + "dev": true, + "requires": { + "call-me-maybe": "^1.0.1", + "glob-to-regexp": "^0.3.0" + } + }, + "@ng-bootstrap/ng-bootstrap": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@ng-bootstrap/ng-bootstrap/-/ng-bootstrap-6.1.0.tgz", + "integrity": "sha512-2GzkNJBKdeHkaUqaCAqSILPft0IzzHjMfAlAuGY6/ZLlVQ0glt5MTbIXtIhSbjR+OvlrljoXFLrvzs1LGdmE+A==" + }, + "@ngtools/webpack": { + "version": "9.1.7", + "resolved": "https://registry.npmjs.org/@ngtools/webpack/-/webpack-9.1.7.tgz", + "integrity": "sha512-A7VB2I42Kn+7jl0tDKzGNLAoZLWSqkKo9Hg1bmKpvAAIz+DSbq3uV+JWgGgTprM3tn0lfkVgmqk4H17HKwAOcg==", + "dev": true, + "requires": { + "@angular-devkit/core": "9.1.7", + "enhanced-resolve": "4.1.1", + "rxjs": "6.5.4", + "webpack-sources": "1.4.3" + }, + "dependencies": { + "rxjs": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.4.tgz", + "integrity": "sha512-naMQXcgEo3csAEGvw/NydRA0fuS2nDZJiw1YUWFKU7aPPAPGZEsD4Iimit96qwCieH6y614MCLYwdkrWx7z/7Q==", + "dev": true, + "requires": { + "tslib": "^1.9.0" } } } @@ -3003,19 +3040,19 @@ }, "dependencies": { "@babel/core": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.10.4.tgz", - "integrity": "sha512-3A0tS0HWpy4XujGc7QtOIHTeNwUgWaZc/WuS5YQrfhU67jnVmsD6OGPc1AKHH0LJHQICGncy3+YUjIhVlfDdcA==", + "version": "7.10.5", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.10.5.tgz", + "integrity": "sha512-O34LQooYVDXPl7QWCdW9p4NR+QlzOr7xShPPJz8GsuCU3/8ua/wqTr7gmnxXv+WBESiGU/G5s16i6tUvHkNb+w==", "dev": true, "requires": { "@babel/code-frame": "^7.10.4", - "@babel/generator": "^7.10.4", - "@babel/helper-module-transforms": "^7.10.4", + "@babel/generator": "^7.10.5", + "@babel/helper-module-transforms": "^7.10.5", "@babel/helpers": "^7.10.4", - "@babel/parser": "^7.10.4", + "@babel/parser": "^7.10.5", "@babel/template": "^7.10.4", - "@babel/traverse": "^7.10.4", - "@babel/types": "^7.10.4", + "@babel/traverse": "^7.10.5", + "@babel/types": "^7.10.5", "convert-source-map": "^1.7.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.1", @@ -3090,9 +3127,9 @@ } }, "@types/chart.js": { - "version": "2.9.22", - "resolved": "https://registry.npmjs.org/@types/chart.js/-/chart.js-2.9.22.tgz", - "integrity": "sha512-CneMxwh2T5fyMpXE5fuprTTmFtlLyZUFq1A3laUrCgOblDzupgiohrFg3jjsTIrqRI5K4qLZdrLN4zT9/MY5Dw==", + "version": "2.9.23", + "resolved": "https://registry.npmjs.org/@types/chart.js/-/chart.js-2.9.23.tgz", + "integrity": "sha512-4QQNE/b+digosu3mnj4E7aNQGKnlpzXa9JvQYPtexpO7v9gnDeqwc1DxF8vLJWLDCNoO6hH0EgO8K/7PtJl8wg==", "requires": { "moment": "^2.10.2" } @@ -4821,15 +4858,6 @@ "path-is-absolute": "^1.0.0" } }, - "lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", - "dev": true, - "requires": { - "yallist": "^3.0.2" - } - }, "mkdirp": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", @@ -4844,12 +4872,6 @@ "requires": { "glob": "^7.1.3" } - }, - "yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", - "dev": true } } }, @@ -4946,9 +4968,9 @@ } }, "caniuse-lite": { - "version": "1.0.30001099", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001099.tgz", - "integrity": "sha512-sdS9A+sQTk7wKoeuZBN/YMAHVztUfVnjDi4/UV3sDE8xoh7YR12hKW+pIdB3oqKGwr9XaFL2ovfzt9w8eUI5CA==", + "version": "1.0.30001100", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001100.tgz", + "integrity": "sha512-0eYdp1+wFCnMlCj2oudciuQn2B9xAFq3WpgpcBIZTxk/1HNA/O2YA7rpeYhnOqsqAJq1AHUgx6i1jtafg7m2zA==", "dev": true }, "canonical-path": { @@ -5129,9 +5151,9 @@ } }, "chokidar": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.0.tgz", - "integrity": "sha512-aXAaho2VJtisB/1fg1+3nlLJqGOuewTzQpd/Tz0yTg2R0e4IGtshYvtjowyEumcBv2z+y4+kc75Mz7j5xJskcQ==", + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.1.tgz", + "integrity": "sha512-TQTJyr2stihpC4Sya9hs2Xh+O2wf+igjL36Y75xx2WdHuiICcn/XJza46Jwt0eT5hVpQOzo3FpY3cj3RVYLX0g==", "dev": true, "requires": { "anymatch": "~3.1.1", @@ -5407,7 +5429,8 @@ "code-point-at": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "dev": true }, "codelyzer": { "version": "5.2.2", @@ -5813,15 +5836,6 @@ "json5": "^1.0.1" } }, - "lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", - "dev": true, - "requires": { - "yallist": "^3.0.2" - } - }, "rimraf": { "version": "2.7.1", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", @@ -5850,12 +5864,6 @@ "requires": { "figgy-pudding": "^3.5.1" } - }, - "yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", - "dev": true } } }, @@ -5956,11 +5964,14 @@ } }, "cross-spawn": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", - "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "dev": true, "requires": { - "lru-cache": "^4.0.1", + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", "shebang-command": "^1.2.0", "which": "^1.2.9" } @@ -6357,34 +6368,6 @@ "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", "dev": true }, - "cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", - "dev": true, - "requires": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - } - }, - "execa": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", - "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", - "dev": true, - "requires": { - "cross-spawn": "^6.0.0", - "get-stream": "^4.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - } - }, "fs-extra": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", @@ -6396,15 +6379,6 @@ "universalify": "^0.1.0" } }, - "get-stream": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", - "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - }, "glob": { "version": "7.1.6", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", @@ -6580,62 +6554,23 @@ "deep-is": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", - "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", - "dev": true - }, - "deepmerge": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", - "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==", - "dev": true - }, - "default-gateway": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/default-gateway/-/default-gateway-4.2.0.tgz", - "integrity": "sha512-h6sMrVB1VMWVrW13mSc6ia/DwYYw5MN6+exNu1OaJeFac5aSAvwM7lZ0NVfTABuSkQelr4h5oebg3KB1XPdjgA==", - "dev": true, - "requires": { - "execa": "^1.0.0", - "ip-regex": "^2.1.0" - }, - "dependencies": { - "cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", - "dev": true, - "requires": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - } - }, - "execa": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", - "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", - "dev": true, - "requires": { - "cross-spawn": "^6.0.0", - "get-stream": "^4.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - } - }, - "get-stream": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", - "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - } + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "dev": true + }, + "deepmerge": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", + "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==", + "dev": true + }, + "default-gateway": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/default-gateway/-/default-gateway-4.2.0.tgz", + "integrity": "sha512-h6sMrVB1VMWVrW13mSc6ia/DwYYw5MN6+exNu1OaJeFac5aSAvwM7lZ0NVfTABuSkQelr4h5oebg3KB1XPdjgA==", + "dev": true, + "requires": { + "execa": "^1.0.0", + "ip-regex": "^2.1.0" } }, "defaults": { @@ -7037,9 +6972,9 @@ "dev": true }, "electron-to-chromium": { - "version": "1.3.497", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.497.tgz", - "integrity": "sha512-sPdW5bUDZwiFtoonuZCUwRGzsZmKzcLM0bMVhp6SMCfUG+B3faENLx3cE+o+K0Jl+MPuNA9s9cScyFjOlixZpQ==", + "version": "1.3.498", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.498.tgz", + "integrity": "sha512-W1hGwaQEU8j9su2jeAr3aabkPuuXw+j8t73eajGAkEJWbfWiwbxBwQN/8Qmv2qCy3uCDm2rOAaZneYQM8VGC4w==", "dev": true }, "elegant-spinner": { @@ -7275,9 +7210,9 @@ } }, "escalade": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.0.1.tgz", - "integrity": "sha512-DR6NO3h9niOT+MZs7bjxlj2a1k+POu5RN8CLTPX2+i78bRi9eLe7+0zXgUHMnGXWybYcL61E9hGhPKqedy8tQA==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.0.2.tgz", + "integrity": "sha512-gPYAU37hYCUhW5euPeR+Y74F7BL+IBsV93j5cvGriSaD1aG6MGsqsV1yamRdrWrb2j3aiZvb0X+UBOWpx3JWtQ==", "dev": true }, "escape-html": { @@ -7431,12 +7366,13 @@ "dev": true }, "execa": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", - "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", + "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", + "dev": true, "requires": { - "cross-spawn": "^5.0.1", - "get-stream": "^3.0.0", + "cross-spawn": "^6.0.0", + "get-stream": "^4.0.0", "is-stream": "^1.1.0", "npm-run-path": "^2.0.0", "p-finally": "^1.0.0", @@ -8365,9 +8301,13 @@ "dev": true }, "get-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", - "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=" + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } }, "get-value": { "version": "2.0.6", @@ -8750,12 +8690,6 @@ "requires": { "yallist": "^4.0.0" } - }, - "yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true } } }, @@ -8892,34 +8826,6 @@ "wrap-ansi": "^2.0.0" } }, - "cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", - "dev": true, - "requires": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - } - }, - "execa": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", - "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", - "dev": true, - "requires": { - "cross-spawn": "^6.0.0", - "get-stream": "^4.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - } - }, "find-up": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", @@ -8935,36 +8841,12 @@ "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==", "dev": true }, - "get-stream": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", - "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - }, - "invert-kv": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz", - "integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==", - "dev": true - }, "is-fullwidth-code-point": { "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 }, - "lcid": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz", - "integrity": "sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA==", - "dev": true, - "requires": { - "invert-kv": "^2.0.0" - } - }, "locate-path": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", @@ -8975,37 +8857,6 @@ "path-exists": "^3.0.0" } }, - "mem": { - "dev": true, - "requires": { - "map-age-cleaner": "^0.1.1", - "mimic-fn": "^2.0.0", - "p-is-promise": "^2.0.0" - }, - "version": "4.3.0" - }, - "mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true - }, - "os-locale": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.1.0.tgz", - "integrity": "sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q==", - "dev": true, - "requires": { - "execa": "^1.0.0", - "lcid": "^2.0.0", - "mem": "4.3.0" - }, - "dependencies": { - "mem": { - "version": "4.3.0" - } - } - }, "p-limit": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", @@ -9582,9 +9433,10 @@ } }, "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=" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz", + "integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==", + "dev": true }, "ip": { "version": "1.1.5", @@ -9954,7 +9806,8 @@ "is-stream": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=" + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true }, "is-svg": { "version": "3.0.0", @@ -10025,7 +9878,8 @@ "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true }, "isobject": { "version": "3.0.1", @@ -12788,11 +12642,12 @@ "dev": true }, "lcid": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", - "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz", + "integrity": "sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA==", + "dev": true, "requires": { - "invert-kv": "^1.0.0" + "invert-kv": "^2.0.0" } }, "less": { @@ -13075,6 +12930,12 @@ "escape-string-regexp": "^1.0.5" } }, + "mimic-fn": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", + "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", + "dev": true + }, "onetime": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", @@ -13483,6 +13344,12 @@ "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", "dev": true }, + "mimic-fn": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", + "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", + "dev": true + }, "onetime": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", @@ -13571,12 +13438,20 @@ } }, "lru-cache": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", - "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, "requires": { - "pseudomap": "^1.0.2", - "yallist": "^2.1.2" + "yallist": "^3.0.2" + }, + "dependencies": { + "yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true + } } }, "lunr": { @@ -13672,15 +13547,6 @@ "path-is-absolute": "^1.0.0" } }, - "lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", - "dev": true, - "requires": { - "yallist": "^3.0.2" - } - }, "rimraf": { "version": "2.7.1", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", @@ -13698,12 +13564,6 @@ "requires": { "figgy-pudding": "^3.5.1" } - }, - "yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", - "dev": true } } }, @@ -13827,10 +13687,15 @@ "dev": true }, "mem": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/mem/-/mem-4.3.0.tgz", + "integrity": "sha512-qX2bG48pTqYRVmDB37rn/6PT7LcR8T7oAX3bf99u1Tt1nzxYfxkgqDwUwolPlXweM0XzBOBFzSx4kfp7KP1s/w==", + "dev": true, "requires": { - "mimic-fn": "^1.0.0" - }, - "version": "4.3.0" + "map-age-cleaner": "^0.1.1", + "mimic-fn": "^2.0.0", + "p-is-promise": "^2.0.0" + } }, "memory-fs": { "version": "0.5.0", @@ -14075,9 +13940,10 @@ } }, "mimic-fn": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", - "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==" + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true }, "min-indent": { "version": "1.0.1", @@ -14185,14 +14051,6 @@ "dev": true, "requires": { "yallist": "^4.0.0" - }, - "dependencies": { - "yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - } } }, "minipass-collect": { @@ -14230,14 +14088,6 @@ "requires": { "minipass": "^3.0.0", "yallist": "^4.0.0" - }, - "dependencies": { - "yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - } } }, "mississippi": { @@ -14374,9 +14224,9 @@ } }, "mri": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/mri/-/mri-1.1.5.tgz", - "integrity": "sha512-d2RKzMD4JNyHMbnbWnznPaa8vbdlq/4pNZ3IgdaGrVbBhebBsGUUE/6qorTMYNS6TwuH3ilfOlD2bf4Igh8CKg==", + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/mri/-/mri-1.1.6.tgz", + "integrity": "sha512-oi1b3MfbyGa7FJMP9GmLTttni5JoICpYBRlq+x5V16fZbLsnL9N3wFqqIm/nIG43FjUFkFh9Epzp/kzUGUnJxQ==", "dev": true }, "ms": { @@ -14789,15 +14639,6 @@ "integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==", "dev": true }, - "lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", - "dev": true, - "requires": { - "yallist": "^3.0.2" - } - }, "npm-package-arg": { "version": "6.1.1", "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-6.1.1.tgz", @@ -14815,12 +14656,6 @@ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", "dev": true - }, - "yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", - "dev": true } } }, @@ -14841,19 +14676,6 @@ "string.prototype.padend": "^3.0.0" }, "dependencies": { - "cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", - "dev": true, - "requires": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - } - }, "read-pkg": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", @@ -14871,6 +14693,7 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "dev": true, "requires": { "path-key": "^2.0.0" } @@ -14893,7 +14716,8 @@ "number-is-nan": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "dev": true }, "nwsapi": { "version": "2.2.0", @@ -15076,14 +14900,6 @@ "dev": true, "requires": { "mimic-fn": "^2.1.0" - }, - "dependencies": { - "mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true - } } }, "open": { @@ -15223,18 +15039,14 @@ "dev": true }, "os-locale": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", - "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.1.0.tgz", + "integrity": "sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q==", + "dev": true, "requires": { - "execa": "^0.7.0", - "lcid": "^1.0.0", - "mem": "4.3.0" - }, - "dependencies": { - "mem": { - "version": "4.3.0" - } + "execa": "^1.0.0", + "lcid": "^2.0.0", + "mem": "^4.0.0" } }, "os-name": { @@ -15284,7 +15096,8 @@ "p-finally": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", - "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=" + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", + "dev": true }, "p-is-promise": { "version": "2.1.0", @@ -15401,15 +15214,6 @@ "minipass": "^2.6.0" } }, - "get-stream": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", - "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - }, "glob": { "version": "7.1.6", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", @@ -15430,15 +15234,6 @@ "integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==", "dev": true }, - "lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", - "dev": true, - "requires": { - "yallist": "^3.0.2" - } - }, "minipass": { "version": "2.9.0", "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.9.0.tgz", @@ -15683,7 +15478,8 @@ "path-key": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=" + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true }, "path-parse": { "version": "1.0.6", @@ -17162,11 +16958,6 @@ "event-stream": "=3.3.4" } }, - "pseudomap": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", - "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=" - }, "psl": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", @@ -18001,43 +17792,6 @@ "normalize-path": "^2.1.1" } }, - "cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", - "dev": true, - "requires": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - } - }, - "execa": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", - "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", - "dev": true, - "requires": { - "cross-spawn": "^6.0.0", - "get-stream": "^4.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - } - }, - "get-stream": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", - "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - }, "normalize-path": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", @@ -18381,6 +18135,7 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, "requires": { "shebang-regex": "^1.0.0" } @@ -18388,7 +18143,8 @@ "shebang-regex": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=" + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true }, "shell-quote": { "version": "1.7.2", @@ -18406,7 +18162,8 @@ "signal-exit": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", - "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==" + "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", + "dev": true }, "simple-swizzle": { "version": "0.2.2", @@ -19263,7 +19020,8 @@ "strip-eof": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", - "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=" + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", + "dev": true }, "strip-final-newline": { "version": "2.0.0", @@ -20405,12 +20163,6 @@ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", "dev": true - }, - "yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true } } }, @@ -20500,15 +20252,6 @@ "path-is-absolute": "^1.0.0" } }, - "lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", - "dev": true, - "requires": { - "yallist": "^3.0.2" - } - }, "rimraf": { "version": "2.7.1", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", @@ -20533,12 +20276,6 @@ "figgy-pudding": "^3.5.1", "minipass": "^3.1.1" } - }, - "yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", - "dev": true } } }, @@ -21909,15 +21646,6 @@ "json5": "^1.0.1" } }, - "lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", - "dev": true, - "requires": { - "yallist": "^3.0.2" - } - }, "memory-fs": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.4.1.tgz", @@ -21988,12 +21716,6 @@ "webpack-sources": "^1.4.0", "worker-farm": "^1.7.0" } - }, - "yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", - "dev": true } } }, @@ -22530,6 +22252,7 @@ "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, "requires": { "isexe": "^2.0.0" } @@ -22546,45 +22269,6 @@ "dev": true, "requires": { "execa": "^1.0.0" - }, - "dependencies": { - "cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", - "dev": true, - "requires": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - } - }, - "execa": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", - "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", - "dev": true, - "requires": { - "cross-spawn": "^6.0.0", - "get-stream": "^4.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - } - }, - "get-stream": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", - "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - } } }, "word-wrap": { @@ -22756,9 +22440,10 @@ "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==" }, "yallist": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", - "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=" + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true }, "yaml": { "version": "1.10.0", diff --git a/src/pybind/mgr/dashboard/frontend/package.json b/src/pybind/mgr/dashboard/frontend/package.json index e99130f2f5a..ddee0a3c23b 100644 --- a/src/pybind/mgr/dashboard/frontend/package.json +++ b/src/pybind/mgr/dashboard/frontend/package.json @@ -13,7 +13,7 @@ "postbuild:localize": "node cd --res", "env_build": "node cd --env", "i18n": "npm run i18n:extract && npm run i18n:push && npm run i18n:pull && npm run i18n:merge", - "i18n:extract": "ng xi18n --output-path locale --progress=false && ngx-extractor -i 'src/**/*.ts' -f xlf -o src/locale/messages.xlf -l en-US", + "i18n:extract": "ng build --localize=false && locl extract -s=dist/*.js -f=xlf -o=src/locale/messages.xlf", "i18n:push": "npx i18ntool push -c i18n.config.json", "i18n:pull": "npx i18ntool pull -c i18n.config.json", "i18n:merge": "npx i18ntool merge -c i18n.config.json", @@ -78,7 +78,6 @@ "@angular/router": "9.1.11", "@auth0/angular-jwt": "4.2.0", "@ng-bootstrap/ng-bootstrap": "6.1.0", - "@ngx-translate/i18n-polyfill": "1.0.0", "@swimlane/ngx-datatable": "17.0.0", "@types/file-saver": "2.0.1", "angular-tree-component": "8.5.6", @@ -107,6 +106,7 @@ "@angular/compiler-cli": "9.1.11", "@angular/language-service": "9.1.11", "@compodoc/compodoc": "1.1.11", + "@locl/cli": "0.0.1-beta.9", "@types/jest": "26.0.3", "@types/lodash": "4.14.157", "@types/node": "12.12.47", @@ -135,7 +135,6 @@ "typescript": "3.8.3" }, "resolutions": { - "mem": "4.3.0", "fsevents": "2.1.2", "lodash": "4.17.19" } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/app.module.ts b/src/pybind/mgr/dashboard/frontend/src/app/app.module.ts index 5a48d7eefdd..a8803d96277 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/app.module.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/app.module.ts @@ -1,20 +1,12 @@ import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http'; -import { - ErrorHandler, - LOCALE_ID, - NgModule, - TRANSLATIONS, - TRANSLATIONS_FORMAT -} from '@angular/core'; +import { ErrorHandler, NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { JwtModule } from '@auth0/angular-jwt'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import { NgBootstrapFormValidationModule } from 'ng-bootstrap-form-validation'; import { ToastrModule } from 'ngx-toastr'; -import { environment } from '../environments/environment'; import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; import { CephModule } from './ceph/ceph.module'; @@ -59,21 +51,7 @@ export function jwtTokenGetter() { provide: HTTP_INTERCEPTORS, useClass: ApiInterceptorService, multi: true - }, - { - provide: TRANSLATIONS, - useFactory: (locale: string) => { - locale = locale || environment.default_lang; - try { - return require(`raw-loader!locale/messages.${locale}.xlf`).default; - } catch (error) { - return []; - } - }, - deps: [LOCALE_ID] - }, - { provide: TRANSLATIONS_FORMAT, useValue: 'xlf' }, - I18n + } ], bootstrap: [AppComponent] }) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-details/iscsi-target-details.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-details/iscsi-target-details.component.spec.ts index 4e0514e0c51..e0cef596b6a 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-details/iscsi-target-details.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-details/iscsi-target-details.component.spec.ts @@ -4,7 +4,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { TreeModel, TreeModule } from 'angular-tree-component'; import * as _ from 'lodash'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { SharedModule } from '../../../shared/shared.module'; import { IscsiTargetDetailsComponent } from './iscsi-target-details.component'; @@ -14,8 +14,7 @@ describe('IscsiTargetDetailsComponent', () => { configureTestBed({ declarations: [IscsiTargetDetailsComponent], - imports: [BrowserAnimationsModule, TreeModule.forRoot(), SharedModule], - providers: [i18nProviders] + imports: [BrowserAnimationsModule, TreeModule.forRoot(), SharedModule] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-details/iscsi-target-details.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-details/iscsi-target-details.component.ts index e7b3b96c9c5..983efd4580c 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-details/iscsi-target-details.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-details/iscsi-target-details.component.ts @@ -1,6 +1,5 @@ import { Component, Input, OnChanges, OnInit, TemplateRef, ViewChild } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import { ITreeOptions, TreeComponent, @@ -61,7 +60,6 @@ export class IscsiTargetDetailsComponent implements OnChanges, OnInit { }; constructor( - private i18n: I18n, private iscsiBackstorePipe: IscsiBackstorePipe, private booleanTextPipe: BooleanTextPipe ) {} @@ -70,19 +68,19 @@ export class IscsiTargetDetailsComponent implements OnChanges, OnInit { this.columns = [ { prop: 'displayName', - name: this.i18n('Name'), + name: $localize`Name`, flexGrow: 1, cellTemplate: this.highlightTpl }, { prop: 'current', - name: this.i18n('Current'), + name: $localize`Current`, flexGrow: 1, cellTemplate: this.highlightTpl }, { prop: 'default', - name: this.i18n('Default'), + name: $localize`Default`, flexGrow: 1, cellTemplate: this.highlightTpl } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-discovery-modal/iscsi-target-discovery-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-discovery-modal/iscsi-target-discovery-modal.component.spec.ts index ed0a6652187..4f6eec2dd23 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-discovery-modal/iscsi-target-discovery-modal.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-discovery-modal/iscsi-target-discovery-modal.component.spec.ts @@ -11,12 +11,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { ToastrModule } from 'ngx-toastr'; -import { - configureTestBed, - FormHelper, - i18nProviders, - IscsiHelper -} from '../../../../testing/unit-test-helper'; +import { configureTestBed, FormHelper, IscsiHelper } from '../../../../testing/unit-test-helper'; import { Permission } from '../../../shared/models/permissions'; import { SharedModule } from '../../../shared/shared.module'; import { IscsiTargetDiscoveryModalComponent } from './iscsi-target-discovery-modal.component'; @@ -39,7 +34,7 @@ describe('IscsiTargetDiscoveryModalComponent', () => { ToastrModule.forRoot(), RouterTestingModule ], - providers: [i18nProviders, NgbActiveModal] + providers: [NgbActiveModal] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-discovery-modal/iscsi-target-discovery-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-discovery-modal/iscsi-target-discovery-modal.component.ts index 9f150747d75..914d141b01f 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-discovery-modal/iscsi-target-discovery-modal.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-discovery-modal/iscsi-target-discovery-modal.component.ts @@ -2,7 +2,6 @@ import { Component, OnInit } from '@angular/core'; import { FormControl, Validators } from '@angular/forms'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import { IscsiService } from '../../../shared/api/iscsi.service'; import { NotificationType } from '../../../shared/enum/notification-type.enum'; @@ -29,8 +28,7 @@ export class IscsiTargetDiscoveryModalComponent implements OnInit { private authStorageService: AuthStorageService, public activeModal: NgbActiveModal, private iscsiService: IscsiService, - private notificationService: NotificationService, - private i18n: I18n + private notificationService: NotificationService ) { this.permission = this.authStorageService.getPermissions().iscsi; } @@ -111,7 +109,7 @@ export class IscsiTargetDiscoveryModalComponent implements OnInit { () => { this.notificationService.show( NotificationType.success, - this.i18n('Updated discovery authentication') + $localize`Updated discovery authentication` ); this.activeModal.close(); }, diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-form/iscsi-target-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-form/iscsi-target-form.component.spec.ts index 299cefd7f20..fb6eef30e8a 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-form/iscsi-target-form.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-form/iscsi-target-form.component.spec.ts @@ -7,12 +7,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { ToastrModule } from 'ngx-toastr'; import { ActivatedRouteStub } from '../../../../testing/activated-route-stub'; -import { - configureTestBed, - FormHelper, - i18nProviders, - IscsiHelper -} from '../../../../testing/unit-test-helper'; +import { configureTestBed, FormHelper, IscsiHelper } from '../../../../testing/unit-test-helper'; import { LoadingPanelComponent } from '../../../shared/components/loading-panel/loading-panel.component'; import { CdFormGroup } from '../../../shared/forms/cd-form-group'; import { SharedModule } from '../../../shared/shared.module'; @@ -153,7 +148,6 @@ describe('IscsiTargetFormComponent', () => { ToastrModule.forRoot() ], providers: [ - i18nProviders, { provide: ActivatedRoute, useValue: new ActivatedRouteStub({ target_iqn: undefined }) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-form/iscsi-target-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-form/iscsi-target-form.component.ts index c5bead7dc38..41d67ca87b2 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-form/iscsi-target-form.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-form/iscsi-target-form.component.ts @@ -3,7 +3,6 @@ import { FormArray, FormControl, Validators } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { forkJoin } from 'rxjs'; @@ -57,30 +56,14 @@ export class IscsiTargetFormComponent extends CdForm implements OnInit { imagesSettings: any = {}; messages = { - portals: new SelectMessages( - { noOptions: this.i18n('There are no portals available.') }, - this.i18n - ), - images: new SelectMessages( - { noOptions: this.i18n('There are no images available.') }, - this.i18n - ), - initiatorImage: new SelectMessages( - { - noOptions: this.i18n( - 'There are no images available. Please make sure you add an image to the target.' - ) - }, - this.i18n - ), - groupInitiator: new SelectMessages( - { - noOptions: this.i18n( - 'There are no initiators available. Please make sure you add an initiator to the target.' - ) - }, - this.i18n - ) + portals: new SelectMessages({ noOptions: $localize`There are no portals available.` }), + images: new SelectMessages({ noOptions: $localize`There are no images available.` }), + initiatorImage: new SelectMessages({ + noOptions: $localize`There are no images available. Please make sure you add an image to the target.` + }), + groupInitiator: new SelectMessages({ + noOptions: $localize`There are no initiators available. Please make sure you add an initiator to the target.` + }) }; IQN_REGEX = /^iqn\.(19|20)\d\d-(0[1-9]|1[0-2])\.\D{2,3}(\.[A-Za-z0-9-]+)+(:[A-Za-z0-9-\.]+)*$/; @@ -95,12 +78,11 @@ export class IscsiTargetFormComponent extends CdForm implements OnInit { private rbdService: RbdService, private router: Router, private route: ActivatedRoute, - private i18n: I18n, private taskWrapper: TaskWrapperService, public actionLabels: ActionLabelsI18n ) { super(); - this.resource = this.i18n('target'); + this.resource = $localize`target`; } ngOnInit() { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-image-settings-modal/iscsi-target-image-settings-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-image-settings-modal/iscsi-target-image-settings-modal.component.spec.ts index 10ac2c762bd..60d8513964a 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-image-settings-modal/iscsi-target-image-settings-modal.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-image-settings-modal/iscsi-target-image-settings-modal.component.spec.ts @@ -5,7 +5,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { SharedModule } from '../../../shared/shared.module'; import { IscsiSettingComponent } from '../iscsi-setting/iscsi-setting.component'; import { IscsiTargetImageSettingsModalComponent } from './iscsi-target-image-settings-modal.component'; @@ -17,7 +17,7 @@ describe('IscsiTargetImageSettingsModalComponent', () => { configureTestBed({ declarations: [IscsiTargetImageSettingsModalComponent, IscsiSettingComponent], imports: [SharedModule, ReactiveFormsModule, HttpClientTestingModule, RouterTestingModule], - providers: [NgbActiveModal, i18nProviders] + providers: [NgbActiveModal] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-iqn-settings-modal/iscsi-target-iqn-settings-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-iqn-settings-modal/iscsi-target-iqn-settings-modal.component.spec.ts index ac6d883499e..8e55b78cb4f 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-iqn-settings-modal/iscsi-target-iqn-settings-modal.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-iqn-settings-modal/iscsi-target-iqn-settings-modal.component.spec.ts @@ -5,7 +5,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { SharedModule } from '../../../shared/shared.module'; import { IscsiSettingComponent } from '../iscsi-setting/iscsi-setting.component'; import { IscsiTargetIqnSettingsModalComponent } from './iscsi-target-iqn-settings-modal.component'; @@ -17,7 +17,7 @@ describe('IscsiTargetIqnSettingsModalComponent', () => { configureTestBed({ declarations: [IscsiTargetIqnSettingsModalComponent, IscsiSettingComponent], imports: [SharedModule, ReactiveFormsModule, HttpClientTestingModule, RouterTestingModule], - providers: [NgbActiveModal, i18nProviders] + providers: [NgbActiveModal] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-list/iscsi-target-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-list/iscsi-target-list.component.spec.ts index 997983872f6..2c8657f3577 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-list/iscsi-target-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-list/iscsi-target-list.component.spec.ts @@ -11,7 +11,6 @@ import { BehaviorSubject, of } from 'rxjs'; import { configureTestBed, expectItemTasks, - i18nProviders, PermissionHelper } from '../../../../testing/unit-test-helper'; import { IscsiService } from '../../../shared/api/iscsi.service'; @@ -46,7 +45,7 @@ describe('IscsiTargetListComponent', () => { NgbNavModule ], declarations: [IscsiTargetListComponent, IscsiTabsComponent, IscsiTargetDetailsComponent], - providers: [TaskListService, i18nProviders] + providers: [TaskListService] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-list/iscsi-target-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-list/iscsi-target-list.component.ts index 236e1dc10bd..dd96295ca0e 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-list/iscsi-target-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-list/iscsi-target-list.component.ts @@ -1,7 +1,6 @@ import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core'; import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { Subscription } from 'rxjs'; @@ -61,7 +60,6 @@ export class IscsiTargetListComponent extends ListWithDetails implements OnInit, constructor( private authStorageService: AuthStorageService, - private i18n: I18n, private iscsiService: IscsiService, private taskListService: TaskListService, private cephReleaseNamePipe: CephReleaseNamePipe, @@ -103,23 +101,23 @@ export class IscsiTargetListComponent extends ListWithDetails implements OnInit, ngOnInit() { this.columns = [ { - name: this.i18n('Target'), + name: $localize`Target`, prop: 'target_iqn', flexGrow: 2, cellTransformation: CellTemplate.executing }, { - name: this.i18n('Portals'), + name: $localize`Portals`, prop: 'cdPortals', flexGrow: 2 }, { - name: this.i18n('Images'), + name: $localize`Images`, prop: 'cdImages', flexGrow: 2 }, { - name: this.i18n('# Sessions'), + name: $localize`# Sessions`, prop: 'info.num_sessions', pipe: this.notAvailablePipe, flexGrow: 1 @@ -168,7 +166,7 @@ export class IscsiTargetListComponent extends ListWithDetails implements OnInit, return first.cdExecuting; } if (first && _.isUndefined(first['info'])) { - return this.i18n('Unavailable gateway(s)'); + return $localize`Unavailable gateway(s)`; } return undefined; @@ -180,10 +178,10 @@ export class IscsiTargetListComponent extends ListWithDetails implements OnInit, return first.cdExecuting; } if (first && _.isUndefined(first['info'])) { - return this.i18n('Unavailable gateway(s)'); + return $localize`Unavailable gateway(s)`; } if (first && first['info'] && first['info']['num_sessions']) { - return this.i18n('Target has active sessions'); + return $localize`Target has active sessions`; } return undefined; @@ -222,7 +220,7 @@ export class IscsiTargetListComponent extends ListWithDetails implements OnInit, const target_iqn = this.selection.first().target_iqn; this.modalRef = this.modalService.show(CriticalConfirmationModalComponent, { - itemDescription: this.i18n('iSCSI target'), + itemDescription: $localize`iSCSI target`, itemNames: [target_iqn], submitActionObservable: () => this.taskWrapper.wrapTaskAroundCall({ diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi/iscsi.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi/iscsi.component.spec.ts index 7b091c01792..4ac569c77a7 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi/iscsi.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi/iscsi.component.spec.ts @@ -4,7 +4,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { of } from 'rxjs'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { IscsiService } from '../../../shared/api/iscsi.service'; import { CephShortVersionPipe } from '../../../shared/pipes/ceph-short-version.pipe'; import { DimlessPipe } from '../../../shared/pipes/dimless.pipe'; @@ -38,8 +38,7 @@ describe('IscsiComponent', () => { FormatterService, RelativeDatePipe, IscsiBackstorePipe, - { provide: IscsiService, useValue: fakeService }, - i18nProviders + { provide: IscsiService, useValue: fakeService } ] }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi/iscsi.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi/iscsi.component.ts index a8dc711a832..b3a6d0c6926 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi/iscsi.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi/iscsi.component.ts @@ -1,7 +1,5 @@ import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; - import { IscsiService } from '../../../shared/api/iscsi.service'; import { CellTemplate } from '../../../shared/enum/cell-template.enum'; import { DimlessPipe } from '../../../shared/pipes/dimless.pipe'; @@ -28,18 +26,17 @@ export class IscsiComponent implements OnInit { constructor( private iscsiService: IscsiService, private dimlessPipe: DimlessPipe, - private iscsiBackstorePipe: IscsiBackstorePipe, - private i18n: I18n + private iscsiBackstorePipe: IscsiBackstorePipe ) {} ngOnInit() { this.gatewaysColumns = [ { - name: this.i18n('Name'), + name: $localize`Name`, prop: 'name' }, { - name: this.i18n('State'), + name: $localize`State`, prop: 'state', flexGrow: 1, cellTransformation: CellTemplate.badge, @@ -51,52 +48,52 @@ export class IscsiComponent implements OnInit { } }, { - name: this.i18n('# Targets'), + name: $localize`# Targets`, prop: 'num_targets' }, { - name: this.i18n('# Sessions'), + name: $localize`# Sessions`, prop: 'num_sessions' } ]; this.imagesColumns = [ { - name: this.i18n('Pool'), + name: $localize`Pool`, prop: 'pool' }, { - name: this.i18n('Image'), + name: $localize`Image`, prop: 'image' }, { - name: this.i18n('Backstore'), + name: $localize`Backstore`, prop: 'backstore', pipe: this.iscsiBackstorePipe }, { - name: this.i18n('Read Bytes'), + name: $localize`Read Bytes`, prop: 'stats_history.rd_bytes', cellTemplate: this.iscsiSparklineTpl }, { - name: this.i18n('Write Bytes'), + name: $localize`Write Bytes`, prop: 'stats_history.wr_bytes', cellTemplate: this.iscsiSparklineTpl }, { - name: this.i18n('Read Ops'), + name: $localize`Read Ops`, prop: 'stats.rd', pipe: this.dimlessPipe, cellTemplate: this.iscsiPerSecondTpl }, { - name: this.i18n('Write Ops'), + name: $localize`Write Ops`, prop: 'stats.wr', pipe: this.dimlessPipe, cellTemplate: this.iscsiPerSecondTpl }, { - name: this.i18n('A/O Since'), + name: $localize`A/O Since`, prop: 'optimized_since', cellTemplate: this.iscsiRelativeDateTpl } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/bootstrap-create-modal/bootstrap-create-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/bootstrap-create-modal/bootstrap-create-modal.component.spec.ts index 0200547c407..a03c6aae5e0 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/bootstrap-create-modal/bootstrap-create-modal.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/bootstrap-create-modal/bootstrap-create-modal.component.spec.ts @@ -7,11 +7,7 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { ToastrModule } from 'ngx-toastr'; import { of } from 'rxjs'; -import { - configureTestBed, - FormHelper, - i18nProviders -} from '../../../../../testing/unit-test-helper'; +import { configureTestBed, FormHelper } from '../../../../../testing/unit-test-helper'; import { RbdMirroringService } from '../../../../shared/api/rbd-mirroring.service'; import { NotificationService } from '../../../../shared/services/notification.service'; import { SharedModule } from '../../../../shared/shared.module'; @@ -33,7 +29,7 @@ describe('BootstrapCreateModalComponent', () => { SharedModule, ToastrModule.forRoot() ], - providers: [NgbActiveModal, i18nProviders] + providers: [NgbActiveModal] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/bootstrap-import-modal/bootstrap-import-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/bootstrap-import-modal/bootstrap-import-modal.component.spec.ts index 9acfabb0875..e0b829d6072 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/bootstrap-import-modal/bootstrap-import-modal.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/bootstrap-import-modal/bootstrap-import-modal.component.spec.ts @@ -7,11 +7,7 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { ToastrModule } from 'ngx-toastr'; import { of } from 'rxjs'; -import { - configureTestBed, - FormHelper, - i18nProviders -} from '../../../../../testing/unit-test-helper'; +import { configureTestBed, FormHelper } from '../../../../../testing/unit-test-helper'; import { RbdMirroringService } from '../../../../shared/api/rbd-mirroring.service'; import { NotificationService } from '../../../../shared/services/notification.service'; import { SharedModule } from '../../../../shared/shared.module'; @@ -33,7 +29,7 @@ describe('BootstrapImportModalComponent', () => { SharedModule, ToastrModule.forRoot() ], - providers: [NgbActiveModal, i18nProviders] + providers: [NgbActiveModal] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/daemon-list/daemon-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/daemon-list/daemon-list.component.spec.ts index b2a511bf289..5dc7855e52a 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/daemon-list/daemon-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/daemon-list/daemon-list.component.spec.ts @@ -2,7 +2,7 @@ import { HttpClientTestingModule } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; -import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../../testing/unit-test-helper'; import { SharedModule } from '../../../../shared/shared.module'; import { MirrorHealthColorPipe } from '../mirror-health-color.pipe'; import { DaemonListComponent } from './daemon-list.component'; @@ -13,8 +13,7 @@ describe('DaemonListComponent', () => { configureTestBed({ declarations: [DaemonListComponent, MirrorHealthColorPipe], - imports: [BrowserAnimationsModule, SharedModule, HttpClientTestingModule], - providers: i18nProviders + imports: [BrowserAnimationsModule, SharedModule, HttpClientTestingModule] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/daemon-list/daemon-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/daemon-list/daemon-list.component.ts index 7eaae7aa024..399e88750d2 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/daemon-list/daemon-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/daemon-list/daemon-list.component.ts @@ -1,6 +1,5 @@ import { Component, OnDestroy, OnInit, TemplateRef, ViewChild } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import { Subscription } from 'rxjs'; import { RbdMirroringService } from '../../../../shared/api/rbd-mirroring.service'; @@ -22,24 +21,23 @@ export class DaemonListComponent implements OnInit, OnDestroy { constructor( private rbdMirroringService: RbdMirroringService, - private cephShortVersionPipe: CephShortVersionPipe, - private i18n: I18n + private cephShortVersionPipe: CephShortVersionPipe ) {} ngOnInit() { this.columns = [ - { prop: 'instance_id', name: this.i18n('Instance'), flexGrow: 2 }, - { prop: 'id', name: this.i18n('ID'), flexGrow: 2 }, - { prop: 'server_hostname', name: this.i18n('Hostname'), flexGrow: 2 }, + { prop: 'instance_id', name: $localize`Instance`, flexGrow: 2 }, + { prop: 'id', name: $localize`ID`, flexGrow: 2 }, + { prop: 'server_hostname', name: $localize`Hostname`, flexGrow: 2 }, { prop: 'version', - name: this.i18n('Version'), + name: $localize`Version`, pipe: this.cephShortVersionPipe, flexGrow: 2 }, { prop: 'health', - name: this.i18n('Health'), + name: $localize`Health`, cellTemplate: this.healthTmpl, flexGrow: 1 } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/edit-site-name-modal/edit-site-name-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/edit-site-name-modal/edit-site-name-modal.component.spec.ts index fc66c868951..4ac1bc3886c 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/edit-site-name-modal/edit-site-name-modal.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/edit-site-name-modal/edit-site-name-modal.component.spec.ts @@ -7,7 +7,7 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { ToastrModule } from 'ngx-toastr'; import { of } from 'rxjs'; -import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../../testing/unit-test-helper'; import { RbdMirroringService } from '../../../../shared/api/rbd-mirroring.service'; import { NotificationService } from '../../../../shared/services/notification.service'; import { SharedModule } from '../../../../shared/shared.module'; @@ -28,7 +28,7 @@ describe('EditSiteNameModalComponent', () => { SharedModule, ToastrModule.forRoot() ], - providers: [NgbActiveModal, i18nProviders] + providers: [NgbActiveModal] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/image-list/image-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/image-list/image-list.component.spec.ts index 48483693be0..75a6c0c1425 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/image-list/image-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/image-list/image-list.component.spec.ts @@ -4,7 +4,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { NgbNavModule, NgbProgressbarModule } from '@ng-bootstrap/ng-bootstrap'; -import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../../testing/unit-test-helper'; import { SharedModule } from '../../../../shared/shared.module'; import { MirrorHealthColorPipe } from '../mirror-health-color.pipe'; import { ImageListComponent } from './image-list.component'; @@ -21,8 +21,7 @@ describe('ImageListComponent', () => { NgbNavModule, NgbProgressbarModule, HttpClientTestingModule - ], - providers: i18nProviders + ] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/image-list/image-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/image-list/image-list.component.ts index 3867da7db92..6b1db0c0661 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/image-list/image-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/image-list/image-list.component.ts @@ -1,6 +1,5 @@ import { Component, OnDestroy, OnInit, TemplateRef, ViewChild } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import { Subscription } from 'rxjs'; import { RbdMirroringService } from '../../../../shared/api/rbd-mirroring.service'; @@ -33,45 +32,45 @@ export class ImageListComponent implements OnInit, OnDestroy { columns: {} }; - constructor(private rbdMirroringService: RbdMirroringService, private i18n: I18n) {} + constructor(private rbdMirroringService: RbdMirroringService) {} ngOnInit() { this.image_error.columns = [ - { prop: 'pool_name', name: this.i18n('Pool'), flexGrow: 2 }, - { prop: 'name', name: this.i18n('Image'), flexGrow: 2 }, - { prop: 'description', name: this.i18n('Issue'), flexGrow: 4 }, + { prop: 'pool_name', name: $localize`Pool`, flexGrow: 2 }, + { prop: 'name', name: $localize`Image`, flexGrow: 2 }, + { prop: 'description', name: $localize`Issue`, flexGrow: 4 }, { prop: 'state', - name: this.i18n('State'), + name: $localize`State`, cellTemplate: this.stateTmpl, flexGrow: 1 } ]; this.image_syncing.columns = [ - { prop: 'pool_name', name: this.i18n('Pool'), flexGrow: 2 }, - { prop: 'name', name: this.i18n('Image'), flexGrow: 2 }, + { prop: 'pool_name', name: $localize`Pool`, flexGrow: 2 }, + { prop: 'name', name: $localize`Image`, flexGrow: 2 }, { prop: 'progress', - name: this.i18n('Progress'), + name: $localize`Progress`, cellTemplate: this.progressTmpl, flexGrow: 2 }, { prop: 'state', - name: this.i18n('State'), + name: $localize`State`, cellTemplate: this.syncTmpl, flexGrow: 1 } ]; this.image_ready.columns = [ - { prop: 'pool_name', name: this.i18n('Pool'), flexGrow: 2 }, - { prop: 'name', name: this.i18n('Image'), flexGrow: 2 }, - { prop: 'description', name: this.i18n('Description'), flexGrow: 4 }, + { prop: 'pool_name', name: $localize`Pool`, flexGrow: 2 }, + { prop: 'name', name: $localize`Image`, flexGrow: 2 }, + { prop: 'description', name: $localize`Description`, flexGrow: 4 }, { prop: 'state', - name: this.i18n('State'), + name: $localize`State`, cellTemplate: this.stateTmpl, flexGrow: 1 } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/overview/overview.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/overview/overview.component.spec.ts index 0ef017448cd..486f3a89c78 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/overview/overview.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/overview/overview.component.spec.ts @@ -6,7 +6,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { NgbNavModule, NgbProgressbarModule } from '@ng-bootstrap/ng-bootstrap'; import { ToastrModule } from 'ngx-toastr'; -import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../../testing/unit-test-helper'; import { SharedModule } from '../../../../shared/shared.module'; import { DaemonListComponent } from '../daemon-list/daemon-list.component'; import { ImageListComponent } from '../image-list/image-list.component'; @@ -34,8 +34,7 @@ describe('OverviewComponent', () => { HttpClientTestingModule, RouterTestingModule, ToastrModule.forRoot() - ], - providers: i18nProviders + ] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/overview/overview.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/overview/overview.component.ts index 5220912c147..02f7fee878e 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/overview/overview.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/overview/overview.component.ts @@ -1,7 +1,6 @@ import { Component, OnDestroy, OnInit } from '@angular/core'; import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import { Subscription } from 'rxjs'; import { RbdMirroringService } from '../../../../shared/api/rbd-mirroring.service'; @@ -35,8 +34,7 @@ export class OverviewComponent implements OnInit, OnDestroy { constructor( private authStorageService: AuthStorageService, private rbdMirroringService: RbdMirroringService, - private modalService: ModalService, - private i18n: I18n + private modalService: ModalService ) { this.permission = this.authStorageService.getPermissions().rbdMirroring; @@ -44,7 +42,7 @@ export class OverviewComponent implements OnInit, OnDestroy { permission: 'update', icon: Icons.edit, click: () => this.editSiteNameModal(), - name: this.i18n('Edit Site Name'), + name: $localize`Edit Site Name`, canBePrimary: () => true, disable: () => false }; @@ -52,14 +50,14 @@ export class OverviewComponent implements OnInit, OnDestroy { permission: 'update', icon: Icons.upload, click: () => this.createBootstrapModal(), - name: this.i18n('Create Bootstrap Token'), + name: $localize`Create Bootstrap Token`, disable: () => false }; const importBootstrapAction: CdTableAction = { permission: 'update', icon: Icons.download, click: () => this.importBootstrapModal(), - name: this.i18n('Import Bootstrap Token'), + name: $localize`Import Bootstrap Token`, disable: () => this.peersExist }; this.tableActions = [editSiteNameAction, createBootstrapAction, importBootstrapAction]; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-mode-modal/pool-edit-mode-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-mode-modal/pool-edit-mode-modal.component.spec.ts index acafbca8473..b5c37ea5f7b 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-mode-modal/pool-edit-mode-modal.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-mode-modal/pool-edit-mode-modal.component.spec.ts @@ -7,11 +7,7 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { ToastrModule } from 'ngx-toastr'; import { of } from 'rxjs'; -import { - configureTestBed, - FormHelper, - i18nProviders -} from '../../../../../testing/unit-test-helper'; +import { configureTestBed, FormHelper } from '../../../../../testing/unit-test-helper'; import { RbdMirroringService } from '../../../../shared/api/rbd-mirroring.service'; import { NotificationService } from '../../../../shared/services/notification.service'; import { SharedModule } from '../../../../shared/shared.module'; @@ -33,7 +29,7 @@ describe('PoolEditModeModalComponent', () => { SharedModule, ToastrModule.forRoot() ], - providers: [NgbActiveModal, i18nProviders] + providers: [NgbActiveModal] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-mode-modal/pool-edit-mode-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-mode-modal/pool-edit-mode-modal.component.ts index e706af9a7f5..696d12d72b4 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-mode-modal/pool-edit-mode-modal.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-mode-modal/pool-edit-mode-modal.component.ts @@ -2,7 +2,6 @@ import { Component, OnDestroy, OnInit } from '@angular/core'; import { AbstractControl, FormControl, Validators } from '@angular/forms'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import { Subscription } from 'rxjs'; import { RbdMirroringService } from '../../../../shared/api/rbd-mirroring.service'; @@ -31,14 +30,13 @@ export class PoolEditModeModalComponent implements OnInit, OnDestroy { peerExists = false; mirrorModes: Array<{ id: string; name: string }> = [ - { id: 'disabled', name: this.i18n('Disabled') }, - { id: 'pool', name: this.i18n('Pool') }, - { id: 'image', name: this.i18n('Image') } + { id: 'disabled', name: $localize`Disabled` }, + { id: 'pool', name: $localize`Pool` }, + { id: 'image', name: $localize`Image` } ]; constructor( public activeModal: NgbActiveModal, - private i18n: I18n, private rbdMirroringService: RbdMirroringService, private taskWrapper: TaskWrapperService ) { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-peer-modal/pool-edit-peer-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-peer-modal/pool-edit-peer-modal.component.spec.ts index 578e07e481c..6a4db9aa6a7 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-peer-modal/pool-edit-peer-modal.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-peer-modal/pool-edit-peer-modal.component.spec.ts @@ -7,11 +7,7 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { ToastrModule } from 'ngx-toastr'; import { of } from 'rxjs'; -import { - configureTestBed, - FormHelper, - i18nProviders -} from '../../../../../testing/unit-test-helper'; +import { configureTestBed, FormHelper } from '../../../../../testing/unit-test-helper'; import { RbdMirroringService } from '../../../../shared/api/rbd-mirroring.service'; import { NotificationService } from '../../../../shared/services/notification.service'; import { SharedModule } from '../../../../shared/shared.module'; @@ -34,7 +30,7 @@ describe('PoolEditPeerModalComponent', () => { SharedModule, ToastrModule.forRoot() ], - providers: [NgbActiveModal, i18nProviders] + providers: [NgbActiveModal] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-list/pool-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-list/pool-list.component.spec.ts index e40e1acd81c..26a8f333e14 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-list/pool-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-list/pool-list.component.spec.ts @@ -5,7 +5,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { ToastrModule } from 'ngx-toastr'; -import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../../testing/unit-test-helper'; import { SharedModule } from '../../../../shared/shared.module'; import { MirrorHealthColorPipe } from '../mirror-health-color.pipe'; import { PoolListComponent } from './pool-list.component'; @@ -22,8 +22,7 @@ describe('PoolListComponent', () => { HttpClientTestingModule, RouterTestingModule, ToastrModule.forRoot() - ], - providers: i18nProviders + ] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-list/pool-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-list/pool-list.component.ts index 10136692c51..6c18acc08ce 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-list/pool-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-list/pool-list.component.ts @@ -1,7 +1,6 @@ import { Component, OnDestroy, OnInit, TemplateRef, ViewChild } from '@angular/core'; import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import { Observable, Subscriber, Subscription } from 'rxjs'; import { RbdMirroringService } from '../../../../shared/api/rbd-mirroring.service'; @@ -41,8 +40,7 @@ export class PoolListComponent implements OnInit, OnDestroy { private authStorageService: AuthStorageService, private rbdMirroringService: RbdMirroringService, private modalService: ModalService, - private taskWrapper: TaskWrapperService, - private i18n: I18n + private taskWrapper: TaskWrapperService ) { this.data = []; this.permission = this.authStorageService.getPermissions().rbdMirroring; @@ -51,13 +49,13 @@ export class PoolListComponent implements OnInit, OnDestroy { permission: 'update', icon: Icons.edit, click: () => this.editModeModal(), - name: this.i18n('Edit Mode'), + name: $localize`Edit Mode`, canBePrimary: () => true }; const addPeerAction: CdTableAction = { permission: 'create', icon: Icons.add, - name: this.i18n('Add Peer'), + name: $localize`Add Peer`, click: () => this.editPeersModal('add'), disable: () => !this.selection.first() || this.selection.first().mirror_mode === 'disabled', visible: () => !this.getPeerUUID(), @@ -66,14 +64,14 @@ export class PoolListComponent implements OnInit, OnDestroy { const editPeerAction: CdTableAction = { permission: 'update', icon: Icons.exchange, - name: this.i18n('Edit Peer'), + name: $localize`Edit Peer`, click: () => this.editPeersModal('edit'), visible: () => !!this.getPeerUUID() }; const deletePeerAction: CdTableAction = { permission: 'delete', icon: Icons.destroy, - name: this.i18n('Delete Peer'), + name: $localize`Delete Peer`, click: () => this.deletePeersModal(), visible: () => !!this.getPeerUUID() }; @@ -82,14 +80,14 @@ export class PoolListComponent implements OnInit, OnDestroy { ngOnInit() { this.columns = [ - { prop: 'name', name: this.i18n('Name'), flexGrow: 2 }, - { prop: 'mirror_mode', name: this.i18n('Mode'), flexGrow: 2 }, - { prop: 'leader_id', name: this.i18n('Leader'), flexGrow: 2 }, - { prop: 'image_local_count', name: this.i18n('# Local'), flexGrow: 2 }, - { prop: 'image_remote_count', name: this.i18n('# Remote'), flexGrow: 2 }, + { prop: 'name', name: $localize`Name`, flexGrow: 2 }, + { prop: 'mirror_mode', name: $localize`Mode`, flexGrow: 2 }, + { prop: 'leader_id', name: $localize`Leader`, flexGrow: 2 }, + { prop: 'image_local_count', name: $localize`# Local`, flexGrow: 2 }, + { prop: 'image_remote_count', name: $localize`# Remote`, flexGrow: 2 }, { prop: 'health', - name: this.i18n('Health'), + name: $localize`Health`, cellTemplate: this.healthTmpl, flexGrow: 1 } @@ -131,7 +129,7 @@ export class PoolListComponent implements OnInit, OnDestroy { const peerUUID = this.getPeerUUID(); this.modalRef = this.modalService.show(CriticalConfirmationModalComponent, { - itemDescription: this.i18n('mirror peer'), + itemDescription: $localize`mirror peer`, itemNames: [`${poolName} (${peerUUID})`], submitActionObservable: () => new Observable((observer: Subscriber) => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-configuration-form/rbd-configuration-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-configuration-form/rbd-configuration-form.component.spec.ts index 8288e9403a9..0f0daa6b9df 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-configuration-form/rbd-configuration-form.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-configuration-form/rbd-configuration-form.component.spec.ts @@ -3,7 +3,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ReactiveFormsModule } from '@angular/forms'; import { By } from '@angular/platform-browser'; -import { configureTestBed, FormHelper, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed, FormHelper } from '../../../../testing/unit-test-helper'; import { DirectivesModule } from '../../../shared/directives/directives.module'; import { CdFormGroup } from '../../../shared/forms/cd-form-group'; import { RbdConfigurationSourceField } from '../../../shared/models/configuration'; @@ -22,12 +22,7 @@ describe('RbdConfigurationFormComponent', () => { configureTestBed({ imports: [ReactiveFormsModule, DirectivesModule, SharedModule], declarations: [RbdConfigurationFormComponent], - providers: [ - RbdConfigurationService, - FormatterService, - DimlessBinaryPerSecondPipe, - i18nProviders - ] + providers: [RbdConfigurationService, FormatterService, DimlessBinaryPerSecondPipe] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-configuration-list/rbd-configuration-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-configuration-list/rbd-configuration-list.component.spec.ts index 7bb8f2e7420..4150269993f 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-configuration-list/rbd-configuration-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-configuration-list/rbd-configuration-list.component.spec.ts @@ -7,7 +7,7 @@ import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap'; import { NgxDatatableModule } from '@swimlane/ngx-datatable'; import { ChartsModule } from 'ng2-charts'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { ComponentsModule } from '../../../shared/components/components.module'; import { TableComponent } from '../../../shared/datatable/table/table.component'; import { RbdConfigurationEntry } from '../../../shared/models/configuration'; @@ -32,7 +32,7 @@ describe('RbdConfigurationListComponent', () => { PipesModule ], declarations: [RbdConfigurationListComponent, TableComponent], - providers: [FormatterService, RbdConfigurationService, i18nProviders] + providers: [FormatterService, RbdConfigurationService] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-configuration-list/rbd-configuration-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-configuration-list/rbd-configuration-list.component.ts index c63a76dccff..1e21a193dc2 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-configuration-list/rbd-configuration-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-configuration-list/rbd-configuration-list.component.ts @@ -1,7 +1,5 @@ import { Component, Input, OnChanges, OnInit, TemplateRef, ViewChild } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; - import { TableComponent } from '../../../shared/datatable/table/table.component'; import { CdTableColumn } from '../../../shared/models/cd-table-column'; import { @@ -34,22 +32,21 @@ export class RbdConfigurationListComponent implements OnInit, OnChanges { constructor( public formatterService: FormatterService, - private rbdConfigurationService: RbdConfigurationService, - private i18n: I18n + private rbdConfigurationService: RbdConfigurationService ) {} ngOnInit() { this.poolConfigurationColumns = [ - { prop: 'displayName', name: this.i18n('Name') }, - { prop: 'description', name: this.i18n('Description') }, - { prop: 'name', name: this.i18n('Key') }, + { prop: 'displayName', name: $localize`Name` }, + { prop: 'description', name: $localize`Description` }, + { prop: 'name', name: $localize`Key` }, { prop: 'source', - name: this.i18n('Source'), + name: $localize`Source`, cellTemplate: this.configurationSourceTpl, pipe: new RbdConfigurationSourcePipe() }, - { prop: 'value', name: this.i18n('Value'), cellTemplate: this.configurationValueTpl } + { prop: 'value', name: $localize`Value`, cellTemplate: this.configurationValueTpl } ]; } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.spec.ts index ce34f019a67..8f86c19a5e0 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.spec.ts @@ -10,7 +10,7 @@ import { NEVER, of } from 'rxjs'; import { delay } from 'rxjs/operators'; import { ActivatedRouteStub } from '../../../../testing/activated-route-stub'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { RbdService } from '../../../shared/api/rbd.service'; import { ImageSpec } from '../../../shared/models/image-spec'; import { SharedModule } from '../../../shared/shared.module'; @@ -41,7 +41,6 @@ describe('RbdFormComponent', () => { provide: ActivatedRoute, useValue: new ActivatedRouteStub({ pool: 'foo', name: 'bar', snap: undefined }) }, - i18nProviders, RbdService ] }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.ts index 09ac2d9e937..f1ae3273071 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.ts @@ -2,7 +2,6 @@ import { Component, EventEmitter, OnInit } from '@angular/core'; import { FormControl, ValidatorFn, Validators } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { forkJoin, Observable, ReplaySubject } from 'rxjs'; import { first, switchMap } from 'rxjs/operators'; @@ -102,48 +101,47 @@ export class RbdFormComponent extends CdForm implements OnInit { private formatter: FormatterService, private taskWrapper: TaskWrapperService, private dimlessBinaryPipe: DimlessBinaryPipe, - private i18n: I18n, public actionLabels: ActionLabelsI18n, public router: Router ) { super(); this.poolPermission = this.authStorageService.getPermissions().pool; - this.resource = this.i18n('RBD'); + this.resource = $localize`RBD`; this.features = { 'deep-flatten': { - desc: this.i18n('Deep flatten'), + desc: $localize`Deep flatten`, requires: null, allowEnable: false, allowDisable: true }, layering: { - desc: this.i18n('Layering'), + desc: $localize`Layering`, requires: null, allowEnable: false, allowDisable: false }, 'exclusive-lock': { - desc: this.i18n('Exclusive lock'), + desc: $localize`Exclusive lock`, requires: null, allowEnable: true, allowDisable: true }, 'object-map': { - desc: this.i18n('Object map (requires exclusive-lock)'), + desc: $localize`Object map (requires exclusive-lock)`, requires: 'exclusive-lock', allowEnable: true, allowDisable: true, initDisabled: true }, journaling: { - desc: this.i18n('Journaling (requires exclusive-lock)'), + desc: $localize`Journaling (requires exclusive-lock)`, requires: 'exclusive-lock', allowEnable: true, allowDisable: true, initDisabled: true }, 'fast-diff': { - desc: this.i18n('Fast diff (interlocked with object-map)'), + desc: $localize`Fast diff (interlocked with object-map)`, requires: 'object-map', allowEnable: true, allowDisable: true, diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.spec.ts index 7533bd7fa0f..193a338feb7 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.spec.ts @@ -10,7 +10,6 @@ import { BehaviorSubject, of } from 'rxjs'; import { configureTestBed, expectItemTasks, - i18nProviders, PermissionHelper } from '../../../../testing/unit-test-helper'; import { RbdService } from '../../../shared/api/rbd.service'; @@ -54,7 +53,7 @@ describe('RbdListComponent', () => { RbdConfigurationListComponent, RbdTabsComponent ], - providers: [TaskListService, i18nProviders] + providers: [TaskListService] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.ts index b1a72abbbee..18ac272143e 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.ts @@ -1,7 +1,6 @@ import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core'; import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { RbdService } from '../../../shared/api/rbd.service'; @@ -108,7 +107,6 @@ export class RbdListComponent extends ListWithDetails implements OnInit { private modalService: ModalService, private taskWrapper: TaskWrapperService, private taskListService: TaskListService, - private i18n: I18n, private urlBuilder: URLBuilderService, public actionLabels: ActionLabelsI18n ) { @@ -185,58 +183,58 @@ export class RbdListComponent extends ListWithDetails implements OnInit { ngOnInit() { this.columns = [ { - name: this.i18n('Name'), + name: $localize`Name`, prop: 'name', flexGrow: 2, cellTransformation: CellTemplate.executing }, { - name: this.i18n('Pool'), + name: $localize`Pool`, prop: 'pool_name', flexGrow: 2 }, { - name: this.i18n('Namespace'), + name: $localize`Namespace`, prop: 'namespace', flexGrow: 2 }, { - name: this.i18n('Size'), + name: $localize`Size`, prop: 'size', flexGrow: 1, cellClass: 'text-right', pipe: this.dimlessBinaryPipe }, { - name: this.i18n('Objects'), + name: $localize`Objects`, prop: 'num_objs', flexGrow: 1, cellClass: 'text-right', pipe: this.dimlessPipe }, { - name: this.i18n('Object size'), + name: $localize`Object size`, prop: 'obj_size', flexGrow: 1, cellClass: 'text-right', pipe: this.dimlessBinaryPipe }, { - name: this.i18n('Provisioned'), + name: $localize`Provisioned`, prop: 'disk_usage', cellClass: 'text-center', flexGrow: 1, pipe: this.dimlessBinaryPipe }, { - name: this.i18n('Total provisioned'), + name: $localize`Total provisioned`, prop: 'total_disk_usage', cellClass: 'text-center', flexGrow: 1, pipe: this.dimlessBinaryPipe }, { - name: this.i18n('Parent'), + name: $localize`Parent`, prop: 'parent', flexGrow: 2, cellTemplate: this.parentTpl @@ -434,9 +432,7 @@ export class RbdListComponent extends ListWithDetails implements OnInit { getDeleteDisableDesc(): string { const first = this.selection.first(); if (first && this.hasClonedSnapshots(first)) { - return this.i18n( - 'This RBD has cloned snapshots. Please delete related RBDs before deleting this RBD.' - ); + return $localize`This RBD has cloned snapshots. Please delete related RBDs before deleting this RBD.`; } return ''; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-namespace-form/rbd-namespace-form-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-namespace-form/rbd-namespace-form-modal.component.spec.ts index 33f486981f7..6ef29adc4b2 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-namespace-form/rbd-namespace-form-modal.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-namespace-form/rbd-namespace-form-modal.component.spec.ts @@ -6,7 +6,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { ToastrModule } from 'ngx-toastr'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { ComponentsModule } from '../../../shared/components/components.module'; import { AuthStorageService } from '../../../shared/services/auth-storage.service'; import { RbdNamespaceFormModalComponent } from './rbd-namespace-form-modal.component'; @@ -24,7 +24,7 @@ describe('RbdNamespaceFormModalComponent', () => { RouterTestingModule ], declarations: [RbdNamespaceFormModalComponent], - providers: [NgbActiveModal, AuthStorageService, i18nProviders] + providers: [NgbActiveModal, AuthStorageService] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-namespace-form/rbd-namespace-form-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-namespace-form/rbd-namespace-form-modal.component.ts index 1183c541d79..99c73300b6a 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-namespace-form/rbd-namespace-form-modal.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-namespace-form/rbd-namespace-form-modal.component.ts @@ -8,7 +8,6 @@ import { } from '@angular/forms'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import { Subject } from 'rxjs'; import { PoolService } from '../../../shared/api/pool.service'; @@ -43,8 +42,7 @@ export class RbdNamespaceFormModalComponent implements OnInit { private authStorageService: AuthStorageService, private notificationService: NotificationService, private poolService: PoolService, - private rbdService: RbdService, - private i18n: I18n + private rbdService: RbdService ) { this.poolPermission = this.authStorageService.getPermissions().pool; this.createForm(); @@ -132,10 +130,7 @@ export class RbdNamespaceFormModalComponent implements OnInit { .then(() => { this.notificationService.show( NotificationType.success, - this.i18n(`Created namespace '{{pool}}/{{namespace}}'`, { - pool: pool, - namespace: namespace - }) + $localize`Created namespace '${pool}/${namespace}'` ); this.activeModal.close(); this.onSubmit.next(); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-namespace-list/rbd-namespace-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-namespace-list/rbd-namespace-list.component.spec.ts index 294a598e251..eed9c6c532a 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-namespace-list/rbd-namespace-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-namespace-list/rbd-namespace-list.component.spec.ts @@ -6,7 +6,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap'; import { ToastrModule } from 'ngx-toastr'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { TaskListService } from '../../../shared/services/task-list.service'; import { SharedModule } from '../../../shared/shared.module'; import { RbdTabsComponent } from '../rbd-tabs/rbd-tabs.component'; @@ -26,7 +26,7 @@ describe('RbdNamespaceListComponent', () => { ToastrModule.forRoot(), NgbNavModule ], - providers: [TaskListService, i18nProviders] + providers: [TaskListService] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-namespace-list/rbd-namespace-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-namespace-list/rbd-namespace-list.component.ts index 7857c09f17e..8d449f3ce79 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-namespace-list/rbd-namespace-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-namespace-list/rbd-namespace-list.component.ts @@ -1,7 +1,6 @@ import { Component, OnInit } from '@angular/core'; import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { forkJoin, Observable } from 'rxjs'; @@ -41,7 +40,6 @@ export class RbdNamespaceListComponent implements OnInit { private poolService: PoolService, private modalService: ModalService, private notificationService: NotificationService, - private i18n: I18n, public actionLabels: ActionLabelsI18n ) { this.permission = this.authStorageService.getPermissions().rbdImage; @@ -65,17 +63,17 @@ export class RbdNamespaceListComponent implements OnInit { ngOnInit() { this.columns = [ { - name: this.i18n('Namespace'), + name: $localize`Namespace`, prop: 'namespace', flexGrow: 1 }, { - name: this.i18n('Pool'), + name: $localize`Pool`, prop: 'pool', flexGrow: 1 }, { - name: this.i18n('Total images'), + name: $localize`Total images`, prop: 'num_images', flexGrow: 1 } @@ -137,10 +135,7 @@ export class RbdNamespaceListComponent implements OnInit { () => { this.notificationService.show( NotificationType.success, - this.i18n(`Deleted namespace '{{pool}}/{{namespace}}'`, { - pool: pool, - namespace: namespace - }) + $localize`Deleted namespace '${pool}/${namespace}'` ); this.modalRef.close(); this.refresh(); @@ -156,7 +151,7 @@ export class RbdNamespaceListComponent implements OnInit { const first = this.selection.first(); if (first) { if (first.num_images > 0) { - return this.i18n('Namespace contains images'); + return $localize`Namespace contains images`; } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-performance/rbd-performance.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-performance/rbd-performance.component.spec.ts index bec05b924ef..9db62c9bada 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-performance/rbd-performance.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-performance/rbd-performance.component.spec.ts @@ -4,7 +4,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { SharedModule } from '../../../shared/shared.module'; import { RbdTabsComponent } from '../rbd-tabs/rbd-tabs.component'; import { RbdPerformanceComponent } from './rbd-performance.component'; @@ -15,8 +15,7 @@ describe('RbdPerformanceComponent', () => { configureTestBed({ imports: [HttpClientTestingModule, RouterTestingModule, SharedModule, NgbNavModule], - declarations: [RbdPerformanceComponent, RbdTabsComponent], - providers: i18nProviders + declarations: [RbdPerformanceComponent, RbdTabsComponent] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form-modal.component.spec.ts index 3e60a3ba787..15ca77f21c2 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form-modal.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form-modal.component.spec.ts @@ -6,7 +6,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { ToastrModule } from 'ngx-toastr'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { ComponentsModule } from '../../../shared/components/components.module'; import { PipesModule } from '../../../shared/pipes/pipes.module'; import { AuthStorageService } from '../../../shared/services/auth-storage.service'; @@ -26,7 +26,7 @@ describe('RbdSnapshotFormModalComponent', () => { RouterTestingModule ], declarations: [RbdSnapshotFormModalComponent], - providers: [NgbActiveModal, AuthStorageService, i18nProviders] + providers: [NgbActiveModal, AuthStorageService] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form-modal.component.ts index f49b72dde5d..b908a7ca35f 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form-modal.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form-modal.component.ts @@ -2,7 +2,6 @@ import { Component, OnInit } from '@angular/core'; import { FormControl, Validators } from '@angular/forms'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import { Subject } from 'rxjs'; import { RbdService } from '../../../shared/api/rbd.service'; @@ -37,11 +36,10 @@ export class RbdSnapshotFormModalComponent implements OnInit { private rbdService: RbdService, private taskManagerService: TaskManagerService, private notificationService: NotificationService, - private i18n: I18n, private actionLabels: ActionLabelsI18n ) { this.action = this.actionLabels.CREATE; - this.resource = this.i18n('RBD Snapshot'); + this.resource = $localize`RBD Snapshot`; this.createForm(); } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-actions.model.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-actions.model.ts index 871939ec050..040f5824de3 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-actions.model.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-actions.model.ts @@ -1,4 +1,3 @@ -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { ActionLabelsI18n } from '../../../shared/constants/app.constants'; @@ -7,8 +6,6 @@ import { CdTableAction } from '../../../shared/models/cd-table-action'; import { CdTableSelection } from '../../../shared/models/cd-table-selection'; export class RbdSnapshotActionsModel { - i18n: I18n; - create: CdTableAction; rename: CdTableAction; protect: CdTableAction; @@ -19,9 +16,7 @@ export class RbdSnapshotActionsModel { deleteSnap: CdTableAction; ordering: CdTableAction[]; - constructor(i18n: I18n, actionLabels: ActionLabelsI18n, featuresName: string[]) { - this.i18n = i18n; - + constructor(actionLabels: ActionLabelsI18n, featuresName: string[]) { this.create = { permission: 'create', icon: Icons.add, @@ -94,7 +89,7 @@ export class RbdSnapshotActionsModel { getCloneDisableDesc(featuresName: string[]): string | undefined { if (!featuresName?.includes('layering')) { - return this.i18n('Parent image must support Layering'); + return $localize`Parent image must support Layering`; } return undefined; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.spec.ts index fc08cba0704..1ea292e0b4f 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.spec.ts @@ -4,7 +4,6 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { RouterTestingModule } from '@angular/router/testing'; import { NgbModalModule, NgbNavModule } from '@ng-bootstrap/ng-bootstrap'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import { NgBootstrapFormValidationModule } from 'ng-bootstrap-form-validation'; import { MockComponent } from 'ng-mocks'; import { ToastrModule } from 'ngx-toastr'; @@ -13,7 +12,6 @@ import { Subject, throwError as observableThrowError } from 'rxjs'; import { configureTestBed, expectItemTasks, - i18nProviders, PermissionHelper } from '../../../../testing/unit-test-helper'; import { RbdService } from '../../../shared/api/rbd.service'; @@ -71,8 +69,7 @@ describe('RbdSnapshotListComponent', () => { ], providers: [ { provide: AuthStorageService, useValue: fakeAuthStorageService }, - TaskListService, - i18nProviders + TaskListService ] }, [CriticalConfirmationModalComponent] @@ -98,7 +95,6 @@ describe('RbdSnapshotListComponent', () => { beforeEach(() => { fixture.detectChanges(); - const i18n = TestBed.inject(I18n); const modalService = TestBed.inject(ModalService); const actionLabelsI18n = TestBed.inject(ActionLabelsI18n); called = false; @@ -116,7 +112,6 @@ describe('RbdSnapshotListComponent', () => { notificationService, null, null, - i18n, actionLabelsI18n ); spyOn(rbdService, 'deleteSnapshot').and.returnValue(observableThrowError({ status: 500 })); @@ -210,7 +205,6 @@ describe('RbdSnapshotListComponent', () => { null, null, null, - TestBed.inject(I18n), TestBed.inject(ActionLabelsI18n) ); ref.componentInstance.onSubmit = new Subject(); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.ts index 8c3a1fc4337..1559a9854f9 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.ts @@ -1,7 +1,6 @@ import { Component, Input, OnChanges, OnInit, TemplateRef, ViewChild } from '@angular/core'; import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as moment from 'moment'; import { of } from 'rxjs'; @@ -80,7 +79,6 @@ export class RbdSnapshotListComponent implements OnInit, OnChanges { private notificationService: NotificationService, private summaryService: SummaryService, private taskListService: TaskListService, - private i18n: I18n, private actionLabels: ActionLabelsI18n ) { this.permission = this.authStorageService.getPermissions().rbdImage; @@ -89,39 +87,39 @@ export class RbdSnapshotListComponent implements OnInit, OnChanges { ngOnInit() { this.columns = [ { - name: this.i18n('Name'), + name: $localize`Name`, prop: 'name', cellTransformation: CellTemplate.executing, flexGrow: 2 }, { - name: this.i18n('Size'), + name: $localize`Size`, prop: 'size', flexGrow: 1, cellClass: 'text-right', pipe: this.dimlessBinaryPipe }, { - name: this.i18n('Provisioned'), + name: $localize`Provisioned`, prop: 'disk_usage', flexGrow: 1, cellClass: 'text-right', pipe: this.dimlessBinaryPipe }, { - name: this.i18n('State'), + name: $localize`State`, prop: 'is_protected', flexGrow: 1, cellTransformation: CellTemplate.badge, customTemplateConfig: { map: { - true: { value: this.i18n('PROTECTED'), class: 'badge-success' }, - false: { value: this.i18n('UNPROTECTED'), class: 'badge-info' } + true: { value: $localize`PROTECTED`, class: 'badge-success' }, + false: { value: $localize`UNPROTECTED`, class: 'badge-info' } } } }, { - name: this.i18n('Created'), + name: $localize`Created`, prop: 'timestamp', flexGrow: 1, pipe: this.cdDatePipe @@ -132,7 +130,7 @@ export class RbdSnapshotListComponent implements OnInit, OnChanges { ngOnChanges() { const imageSpec = new ImageSpec(this.poolName, this.namespace, this.rbdName); - const actions = new RbdSnapshotActionsModel(this.i18n, this.actionLabels, this.featuresName); + const actions = new RbdSnapshotActionsModel(this.actionLabels, this.featuresName); actions.create.click = () => this.openCreateSnapshotModal(); actions.rename.click = () => this.openEditSnapshotModal(); actions.protect.click = () => this.toggleProtection(); @@ -266,8 +264,8 @@ export class RbdSnapshotListComponent implements OnInit, OnChanges { const snapshotName = this.selection.selected[0].name; const imageSpec = new ImageSpec(this.poolName, this.namespace, this.rbdName).toString(); const initialState = { - titleText: this.i18n('RBD snapshot rollback'), - buttonText: this.i18n('Rollback'), + titleText: $localize`RBD snapshot rollback`, + buttonText: $localize`Rollback`, bodyTpl: this.rollbackTpl, bodyData: { snapName: `${imageSpec}@${snapshotName}` @@ -283,7 +281,7 @@ export class RbdSnapshotListComponent implements OnInit, OnChanges { deleteSnapshotModal() { const snapshotName = this.selection.selected[0].name; this.modalRef = this.modalService.show(CriticalConfirmationModalComponent, { - itemDescription: this.i18n('RBD snapshot'), + itemDescription: $localize`RBD snapshot`, itemNames: [snapshotName], submitAction: () => this._asyncTask('deleteSnapshot', 'rbd/snap/delete', snapshotName) }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-list/rbd-trash-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-list/rbd-trash-list.component.spec.ts index a448a9cd6e8..d975a1c4128 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-list/rbd-trash-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-list/rbd-trash-list.component.spec.ts @@ -9,11 +9,7 @@ import * as moment from 'moment'; import { ToastrModule } from 'ngx-toastr'; import { of } from 'rxjs'; -import { - configureTestBed, - expectItemTasks, - i18nProviders -} from '../../../../testing/unit-test-helper'; +import { configureTestBed, expectItemTasks } from '../../../../testing/unit-test-helper'; import { RbdService } from '../../../shared/api/rbd.service'; import { CdTableSelection } from '../../../shared/models/cd-table-selection'; import { ExecutingTask } from '../../../shared/models/executing-task'; @@ -40,7 +36,7 @@ describe('RbdTrashListComponent', () => { NgbNavModule, ToastrModule.forRoot() ], - providers: [TaskListService, i18nProviders] + providers: [TaskListService] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-list/rbd-trash-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-list/rbd-trash-list.component.ts index 9b6b3b44b89..63b4d085bb3 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-list/rbd-trash-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-list/rbd-trash-list.component.ts @@ -1,7 +1,6 @@ import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core'; import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import * as moment from 'moment'; @@ -62,7 +61,6 @@ export class RbdTrashListComponent implements OnInit { private cdDatePipe: CdDatePipe, private taskListService: TaskListService, private taskWrapper: TaskWrapperService, - private i18n: I18n, public actionLabels: ActionLabelsI18n ) { this.permission = this.authStorageService.getPermissions().rbdImage; @@ -84,34 +82,34 @@ export class RbdTrashListComponent implements OnInit { ngOnInit() { this.columns = [ { - name: this.i18n('ID'), + name: $localize`ID`, prop: 'id', flexGrow: 1, cellTransformation: CellTemplate.executing }, { - name: this.i18n('Name'), + name: $localize`Name`, prop: 'name', flexGrow: 1 }, { - name: this.i18n('Pool'), + name: $localize`Pool`, prop: 'pool_name', flexGrow: 1 }, { - name: this.i18n('Namespace'), + name: $localize`Namespace`, prop: 'namespace', flexGrow: 1 }, { - name: this.i18n('Status'), + name: $localize`Status`, prop: 'deferment_end_time', flexGrow: 1, cellTemplate: this.expiresTpl }, { - name: this.i18n('Deleted At'), + name: $localize`Deleted At`, prop: 'deletion_time', flexGrow: 1, pipe: this.cdDatePipe diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-move-modal/rbd-trash-move-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-move-modal/rbd-trash-move-modal.component.spec.ts index cb0dd58c40a..22fc800585c 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-move-modal/rbd-trash-move-modal.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-move-modal/rbd-trash-move-modal.component.spec.ts @@ -7,7 +7,7 @@ import { NgbActiveModal, NgbPopoverModule } from '@ng-bootstrap/ng-bootstrap'; import * as moment from 'moment'; import { ToastrModule } from 'ngx-toastr'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { NotificationService } from '../../../shared/services/notification.service'; import { SharedModule } from '../../../shared/shared.module'; import { RbdTrashMoveModalComponent } from './rbd-trash-move-modal.component'; @@ -27,7 +27,7 @@ describe('RbdTrashMoveModalComponent', () => { NgbPopoverModule ], declarations: [RbdTrashMoveModalComponent], - providers: [NgbActiveModal, i18nProviders] + providers: [NgbActiveModal] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-purge-modal/rbd-trash-purge-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-purge-modal/rbd-trash-purge-modal.component.spec.ts index fbecde705cc..852c785edae 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-purge-modal/rbd-trash-purge-modal.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-purge-modal/rbd-trash-purge-modal.component.spec.ts @@ -10,7 +10,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { ToastrModule } from 'ngx-toastr'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { Permission } from '../../../shared/models/permissions'; import { NotificationService } from '../../../shared/services/notification.service'; import { SharedModule } from '../../../shared/shared.module'; @@ -30,7 +30,7 @@ describe('RbdTrashPurgeModalComponent', () => { RouterTestingModule ], declarations: [RbdTrashPurgeModalComponent], - providers: [NgbActiveModal, i18nProviders] + providers: [NgbActiveModal] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-restore-modal/rbd-trash-restore-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-restore-modal/rbd-trash-restore-modal.component.spec.ts index 7878e7e8139..1577afbb996 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-restore-modal/rbd-trash-restore-modal.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-restore-modal/rbd-trash-restore-modal.component.spec.ts @@ -10,7 +10,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { ToastrModule } from 'ngx-toastr'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { NotificationService } from '../../../shared/services/notification.service'; import { SharedModule } from '../../../shared/shared.module'; import { RbdTrashRestoreModalComponent } from './rbd-trash-restore-modal.component'; @@ -28,7 +28,7 @@ describe('RbdTrashRestoreModalComponent', () => { SharedModule, RouterTestingModule ], - providers: [NgbActiveModal, i18nProviders] + providers: [NgbActiveModal] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-clients/cephfs-clients.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-clients/cephfs-clients.component.spec.ts index bdc0dcf250d..ea6ca381e9d 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-clients/cephfs-clients.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-clients/cephfs-clients.component.spec.ts @@ -4,11 +4,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { ToastrModule } from 'ngx-toastr'; -import { - configureTestBed, - i18nProviders, - PermissionHelper -} from '../../../../testing/unit-test-helper'; +import { configureTestBed, PermissionHelper } from '../../../../testing/unit-test-helper'; import { TableActionsComponent } from '../../../shared/datatable/table-actions/table-actions.component'; import { ViewCacheStatus } from '../../../shared/enum/view-cache-status.enum'; import { SharedModule } from '../../../shared/shared.module'; @@ -25,8 +21,7 @@ describe('CephfsClientsComponent', () => { SharedModule, HttpClientTestingModule ], - declarations: [CephfsClientsComponent], - providers: i18nProviders + declarations: [CephfsClientsComponent] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-clients/cephfs-clients.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-clients/cephfs-clients.component.ts index 305dcbca4e9..5d128fb7dd0 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-clients/cephfs-clients.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-clients/cephfs-clients.component.ts @@ -1,7 +1,6 @@ import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import { CephfsService } from '../../../shared/api/cephfs.service'; import { CriticalConfirmationModalComponent } from '../../../shared/components/critical-confirmation-modal/critical-confirmation-modal.component'; @@ -48,7 +47,6 @@ export class CephfsClientsComponent implements OnInit { private modalService: ModalService, private notificationService: NotificationService, private authStorageService: AuthStorageService, - private i18n: I18n, private actionLabels: ActionLabelsI18n ) { this.permission = this.authStorageService.getPermissions().cephfs; @@ -63,12 +61,12 @@ export class CephfsClientsComponent implements OnInit { ngOnInit() { this.columns = [ - { prop: 'id', name: this.i18n('id') }, - { prop: 'type', name: this.i18n('type') }, - { prop: 'state', name: this.i18n('state') }, - { prop: 'version', name: this.i18n('version') }, - { prop: 'hostname', name: this.i18n('Host') }, - { prop: 'root', name: this.i18n('root') } + { prop: 'id', name: $localize`id` }, + { prop: 'type', name: $localize`type` }, + { prop: 'state', name: $localize`state` }, + { prop: 'version', name: $localize`version` }, + { prop: 'hostname', name: $localize`Host` }, + { prop: 'root', name: $localize`root` } ]; } @@ -83,7 +81,7 @@ export class CephfsClientsComponent implements OnInit { this.modalRef.close(); this.notificationService.show( NotificationType.success, - this.i18n(`Evicted client '{{clientId}}'`, { clientId: clientId }) + $localize`Evicted client '${clientId}'` ); }, () => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.spec.ts index 1d80097c92b..130439e52a2 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.spec.ts @@ -1,7 +1,7 @@ import { Component, Input } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { SharedModule } from '../../../shared/shared.module'; import { CephfsDetailComponent } from './cephfs-detail.component'; @@ -34,8 +34,7 @@ describe('CephfsDetailComponent', () => { configureTestBed({ imports: [SharedModule], - declarations: [CephfsDetailComponent, CephfsChartStubComponent], - providers: i18nProviders + declarations: [CephfsDetailComponent, CephfsChartStubComponent] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.ts index d45fb70bf9c..655aefa18b1 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.ts @@ -1,6 +1,5 @@ import { Component, Input, OnChanges, OnInit, TemplateRef, ViewChild } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { CdTableColumn } from '../../../shared/models/cd-table-column'; @@ -35,11 +34,7 @@ export class CephfsDetailComponent implements OnChanges, OnInit { objectValues = Object.values; - constructor( - private dimlessBinary: DimlessBinaryPipe, - private dimless: DimlessPipe, - private i18n: I18n - ) {} + constructor(private dimlessBinary: DimlessBinaryPipe, private dimless: DimlessPipe) {} ngOnChanges() { this.setStandbys(); @@ -48,7 +43,7 @@ export class CephfsDetailComponent implements OnChanges, OnInit { private setStandbys() { this.standbys = [ { - key: this.i18n('Standby daemons'), + key: $localize`Standby daemons`, value: this.data.standbys } ]; @@ -57,19 +52,19 @@ export class CephfsDetailComponent implements OnChanges, OnInit { ngOnInit() { this.columns = { ranks: [ - { prop: 'rank', name: this.i18n('Rank') }, - { prop: 'state', name: this.i18n('State') }, - { prop: 'mds', name: this.i18n('Daemon') }, - { prop: 'activity', name: this.i18n('Activity'), cellTemplate: this.activityTmpl }, - { prop: 'dns', name: this.i18n('Dentries'), pipe: this.dimless }, - { prop: 'inos', name: this.i18n('Inodes'), pipe: this.dimless } + { prop: 'rank', name: $localize`Rank` }, + { prop: 'state', name: $localize`State` }, + { prop: 'mds', name: $localize`Daemon` }, + { prop: 'activity', name: $localize`Activity`, cellTemplate: this.activityTmpl }, + { prop: 'dns', name: $localize`Dentries`, pipe: this.dimless }, + { prop: 'inos', name: $localize`Inodes`, pipe: this.dimless } ], pools: [ - { prop: 'pool', name: this.i18n('Pool') }, - { prop: 'type', name: this.i18n('Type') }, - { prop: 'size', name: this.i18n('Size'), pipe: this.dimlessBinary }, + { prop: 'pool', name: $localize`Pool` }, + { prop: 'type', name: $localize`Type` }, + { prop: 'size', name: $localize`Size`, pipe: this.dimlessBinary }, { - name: this.i18n('Usage'), + name: $localize`Usage`, cellTemplate: this.poolUsageTpl, comparator: (_valueA: any, _valueB: any, rowA: any, rowB: any) => { const valA = rowA.used / rowA.avail; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-directories/cephfs-directories.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-directories/cephfs-directories.component.spec.ts index 4382f630ad7..124fad18c2b 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-directories/cephfs-directories.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-directories/cephfs-directories.component.spec.ts @@ -12,7 +12,6 @@ import { Observable, of } from 'rxjs'; import { configureTestBed, - i18nProviders, modalServiceShow, PermissionHelper } from '../../../../testing/unit-test-helper'; @@ -375,7 +374,7 @@ describe('CephfsDirectoriesComponent', () => { NgbModalModule ], declarations: [CephfsDirectoriesComponent], - providers: [i18nProviders, NgbActiveModal] + providers: [NgbActiveModal] }, [CriticalConfirmationModalComponent, FormModalComponent, ConfirmationModalComponent] ); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-directories/cephfs-directories.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-directories/cephfs-directories.component.ts index df6ae3a250f..13c9c87e164 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-directories/cephfs-directories.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-directories/cephfs-directories.component.ts @@ -2,7 +2,6 @@ import { Component, Input, OnChanges, OnInit, TemplateRef, ViewChild } from '@an import { Validators } from '@angular/forms'; import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import { ITreeOptions, TreeComponent, @@ -110,7 +109,6 @@ export class CephfsDirectoriesComponent implements OnInit, OnChanges { private modalService: ModalService, private cephfsService: CephfsService, private cdDatePipe: CdDatePipe, - private i18n: I18n, private actionLabels: ActionLabelsI18n, private notificationService: NotificationService, private dimlessBinaryPipe: DimlessBinaryPipe @@ -141,18 +139,18 @@ export class CephfsDirectoriesComponent implements OnInit, OnChanges { columns: [ { prop: 'row.name', - name: this.i18n('Name'), + name: $localize`Name`, flexGrow: 1 }, { prop: 'row.value', - name: this.i18n('Value'), + name: $localize`Value`, sortable: false, flexGrow: 1 }, { prop: 'row.originPath', - name: this.i18n('Origin'), + name: $localize`Origin`, sortable: false, cellTemplate: this.originTmpl, flexGrow: 1 @@ -195,18 +193,18 @@ export class CephfsDirectoriesComponent implements OnInit, OnChanges { columns: [ { prop: 'name', - name: this.i18n('Name'), + name: $localize`Name`, flexGrow: 1 }, { prop: 'path', - name: this.i18n('Path'), + name: $localize`Path`, isHidden: true, flexGrow: 2 }, { prop: 'created', - name: this.i18n('Created'), + name: $localize`Created`, flexGrow: 1, pipe: this.cdDatePipe } @@ -352,7 +350,7 @@ export class CephfsDirectoriesComponent implements OnInit, OnChanges { } return { row: { - name: quotaKey === 'max_bytes' ? this.i18n('Max size') : this.i18n('Max files'), + name: quotaKey === 'max_bytes' ? $localize`Max size` : $localize`Max files`, value: valueConvertFn(value), originPath: value ? dir.path : '' }, @@ -422,26 +420,23 @@ export class CephfsDirectoriesComponent implements OnInit, OnChanges { path ), message: nextMax.value - ? this.i18n('The inherited {{quotaValue}} is the maximum value to be used.', { - quotaValue: this.getQuotaValueFromPathMsg(nextMax.value, nextMax.path) - }) + ? $localize`The inherited ${this.getQuotaValueFromPathMsg( + nextMax.value, + nextMax.path + )} is the maximum value to be used.` : undefined, fields: [this.getQuotaFormField(selection.row.name, key, value, nextMax.value)], - submitButtonText: this.i18n('Save'), + submitButtonText: $localize`Save`, onSubmit: (values: CephfsQuotas) => this.updateQuota(values) }); } private getModalQuotaTitle(action: string, path: string): string { - return this.i18n(`{{action}} CephFS {{quotaName}} quota for '{{path}}'`, { - action, - quotaName: this.getQuotaName(), - path - }); + return $localize`${action} CephFS ${this.getQuotaName()} quota for '${path}'`; } private getQuotaName(): string { - return this.isBytesQuotaSelected() ? this.i18n('size') : this.i18n('files'); + return this.isBytesQuotaSelected() ? $localize`size` : $localize`files`; } private isBytesQuotaSelected(): boolean { @@ -449,11 +444,9 @@ export class CephfsDirectoriesComponent implements OnInit, OnChanges { } private getQuotaValueFromPathMsg(value: number, path: string): string { - return this.i18n(`{{quotaName}} quota {{value}} from '{{path}}'`, { - value: this.isBytesQuotaSelected() ? this.dimlessBinaryPipe.transform(value) : value, - quotaName: this.getQuotaName(), - path - }); + value = this.isBytesQuotaSelected() ? this.dimlessBinaryPipe.transform(value) : value; + + return $localize`${this.getQuotaName()} quota ${value} from '${path}'`; } private getQuotaFormField( @@ -477,8 +470,8 @@ export class CephfsDirectoriesComponent implements OnInit, OnChanges { }; if (!isBinary) { field.errors = { - min: this.i18n(`Value has to be at least {{value}} or more`, { value: 0 }), - max: this.i18n(`Value has to be at most {{value}} or less`, { value: maxValue }) + min: $localize`Value has to be at least 0 or more`, + max: $localize`Value has to be at most ${maxValue} or less` }; } return field; @@ -492,7 +485,7 @@ export class CephfsDirectoriesComponent implements OnInit, OnChanges { ? this.actionLabels.SET : values[key] === 0 ? this.actionLabels.UNSET - : this.i18n('Updated'); + : $localize`Updated`; this.cephfsService.updateQuota(this.id, path, values).subscribe(() => { if (onSuccess) { onSuccess(); @@ -512,23 +505,21 @@ export class CephfsDirectoriesComponent implements OnInit, OnChanges { const nextMax = selection.nextTreeMaximum; const dirValue = selection.dirValue; + const quotaValue = this.getQuotaValueFromPathMsg(nextMax.value, nextMax.path); + const conclusion = + nextMax.value > 0 + ? nextMax.value > dirValue + ? $localize`in order to inherit ${quotaValue}` + : $localize`which isn't used because of the inheritance of ${quotaValue}` + : $localize`in order to have no quota on the directory`; + this.modalRef = this.modalService.show(ConfirmationModalComponent, { titleText: this.getModalQuotaTitle(this.actionLabels.UNSET, path), buttonText: this.actionLabels.UNSET, - description: this.i18n(`{{action}} {{quotaValue}} {{conclusion}}.`, { - action: this.actionLabels.UNSET, - quotaValue: this.getQuotaValueFromPathMsg(dirValue, path), - conclusion: - nextMax.value > 0 - ? nextMax.value > dirValue - ? this.i18n('in order to inherit {{quotaValue}}', { - quotaValue: this.getQuotaValueFromPathMsg(nextMax.value, nextMax.path) - }) - : this.i18n(`which isn't used because of the inheritance of {{quotaValue}}`, { - quotaValue: this.getQuotaValueFromPathMsg(nextMax.value, nextMax.path) - }) - : this.i18n('in order to have no quota on the directory') - }), + description: $localize`${this.actionLabels.UNSET} ${this.getQuotaValueFromPathMsg( + dirValue, + path + )} ${conclusion}.`, onSubmit: () => this.updateQuota({ [key]: 0 }, () => this.modalRef.close()) }); } @@ -537,8 +528,8 @@ export class CephfsDirectoriesComponent implements OnInit, OnChanges { // Create a snapshot. Auto-generate a snapshot name by default. const path = this.selectedDir.path; this.modalService.show(FormModalComponent, { - titleText: this.i18n('Create Snapshot'), - message: this.i18n('Please enter the name of the snapshot.'), + titleText: $localize`Create Snapshot`, + message: $localize`Please enter the name of the snapshot.`, fields: [ { type: 'text', @@ -547,15 +538,12 @@ export class CephfsDirectoriesComponent implements OnInit, OnChanges { required: true } ], - submitButtonText: this.i18n('Create Snapshot'), + submitButtonText: $localize`Create Snapshot`, onSubmit: (values: CephfsSnapshot) => { this.cephfsService.mkSnapshot(this.id, path, values.name).subscribe((name) => { this.notificationService.show( NotificationType.success, - this.i18n(`Created snapshot '{{name}}' for '{{path}}'`, { - name: name, - path: path - }) + $localize`Created snapshot '${name}' for '${path}'` ); this.forceDirRefresh(); }); @@ -668,7 +656,7 @@ export class CephfsDirectoriesComponent implements OnInit, OnChanges { deleteSnapshotModal() { this.modalRef = this.modalService.show(CriticalConfirmationModalComponent, { - itemDescription: this.i18n('CephFs Snapshot'), + itemDescription: $localize`CephFs Snapshot`, itemNames: this.snapshot.selection.selected.map((snapshot: CephfsSnapshot) => snapshot.name), submitAction: () => this.deleteSnapshot() }); @@ -681,10 +669,7 @@ export class CephfsDirectoriesComponent implements OnInit, OnChanges { this.cephfsService.rmSnapshot(this.id, path, name).subscribe(() => { this.notificationService.show( NotificationType.success, - this.i18n(`Deleted snapshot '{{name}}' for '{{path}}'`, { - name: name, - path: path - }) + $localize`Deleted snapshot '${name}' for '${path}'` ); }); }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-list/cephfs-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-list/cephfs-list.component.spec.ts index f0d0803295d..a8f87b6ba29 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-list/cephfs-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-list/cephfs-list.component.spec.ts @@ -3,7 +3,7 @@ import { Component, Input } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { CdTableSelection } from '../../../shared/models/cd-table-selection'; import { SharedModule } from '../../../shared/shared.module'; import { CephfsListComponent } from './cephfs-list.component'; @@ -20,8 +20,7 @@ describe('CephfsListComponent', () => { configureTestBed({ imports: [BrowserAnimationsModule, SharedModule, HttpClientTestingModule], - declarations: [CephfsListComponent, CephfsTabsStubComponent], - providers: i18nProviders + declarations: [CephfsListComponent, CephfsTabsStubComponent] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-list/cephfs-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-list/cephfs-list.component.ts index 9b4ece957fd..4b19803d870 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-list/cephfs-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-list/cephfs-list.component.ts @@ -1,7 +1,5 @@ import { Component, OnInit } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; - import { CephfsService } from '../../../shared/api/cephfs.service'; import { ListWithDetails } from '../../../shared/classes/list-with-details.class'; import { CellTemplate } from '../../../shared/enum/cell-template.enum'; @@ -20,29 +18,25 @@ export class CephfsListComponent extends ListWithDetails implements OnInit { filesystems: any = []; selection = new CdTableSelection(); - constructor( - private cephfsService: CephfsService, - private cdDatePipe: CdDatePipe, - private i18n: I18n - ) { + constructor(private cephfsService: CephfsService, private cdDatePipe: CdDatePipe) { super(); } ngOnInit() { this.columns = [ { - name: this.i18n('Name'), + name: $localize`Name`, prop: 'mdsmap.fs_name', flexGrow: 2 }, { - name: this.i18n('Created'), + name: $localize`Created`, prop: 'mdsmap.created', flexGrow: 2, pipe: this.cdDatePipe }, { - name: this.i18n('Enabled'), + name: $localize`Enabled`, prop: 'mdsmap.enabled', flexGrow: 1, cellTransformation: CellTemplate.checkIcon diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-tabs/cephfs-tabs.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-tabs/cephfs-tabs.component.spec.ts index d165e589261..714f4e467bf 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-tabs/cephfs-tabs.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-tabs/cephfs-tabs.component.spec.ts @@ -8,7 +8,7 @@ import * as _ from 'lodash'; import { ToastrModule } from 'ngx-toastr'; import { of } from 'rxjs'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { CephfsService } from '../../../shared/api/cephfs.service'; import { ViewCacheStatus } from '../../../shared/enum/view-cache-status.enum'; import { SharedModule } from '../../../shared/shared.module'; @@ -91,8 +91,7 @@ describe('CephfsTabsComponent', () => { CephfsDetailComponent, CephfsDirectoriesComponent, CephfsClientsComponent - ], - providers: [i18nProviders] + ] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-details/configuration-details.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-details/configuration-details.component.spec.ts index 40b05d829a4..5e079e81440 100755 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-details/configuration-details.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-details/configuration-details.component.spec.ts @@ -1,6 +1,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../../testing/unit-test-helper'; import { DataTableModule } from '../../../../shared/datatable/datatable.module'; import { SharedModule } from '../../../../shared/shared.module'; import { ConfigurationDetailsComponent } from './configuration-details.component'; @@ -11,8 +11,7 @@ describe('ConfigurationDetailsComponent', () => { configureTestBed({ declarations: [ConfigurationDetailsComponent], - imports: [DataTableModule, SharedModule], - providers: [i18nProviders] + imports: [DataTableModule, SharedModule] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-details/configuration-details.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-details/configuration-details.component.ts index d80544bd02c..df0e6d16261 100755 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-details/configuration-details.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-details/configuration-details.component.ts @@ -1,6 +1,5 @@ import { Component, Input, OnChanges } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; @Component({ @@ -12,18 +11,16 @@ export class ConfigurationDetailsComponent implements OnChanges { @Input() selection: any; flags = { - runtime: this.i18n('The value can be updated at runtime.'), - no_mon_update: this.i18n(`Daemons/clients do not pull this value from the + runtime: $localize`The value can be updated at runtime.`, + no_mon_update: $localize`Daemons/clients do not pull this value from the monitor config database. We disallow setting this option via 'ceph config set ...'. This option should be configured via ceph.conf or via the - command line.`), - startup: this.i18n('Option takes effect only during daemon startup.'), - cluster_create: this.i18n('Option only affects cluster creation.'), - create: this.i18n('Option only affects daemon creation.') + command line.`, + startup: $localize`Option takes effect only during daemon startup.`, + cluster_create: $localize`Option only affects cluster creation.`, + create: $localize`Option only affects daemon creation.` }; - constructor(private i18n: I18n) {} - ngOnChanges() { if (this.selection) { this.selection.services = _.split(this.selection.services, ','); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-form/configuration-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-form/configuration-form.component.spec.ts index 070455fbb45..d6fd507f839 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-form/configuration-form.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-form/configuration-form.component.spec.ts @@ -6,7 +6,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { ToastrModule } from 'ngx-toastr'; -import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../../testing/unit-test-helper'; import { ConfigFormModel } from '../../../../shared/components/config-option/config-option.model'; import { SharedModule } from '../../../../shared/shared.module'; import { ConfigurationFormComponent } from './configuration-form.component'; @@ -27,8 +27,7 @@ describe('ConfigurationFormComponent', () => { providers: [ { provide: ActivatedRoute - }, - i18nProviders + } ] }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-form/configuration-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-form/configuration-form.component.ts index 771180f1394..aa9ab7b839c 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-form/configuration-form.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-form/configuration-form.component.ts @@ -2,7 +2,6 @@ import { Component, OnInit } from '@angular/core'; import { FormControl, FormGroup, ValidatorFn } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { ConfigurationService } from '../../../../shared/api/configuration.service'; @@ -34,8 +33,7 @@ export class ConfigurationFormComponent extends CdForm implements OnInit { private route: ActivatedRoute, private router: Router, private configService: ConfigurationService, - private notificationService: NotificationService, - private i18n: I18n + private notificationService: NotificationService ) { super(); this.createForm(); @@ -157,7 +155,7 @@ export class ConfigurationFormComponent extends CdForm implements OnInit { () => { this.notificationService.show( NotificationType.success, - this.i18n('Updated config option {{name}}', { name: request.name }) + $localize`Updated config option ${request.name}` ); this.router.navigate(['/configuration']); }, diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration.component.spec.ts index 32cee6c2a3f..0aa03948562 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration.component.spec.ts @@ -7,7 +7,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { SharedModule } from '../../../shared/shared.module'; import { ConfigurationDetailsComponent } from './configuration-details/configuration-details.component'; import { ConfigurationComponent } from './configuration.component'; @@ -25,8 +25,7 @@ describe('ConfigurationComponent', () => { NgbNavModule, HttpClientTestingModule, RouterTestingModule - ], - providers: i18nProviders + ] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration.component.ts index 74971b32c6f..f32c1b0e966 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration.component.ts @@ -1,7 +1,5 @@ import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; - import { ConfigurationService } from '../../../shared/api/configuration.service'; import { ListWithDetails } from '../../../shared/classes/list-with-details.class'; import { ActionLabelsI18n } from '../../../shared/constants/app.constants'; @@ -28,7 +26,7 @@ export class ConfigurationComponent extends ListWithDetails implements OnInit { selection = new CdTableSelection(); filters: CdTableColumn[] = [ { - name: this.i18n('Level'), + name: $localize`Level`, prop: 'level', filterOptions: ['basic', 'advanced', 'dev'], filterInitValue: 'basic', @@ -45,7 +43,7 @@ export class ConfigurationComponent extends ListWithDetails implements OnInit { } }, { - name: this.i18n('Service'), + name: $localize`Service`, prop: 'services', filterOptions: ['mon', 'mgr', 'osd', 'mds', 'common', 'mds_client', 'rgw'], filterPredicate: (row, value) => { @@ -53,7 +51,7 @@ export class ConfigurationComponent extends ListWithDetails implements OnInit { } }, { - name: this.i18n('Source'), + name: $localize`Source`, prop: 'source', filterOptions: ['mon'], filterPredicate: (row, value) => { @@ -64,7 +62,7 @@ export class ConfigurationComponent extends ListWithDetails implements OnInit { } }, { - name: this.i18n('Modified'), + name: $localize`Modified`, prop: 'modified', filterOptions: ['yes', 'no'], filterPredicate: (row, value) => { @@ -89,7 +87,6 @@ export class ConfigurationComponent extends ListWithDetails implements OnInit { constructor( private authStorageService: AuthStorageService, private configurationService: ConfigurationService, - private i18n: I18n, public actionLabels: ActionLabelsI18n ) { super(); @@ -108,18 +105,18 @@ export class ConfigurationComponent extends ListWithDetails implements OnInit { ngOnInit() { this.columns = [ - { canAutoResize: true, prop: 'name', name: this.i18n('Name') }, - { prop: 'desc', name: this.i18n('Description'), cellClass: 'wrap' }, + { canAutoResize: true, prop: 'name', name: $localize`Name` }, + { prop: 'desc', name: $localize`Description`, cellClass: 'wrap' }, { prop: 'value', - name: this.i18n('Current value'), + name: $localize`Current value`, cellClass: 'wrap', cellTemplate: this.confValTpl }, - { prop: 'default', name: this.i18n('Default'), cellClass: 'wrap' }, + { prop: 'default', name: $localize`Default`, cellClass: 'wrap' }, { prop: 'can_update_at_runtime', - name: this.i18n('Editable'), + name: $localize`Editable`, cellTransformation: CellTemplate.checkIcon, flexGrow: 0.4, cellClass: 'text-center' diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-details/host-details.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-details/host-details.component.spec.ts index a70ccd0b802..df2a06ba427 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-details/host-details.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-details/host-details.component.spec.ts @@ -6,11 +6,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { NgBootstrapFormValidationModule } from 'ng-bootstrap-form-validation'; import { ToastrModule } from 'ngx-toastr'; -import { - configureTestBed, - i18nProviders, - TabHelper -} from '../../../../../testing/unit-test-helper'; +import { configureTestBed, TabHelper } from '../../../../../testing/unit-test-helper'; import { CoreModule } from '../../../../core/core.module'; import { Permissions } from '../../../../shared/models/permissions'; import { SharedModule } from '../../../../shared/shared.module'; @@ -33,9 +29,7 @@ describe('HostDetailsComponent', () => { CephSharedModule, SharedModule, ToastrModule.forRoot() - ], - declarations: [], - providers: [i18nProviders] + ] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-form/host-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-form/host-form.component.spec.ts index 7015108ad2a..9586beadde0 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-form/host-form.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-form/host-form.component.spec.ts @@ -5,7 +5,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { ToastrModule } from 'ngx-toastr'; -import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../../testing/unit-test-helper'; import { LoadingPanelComponent } from '../../../../shared/components/loading-panel/loading-panel.component'; import { SharedModule } from '../../../../shared/shared.module'; import { HostFormComponent } from './host-form.component'; @@ -23,7 +23,6 @@ describe('HostFormComponent', () => { ReactiveFormsModule, ToastrModule.forRoot() ], - providers: [i18nProviders], declarations: [HostFormComponent] }, [LoadingPanelComponent] diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-form/host-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-form/host-form.component.ts index 5bb66497d3a..d0118fe114c 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-form/host-form.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-form/host-form.component.ts @@ -2,8 +2,6 @@ import { Component, OnInit } from '@angular/core'; import { FormControl, Validators } from '@angular/forms'; import { Router } from '@angular/router'; -import { I18n } from '@ngx-translate/i18n-polyfill'; - import { HostService } from '../../../../shared/api/host.service'; import { ActionLabelsI18n, URLVerbs } from '../../../../shared/constants/app.constants'; import { CdForm } from '../../../../shared/forms/cd-form'; @@ -25,13 +23,12 @@ export class HostFormComponent extends CdForm implements OnInit { constructor( private router: Router, - private i18n: I18n, private actionLabels: ActionLabelsI18n, private hostService: HostService, private taskWrapper: TaskWrapperService ) { super(); - this.resource = this.i18n('host'); + this.resource = $localize`host`; this.action = this.actionLabels.CREATE; this.createForm(); } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.spec.ts index 18e9fd5f1ef..bd6444d726e 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.spec.ts @@ -6,7 +6,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { ToastrModule } from 'ngx-toastr'; import { of } from 'rxjs'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { CoreModule } from '../../../core/core.module'; import { HostService } from '../../../shared/api/host.service'; import { Permissions } from '../../../shared/models/permissions'; @@ -38,8 +38,7 @@ describe('HostsComponent', () => { CephModule, CoreModule ], - providers: [{ provide: AuthStorageService, useValue: fakeAuthStorageService }, i18nProviders], - declarations: [] + providers: [{ provide: AuthStorageService, useValue: fakeAuthStorageService }] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.ts index 089024fbbd7..d1bea0bdd52 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.ts @@ -2,7 +2,6 @@ import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core'; import { Router } from '@angular/router'; import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import { HostService } from '../../../shared/api/host.service'; import { ListWithDetails } from '../../../shared/classes/list-with-details.class'; @@ -56,7 +55,6 @@ export class HostsComponent extends ListWithDetails implements OnInit { private hostService: HostService, private cephShortVersionPipe: CephShortVersionPipe, private joinPipe: JoinPipe, - private i18n: I18n, private urlBuilder: URLBuilderService, private actionLabels: ActionLabelsI18n, private modalService: ModalService, @@ -75,7 +73,7 @@ export class HostsComponent extends ListWithDetails implements OnInit { click: () => { this.depCheckerService.checkOrchestratorOrModal( this.actionLabels.CREATE, - this.i18n('Host'), + $localize`Host`, () => { this.router.navigate([this.urlBuilder.getCreate()]); } @@ -89,7 +87,7 @@ export class HostsComponent extends ListWithDetails implements OnInit { click: () => { this.depCheckerService.checkOrchestratorOrModal( this.actionLabels.EDIT, - this.i18n('Host'), + $localize`Host`, () => this.editAction() ); }, @@ -104,7 +102,7 @@ export class HostsComponent extends ListWithDetails implements OnInit { click: () => { this.depCheckerService.checkOrchestratorOrModal( this.actionLabels.DELETE, - this.i18n('Host'), + $localize`Host`, () => this.deleteAction() ); }, @@ -119,24 +117,24 @@ export class HostsComponent extends ListWithDetails implements OnInit { ngOnInit() { this.columns = [ { - name: this.i18n('Hostname'), + name: $localize`Hostname`, prop: 'hostname', flexGrow: 1 }, { - name: this.i18n('Services'), + name: $localize`Services`, prop: 'services', flexGrow: 3, cellTemplate: this.servicesTpl }, { - name: this.i18n('Labels'), + name: $localize`Labels`, prop: 'labels', flexGrow: 1, pipe: this.joinPipe }, { - name: this.i18n('Version'), + name: $localize`Version`, prop: 'ceph_version', flexGrow: 1, pipe: this.cephShortVersionPipe @@ -155,33 +153,30 @@ export class HostsComponent extends ListWithDetails implements OnInit { return { enabled: true, name: label }; }); this.modalService.show(FormModalComponent, { - titleText: this.i18n('Edit Host: {{hostname}}', host), + titleText: $localize`Edit Host: ${host.hostname}`, fields: [ { type: 'select-badges', name: 'labels', value: host['labels'], - label: this.i18n('Labels'), + label: $localize`Labels`, typeConfig: { customBadges: true, options: allLabels, - messages: new SelectMessages( - { - empty: this.i18n('There are no labels.'), - filter: this.i18n('Filter or add labels'), - add: this.i18n('Add label') - }, - this.i18n - ) + messages: new SelectMessages({ + empty: $localize`There are no labels.`, + filter: $localize`Filter or add labels`, + add: $localize`Add label` + }) } } ], - submitButtonText: this.i18n('Edit Host'), + submitButtonText: $localize`Edit Host`, onSubmit: (values: any) => { this.hostService.update(host['hostname'], values.labels).subscribe(() => { this.notificationService.show( NotificationType.success, - this.i18n('Updated Host "{{hostname}}"', host) + $localize`Updated Host "${host.hostname}"` ); // Reload the data table content. this.table.refreshBtn(); @@ -193,9 +188,7 @@ export class HostsComponent extends ListWithDetails implements OnInit { getEditDisableDesc(selection: CdTableSelection): string | undefined { if (selection && selection.hasSingleSelection && !selection.first().sources.orchestrator) { - return this.i18n( - 'Host editing is disabled because the selected host is not managed by Orchestrator.' - ); + return $localize`Host editing is disabled because the selected host is not managed by Orchestrator.`; } return undefined; } @@ -220,9 +213,7 @@ export class HostsComponent extends ListWithDetails implements OnInit { selection.hasSelection && !selection.selected.every((selected) => selected.sources.orchestrator) ) { - return this.i18n( - 'Host deletion is disabled because a selected host is not managed by Orchestrator.' - ); + return $localize`Host deletion is disabled because a selected host is not managed by Orchestrator.`; } return undefined; } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory-devices/inventory-devices.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory-devices/inventory-devices.component.spec.ts index 695b3377a15..1ce48f6fd00 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory-devices/inventory-devices.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory-devices/inventory-devices.component.spec.ts @@ -6,7 +6,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import * as _ from 'lodash'; import { ToastrModule } from 'ngx-toastr'; -import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../../testing/unit-test-helper'; import { SharedModule } from '../../../../shared/shared.module'; import { InventoryDevicesComponent } from './inventory-devices.component'; @@ -22,7 +22,6 @@ describe('InventoryDevicesComponent', () => { SharedModule, ToastrModule.forRoot() ], - providers: [i18nProviders], declarations: [InventoryDevicesComponent] }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory-devices/inventory-devices.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory-devices/inventory-devices.component.ts index 3cc281f7e1a..4b99c747396 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory-devices/inventory-devices.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory-devices/inventory-devices.component.ts @@ -8,7 +8,6 @@ import { ViewChild } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { Subscription } from 'rxjs'; @@ -71,7 +70,6 @@ export class InventoryDevicesComponent implements OnInit, OnDestroy { constructor( private authStorageService: AuthStorageService, private dimlessBinary: DimlessBinaryPipe, - private i18n: I18n, private modalService: ModalService, private notificationService: NotificationService, private orchService: OrchestratorService @@ -84,7 +82,7 @@ export class InventoryDevicesComponent implements OnInit, OnDestroy { permission: 'update', icon: Icons.show, click: () => this.identifyDevice(), - name: this.i18n('Identify'), + name: $localize`Identify`, disable: () => !this.selection.hasSingleSelection, canBePrimary: (selection: CdTableSelection) => !selection.hasSingleSelection, visible: () => _.isString(this.selectionType) @@ -92,17 +90,17 @@ export class InventoryDevicesComponent implements OnInit, OnDestroy { ]; const columns = [ { - name: this.i18n('Hostname'), + name: $localize`Hostname`, prop: 'hostname', flexGrow: 1 }, { - name: this.i18n('Device path'), + name: $localize`Device path`, prop: 'path', flexGrow: 1 }, { - name: this.i18n('Type'), + name: $localize`Type`, prop: 'human_readable_type', flexGrow: 1, cellTransformation: CellTemplate.badge, @@ -114,30 +112,30 @@ export class InventoryDevicesComponent implements OnInit, OnDestroy { } }, { - name: this.i18n('Available'), + name: $localize`Available`, prop: 'available', flexGrow: 1, cellClass: 'text-center', cellTransformation: CellTemplate.checkIcon }, { - name: this.i18n('Vendor'), + name: $localize`Vendor`, prop: 'sys_api.vendor', flexGrow: 1 }, { - name: this.i18n('Model'), + name: $localize`Model`, prop: 'sys_api.model', flexGrow: 1 }, { - name: this.i18n('Size'), + name: $localize`Size`, prop: 'sys_api.size', flexGrow: 1, pipe: this.dimlessBinary }, { - name: this.i18n('OSDs'), + name: $localize`OSDs`, prop: 'osd_ids', flexGrow: 1, cellTransformation: CellTemplate.badge, @@ -186,8 +184,8 @@ export class InventoryDevicesComponent implements OnInit, OnDestroy { const hostname = selected.hostname; const device = selected.path || selected.device_id; this.modalService.show(FormModalComponent, { - titleText: this.i18n(`Identify device {{device}}`, { device }), - message: this.i18n('Please enter the duration how long to blink the LED.'), + titleText: $localize`Identify device ${device}`, + message: $localize`Please enter the duration how long to blink the LED.`, fields: [ { type: 'select', @@ -196,24 +194,21 @@ export class InventoryDevicesComponent implements OnInit, OnDestroy { required: true, typeConfig: { options: [ - { text: this.i18n('1 minute'), value: 60 }, - { text: this.i18n('2 minutes'), value: 120 }, - { text: this.i18n('5 minutes'), value: 300 }, - { text: this.i18n('10 minutes'), value: 600 }, - { text: this.i18n('15 minutes'), value: 900 } + { text: $localize`1 minute`, value: 60 }, + { text: $localize`2 minutes`, value: 120 }, + { text: $localize`5 minutes`, value: 300 }, + { text: $localize`10 minutes`, value: 600 }, + { text: $localize`15 minutes`, value: 900 } ] } } ], - submitButtonText: this.i18n('Execute'), + submitButtonText: $localize`Execute`, onSubmit: (values: any) => { this.orchService.identifyDevice(hostname, device, values.duration).subscribe(() => { this.notificationService.show( NotificationType.success, - this.i18n(`Identifying '{{device}}' started on host '{{hostname}}'`, { - hostname, - device - }) + $localize`Identifying '${device}' started on host '${hostname}'` ); }); } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory.component.spec.ts index 51de5164bef..3c97845e8ef 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory.component.spec.ts @@ -7,7 +7,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { ToastrModule } from 'ngx-toastr'; import { of } from 'rxjs'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { OrchestratorService } from '../../../shared/api/orchestrator.service'; import { SharedModule } from '../../../shared/shared.module'; import { InventoryDevicesComponent } from './inventory-devices/inventory-devices.component'; @@ -27,7 +27,6 @@ describe('InventoryComponent', () => { RouterTestingModule, ToastrModule.forRoot() ], - providers: [i18nProviders], declarations: [InventoryComponent, InventoryDevicesComponent] }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-details/mgr-module-details.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-details/mgr-module-details.component.spec.ts index f33e17cd11d..ff6473ed133 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-details/mgr-module-details.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-details/mgr-module-details.component.spec.ts @@ -1,7 +1,7 @@ import { HttpClientTestingModule } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../../testing/unit-test-helper'; import { SharedModule } from '../../../../shared/shared.module'; import { MgrModuleDetailsComponent } from './mgr-module-details.component'; @@ -11,8 +11,7 @@ describe('MgrModuleDetailsComponent', () => { configureTestBed({ declarations: [MgrModuleDetailsComponent], - imports: [HttpClientTestingModule, SharedModule], - providers: [i18nProviders] + imports: [HttpClientTestingModule, SharedModule] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-form/mgr-module-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-form/mgr-module-form.component.spec.ts index 18cbb7609bd..18168a686e6 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-form/mgr-module-form.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-form/mgr-module-form.component.spec.ts @@ -5,7 +5,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { ToastrModule } from 'ngx-toastr'; -import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../../testing/unit-test-helper'; import { LoadingPanelComponent } from '../../../../shared/components/loading-panel/loading-panel.component'; import { SharedModule } from '../../../../shared/shared.module'; import { MgrModuleFormComponent } from './mgr-module-form.component'; @@ -23,8 +23,7 @@ describe('MgrModuleFormComponent', () => { RouterTestingModule, SharedModule, ToastrModule.forRoot() - ], - providers: i18nProviders + ] }, [LoadingPanelComponent] ); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-form/mgr-module-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-form/mgr-module-form.component.ts index ea92c9fc550..715ee5035c8 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-form/mgr-module-form.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-form/mgr-module-form.component.ts @@ -2,7 +2,6 @@ import { Component, OnInit } from '@angular/core'; import { ValidatorFn, Validators } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { forkJoin as observableForkJoin } from 'rxjs'; @@ -29,8 +28,7 @@ export class MgrModuleFormComponent extends CdForm implements OnInit { private router: Router, private formBuilder: CdFormBuilder, private mgrModuleService: MgrModuleService, - private notificationService: NotificationService, - private i18n: I18n + private notificationService: NotificationService ) { super(); } @@ -129,7 +127,7 @@ export class MgrModuleFormComponent extends CdForm implements OnInit { () => { this.notificationService.show( NotificationType.success, - this.i18n(`Updated options for module '{{name}}'.`, { name: this.moduleName }) + $localize`Updated options for module '${this.moduleName}'.` ); this.goToListView(); }, diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-list/mgr-module-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-list/mgr-module-list.component.spec.ts index dbeca1db812..f340bd83264 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-list/mgr-module-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-list/mgr-module-list.component.spec.ts @@ -7,11 +7,7 @@ import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap'; import { ToastrModule } from 'ngx-toastr'; import { of as observableOf, throwError as observableThrowError } from 'rxjs'; -import { - configureTestBed, - i18nProviders, - PermissionHelper -} from '../../../../../testing/unit-test-helper'; +import { configureTestBed, PermissionHelper } from '../../../../../testing/unit-test-helper'; import { MgrModuleService } from '../../../../shared/api/mgr-module.service'; import { TableActionsComponent } from '../../../../shared/datatable/table-actions/table-actions.component'; import { CdTableSelection } from '../../../../shared/models/cd-table-selection'; @@ -36,7 +32,7 @@ describe('MgrModuleListComponent', () => { NgbNavModule, ToastrModule.forRoot() ], - providers: [MgrModuleService, NotificationService, i18nProviders] + providers: [MgrModuleService, NotificationService] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-list/mgr-module-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-list/mgr-module-list.component.ts index 4db0f6fd1d8..8e1da89d0f5 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-list/mgr-module-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-list/mgr-module-list.component.ts @@ -1,6 +1,5 @@ import { Component, ViewChild } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import { BlockUI, NgBlockUI } from 'ng-block-ui'; import { timer as observableTimer } from 'rxjs'; @@ -37,26 +36,25 @@ export class MgrModuleListComponent extends ListWithDetails { constructor( private authStorageService: AuthStorageService, private mgrModuleService: MgrModuleService, - private notificationService: NotificationService, - private i18n: I18n + private notificationService: NotificationService ) { super(); this.permission = this.authStorageService.getPermissions().configOpt; this.columns = [ { - name: this.i18n('Name'), + name: $localize`Name`, prop: 'name', flexGrow: 1 }, { - name: this.i18n('Enabled'), + name: $localize`Enabled`, prop: 'enabled', flexGrow: 1, cellClass: 'text-center', cellTransformation: CellTemplate.checkIcon }, { - name: this.i18n('Always-On'), + name: $localize`Always-On`, prop: 'always_on', isHidden: true, flexGrow: 1, @@ -68,7 +66,7 @@ export class MgrModuleListComponent extends ListWithDetails { this.selection.first() && encodeURIComponent(this.selection.first().name); this.tableActions = [ { - name: this.i18n('Edit'), + name: $localize`Edit`, permission: 'update', disable: () => { if (!this.selection.hasSelection) { @@ -81,14 +79,14 @@ export class MgrModuleListComponent extends ListWithDetails { icon: Icons.edit }, { - name: this.i18n('Enable'), + name: $localize`Enable`, permission: 'update', click: () => this.updateModuleState(), disable: () => this.isTableActionDisabled('enabled'), icon: Icons.start }, { - name: this.i18n('Disable'), + name: $localize`Disable`, permission: 'update', click: () => this.updateModuleState(), disable: () => this.isTableActionDisabled('disabled'), @@ -146,7 +144,7 @@ export class MgrModuleListComponent extends ListWithDetails { if (this.selection.hasSelection) { const selected = this.selection.first(); if (selected.always_on) { - return this.i18n('This Manager module is always on.'); + return $localize`This Manager module is always on.`; } } @@ -197,7 +195,7 @@ export class MgrModuleListComponent extends ListWithDetails { this.notificationService.suspendToasties(true); // Block the whole UI to prevent user interactions until // the connection to the backend is reestablished - this.blockUI.start(this.i18n('Reconnecting, please wait ...')); + this.blockUI.start($localize`Reconnecting, please wait ...`); fnWaitUntilReconnected(); } ); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/monitor/monitor.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/monitor/monitor.component.spec.ts index d15be4a3598..1df4af8810f 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/monitor/monitor.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/monitor/monitor.component.spec.ts @@ -4,7 +4,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { of } from 'rxjs'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { MonitorService } from '../../../shared/api/monitor.service'; import { MonitorComponent } from './monitor.component'; @@ -17,7 +17,7 @@ describe('MonitorComponent', () => { imports: [HttpClientTestingModule], declarations: [MonitorComponent], schemas: [NO_ERRORS_SCHEMA], - providers: [MonitorService, i18nProviders] + providers: [MonitorService] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/monitor/monitor.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/monitor/monitor.component.ts index 441351b729a..82d765dac5b 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/monitor/monitor.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/monitor/monitor.component.ts @@ -1,6 +1,5 @@ import { Component } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { MonitorService } from '../../../shared/api/monitor.service'; @@ -18,15 +17,15 @@ export class MonitorComponent { interval: any; - constructor(private monitorService: MonitorService, private i18n: I18n) { + constructor(private monitorService: MonitorService) { this.inQuorum = { columns: [ - { prop: 'name', name: this.i18n('Name'), cellTransformation: CellTemplate.routerLink }, - { prop: 'rank', name: this.i18n('Rank') }, - { prop: 'public_addr', name: this.i18n('Public Address') }, + { prop: 'name', name: $localize`Name`, cellTransformation: CellTemplate.routerLink }, + { prop: 'rank', name: $localize`Rank` }, + { prop: 'public_addr', name: $localize`Public Address` }, { prop: 'cdOpenSessions', - name: this.i18n('Open Sessions'), + name: $localize`Open Sessions`, cellTransformation: CellTemplate.sparkline, comparator: (dataA: any, dataB: any) => { // We get the last value of time series to compare: @@ -45,9 +44,9 @@ export class MonitorComponent { this.notInQuorum = { columns: [ - { prop: 'name', name: this.i18n('Name'), cellTransformation: CellTemplate.routerLink }, - { prop: 'rank', name: this.i18n('Rank') }, - { prop: 'public_addr', name: this.i18n('Public Address') } + { prop: 'name', name: $localize`Name`, cellTransformation: CellTemplate.routerLink }, + { prop: 'rank', name: $localize`Rank` }, + { prop: 'public_addr', name: $localize`Public Address` } ] }; } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-creation-preview-modal/osd-creation-preview-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-creation-preview-modal/osd-creation-preview-modal.component.spec.ts index 6922d99dbbd..1f6ecd143d4 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-creation-preview-modal/osd-creation-preview-modal.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-creation-preview-modal/osd-creation-preview-modal.component.spec.ts @@ -6,7 +6,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { ToastrModule } from 'ngx-toastr'; -import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../../testing/unit-test-helper'; import { SharedModule } from '../../../../shared/shared.module'; import { OsdCreationPreviewModalComponent } from './osd-creation-preview-modal.component'; @@ -22,7 +22,7 @@ describe('OsdCreationPreviewModalComponent', () => { RouterTestingModule, ToastrModule.forRoot() ], - providers: [NgbActiveModal, i18nProviders], + providers: [NgbActiveModal], declarations: [OsdCreationPreviewModalComponent] }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.spec.ts index 0ed14a1aea9..0d55de450ed 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.spec.ts @@ -5,7 +5,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap'; import { of } from 'rxjs'; -import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../../testing/unit-test-helper'; import { OsdService } from '../../../../shared/api/osd.service'; import { SharedModule } from '../../../../shared/shared.module'; import { TablePerformanceCounterComponent } from '../../../performance-counter/table-performance-counter/table-performance-counter.component'; @@ -29,8 +29,7 @@ describe('OsdDetailsComponent', () => { SmartListComponent, TablePerformanceCounterComponent, OsdPerformanceHistogramComponent - ], - providers: i18nProviders + ] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-devices-selection-groups/osd-devices-selection-groups.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-devices-selection-groups/osd-devices-selection-groups.component.spec.ts index 893f9814987..7aac4146f42 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-devices-selection-groups/osd-devices-selection-groups.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-devices-selection-groups/osd-devices-selection-groups.component.spec.ts @@ -5,12 +5,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { ToastrModule } from 'ngx-toastr'; -import { - configureTestBed, - FixtureHelper, - i18nProviders, - Mocks -} from '../../../../../testing/unit-test-helper'; +import { configureTestBed, FixtureHelper, Mocks } from '../../../../../testing/unit-test-helper'; import { SharedModule } from '../../../../shared/shared.module'; import { InventoryDevice } from '../../inventory/inventory-devices/inventory-device.model'; import { InventoryDevicesComponent } from '../../inventory/inventory-devices/inventory-devices.component'; @@ -41,7 +36,6 @@ describe('OsdDevicesSelectionGroupsComponent', () => { SharedModule, ToastrModule.forRoot() ], - providers: [i18nProviders], declarations: [OsdDevicesSelectionGroupsComponent, InventoryDevicesComponent] }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-devices-selection-groups/osd-devices-selection-groups.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-devices-selection-groups/osd-devices-selection-groups.component.ts index 8c41b75482a..3693bc558cc 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-devices-selection-groups/osd-devices-selection-groups.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-devices-selection-groups/osd-devices-selection-groups.component.ts @@ -1,6 +1,5 @@ import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { Icons } from '../../../../shared/enum/icons.enum'; @@ -42,12 +41,12 @@ export class OsdDevicesSelectionGroupsComponent implements OnInit, OnChanges { addButtonTooltip: String; tooltips = { - noAvailDevices: this.i18n('No available devices'), - addPrimaryFirst: this.i18n('Please add primary devices first'), - addByFilters: this.i18n('Add devices by using filters') + noAvailDevices: $localize`No available devices`, + addPrimaryFirst: $localize`Please add primary devices first`, + addByFilters: $localize`Add devices by using filters` }; - constructor(private modalService: ModalService, private i18n: I18n) {} + constructor(private modalService: ModalService) {} ngOnInit() { this.updateAddButtonTooltip(); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-devices-selection-modal/osd-devices-selection-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-devices-selection-modal/osd-devices-selection-modal.component.spec.ts index 6847104c67d..baa9e230e83 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-devices-selection-modal/osd-devices-selection-modal.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-devices-selection-modal/osd-devices-selection-modal.component.spec.ts @@ -7,7 +7,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { ToastrModule } from 'ngx-toastr'; -import { configureTestBed, i18nProviders, Mocks } from '../../../../../testing/unit-test-helper'; +import { configureTestBed, Mocks } from '../../../../../testing/unit-test-helper'; import { CdTableColumnFiltersChange } from '../../../../shared/models/cd-table-column-filters-change'; import { SharedModule } from '../../../../shared/shared.module'; import { InventoryDevice } from '../../inventory/inventory-devices/inventory-device.model'; @@ -37,7 +37,7 @@ describe('OsdDevicesSelectionModalComponent', () => { RouterTestingModule, ToastrModule.forRoot() ], - providers: [NgbActiveModal, i18nProviders], + providers: [NgbActiveModal], declarations: [OsdDevicesSelectionModalComponent, InventoryDevicesComponent] }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-flags-modal/osd-flags-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-flags-modal/osd-flags-modal.component.spec.ts index b73a495af8e..78d472da16a 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-flags-modal/osd-flags-modal.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-flags-modal/osd-flags-modal.component.spec.ts @@ -7,7 +7,7 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import * as _ from 'lodash'; import { ToastrModule } from 'ngx-toastr'; -import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../../testing/unit-test-helper'; import { NotificationType } from '../../../../shared/enum/notification-type.enum'; import { NotificationService } from '../../../../shared/services/notification.service'; import { SharedModule } from '../../../../shared/shared.module'; @@ -34,7 +34,7 @@ describe('OsdFlagsModalComponent', () => { ToastrModule.forRoot() ], declarations: [OsdFlagsModalComponent], - providers: [i18nProviders, NgbActiveModal] + providers: [NgbActiveModal] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-flags-modal/osd-flags-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-flags-modal/osd-flags-modal.component.ts index e2cc01a764d..78ca001ce7a 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-flags-modal/osd-flags-modal.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-flags-modal/osd-flags-modal.component.ts @@ -2,7 +2,6 @@ import { Component, OnInit } from '@angular/core'; import { FormGroup } from '@angular/forms'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { OsdService } from '../../../../shared/api/osd.service'; @@ -24,96 +23,90 @@ export class OsdFlagsModalComponent implements OnInit { allFlags = { noin: { code: 'noin', - name: this.i18n('No In'), + name: $localize`No In`, value: false, - description: this.i18n( - 'OSDs that were previously marked out will not be marked back in when they start' - ) + description: $localize`OSDs that were previously marked out will not be marked back in when they start` }, noout: { code: 'noout', - name: this.i18n('No Out'), + name: $localize`No Out`, value: false, - description: this.i18n( - 'OSDs will not automatically be marked out after the configured interval' - ) + description: $localize`OSDs will not automatically be marked out after the configured interval` }, noup: { code: 'noup', - name: this.i18n('No Up'), + name: $localize`No Up`, value: false, - description: this.i18n('OSDs are not allowed to start') + description: $localize`OSDs are not allowed to start` }, nodown: { code: 'nodown', - name: this.i18n('No Down'), + name: $localize`No Down`, value: false, - description: this.i18n( - 'OSD failure reports are being ignored, such that the monitors will not mark OSDs down' - ) + description: $localize`OSD failure reports are being ignored, such that the monitors will not mark OSDs down` }, pause: { code: 'pause', - name: this.i18n('Pause'), + name: $localize`Pause`, value: false, - description: this.i18n('Pauses reads and writes') + description: $localize`Pauses reads and writes` }, noscrub: { code: 'noscrub', - name: this.i18n('No Scrub'), + name: $localize`No Scrub`, value: false, - description: this.i18n('Scrubbing is disabled') + description: $localize`Scrubbing is disabled` }, 'nodeep-scrub': { code: 'nodeep-scrub', - name: this.i18n('No Deep Scrub'), + name: $localize`No Deep Scrub`, value: false, - description: this.i18n('Deep Scrubbing is disabled') + description: $localize`Deep Scrubbing is disabled` }, nobackfill: { code: 'nobackfill', - name: this.i18n('No Backfill'), + name: $localize`No Backfill`, value: false, - description: this.i18n('Backfilling of PGs is suspended') + description: $localize`Backfilling of PGs is suspended` }, norebalance: { code: 'norebalance', - name: this.i18n('No Rebalance'), + name: $localize`No Rebalance`, value: false, - description: this.i18n('OSD will choose not to backfill unless PG is also degraded') + description: $localize`OSD will choose not to backfill unless PG is also degraded` }, norecover: { code: 'norecover', - name: this.i18n('No Recover'), + name: $localize`No Recover`, value: false, - description: this.i18n('Recovery of PGs is suspended') + description: $localize`Recovery of PGs is suspended` }, sortbitwise: { code: 'sortbitwise', - name: this.i18n('Bitwise Sort'), + name: $localize`Bitwise Sort`, value: false, - description: this.i18n('Use bitwise sort'), + description: $localize`Use bitwise sort`, disabled: true }, purged_snapdirs: { code: 'purged_snapdirs', - name: this.i18n('Purged Snapdirs'), + name: $localize`Purged Snapdirs`, value: false, - description: this.i18n('OSDs have converted snapsets'), + description: $localize`OSDs have converted snapsets`, disabled: true }, recovery_deletes: { code: 'recovery_deletes', - name: this.i18n('Recovery Deletes'), + name: $localize`Recovery Deletes`, value: false, - description: this.i18n('Deletes performed during recovery instead of peering'), + description: $localize`Deletes performed during recovery instead of peering`, disabled: true }, pglog_hardlimit: { code: 'pglog_hardlimit', - name: this.i18n('PG Log Hard Limit'), + name: $localize`PG Log Hard Limit`, value: false, - description: this.i18n('Puts a hard limit on pg log length'), + description: $localize`Puts a hard limit on pg log length`, disabled: true } }; @@ -124,8 +117,7 @@ export class OsdFlagsModalComponent implements OnInit { public activeModal: NgbActiveModal, private authStorageService: AuthStorageService, private osdService: OsdService, - private notificationService: NotificationService, - private i18n: I18n + private notificationService: NotificationService ) { this.permissions = this.authStorageService.getPermissions(); } @@ -151,7 +143,7 @@ export class OsdFlagsModalComponent implements OnInit { this.osdService.updateFlags(newFlags).subscribe( () => { - this.notificationService.show(NotificationType.success, this.i18n('Updated OSD Flags')); + this.notificationService.show(NotificationType.success, $localize`Updated OSD Flags`); this.activeModal.close(); }, () => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-form/osd-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-form/osd-form.component.spec.ts index 0acf0f3a1c7..4ca688acc0d 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-form/osd-form.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-form/osd-form.component.spec.ts @@ -10,8 +10,7 @@ import { BehaviorSubject, of } from 'rxjs'; import { configureTestBed, FixtureHelper, - FormHelper, - i18nProviders + FormHelper } from '../../../../../testing/unit-test-helper'; import { OrchestratorService } from '../../../../shared/api/orchestrator.service'; import { CdFormGroup } from '../../../../shared/forms/cd-form-group'; @@ -104,7 +103,6 @@ describe('OsdFormComponent', () => { ReactiveFormsModule, ToastrModule.forRoot() ], - providers: [i18nProviders], declarations: [OsdFormComponent, OsdDevicesSelectionGroupsComponent, InventoryDevicesComponent] }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-form/osd-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-form/osd-form.component.ts index 291a87c75c6..7a3538e6e20 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-form/osd-form.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-form/osd-form.component.ts @@ -2,7 +2,6 @@ import { Component, OnInit, ViewChild } from '@angular/core'; import { FormControl, Validators } from '@angular/forms'; import { Router } from '@angular/router'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { OrchestratorService } from '../../../../shared/api/orchestrator.service'; @@ -66,18 +65,17 @@ export class OsdFormComponent extends CdForm implements OnInit { constructor( public actionLabels: ActionLabelsI18n, private authStorageService: AuthStorageService, - private i18n: I18n, private orchService: OrchestratorService, private router: Router, private modalService: ModalService ) { super(); - this.resource = this.i18n('OSDs'); + this.resource = $localize`OSDs`; this.action = this.actionLabels.CREATE; this.features = { encrypted: { key: 'encrypted', - desc: this.i18n('Encryption') + desc: $localize`Encryption` } }; this.featureList = _.map(this.features, (o, key) => Object.assign(o, { key: key })); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.spec.ts index 44792948d69..f928e4de4b0 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.spec.ts @@ -10,11 +10,7 @@ import * as _ from 'lodash'; import { ToastrModule } from 'ngx-toastr'; import { EMPTY, of } from 'rxjs'; -import { - configureTestBed, - i18nProviders, - PermissionHelper -} from '../../../../../testing/unit-test-helper'; +import { configureTestBed, PermissionHelper } from '../../../../../testing/unit-test-helper'; import { CoreModule } from '../../../../core/core.module'; import { OrchestratorService } from '../../../../shared/api/orchestrator.service'; import { OsdService } from '../../../../shared/api/osd.service'; @@ -103,12 +99,10 @@ describe('OsdListComponent', () => { CoreModule, RouterTestingModule ], - declarations: [], providers: [ { provide: AuthStorageService, useValue: fakeAuthStorageService }, TableActionsComponent, - ModalService, - i18nProviders + ModalService ] }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.ts index 67224ce6871..af298a9e5b1 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.ts @@ -3,7 +3,6 @@ import { FormControl } from '@angular/forms'; import { Router } from '@angular/router'; import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { forkJoin as observableForkJoin, Observable } from 'rxjs'; @@ -87,7 +86,6 @@ export class OsdListComponent extends ListWithDetails implements OnInit { private osdService: OsdService, private dimlessBinaryPipe: DimlessBinaryPipe, private modalService: ModalService, - private i18n: I18n, private urlBuilder: URLBuilderService, private router: Router, private depCheckerService: DepCheckerService, @@ -105,7 +103,7 @@ export class OsdListComponent extends ListWithDetails implements OnInit { click: () => { this.depCheckerService.checkOrchestratorOrModal( this.actionLabels.CREATE, - this.i18n('OSD'), + $localize`OSD`, () => { this.router.navigate([this.urlBuilder.getCreate()]); } @@ -144,21 +142,21 @@ export class OsdListComponent extends ListWithDetails implements OnInit { { name: this.actionLabels.MARK_OUT, permission: 'update', - click: () => this.showConfirmationModal(this.i18n('out'), this.osdService.markOut), + click: () => this.showConfirmationModal($localize`out`, this.osdService.markOut), disable: () => this.isNotSelectedOrInState('out'), icon: Icons.left }, { name: this.actionLabels.MARK_IN, permission: 'update', - click: () => this.showConfirmationModal(this.i18n('in'), this.osdService.markIn), + click: () => this.showConfirmationModal($localize`in`, this.osdService.markIn), disable: () => this.isNotSelectedOrInState('in'), icon: Icons.right }, { name: this.actionLabels.MARK_DOWN, permission: 'update', - click: () => this.showConfirmationModal(this.i18n('down'), this.osdService.markDown), + click: () => this.showConfirmationModal($localize`down`, this.osdService.markDown), disable: () => this.isNotSelectedOrInState('down'), icon: Icons.down }, @@ -167,9 +165,9 @@ export class OsdListComponent extends ListWithDetails implements OnInit { permission: 'delete', click: () => this.showCriticalConfirmationModal( - this.i18n('Mark'), - this.i18n('OSD lost'), - this.i18n('marked lost'), + $localize`Mark`, + $localize`OSD lost`, + $localize`marked lost`, (ids: number[]) => { return this.osdService.safeToDestroy(JSON.stringify(ids)); }, @@ -184,9 +182,9 @@ export class OsdListComponent extends ListWithDetails implements OnInit { permission: 'delete', click: () => this.showCriticalConfirmationModal( - this.i18n('Purge'), - this.i18n('OSD'), - this.i18n('purged'), + $localize`Purge`, + $localize`OSD`, + $localize`purged`, (ids: number[]) => { return this.osdService.safeToDestroy(JSON.stringify(ids)); }, @@ -204,9 +202,9 @@ export class OsdListComponent extends ListWithDetails implements OnInit { permission: 'delete', click: () => this.showCriticalConfirmationModal( - this.i18n('destroy'), - this.i18n('OSD'), - this.i18n('destroyed'), + $localize`destroy`, + $localize`OSD`, + $localize`destroyed`, (ids: number[]) => { return this.osdService.safeToDestroy(JSON.stringify(ids)); }, @@ -232,21 +230,21 @@ export class OsdListComponent extends ListWithDetails implements OnInit { ngOnInit() { this.clusterWideActions = [ { - name: this.i18n('Flags'), + name: $localize`Flags`, icon: Icons.flag, click: () => this.configureFlagsAction(), permission: 'read', visible: () => this.permissions.osd.read }, { - name: this.i18n('Recovery Priority'), + name: $localize`Recovery Priority`, icon: Icons.deepCheck, click: () => this.configureQosParamsAction(), permission: 'read', visible: () => this.permissions.configOpt.read }, { - name: this.i18n('PG scrub'), + name: $localize`PG scrub`, icon: Icons.analyse, click: () => this.configurePgScrubAction(), permission: 'read', @@ -254,11 +252,11 @@ export class OsdListComponent extends ListWithDetails implements OnInit { } ]; this.columns = [ - { prop: 'host.name', name: this.i18n('Host') }, - { prop: 'id', name: this.i18n('ID'), flexGrow: 1, cellTransformation: CellTemplate.bold }, + { prop: 'host.name', name: $localize`Host` }, + { prop: 'id', name: $localize`ID`, flexGrow: 1, cellTransformation: CellTemplate.bold }, { prop: 'collectedStates', - name: this.i18n('Status'), + name: $localize`Status`, flexGrow: 1, cellTransformation: CellTemplate.badge, customTemplateConfig: { @@ -273,7 +271,7 @@ export class OsdListComponent extends ListWithDetails implements OnInit { }, { prop: 'tree.device_class', - name: this.i18n('Device class'), + name: $localize`Device class`, flexGrow: 1.2, cellTransformation: CellTemplate.badge, customTemplateConfig: { @@ -285,34 +283,34 @@ export class OsdListComponent extends ListWithDetails implements OnInit { }, { prop: 'stats.numpg', - name: this.i18n('PGs'), + name: $localize`PGs`, flexGrow: 1 }, { prop: 'stats.stat_bytes', - name: this.i18n('Size'), + name: $localize`Size`, flexGrow: 1, pipe: this.dimlessBinaryPipe }, - { prop: 'stats.usage', name: this.i18n('Usage'), cellTemplate: this.osdUsageTpl }, + { prop: 'stats.usage', name: $localize`Usage`, cellTemplate: this.osdUsageTpl }, { prop: 'stats_history.out_bytes', - name: this.i18n('Read bytes'), + name: $localize`Read bytes`, cellTransformation: CellTemplate.sparkline }, { prop: 'stats_history.in_bytes', - name: this.i18n('Write bytes'), + name: $localize`Write bytes`, cellTransformation: CellTemplate.sparkline }, { prop: 'stats.op_r', - name: this.i18n('Read ops'), + name: $localize`Read ops`, cellTransformation: CellTemplate.perSecond }, { prop: 'stats.op_w', - name: this.i18n('Write ops'), + name: $localize`Write ops`, cellTransformation: CellTemplate.perSecond } ]; @@ -379,26 +377,22 @@ export class OsdListComponent extends ListWithDetails implements OnInit { const selectedOsd = _.filter(this.osds, ['id', this.selection.first().id]).pop(); this.modalService.show(FormModalComponent, { - titleText: this.i18n('Edit OSD: {{id}}', { - id: selectedOsd.id - }), + titleText: $localize`Edit OSD: ${selectedOsd.id}`, fields: [ { type: 'text', name: 'deviceClass', value: selectedOsd.tree.device_class, - label: this.i18n('Device class'), + label: $localize`Device class`, required: true } ], - submitButtonText: this.i18n('Edit OSD'), + submitButtonText: $localize`Edit OSD`, onSubmit: (values: any) => { this.osdService.update(selectedOsd.id, values.deviceClass).subscribe(() => { this.notificationService.show( NotificationType.success, - this.i18n(`Updated OSD '{{id}}'`, { - id: selectedOsd.id - }) + $localize`Updated OSD '${selectedOsd.id}'` ); this.getOsdList(); }); @@ -425,8 +419,8 @@ export class OsdListComponent extends ListWithDetails implements OnInit { showConfirmationModal(markAction: string, onSubmit: (id: number) => Observable) { this.bsModalRef = this.modalService.show(ConfirmationModalComponent, { - titleText: this.i18n('Mark OSD {{markAction}}', { markAction: markAction }), - buttonText: this.i18n('Mark {{markAction}}', { markAction: markAction }), + titleText: $localize`Mark OSD ${markAction}`, + buttonText: $localize`Mark ${markAction}`, bodyTpl: this.markOsdConfirmationTpl, bodyContext: { markActionDescription: markAction @@ -454,12 +448,12 @@ export class OsdListComponent extends ListWithDetails implements OnInit { this.depCheckerService.checkOrchestratorOrModal( this.actionLabels.DELETE, - this.i18n('OSD'), + $localize`OSD`, () => { this.showCriticalConfirmationModal( - this.i18n('delete'), - this.i18n('OSD'), - this.i18n('deleted'), + $localize`delete`, + $localize`OSD`, + $localize`deleted`, (ids: number[]) => { return this.osdService.safeToDelete(JSON.stringify(ids)); }, diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-pg-scrub-modal/osd-pg-scrub-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-pg-scrub-modal/osd-pg-scrub-modal.component.spec.ts index 083398d1ce0..8b9d39268e2 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-pg-scrub-modal/osd-pg-scrub-modal.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-pg-scrub-modal/osd-pg-scrub-modal.component.spec.ts @@ -8,7 +8,7 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { ToastrModule } from 'ngx-toastr'; import { of as observableOf } from 'rxjs'; -import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../../testing/unit-test-helper'; import { ConfigurationService } from '../../../../shared/api/configuration.service'; import { NotificationType } from '../../../../shared/enum/notification-type.enum'; import { NotificationService } from '../../../../shared/services/notification.service'; @@ -29,7 +29,7 @@ describe('OsdPgScrubModalComponent', () => { ToastrModule.forRoot() ], declarations: [OsdPgScrubModalComponent], - providers: [NgbActiveModal, i18nProviders] + providers: [NgbActiveModal] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-pg-scrub-modal/osd-pg-scrub-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-pg-scrub-modal/osd-pg-scrub-modal.component.ts index e2b4c1d4450..8c21b6d4177 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-pg-scrub-modal/osd-pg-scrub-modal.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-pg-scrub-modal/osd-pg-scrub-modal.component.ts @@ -1,7 +1,6 @@ import { Component, ViewChild } from '@angular/core'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import { forkJoin as observableForkJoin } from 'rxjs'; import { ConfigOptionComponent } from '../../../../shared/components/config-option/config-option.component'; @@ -38,11 +37,10 @@ export class OsdPgScrubModalComponent { public activeModal: NgbActiveModal, private authStorageService: AuthStorageService, private notificationService: NotificationService, - private i18n: I18n, public actionLabels: ActionLabelsI18n ) { this.osdPgScrubForm = new CdFormGroup({}); - this.resource = this.i18n('PG scrub options'); + this.resource = $localize`PG scrub options`; this.action = this.actionLabels.EDIT; this.permissions = this.authStorageService.getPermissions(); } @@ -58,7 +56,7 @@ export class OsdPgScrubModalComponent { () => { this.notificationService.show( NotificationType.success, - this.i18n('Updated PG scrub options') + $localize`Updated PG scrub options` ); this.activeModal.close(); }, diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-recv-speed-modal/osd-recv-speed-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-recv-speed-modal/osd-recv-speed-modal.component.spec.ts index 5c08024a86b..c6351ea8a72 100755 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-recv-speed-modal/osd-recv-speed-modal.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-recv-speed-modal/osd-recv-speed-modal.component.spec.ts @@ -8,7 +8,7 @@ import * as _ from 'lodash'; import { ToastrModule } from 'ngx-toastr'; import { of as observableOf } from 'rxjs'; -import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../../testing/unit-test-helper'; import { ConfigurationService } from '../../../../shared/api/configuration.service'; import { SharedModule } from '../../../../shared/shared.module'; import { OsdRecvSpeedModalComponent } from './osd-recv-speed-modal.component'; @@ -27,7 +27,7 @@ describe('OsdRecvSpeedModalComponent', () => { ToastrModule.forRoot() ], declarations: [OsdRecvSpeedModalComponent], - providers: [NgbActiveModal, i18nProviders] + providers: [NgbActiveModal] }); let configOptions: any[] = []; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-recv-speed-modal/osd-recv-speed-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-recv-speed-modal/osd-recv-speed-modal.component.ts index 4eaffd27fbc..f4b165b2eea 100755 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-recv-speed-modal/osd-recv-speed-modal.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-recv-speed-modal/osd-recv-speed-modal.component.ts @@ -2,7 +2,6 @@ import { Component, OnInit } from '@angular/core'; import { FormControl, Validators } from '@angular/forms'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { ConfigurationService } from '../../../../shared/api/configuration.service'; @@ -31,7 +30,6 @@ export class OsdRecvSpeedModalComponent implements OnInit { private authStorageService: AuthStorageService, private configService: ConfigurationService, private notificationService: NotificationService, - private i18n: I18n, private osdService: OsdService ) { this.permissions = this.authStorageService.getPermissions(); @@ -42,28 +40,28 @@ export class OsdRecvSpeedModalComponent implements OnInit { }); this.priorityAttrs = { osd_max_backfills: { - text: this.i18n('Max Backfills'), + text: $localize`Max Backfills`, desc: '', patternHelpText: '', maxValue: undefined, minValue: undefined }, osd_recovery_max_active: { - text: this.i18n('Recovery Max Active'), + text: $localize`Recovery Max Active`, desc: '', patternHelpText: '', maxValue: undefined, minValue: undefined }, osd_recovery_max_single_start: { - text: this.i18n('Recovery Max Single Start'), + text: $localize`Recovery Max Single Start`, desc: '', patternHelpText: '', maxValue: undefined, minValue: undefined }, osd_recovery_sleep: { - text: this.i18n('Recovery Sleep'), + text: $localize`Recovery Sleep`, desc: '', patternHelpText: '', maxValue: undefined, @@ -104,7 +102,7 @@ export class OsdRecvSpeedModalComponent implements OnInit { if (Object.entries(configOptionValues).length === 4) { this.osdRecvSpeedForm.controls.customizePriority.setValue(true); return callbackFn( - Object({ name: 'custom', text: this.i18n('Custom'), values: configOptionValues }) + Object({ name: 'custom', text: $localize`Custom`, values: configOptionValues }) ); } @@ -189,7 +187,7 @@ export class OsdRecvSpeedModalComponent implements OnInit { if (this.osdRecvSpeedForm.getValue('customizePriority')) { const customPriority = { name: 'custom', - text: this.i18n('Custom'), + text: $localize`Custom`, values: values }; this.setPriority(customPriority); @@ -224,9 +222,9 @@ export class OsdRecvSpeedModalComponent implements OnInit { () => { this.notificationService.show( NotificationType.success, - this.i18n(`Updated OSD recovery speed priority '{{value}}'`, { - value: this.osdRecvSpeedForm.getValue('priority') - }) + $localize`Updated OSD recovery speed priority '${this.osdRecvSpeedForm.getValue( + 'priority' + )}'` ); this.activeModal.close(); }, diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-reweight-modal/osd-reweight-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-reweight-modal/osd-reweight-modal.component.spec.ts index 7b98b6d0340..abd92bbe012 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-reweight-modal/osd-reweight-modal.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-reweight-modal/osd-reweight-modal.component.spec.ts @@ -6,7 +6,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { of } from 'rxjs'; -import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../../testing/unit-test-helper'; import { OsdService } from '../../../../shared/api/osd.service'; import { BackButtonComponent } from '../../../../shared/components/back-button/back-button.component'; import { ModalComponent } from '../../../../shared/components/modal/modal.component'; @@ -26,7 +26,7 @@ describe('OsdReweightModalComponent', () => { SubmitButtonComponent, BackButtonComponent ], - providers: [OsdService, NgbActiveModal, CdFormBuilder, i18nProviders] + providers: [OsdService, NgbActiveModal, CdFormBuilder] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-scrub-modal/osd-scrub-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-scrub-modal/osd-scrub-modal.component.spec.ts index a20df3bb3a2..a2c2b1c8794 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-scrub-modal/osd-scrub-modal.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-scrub-modal/osd-scrub-modal.component.spec.ts @@ -4,7 +4,7 @@ import { ReactiveFormsModule } from '@angular/forms'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; -import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../../testing/unit-test-helper'; import { OsdService } from '../../../../shared/api/osd.service'; import { JoinPipe } from '../../../../shared/pipes/join.pipe'; import { NotificationService } from '../../../../shared/services/notification.service'; @@ -34,8 +34,7 @@ describe('OsdScrubModalComponent', () => { NgbActiveModal, JoinPipe, { provide: OsdService, useValue: fakeService }, - { provide: NotificationService, useValue: fakeService }, - i18nProviders + { provide: NotificationService, useValue: fakeService } ] }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-scrub-modal/osd-scrub-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-scrub-modal/osd-scrub-modal.component.ts index c23fb500537..e7306bfa66a 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-scrub-modal/osd-scrub-modal.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-scrub-modal/osd-scrub-modal.component.ts @@ -2,7 +2,6 @@ import { Component, OnInit } from '@angular/core'; import { FormGroup } from '@angular/forms'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import { forkJoin } from 'rxjs'; import { OsdService } from '../../../../shared/api/osd.service'; @@ -24,7 +23,6 @@ export class OsdScrubModalComponent implements OnInit { public activeModal: NgbActiveModal, private osdService: OsdService, private notificationService: NotificationService, - private i18n: I18n, private joinPipe: JoinPipe ) {} @@ -39,10 +37,9 @@ export class OsdScrubModalComponent implements OnInit { this.notificationService.show( NotificationType.success, - this.i18n('{{operation}} was initialized in the following OSD(s): {{id}}', { - operation: operation, - id: this.joinPipe.transform(this.selected) - }) + $localize`${operation} was initialized in the following OSD(s): ${this.joinPipe.transform( + this.selected + )}` ); this.activeModal.close(); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/active-alert-list/active-alert-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/active-alert-list/active-alert-list.component.spec.ts index c551d599bb2..558473d2204 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/active-alert-list/active-alert-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/active-alert-list/active-alert-list.component.spec.ts @@ -6,11 +6,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap'; import { ToastrModule } from 'ngx-toastr'; -import { - configureTestBed, - i18nProviders, - PermissionHelper -} from '../../../../../testing/unit-test-helper'; +import { configureTestBed, PermissionHelper } from '../../../../../testing/unit-test-helper'; import { CoreModule } from '../../../../core/core.module'; import { TableActionsComponent } from '../../../../shared/datatable/table-actions/table-actions.component'; import { SharedModule } from '../../../../shared/shared.module'; @@ -35,9 +31,7 @@ describe('ActiveAlertListComponent', () => { DashboardModule, CephModule, CoreModule - ], - declarations: [], - providers: [i18nProviders] + ] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/active-alert-list/active-alert-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/active-alert-list/active-alert-list.component.ts index bcd1f006aa0..7c0e437d7a2 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/active-alert-list/active-alert-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/active-alert-list/active-alert-list.component.ts @@ -1,7 +1,5 @@ import { Component, Inject, OnInit, TemplateRef, ViewChild } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; - import { PrometheusService } from '../../../../shared/api/prometheus.service'; import { CellTemplate } from '../../../../shared/enum/cell-template.enum'; import { Icons } from '../../../../shared/enum/icons.enum'; @@ -44,7 +42,6 @@ export class ActiveAlertListComponent extends PrometheusListHelper implements On private authStorageService: AuthStorageService, public prometheusAlertService: PrometheusAlertService, private urlBuilder: URLBuilderService, - private i18n: I18n, private cdDatePipe: CdDatePipe, @Inject(PrometheusService) prometheusService: PrometheusService, @Inject(SummaryService) summaryService: SummaryService, @@ -61,7 +58,7 @@ export class ActiveAlertListComponent extends PrometheusListHelper implements On icon: Icons.add, routerLink: () => '/monitoring' + this.urlBuilder.getCreateFrom(this.selection.first().fingerprint), - name: this.i18n('Create Silence') + name: $localize`Create Silence` } ]; } @@ -70,31 +67,31 @@ export class ActiveAlertListComponent extends PrometheusListHelper implements On super.ngOnInit(); this.columns = [ { - name: this.i18n('Name'), + name: $localize`Name`, prop: 'labels.alertname', flexGrow: 2 }, { - name: this.i18n('Job'), + name: $localize`Job`, prop: 'labels.job', flexGrow: 2 }, { - name: this.i18n('Severity'), + name: $localize`Severity`, prop: 'labels.severity' }, { - name: this.i18n('State'), + name: $localize`State`, prop: 'status.state', cellTransformation: CellTemplate.classAdding }, { - name: this.i18n('Started'), + name: $localize`Started`, prop: 'startsAt', pipe: this.cdDatePipe }, { - name: this.i18n('URL'), + name: $localize`URL`, prop: 'generatorURL', sortable: false, cellTemplate: this.externalLinkTpl diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/rules-list/rules-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/rules-list/rules-list.component.spec.ts index 1c1c53486aa..5f1b294f2dd 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/rules-list/rules-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/rules-list/rules-list.component.spec.ts @@ -5,7 +5,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap'; import { ToastrModule } from 'ngx-toastr'; -import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../../testing/unit-test-helper'; import { PrometheusService } from '../../../../shared/api/prometheus.service'; import { SettingsService } from '../../../../shared/api/settings.service'; import { SharedModule } from '../../../../shared/shared.module'; @@ -25,7 +25,7 @@ describe('RulesListComponent', () => { RouterTestingModule, ToastrModule.forRoot() ], - providers: [PrometheusService, SettingsService, i18nProviders] + providers: [PrometheusService, SettingsService] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/rules-list/rules-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/rules-list/rules-list.component.ts index 809d7703df8..e98aaabe74c 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/rules-list/rules-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/rules-list/rules-list.component.ts @@ -1,7 +1,5 @@ import { Component, Inject, OnInit } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; - import { PrometheusService } from '../../../../shared/api/prometheus.service'; import { CdTableColumn } from '../../../../shared/models/cd-table-column'; import { PrometheusRule } from '../../../../shared/models/prometheus-alerts'; @@ -28,7 +26,6 @@ export class RulesListComponent extends PrometheusListHelper implements OnInit { hideKeys = ['alerts', 'type']; constructor( - private i18n: I18n, public prometheusAlertService: PrometheusAlertService, @Inject(PrometheusService) prometheusService: PrometheusService, @Inject(SummaryService) summaryService: SummaryService, @@ -40,12 +37,12 @@ export class RulesListComponent extends PrometheusListHelper implements OnInit { ngOnInit() { super.ngOnInit(); this.columns = [ - { prop: 'name', name: this.i18n('Name') }, - { prop: 'labels.severity', name: this.i18n('Severity') }, - { prop: 'group', name: this.i18n('Group') }, - { prop: 'duration', name: this.i18n('Duration'), pipe: new DurationPipe() }, - { prop: 'query', name: this.i18n('Query'), isHidden: true }, - { prop: 'annotations.description', name: this.i18n('Description') } + { prop: 'name', name: $localize`Name` }, + { prop: 'labels.severity', name: $localize`Severity` }, + { prop: 'group', name: $localize`Group` }, + { prop: 'duration', name: $localize`Duration`, pipe: new DurationPipe() }, + { prop: 'query', name: $localize`Query`, isHidden: true }, + { prop: 'annotations.description', name: $localize`Description` } ]; } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-form/silence-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-form/silence-form.component.spec.ts index 365fcf1f74a..ee3d5e956e3 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-form/silence-form.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-form/silence-form.component.spec.ts @@ -14,7 +14,6 @@ import { configureTestBed, FixtureHelper, FormHelper, - i18nProviders, PrometheusHelper } from '../../../../../testing/unit-test-helper'; import { NotFoundComponent } from '../../../../core/not-found/not-found.component'; @@ -64,7 +63,6 @@ describe('SilenceFormComponent', () => { ReactiveFormsModule ], providers: [ - i18nProviders, { provide: ActivatedRoute, useValue: { params: { subscribe: (fn: Function) => fn(params) } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-form/silence-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-form/silence-form.component.ts index aa241505c85..0212ac0ebf2 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-form/silence-form.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-form/silence-form.component.ts @@ -2,7 +2,6 @@ import { Component } from '@angular/core'; import { Validators } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import * as moment from 'moment'; @@ -46,23 +45,23 @@ export class SilenceFormComponent { id: string; action: string; - resource = this.i18n('silence'); + resource = $localize`silence`; matchers: AlertmanagerSilenceMatcher[] = []; matcherMatch: AlertmanagerSilenceMatcherMatch = undefined; matcherConfig = [ { - tooltip: this.i18n('Attribute name'), + tooltip: $localize`Attribute name`, icon: this.icons.paragraph, attribute: 'name' }, { - tooltip: this.i18n('Value'), + tooltip: $localize`Value`, icon: this.icons.terminal, attribute: 'value' }, { - tooltip: this.i18n('Regular expression'), + tooltip: $localize`Regular expression`, icon: this.icons.magic, attribute: 'isRegex' } @@ -71,7 +70,6 @@ export class SilenceFormComponent { datetimeFormat = 'YYYY-MM-DD HH:mm'; constructor( - private i18n: I18n, private router: Router, private authStorageService: AuthStorageService, private formBuilder: CdFormBuilder, @@ -206,9 +204,7 @@ export class SilenceFormComponent { this.rules = []; this.notificationService.show( NotificationType.info, - this.i18n( - 'Please add your Prometheus host to the dashboard configuration and refresh the page' - ), + $localize`Please add your Prometheus host to the dashboard configuration and refresh the page`, undefined, undefined, 'Prometheus' diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-list/silence-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-list/silence-list.component.spec.ts index c428f7ca4b4..a5e1a250bc6 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-list/silence-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-list/silence-list.component.spec.ts @@ -7,11 +7,7 @@ import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap'; import { ToastrModule } from 'ngx-toastr'; import { of } from 'rxjs'; -import { - configureTestBed, - i18nProviders, - PermissionHelper -} from '../../../../../testing/unit-test-helper'; +import { configureTestBed, PermissionHelper } from '../../../../../testing/unit-test-helper'; import { PrometheusService } from '../../../../shared/api/prometheus.service'; import { CriticalConfirmationModalComponent } from '../../../../shared/components/critical-confirmation-modal/critical-confirmation-modal.component'; import { TableActionsComponent } from '../../../../shared/datatable/table-actions/table-actions.component'; @@ -36,8 +32,7 @@ describe('SilenceListComponent', () => { HttpClientTestingModule, NgbNavModule ], - declarations: [SilenceListComponent, PrometheusTabsComponent], - providers: [i18nProviders] + declarations: [SilenceListComponent, PrometheusTabsComponent] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-list/silence-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-list/silence-list.component.ts index daba3e2a8d6..af48f5fdba6 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-list/silence-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-list/silence-list.component.ts @@ -1,7 +1,6 @@ import { Component, Inject } from '@angular/core'; import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import { SortDirection, SortPropDir } from '@swimlane/ngx-datatable'; import { Observable, Subscriber } from 'rxjs'; @@ -52,7 +51,6 @@ export class SilenceListComponent extends PrometheusListHelper { constructor( private authStorageService: AuthStorageService, - private i18n: I18n, private cdDatePipe: CdDatePipe, private modalService: ModalService, private notificationService: NotificationService, @@ -116,32 +114,32 @@ export class SilenceListComponent extends PrometheusListHelper { ]; this.columns = [ { - name: this.i18n('ID'), + name: $localize`ID`, prop: 'id', flexGrow: 3 }, { - name: this.i18n('Created by'), + name: $localize`Created by`, prop: 'createdBy', flexGrow: 2 }, { - name: this.i18n('Started'), + name: $localize`Started`, prop: 'startsAt', pipe: this.cdDatePipe }, { - name: this.i18n('Updated'), + name: $localize`Updated`, prop: 'updatedAt', pipe: this.cdDatePipe }, { - name: this.i18n('Ends'), + name: $localize`Ends`, prop: 'endsAt', pipe: this.cdDatePipe }, { - name: this.i18n('Status'), + name: $localize`Status`, prop: 'status.state', cellTransformation: CellTemplate.classAdding } @@ -167,7 +165,7 @@ export class SilenceListComponent extends PrometheusListHelper { expireSilence() { const id = this.selection.first().id; - const i18nSilence = this.i18n('Silence'); + const i18nSilence = $localize`Silence`; const applicationName = 'Prometheus'; this.modalRef = this.modalService.show(CriticalConfirmationModalComponent, { itemDescription: i18nSilence, diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-matcher-modal/silence-matcher-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-matcher-modal/silence-matcher-modal.component.spec.ts index 08d408fbac1..c888fb5bb60 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-matcher-modal/silence-matcher-modal.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-matcher-modal/silence-matcher-modal.component.spec.ts @@ -11,7 +11,6 @@ import { configureTestBed, FixtureHelper, FormHelper, - i18nProviders, PrometheusHelper } from '../../../../../testing/unit-test-helper'; import { SharedModule } from '../../../../shared/shared.module'; @@ -34,7 +33,7 @@ describe('SilenceMatcherModalComponent', () => { RouterTestingModule, ReactiveFormsModule ], - providers: [NgbActiveModal, i18nProviders] + providers: [NgbActiveModal] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.spec.ts index 20683f0d284..23fe0950889 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.spec.ts @@ -4,7 +4,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import * as _ from 'lodash'; import { of } from 'rxjs'; -import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../../testing/unit-test-helper'; import { CoreModule } from '../../../../core/core.module'; import { CephServiceService } from '../../../../shared/api/ceph-service.service'; import { HostService } from '../../../../shared/api/host.service'; @@ -77,9 +77,7 @@ describe('ServiceDaemonListComponent', () => { }; configureTestBed({ - imports: [HttpClientTestingModule, CephModule, CoreModule, SharedModule], - declarations: [], - providers: [i18nProviders] + imports: [HttpClientTestingModule, CephModule, CoreModule, SharedModule] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.ts index e2758013297..16c23f3b579 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.ts @@ -11,7 +11,6 @@ import { ViewChildren } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { Observable, Subscription } from 'rxjs'; @@ -51,7 +50,6 @@ export class ServiceDaemonListComponent implements OnInit, OnChanges, AfterViewI private daemonsTableTplsSub: Subscription; constructor( - private i18n: I18n, private hostService: HostService, private cephServiceService: CephServiceService, private orchService: OrchestratorService @@ -60,25 +58,25 @@ export class ServiceDaemonListComponent implements OnInit, OnChanges, AfterViewI ngOnInit() { this.columns = [ { - name: this.i18n('Hostname'), + name: $localize`Hostname`, prop: 'hostname', flexGrow: 1, filterable: true }, { - name: this.i18n('Daemon type'), + name: $localize`Daemon type`, prop: 'daemon_type', flexGrow: 1, filterable: true }, { - name: this.i18n('Daemon ID'), + name: $localize`Daemon ID`, prop: 'daemon_id', flexGrow: 1, filterable: true }, { - name: this.i18n('Container ID'), + name: $localize`Container ID`, prop: 'container_id', flexGrow: 3, filterable: true, @@ -88,13 +86,13 @@ export class ServiceDaemonListComponent implements OnInit, OnChanges, AfterViewI } }, { - name: this.i18n('Container Image name'), + name: $localize`Container Image name`, prop: 'container_image_name', flexGrow: 3, filterable: true }, { - name: this.i18n('Container Image ID'), + name: $localize`Container Image ID`, prop: 'container_image_id', flexGrow: 3, filterable: true, @@ -104,20 +102,20 @@ export class ServiceDaemonListComponent implements OnInit, OnChanges, AfterViewI } }, { - name: this.i18n('Version'), + name: $localize`Version`, prop: 'version', flexGrow: 1, filterable: true }, { - name: this.i18n('Status'), + name: $localize`Status`, prop: 'status_desc', flexGrow: 1, filterable: true, cellTemplate: this.statusTpl }, { - name: this.i18n('Last Refreshed'), + name: $localize`Last Refreshed`, prop: 'last_refresh', flexGrow: 2 } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-details/service-details.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-details/service-details.component.spec.ts index 1faa2bed845..ea65965a85c 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-details/service-details.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-details/service-details.component.spec.ts @@ -4,7 +4,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap'; -import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../../testing/unit-test-helper'; import { CdTableSelection } from '../../../../shared/models/cd-table-selection'; import { SummaryService } from '../../../../shared/services/summary.service'; import { SharedModule } from '../../../../shared/shared.module'; @@ -18,15 +18,7 @@ describe('ServiceDetailsComponent', () => { configureTestBed({ imports: [HttpClientTestingModule, RouterTestingModule, SharedModule, NgbNavModule], declarations: [ServiceDetailsComponent, ServiceDaemonListComponent], - providers: [ - i18nProviders, - { - provide: SummaryService, - useValue: { - subscribeOnce: jest.fn() - } - } - ] + providers: [{ provide: SummaryService, useValue: { subscribeOnce: jest.fn() } }] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/services.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/services.component.spec.ts index 6a2f4d34377..b007f1ee097 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/services.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/services.component.spec.ts @@ -5,7 +5,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { of } from 'rxjs'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { CoreModule } from '../../../core/core.module'; import { CephServiceService } from '../../../shared/api/ceph-service.service'; import { OrchestratorService } from '../../../shared/api/orchestrator.service'; @@ -60,8 +60,7 @@ describe('ServicesComponent', () => { HttpClientTestingModule, RouterTestingModule ], - providers: [{ provide: AuthStorageService, useValue: fakeAuthStorageService }, i18nProviders], - declarations: [] + providers: [{ provide: AuthStorageService, useValue: fakeAuthStorageService }] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/services.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/services.component.ts index 4f23794f244..4f83b0c944c 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/services.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/services.component.ts @@ -1,7 +1,5 @@ import { Component, Input, OnChanges, OnInit, ViewChild } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; - import { CephServiceService } from '../../../shared/api/ceph-service.service'; import { OrchestratorService } from '../../../shared/api/orchestrator.service'; import { ListWithDetails } from '../../../shared/classes/list-with-details.class'; @@ -41,7 +39,6 @@ export class ServicesComponent extends ListWithDetails implements OnChanges, OnI constructor( private authStorageService: AuthStorageService, - private i18n: I18n, private orchService: OrchestratorService, private cephServiceService: CephServiceService ) { @@ -52,17 +49,17 @@ export class ServicesComponent extends ListWithDetails implements OnChanges, OnI ngOnInit() { const columns = [ { - name: this.i18n('Service'), + name: $localize`Service`, prop: 'service_name', flexGrow: 1 }, { - name: this.i18n('Container image name'), + name: $localize`Container image name`, prop: 'status.container_image_name', flexGrow: 3 }, { - name: this.i18n('Container image ID'), + name: $localize`Container image ID`, prop: 'status.container_image_id', flexGrow: 3, cellTransformation: CellTemplate.truncate, @@ -71,19 +68,19 @@ export class ServicesComponent extends ListWithDetails implements OnChanges, OnI } }, { - name: this.i18n('Running'), + name: $localize`Running`, prop: 'status.running', flexGrow: 1, cellClass: 'text-center', cellTransformation: CellTemplate.checkIcon }, { - name: this.i18n('Size'), + name: $localize`Size`, prop: 'status.size', flexGrow: 1 }, { - name: this.i18n('Last Refreshed'), + name: $localize`Last Refreshed`, prop: 'status.last_refresh', flexGrow: 1 } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/telemetry/telemetry.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/telemetry/telemetry.component.spec.ts index 0f0133512b0..5ffb046cf16 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/telemetry/telemetry.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/telemetry/telemetry.component.spec.ts @@ -8,7 +8,7 @@ import * as _ from 'lodash'; import { ToastrModule } from 'ngx-toastr'; import { of as observableOf } from 'rxjs'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { MgrModuleService } from '../../../shared/api/mgr-module.service'; import { TelemetryService } from '../../../shared/api/telemetry.service'; import { LoadingPanelComponent } from '../../../shared/components/loading-panel/loading-panel.component'; @@ -56,8 +56,7 @@ describe('TelemetryComponent', () => { RouterTestingModule, SharedModule, ToastrModule.forRoot() - ], - providers: i18nProviders + ] }, [LoadingPanelComponent] ); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/telemetry/telemetry.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/telemetry/telemetry.component.ts index 40c00795e36..2abbade4847 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/telemetry/telemetry.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/telemetry/telemetry.component.ts @@ -2,7 +2,6 @@ import { Component, OnInit } from '@angular/core'; import { ValidatorFn, Validators } from '@angular/forms'; import { Router } from '@angular/router'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { forkJoin as observableForkJoin } from 'rxjs'; @@ -50,7 +49,6 @@ export class TelemetryComponent extends CdForm implements OnInit { private notificationService: NotificationService, private router: Router, private telemetryService: TelemetryService, - private i18n: I18n, private textToDownloadService: TextToDownloadService, private telemetryNotificationService: TelemetryNotificationService ) { @@ -151,11 +149,9 @@ export class TelemetryComponent extends CdForm implements OnInit { this.mgrModuleService.updateConfig('telemetry', config).subscribe( () => { this.disableModule( - this.i18n( - `Your settings have been applied successfully. \ -Due to privacy/legal reasons the Telemetry module is now disabled until you \ -complete the next step and accept the license.` - ), + $localize`Your settings have been applied successfully. \ + Due to privacy/legal reasons the Telemetry module is now disabled until you \ + complete the next step and accept the license.`, () => { this.getReport(); } @@ -203,7 +199,7 @@ complete the next step and accept the license.` this.telemetryNotificationService.setVisibility(false); this.notificationService.show( NotificationType.success, - this.i18n('The Telemetry module has been configured and activated successfully.') + $localize`The Telemetry module has been configured and activated successfully.` ); this.router.navigate(['']); }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.spec.ts index 6728b41d3a1..24fa1b5b338 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.spec.ts @@ -6,7 +6,7 @@ import { By } from '@angular/platform-browser'; import * as _ from 'lodash'; import { of } from 'rxjs'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { HealthService } from '../../../shared/api/health.service'; import { Permissions } from '../../../shared/models/permissions'; import { AuthStorageService } from '../../../shared/services/auth-storage.service'; @@ -59,7 +59,6 @@ describe('HealthComponent', () => { ], schemas: [NO_ERRORS_SCHEMA], providers: [ - i18nProviders, { provide: AuthStorageService, useValue: fakeAuthStorageService }, PgCategoryService, RefreshIntervalService diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.ts index 6089f4faef3..8268d1320fe 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.ts @@ -1,6 +1,5 @@ import { Component, OnDestroy, OnInit } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { Subscription } from 'rxjs'; @@ -65,7 +64,6 @@ export class HealthComponent implements OnInit, OnDestroy { constructor( private healthService: HealthService, - private i18n: I18n, private authStorageService: AuthStorageService, private pgCategoryService: PgCategoryService, private featureToggles: FeatureTogglesService, @@ -101,14 +99,14 @@ export class HealthComponent implements OnInit, OnDestroy { this.healthData.client_perf.write_op_per_sec + this.healthData.client_perf.read_op_per_sec; ratioLabels.push( - `${this.i18n('Writes')} (${this.calcPercentage( + `${$localize`Writes`} (${this.calcPercentage( this.healthData.client_perf.write_op_per_sec, total )}%)` ); ratioData.push(this.healthData.client_perf.write_op_per_sec); ratioLabels.push( - `${this.i18n('Reads')} (${this.calcPercentage( + `${$localize`Reads`} (${this.calcPercentage( this.healthData.client_perf.read_op_per_sec, total )}%)` @@ -132,17 +130,17 @@ export class HealthComponent implements OnInit, OnDestroy { chart.dataset[0].data = [data.df.stats.total_used_raw_bytes, data.df.stats.total_avail_bytes]; chart.labels = [ - `${this.dimlessBinary.transform(data.df.stats.total_used_raw_bytes)} ${this.i18n( - 'Used' - )} (${percentUsed}%)`, - `${this.dimlessBinary.transform( + $localize`${this.dimlessBinary.transform( + data.df.stats.total_used_raw_bytes + )} Used (${percentUsed}%)`, + $localize`${this.dimlessBinary.transform( data.df.stats.total_bytes - data.df.stats.total_used_raw_bytes - )} ${this.i18n('Avail.')} (${percentAvailable}%)` + )} Avail. (${percentAvailable}%)` ]; chart.options.title.text = `${this.dimlessBinary.transform( data.df.stats.total_bytes - )} ${this.i18n('total')}`; + )} ${$localize`total`}`; } preparePgStatus(chart: Record, data: Record) { @@ -164,10 +162,10 @@ export class HealthComponent implements OnInit, OnDestroy { .map((categoryType) => categoryPgAmount[categoryType]); chart.labels = [ - `${this.i18n('Clean')} (${this.calcPercentage(categoryPgAmount['clean'], totalPgs)}%)`, - `${this.i18n('Working')} (${this.calcPercentage(categoryPgAmount['working'], totalPgs)}%)`, - `${this.i18n('Warning')} (${this.calcPercentage(categoryPgAmount['warning'], totalPgs)}%)`, - `${this.i18n('Unknown')} (${this.calcPercentage(categoryPgAmount['unknown'], totalPgs)}%)` + `${$localize`Clean`} (${this.calcPercentage(categoryPgAmount['clean'], totalPgs)}%)`, + `${$localize`Working`} (${this.calcPercentage(categoryPgAmount['working'], totalPgs)}%)`, + `${$localize`Warning`} (${this.calcPercentage(categoryPgAmount['warning'], totalPgs)}%)`, + `${$localize`Unknown`} (${this.calcPercentage(categoryPgAmount['unknown'], totalPgs)}%)` ]; } @@ -180,16 +178,16 @@ export class HealthComponent implements OnInit, OnDestroy { data.pg_info.object_stats.num_objects_unfound; chart.labels = [ - `${this.i18n('Healthy')} (${this.calcPercentage(healthy, totalReplicas)}%)`, - `${this.i18n('Misplaced')} (${this.calcPercentage( + `${$localize`Healthy`} (${this.calcPercentage(healthy, totalReplicas)}%)`, + `${$localize`Misplaced`} (${this.calcPercentage( data.pg_info.object_stats.num_objects_misplaced, totalReplicas )}%)`, - `${this.i18n('Degraded')} (${this.calcPercentage( + `${$localize`Degraded`} (${this.calcPercentage( data.pg_info.object_stats.num_objects_degraded, totalReplicas )}%)`, - `${this.i18n('Unfound')} (${this.calcPercentage( + `${$localize`Unfound`} (${this.calcPercentage( data.pg_info.object_stats.num_objects_unfound, totalReplicas )}%)` @@ -204,7 +202,7 @@ export class HealthComponent implements OnInit, OnDestroy { chart.options.title.text = `${this.dimless.transform( data.pg_info.object_stats.num_objects - )} ${this.i18n('total')} (${this.dimless.transform(totalReplicas)} ${this.i18n('replicas')})`; + )} ${$localize`total`} (${this.dimless.transform(totalReplicas)} ${$localize`replicas`})`; chart.options.maintainAspectRatio = window.innerWidth >= 375; } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mds-summary.pipe.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mds-summary.pipe.spec.ts index 32e05b04114..68d951bd01c 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mds-summary.pipe.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mds-summary.pipe.spec.ts @@ -1,13 +1,13 @@ import { TestBed } from '@angular/core/testing'; -import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../testing/unit-test-helper'; import { MdsSummaryPipe } from './mds-summary.pipe'; describe('MdsSummaryPipe', () => { let pipe: MdsSummaryPipe; configureTestBed({ - providers: [MdsSummaryPipe, i18nProviders] + providers: [MdsSummaryPipe] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mds-summary.pipe.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mds-summary.pipe.ts index 7bd1014d8de..68853cb0bee 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mds-summary.pipe.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mds-summary.pipe.ts @@ -1,14 +1,11 @@ import { Pipe, PipeTransform } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; @Pipe({ name: 'mdsSummary' }) export class MdsSummaryPipe implements PipeTransform { - constructor(private i18n: I18n) {} - transform(value: any): any { if (!value) { return ''; @@ -24,10 +21,10 @@ export class MdsSummaryPipe implements PipeTransform { }); if (value.standbys && !value.filesystems) { - contentLine1 = `${standbys} ${this.i18n('up')}`; - contentLine2 = this.i18n('no filesystems'); + contentLine1 = `${standbys} ${$localize`up`}`; + contentLine2 = $localize`no filesystems`; } else if (value.filesystems.length === 0) { - contentLine1 = this.i18n('no filesystems'); + contentLine1 = $localize`no filesystems`; } else { _.each(value.filesystems, (fs) => { _.each(fs.mdsmap.info, (mds) => { @@ -39,24 +36,22 @@ export class MdsSummaryPipe implements PipeTransform { }); }); - contentLine1 = `${active} ${this.i18n('active')}`; - contentLine2 = `${standbys + standbyReplay} ${this.i18n('standby')}`; + contentLine1 = `${active} ${$localize`active`}`; + contentLine2 = `${standbys + standbyReplay} ${$localize`standby`}`; } const standbyHoverText = value.standbys.map((s: any): string => s.name).join(', '); const standbyTitleText = !standbyHoverText ? '' - : `${this.i18n('standby daemons')}: ${standbyHoverText}`; + : `${$localize`standby daemons`}: ${standbyHoverText}`; const fsLength = value.filesystems ? value.filesystems.length : 0; const infoObject = fsLength > 0 ? value.filesystems[0].mdsmap.info : {}; const activeHoverText = Object.values(infoObject) .map((info: any): string => info.name) .join(', '); - let activeTitleText = !activeHoverText - ? '' - : `${this.i18n('active daemon')}: ${activeHoverText}`; + let activeTitleText = !activeHoverText ? '' : `${$localize`active daemon`}: ${activeHoverText}`; // There is always one standbyreplay to replace active daemon, if active one is down if (!active && fsLength > 0) { - activeTitleText = `${standbyReplay} ${this.i18n('standbyReplay')}`; + activeTitleText = `${standbyReplay} ${$localize`standbyReplay`}`; } const mgrSummary = [ { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mgr-summary.pipe.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mgr-summary.pipe.spec.ts index 84dea633592..a81530c54d8 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mgr-summary.pipe.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mgr-summary.pipe.spec.ts @@ -1,13 +1,13 @@ import { TestBed } from '@angular/core/testing'; -import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../testing/unit-test-helper'; import { MgrSummaryPipe } from './mgr-summary.pipe'; describe('MgrSummaryPipe', () => { let pipe: MgrSummaryPipe; configureTestBed({ - providers: [MgrSummaryPipe, i18nProviders] + providers: [MgrSummaryPipe] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mgr-summary.pipe.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mgr-summary.pipe.ts index c99cd864635..286d5dd337f 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mgr-summary.pipe.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mgr-summary.pipe.ts @@ -1,23 +1,20 @@ import { Pipe, PipeTransform } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; @Pipe({ name: 'mgrSummary' }) export class MgrSummaryPipe implements PipeTransform { - constructor(private i18n: I18n) {} - transform(value: any): any { if (!value) { return ''; } - let activeCount = this.i18n('n/a'); + let activeCount = $localize`n/a`; const activeTitleText = _.isUndefined(value.active_name) ? '' - : `${this.i18n('active daemon')}: ${value.active_name}`; + : `${$localize`active daemon`}: ${value.active_name}`; // There is always one standbyreplay to replace active daemon, if active one is down if (activeTitleText.length > 0) { activeCount = '1'; @@ -25,11 +22,11 @@ export class MgrSummaryPipe implements PipeTransform { const standbyHoverText = value.standbys.map((s: any): string => s.name).join(', '); const standbyTitleText = !standbyHoverText ? '' - : `${this.i18n('standby daemons')}: ${standbyHoverText}`; + : `${$localize`standby daemons`}: ${standbyHoverText}`; const standbyCount = value.standbys.length; const mgrSummary = [ { - content: `${activeCount} ${this.i18n('active')}`, + content: `${activeCount} ${$localize`active`}`, class: 'popover-info', titleText: activeTitleText } @@ -41,7 +38,7 @@ export class MgrSummaryPipe implements PipeTransform { titleText: '' }); mgrSummary.push({ - content: `${standbyCount} ${this.i18n('standby')}`, + content: `${standbyCount} ${$localize`standby`}`, class: 'popover-info', titleText: standbyTitleText }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mon-summary.pipe.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mon-summary.pipe.spec.ts index 5d64cd6c91e..15374674190 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mon-summary.pipe.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mon-summary.pipe.spec.ts @@ -1,13 +1,13 @@ import { TestBed } from '@angular/core/testing'; -import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../testing/unit-test-helper'; import { MonSummaryPipe } from './mon-summary.pipe'; describe('MonSummaryPipe', () => { let pipe: MonSummaryPipe; configureTestBed({ - providers: [MonSummaryPipe, i18nProviders] + providers: [MonSummaryPipe] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mon-summary.pipe.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mon-summary.pipe.ts index 31339f52e29..399045d5de3 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mon-summary.pipe.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mon-summary.pipe.ts @@ -1,21 +1,16 @@ import { Pipe, PipeTransform } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; - @Pipe({ name: 'monSummary' }) export class MonSummaryPipe implements PipeTransform { - constructor(private i18n: I18n) {} - transform(value: any): any { if (!value) { return ''; } - const result = `${value.monmap.mons.length.toString()} (${this.i18n( - 'quorum' - )} ${value.quorum.join(', ')})`; + const result = $localize`${value.monmap.mons.length.toString()} (quorum \ +${value.quorum.join(', ')})`; return result; } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/osd-summary.pipe.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/osd-summary.pipe.spec.ts index 20914d52a55..13456e26343 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/osd-summary.pipe.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/osd-summary.pipe.spec.ts @@ -1,13 +1,13 @@ import { TestBed } from '@angular/core/testing'; -import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../testing/unit-test-helper'; import { OsdSummaryPipe } from './osd-summary.pipe'; describe('OsdSummaryPipe', () => { let pipe: OsdSummaryPipe; configureTestBed({ - providers: [OsdSummaryPipe, i18nProviders] + providers: [OsdSummaryPipe] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/osd-summary.pipe.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/osd-summary.pipe.ts index c007c313cf3..05fc7ad7f80 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/osd-summary.pipe.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/osd-summary.pipe.ts @@ -1,14 +1,11 @@ import { Pipe, PipeTransform } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; @Pipe({ name: 'osdSummary' }) export class OsdSummaryPipe implements PipeTransform { - constructor(private i18n: I18n) {} - transform(value: any): any { if (!value) { return ''; @@ -27,7 +24,7 @@ export class OsdSummaryPipe implements PipeTransform { const osdSummary = [ { - content: `${value.osds.length} ${this.i18n('total')}`, + content: `${value.osds.length} ${$localize`total`}`, class: '' } ]; @@ -36,7 +33,7 @@ export class OsdSummaryPipe implements PipeTransform { class: 'card-text-line-break' }); osdSummary.push({ - content: `${upCount} ${this.i18n('up')}, ${inCount} ${this.i18n('in')}`, + content: `${upCount} ${$localize`up`}, ${inCount} ${$localize`in`}`, class: '' }); @@ -48,9 +45,9 @@ export class OsdSummaryPipe implements PipeTransform { class: 'card-text-line-break' }); - const downText = downCount > 0 ? `${downCount} ${this.i18n('down')}` : ''; + const downText = downCount > 0 ? `${downCount} ${$localize`down`}` : ''; const separator = downCount > 0 && outCount > 0 ? ', ' : ''; - const outText = outCount > 0 ? `${outCount} ${this.i18n('out')}` : ''; + const outText = outCount > 0 ? `${outCount} ${$localize`out`}` : ''; osdSummary.push({ content: `${downText}${separator}${outText}`, class: 'card-text-error' diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-501/nfs-501.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-501/nfs-501.component.spec.ts index bde06ba857b..cec861ba47f 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-501/nfs-501.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-501/nfs-501.component.spec.ts @@ -2,7 +2,7 @@ import { HttpClientTestingModule } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { SharedModule } from '../../../shared/shared.module'; import { Nfs501Component } from './nfs-501.component'; @@ -12,8 +12,7 @@ describe('Nfs501Component', () => { configureTestBed({ declarations: [Nfs501Component], - imports: [HttpClientTestingModule, RouterTestingModule, SharedModule], - providers: i18nProviders + imports: [HttpClientTestingModule, RouterTestingModule, SharedModule] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-501/nfs-501.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-501/nfs-501.component.ts index 985b3b3f531..4654a5ca5c6 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-501/nfs-501.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-501/nfs-501.component.ts @@ -1,8 +1,6 @@ import { Component, OnDestroy, OnInit } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; -import { I18n } from '@ngx-translate/i18n-polyfill'; - import { CephReleaseNamePipe } from '../../../shared/pipes/ceph-release-name.pipe'; import { SummaryService } from '../../../shared/services/summary.service'; @@ -13,14 +11,13 @@ import { SummaryService } from '../../../shared/services/summary.service'; }) export class Nfs501Component implements OnInit, OnDestroy { docsUrl: string; - message = this.i18n('The NFS Ganesha service is not configured.'); + message = $localize`The NFS Ganesha service is not configured.`; routeParamsSubscribe: any; constructor( private route: ActivatedRoute, private summaryService: SummaryService, - private cephReleaseNamePipe: CephReleaseNamePipe, - private i18n: I18n + private cephReleaseNamePipe: CephReleaseNamePipe ) {} ngOnInit() { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-details/nfs-details.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-details/nfs-details.component.spec.ts index 9b8f7da73e0..2411aa22eff 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-details/nfs-details.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-details/nfs-details.component.spec.ts @@ -6,7 +6,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap'; import * as _ from 'lodash'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { SharedModule } from '../../../shared/shared.module'; import { NfsDetailsComponent } from './nfs-details.component'; @@ -18,8 +18,7 @@ describe('NfsDetailsComponent', () => { configureTestBed({ declarations: [NfsDetailsComponent], - imports: [BrowserAnimationsModule, SharedModule, HttpClientTestingModule, NgbNavModule], - providers: i18nProviders + imports: [BrowserAnimationsModule, SharedModule, HttpClientTestingModule, NgbNavModule] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-details/nfs-details.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-details/nfs-details.component.ts index c6a3ba0eca9..a7760400f09 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-details/nfs-details.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-details/nfs-details.component.ts @@ -1,7 +1,5 @@ import { Component, Input, OnChanges } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; - import { CdTableColumn } from '../../../shared/models/cd-table-column'; @Component({ @@ -19,20 +17,20 @@ export class NfsDetailsComponent implements OnChanges { clientsColumns: CdTableColumn[]; clients: any[] = []; - constructor(private i18n: I18n) { + constructor() { this.clientsColumns = [ { - name: this.i18n('Addresses'), + name: $localize`Addresses`, prop: 'addresses', flexGrow: 2 }, { - name: this.i18n('Access Type'), + name: $localize`Access Type`, prop: 'access_type', flexGrow: 1 }, { - name: this.i18n('Squash'), + name: $localize`Squash`, prop: 'squash', flexGrow: 1 } @@ -46,25 +44,25 @@ export class NfsDetailsComponent implements OnChanges { this.clients = this.selectedItem.clients; this.data = {}; - this.data[this.i18n('Cluster')] = this.selectedItem.cluster_id; - this.data[this.i18n('Daemons')] = this.selectedItem.daemons; - this.data[this.i18n('NFS Protocol')] = this.selectedItem.protocols.map( + this.data[$localize`Cluster`] = this.selectedItem.cluster_id; + this.data[$localize`Daemons`] = this.selectedItem.daemons; + this.data[$localize`NFS Protocol`] = this.selectedItem.protocols.map( (protocol: string) => 'NFSv' + protocol ); - this.data[this.i18n('Pseudo')] = this.selectedItem.pseudo; - this.data[this.i18n('Access Type')] = this.selectedItem.access_type; - this.data[this.i18n('Squash')] = this.selectedItem.squash; - this.data[this.i18n('Transport')] = this.selectedItem.transports; - this.data[this.i18n('Path')] = this.selectedItem.path; + this.data[$localize`Pseudo`] = this.selectedItem.pseudo; + this.data[$localize`Access Type`] = this.selectedItem.access_type; + this.data[$localize`Squash`] = this.selectedItem.squash; + this.data[$localize`Transport`] = this.selectedItem.transports; + this.data[$localize`Path`] = this.selectedItem.path; if (this.selectedItem.fsal.name === 'CEPH') { - this.data[this.i18n('Storage Backend')] = this.i18n('CephFS'); - this.data[this.i18n('CephFS User')] = this.selectedItem.fsal.user_id; - this.data[this.i18n('CephFS Filesystem')] = this.selectedItem.fsal.fs_name; - this.data[this.i18n('Security Label')] = this.selectedItem.fsal.sec_label_xattr; + this.data[$localize`Storage Backend`] = $localize`CephFS`; + this.data[$localize`CephFS User`] = this.selectedItem.fsal.user_id; + this.data[$localize`CephFS Filesystem`] = this.selectedItem.fsal.fs_name; + this.data[$localize`Security Label`] = this.selectedItem.fsal.sec_label_xattr; } else { - this.data[this.i18n('Storage Backend')] = this.i18n('Object Gateway'); - this.data[this.i18n('Object Gateway User')] = this.selectedItem.fsal.rgw_user_id; + this.data[$localize`Storage Backend`] = $localize`Object Gateway`; + this.data[$localize`Object Gateway User`] = this.selectedItem.fsal.rgw_user_id; } } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form-client/nfs-form-client.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form-client/nfs-form-client.component.spec.ts index 4fd4e2f1f08..e85e655626a 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form-client/nfs-form-client.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form-client/nfs-form-client.component.spec.ts @@ -2,7 +2,7 @@ import { HttpClientTestingModule } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { FormControl, ReactiveFormsModule } from '@angular/forms'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { CdFormBuilder } from '../../../shared/forms/cd-form-builder'; import { CdFormGroup } from '../../../shared/forms/cd-form-group'; import { SharedModule } from '../../../shared/shared.module'; @@ -14,8 +14,7 @@ describe('NfsFormClientComponent', () => { configureTestBed({ declarations: [NfsFormClientComponent], - imports: [ReactiveFormsModule, SharedModule, HttpClientTestingModule], - providers: i18nProviders + imports: [ReactiveFormsModule, SharedModule, HttpClientTestingModule] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form-client/nfs-form-client.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form-client/nfs-form-client.component.ts index 6415b1f80d9..3ed39cff7c2 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form-client/nfs-form-client.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form-client/nfs-form-client.component.ts @@ -1,7 +1,6 @@ import { Component, Input, OnInit } from '@angular/core'; import { FormArray, FormControl, NgForm, Validators } from '@angular/forms'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { NfsService } from '../../../shared/api/nfs.service'; @@ -24,7 +23,7 @@ export class NfsFormClientComponent implements OnInit { nfsAccessType: any[] = this.nfsService.nfsAccessType; icons = Icons; - constructor(private nfsService: NfsService, private i18n: I18n) {} + constructor(private nfsService: NfsService) {} ngOnInit() { _.forEach(this.clients, (client) => { @@ -35,9 +34,9 @@ export class NfsFormClientComponent implements OnInit { getNoAccessTypeDescr() { if (this.form.getValue('access_type')) { - return `${this.form.getValue('access_type')} ${this.i18n('(inherited from global config)')}`; + return `${this.form.getValue('access_type')} ${$localize`(inherited from global config)`}`; } - return this.i18n('-- Select the access type --'); + return $localize`-- Select the access type --`; } getAccessTypeHelp(index: number) { @@ -49,9 +48,9 @@ export class NfsFormClientComponent implements OnInit { getNoSquashDescr() { if (this.form.getValue('squash')) { - return `${this.form.getValue('squash')} (${this.i18n('inherited from global config')})`; + return `${this.form.getValue('squash')} (${$localize`inherited from global config`})`; } - return this.i18n('-- Select what kind of user id squashing is performed --'); + return $localize`-- Select what kind of user id squashing is performed --`; } addClient() { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.spec.ts index ee424ae51b1..f17ee20a3de 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.spec.ts @@ -9,7 +9,7 @@ import { ToastrModule } from 'ngx-toastr'; import { of } from 'rxjs'; import { ActivatedRouteStub } from '../../../../testing/activated-route-stub'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { LoadingPanelComponent } from '../../../shared/components/loading-panel/loading-panel.component'; import { CephReleaseNamePipe } from '../../../shared/pipes/ceph-release-name.pipe'; import { SummaryService } from '../../../shared/services/summary.service'; @@ -39,7 +39,6 @@ describe('NfsFormComponent', () => { provide: ActivatedRoute, useValue: new ActivatedRouteStub({ cluster_id: undefined, export_id: undefined }) }, - i18nProviders, SummaryService, CephReleaseNamePipe ] diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.ts index 8744ff51cdf..4a62907fbec 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.ts @@ -2,7 +2,6 @@ import { ChangeDetectorRef, Component, OnInit, ViewChild } from '@angular/core'; import { FormControl, Validators } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { forkJoin, Observable, of } from 'rxjs'; import { debounceTime, distinctUntilChanged, map, mergeMap } from 'rxjs/operators'; @@ -65,10 +64,7 @@ export class NfsFormComponent extends CdForm implements OnInit { docsUrl: string; daemonsSelections: SelectOption[] = []; - daemonsMessages = new SelectMessages( - { noOptions: this.i18n('There are no daemons available.') }, - this.i18n - ); + daemonsMessages = new SelectMessages({ noOptions: $localize`There are no daemons available.` }); pathDataSource = (text$: Observable) => { return text$.pipe( @@ -98,12 +94,11 @@ export class NfsFormComponent extends CdForm implements OnInit { private cephReleaseNamePipe: CephReleaseNamePipe, private taskWrapper: TaskWrapperService, private cdRef: ChangeDetectorRef, - private i18n: I18n, public actionLabels: ActionLabelsI18n ) { super(); this.permission = this.authStorageService.getPermissions().pool; - this.resource = this.i18n('NFS export'); + this.resource = $localize`NFS export`; this.createForm(); } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-list/nfs-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-list/nfs-list.component.spec.ts index 046e2789c5f..1748b725582 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-list/nfs-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-list/nfs-list.component.spec.ts @@ -10,7 +10,6 @@ import { of } from 'rxjs'; import { configureTestBed, expectItemTasks, - i18nProviders, PermissionHelper } from '../../../../testing/unit-test-helper'; import { NfsService } from '../../../shared/api/nfs.service'; @@ -44,7 +43,7 @@ describe('NfsListComponent', () => { NgbNavModule, ToastrModule.forRoot() ], - providers: [TaskListService, i18nProviders] + providers: [TaskListService] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-list/nfs-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-list/nfs-list.component.ts index cf3994f0cac..6cebd9f1ebe 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-list/nfs-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-list/nfs-list.component.ts @@ -1,7 +1,6 @@ import { Component, OnDestroy, OnInit, TemplateRef, ViewChild } from '@angular/core'; import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { Subscription } from 'rxjs'; @@ -62,7 +61,6 @@ export class NfsListComponent extends ListWithDetails implements OnInit, OnDestr constructor( private authStorageService: AuthStorageService, - private i18n: I18n, private modalService: ModalService, private nfsService: NfsService, private taskListService: TaskListService, @@ -105,34 +103,34 @@ export class NfsListComponent extends ListWithDetails implements OnInit, OnDestr ngOnInit() { this.columns = [ { - name: this.i18n('Path'), + name: $localize`Path`, prop: 'path', flexGrow: 2, cellTransformation: CellTemplate.executing }, { - name: this.i18n('Pseudo'), + name: $localize`Pseudo`, prop: 'pseudo', flexGrow: 2 }, { - name: this.i18n('Cluster'), + name: $localize`Cluster`, prop: 'cluster_id', flexGrow: 2 }, { - name: this.i18n('Daemons'), + name: $localize`Daemons`, prop: 'daemons', flexGrow: 2 }, { - name: this.i18n('Storage Backend'), + name: $localize`Storage Backend`, prop: 'fsal', flexGrow: 2, cellTemplate: this.nfsFsal }, { - name: this.i18n('Access Type'), + name: $localize`Access Type`, prop: 'access_type', flexGrow: 2 } @@ -209,7 +207,7 @@ export class NfsListComponent extends ListWithDetails implements OnInit, OnDestr const export_id = this.selection.first().export_id; this.modalRef = this.modalService.show(CriticalConfirmationModalComponent, { - itemDescription: this.i18n('NFS export'), + itemDescription: $localize`NFS export`, itemNames: [`${cluster_id}:${export_id}`], submitActionObservable: () => this.taskWrapper.wrapTaskAroundCall({ diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/performance-counter/performance-counter.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/performance-counter/performance-counter.component.spec.ts index ed553e1b407..3f3affe6858 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/performance-counter/performance-counter.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/performance-counter/performance-counter.component.spec.ts @@ -3,7 +3,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { RouterTestingModule } from '@angular/router/testing'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { SharedModule } from '../../../shared/shared.module'; import { TablePerformanceCounterComponent } from '../table-performance-counter/table-performance-counter.component'; import { PerformanceCounterComponent } from './performance-counter.component'; @@ -14,8 +14,7 @@ describe('PerformanceCounterComponent', () => { configureTestBed({ declarations: [PerformanceCounterComponent, TablePerformanceCounterComponent], - imports: [RouterTestingModule, SharedModule, HttpClientTestingModule, BrowserAnimationsModule], - providers: i18nProviders + imports: [RouterTestingModule, SharedModule, HttpClientTestingModule, BrowserAnimationsModule] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/table-performance-counter/table-performance-counter.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/table-performance-counter/table-performance-counter.component.spec.ts index ae369f28281..4ca483cf671 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/table-performance-counter/table-performance-counter.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/table-performance-counter/table-performance-counter.component.spec.ts @@ -1,7 +1,7 @@ import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { AppModule } from '../../../app.module'; import { CdTableFetchDataContext } from '../../../shared/models/cd-table-fetch-data-context'; import { TablePerformanceCounterComponent } from './table-performance-counter.component'; @@ -12,8 +12,7 @@ describe('TablePerformanceCounterComponent', () => { let httpTesting: HttpTestingController; configureTestBed({ - imports: [AppModule, HttpClientTestingModule], - providers: i18nProviders + imports: [AppModule, HttpClientTestingModule] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/table-performance-counter/table-performance-counter.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/table-performance-counter/table-performance-counter.component.ts index ac6ea523576..0e069833697 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/table-performance-counter/table-performance-counter.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/table-performance-counter/table-performance-counter.component.ts @@ -1,7 +1,5 @@ import { Component, Input, OnInit, TemplateRef, ViewChild } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; - import { PerformanceCounterService } from '../../../shared/api/performance-counter.service'; import { CdTableColumn } from '../../../shared/models/cd-table-column'; import { CdTableFetchDataContext } from '../../../shared/models/cd-table-fetch-data-context'; @@ -33,22 +31,22 @@ export class TablePerformanceCounterComponent implements OnInit { @Input() serviceId: string; - constructor(private performanceCounterService: PerformanceCounterService, private i18n: I18n) {} + constructor(private performanceCounterService: PerformanceCounterService) {} ngOnInit() { this.columns = [ { - name: this.i18n('Name'), + name: $localize`Name`, prop: 'name', flexGrow: 1 }, { - name: this.i18n('Description'), + name: $localize`Description`, prop: 'description', flexGrow: 1 }, { - name: this.i18n('Value'), + name: $localize`Value`, prop: 'value', cellTemplate: this.valueTpl, flexGrow: 1 diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/crush-rule-form-modal/crush-rule-form-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/crush-rule-form-modal/crush-rule-form-modal.component.spec.ts index 62bdbebc367..2ecdfe9b5d2 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/crush-rule-form-modal/crush-rule-form-modal.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/crush-rule-form-modal/crush-rule-form-modal.component.spec.ts @@ -11,7 +11,6 @@ import { configureTestBed, FixtureHelper, FormHelper, - i18nProviders, Mocks } from '../../../../testing/unit-test-helper'; import { CrushRuleService } from '../../../shared/api/crush-rule.service'; @@ -79,7 +78,7 @@ describe('CrushRuleFormComponent', () => { PoolModule, NgBootstrapFormValidationModule.forRoot() ], - providers: [CrushRuleService, NgbActiveModal, i18nProviders] + providers: [CrushRuleService, NgbActiveModal] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/crush-rule-form-modal/crush-rule-form-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/crush-rule-form-modal/crush-rule-form-modal.component.ts index dcf60e4cd88..be4f85e0290 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/crush-rule-form-modal/crush-rule-form-modal.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/crush-rule-form-modal/crush-rule-form-modal.component.ts @@ -2,7 +2,6 @@ import { Component, EventEmitter, OnInit, Output } from '@angular/core'; import { Validators } from '@angular/forms'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { CrushRuleService } from '../../../shared/api/crush-rule.service'; @@ -36,12 +35,11 @@ export class CrushRuleFormModalComponent extends CrushNodeSelectionClass impleme public activeModal: NgbActiveModal, private taskWrapper: TaskWrapperService, private crushRuleService: CrushRuleService, - private i18n: I18n, public actionLabels: ActionLabelsI18n ) { super(); this.action = this.actionLabels.CREATE; - this.resource = this.i18n('Crush Rule'); + this.resource = $localize`Crush Rule`; this.createForm(); } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/erasure-code-profile-form/erasure-code-profile-form-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/erasure-code-profile-form/erasure-code-profile-form-modal.component.spec.ts index 7499a3148cd..1ea007a1e32 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/erasure-code-profile-form/erasure-code-profile-form-modal.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/erasure-code-profile-form/erasure-code-profile-form-modal.component.spec.ts @@ -12,7 +12,6 @@ import { configureTestBed, FixtureHelper, FormHelper, - i18nProviders, Mocks } from '../../../../testing/unit-test-helper'; import { ErasureCodeProfileService } from '../../../shared/api/erasure-code-profile.service'; @@ -37,7 +36,7 @@ describe('ErasureCodeProfileFormModalComponent', () => { PoolModule, NgBootstrapFormValidationModule.forRoot() ], - providers: [ErasureCodeProfileService, NgbActiveModal, i18nProviders] + providers: [ErasureCodeProfileService, NgbActiveModal] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/erasure-code-profile-form/erasure-code-profile-form-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/erasure-code-profile-form/erasure-code-profile-form-modal.component.ts index 814b1696fe0..4cda73509f5 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/erasure-code-profile-form/erasure-code-profile-form-modal.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/erasure-code-profile-form/erasure-code-profile-form-modal.component.ts @@ -2,7 +2,6 @@ import { Component, EventEmitter, OnInit, Output } from '@angular/core'; import { Validators } from '@angular/forms'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import { ErasureCodeProfileService } from '../../../shared/api/erasure-code-profile.service'; import { CrushNodeSelectionClass } from '../../../shared/classes/crush.node.selection.class'; @@ -48,12 +47,11 @@ export class ErasureCodeProfileFormModalComponent extends CrushNodeSelectionClas public activeModal: NgbActiveModal, private taskWrapper: TaskWrapperService, private ecpService: ErasureCodeProfileService, - private i18n: I18n, public actionLabels: ActionLabelsI18n ) { super(); this.action = this.actionLabels.CREATE; - this.resource = this.i18n('EC Profile'); + this.resource = $localize`EC Profile`; this.createForm(); this.setJerasureDefaults(); } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-details/pool-details.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-details/pool-details.component.spec.ts index 9bb3f2422df..188f65d7905 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-details/pool-details.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-details/pool-details.component.spec.ts @@ -5,7 +5,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap'; -import { configureTestBed, i18nProviders, TabHelper } from '../../../../testing/unit-test-helper'; +import { configureTestBed, TabHelper } from '../../../../testing/unit-test-helper'; import { Permissions } from '../../../shared/models/permissions'; import { SharedModule } from '../../../shared/shared.module'; import { RbdConfigurationListComponent } from '../../block/rbd-configuration-list/rbd-configuration-list.component'; @@ -23,8 +23,7 @@ describe('PoolDetailsComponent', () => { HttpClientTestingModule, RouterTestingModule ], - declarations: [PoolDetailsComponent, RbdConfigurationListComponent], - providers: [i18nProviders] + declarations: [PoolDetailsComponent, RbdConfigurationListComponent] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-details/pool-details.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-details/pool-details.component.ts index bf517a84dcc..74242d9ec2a 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-details/pool-details.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-details/pool-details.component.ts @@ -1,6 +1,5 @@ import { Component, Input, OnChanges } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { PoolService } from '../../../shared/api/pool.service'; @@ -24,36 +23,36 @@ export class PoolDetailsComponent implements OnChanges { cacheTiers: any[]; selectedPoolConfiguration: RbdConfigurationEntry[]; - constructor(private i18n: I18n, private poolService: PoolService) { + constructor(private poolService: PoolService) { this.cacheTierColumns = [ { prop: 'pool_name', - name: this.i18n('Name'), + name: $localize`Name`, flexGrow: 3 }, { prop: 'cache_mode', - name: this.i18n('Cache Mode'), + name: $localize`Cache Mode`, flexGrow: 2 }, { prop: 'cache_min_evict_age', - name: this.i18n('Min Evict Age'), + name: $localize`Min Evict Age`, flexGrow: 2 }, { prop: 'cache_min_flush_age', - name: this.i18n('Min Flush Age'), + name: $localize`Min Flush Age`, flexGrow: 2 }, { prop: 'target_max_bytes', - name: this.i18n('Target Max Bytes'), + name: $localize`Target Max Bytes`, flexGrow: 2 }, { prop: 'target_max_objects', - name: this.i18n('Target Max Objects'), + name: $localize`Target Max Objects`, flexGrow: 2 } ]; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form-data.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form-data.ts index 88d5664d6b6..c0cd2438672 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form-data.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form-data.ts @@ -1,7 +1,5 @@ import { Validators } from '@angular/forms'; -import { I18n } from '@ngx-translate/i18n-polyfill'; - import { SelectMessages } from '../../../shared/components/select/select-messages.model'; import { Pool } from '../pool'; @@ -11,29 +9,26 @@ export class PoolFormData { crushInfo = false; applications: any; - constructor(i18n: I18n) { + constructor() { this.poolTypes = ['erasure', 'replicated']; this.applications = { selected: [], default: ['cephfs', 'rbd', 'rgw'], available: [], // Filled during runtime validators: [Validators.pattern('[A-Za-z0-9_]+'), Validators.maxLength(128)], - messages: new SelectMessages( - { - empty: i18n('No applications added'), - selectionLimit: { - text: i18n('Applications limit reached'), - tooltip: i18n('A pool can only have up to four applications definitions.') - }, - customValidations: { - pattern: i18n(`Allowed characters '_a-zA-Z0-9'`), - maxlength: i18n('Maximum length is 128 characters') - }, - filter: i18n('Filter or add applications'), - add: i18n('Add application') + messages: new SelectMessages({ + empty: $localize`No applications added`, + selectionLimit: { + text: $localize`Applications limit reached`, + tooltip: $localize`A pool can only have up to four applications definitions.` + }, + customValidations: { + pattern: $localize`Allowed characters '_a-zA-Z0-9'`, + maxlength: $localize`Maximum length is 128 characters` }, - i18n - ) + filter: $localize`Filter or add applications'`, + add: $localize`Add application` + }) }; } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.spec.ts index af8999a807c..0ca5df70d8c 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.spec.ts @@ -21,7 +21,6 @@ import { configureTestBed, FixtureHelper, FormHelper, - i18nProviders, Mocks, modalServiceShow } from '../../../../testing/unit-test-helper'; @@ -152,8 +151,7 @@ describe('PoolFormComponent', () => { ErasureCodeProfileService, NgbActiveModal, SelectBadgesComponent, - { provide: ActivatedRoute, useValue: { params: of({ name: 'somePoolName' }) } }, - i18nProviders + { provide: ActivatedRoute, useValue: { params: of({ name: 'somePoolName' }) } } ] }, [CriticalConfirmationModalComponent] diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.ts index f57b70a1231..7691b5e494b 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.ts @@ -3,7 +3,6 @@ import { FormControl, Validators } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; import { NgbNav, NgbTooltip } from '@ng-bootstrap/ng-bootstrap'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { Observable, Subscription } from 'rxjs'; @@ -66,7 +65,7 @@ export class PoolFormComponent extends CdForm implements OnInit { editing = false; isReplicated = false; isErasure = false; - data = new PoolFormData(this.i18n); + data = new PoolFormData(); externalPgChange = false; current: Record = { rules: [] @@ -96,13 +95,12 @@ export class PoolFormComponent extends CdForm implements OnInit { private taskWrapper: TaskWrapperService, private ecpService: ErasureCodeProfileService, private crushRuleService: CrushRuleService, - private i18n: I18n, public actionLabels: ActionLabelsI18n ) { super(); this.editing = this.router.url.startsWith(`/pool/${URLVerbs.EDIT}`); this.action = this.editing ? this.actionLabels.EDIT : this.actionLabels.CREATE; - this.resource = this.i18n('pool'); + this.resource = $localize`pool`; this.authenticate(); this.createForm(); } @@ -632,7 +630,7 @@ export class PoolFormComponent extends CdForm implements OnInit { getTabs: () => this.ecpInfoTabs, tabPosition: 'used-by-pools', nameAttribute: 'name', - itemDescription: this.i18n('erasure code profile'), + itemDescription: $localize`erasure code profile`, reloadFn: () => this.reloadECPs(), deleteFn: (name) => this.ecpService.delete(name), taskName: 'ecp/delete' @@ -720,7 +718,7 @@ export class PoolFormComponent extends CdForm implements OnInit { getTabs: () => this.crushInfoTabs, tabPosition: 'used-by-pools', nameAttribute: 'rule_name', - itemDescription: this.i18n('crush rule'), + itemDescription: $localize`crush rule`, reloadFn: () => this.reloadCrushRules(), deleteFn: (name) => this.crushRuleService.delete(name), taskName: 'crushRule/delete' diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.spec.ts index 048802fc1af..1dbd72afb2b 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.spec.ts @@ -8,11 +8,7 @@ import * as _ from 'lodash'; import { ToastrModule } from 'ngx-toastr'; import { of } from 'rxjs'; -import { - configureTestBed, - expectItemTasks, - i18nProviders -} from '../../../../testing/unit-test-helper'; +import { configureTestBed, expectItemTasks } from '../../../../testing/unit-test-helper'; import { ConfigurationService } from '../../../shared/api/configuration.service'; import { PoolService } from '../../../shared/api/pool.service'; import { CriticalConfirmationModalComponent } from '../../../shared/components/critical-confirmation-modal/critical-confirmation-modal.component'; @@ -57,7 +53,7 @@ describe('PoolListComponent', () => { NgbNavModule, HttpClientTestingModule ], - providers: [i18nProviders, PgCategoryService] + providers: [PgCategoryService] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.ts index ede82bb58cc..eae76ef70c7 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.ts @@ -1,7 +1,6 @@ import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core'; import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { ConfigurationService } from '../../../shared/api/configuration.service'; @@ -66,7 +65,6 @@ export class PoolListComponent extends ListWithDetails implements OnInit { private authStorageService: AuthStorageService, private taskListService: TaskListService, private modalService: ModalService, - private i18n: I18n, private pgCategoryService: PgCategoryService, private dimlessPipe: DimlessPipe, private urlBuilder: URLBuilderService, @@ -119,23 +117,23 @@ export class PoolListComponent extends ListWithDetails implements OnInit { this.columns = [ { prop: 'pool_name', - name: this.i18n('Name'), + name: $localize`Name`, flexGrow: 4, cellTransformation: CellTemplate.executing }, { prop: 'type', - name: this.i18n('Type'), + name: $localize`Type`, flexGrow: 2 }, { prop: 'application_metadata', - name: this.i18n('Applications'), + name: $localize`Applications`, flexGrow: 3 }, { prop: 'pg_status', - name: this.i18n('PG Status'), + name: $localize`PG Status`, flexGrow: 3, cellClass: ({ row, column, value }): any => { return this.getPgStatusCellClass(row, column, value); @@ -143,35 +141,35 @@ export class PoolListComponent extends ListWithDetails implements OnInit { }, { prop: 'size', - name: this.i18n('Replica Size'), + name: $localize`Replica Size`, flexGrow: 2, cellClass: 'text-right' }, { prop: 'last_change', - name: this.i18n('Last Change'), + name: $localize`Last Change`, flexGrow: 2, cellClass: 'text-right' }, { prop: 'erasure_code_profile', - name: this.i18n('Erasure Coded Profile'), + name: $localize`Erasure Coded Profile`, flexGrow: 2 }, { prop: 'crush_rule', - name: this.i18n('Crush Ruleset'), + name: $localize`Crush Ruleset`, flexGrow: 3 }, { - name: this.i18n('Usage'), + name: $localize`Usage`, prop: 'usage', cellTemplate: this.poolUsageTpl, flexGrow: 3 }, { prop: 'stats.rd_bytes.rates', - name: this.i18n('Read bytes'), + name: $localize`Read bytes`, comparator: (_valueA: any, _valueB: any, rowA: Pool, rowB: Pool) => compare('stats.rd_bytes.latest', rowA, rowB), cellTransformation: CellTemplate.sparkline, @@ -179,7 +177,7 @@ export class PoolListComponent extends ListWithDetails implements OnInit { }, { prop: 'stats.wr_bytes.rates', - name: this.i18n('Write bytes'), + name: $localize`Write bytes`, comparator: (_valueA: any, _valueB: any, rowA: Pool, rowB: Pool) => compare('stats.wr_bytes.latest', rowA, rowB), cellTransformation: CellTemplate.sparkline, @@ -187,14 +185,14 @@ export class PoolListComponent extends ListWithDetails implements OnInit { }, { prop: 'stats.rd.rate', - name: this.i18n('Read ops'), + name: $localize`Read ops`, flexGrow: 1, pipe: this.dimlessPipe, cellTransformation: CellTemplate.perSecond }, { prop: 'stats.wr.rate', - name: this.i18n('Write ops'), + name: $localize`Write ops`, flexGrow: 1, pipe: this.dimlessPipe, cellTransformation: CellTemplate.perSecond @@ -295,9 +293,7 @@ export class PoolListComponent extends ListWithDetails implements OnInit { getDisableDesc(): string | undefined { if (!this.monAllowPoolDelete) { - return this.i18n( - 'Pool deletion is disabled by the mon_allow_pool_delete configuration setting.' - ); + return $localize`Pool deletion is disabled by the mon_allow_pool_delete configuration setting.`; } return undefined; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-501/rgw-501.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-501/rgw-501.component.spec.ts index 565caab1563..75941b9e30b 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-501/rgw-501.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-501/rgw-501.component.spec.ts @@ -2,7 +2,7 @@ import { HttpClientTestingModule } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { SharedModule } from '../../../shared/shared.module'; import { Rgw501Component } from './rgw-501.component'; @@ -12,8 +12,7 @@ describe('Rgw501Component', () => { configureTestBed({ declarations: [Rgw501Component], - imports: [HttpClientTestingModule, RouterTestingModule, SharedModule], - providers: i18nProviders + imports: [HttpClientTestingModule, RouterTestingModule, SharedModule] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-details/rgw-bucket-details.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-details/rgw-bucket-details.component.spec.ts index 68799f5ee36..60f2c67fa90 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-details/rgw-bucket-details.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-details/rgw-bucket-details.component.spec.ts @@ -1,6 +1,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { CdTableSelection } from '../../../shared/models/cd-table-selection'; import { SharedModule } from '../../../shared/shared.module'; import { RgwBucketDetailsComponent } from './rgw-bucket-details.component'; @@ -11,8 +11,7 @@ describe('RgwBucketDetailsComponent', () => { configureTestBed({ declarations: [RgwBucketDetailsComponent], - imports: [SharedModule], - providers: [i18nProviders] + imports: [SharedModule] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.spec.ts index acaecac88ba..5a9e3e221ad 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.spec.ts @@ -8,7 +8,7 @@ import * as _ from 'lodash'; import { ToastrModule } from 'ngx-toastr'; import { of as observableOf } from 'rxjs'; -import { configureTestBed, FormHelper, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed, FormHelper } from '../../../../testing/unit-test-helper'; import { RgwBucketService } from '../../../shared/api/rgw-bucket.service'; import { RgwSiteService } from '../../../shared/api/rgw-site.service'; import { RgwUserService } from '../../../shared/api/rgw-user.service'; @@ -36,8 +36,7 @@ describe('RgwBucketFormComponent', () => { RouterTestingModule, SharedModule, ToastrModule.forRoot() - ], - providers: [i18nProviders] + ] }); beforeEach(() => { @@ -204,7 +203,7 @@ describe('RgwBucketFormComponent', () => { component.submit(); expect(notificationService.show).toHaveBeenCalledWith( NotificationType.success, - `Created Object Gateway bucket ''` + `Created Object Gateway bucket 'null'` ); }); @@ -215,7 +214,7 @@ describe('RgwBucketFormComponent', () => { component.submit(); expect(notificationService.show).toHaveBeenCalledWith( NotificationType.success, - `Updated Object Gateway bucket ''.` + `Updated Object Gateway bucket 'null'.` ); }); }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.ts index 21531ed7344..484a2bf0a0f 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.ts @@ -2,7 +2,6 @@ import { Component, OnInit } from '@angular/core'; import { AbstractControl, AsyncValidatorFn, ValidationErrors, Validators } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { forkJoin } from 'rxjs'; @@ -52,13 +51,12 @@ export class RgwBucketFormComponent extends CdForm implements OnInit { private rgwSiteService: RgwSiteService, private rgwUserService: RgwUserService, private notificationService: NotificationService, - private i18n: I18n, public actionLabels: ActionLabelsI18n ) { super(); this.editing = this.router.url.startsWith(`/rgw/bucket/${URLVerbs.EDIT}`); this.action = this.editing ? this.actionLabels.EDIT : this.actionLabels.CREATE; - this.resource = this.i18n('bucket'); + this.resource = $localize`bucket`; this.createForm(); } @@ -114,7 +112,7 @@ export class RgwBucketFormComponent extends CdForm implements OnInit { const placementTargets = data['getPlacementTargets']; this.zonegroup = placementTargets['zonegroup']; _.forEach(placementTargets['placement_targets'], (placementTarget) => { - placementTarget['description'] = `${placementTarget['name']} (${this.i18n('pool')}: ${ + placementTarget['description'] = `${placementTarget['name']} (${$localize`pool`}: ${ placementTarget['data_pool'] })`; this.placementTargets.push(placementTarget); @@ -189,7 +187,7 @@ export class RgwBucketFormComponent extends CdForm implements OnInit { () => { this.notificationService.show( NotificationType.success, - this.i18n(`Updated Object Gateway bucket '{{bid}}'.`, values) + $localize`Updated Object Gateway bucket '${values.bid}'.` ); this.goToListView(); }, @@ -215,7 +213,7 @@ export class RgwBucketFormComponent extends CdForm implements OnInit { () => { this.notificationService.show( NotificationType.success, - this.i18n(`Created Object Gateway bucket '{{bid}}'`, values) + $localize`Created Object Gateway bucket '${values.bid}'` ); this.goToListView(); }, diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-list/rgw-bucket-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-list/rgw-bucket-list.component.spec.ts index b3ea48a0935..a41ff3c169d 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-list/rgw-bucket-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-list/rgw-bucket-list.component.spec.ts @@ -6,11 +6,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap'; import { of } from 'rxjs'; -import { - configureTestBed, - i18nProviders, - PermissionHelper -} from '../../../../testing/unit-test-helper'; +import { configureTestBed, PermissionHelper } from '../../../../testing/unit-test-helper'; import { RgwBucketService } from '../../../shared/api/rgw-bucket.service'; import { TableActionsComponent } from '../../../shared/datatable/table-actions/table-actions.component'; import { SharedModule } from '../../../shared/shared.module'; @@ -31,8 +27,7 @@ describe('RgwBucketListComponent', () => { SharedModule, NgbNavModule, HttpClientTestingModule - ], - providers: i18nProviders + ] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-list/rgw-bucket-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-list/rgw-bucket-list.component.ts index aceaffe07ee..f35b19f8280 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-list/rgw-bucket-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-list/rgw-bucket-list.component.ts @@ -7,7 +7,6 @@ import { ViewChild } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { forkJoin as observableForkJoin, Observable, Subscriber } from 'rxjs'; @@ -58,7 +57,6 @@ export class RgwBucketListComponent extends ListWithDetails implements OnInit { private dimlessPipe: DimlessPipe, private rgwBucketService: RgwBucketService, private modalService: ModalService, - private i18n: I18n, private urlBuilder: URLBuilderService, public actionLabels: ActionLabelsI18n, private ngZone: NgZone, @@ -96,35 +94,35 @@ export class RgwBucketListComponent extends ListWithDetails implements OnInit { ngOnInit() { this.columns = [ { - name: this.i18n('Name'), + name: $localize`Name`, prop: 'bid', flexGrow: 2 }, { - name: this.i18n('Owner'), + name: $localize`Owner`, prop: 'owner', flexGrow: 2.5 }, { - name: this.i18n('Used Capacity'), + name: $localize`Used Capacity`, prop: 'bucket_size', flexGrow: 0.6, pipe: this.dimlessBinaryPipe }, { - name: this.i18n('Capacity Limit %'), + name: $localize`Capacity Limit %`, prop: 'size_usage', cellTemplate: this.bucketSizeTpl, flexGrow: 0.8 }, { - name: this.i18n('Objects'), + name: $localize`Objects`, prop: 'num_objects', flexGrow: 0.6, pipe: this.dimlessPipe }, { - name: this.i18n('Object Limit %'), + name: $localize`Object Limit %`, prop: 'object_usage', cellTemplate: this.bucketObjectTpl, flexGrow: 0.8 @@ -183,9 +181,7 @@ export class RgwBucketListComponent extends ListWithDetails implements OnInit { deleteAction() { this.modalService.show(CriticalConfirmationModalComponent, { - itemDescription: this.selection.hasSingleSelection - ? this.i18n('bucket') - : this.i18n('buckets'), + itemDescription: this.selection.hasSingleSelection ? $localize`bucket` : $localize`buckets`, itemNames: this.selection.selected.map((bucket: any) => bucket['bid']), submitActionObservable: () => { return new Observable((observer: Subscriber) => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-list/rgw-daemon-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-list/rgw-daemon-list.component.spec.ts index 8dce412135a..4ee44b72922 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-list/rgw-daemon-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-list/rgw-daemon-list.component.spec.ts @@ -6,7 +6,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap'; import { of } from 'rxjs'; -import { configureTestBed, i18nProviders, TabHelper } from '../../../../testing/unit-test-helper'; +import { configureTestBed, TabHelper } from '../../../../testing/unit-test-helper'; import { RgwSiteService } from '../../../shared/api/rgw-site.service'; import { Permissions } from '../../../shared/models/permissions'; import { AuthStorageService } from '../../../shared/services/auth-storage.service'; @@ -37,8 +37,7 @@ describe('RgwDaemonListComponent', () => { PerformanceCounterModule, SharedModule, RouterTestingModule - ], - providers: i18nProviders + ] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-list/rgw-daemon-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-list/rgw-daemon-list.component.ts index 7a43cfeeadf..8d8be533a2d 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-list/rgw-daemon-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-list/rgw-daemon-list.component.ts @@ -1,7 +1,5 @@ import { Component, OnInit } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; - import { RgwDaemonService } from '../../../shared/api/rgw-daemon.service'; import { RgwSiteService } from '../../../shared/api/rgw-site.service'; import { ListWithDetails } from '../../../shared/classes/list-with-details.class'; @@ -26,7 +24,6 @@ export class RgwDaemonListComponent extends ListWithDetails implements OnInit { private rgwDaemonService: RgwDaemonService, private authStorageService: AuthStorageService, private cephShortVersionPipe: CephShortVersionPipe, - private i18n: I18n, private rgwSiteService: RgwSiteService ) { super(); @@ -36,17 +33,17 @@ export class RgwDaemonListComponent extends ListWithDetails implements OnInit { this.grafanaPermission = this.authStorageService.getPermissions().grafana; this.columns = [ { - name: this.i18n('ID'), + name: $localize`ID`, prop: 'id', flexGrow: 2 }, { - name: this.i18n('Hostname'), + name: $localize`Hostname`, prop: 'server_hostname', flexGrow: 2 }, { - name: this.i18n('Version'), + name: $localize`Version`, prop: 'version', flexGrow: 1, pipe: this.cephShortVersionPipe diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-capability-modal/rgw-user-capability-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-capability-modal/rgw-user-capability-modal.component.spec.ts index 9c457bec9c4..3b92991f3d3 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-capability-modal/rgw-user-capability-modal.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-capability-modal/rgw-user-capability-modal.component.spec.ts @@ -4,7 +4,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { SharedModule } from '../../../shared/shared.module'; import { RgwUserCapabilityModalComponent } from './rgw-user-capability-modal.component'; @@ -15,7 +15,7 @@ describe('RgwUserCapabilityModalComponent', () => { configureTestBed({ declarations: [RgwUserCapabilityModalComponent], imports: [ReactiveFormsModule, SharedModule, RouterTestingModule], - providers: [NgbActiveModal, i18nProviders] + providers: [NgbActiveModal] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-capability-modal/rgw-user-capability-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-capability-modal/rgw-user-capability-modal.component.ts index cb4ca385545..3b1ce3fc81c 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-capability-modal/rgw-user-capability-modal.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-capability-modal/rgw-user-capability-modal.component.ts @@ -2,7 +2,6 @@ import { Component, EventEmitter, Output } from '@angular/core'; import { Validators } from '@angular/forms'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { ActionLabelsI18n } from '../../../shared/constants/app.constants'; @@ -33,10 +32,9 @@ export class RgwUserCapabilityModalComponent { constructor( private formBuilder: CdFormBuilder, public activeModal: NgbActiveModal, - private i18n: I18n, public actionLabels: ActionLabelsI18n ) { - this.resource = this.i18n('capability'); + this.resource = $localize`capability`; this.createForm(); } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-details/rgw-user-details.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-details/rgw-user-details.component.spec.ts index 9dcf79a3c03..4156a4ada20 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-details/rgw-user-details.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-details/rgw-user-details.component.spec.ts @@ -4,7 +4,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap'; -import { configureTestBed, i18nProviders, TabHelper } from '../../../../testing/unit-test-helper'; +import { configureTestBed, TabHelper } from '../../../../testing/unit-test-helper'; import { SharedModule } from '../../../shared/shared.module'; import { RgwUserS3Key } from '../models/rgw-user-s3-key'; import { RgwUserDetailsComponent } from './rgw-user-details.component'; @@ -15,8 +15,7 @@ describe('RgwUserDetailsComponent', () => { configureTestBed({ declarations: [RgwUserDetailsComponent], - imports: [BrowserAnimationsModule, HttpClientTestingModule, SharedModule, NgbNavModule], - providers: [i18nProviders] + imports: [BrowserAnimationsModule, HttpClientTestingModule, SharedModule, NgbNavModule] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-details/rgw-user-details.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-details/rgw-user-details.component.ts index f2cd8faa18b..276950c8d6e 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-details/rgw-user-details.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-details/rgw-user-details.component.ts @@ -1,6 +1,5 @@ import { Component, Input, OnChanges, OnInit, TemplateRef, ViewChild } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { RgwUserService } from '../../../shared/api/rgw-user.service'; @@ -38,28 +37,24 @@ export class RgwUserDetailsComponent implements OnChanges, OnInit { icons = Icons; - constructor( - private rgwUserService: RgwUserService, - private modalService: ModalService, - private i18n: I18n - ) {} + constructor(private rgwUserService: RgwUserService, private modalService: ModalService) {} ngOnInit() { this.keysColumns = [ { - name: this.i18n('Username'), + name: $localize`Username`, prop: 'username', flexGrow: 1 }, { - name: this.i18n('Type'), + name: $localize`Type`, prop: 'type', flexGrow: 1 } ]; this.maxBucketsMap = { - '-1': this.i18n('Disabled'), - 0: this.i18n('Unlimited') + '-1': $localize`Disabled`, + 0: $localize`Unlimited` }; } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.spec.ts index c41e7384d28..f434aae26a5 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.spec.ts @@ -8,7 +8,7 @@ import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap'; import { ToastrModule } from 'ngx-toastr'; import { of as observableOf } from 'rxjs'; -import { configureTestBed, FormHelper, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed, FormHelper } from '../../../../testing/unit-test-helper'; import { RgwUserService } from '../../../shared/api/rgw-user.service'; import { NotificationType } from '../../../shared/enum/notification-type.enum'; import { NotificationService } from '../../../shared/services/notification.service'; @@ -33,8 +33,7 @@ describe('RgwUserFormComponent', () => { SharedModule, ToastrModule.forRoot(), NgbTooltipModule - ], - providers: [i18nProviders] + ] }); beforeEach(() => { @@ -295,7 +294,7 @@ describe('RgwUserFormComponent', () => { component.onSubmit(); expect(notificationService.show).toHaveBeenCalledWith( NotificationType.success, - `Created Object Gateway user ''` + `Created Object Gateway user 'null'` ); }); @@ -306,7 +305,7 @@ describe('RgwUserFormComponent', () => { component.onSubmit(); expect(notificationService.show).toHaveBeenCalledWith( NotificationType.success, - `Updated Object Gateway user ''` + `Updated Object Gateway user 'null'` ); }); }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.ts index 00a799f180f..8055daf029a 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.ts @@ -2,7 +2,6 @@ import { Component, OnInit } from '@angular/core'; import { AbstractControl, ValidationErrors, Validators } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { concat as observableConcat, forkJoin as observableForkJoin, Observable } from 'rxjs'; @@ -55,14 +54,13 @@ export class RgwUserFormComponent extends CdForm implements OnInit { private rgwUserService: RgwUserService, private modalService: ModalService, private notificationService: NotificationService, - private i18n: I18n, public actionLabels: ActionLabelsI18n ) { super(); - this.resource = this.i18n('user'); - this.subuserLabel = this.i18n('subuser'); - this.s3keyLabel = this.i18n('S3 Key'); - this.capabilityLabel = this.i18n('capability'); + this.resource = $localize`user`; + this.subuserLabel = $localize`subuser`; + this.s3keyLabel = $localize`S3 Key`; + this.capabilityLabel = $localize`capability`; this.createForm(); } @@ -250,12 +248,12 @@ export class RgwUserFormComponent extends CdForm implements OnInit { const args = this._getUpdateArgs(); this.submitObservables.push(this.rgwUserService.update(uid, args)); } - notificationTitle = this.i18n(`Updated Object Gateway user '{{uid}}'`, { uid: uid }); + notificationTitle = $localize`Updated Object Gateway user '${uid}'`; } else { // Add const args = this._getCreateArgs(); this.submitObservables.push(this.rgwUserService.create(args)); - notificationTitle = this.i18n(`Created Object Gateway user '{{uid}}'`, { uid: uid }); + notificationTitle = $localize`Created Object Gateway user '${uid}'`; } // Check if user quota has been modified. if (this._isUserQuotaDirty()) { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-list/rgw-user-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-list/rgw-user-list.component.spec.ts index a893a0db1fe..c037065e03c 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-list/rgw-user-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-list/rgw-user-list.component.spec.ts @@ -4,11 +4,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { RouterTestingModule } from '@angular/router/testing'; -import { - configureTestBed, - i18nProviders, - PermissionHelper -} from '../../../../testing/unit-test-helper'; +import { configureTestBed, PermissionHelper } from '../../../../testing/unit-test-helper'; import { TableActionsComponent } from '../../../shared/datatable/table-actions/table-actions.component'; import { SharedModule } from '../../../shared/shared.module'; import { RgwUserListComponent } from './rgw-user-list.component'; @@ -20,8 +16,7 @@ describe('RgwUserListComponent', () => { configureTestBed({ declarations: [RgwUserListComponent], imports: [BrowserAnimationsModule, RouterTestingModule, HttpClientTestingModule, SharedModule], - schemas: [NO_ERRORS_SCHEMA], - providers: i18nProviders + schemas: [NO_ERRORS_SCHEMA] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-list/rgw-user-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-list/rgw-user-list.component.ts index 4bad8007d7d..d5ed7c17e84 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-list/rgw-user-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-list/rgw-user-list.component.ts @@ -1,6 +1,5 @@ import { Component, NgZone, ViewChild } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import { forkJoin as observableForkJoin, Observable, Subscriber } from 'rxjs'; import { RgwUserService } from '../../../shared/api/rgw-user.service'; @@ -42,7 +41,6 @@ export class RgwUserListComponent extends ListWithDetails { private authStorageService: AuthStorageService, private rgwUserService: RgwUserService, private modalService: ModalService, - private i18n: I18n, private urlBuilder: URLBuilderService, public actionLabels: ActionLabelsI18n, private ngZone: NgZone @@ -51,35 +49,35 @@ export class RgwUserListComponent extends ListWithDetails { this.permission = this.authStorageService.getPermissions().rgw; this.columns = [ { - name: this.i18n('Username'), + name: $localize`Username`, prop: 'uid', flexGrow: 1 }, { - name: this.i18n('Full name'), + name: $localize`Full name`, prop: 'display_name', flexGrow: 1 }, { - name: this.i18n('Email address'), + name: $localize`Email address`, prop: 'email', flexGrow: 1 }, { - name: this.i18n('Suspended'), + name: $localize`Suspended`, prop: 'suspended', flexGrow: 1, cellClass: 'text-center', cellTransformation: CellTemplate.checkIcon }, { - name: this.i18n('Max. buckets'), + name: $localize`Max. buckets`, prop: 'max_buckets', flexGrow: 1, cellTransformation: CellTemplate.map, customTemplateConfig: { - '-1': this.i18n('Disabled'), - 0: this.i18n('Unlimited') + '-1': $localize`Disabled`, + 0: $localize`Unlimited` } } ]; @@ -140,7 +138,7 @@ export class RgwUserListComponent extends ListWithDetails { deleteAction() { this.modalService.show(CriticalConfirmationModalComponent, { - itemDescription: this.selection.hasSingleSelection ? this.i18n('user') : this.i18n('users'), + itemDescription: this.selection.hasSingleSelection ? $localize`user` : $localize`users`, itemNames: this.selection.selected.map((user: any) => user['uid']), submitActionObservable: (): Observable => { return new Observable((observer: Subscriber) => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-s3-key-modal/rgw-user-s3-key-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-s3-key-modal/rgw-user-s3-key-modal.component.spec.ts index 0f124dcb2ff..9c42e1c6d29 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-s3-key-modal/rgw-user-s3-key-modal.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-s3-key-modal/rgw-user-s3-key-modal.component.spec.ts @@ -4,7 +4,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { SharedModule } from '../../../shared/shared.module'; import { RgwUserS3KeyModalComponent } from './rgw-user-s3-key-modal.component'; @@ -15,7 +15,7 @@ describe('RgwUserS3KeyModalComponent', () => { configureTestBed({ declarations: [RgwUserS3KeyModalComponent], imports: [ReactiveFormsModule, SharedModule, RouterTestingModule], - providers: [NgbActiveModal, i18nProviders] + providers: [NgbActiveModal] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-s3-key-modal/rgw-user-s3-key-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-s3-key-modal/rgw-user-s3-key-modal.component.ts index bc762794d68..c06129d39fc 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-s3-key-modal/rgw-user-s3-key-modal.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-s3-key-modal/rgw-user-s3-key-modal.component.ts @@ -2,7 +2,6 @@ import { Component, EventEmitter, Output } from '@angular/core'; import { Validators } from '@angular/forms'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { ActionLabelsI18n } from '../../../shared/constants/app.constants'; @@ -32,10 +31,9 @@ export class RgwUserS3KeyModalComponent { constructor( private formBuilder: CdFormBuilder, public activeModal: NgbActiveModal, - private i18n: I18n, public actionLabels: ActionLabelsI18n ) { - this.resource = this.i18n('S3 Key'); + this.resource = $localize`S3 Key`; this.createForm(); } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-subuser-modal/rgw-user-subuser-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-subuser-modal/rgw-user-subuser-modal.component.spec.ts index 4c883468e7f..4ebe26a298d 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-subuser-modal/rgw-user-subuser-modal.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-subuser-modal/rgw-user-subuser-modal.component.spec.ts @@ -4,7 +4,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { SharedModule } from '../../../shared/shared.module'; import { RgwUserSubuserModalComponent } from './rgw-user-subuser-modal.component'; @@ -15,7 +15,7 @@ describe('RgwUserSubuserModalComponent', () => { configureTestBed({ declarations: [RgwUserSubuserModalComponent], imports: [ReactiveFormsModule, SharedModule, RouterTestingModule], - providers: [NgbActiveModal, i18nProviders] + providers: [NgbActiveModal] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-subuser-modal/rgw-user-subuser-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-subuser-modal/rgw-user-subuser-modal.component.ts index 663c7f93779..3a534497001 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-subuser-modal/rgw-user-subuser-modal.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-subuser-modal/rgw-user-subuser-modal.component.ts @@ -2,7 +2,6 @@ import { Component, EventEmitter, Output } from '@angular/core'; import { AbstractControl, ValidationErrors, ValidatorFn, Validators } from '@angular/forms'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { ActionLabelsI18n } from '../../../shared/constants/app.constants'; @@ -33,10 +32,9 @@ export class RgwUserSubuserModalComponent { constructor( private formBuilder: CdFormBuilder, public bsModalRef: NgbActiveModal, - private i18n: I18n, private actionLabels: ActionLabelsI18n ) { - this.resource = this.i18n('Subuser'); + this.resource = $localize`Subuser`; this.createForm(); } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-swift-key-modal/rgw-user-swift-key-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-swift-key-modal/rgw-user-swift-key-modal.component.spec.ts index af2c873bcdb..4d5e8fc4176 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-swift-key-modal/rgw-user-swift-key-modal.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-swift-key-modal/rgw-user-swift-key-modal.component.spec.ts @@ -5,7 +5,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { ToastrModule } from 'ngx-toastr'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { SharedModule } from '../../../shared/shared.module'; import { RgwUserSwiftKeyModalComponent } from './rgw-user-swift-key-modal.component'; @@ -16,7 +16,7 @@ describe('RgwUserSwiftKeyModalComponent', () => { configureTestBed({ declarations: [RgwUserSwiftKeyModalComponent], imports: [ToastrModule.forRoot(), FormsModule, SharedModule, RouterTestingModule], - providers: [NgbActiveModal, i18nProviders] + providers: [NgbActiveModal] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-swift-key-modal/rgw-user-swift-key-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-swift-key-modal/rgw-user-swift-key-modal.component.ts index aa34f6b7c7f..306e81be81f 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-swift-key-modal/rgw-user-swift-key-modal.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-swift-key-modal/rgw-user-swift-key-modal.component.ts @@ -1,7 +1,6 @@ import { Component } from '@angular/core'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import { ActionLabelsI18n } from '../../../shared/constants/app.constants'; @@ -16,12 +15,8 @@ export class RgwUserSwiftKeyModalComponent { resource: string; action: string; - constructor( - public activeModal: NgbActiveModal, - private i18n: I18n, - public actionLabels: ActionLabelsI18n - ) { - this.resource = this.i18n('Swift Key'); + constructor(public activeModal: NgbActiveModal, public actionLabels: ActionLabelsI18n) { + this.resource = $localize`Swift Key`; this.action = this.actionLabels.SHOW; } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/device-list/device-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/device-list/device-list.component.spec.ts index 2d136e799f9..37518b18693 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/device-list/device-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/device-list/device-list.component.spec.ts @@ -1,7 +1,7 @@ import { HttpClientTestingModule } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { SharedModule } from '../../../shared/shared.module'; import { DeviceListComponent } from './device-list.component'; @@ -11,8 +11,7 @@ describe('DeviceListComponent', () => { configureTestBed({ declarations: [DeviceListComponent], - imports: [SharedModule, HttpClientTestingModule], - providers: [i18nProviders] + imports: [SharedModule, HttpClientTestingModule] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/device-list/device-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/device-list/device-list.component.ts index cc59e674f48..22ce27ff673 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/device-list/device-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/device-list/device-list.component.ts @@ -1,8 +1,6 @@ import { DatePipe } from '@angular/common'; import { Component, Input, OnChanges, OnInit, TemplateRef, ViewChild } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; - import { HostService } from '../../../shared/api/host.service'; import { OsdService } from '../../../shared/api/osd.service'; import { CellTemplate } from '../../../shared/enum/cell-template.enum'; @@ -36,43 +34,42 @@ export class DeviceListComponent implements OnChanges, OnInit { constructor( private hostService: HostService, - private i18n: I18n, private datePipe: DatePipe, private osdService: OsdService ) {} ngOnInit() { this.columns = [ - { prop: 'devid', name: this.i18n('Device ID'), minWidth: 200 }, + { prop: 'devid', name: $localize`Device ID`, minWidth: 200 }, { prop: 'state', - name: this.i18n('State of Health'), + name: $localize`State of Health`, flexGrow: 1, cellTransformation: CellTemplate.badge, customTemplateConfig: { map: { - good: { value: this.i18n('Good'), class: 'badge-success' }, - warning: { value: this.i18n('Warning'), class: 'badge-warning' }, - bad: { value: this.i18n('Bad'), class: 'badge-danger' }, - stale: { value: this.i18n('Stale'), class: 'badge-info' }, - unknown: { value: this.i18n('Unknown'), class: 'badge-dark' } + good: { value: $localize`Good`, class: 'badge-success' }, + warning: { value: $localize`Warning`, class: 'badge-warning' }, + bad: { value: $localize`Bad`, class: 'badge-danger' }, + stale: { value: $localize`Stale`, class: 'badge-info' }, + unknown: { value: $localize`Unknown`, class: 'badge-dark' } } } }, { prop: 'life_expectancy_weeks', - name: this.i18n('Life Expectancy'), + name: $localize`Life Expectancy`, cellTemplate: this.lifeExpectancyTemplate }, { prop: 'life_expectancy_stamp', - name: this.i18n('Prediction Creation Date'), + name: $localize`Prediction Creation Date`, cellTemplate: this.lifeExpectancyTimestampTemplate, pipe: this.datePipe, isHidden: true }, - { prop: 'location', name: this.i18n('Device Name'), cellTemplate: this.locationTemplate }, - { prop: 'readableDaemons', name: this.i18n('Daemons') } + { prop: 'location', name: $localize`Device Name`, cellTemplate: this.locationTemplate }, + { prop: 'readableDaemons', name: $localize`Daemons` } ]; } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/smart-list/smart-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/smart-list/smart-list.component.spec.ts index 138115750f8..ac79d93fff7 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/smart-list/smart-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/smart-list/smart-list.component.spec.ts @@ -8,7 +8,7 @@ import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap'; import * as _ from 'lodash'; import { of } from 'rxjs'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { OsdService } from '../../../shared/api/osd.service'; import { HddSmartDataV1, NvmeSmartDataV1, SmartDataResult } from '../../../shared/models/smart'; import { SharedModule } from '../../../shared/shared.module'; @@ -81,8 +81,7 @@ describe('OsdSmartListComponent', () => { configureTestBed({ declarations: [SmartListComponent], - imports: [BrowserAnimationsModule, SharedModule, HttpClientTestingModule, NgbNavModule], - providers: [i18nProviders] + imports: [BrowserAnimationsModule, SharedModule, HttpClientTestingModule, NgbNavModule] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/smart-list/smart-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/smart-list/smart-list.component.ts index 7c29c98fda3..f02a537c08c 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/smart-list/smart-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/smart-list/smart-list.component.ts @@ -1,6 +1,5 @@ import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { HostService } from '../../../shared/api/host.service'; @@ -33,11 +32,7 @@ export class SmartListComponent implements OnInit, OnChanges { smartDataColumns: CdTableColumn[]; - constructor( - private i18n: I18n, - private osdService: OsdService, - private hostService: HostService - ) {} + constructor(private osdService: OsdService, private hostService: HostService) {} isSmartError(data: any): data is SmartError { return _.get(data, 'error') !== undefined; @@ -57,16 +52,12 @@ export class SmartListComponent implements OnInit, OnChanges { if (this.isSmartError(smartData)) { let userMessage = ''; if (smartData.smartctl_error_code === -22) { - userMessage = this.i18n( - `Smartctl has received an unknown argument (error code {{code}}). \ + userMessage = $localize`Smartctl has received an unknown argument \ +(error code ${smartData.smartctl_error_code}). \ You may be using an incompatible version of smartmontools. Version >= 7.0 of \ -smartmontools is required to successfully retrieve data.`, - { code: smartData.smartctl_error_code } - ); +smartmontools is required to successfully retrieve data.`; } else { - userMessage = this.i18n('An error with error code {{code}} occurred.', { - code: smartData.smartctl_error_code - }); + userMessage = $localize`An error with error code ${smartData.smartctl_error_code} occurred.`; } const _result: SmartErrorResult = { error: smartData.error, @@ -152,13 +143,13 @@ smartmontools is required to successfully retrieve data.`, ngOnInit() { this.smartDataColumns = [ - { prop: 'id', name: this.i18n('ID') }, - { prop: 'name', name: this.i18n('Name') }, - { prop: 'raw.value', name: this.i18n('Raw') }, - { prop: 'thresh', name: this.i18n('Threshold') }, - { prop: 'value', name: this.i18n('Value') }, - { prop: 'when_failed', name: this.i18n('When Failed') }, - { prop: 'worst', name: this.i18n('Worst') } + { prop: 'id', name: $localize`ID` }, + { prop: 'name', name: $localize`Name` }, + { prop: 'raw.value', name: $localize`Raw` }, + { prop: 'thresh', name: $localize`Threshold` }, + { prop: 'value', name: $localize`Value` }, + { prop: 'when_failed', name: $localize`When Failed` }, + { prop: 'worst', name: $localize`Worst` } ]; } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/login-password-form/login-password-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/login-password-form/login-password-form.component.spec.ts index eae34d33f9d..36bef19ef88 100755 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/login-password-form/login-password-form.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/login-password-form/login-password-form.component.spec.ts @@ -6,7 +6,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { ToastrModule } from 'ngx-toastr'; -import { configureTestBed, FormHelper, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed, FormHelper } from '../../../../testing/unit-test-helper'; import { AuthService } from '../../../shared/api/auth.service'; import { ComponentsModule } from '../../../shared/components/components.module'; import { CdFormGroup } from '../../../shared/forms/cd-form-group'; @@ -33,8 +33,7 @@ describe('LoginPasswordFormComponent', () => { ToastrModule.forRoot(), SharedModule ], - declarations: [LoginPasswordFormComponent], - providers: i18nProviders + declarations: [LoginPasswordFormComponent] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/login-password-form/login-password-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/login-password-form/login-password-form.component.ts index e952faf38d8..18c2c02a49d 100755 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/login-password-form/login-password-form.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/login-password-form/login-password-form.component.ts @@ -1,8 +1,6 @@ import { Component } from '@angular/core'; import { Router } from '@angular/router'; -import { I18n } from '@ngx-translate/i18n-polyfill'; - import { AuthService } from '../../../shared/api/auth.service'; import { UserService } from '../../../shared/api/user.service'; import { ActionLabelsI18n } from '../../../shared/constants/app.constants'; @@ -19,7 +17,6 @@ import { UserPasswordFormComponent } from '../user-password-form/user-password-f }) export class LoginPasswordFormComponent extends UserPasswordFormComponent { constructor( - public i18n: I18n, public actionLabels: ActionLabelsI18n, public notificationService: NotificationService, public userService: UserService, @@ -30,7 +27,6 @@ export class LoginPasswordFormComponent extends UserPasswordFormComponent { public authService: AuthService ) { super( - i18n, actionLabels, notificationService, userService, diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-details/role-details.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-details/role-details.component.spec.ts index 7d1fe5b80bb..1f918bb06fb 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-details/role-details.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-details/role-details.component.spec.ts @@ -4,7 +4,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { SharedModule } from '../../../shared/shared.module'; import { RoleDetailsComponent } from './role-details.component'; @@ -14,8 +14,7 @@ describe('RoleDetailsComponent', () => { configureTestBed({ imports: [SharedModule, RouterTestingModule, HttpClientTestingModule, NgbNavModule], - declarations: [RoleDetailsComponent], - providers: i18nProviders + declarations: [RoleDetailsComponent] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-details/role-details.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-details/role-details.component.ts index 6ee91494104..8470836fbcd 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-details/role-details.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-details/role-details.component.ts @@ -1,6 +1,5 @@ import { Component, Input, OnChanges, OnInit } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { CellTemplate } from '../../../shared/enum/cell-template.enum'; @@ -21,39 +20,37 @@ export class RoleDetailsComponent implements OnChanges, OnInit { columns: CdTableColumn[]; scopes_permissions: Array = []; - constructor(private i18n: I18n) {} - ngOnInit() { this.columns = [ { prop: 'scope', - name: this.i18n('Scope'), + name: $localize`Scope`, flexGrow: 2 }, { prop: 'read', - name: this.i18n('Read'), + name: $localize`Read`, flexGrow: 1, cellClass: 'text-center', cellTransformation: CellTemplate.checkIcon }, { prop: 'create', - name: this.i18n('Create'), + name: $localize`Create`, flexGrow: 1, cellClass: 'text-center', cellTransformation: CellTemplate.checkIcon }, { prop: 'update', - name: this.i18n('Update'), + name: $localize`Update`, flexGrow: 1, cellClass: 'text-center', cellTransformation: CellTemplate.checkIcon }, { prop: 'delete', - name: this.i18n('Delete'), + name: $localize`Delete`, flexGrow: 1, cellClass: 'text-center', cellTransformation: CellTemplate.checkIcon diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-form/role-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-form/role-form.component.spec.ts index 54786e73761..cd2109c0293 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-form/role-form.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-form/role-form.component.spec.ts @@ -8,7 +8,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { ToastrModule } from 'ngx-toastr'; import { of } from 'rxjs'; -import { configureTestBed, FormHelper, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed, FormHelper } from '../../../../testing/unit-test-helper'; import { RoleService } from '../../../shared/api/role.service'; import { ScopeService } from '../../../shared/api/scope.service'; import { LoadingPanelComponent } from '../../../shared/components/loading-panel/loading-panel.component'; @@ -41,8 +41,7 @@ describe('RoleFormComponent', () => { ToastrModule.forRoot(), SharedModule ], - declarations: [RoleFormComponent, FakeComponent], - providers: i18nProviders + declarations: [RoleFormComponent, FakeComponent] }, [LoadingPanelComponent] ); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-form/role-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-form/role-form.component.ts index e042a4f2f26..08d8f463b02 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-form/role-form.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-form/role-form.component.ts @@ -2,7 +2,6 @@ import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core'; import { FormControl, Validators } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { forkJoin as observableForkJoin } from 'rxjs'; @@ -50,11 +49,10 @@ export class RoleFormComponent extends CdForm implements OnInit { private roleService: RoleService, private scopeService: ScopeService, private notificationService: NotificationService, - private i18n: I18n, public actionLabels: ActionLabelsI18n ) { super(); - this.resource = this.i18n('role'); + this.resource = $localize`role`; this.createForm(); this.listenToChanges(); } @@ -74,14 +72,14 @@ export class RoleFormComponent extends CdForm implements OnInit { this.columns = [ { prop: 'scope', - name: this.i18n('All'), + name: $localize`All`, flexGrow: 2, cellTemplate: this.cellScopeCheckboxTpl, headerTemplate: this.headerPermissionCheckboxTpl }, { prop: 'read', - name: this.i18n('Read'), + name: $localize`Read`, flexGrow: 1, cellClass: 'text-center', cellTemplate: this.cellPermissionCheckboxTpl, @@ -89,7 +87,7 @@ export class RoleFormComponent extends CdForm implements OnInit { }, { prop: 'create', - name: this.i18n('Create'), + name: $localize`Create`, flexGrow: 1, cellClass: 'text-center', cellTemplate: this.cellPermissionCheckboxTpl, @@ -97,7 +95,7 @@ export class RoleFormComponent extends CdForm implements OnInit { }, { prop: 'update', - name: this.i18n('Update'), + name: $localize`Update`, flexGrow: 1, cellClass: 'text-center', cellTemplate: this.cellPermissionCheckboxTpl, @@ -105,7 +103,7 @@ export class RoleFormComponent extends CdForm implements OnInit { }, { prop: 'delete', - name: this.i18n('Delete'), + name: $localize`Delete`, flexGrow: 1, cellClass: 'text-center', cellTemplate: this.cellPermissionCheckboxTpl, @@ -281,7 +279,7 @@ export class RoleFormComponent extends CdForm implements OnInit { () => { this.notificationService.show( NotificationType.success, - this.i18n(`Created role '{{role_name}}'`, { role_name: roleFormModel.name }) + $localize`Created role '${roleFormModel.name}'` ); this.router.navigate(['/user-management/roles']); }, @@ -297,7 +295,7 @@ export class RoleFormComponent extends CdForm implements OnInit { () => { this.notificationService.show( NotificationType.success, - this.i18n(`Updated role '{{role_name}}'`, { role_name: roleFormModel.name }) + $localize`Updated role '${roleFormModel.name}'` ); this.router.navigate(['/user-management/roles']); }, diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-list/role-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-list/role-list.component.spec.ts index dc3c71c38ed..bc6d1fdfc3c 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-list/role-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-list/role-list.component.spec.ts @@ -6,11 +6,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap'; import { ToastrModule } from 'ngx-toastr'; -import { - configureTestBed, - i18nProviders, - PermissionHelper -} from '../../../../testing/unit-test-helper'; +import { configureTestBed, PermissionHelper } from '../../../../testing/unit-test-helper'; import { TableActionsComponent } from '../../../shared/datatable/table-actions/table-actions.component'; import { SharedModule } from '../../../shared/shared.module'; import { RoleDetailsComponent } from '../role-details/role-details.component'; @@ -30,8 +26,7 @@ describe('RoleListComponent', () => { NgbNavModule, RouterTestingModule, HttpClientTestingModule - ], - providers: i18nProviders + ] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-list/role-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-list/role-list.component.ts index f1cd8753868..ecf254051fa 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-list/role-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-list/role-list.component.ts @@ -1,7 +1,6 @@ import { Component, OnInit } from '@angular/core'; import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import { forkJoin } from 'rxjs'; import { RoleService } from '../../../shared/api/role.service'; @@ -48,7 +47,6 @@ export class RoleListComponent extends ListWithDetails implements OnInit { private authStorageService: AuthStorageService, private modalService: ModalService, private notificationService: NotificationService, - private i18n: I18n, private urlBuilder: URLBuilderService, public actionLabels: ActionLabelsI18n ) { @@ -88,18 +86,18 @@ export class RoleListComponent extends ListWithDetails implements OnInit { ngOnInit() { this.columns = [ { - name: this.i18n('Name'), + name: $localize`Name`, prop: 'name', flexGrow: 3 }, { - name: this.i18n('Description'), + name: $localize`Description`, prop: 'description', flexGrow: 5, pipe: this.emptyPipe }, { - name: this.i18n('System Role'), + name: $localize`System Role`, prop: 'system', cellClass: 'text-center', flexGrow: 1, @@ -126,10 +124,7 @@ export class RoleListComponent extends ListWithDetails implements OnInit { () => { this.getRoles(); this.modalRef.close(); - this.notificationService.show( - NotificationType.success, - this.i18n(`Deleted role '{{role_name}}'`, { role_name: role }) - ); + this.notificationService.show(NotificationType.success, $localize`Deleted role '${role}'`); }, () => { this.modalRef.componentInstance.stopLoadingSpinner(); @@ -154,21 +149,18 @@ export class RoleListComponent extends ListWithDetails implements OnInit { type: 'text', name: 'newName', value: `${name}_clone`, - label: this.i18n('New name'), + label: $localize`New name`, required: true } ], - titleText: this.i18n('Clone Role'), - submitButtonText: this.i18n('Clone Role'), + titleText: $localize`Clone Role`, + submitButtonText: $localize`Clone Role`, onSubmit: (values: object) => { this.roleService.clone(name, values['newName']).subscribe(() => { this.getRoles(); this.notificationService.show( NotificationType.success, - this.i18n(`Cloned role '{{dst_name}}' from '{{src_name}}'`, { - src_name: name, - dst_name: values['newName'] - }) + $localize`Cloned role '${values['newName']}' from '${name}'` ); }); } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-form/user-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-form/user-form.component.spec.ts index 9eb6bde2aec..fb16065527c 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-form/user-form.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-form/user-form.component.spec.ts @@ -9,7 +9,7 @@ import { NgbPopoverModule } from '@ng-bootstrap/ng-bootstrap'; import { ToastrModule } from 'ngx-toastr'; import { of } from 'rxjs'; -import { configureTestBed, FormHelper, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed, FormHelper } from '../../../../testing/unit-test-helper'; import { RoleService } from '../../../shared/api/role.service'; import { SettingsService } from '../../../shared/api/settings.service'; import { UserService } from '../../../shared/api/user.service'; @@ -55,8 +55,7 @@ describe('UserFormComponent', () => { SharedModule, NgbPopoverModule ], - declarations: [UserFormComponent, FakeComponent], - providers: i18nProviders + declarations: [UserFormComponent, FakeComponent] }, [LoadingPanelComponent] ); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-form/user-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-form/user-form.component.ts index 6568f474229..c3e1b227779 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-form/user-form.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-form/user-form.component.ts @@ -3,7 +3,6 @@ import { Validators } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import * as moment from 'moment'; import { forkJoin as observableForkJoin } from 'rxjs'; @@ -47,7 +46,7 @@ export class UserFormComponent extends CdForm implements OnInit { userFormMode = UserFormMode; mode: UserFormMode; allRoles: Array; - messages = new SelectMessages({ empty: this.i18n('There are no roles.') }, this.i18n); + messages = new SelectMessages({ empty: $localize`There are no roles.` }); action: string; resource: string; passwordPolicyHelpText = ''; @@ -66,16 +65,15 @@ export class UserFormComponent extends CdForm implements OnInit { private roleService: RoleService, private userService: UserService, private notificationService: NotificationService, - private i18n: I18n, public actionLabels: ActionLabelsI18n, private passwordPolicyService: PasswordPolicyService, private formBuilder: CdFormBuilder, private settingsService: SettingsService ) { super(); - this.resource = this.i18n('user'); + this.resource = $localize`user`; this.createForm(); - this.messages = new SelectMessages({ empty: this.i18n('There are no roles.') }, this.i18n); + this.messages = new SelectMessages({ empty: $localize`There are no roles.` }); } createForm() { @@ -210,7 +208,7 @@ export class UserFormComponent extends CdForm implements OnInit { () => { this.notificationService.show( NotificationType.success, - this.i18n(`Created user '{{username}}'`, { username: userFormModel.username }) + $localize`Created user '${userFormModel.username}'` ); this.router.navigate(['/user-management/users']); }, @@ -223,8 +221,8 @@ export class UserFormComponent extends CdForm implements OnInit { editAction() { if (this.isUserRemovingNeededRolePermissions()) { const initialState = { - titleText: this.i18n('Update user'), - buttonText: this.i18n('Continue'), + titleText: $localize`Update user`, + buttonText: $localize`Continue`, bodyTpl: this.removeSelfUserReadUpdatePermissionTpl, onSubmit: () => { this.modalRef.close(); @@ -279,13 +277,13 @@ export class UserFormComponent extends CdForm implements OnInit { this.authService.logout(() => { this.notificationService.show( NotificationType.info, - this.i18n('You were automatically logged out because your roles have been changed.') + $localize`You were automatically logged out because your roles have been changed.` ); }); } else { this.notificationService.show( NotificationType.success, - this.i18n(`Updated user '{{username}}'`, { username: userFormModel.username }) + $localize`Updated user '${userFormModel.username}'` ); this.router.navigate(['/user-management/users']); } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-list/user-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-list/user-list.component.spec.ts index f5ead615831..7cc70765a15 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-list/user-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-list/user-list.component.spec.ts @@ -6,11 +6,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap'; import { ToastrModule } from 'ngx-toastr'; -import { - configureTestBed, - i18nProviders, - PermissionHelper -} from '../../../../testing/unit-test-helper'; +import { configureTestBed, PermissionHelper } from '../../../../testing/unit-test-helper'; import { TableActionsComponent } from '../../../shared/datatable/table-actions/table-actions.component'; import { SharedModule } from '../../../shared/shared.module'; import { UserTabsComponent } from '../user-tabs/user-tabs.component'; @@ -29,8 +25,7 @@ describe('UserListComponent', () => { RouterTestingModule, HttpClientTestingModule ], - declarations: [UserListComponent, UserTabsComponent], - providers: i18nProviders + declarations: [UserListComponent, UserTabsComponent] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-list/user-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-list/user-list.component.ts index cadc8c929ed..c9b21f267a4 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-list/user-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-list/user-list.component.ts @@ -1,7 +1,6 @@ import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core'; import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import { UserService } from '../../../shared/api/user.service'; import { CriticalConfirmationModalComponent } from '../../../shared/components/critical-confirmation-modal/critical-confirmation-modal.component'; @@ -46,7 +45,6 @@ export class UserListComponent implements OnInit { private modalService: ModalService, private notificationService: NotificationService, private authStorageService: AuthStorageService, - private i18n: I18n, private urlBuilder: URLBuilderService, private cdDatePipe: CdDatePipe, public actionLabels: ActionLabelsI18n @@ -77,36 +75,36 @@ export class UserListComponent implements OnInit { ngOnInit() { this.columns = [ { - name: this.i18n('Username'), + name: $localize`Username`, prop: 'username', flexGrow: 1 }, { - name: this.i18n('Name'), + name: $localize`Name`, prop: 'name', flexGrow: 1, pipe: this.emptyPipe }, { - name: this.i18n('Email'), + name: $localize`Email`, prop: 'email', flexGrow: 1, pipe: this.emptyPipe }, { - name: this.i18n('Roles'), + name: $localize`Roles`, prop: 'roles', flexGrow: 1, cellTemplate: this.userRolesTpl }, { - name: this.i18n('Enabled'), + name: $localize`Enabled`, prop: 'enabled', flexGrow: 1, cellTransformation: CellTemplate.checkIcon }, { - name: this.i18n('Password expiration date'), + name: $localize`Password expiration date`, prop: 'pwdExpirationDate', flexGrow: 1, pipe: this.cdDatePipe @@ -136,7 +134,7 @@ export class UserListComponent implements OnInit { this.modalRef.close(); this.notificationService.show( NotificationType.success, - this.i18n(`Deleted user '{{username}}'`, { username: username }) + $localize`Deleted user '${username}'` ); }, () => { @@ -151,8 +149,8 @@ export class UserListComponent implements OnInit { if (sessionUsername === username) { this.notificationService.show( NotificationType.error, - this.i18n(`Failed to delete user '{{username}}'`, { username: username }), - this.i18n(`You are currently logged in as '{{username}}'.`, { username: username }) + $localize`Failed to delete user '${username}'`, + $localize`You are currently logged in as '${username}'.` ); return; } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-password-form/user-password-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-password-form/user-password-form.component.spec.ts index faaa3057c92..7adaebaba3b 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-password-form/user-password-form.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-password-form/user-password-form.component.spec.ts @@ -6,7 +6,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { ToastrModule } from 'ngx-toastr'; -import { configureTestBed, FormHelper, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed, FormHelper } from '../../../../testing/unit-test-helper'; import { ComponentsModule } from '../../../shared/components/components.module'; import { CdFormGroup } from '../../../shared/forms/cd-form-group'; import { AuthStorageService } from '../../../shared/services/auth-storage.service'; @@ -31,8 +31,7 @@ describe('UserPasswordFormComponent', () => { ToastrModule.forRoot(), SharedModule ], - declarations: [UserPasswordFormComponent], - providers: i18nProviders + declarations: [UserPasswordFormComponent] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-password-form/user-password-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-password-form/user-password-form.component.ts index cf08a134fb3..e7ef06c15a5 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-password-form/user-password-form.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-password-form/user-password-form.component.ts @@ -2,7 +2,6 @@ import { Component } from '@angular/core'; import { Validators } from '@angular/forms'; import { Router } from '@angular/router'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { UserService } from '../../../shared/api/user.service'; @@ -31,7 +30,6 @@ export class UserPasswordFormComponent { icons = Icons; constructor( - public i18n: I18n, public actionLabels: ActionLabelsI18n, public notificationService: NotificationService, public userService: UserService, @@ -41,7 +39,7 @@ export class UserPasswordFormComponent { public passwordPolicyService: PasswordPolicyService ) { this.action = this.actionLabels.CHANGE; - this.resource = this.i18n('password'); + this.resource = $localize`password`; this.createForm(); } @@ -115,7 +113,7 @@ export class UserPasswordFormComponent { * Override this in derived classes to change the behaviour. */ onPasswordChange() { - this.notificationService.show(NotificationType.success, this.i18n('Updated user password"')); + this.notificationService.show(NotificationType.success, $localize`Updated user password"`); this.router.navigate(['/login']); } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/layouts/workbench-layout/workbench-layout.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/layouts/workbench-layout/workbench-layout.component.spec.ts index 3d1d440824f..587925bf46b 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/layouts/workbench-layout/workbench-layout.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/layouts/workbench-layout/workbench-layout.component.spec.ts @@ -5,7 +5,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { ToastrModule } from 'ngx-toastr'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { RbdService } from '../../../shared/api/rbd.service'; import { PipesModule } from '../../../shared/pipes/pipes.module'; import { AuthStorageService } from '../../../shared/services/auth-storage.service'; @@ -19,7 +19,7 @@ describe('WorkbenchLayoutComponent', () => { imports: [RouterTestingModule, ToastrModule.forRoot(), PipesModule, HttpClientTestingModule], declarations: [WorkbenchLayoutComponent], schemas: [NO_ERRORS_SCHEMA], - providers: [AuthStorageService, i18nProviders, RbdService] + providers: [AuthStorageService, RbdService] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/notifications/notifications.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/notifications/notifications.component.spec.ts index 3111d482b02..e7c2d97f35a 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/notifications/notifications.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/notifications/notifications.component.spec.ts @@ -4,7 +4,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { ToastrModule } from 'ngx-toastr'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { ExecutingTask } from '../../../shared/models/executing-task'; import { SummaryService } from '../../../shared/services/summary.service'; import { SharedModule } from '../../../shared/shared.module'; @@ -17,8 +17,7 @@ describe('NotificationsComponent', () => { configureTestBed({ imports: [HttpClientTestingModule, SharedModule, ToastrModule.forRoot(), RouterTestingModule], - declarations: [NotificationsComponent], - providers: i18nProviders + declarations: [NotificationsComponent] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/crush-rule.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/crush-rule.service.spec.ts index 493fc920238..39bdf0c8183 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/crush-rule.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/crush-rule.service.spec.ts @@ -1,7 +1,7 @@ import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; import { TestBed } from '@angular/core/testing'; -import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../testing/unit-test-helper'; import { CrushRuleService } from './crush-rule.service'; describe('CrushRuleService', () => { @@ -11,7 +11,7 @@ describe('CrushRuleService', () => { configureTestBed({ imports: [HttpClientTestingModule], - providers: [CrushRuleService, i18nProviders] + providers: [CrushRuleService] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/crush-rule.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/crush-rule.service.ts index 74d061a0205..e4e7bb60540 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/crush-rule.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/crush-rule.service.ts @@ -1,8 +1,6 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; - import { CrushRuleConfig } from '../models/crush-rule'; @Injectable({ @@ -13,12 +11,12 @@ export class CrushRuleService { formTooltips = { // Copied from /doc/rados/operations/crush-map.rst - root: this.i18n(`The name of the node under which data should be placed.`), - failure_domain: this.i18n(`The type of CRUSH nodes across which we should separate replicas.`), - device_class: this.i18n(`The device class data should be placed on.`) + root: $localize`The name of the node under which data should be placed.`, + failure_domain: $localize`The type of CRUSH nodes across which we should separate replicas.`, + device_class: $localize`The device class data should be placed on.` }; - constructor(private http: HttpClient, private i18n: I18n) {} + constructor(private http: HttpClient) {} create(rule: CrushRuleConfig) { return this.http.post(this.apiPath, rule, { observe: 'response' }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/erasure-code-profile.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/erasure-code-profile.service.spec.ts index 591ca879b6d..88888b5222e 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/erasure-code-profile.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/erasure-code-profile.service.spec.ts @@ -1,7 +1,7 @@ import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; import { TestBed } from '@angular/core/testing'; -import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../testing/unit-test-helper'; import { ErasureCodeProfile } from '../models/erasure-code-profile'; import { ErasureCodeProfileService } from './erasure-code-profile.service'; @@ -13,7 +13,7 @@ describe('ErasureCodeProfileService', () => { configureTestBed({ imports: [HttpClientTestingModule], - providers: [ErasureCodeProfileService, i18nProviders] + providers: [ErasureCodeProfileService] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/erasure-code-profile.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/erasure-code-profile.service.ts index f99841250f5..47817367e72 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/erasure-code-profile.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/erasure-code-profile.service.ts @@ -1,7 +1,6 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import { Observable } from 'rxjs'; import { ErasureCodeProfile } from '../models/erasure-code-profile'; @@ -14,25 +13,25 @@ export class ErasureCodeProfileService { formTooltips = { // Copied from /doc/rados/operations/erasure-code.*.rst - k: this.i18n(`Each object is split in data-chunks parts, each stored on a different OSD.`), + k: $localize`Each object is split in data-chunks parts, each stored on a different OSD.`, - m: this.i18n(`Compute coding chunks for each object and store them on different OSDs. - The number of coding chunks is also the number of OSDs that can be down without losing data.`), + m: $localize`Compute coding chunks for each object and store them on different OSDs. + The number of coding chunks is also the number of OSDs that can be down without losing data.`, plugins: { jerasure: { - description: this.i18n(`The jerasure plugin is the most generic and flexible plugin, - it is also the default for Ceph erasure coded pools.`), - technique: this.i18n(`The more flexible technique is reed_sol_van : it is enough to set k + description: $localize`The jerasure plugin is the most generic and flexible plugin, + it is also the default for Ceph erasure coded pools.`, + technique: $localize`The more flexible technique is reed_sol_van : it is enough to set k and m. The cauchy_good technique can be faster but you need to chose the packetsize carefully. All of reed_sol_r6_op, liberation, blaum_roth, liber8tion are RAID6 equivalents - in the sense that they can only be configured with m=2.`), - packetSize: this.i18n(`The encoding will be done on packets of bytes size at a time. + in the sense that they can only be configured with m=2.`, + packetSize: $localize`The encoding will be done on packets of bytes size at a time. Chosing the right packet size is difficult. - The jerasure documentation contains extensive information on this topic.`) + The jerasure documentation contains extensive information on this topic.` }, lrc: { - description: this.i18n(`With the jerasure plugin, when an erasure coded object is stored on + description: $localize`With the jerasure plugin, when an erasure coded object is stored on multiple OSDs, recovering from the loss of one OSD requires reading from all the others. For instance if jerasure is configured with k=8 and m=4, losing one OSD requires reading from the eleven others to repair. @@ -40,45 +39,43 @@ export class ErasureCodeProfileService { The lrc erasure code plugin creates local parity chunks to be able to recover using less OSDs. For instance if lrc is configured with k=8, m=4 and l=4, it will create an additional parity chunk for every four OSDs. When a single OSD is lost, it can be - recovered with only four OSDs instead of eleven.`), - l: this.i18n(`Group the coding and data chunks into sets of size locality. For instance, + recovered with only four OSDs instead of eleven.`, + l: $localize`Group the coding and data chunks into sets of size locality. For instance, for k=4 and m=2, when locality=3 two groups of three are created. Each set can - be recovered without reading chunks from another set.`), - crushLocality: this.i18n(`The type of the crush bucket in which each set of chunks defined + be recovered without reading chunks from another set.`, + crushLocality: $localize`The type of the crush bucket in which each set of chunks defined by l will be stored. For instance, if it is set to rack, each group of l chunks will be placed in a different rack. It is used to create a CRUSH rule step such as step choose - rack. If it is not set, no such grouping is done.`) + rack. If it is not set, no such grouping is done.` }, isa: { - description: this.i18n( - `The isa plugin encapsulates the ISA library. It only runs on Intel processors.` - ), - technique: this.i18n(`The ISA plugin comes in two Reed Solomon forms. - If reed_sol_van is set, it is Vandermonde, if cauchy is set, it is Cauchy.`) + description: $localize`The isa plugin encapsulates the ISA library. It only runs on Intel processors.`, + technique: $localize`The ISA plugin comes in two Reed Solomon forms. + If reed_sol_van is set, it is Vandermonde, if cauchy is set, it is Cauchy.` }, shec: { - description: this.i18n(`The shec plugin encapsulates the multiple SHEC library. - It allows ceph to recover data more efficiently than Reed Solomon codes.`), - c: this.i18n(`The number of parity chunks each of which includes each data chunk in its + description: $localize`The shec plugin encapsulates the multiple SHEC library. + It allows ceph to recover data more efficiently than Reed Solomon codes.`, + c: $localize`The number of parity chunks each of which includes each data chunk in its calculation range. The number is used as a durability estimator. For instance, if c=2, - 2 OSDs can be down without losing data.`) + 2 OSDs can be down without losing data.` } }, - crushRoot: this.i18n(`The name of the crush bucket used for the first step of the CRUSH rule. - For instance step take default.`), + crushRoot: $localize`The name of the crush bucket used for the first step of the CRUSH rule. + For instance step take default.`, - crushFailureDomain: this.i18n(`Ensure that no two chunks are in a bucket with the same failure + crushFailureDomain: $localize`Ensure that no two chunks are in a bucket with the same failure domain. For instance, if the failure domain is host no two chunks will be stored on the same - host. It is used to create a CRUSH rule step such as step chooseleaf host.`), + host. It is used to create a CRUSH rule step such as step chooseleaf host.`, - crushDeviceClass: this.i18n(`Restrict placement to devices of a specific class - (e.g., ssd or hdd), using the crush device class names in the CRUSH map.`), + crushDeviceClass: $localize`Restrict placement to devices of a specific class + (e.g., ssd or hdd), using the crush device class names in the CRUSH map.`, - directory: this.i18n(`Set the directory name from which the erasure code plugin is loaded.`) + directory: $localize`Set the directory name from which the erasure code plugin is loaded.` }; - constructor(private http: HttpClient, private i18n: I18n) {} + constructor(private http: HttpClient) {} list(): Observable { return this.http.get(this.apiPath); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/nfs.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/nfs.service.spec.ts index a960500705a..b90e816d979 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/nfs.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/nfs.service.spec.ts @@ -1,7 +1,7 @@ import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; import { TestBed } from '@angular/core/testing'; -import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../testing/unit-test-helper'; import { NfsService } from './nfs.service'; describe('NfsService', () => { @@ -9,7 +9,7 @@ describe('NfsService', () => { let httpTesting: HttpTestingController; configureTestBed({ - providers: [NfsService, i18nProviders], + providers: [NfsService], imports: [HttpClientTestingModule] }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/nfs.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/nfs.service.ts index f5de5bd412b..e9858416919 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/nfs.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/nfs.service.ts @@ -1,8 +1,6 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; - @Injectable({ providedIn: 'root' }) @@ -13,43 +11,40 @@ export class NfsService { nfsAccessType = [ { value: 'RW', - help: this.i18n('Allows all operations') + help: $localize`Allows all operations` }, { value: 'RO', - help: this.i18n('Allows only operations that do not modify the server') + help: $localize`Allows only operations that do not modify the server` }, { value: 'MDONLY', - help: this.i18n('Does not allow read or write operations, but allows any other operation') + help: $localize`Does not allow read or write operations, but allows any other operation` }, { value: 'MDONLY_RO', - help: this.i18n( - 'Does not allow read, write, or any operation that modifies file \ - attributes or directory content' - ) + help: $localize`Does not allow read, write, or any operation that modifies file attributes or directory content` }, { value: 'NONE', - help: this.i18n('Allows no access at all') + help: $localize`Allows no access at all` } ]; nfsFsal = [ { value: 'CEPH', - descr: this.i18n('CephFS') + descr: $localize`CephFS` }, { value: 'RGW', - descr: this.i18n('Object Gateway') + descr: $localize`Object Gateway` } ]; nfsSquash = ['no_root_squash', 'root_id_squash', 'root_squash', 'all_squash']; - constructor(private http: HttpClient, private i18n: I18n) {} + constructor(private http: HttpClient) {} list() { return this.http.get(`${this.apiPath}/export`); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/orchestrator.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/orchestrator.service.spec.ts index 41527a428ea..94c957e49c6 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/orchestrator.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/orchestrator.service.spec.ts @@ -1,7 +1,7 @@ import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; import { TestBed } from '@angular/core/testing'; -import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../testing/unit-test-helper'; import { OrchestratorService } from './orchestrator.service'; describe('OrchestratorService', () => { @@ -10,7 +10,7 @@ describe('OrchestratorService', () => { const apiPath = 'api/orchestrator'; configureTestBed({ - providers: [OrchestratorService, i18nProviders], + providers: [OrchestratorService], imports: [HttpClientTestingModule] }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.spec.ts index 4c8e7eeedeb..e96a13ae306 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.spec.ts @@ -1,7 +1,7 @@ import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; import { TestBed } from '@angular/core/testing'; -import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../testing/unit-test-helper'; import { OsdService } from './osd.service'; describe('OsdService', () => { @@ -9,7 +9,7 @@ describe('OsdService', () => { let httpTesting: HttpTestingController; configureTestBed({ - providers: [OsdService, i18nProviders], + providers: [OsdService], imports: [HttpClientTestingModule] }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.ts index ea407605da6..cc088d0e95f 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.ts @@ -1,7 +1,6 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { map } from 'rxjs/operators'; @@ -19,7 +18,7 @@ export class OsdService { KNOWN_PRIORITIES: [ { name: null, - text: this.i18n('-- Select the priority --'), + text: $localize`-- Select the priority --`, values: { osd_max_backfills: null, osd_recovery_max_active: null, @@ -29,7 +28,7 @@ export class OsdService { }, { name: 'low', - text: this.i18n('Low'), + text: $localize`Low`, values: { osd_max_backfills: 1, osd_recovery_max_active: 1, @@ -39,7 +38,7 @@ export class OsdService { }, { name: 'default', - text: this.i18n('Default'), + text: $localize`Default`, values: { osd_max_backfills: 1, osd_recovery_max_active: 3, @@ -49,7 +48,7 @@ export class OsdService { }, { name: 'high', - text: this.i18n('High'), + text: $localize`High`, values: { osd_max_backfills: 4, osd_recovery_max_active: 4, @@ -60,7 +59,7 @@ export class OsdService { ] }; - constructor(private http: HttpClient, private i18n: I18n, private deviceService: DeviceService) {} + constructor(private http: HttpClient, private deviceService: DeviceService) {} create(driveGroups: Object[]) { const request = { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/pool.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/pool.service.spec.ts index 197864d22a7..c0e7cb0eabb 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/pool.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/pool.service.spec.ts @@ -1,7 +1,7 @@ import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; import { fakeAsync, TestBed, tick } from '@angular/core/testing'; -import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../testing/unit-test-helper'; import { RbdConfigurationSourceField } from '../models/configuration'; import { RbdConfigurationService } from '../services/rbd-configuration.service'; import { PoolService } from './pool.service'; @@ -12,7 +12,7 @@ describe('PoolService', () => { const apiPath = 'api/pool'; configureTestBed({ - providers: [PoolService, RbdConfigurationService, i18nProviders], + providers: [PoolService, RbdConfigurationService], imports: [HttpClientTestingModule] }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rbd.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rbd.service.spec.ts index a9f3a36a437..72af80b977d 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rbd.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rbd.service.spec.ts @@ -1,7 +1,7 @@ import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; import { TestBed } from '@angular/core/testing'; -import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../testing/unit-test-helper'; import { ImageSpec } from '../models/image-spec'; import { RbdConfigurationService } from '../services/rbd-configuration.service'; import { RbdService } from './rbd.service'; @@ -11,7 +11,7 @@ describe('RbdService', () => { let httpTesting: HttpTestingController; configureTestBed({ - providers: [RbdService, RbdConfigurationService, i18nProviders], + providers: [RbdService, RbdConfigurationService], imports: [HttpClientTestingModule] }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/alert-panel/alert-panel.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/alert-panel/alert-panel.component.spec.ts index d1ed14d57a2..6b73b47c3b8 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/alert-panel/alert-panel.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/alert-panel/alert-panel.component.spec.ts @@ -2,7 +2,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { NgbAlertModule } from '@ng-bootstrap/ng-bootstrap'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { AlertPanelComponent } from './alert-panel.component'; describe('AlertPanelComponent', () => { @@ -11,8 +11,7 @@ describe('AlertPanelComponent', () => { configureTestBed({ declarations: [AlertPanelComponent], - imports: [NgbAlertModule], - providers: [i18nProviders] + imports: [NgbAlertModule] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/alert-panel/alert-panel.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/alert-panel/alert-panel.component.ts index d457a0ed7ef..f72aa73c112 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/alert-panel/alert-panel.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/alert-panel/alert-panel.component.ts @@ -1,7 +1,5 @@ import { Component, Input, OnInit } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; - import { Icons } from '../../enum/icons.enum'; @Component({ @@ -27,27 +25,25 @@ export class AlertPanelComponent implements OnInit { icons = Icons; - constructor(private i18n: I18n) {} - ngOnInit() { switch (this.type) { case 'warning': - this.title = this.title || this.i18n('Warning'); + this.title = this.title || $localize`Warning`; this.typeIcon = this.typeIcon || Icons.warning; this.bootstrapClass = this.bootstrapClass || 'warning'; break; case 'error': - this.title = this.title || this.i18n('Error'); + this.title = this.title || $localize`Error`; this.typeIcon = this.typeIcon || Icons.destroyCircle; this.bootstrapClass = this.bootstrapClass || 'danger'; break; case 'info': - this.title = this.title || this.i18n('Information'); + this.title = this.title || $localize`Information`; this.typeIcon = this.typeIcon || Icons.infoCircle; this.bootstrapClass = this.bootstrapClass || 'info'; break; case 'success': - this.title = this.title || this.i18n('Success'); + this.title = this.title || $localize`Success`; this.typeIcon = this.typeIcon || Icons.check; this.bootstrapClass = this.bootstrapClass || 'success'; break; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/back-button/back-button.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/back-button/back-button.component.spec.ts index 150e0567a16..7b62b625683 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/back-button/back-button.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/back-button/back-button.component.spec.ts @@ -1,7 +1,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { BackButtonComponent } from './back-button.component'; describe('BackButtonComponent', () => { @@ -10,8 +10,7 @@ describe('BackButtonComponent', () => { configureTestBed({ imports: [RouterTestingModule], - declarations: [BackButtonComponent], - providers: [i18nProviders] + declarations: [BackButtonComponent] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/confirmation-modal/confirmation-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/confirmation-modal/confirmation-modal.component.spec.ts index c66910a5ea2..dca77404a0d 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/confirmation-modal/confirmation-modal.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/confirmation-modal/confirmation-modal.component.spec.ts @@ -6,11 +6,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { NgbActiveModal, NgbModalModule, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; -import { - configureTestBed, - FixtureHelper, - i18nProviders -} from '../../../../testing/unit-test-helper'; +import { configureTestBed, FixtureHelper } from '../../../../testing/unit-test-helper'; import { ModalService } from '../../services/modal.service'; import { BackButtonComponent } from '../back-button/back-button.component'; import { ModalComponent } from '../modal/modal.component'; @@ -84,7 +80,7 @@ describe('ConfirmationModalComponent', () => { ], schemas: [NO_ERRORS_SCHEMA], imports: [ReactiveFormsModule, MockModule, RouterTestingModule, NgbModalModule], - providers: [NgbActiveModal, i18nProviders, SubmitButtonComponent] + providers: [NgbActiveModal, SubmitButtonComponent] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/form-modal/form-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/form-modal/form-modal.component.spec.ts index fbf10aa4594..653b00bc4aa 100755 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/form-modal/form-modal.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/form-modal/form-modal.component.spec.ts @@ -5,12 +5,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { NgBootstrapFormValidationModule } from 'ng-bootstrap-form-validation'; -import { - configureTestBed, - FixtureHelper, - FormHelper, - i18nProviders -} from '../../../../testing/unit-test-helper'; +import { configureTestBed, FixtureHelper, FormHelper } from '../../../../testing/unit-test-helper'; import { CdValidators } from '../../forms/cd-validators'; import { SharedModule } from '../../shared.module'; import { FormModalComponent } from './form-modal.component'; @@ -58,7 +53,7 @@ describe('InputModalComponent', () => { ReactiveFormsModule, SharedModule ], - providers: [i18nProviders, NgbActiveModal] + providers: [NgbActiveModal] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/form-modal/form-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/form-modal/form-modal.component.ts index a4017941229..b8dad67a46b 100755 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/form-modal/form-modal.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/form-modal/form-modal.component.ts @@ -2,7 +2,6 @@ import { Component, OnInit } from '@angular/core'; import { FormControl, ValidatorFn, Validators } from '@angular/forms'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { CdFormBuilder } from '../../forms/cd-form-builder'; @@ -31,8 +30,7 @@ export class FormModalComponent implements OnInit { public activeModal: NgbActiveModal, private formBuilder: CdFormBuilder, private formatter: FormatterService, - private dimlessBinaryPipe: DimlessBinaryPipe, - private i18n: I18n + private dimlessBinaryPipe: DimlessBinaryPipe ) {} ngOnInit() { @@ -86,12 +84,12 @@ export class FormModalComponent implements OnInit { if (['binaryMin', 'binaryMax'].includes(error)) { // binaryMin and binaryMax return a function that take I18n to // provide a translated error message. - return errorContext(this.i18n); + return errorContext(); } if (error === 'required') { - return this.i18n('This field is required.'); + return $localize`This field is required.`; } - return this.i18n('An error occurred.'); + return $localize`An error occurred.`; } onSubmitForm(values: any) { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/grafana/grafana.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/grafana/grafana.component.spec.ts index 0568fc5806a..fb7747cabf5 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/grafana/grafana.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/grafana/grafana.component.spec.ts @@ -6,7 +6,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { NgbAlertModule } from '@ng-bootstrap/ng-bootstrap'; import { of } from 'rxjs'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { SummaryService } from '../../../shared/services/summary.service'; import { SettingsService } from '../../api/settings.service'; import { CephReleaseNamePipe } from '../../pipes/ceph-release-name.pipe'; @@ -21,7 +21,7 @@ describe('GrafanaComponent', () => { configureTestBed({ declarations: [GrafanaComponent, AlertPanelComponent, LoadingPanelComponent], imports: [NgbAlertModule, HttpClientTestingModule, RouterTestingModule, FormsModule], - providers: [CephReleaseNamePipe, SettingsService, SummaryService, i18nProviders] + providers: [CephReleaseNamePipe, SettingsService, SummaryService] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/grafana/grafana.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/grafana/grafana.component.ts index afb41361890..827210ccb6b 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/grafana/grafana.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/grafana/grafana.component.ts @@ -1,8 +1,6 @@ import { Component, Input, OnChanges, OnInit } from '@angular/core'; import { DomSanitizer, SafeUrl } from '@angular/platform-browser'; -import { I18n } from '@ngx-translate/i18n-polyfill'; - import { Icons } from '../../../shared/enum/icons.enum'; import { CephReleaseNamePipe } from '../../../shared/pipes/ceph-release-name.pipe'; import { SummaryService } from '../../../shared/services/summary.service'; @@ -44,128 +42,127 @@ export class GrafanaComponent implements OnInit, OnChanges { private summaryService: SummaryService, private sanitizer: DomSanitizer, private settingsService: SettingsService, - private cephReleaseNamePipe: CephReleaseNamePipe, - private i18n: I18n + private cephReleaseNamePipe: CephReleaseNamePipe ) { this.grafanaTimes = [ { - name: this.i18n('Last 5 minutes'), + name: $localize`Last 5 minutes`, value: 'from=now-5m&to=now' }, { - name: this.i18n('Last 15 minutes'), + name: $localize`Last 15 minutes`, value: 'from=now-15m&to=now' }, { - name: this.i18n('Last 30 minutes'), + name: $localize`Last 30 minutes`, value: 'from=now-30m&to=now' }, { - name: this.i18n('Last 1 hour (Default)'), + name: $localize`Last 1 hour (Default)`, value: 'from=now-1h&to=now' }, { - name: this.i18n('Last 3 hours'), + name: $localize`Last 3 hours`, value: 'from=now-3h&to=now' }, { - name: this.i18n('Last 6 hours'), + name: $localize`Last 6 hours`, value: 'from=now-6h&to=now' }, { - name: this.i18n('Last 12 hours'), + name: $localize`Last 12 hours`, value: 'from=now-12h&to=now' }, { - name: this.i18n('Last 24 hours'), + name: $localize`Last 24 hours`, value: 'from=now-24h&to=now' }, { - name: this.i18n('Yesterday'), + name: $localize`Yesterday`, value: 'from=now-1d%2Fd&to=now-1d%2Fd' }, { - name: this.i18n('Today'), + name: $localize`Today`, value: 'from=now%2Fd&to=now%2Fd' }, { - name: this.i18n('Today so far'), + name: $localize`Today so far`, value: 'from=now%2Fd&to=now' }, { - name: this.i18n('Day before yesterday'), + name: $localize`Day before yesterday`, value: 'from=now-2d%2Fd&to=now-2d%2Fd' }, { - name: this.i18n('Last 2 days'), + name: $localize`Last 2 days`, value: 'from=now-2d&to=now' }, { - name: this.i18n('This day last week'), + name: $localize`This day last week`, value: 'from=now-7d%2Fd&to=now-7d%2Fd' }, { - name: this.i18n('Previous week'), + name: $localize`Previous week`, value: 'from=now-1w%2Fw&to=now-1w%2Fw' }, { - name: this.i18n('This week'), + name: $localize`This week`, value: 'from=now%2Fw&to=now%2Fw' }, { - name: this.i18n('This week so far'), + name: $localize`This week so far`, value: 'from=now%2Fw&to=now' }, { - name: this.i18n('Last 7 days'), + name: $localize`Last 7 days`, value: 'from=now-7d&to=now' }, { - name: this.i18n('Previous month'), + name: $localize`Previous month`, value: 'from=now-1M%2FM&to=now-1M%2FM' }, { - name: this.i18n('This month'), + name: $localize`This month`, value: 'from=now%2FM&to=now%2FM' }, { - name: this.i18n('This month so far'), + name: $localize`This month so far`, value: 'from=now%2FM&to=now' }, { - name: this.i18n('Last 30 days'), + name: $localize`Last 30 days`, value: 'from=now-30d&to=now' }, { - name: this.i18n('Last 90 days'), + name: $localize`Last 90 days`, value: 'from=now-90d&to=now' }, { - name: this.i18n('Last 6 months'), + name: $localize`Last 6 months`, value: 'from=now-6M&to=now' }, { - name: this.i18n('Last 1 year'), + name: $localize`Last 1 year`, value: 'from=now-1y&to=now' }, { - name: this.i18n('Previous year'), + name: $localize`Previous year`, value: 'from=now-1y%2Fy&to=now-1y%2Fy' }, { - name: this.i18n('This year'), + name: $localize`This year`, value: 'from=now%2Fy&to=now%2Fy' }, { - name: this.i18n('This year so far'), + name: $localize`This year so far`, value: 'from=now%2Fy&to=now' }, { - name: this.i18n('Last 2 years'), + name: $localize`Last 2 years`, value: 'from=now-2y&to=now' }, { - name: this.i18n('Last 5 years'), + name: $localize`Last 5 years`, value: 'from=now-5y&to=now' } ]; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/notifications-sidebar/notifications-sidebar.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/notifications-sidebar/notifications-sidebar.component.spec.ts index fa3790b18fb..857595f07d0 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/notifications-sidebar/notifications-sidebar.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/notifications-sidebar/notifications-sidebar.component.spec.ts @@ -8,7 +8,7 @@ import { ClickOutsideModule } from 'ng-click-outside'; import { ToastrModule } from 'ngx-toastr'; import { SimplebarAngularModule } from 'simplebar-angular'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { PrometheusService } from '../../api/prometheus.service'; import { RbdService } from '../../api/rbd.service'; import { SettingsService } from '../../api/settings.service'; @@ -39,14 +39,7 @@ describe('NotificationsSidebarComponent', () => { ClickOutsideModule ], declarations: [NotificationsSidebarComponent], - providers: [ - i18nProviders, - PrometheusService, - SettingsService, - SummaryService, - NotificationService, - RbdService - ] + providers: [PrometheusService, SettingsService, SummaryService, NotificationService, RbdService] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/orchestrator-doc-modal/orchestrator-doc-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/orchestrator-doc-modal/orchestrator-doc-modal.component.spec.ts index 2bcf2ae317f..ef4ed3eb12c 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/orchestrator-doc-modal/orchestrator-doc-modal.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/orchestrator-doc-modal/orchestrator-doc-modal.component.spec.ts @@ -4,7 +4,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { ComponentsModule } from '../components.module'; import { OrchestratorDocModalComponent } from './orchestrator-doc-modal.component'; @@ -14,7 +14,7 @@ describe('OrchestratorDocModalComponent', () => { configureTestBed({ imports: [ComponentsModule, HttpClientTestingModule, RouterTestingModule], - providers: [NgbActiveModal, i18nProviders] + providers: [NgbActiveModal] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/orchestrator-doc-panel/orchestrator-doc-panel.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/orchestrator-doc-panel/orchestrator-doc-panel.component.spec.ts index e2c7935127b..27b42fa707e 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/orchestrator-doc-panel/orchestrator-doc-panel.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/orchestrator-doc-panel/orchestrator-doc-panel.component.spec.ts @@ -2,7 +2,7 @@ import { HttpClientTestingModule } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { CephReleaseNamePipe } from '../../pipes/ceph-release-name.pipe'; import { SummaryService } from '../../services/summary.service'; import { ComponentsModule } from '../components.module'; @@ -14,7 +14,7 @@ describe('OrchestratorDocPanelComponent', () => { configureTestBed({ imports: [ComponentsModule, HttpClientTestingModule, RouterTestingModule], - providers: [CephReleaseNamePipe, SummaryService, i18nProviders] + providers: [CephReleaseNamePipe, SummaryService] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/select-badges/select-badges.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/select-badges/select-badges.component.spec.ts index 8986901b3b4..c71d058fb04 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/select-badges/select-badges.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/select-badges/select-badges.component.spec.ts @@ -2,9 +2,8 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ReactiveFormsModule, Validators } from '@angular/forms'; import { NgbPopoverModule, NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap'; -import { I18n } from '@ngx-translate/i18n-polyfill'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { SelectMessages } from '../select/select-messages.model'; import { SelectComponent } from '../select/select.component'; import { SelectBadgesComponent } from './select-badges.component'; @@ -15,8 +14,7 @@ describe('SelectBadgesComponent', () => { configureTestBed({ declarations: [SelectBadgesComponent, SelectComponent], - imports: [NgbPopoverModule, NgbTooltipModule, ReactiveFormsModule], - providers: i18nProviders + imports: [NgbPopoverModule, NgbTooltipModule, ReactiveFormsModule] }); beforeEach(() => { @@ -35,8 +33,7 @@ describe('SelectBadgesComponent', () => { { name: 'option1', description: '', selected: false, enabled: true }, { name: 'option2', description: '', selected: false, enabled: true } ]; - const i18n = TestBed.inject(I18n); - const messages = new SelectMessages({ empty: 'foo bar' }, i18n); + const messages = new SelectMessages({ empty: 'foo bar' }); const selectionLimit = 2; const customBadges = true; const customBadgeValidators = [Validators.required]; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/select-badges/select-badges.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/select-badges/select-badges.component.ts index 9c4e381aa9b..17d05ed4b48 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/select-badges/select-badges.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/select-badges/select-badges.component.ts @@ -1,8 +1,6 @@ import { Component, EventEmitter, Input, Output, ViewChild } from '@angular/core'; import { ValidatorFn } from '@angular/forms'; -import { I18n } from '@ngx-translate/i18n-polyfill'; - import { Icons } from '../../../shared/enum/icons.enum'; import { SelectMessages } from '../select/select-messages.model'; import { SelectOption } from '../select/select-option.model'; @@ -19,7 +17,7 @@ export class SelectBadgesComponent { @Input() options: Array = []; @Input() - messages = new SelectMessages({}, this.i18n); + messages = new SelectMessages({}); @Input() selectionLimit: number; @Input() @@ -34,6 +32,4 @@ export class SelectBadgesComponent { cdSelect: SelectComponent; icons = Icons; - - constructor(private i18n: I18n) {} } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/select/select-messages.model.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/select/select-messages.model.ts index 3f1f9fd264f..6362b4e26cb 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/select/select-messages.model.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/select/select-messages.model.ts @@ -1,9 +1,6 @@ -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; export class SelectMessages { - i18n: I18n; - empty: string; selectionLimit: any; customValidations = {}; @@ -11,17 +8,15 @@ export class SelectMessages { add: string; noOptions: string; - constructor(messages: {}, i18n: I18n) { - this.i18n = i18n; - - this.empty = this.i18n('No items selected.'); + constructor(messages: {}) { + this.empty = $localize`No items selected.`; this.selectionLimit = { - tooltip: this.i18n('Deselect item to select again'), - text: this.i18n('Selection limit reached') + tooltip: $localize`Deselect item to select again`, + text: $localize`Selection limit reached` }; - this.filter = this.i18n('Filter tags'); - this.add = this.i18n('Add badge'); // followed by " '{{filter.value}}'" - this.noOptions = this.i18n('There are no items available.'); + this.filter = $localize`Filter tags`; + this.add = $localize`Add badge`; // followed by " '{{filter.value}}'" + this.noOptions = $localize`There are no items available.`; _.merge(this, messages); } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/select/select.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/select/select.component.spec.ts index 45bb8d38ba7..4d1e78624e7 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/select/select.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/select/select.component.spec.ts @@ -3,7 +3,7 @@ import { ReactiveFormsModule, Validators } from '@angular/forms'; import { NgbPopoverModule, NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { SelectOption } from './select-option.model'; import { SelectComponent } from './select.component'; @@ -19,8 +19,7 @@ describe('SelectComponent', () => { configureTestBed({ declarations: [SelectComponent], - imports: [NgbPopoverModule, NgbTooltipModule, ReactiveFormsModule], - providers: i18nProviders + imports: [NgbPopoverModule, NgbTooltipModule, ReactiveFormsModule] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/select/select.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/select/select.component.ts index ad3a97c09a3..e4b780fcdf9 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/select/select.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/select/select.component.ts @@ -1,7 +1,6 @@ import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core'; import { FormControl, ValidatorFn } from '@angular/forms'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { Icons } from '../../../shared/enum/icons.enum'; @@ -22,7 +21,7 @@ export class SelectComponent implements OnInit, OnChanges { @Input() options: Array = []; @Input() - messages = new SelectMessages({}, this.i18n); + messages = new SelectMessages({}); @Input() selectionLimit: number; @Input() @@ -39,8 +38,6 @@ export class SelectComponent implements OnInit, OnChanges { filteredOptions: Array = []; icons = Icons; - constructor(private i18n: I18n) {} - ngOnInit() { this.initFilter(); if (this.data.length > 0) { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/sparkline/sparkline.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/sparkline/sparkline.component.spec.ts index 2aac8532111..484770b0905 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/sparkline/sparkline.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/sparkline/sparkline.component.spec.ts @@ -13,7 +13,6 @@ describe('SparklineComponent', () => { configureTestBed({ declarations: [SparklineComponent], schemas: [NO_ERRORS_SCHEMA], - imports: [], providers: [DimlessBinaryPipe, FormatterService] }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/telemetry-notification/telemetry-notification.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/telemetry-notification/telemetry-notification.component.spec.ts index 7f2b4725193..cc9fa591c31 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/telemetry-notification/telemetry-notification.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/telemetry-notification/telemetry-notification.component.spec.ts @@ -5,7 +5,7 @@ import { NgbAlertModule } from '@ng-bootstrap/ng-bootstrap'; import { ToastrModule } from 'ngx-toastr'; import { of } from 'rxjs'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { UserFormModel } from '../../../core/auth/user-form/user-form.model'; import { MgrModuleService } from '../../api/mgr-module.service'; import { UserService } from '../../api/user.service'; @@ -59,7 +59,7 @@ describe('TelemetryActivationNotificationComponent', () => { configureTestBed({ declarations: [TelemetryNotificationComponent], imports: [NgbAlertModule, HttpClientTestingModule, ToastrModule.forRoot(), PipesModule], - providers: [MgrModuleService, UserService, i18nProviders] + providers: [MgrModuleService, UserService] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/telemetry-notification/telemetry-notification.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/telemetry-notification/telemetry-notification.component.ts index 4b881e2f8e0..ce3e97fd516 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/telemetry-notification/telemetry-notification.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/telemetry-notification/telemetry-notification.component.ts @@ -1,7 +1,5 @@ import { Component, OnDestroy, OnInit } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; - import { UserFormModel } from '../../../core/auth/user-form/user-form.model'; import { MgrModuleService } from '../../api/mgr-module.service'; import { UserService } from '../../api/user.service'; @@ -23,8 +21,7 @@ export class TelemetryNotificationComponent implements OnInit, OnDestroy { private authStorageService: AuthStorageService, private userService: UserService, private notificationService: NotificationService, - private telemetryNotificationService: TelemetryNotificationService, - private i18n: I18n + private telemetryNotificationService: TelemetryNotificationService ) {} ngOnInit() { @@ -59,10 +56,9 @@ export class TelemetryNotificationComponent implements OnInit, OnDestroy { localStorage.setItem('telemetry_notification_hidden', 'true'); this.notificationService.show( NotificationType.success, - this.i18n('Telemetry activation reminder muted'), - this.i18n( - 'You can activate the module on the Telemetry configuration page (Dashboard Settings -> Telemetry configuration) at any time.' - ) + $localize`Telemetry activation reminder muted`, + $localize`You can activate the module on the Telemetry configuration \ +page (Dashboard Settings -> Telemetry configuration) at any time.` ); } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/constants/app.constants.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/constants/app.constants.ts index 802c0d96f34..5f8d310d9c5 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/constants/app.constants.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/constants/app.constants.ts @@ -1,7 +1,5 @@ import { Injectable } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; - export class AppConstants { public static readonly organization = 'ceph'; public static readonly projectName = 'Ceph Dashboard'; @@ -109,52 +107,52 @@ export class ActionLabelsI18n { UNSET: string; UPDATE: string; - constructor(private i18n: I18n) { + constructor() { /* Create a new item */ - this.CREATE = this.i18n('Create'); + this.CREATE = $localize`Create`; /* Destroy an existing item */ - this.DELETE = this.i18n('Delete'); + this.DELETE = $localize`Delete`; /* Add an existing item to a container */ - this.ADD = this.i18n('Add'); - this.SET = this.i18n('Set'); + this.ADD = $localize`Add`; + this.SET = $localize`Set`; /* Remove an item from a container WITHOUT deleting it */ - this.REMOVE = this.i18n('Remove'); - this.UNSET = this.i18n('Unset'); + this.REMOVE = $localize`Remove`; + this.UNSET = $localize`Unset`; /* Make changes to an existing item */ - this.EDIT = this.i18n('Edit'); - this.UPDATE = this.i18n('Update'); - this.CANCEL = this.i18n('Cancel'); + this.EDIT = $localize`Edit`; + this.UPDATE = $localize`Update`; + this.CANCEL = $localize`Cancel`; /* Non-standard actions */ - this.CLONE = this.i18n('Clone'); - this.COPY = this.i18n('Copy'); - this.DEEP_SCRUB = this.i18n('Deep Scrub'); - this.DESTROY = this.i18n('Destroy'); - this.EVICT = this.i18n('Evict'); - this.FLATTEN = this.i18n('Flatten'); - this.MARK_DOWN = this.i18n('Mark Down'); - this.MARK_IN = this.i18n('Mark In'); - this.MARK_LOST = this.i18n('Mark Lost'); - this.MARK_OUT = this.i18n('Mark Out'); - this.PROTECT = this.i18n('Protect'); - this.PURGE = this.i18n('Purge'); - this.RENAME = this.i18n('Rename'); - this.RESTORE = this.i18n('Restore'); - this.REWEIGHT = this.i18n('Reweight'); - this.ROLLBACK = this.i18n('Rollback'); - this.SCRUB = this.i18n('Scrub'); - this.SHOW = this.i18n('Show'); - this.TRASH = this.i18n('Move to Trash'); - this.UNPROTECT = this.i18n('Unprotect'); - this.CHANGE = this.i18n('Change'); + this.CLONE = $localize`Clone`; + this.COPY = $localize`Copy`; + this.DEEP_SCRUB = $localize`Deep Scrub`; + this.DESTROY = $localize`Destroy`; + this.EVICT = $localize`Evict`; + this.FLATTEN = $localize`Flatten`; + this.MARK_DOWN = $localize`Mark Down`; + this.MARK_IN = $localize`Mark In`; + this.MARK_LOST = $localize`Mark Lost`; + this.MARK_OUT = $localize`Mark Out`; + this.PROTECT = $localize`Protect`; + this.PURGE = $localize`Purge`; + this.RENAME = $localize`Rename`; + this.RESTORE = $localize`Restore`; + this.REWEIGHT = $localize`Reweight`; + this.ROLLBACK = $localize`Rollback`; + this.SCRUB = $localize`Scrub`; + this.SHOW = $localize`Show`; + this.TRASH = $localize`Move to Trash`; + this.UNPROTECT = $localize`Unprotect`; + this.CHANGE = $localize`Change`; /* Prometheus wording */ - this.RECREATE = this.i18n('Recreate'); - this.EXPIRE = this.i18n('Expire'); + this.RECREATE = $localize`Recreate`; + this.EXPIRE = $localize`Expire`; } } @@ -194,47 +192,47 @@ export class SucceededActionLabelsI18n { RECREATED: string; EXPIRED: string; - constructor(private i18n: I18n) { + constructor() { /* Create a new item */ - this.CREATED = this.i18n('Created'); + this.CREATED = $localize`Created`; /* Destroy an existing item */ - this.DELETED = this.i18n('Deleted'); + this.DELETED = $localize`Deleted`; /* Add an existing item to a container */ - this.ADDED = this.i18n('Added'); + this.ADDED = $localize`Added`; /* Remove an item from a container WITHOUT deleting it */ - this.REMOVED = this.i18n('Removed'); + this.REMOVED = $localize`Removed`; /* Make changes to an existing item */ - this.EDITED = this.i18n('Edited'); - this.CANCELED = this.i18n('Canceled'); + this.EDITED = $localize`Edited`; + this.CANCELED = $localize`Canceled`; /* Non-standard actions */ - this.CLONED = this.i18n('Cloned'); - this.COPIED = this.i18n('Copied'); - this.DEEP_SCRUBBED = this.i18n('Deep Scrubbed'); - this.DESTROYED = this.i18n('Destroyed'); - this.FLATTENED = this.i18n('Flattened'); - this.MARKED_DOWN = this.i18n('Marked Down'); - this.MARKED_IN = this.i18n('Marked In'); - this.MARKED_LOST = this.i18n('Marked Lost'); - this.MARKED_OUT = this.i18n('Marked Out'); - this.PROTECTED = this.i18n('Protected'); - this.PURGED = this.i18n('Purged'); - this.RENAMED = this.i18n('Renamed'); - this.RESTORED = this.i18n('Restored'); - this.REWEIGHTED = this.i18n('Reweighted'); - this.ROLLED_BACK = this.i18n('Rolled back'); - this.SCRUBBED = this.i18n('Scrubbed'); - this.SHOWED = this.i18n('Showed'); - this.TRASHED = this.i18n('Moved to Trash'); - this.UNPROTECTED = this.i18n('Unprotected'); - this.CHANGE = this.i18n('Change'); + this.CLONED = $localize`Cloned`; + this.COPIED = $localize`Copied`; + this.DEEP_SCRUBBED = $localize`Deep Scrubbed`; + this.DESTROYED = $localize`Destroyed`; + this.FLATTENED = $localize`Flattened`; + this.MARKED_DOWN = $localize`Marked Down`; + this.MARKED_IN = $localize`Marked In`; + this.MARKED_LOST = $localize`Marked Lost`; + this.MARKED_OUT = $localize`Marked Out`; + this.PROTECTED = $localize`Protected`; + this.PURGED = $localize`Purged`; + this.RENAMED = $localize`Renamed`; + this.RESTORED = $localize`Restored`; + this.REWEIGHTED = $localize`Reweighted`; + this.ROLLED_BACK = $localize`Rolled back`; + this.SCRUBBED = $localize`Scrubbed`; + this.SHOWED = $localize`Showed`; + this.TRASHED = $localize`Moved to Trash`; + this.UNPROTECTED = $localize`Unprotected`; + this.CHANGE = $localize`Change`; /* Prometheus wording */ - this.RECREATED = this.i18n('Recreated'); - this.EXPIRED = this.i18n('Expired'); + this.RECREATED = $localize`Recreated`; + this.EXPIRED = $localize`Expired`; } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/copy2clipboard-button.directive.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/copy2clipboard-button.directive.spec.ts index e4f09edd03c..e50fd86332c 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/copy2clipboard-button.directive.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/copy2clipboard-button.directive.spec.ts @@ -1,18 +1,8 @@ -import { TestBed } from '@angular/core/testing'; - -import { I18n } from '@ngx-translate/i18n-polyfill'; - -import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper'; import { Copy2ClipboardButtonDirective } from './copy2clipboard-button.directive'; describe('Copy2clipboardButtonDirective', () => { - configureTestBed({ - providers: [i18nProviders] - }); - it('should create an instance', () => { - const i18n = TestBed.inject(I18n); - const directive = new Copy2ClipboardButtonDirective(null, null, null, i18n); + const directive = new Copy2ClipboardButtonDirective(null, null, null); expect(directive).toBeTruthy(); }); }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/copy2clipboard-button.directive.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/copy2clipboard-button.directive.ts index ff5218acb70..78e4767e539 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/copy2clipboard-button.directive.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/copy2clipboard-button.directive.ts @@ -1,6 +1,5 @@ import { Directive, ElementRef, HostListener, Input, OnInit, Renderer2 } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import { ToastrService } from 'ngx-toastr'; @Directive({ @@ -13,15 +12,14 @@ export class Copy2ClipboardButtonDirective implements OnInit { constructor( private elementRef: ElementRef, private renderer: Renderer2, - private toastr: ToastrService, - private i18n: I18n + private toastr: ToastrService ) {} ngOnInit() { const iElement = this.renderer.createElement('i'); this.renderer.addClass(iElement, 'fa'); this.renderer.addClass(iElement, 'fa-clipboard'); - this.renderer.setAttribute(iElement, 'title', this.i18n('Copy to clipboard')); + this.renderer.setAttribute(iElement, 'title', $localize`Copy to clipboard`); this.renderer.appendChild(this.elementRef.nativeElement, iElement); } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/form-loading.directive.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/form-loading.directive.spec.ts index d30233a69b9..ed9299124ae 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/form-loading.directive.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/form-loading.directive.spec.ts @@ -4,7 +4,7 @@ import { By } from '@angular/platform-browser'; import { NgbAlertModule } from '@ng-bootstrap/ng-bootstrap'; -import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../testing/unit-test-helper'; import { AlertPanelComponent } from '../components/alert-panel/alert-panel.component'; import { LoadingPanelComponent } from '../components/loading-panel/loading-panel.component'; import { CdForm } from '../forms/cd-form'; @@ -31,8 +31,7 @@ describe('FormLoadingDirective', () => { configureTestBed( { declarations: [TestComponent], - imports: [SharedModule, NgbAlertModule], - providers: [i18nProviders] + imports: [SharedModule, NgbAlertModule] }, [LoadingPanelComponent, AlertPanelComponent] ); @@ -48,7 +47,7 @@ describe('FormLoadingDirective', () => { }); it('should create an instance', () => { - const directive = new FormLoadingDirective(null, null, null, null); + const directive = new FormLoadingDirective(null, null, null); expect(directive).toBeTruthy(); }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/form-loading.directive.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/form-loading.directive.ts index 9b063948520..e83614b84a5 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/form-loading.directive.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/form-loading.directive.ts @@ -6,8 +6,6 @@ import { ViewContainerRef } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; - import { AlertPanelComponent } from '../components/alert-panel/alert-panel.component'; import { LoadingPanelComponent } from '../components/loading-panel/loading-panel.component'; import { LoadingStatus } from '../forms/cd-form'; @@ -19,8 +17,7 @@ export class FormLoadingDirective { constructor( private templateRef: TemplateRef, private viewContainer: ViewContainerRef, - private componentFactoryResolver: ComponentFactoryResolver, - private i18n: I18n + private componentFactoryResolver: ComponentFactoryResolver ) {} @Input('cdFormLoading') set cdFormLoading(condition: LoadingStatus) { @@ -32,7 +29,7 @@ export class FormLoadingDirective { switch (condition) { case LoadingStatus.Loading: factory = this.componentFactoryResolver.resolveComponentFactory(LoadingPanelComponent); - content = this.resolveNgContent(this.i18n(`Loading form data...`)); + content = this.resolveNgContent($localize`Loading form data...`); this.viewContainer.createComponent(factory, null, null, content); break; case LoadingStatus.Ready: @@ -40,7 +37,7 @@ export class FormLoadingDirective { break; case LoadingStatus.Error: factory = this.componentFactoryResolver.resolveComponentFactory(AlertPanelComponent); - content = this.resolveNgContent(this.i18n(`Form data could not be loaded.`)); + content = this.resolveNgContent($localize`Form data could not be loaded.`); const componentRef = this.viewContainer.createComponent(factory, null, null, content); (componentRef.instance).type = 'error'; break; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/forms/cd-validators.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/forms/cd-validators.ts index b0cd8133eda..bcc5629a9e0 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/forms/cd-validators.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/forms/cd-validators.ts @@ -6,7 +6,6 @@ import { Validators } from '@angular/forms'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { Observable, of as observableOf, timer as observableTimer } from 'rxjs'; import { map, switchMapTo, take } from 'rxjs/operators'; @@ -333,7 +332,7 @@ export class CdValidators { * be called in a static one. */ static binaryMin(bytes: number): ValidatorFn { - return (control: AbstractControl): { [key: string]: (i18n: I18n) => string } | null => { + return (control: AbstractControl): { [key: string]: () => string } | null => { const formatterService = new FormatterService(); const currentBytes = new FormatterService().toBytes(control.value); if (bytes <= currentBytes) { @@ -341,7 +340,7 @@ export class CdValidators { } const value = new DimlessBinaryPipe(formatterService).transform(bytes); return { - binaryMin: (i18n: I18n) => i18n(`Size has to be at least {{value}} or more`, { value }) + binaryMin: () => $localize`Size has to be at least ${value} or more` }; }; } @@ -353,7 +352,7 @@ export class CdValidators { * be called in a static one. */ static binaryMax(bytes: number): ValidatorFn { - return (control: AbstractControl): { [key: string]: (i18n: I18n) => string } | null => { + return (control: AbstractControl): { [key: string]: () => string } | null => { const formatterService = new FormatterService(); const currentBytes = formatterService.toBytes(control.value); if (bytes >= currentBytes) { @@ -361,7 +360,7 @@ export class CdValidators { } const value = new DimlessBinaryPipe(formatterService).transform(bytes); return { - binaryMax: (i18n: I18n) => i18n(`Size has to be at most {{value}} or less`, { value }) + binaryMax: () => $localize`Size has to be at most ${value} or less` }; }; } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/boolean-text.pipe.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/boolean-text.pipe.spec.ts index 5293059e75d..a0b8019a7ca 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/boolean-text.pipe.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/boolean-text.pipe.spec.ts @@ -1,20 +1,10 @@ -import { TestBed } from '@angular/core/testing'; - -import { I18n } from '@ngx-translate/i18n-polyfill'; - -import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper'; import { BooleanTextPipe } from './boolean-text.pipe'; describe('BooleanTextPipe', () => { let pipe: BooleanTextPipe; - configureTestBed({ - providers: [i18nProviders] - }); - beforeEach(() => { - const i18n = TestBed.inject(I18n); - pipe = new BooleanTextPipe(i18n); + pipe = new BooleanTextPipe(); }); it('create an instance', () => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/boolean-text.pipe.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/boolean-text.pipe.ts index dba4e8bc010..70432f9be5d 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/boolean-text.pipe.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/boolean-text.pipe.ts @@ -1,17 +1,13 @@ import { Pipe, PipeTransform } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; - @Pipe({ name: 'booleanText' }) export class BooleanTextPipe implements PipeTransform { - constructor(private i18n: I18n) {} - transform( value: any, - truthyText: string = this.i18n('Yes'), - falsyText: string = this.i18n('No') + truthyText: string = $localize`Yes`, + falsyText: string = $localize`No` ): string { return Boolean(value) ? truthyText : falsyText; } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/not-available.pipe.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/not-available.pipe.spec.ts index f658365e2d2..9d36defb937 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/not-available.pipe.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/not-available.pipe.spec.ts @@ -1,20 +1,10 @@ -import { TestBed } from '@angular/core/testing'; - -import { I18n } from '@ngx-translate/i18n-polyfill'; - -import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper'; import { NotAvailablePipe } from './not-available.pipe'; describe('NotAvailablePipe', () => { let pipe: NotAvailablePipe; - configureTestBed({ - providers: [i18nProviders] - }); - beforeEach(() => { - const i18n = TestBed.inject(I18n); - pipe = new NotAvailablePipe(i18n); + pipe = new NotAvailablePipe(); }); it('create an instance', () => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/not-available.pipe.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/not-available.pipe.ts index 75cb8a5cf0c..17184c38ae1 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/not-available.pipe.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/not-available.pipe.ts @@ -1,15 +1,12 @@ import { Pipe, PipeTransform } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; - @Pipe({ name: 'notAvailable' }) export class NotAvailablePipe implements PipeTransform { - constructor(private i18n: I18n) {} transform(value: any): any { if (value === '') { - return this.i18n('n/a'); + return $localize`n/a`; } return value; } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/api-interceptor.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/api-interceptor.service.spec.ts index 9467cc3f7ba..2b37ffafaa3 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/api-interceptor.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/api-interceptor.service.spec.ts @@ -5,7 +5,7 @@ import { Router } from '@angular/router'; import { ToastrService } from 'ngx-toastr'; -import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../testing/unit-test-helper'; import { AppModule } from '../../app.module'; import { NotificationType } from '../enum/notification-type.enum'; import { CdNotification, CdNotificationConfig } from '../models/cd-notification'; @@ -62,7 +62,6 @@ describe('ApiInterceptorService', () => { imports: [AppModule, HttpClientTestingModule], providers: [ NotificationService, - i18nProviders, { provide: ToastrService, useValue: { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/notification.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/notification.service.spec.ts index fa235acefc6..226fa4712fc 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/notification.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/notification.service.spec.ts @@ -4,7 +4,7 @@ import { fakeAsync, TestBed, tick } from '@angular/core/testing'; import * as _ from 'lodash'; import { ToastrService } from 'ngx-toastr'; -import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../testing/unit-test-helper'; import { RbdService } from '../api/rbd.service'; import { NotificationType } from '../enum/notification-type.enum'; import { CdNotificationConfig } from '../models/cd-notification'; @@ -27,7 +27,6 @@ describe('NotificationService', () => { TaskMessageService, { provide: ToastrService, useValue: toastFakeService }, { provide: CdDatePipe, useValue: { transform: (d: any) => d } }, - i18nProviders, RbdService ], imports: [HttpClientTestingModule] diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/password-policy.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/password-policy.service.spec.ts index cae1993b58b..ff88fcb6206 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/password-policy.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/password-policy.service.spec.ts @@ -3,7 +3,7 @@ import { TestBed } from '@angular/core/testing'; import { of as observableOf } from 'rxjs'; -import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../testing/unit-test-helper'; import { SettingsService } from '../api/settings.service'; import { SharedModule } from '../shared.module'; import { PasswordPolicyService } from './password-policy.service'; @@ -33,8 +33,7 @@ describe('PasswordPolicyService', () => { }; configureTestBed({ - imports: [HttpClientTestingModule, SharedModule], - providers: [i18nProviders] + imports: [HttpClientTestingModule, SharedModule] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/password-policy.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/password-policy.service.ts index e3030b10a67..c768a36aa94 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/password-policy.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/password-policy.service.ts @@ -1,6 +1,5 @@ import { Injectable } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; @@ -12,7 +11,7 @@ import { CdPwdPolicySettings } from '../models/cd-pwd-policy-settings'; providedIn: 'root' }) export class PasswordPolicyService { - constructor(private i18n: I18n, private settingsService: SettingsService) {} + constructor(private settingsService: SettingsService) {} getHelpText(): Observable { return this.settingsService.getStandardSettings().pipe( @@ -20,27 +19,19 @@ export class PasswordPolicyService { const settings = new CdPwdPolicySettings(resp); let helpText: string[] = []; if (settings.pwdPolicyEnabled) { - helpText.push(this.i18n('Required rules for passwords:')); + helpText.push($localize`Required rules for passwords:`); const i18nHelp: { [key: string]: string } = { - pwdPolicyCheckLengthEnabled: this.i18n('Must contain at least {{length}} characters', { - length: settings.pwdPolicyMinLength - }), - pwdPolicyCheckOldpwdEnabled: this.i18n('Must not be the same as the previous one'), - pwdPolicyCheckUsernameEnabled: this.i18n('Cannot contain the username'), - pwdPolicyCheckExclusionListEnabled: this.i18n('Cannot contain any configured keyword'), - pwdPolicyCheckRepetitiveCharsEnabled: this.i18n( - 'Cannot contain any repetitive characters e.g. "aaa"' - ), - pwdPolicyCheckSequentialCharsEnabled: this.i18n( - 'Cannot contain any sequential characters e.g. "abc"' - ), - pwdPolicyCheckComplexityEnabled: this.i18n( - `Must consist of characters from the following groups: + pwdPolicyCheckLengthEnabled: $localize`Must contain at least ${settings.pwdPolicyMinLength} characters`, + pwdPolicyCheckOldpwdEnabled: $localize`Must not be the same as the previous one`, + pwdPolicyCheckUsernameEnabled: $localize`Cannot contain the username`, + pwdPolicyCheckExclusionListEnabled: $localize`Cannot contain any configured keyword`, + pwdPolicyCheckRepetitiveCharsEnabled: $localize`Cannot contain any repetitive characters e.g. "aaa"`, + pwdPolicyCheckSequentialCharsEnabled: $localize`Cannot contain any sequential characters e.g. "abc"`, + pwdPolicyCheckComplexityEnabled: $localize`Must consist of characters from the following groups: * Alphabetic a-z, A-Z * Numbers 0-9 * Special chars: !"#$%& '()*+,-./:;<=>?@[\\]^_\`{{|}}~ * Any other characters (signs)` - ) }; helpText = helpText.concat( _.keys(i18nHelp) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert-formatter.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert-formatter.spec.ts index ee76530ecc5..c4ffc5e8444 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert-formatter.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert-formatter.spec.ts @@ -3,11 +3,7 @@ import { TestBed } from '@angular/core/testing'; import { ToastrModule } from 'ngx-toastr'; -import { - configureTestBed, - i18nProviders, - PrometheusHelper -} from '../../../testing/unit-test-helper'; +import { configureTestBed, PrometheusHelper } from '../../../testing/unit-test-helper'; import { NotificationType } from '../enum/notification-type.enum'; import { CdNotificationConfig } from '../models/cd-notification'; import { PrometheusCustomAlert } from '../models/prometheus-alerts'; @@ -22,7 +18,7 @@ describe('PrometheusAlertFormatter', () => { configureTestBed({ imports: [ToastrModule.forRoot(), SharedModule, HttpClientTestingModule], - providers: [PrometheusAlertFormatter, i18nProviders] + providers: [PrometheusAlertFormatter] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert.service.spec.ts index cefbb78be0b..eaca61b48a3 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert.service.spec.ts @@ -4,11 +4,7 @@ import { TestBed } from '@angular/core/testing'; import { ToastrModule } from 'ngx-toastr'; import { Observable, of } from 'rxjs'; -import { - configureTestBed, - i18nProviders, - PrometheusHelper -} from '../../../testing/unit-test-helper'; +import { configureTestBed, PrometheusHelper } from '../../../testing/unit-test-helper'; import { PrometheusService } from '../api/prometheus.service'; import { NotificationType } from '../enum/notification-type.enum'; import { CdNotificationConfig } from '../models/cd-notification'; @@ -27,7 +23,7 @@ describe('PrometheusAlertService', () => { configureTestBed({ imports: [ToastrModule.forRoot(), SharedModule, HttpClientTestingModule], - providers: [PrometheusAlertService, PrometheusAlertFormatter, i18nProviders] + providers: [PrometheusAlertService, PrometheusAlertFormatter] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-notification.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-notification.service.spec.ts index de3130a9dc8..6500d51f26a 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-notification.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-notification.service.spec.ts @@ -4,11 +4,7 @@ import { fakeAsync, TestBed, tick } from '@angular/core/testing'; import { ToastrModule, ToastrService } from 'ngx-toastr'; import { of, throwError } from 'rxjs'; -import { - configureTestBed, - i18nProviders, - PrometheusHelper -} from '../../../testing/unit-test-helper'; +import { configureTestBed, PrometheusHelper } from '../../../testing/unit-test-helper'; import { PrometheusService } from '../api/prometheus.service'; import { NotificationType } from '../enum/notification-type.enum'; import { CdNotificationConfig } from '../models/cd-notification'; @@ -38,7 +34,6 @@ describe('PrometheusNotificationService', () => { providers: [ PrometheusNotificationService, PrometheusAlertFormatter, - i18nProviders, { provide: ToastrService, useValue: toastFakeService } ] }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-silence-matcher.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-silence-matcher.service.spec.ts index 5e92b52a59e..57f0442c43f 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-silence-matcher.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-silence-matcher.service.spec.ts @@ -1,10 +1,6 @@ import { TestBed } from '@angular/core/testing'; -import { - configureTestBed, - i18nProviders, - PrometheusHelper -} from '../../../testing/unit-test-helper'; +import { configureTestBed, PrometheusHelper } from '../../../testing/unit-test-helper'; import { PrometheusRule } from '../models/prometheus-alerts'; import { SharedModule } from '../shared.module'; import { PrometheusSilenceMatcherService } from './prometheus-silence-matcher.service'; @@ -15,8 +11,7 @@ describe('PrometheusSilenceMatcherService', () => { let rules: PrometheusRule[]; configureTestBed({ - imports: [SharedModule], - providers: [i18nProviders] + imports: [SharedModule] }); const addMatcher = (name: string, value: any) => ({ diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-silence-matcher.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-silence-matcher.service.ts index dbd0da04eb1..c819a16f426 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-silence-matcher.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-silence-matcher.service.ts @@ -1,6 +1,5 @@ import { Injectable } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { @@ -20,8 +19,6 @@ export class PrometheusSilenceMatcherService { severity: 'labels.severity' }; - constructor(private i18n: I18n) {} - singleMatch( matcher: AlertmanagerSilenceMatcher, rules: PrometheusRule[] @@ -65,18 +62,17 @@ export class PrometheusSilenceMatcherService { private getMatchText(rules: number, alerts: number): string { const msg = { - noRule: this.i18n('Your matcher seems to match no currently defined rule or active alert.'), - noAlerts: this.i18n('no active alerts'), - alert: this.i18n('1 active alert'), - alerts: this.i18n('{{n}} active alerts', { n: alerts }), - rule: this.i18n('Matches 1 rule'), - rules: this.i18n('Matches {{n}} rules', { n: rules }) + noRule: $localize`Your matcher seems to match no currently defined rule or active alert.`, + noAlerts: $localize`no active alerts`, + alert: $localize`1 active alert`, + alerts: $localize`${alerts} active alerts`, + rule: $localize`Matches 1 rule`, + rules: $localize`Matches ${rules} rules` }; - return rules - ? this.i18n('{{rules}} with {{alerts}}.', { - rules: rules > 1 ? msg.rules : msg.rule, - alerts: alerts ? (alerts > 1 ? msg.alerts : msg.alert) : msg.noAlerts - }) - : msg.noRule; + + const rule = rules > 1 ? msg.rules : msg.rule; + const alert = alerts ? (alerts > 1 ? msg.alerts : msg.alert) : msg.noAlerts; + + return rules ? $localize`${rule} with ${alert}.` : msg.noRule; } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/rbd-configuration.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/rbd-configuration.service.spec.ts index e1db61a5ebb..15b2e4e7e14 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/rbd-configuration.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/rbd-configuration.service.spec.ts @@ -1,6 +1,6 @@ import { TestBed } from '@angular/core/testing'; -import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../testing/unit-test-helper'; import { RbdConfigurationType } from '../models/configuration'; import { RbdConfigurationService } from './rbd-configuration.service'; @@ -8,7 +8,7 @@ describe('RbdConfigurationService', () => { let service: RbdConfigurationService; configureTestBed({ - providers: [RbdConfigurationService, i18nProviders] + providers: [RbdConfigurationService] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/rbd-configuration.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/rbd-configuration.service.ts index 10a0ac7060e..4499718e1fa 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/rbd-configuration.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/rbd-configuration.service.ts @@ -1,7 +1,5 @@ import { Injectable } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; - import { RbdConfigurationExtraField, RbdConfigurationSection, @@ -19,82 +17,82 @@ import { export class RbdConfigurationService { readonly sections: RbdConfigurationSection[]; - constructor(private i18n: I18n) { + constructor() { this.sections = [ { - heading: this.i18n('Quality of Service'), + heading: $localize`Quality of Service`, class: 'quality-of-service', options: [ { name: 'rbd_qos_bps_limit', - displayName: this.i18n('BPS Limit'), - description: this.i18n('The desired limit of IO bytes per second.'), + displayName: $localize`BPS Limit`, + description: $localize`The desired limit of IO bytes per second.`, type: RbdConfigurationType.bps }, { name: 'rbd_qos_iops_limit', - displayName: this.i18n('IOPS Limit'), - description: this.i18n('The desired limit of IO operations per second.'), + displayName: $localize`IOPS Limit`, + description: $localize`The desired limit of IO operations per second.`, type: RbdConfigurationType.iops }, { name: 'rbd_qos_read_bps_limit', - displayName: this.i18n('Read BPS Limit'), - description: this.i18n('The desired limit of read bytes per second.'), + displayName: $localize`Read BPS Limit`, + description: $localize`The desired limit of read bytes per second.`, type: RbdConfigurationType.bps }, { name: 'rbd_qos_read_iops_limit', - displayName: this.i18n('Read IOPS Limit'), - description: this.i18n('The desired limit of read operations per second.'), + displayName: $localize`Read IOPS Limit`, + description: $localize`The desired limit of read operations per second.`, type: RbdConfigurationType.iops }, { name: 'rbd_qos_write_bps_limit', - displayName: this.i18n('Write BPS Limit'), - description: this.i18n('The desired limit of write bytes per second.'), + displayName: $localize`Write BPS Limit`, + description: $localize`The desired limit of write bytes per second.`, type: RbdConfigurationType.bps }, { name: 'rbd_qos_write_iops_limit', - displayName: this.i18n('Write IOPS Limit'), - description: this.i18n('The desired limit of write operations per second.'), + displayName: $localize`Write IOPS Limit`, + description: $localize`The desired limit of write operations per second.`, type: RbdConfigurationType.iops }, { name: 'rbd_qos_bps_burst', - displayName: this.i18n('BPS Burst'), - description: this.i18n('The desired burst limit of IO bytes.'), + displayName: $localize`BPS Burst`, + description: $localize`The desired burst limit of IO bytes.`, type: RbdConfigurationType.bps }, { name: 'rbd_qos_iops_burst', - displayName: this.i18n('IOPS Burst'), - description: this.i18n('The desired burst limit of IO operations.'), + displayName: $localize`IOPS Burst`, + description: $localize`The desired burst limit of IO operations.`, type: RbdConfigurationType.iops }, { name: 'rbd_qos_read_bps_burst', - displayName: this.i18n('Read BPS Burst'), - description: this.i18n('The desired burst limit of read bytes.'), + displayName: $localize`Read BPS Burst`, + description: $localize`The desired burst limit of read bytes.`, type: RbdConfigurationType.bps }, { name: 'rbd_qos_read_iops_burst', - displayName: this.i18n('Read IOPS Burst'), - description: this.i18n('The desired burst limit of read operations.'), + displayName: $localize`Read IOPS Burst`, + description: $localize`The desired burst limit of read operations.`, type: RbdConfigurationType.iops }, { name: 'rbd_qos_write_bps_burst', - displayName: this.i18n('Write BPS Burst'), - description: this.i18n('The desired burst limit of write bytes.'), + displayName: $localize`Write BPS Burst`, + description: $localize`The desired burst limit of write bytes.`, type: RbdConfigurationType.bps }, { name: 'rbd_qos_write_iops_burst', - displayName: this.i18n('Write IOPS Burst'), - description: this.i18n('The desired burst limit of write operations.'), + displayName: $localize`Write IOPS Burst`, + description: $localize`The desired burst limit of write operations.`, type: RbdConfigurationType.iops } ] as RbdConfigurationExtraField[] diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/refresh-interval.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/refresh-interval.service.spec.ts index 1d11fc5561f..51be8659137 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/refresh-interval.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/refresh-interval.service.spec.ts @@ -8,7 +8,6 @@ describe('RefreshIntervalService', () => { let service: RefreshIntervalService; configureTestBed({ - imports: [], providers: [RefreshIntervalService] }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-list.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-list.service.spec.ts index e52459b0b85..5ec08671eca 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-list.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-list.service.spec.ts @@ -4,11 +4,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { of } from 'rxjs'; -import { - configureTestBed, - expectItemTasks, - i18nProviders -} from '../../../testing/unit-test-helper'; +import { configureTestBed, expectItemTasks } from '../../../testing/unit-test-helper'; import { RbdService } from '../api/rbd.service'; import { ExecutingTask } from '../models/executing-task'; import { SummaryService } from './summary.service'; @@ -29,7 +25,7 @@ describe('TaskListService', () => { }; configureTestBed({ - providers: [TaskListService, TaskMessageService, SummaryService, i18nProviders, RbdService], + providers: [TaskListService, TaskMessageService, SummaryService, RbdService], imports: [HttpClientTestingModule, RouterTestingModule] }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-message.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-message.service.spec.ts index 9d037aecb9b..920d79dd73a 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-message.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-message.service.spec.ts @@ -3,7 +3,7 @@ import { TestBed } from '@angular/core/testing'; import * as _ from 'lodash'; -import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../testing/unit-test-helper'; import { RbdService } from '../api/rbd.service'; import { FinishedTask } from '../models/finished-task'; import { TaskException } from '../models/task-exception'; @@ -14,7 +14,7 @@ describe('TaskManagerMessageService', () => { let finishedTask: FinishedTask; configureTestBed({ - providers: [TaskMessageService, i18nProviders, RbdService], + providers: [TaskMessageService, RbdService], imports: [HttpClientTestingModule] }); @@ -247,7 +247,7 @@ describe('TaskManagerMessageService', () => { finishedTask.name = 'rbd/trash/restore'; testMessages( new TaskMessageOperation('Restoring', 'restore', 'Restored'), - `image '${metadata.image_id_spec}' ` + `into '${metadata.new_image_name}'` + `image '${metadata.image_id_spec}' into '${metadata.new_image_name}'` ); testErrorCode(17, `Image name '${metadata.new_image_name}' is already in use.`); }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-message.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-message.service.ts index 3047a287db3..026765a14ce 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-message.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-message.service.ts @@ -1,7 +1,5 @@ import { Injectable } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; - import { Components } from '../enum/components.enum'; import { FinishedTask } from '../models/finished-task'; import { ImageSpec } from '../models/image-spec'; @@ -20,17 +18,12 @@ export class TaskMessageOperation { } class TaskMessage { - i18n: I18n; - operation: TaskMessageOperation; involves: (object: any) => string; errors: (metadata: any) => object; failure(metadata: any): string { - return this.i18n('Failed to {{failure}} {{metadata}}', { - failure: this.operation.failure, - metadata: this.involves(metadata) - }); + return $localize`Failed to ${this.operation.failure} ${this.involves(metadata)}`; } running(metadata: any): string { @@ -42,12 +35,10 @@ class TaskMessage { } constructor( - i18n: I18n, operation: TaskMessageOperation, involves: (metadata: any) => string, errors?: (metadata: any) => object ) { - this.i18n = i18n; this.operation = operation; this.involves = involves; this.errors = errors || (() => ({})); @@ -58,14 +49,12 @@ class TaskMessage { providedIn: 'root' }) export class TaskMessageService { - constructor(private i18n: I18n) {} - defaultMessage = this.newTaskMessage( - new TaskMessageOperation(this.i18n('Executing'), this.i18n('execute'), this.i18n('Executed')), + new TaskMessageOperation($localize`Executing`, $localize`execute`, $localize`Executed`), (metadata) => { return ( (metadata && (Components[metadata.component] || metadata.component)) || - this.i18n('unknown task') + $localize`unknown task` ); }, () => { @@ -74,48 +63,23 @@ export class TaskMessageService { ); commonOperations = { - create: new TaskMessageOperation( - this.i18n('Creating'), - this.i18n('create'), - this.i18n('Created') - ), - update: new TaskMessageOperation( - this.i18n('Updating'), - this.i18n('update'), - this.i18n('Updated') - ), - delete: new TaskMessageOperation( - this.i18n('Deleting'), - this.i18n('delete'), - this.i18n('Deleted') - ), - add: new TaskMessageOperation(this.i18n('Adding'), this.i18n('add'), this.i18n('Added')), - remove: new TaskMessageOperation( - this.i18n('Removing'), - this.i18n('remove'), - this.i18n('Removed') - ), - import: new TaskMessageOperation( - this.i18n('Importing'), - this.i18n('import'), - this.i18n('Imported') - ) + create: new TaskMessageOperation($localize`Creating`, $localize`create`, $localize`Created`), + update: new TaskMessageOperation($localize`Updating`, $localize`update`, $localize`Updated`), + delete: new TaskMessageOperation($localize`Deleting`, $localize`delete`, $localize`Deleted`), + add: new TaskMessageOperation($localize`Adding`, $localize`add`, $localize`Added`), + remove: new TaskMessageOperation($localize`Removing`, $localize`remove`, $localize`Removed`), + import: new TaskMessageOperation($localize`Importing`, $localize`import`, $localize`Imported`) }; rbd = { - default: (metadata: any) => - this.i18n(`RBD '{{id}}'`, { - id: `${metadata.image_spec}` - }), + default: (metadata: any) => $localize`RBD '${metadata.image_spec}'`, create: (metadata: any) => { const id = new ImageSpec( metadata.pool_name, metadata.namespace, metadata.image_name ).toString(); - return this.i18n(`RBD '{{id}}'`, { - id: id - }); + return $localize`RBD '${id}'`; }, child: (metadata: any) => { const id = new ImageSpec( @@ -123,9 +87,7 @@ export class TaskMessageService { metadata.child_namespace, metadata.child_image_name ).toString(); - return this.i18n(`RBD '{{id}}'`, { - id: id - }); + return $localize`RBD '${id}'`; }, destination: (metadata: any) => { const id = new ImageSpec( @@ -133,31 +95,21 @@ export class TaskMessageService { metadata.dest_namespace, metadata.dest_image_name ).toString(); - return this.i18n(`RBD '{{id}}'`, { - id: id - }); + return $localize`RBD '${id}'`; }, snapshot: (metadata: any) => - this.i18n(`RBD snapshot '{{id}}'`, { - id: `${metadata.image_spec}@${metadata.snapshot_name}` - }) + $localize`RBD snapshot '${metadata.image_spec}@${metadata.snapshot_name}'` }; rbd_mirroring = { - site_name: () => this.i18n('mirroring site name'), - bootstrap: () => this.i18n('bootstrap token'), - pool: (metadata: any) => - this.i18n(`mirror mode for pool '{{id}}'`, { - id: `${metadata.pool_name}` - }), - pool_peer: (metadata: any) => - this.i18n(`mirror peer for pool '{{id}}'`, { - id: `${metadata.pool_name}` - }) + site_name: () => $localize`mirroring site name`, + bootstrap: () => $localize`bootstrap token`, + pool: (metadata: any) => $localize`mirror mode for pool '${metadata.pool_name}'`, + pool_peer: (metadata: any) => $localize`mirror peer for pool '${metadata.pool_name}'` }; grafana = { - update_dashboards: () => this.i18n('all dashboards') + update_dashboards: () => $localize`all dashboards` }; messages = { @@ -169,10 +121,9 @@ export class TaskMessageService { this.host(metadata) ), // OSD tasks - 'osd/create': this.newTaskMessage(this.commonOperations.create, (metadata) => - this.i18n(`OSDs (DriveGroups: {{tracking_id}})`, { - tracking_id: metadata.tracking_id - }) + 'osd/create': this.newTaskMessage( + this.commonOperations.create, + (metadata) => $localize`OSDs (DriveGroups: ${metadata.tracking_id})` ), 'osd/delete': this.newTaskMessage(this.commonOperations.delete, (metadata) => this.osd(metadata) @@ -182,18 +133,14 @@ export class TaskMessageService { this.commonOperations.create, (metadata) => this.pool(metadata), (metadata) => ({ - '17': this.i18n('Name is already used by {{pool_name}}.', { - pool_name: this.pool(metadata) - }) + '17': $localize`Name is already used by ${this.pool(metadata)}.` }) ), 'pool/edit': this.newTaskMessage( this.commonOperations.update, (metadata) => this.pool(metadata), (metadata) => ({ - '17': this.i18n('Name is already used by {{pool_name}}.', { - pool_name: this.pool(metadata) - }) + '17': $localize`Name is already used by ${this.pool(metadata)}.` }) ), 'pool/delete': this.newTaskMessage(this.commonOperations.delete, (metadata) => @@ -204,9 +151,7 @@ export class TaskMessageService { this.commonOperations.create, (metadata) => this.ecp(metadata), (metadata) => ({ - '17': this.i18n('Name is already used by {{name}}.', { - name: this.ecp(metadata) - }) + '17': $localize`Name is already used by ${this.ecp(metadata)}.` }) ), 'ecp/delete': this.newTaskMessage(this.commonOperations.delete, (metadata) => @@ -217,9 +162,7 @@ export class TaskMessageService { this.commonOperations.create, (metadata) => this.crushRule(metadata), (metadata) => ({ - '17': this.i18n('Name is already used by {{name}}.', { - name: this.crushRule(metadata) - }) + '17': $localize`Name is already used by ${this.crushRule(metadata)}.` }) ), 'crushRule/delete': this.newTaskMessage(this.commonOperations.delete, (metadata) => @@ -230,55 +173,37 @@ export class TaskMessageService { this.commonOperations.create, this.rbd.create, (metadata) => ({ - '17': this.i18n('Name is already used by {{rbd_name}}.', { - rbd_name: this.rbd.create(metadata) - }) + '17': $localize`Name is already used by ${this.rbd.create(metadata)}.` }) ), 'rbd/edit': this.newTaskMessage(this.commonOperations.update, this.rbd.default, (metadata) => ({ - '17': this.i18n('Name is already used by {{rbd_name}}.', { - rbd_name: this.rbd.default(metadata) - }) + '17': $localize`Name is already used by ${this.rbd.default(metadata)}.` })), 'rbd/delete': this.newTaskMessage( this.commonOperations.delete, this.rbd.default, (metadata) => ({ - '16': this.i18n('{{rbd_name}} is busy.', { - rbd_name: this.rbd.default(metadata) - }), - '39': this.i18n('{{rbd_name}} contains snapshots.', { - rbd_name: this.rbd.default(metadata) - }) + '16': $localize`${this.rbd.default(metadata)} is busy.`, + '39': $localize`${this.rbd.default(metadata)} contains snapshots.` }) ), 'rbd/clone': this.newTaskMessage( - new TaskMessageOperation(this.i18n('Cloning'), this.i18n('clone'), this.i18n('Cloned')), + new TaskMessageOperation($localize`Cloning`, $localize`clone`, $localize`Cloned`), this.rbd.child, (metadata) => ({ - '17': this.i18n('Name is already used by {{rbd_name}}.', { - rbd_name: this.rbd.child(metadata) - }), - '22': this.i18n('Snapshot of {{rbd_name}} must be protected.', { - rbd_name: this.rbd.child(metadata) - }) + '17': $localize`Name is already used by ${this.rbd.child(metadata)}.`, + '22': $localize`Snapshot of ${this.rbd.child(metadata)} must be protected.` }) ), 'rbd/copy': this.newTaskMessage( - new TaskMessageOperation(this.i18n('Copying'), this.i18n('copy'), this.i18n('Copied')), + new TaskMessageOperation($localize`Copying`, $localize`copy`, $localize`Copied`), this.rbd.destination, (metadata) => ({ - '17': this.i18n('Name is already used by {{rbd_name}}.', { - rbd_name: this.rbd.destination(metadata) - }) + '17': $localize`Name is already used by ${this.rbd.destination(metadata)}.` }) ), 'rbd/flatten': this.newTaskMessage( - new TaskMessageOperation( - this.i18n('Flattening'), - this.i18n('flatten'), - this.i18n('Flattened') - ), + new TaskMessageOperation($localize`Flattening`, $localize`flatten`, $localize`Flattened`), this.rbd.default ), // RBD snapshot tasks @@ -286,78 +211,60 @@ export class TaskMessageService { this.commonOperations.create, this.rbd.snapshot, (metadata) => ({ - '17': this.i18n('Name is already used by {{snap_name}}.', { - snap_name: this.rbd.snapshot(metadata) - }) + '17': $localize`Name is already used by ${this.rbd.snapshot(metadata)}.` }) ), 'rbd/snap/edit': this.newTaskMessage( this.commonOperations.update, this.rbd.snapshot, (metadata) => ({ - '16': this.i18n('Cannot unprotect {{snap_name}} because it contains child images.', { - snap_name: this.rbd.snapshot(metadata) - }) + '16': $localize`Cannot unprotect ${this.rbd.snapshot( + metadata + )} because it contains child images.` }) ), 'rbd/snap/delete': this.newTaskMessage( this.commonOperations.delete, this.rbd.snapshot, (metadata) => ({ - '16': this.i18n(`Cannot delete {{snap_name}} because it's protected.`, { - snap_name: this.rbd.snapshot(metadata) - }) + '16': $localize`Cannot delete ${this.rbd.snapshot(metadata)} because it's protected.` }) ), 'rbd/snap/rollback': this.newTaskMessage( new TaskMessageOperation( - this.i18n('Rolling back'), - this.i18n('rollback'), - this.i18n('Rolled back') + $localize`Rolling back`, + $localize`rollback`, + $localize`Rolled back` ), this.rbd.snapshot ), // RBD trash tasks 'rbd/trash/move': this.newTaskMessage( - new TaskMessageOperation(this.i18n('Moving'), this.i18n('move'), this.i18n('Moved')), - (metadata) => - this.i18n(`image '{{id}}' to trash`, { - id: metadata.image_spec - }), + new TaskMessageOperation($localize`Moving`, $localize`move`, $localize`Moved`), + (metadata) => $localize`image '${metadata.image_spec}' to trash`, () => ({ - 2: this.i18n('Could not find image.') + 2: $localize`Could not find image.` }) ), 'rbd/trash/restore': this.newTaskMessage( - new TaskMessageOperation(this.i18n('Restoring'), this.i18n('restore'), this.i18n('Restored')), - (metadata) => - this.i18n(`image '{{id}}' into '{{new_id}}'`, { - id: metadata.image_id_spec, - new_id: metadata.new_image_name - }), + new TaskMessageOperation($localize`Restoring`, $localize`restore`, $localize`Restored`), + (metadata) => $localize`image '${metadata.image_id_spec}' into '${metadata.new_image_name}'`, (metadata) => ({ - 17: this.i18n(`Image name '{{id}}' is already in use.`, { - id: metadata.new_image_name - }) + 17: $localize`Image name '${metadata.new_image_name}' is already in use.` }) ), 'rbd/trash/remove': this.newTaskMessage( - new TaskMessageOperation(this.i18n('Deleting'), this.i18n('delete'), this.i18n('Deleted')), - (metadata) => - this.i18n(`image '{{id}}'`, { - id: `${metadata.image_id_spec}` - }) + new TaskMessageOperation($localize`Deleting`, $localize`delete`, $localize`Deleted`), + (metadata) => $localize`image '${metadata.image_id_spec}'` ), 'rbd/trash/purge': this.newTaskMessage( - new TaskMessageOperation(this.i18n('Purging'), this.i18n('purge'), this.i18n('Purged')), + new TaskMessageOperation($localize`Purging`, $localize`purge`, $localize`Purged`), (metadata) => { - let message = this.i18n('all pools'); + let message = $localize`all pools`; if (metadata.pool_name) { message = `'${metadata.pool_name}'`; } - return this.i18n('images from {{message}}', { - message: message - }); + return $localize`images from ${message}`; } ), // RBD mirroring tasks @@ -380,7 +287,7 @@ export class TaskMessageService { this.commonOperations.update, this.rbd_mirroring.pool, () => ({ - 16: this.i18n('Cannot disable mirroring because it contains a peer.') + 16: $localize`Cannot disable mirroring because it contains a peer.` }) ), 'rbd/mirroring/peer/add': this.newTaskMessage( @@ -423,12 +330,8 @@ export class TaskMessageService { ), // Orchestrator tasks 'orchestrator/identify_device': this.newTaskMessage( - new TaskMessageOperation( - this.i18n('Identifying'), - this.i18n('identify'), - this.i18n('Identified') - ), - (metadata) => this.i18n(`device '{{device}}' on host '{{hostname}}'`, metadata) + new TaskMessageOperation($localize`Identifying`, $localize`identify`, $localize`Identified`), + (metadata) => $localize`device '${metadata.device}' on host '${metadata.hostname}'` ) }; @@ -437,43 +340,37 @@ export class TaskMessageService { involves: (metadata: any) => string, errors?: (metadata: any) => object ) { - return new TaskMessage(this.i18n, operation, involves, errors); + return new TaskMessage(operation, involves, errors); } host(metadata: any) { - return this.i18n(`host '{{hostname}}'`, { - hostname: metadata.hostname - }); + return $localize`host '${metadata.hostname}'`; } osd(metadata: any) { - return this.i18n(`OSD '{{svc_id}}'`, { - svc_id: metadata.svc_id - }); + return $localize`OSD '${metadata.svc_id}'`; } pool(metadata: any) { - return this.i18n(`pool '{{pool_name}}'`, { - pool_name: metadata.pool_name - }); + return $localize`pool '${metadata.pool_name}'`; } ecp(metadata: any) { - return this.i18n(`erasure code profile '{{name}}'`, { name: metadata.name }); + return $localize`erasure code profile '${metadata.name}'`; } crushRule(metadata: any) { - return this.i18n(`crush rule '{{name}}'`, { name: metadata.name }); + return $localize`crush rule '${metadata.name}'`; } iscsiTarget(metadata: any) { - return this.i18n(`target '{{target_iqn}}'`, { target_iqn: metadata.target_iqn }); + return $localize`target '${metadata.target_iqn}'`; } nfs(metadata: any) { - return this.i18n(`NFS {{nfs_id}}`, { - nfs_id: `'${metadata.cluster_id}:${metadata.export_id ? metadata.export_id : metadata.path}'` - }); + return $localize`NFS '${metadata.cluster_id}\:${ + metadata.export_id ? metadata.export_id : metadata.path + }'`; } _getTaskTitle(task: Task) { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-wrapper.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-wrapper.service.spec.ts index 698b2affa2c..2d64dd191da 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-wrapper.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-wrapper.service.spec.ts @@ -5,7 +5,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { ToastrModule } from 'ngx-toastr'; import { Observable } from 'rxjs'; -import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper'; +import { configureTestBed } from '../../../testing/unit-test-helper'; import { FinishedTask } from '../models/finished-task'; import { SharedModule } from '../shared.module'; import { NotificationService } from './notification.service'; @@ -18,7 +18,7 @@ describe('TaskWrapperService', () => { configureTestBed({ imports: [HttpClientTestingModule, ToastrModule.forRoot(), SharedModule, RouterTestingModule], - providers: [TaskWrapperService, i18nProviders] + providers: [TaskWrapperService] }); beforeEach(inject([TaskWrapperService], (wrapper: TaskWrapperService) => { diff --git a/src/pybind/mgr/dashboard/frontend/src/setupJest.ts b/src/pybind/mgr/dashboard/frontend/src/setupJest.ts index 9ff62e11236..8fc004375a2 100644 --- a/src/pybind/mgr/dashboard/frontend/src/setupJest.ts +++ b/src/pybind/mgr/dashboard/frontend/src/setupJest.ts @@ -1,3 +1,5 @@ +import '@angular/localize/init'; + import 'jest-preset-angular'; import './jestGlobalMocks'; diff --git a/src/pybind/mgr/dashboard/frontend/src/testing/unit-test-helper.ts b/src/pybind/mgr/dashboard/frontend/src/testing/unit-test-helper.ts index da024dc1990..c260a6fe0c1 100644 --- a/src/pybind/mgr/dashboard/frontend/src/testing/unit-test-helper.ts +++ b/src/pybind/mgr/dashboard/frontend/src/testing/unit-test-helper.ts @@ -1,11 +1,10 @@ -import { DebugElement, LOCALE_ID, TRANSLATIONS, TRANSLATIONS_FORMAT, Type } from '@angular/core'; +import { DebugElement, Type } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { AbstractControl } from '@angular/forms'; import { By } from '@angular/platform-browser'; import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing'; import { NgbModal, NgbNav, NgbNavItem } from '@ng-bootstrap/ng-bootstrap'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import { configureTestSuite } from 'ng-bullet'; import { InventoryDevice } from '../app/ceph/cluster/inventory/inventory-devices/inventory-device.model'; @@ -339,24 +338,6 @@ export class PrometheusHelper { } } -const XLIFF = ` - - - - - - -`; - -const i18nProviders = [ - { provide: TRANSLATIONS_FORMAT, useValue: 'xlf' }, - { provide: TRANSLATIONS, useValue: XLIFF }, - { provide: LOCALE_ID, useValue: 'en' }, - I18n -]; - -export { i18nProviders }; - export function expectItemTasks(item: any, executing: string, percentage?: number) { if (executing) { executing = executing + '...';