[TASK] Show better error messages on failed TER update 88/18688/4
authorJost Baron <jost.baron@gmx.de>
Mon, 4 Mar 2013 21:38:01 +0000 (22:38 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Mon, 11 Mar 2013 20:58:33 +0000 (21:58 +0100)
This patch shows error messages in a flash message if the ajax request
for a TER-update fails, and resets the extension manager into a sane
state, instead of showing an ever spinning wheel.

Resolves: #46030
Releases: 6.1
Change-Id: I1cc67460a11feb206c53c12a38ad0f6db482e04a
Reviewed-on: https://review.typo3.org/18688
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/extensionmanager/Resources/Public/JavaScript/main.js
typo3/sysext/extensionmanager/Resources/Public/JavaScript/update.js

index c3622aa..07fbd83 100644 (file)
        }
 
        function resetSearchField() {
-               var dataTablesFilter = find(".dataTables_filter");
                $('.dataTables_wrapper').find('.dataTables_filter').append($('<span />', {
                        'class':'t3-icon t3-icon-actions t3-icon-actions-input t3-icon-input-clear t3-tceforms-input-clearer',
                        'id':'resetSearch',
index f5be476..8140685 100644 (file)
@@ -39,9 +39,6 @@
                        dataType: 'json',
                        success: function(data) {
 
-                               // Hide loader
-                               $('.splash-receivedata').removeClass('is-shown');
-
                                // Something went wrong, show message
                                if (data.errorMessage.length) {
                                        TYPO3.Flashmessage.display(TYPO3.Severity.warning, TYPO3.l10n.localize('extensionList.updateFromTerFlashMessage.title'), data.errorMessage, 10);
                                        data.message
                                );
 
-                               // Show content
-                               $('#terTable_wrapper').removeClass('is-loading');
-
-                               // Header: Show message
-                               $('.typo3-extensionmanager-headerRowRight .splash-receivedata').removeClass('is-hidden');
-
                                if (data.updated) {
                                        $.ajax({
                                                url: window.location.href + '&tx_extensionmanager_tools_extensionmanagerextensionmanager%5Bformat%5D=json',
                                                }
                                        });
                                }
+                       },
+                       error: function(jqXHR, textStatus, errorThrown) {
+                               // Create an error message with diagnosis info.
+                               var errorMessage = textStatus + '(' + errorThrown + '): ' + jqXHR.responseText;
+
+
+                               TYPO3.Flashmessage.display(
+                                       TYPO3.Severity.warning,
+                                       TYPO3.l10n.localize('extensionList.updateFromTerFlashMessage.title'),
+                                       errorMessage,
+                                       10
+                               );
+                       },
+                       complete: function() {
+
+                               // Hide loader
+                               $('.splash-receivedata').removeClass('is-shown');
+
+                               // Show content
+                               $('#terTable_wrapper').removeClass('is-loading');
+
+                               // Header: Show message
+                               $('.typo3-extensionmanager-headerRowRight .splash-receivedata').removeClass('is-hidden');
                        }
                });
        }