Santhosh has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/395720 )

Change subject: Fix: When cxserver is down, Dashboard is empty page
......................................................................

Fix: When cxserver is down, Dashboard is empty page

We should show error message that the cxserver is not reachable.

Due to a regression from accessing language pairs from cxserver
early, the error message from the hook has no effect since there
no header rendered in the screen.

This commit is fixing this by rendering main components before
the language pairs are requested. Also making sure the message
is added to RL module definition.

To test, shutdown cxserver and then access CX dashboard.

Change-Id: Ib60c4568117fc79c09bf864ab8466bd36015177c
---
M extension.json
M modules/base/ext.cx.sitemapper.js
M modules/dashboard/ext.cx.dashboard.js
3 files changed, 12 insertions(+), 7 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/20/395720/1

diff --git a/extension.json b/extension.json
index 204c8dc..83ca79a 100644
--- a/extension.json
+++ b/extension.json
@@ -251,14 +251,15 @@
                        ],
                        "messages": [
                                "cx-create-new-translation",
-                               "cx-dashboard-sidebar-title",
+                               "cx-create-new-translation",
+                               "cx-dashboard-sidebar-feedback",
                                "cx-dashboard-sidebar-information",
                                "cx-dashboard-sidebar-stats",
-                               "cx-dashboard-sidebar-feedback",
-                               "cx-create-new-translation",
-                               "cx-translation-filter-suggested-translations",
+                               "cx-dashboard-sidebar-title",
+                               "cx-error-server-connection",
+                               "cx-translation-filter-draft-translations",
                                "cx-translation-filter-published-translations",
-                               "cx-translation-filter-draft-translations"
+                               "cx-translation-filter-suggested-translations"
                        ]
                },
                "ext.cx.util": {
diff --git a/modules/base/ext.cx.sitemapper.js 
b/modules/base/ext.cx.sitemapper.js
index aa11fa7..1ca5b39 100644
--- a/modules/base/ext.cx.sitemapper.js
+++ b/modules/base/ext.cx.sitemapper.js
@@ -179,7 +179,6 @@
                                                response.statusText + ' (' + 
response.status + '). ' +
                                                response.responseText
                                        );
-                                       mw.hook( 'mw.cx.error' ).fire( mw.msg( 
'cx-error-server-connection' ) );
                                        self.languagePairsPromise = null;
                                        return $.Deferred().reject().promise();
                                } );
diff --git a/modules/dashboard/ext.cx.dashboard.js 
b/modules/dashboard/ext.cx.dashboard.js
index 0337c19..da455b3 100644
--- a/modules/dashboard/ext.cx.dashboard.js
+++ b/modules/dashboard/ext.cx.dashboard.js
@@ -76,6 +76,9 @@
                        autonym: mw.msg( 
'cx-translation-filter-uls-all-languages' )
                } );
 
+               // Render the main components
+               this.render();
+
                // Get acceptable source/target language pairs
                this.siteMapper.getLanguagePairs().then( function ( data ) {
                        // We store valid source and target languages as 
"static" variables of LanguageFilter
@@ -83,11 +86,13 @@
                        mw.cx.ui.LanguageFilter.targetLanguages = 
data.targetLanguages;
 
                        self.setDefaultLanguages();
-                       self.render();
+
                        self.initLists();
                        self.listen();
 
                        mw.hook( 'mw.cx.dashboard.ready' ).fire();
+               } ).fail( function () {
+                       mw.hook( 'mw.cx.error' ).fire( mw.msg( 
'cx-error-server-connection' ) );
                } );
        };
 

-- 
To view, visit https://gerrit.wikimedia.org/r/395720
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib60c4568117fc79c09bf864ab8466bd36015177c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh <santhosh.thottin...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to