Merge "Don't show plugin loading error toast on timeout"
diff --git a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-js-api-interface_test.html b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-js-api-interface_test.html
index 42bfc6a..d9fdc59 100644
--- a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-js-api-interface_test.html
+++ b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-js-api-interface_test.html
@@ -351,6 +351,16 @@
       return Gerrit.awaitPluginsLoaded();
     });
 
+    test('plugin install errors shows toasts', () => {
+      const alertStub = sandbox.stub();
+      document.addEventListener('show-alert', alertStub);
+      Gerrit._setPluginsCount(1);
+      Gerrit.install(() => {}, '0.0pre-alpha');
+      return Gerrit.awaitPluginsLoaded().then(() => {
+        assert.isTrue(alertStub.calledOnce);
+      });
+    });
+
     test('installGwt calls _pluginInstalled', () => {
       sandbox.stub(Gerrit, '_pluginInstalled');
       Gerrit.installGwt('http://test.com/plugins/testplugin/static/test.js');
diff --git a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-public-js-api.js b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-public-js-api.js
index 60e07e0..ef20206 100644
--- a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-public-js-api.js
+++ b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-public-js-api.js
@@ -34,7 +34,7 @@
     CHANGE_SCREEN_BELOW_CHANGE_INFO_BLOCK: 'change-metadata-item',
   };
 
-  const PLUGIN_LOADING_TIMEOUT_MS = 10000;
+  const PLUGIN_LOADING_TIMEOUT_MS = 60000;
 
   let _restAPI;
   const getRestAPI = () => {
@@ -552,11 +552,6 @@
   };
 
   Gerrit._pluginLoadingTimeout = function() {
-    document.dispatchEvent(new CustomEvent('show-alert', {
-      detail: {
-        message: 'Plugins loading timeout. Check the console for errors.',
-      },
-    }));
     console.error(`Failed to load plugins: ${Object.keys(_pluginsPending)}`);
     Gerrit._setPluginsPending([]);
   };
@@ -580,7 +575,12 @@
   };
 
   Gerrit._pluginInstallError = function(message) {
-    console.log(`Plugin install error: ${message}`);
+    document.dispatchEvent(new CustomEvent('show-alert', {
+      detail: {
+        message: `Plugin install error: ${message}`,
+      },
+    }));
+    console.info(`Plugin install error: ${message}`);
     Gerrit._setPluginsCount(_pluginsPendingCount - 1);
   };