]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
fix review about mgr/dashboard/frontend:Ceph dashboard supports multiple languages 56360/head
authorTomNewChao <chaotomzhu@gmail.com>
Fri, 26 Jan 2024 03:49:05 +0000 (11:49 +0800)
committerRongqi Sun <sunrongqi@huawei.com>
Thu, 21 Mar 2024 08:37:47 +0000 (08:37 +0000)
1.Set the default value of DASHBOARD_FRONTEND_LANGS to 'ALL'.
2.Fix bug about receive the `"ALL"` or `'ALL'`from process.env.DASHBOARD_FRONTEND_LANGS that is not equal 'ALL' in cd.js.
3.When we use the make-dist script to build the front-end UI to release the ceph, we should add DASHBOARD_FRONTEND_LANGS="ALL" to support multiple languages.

Signed-off-by: TomNewChao <chaotomzhu@gmail.com>
(cherry picked from commit 913b52d6eefc1c1c763c03f2e6e54cceae5601ff)

CMakeLists.txt
ceph.spec.in
make-dist
src/pybind/mgr/dashboard/frontend/cd.js
src/pybind/mgr/dashboard/frontend/cypress/e2e/ui/language.e2e-spec.ts

index c4a9df519b026c5eddba1b42e0721d24d1279133..b0fa6c117f663da71bb3e47fca736c813b9d3c23 100644 (file)
@@ -666,7 +666,7 @@ if(WITH_SYSTEM_NPM)
     message(FATAL_ERROR "Can't find npm.")
   endif()
 endif()
-set(DASHBOARD_FRONTEND_LANGS "" CACHE STRING
+set(DASHBOARD_FRONTEND_LANGS "ALL" CACHE STRING
   "List of comma separated ceph-dashboard frontend languages to build. \
   Use value `ALL` to build all languages")
 CMAKE_DEPENDENT_OPTION(WITH_MGR_ROOK_CLIENT "Enable the mgr's Rook support" ON
index 11ee54d9d3183e3141da5b4e6051b5d44eadd1a7..e4cbbef6943b88fdc5882656e8063159efb91763 100644 (file)
@@ -24,7 +24,6 @@
 %bcond_with zbd
 %bcond_with cmake_verbose_logging
 %bcond_without ceph_test_package
-%bcond_without mgr_dashboard_frontend_support_multi_language
 %ifarch s390
 %bcond_with tcmalloc
 %else
@@ -459,9 +458,6 @@ BuildRequires:  libnuma-devel
 %if 0%{?rhel} >= 8
 BuildRequires:  /usr/bin/pathfix.py
 %endif
-%if 0%{with mgr_dashboard_frontend_support_multi_language}
-BuildRequires:  npm
-%endif
 
 %description
 Ceph is a massively scalable, open-source, distributed storage system that runs
@@ -1334,13 +1330,7 @@ cmake .. \
     -DSYSTEMD_SYSTEM_UNIT_DIR:PATH=%{_unitdir} \
     -DWITH_MANPAGE:BOOL=ON \
     -DWITH_PYTHON3:STRING=%{python3_version} \
-%if 0%{with mgr_dashboard_frontend_support_multi_language}
-    -DWITH_MGR_DASHBOARD_FRONTEND:BOOL=ON \
-    -DDASHBOARD_FRONTEND_LANGS:STRING="cs,de,es,fr,id,it,ja,ko,pl,zh-Hans,zh-Hant,pt" \
-    -DWITH_SYSTEM_NPM:BOOL=ON \
-%else
     -DWITH_MGR_DASHBOARD_FRONTEND:BOOL=OFF \
-%endif
 %if 0%{?suse_version}
     -DWITH_RADOSGW_SELECT_PARQUET:BOOL=OFF \
 %endif
index 97ea7a6c8b105b091b798bc9d60e5d97240a5da9..d71c48e8882cb2b59b35cd7e788a5506b0d57ef1 100755 (executable)
--- a/make-dist
+++ b/make-dist
@@ -138,9 +138,9 @@ build_dashboard_frontend() {
   . $TEMP_DIR/bin/activate
   NG_CLI_ANALYTICS=false timeout 1h npm ci
   echo "Building ceph-dashboard frontend with build:localize script";
-  # we need to use "--" because so that "--prod" survives accross all
-  # scripts redirections inside package.json
-  npm run build:localize -- --prod
+  # we need to use "--" because so that "--configuration production"
+  # survives accross all scripts redirections inside package.json
+  DASHBOARD_FRONTEND_LANGS="ALL" npm run build:localize -- --configuration production
   deactivate
   cd $CURR_DIR
   rm -rf $TEMP_DIR
index 34d0ce29f2d3cdc6f67dc7c524003a036d465483..db92308d585fbc8bdbbba6793b90cb34dc6603ea 100755 (executable)
@@ -46,6 +46,7 @@ function prepareLocales() {
   }
 
   let langs = process.env.DASHBOARD_FRONTEND_LANGS || '';
+  langs = langs.replace(/\"\'/g, '')
   if (langs == 'ALL') {
     logger(`Preparing build of all languages.`);
     return;
index fa20f0be542730f774e03b803e46c355454d7cbc..86b170d4320c9c3a32b415f816a8dd0d6621362d 100644 (file)
@@ -14,6 +14,6 @@ describe('Shared pages', () => {
 
   it('should check all available languages', () => {
     language.getLanguageBtn().click();
-    language.getAllLanguages().should('have.length', 1).should('contain.text', 'English');
+    language.getAllLanguages().should('have.length', 13).should('contain.text', 'English');
   });
 });