Bug 1004506 - Telemetry experiments: Properly handle install states & their transitions in addon manager UI. r=unfocused
authorGeorg Fritzsche <georg.fritzsche@googlemail.com>
Wed, 07 May 2014 20:48:07 +0200
changeset 182872 0f50b9a4d1e66ab7a7d814ffe613fbbe42b8bb93
parent 182871 463a0f7fb61be80f9bbcca7893e8f95f3a92df2e
child 182873 a98ed6c91bf3e5a1514ebb76aa422b54211aa766
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersunfocused
bugs1004506
milestone32.0a1
Bug 1004506 - Telemetry experiments: Properly handle install states & their transitions in addon manager UI. r=unfocused
toolkit/mozapps/extensions/content/extensions.css
toolkit/mozapps/extensions/content/extensions.js
toolkit/mozapps/extensions/content/extensions.xml
--- a/toolkit/mozapps/extensions/content/extensions.css
+++ b/toolkit/mozapps/extensions/content/extensions.css
@@ -245,8 +245,13 @@ richlistitem:not([selected]) * {
 #detail-view[type="experiment"] #detail-creator {
   display: none;
 }
 
 .view-pane:not([type="experiment"]) .experiment-container,
 .view-pane:not([type="experiment"]) #detail-experiment-container {
   display: none;
 }
+
+.addon[type="experiment"][status="installing"] .experiment-time,
+.addon[type="experiment"][status="installing"] .experiment-state {
+  display: none;
+}
--- a/toolkit/mozapps/extensions/content/extensions.js
+++ b/toolkit/mozapps/extensions/content/extensions.js
@@ -2644,16 +2644,23 @@ var gListView = {
     this.removeItem(aInstall, true);
   },
 
   onInstallEnded: function gListView_onInstallEnded(aInstall) {
     // Remove any install entries for upgrades, their status will appear against
     // the existing item
     if (aInstall.existingAddon)
       this.removeItem(aInstall, true);
+
+    if (aInstall.addon.type == "experiment") {
+      let item = this.getListItemForID(aInstall.addon.id);
+      if (item) {
+        item.endDate = getExperimentEndDate(aInstall.addon);
+      }
+    }
   },
 
   addItem: function gListView_addItem(aObj, aIsInstall) {
     if (aObj.type != this._type)
       return;
 
     if (aIsInstall && aObj.existingAddon)
       return;
--- a/toolkit/mozapps/extensions/content/extensions.xml
+++ b/toolkit/mozapps/extensions/content/extensions.xml
@@ -1359,40 +1359,44 @@
 
           let debuggable = this.mAddon.isDebuggable &&
                            Services.prefs.getBoolPref('devtools.chrome.enabled') &&
                            Services.prefs.getBoolPref('devtools.debugger.remote-enabled');
 
           this._debugBtn.disabled = this._debugBtn.hidden = !debuggable
 
           if (this.mAddon.type == "experiment") {
+            this.removeAttribute("notification");
             let prefix = "experiment.";
             let active = this.mAddon.isActive;
 
-            let stateKey = prefix + "state." + (active ? "active" : "complete");
-            this._experimentState.value = gStrings.ext.GetStringFromName(stateKey);
+            if (!showProgress) {
+              let stateKey = prefix + "state." + (active ? "active" : "complete");
+              this._experimentState.value = gStrings.ext.GetStringFromName(stateKey);
 
-            let now = Date.now();
-            let end = this.endDate;
-            let days = Math.abs(end - now) / (24 * 60 * 60 * 1000);
+              let now = Date.now();
+              let end = this.endDate;
+              let days = Math.abs(end - now) / (24 * 60 * 60 * 1000);
+
+              let timeKey = prefix + "time.";
+              let timeMessage;
 
-            let timeKey = prefix + "time.";
-            let timeMessage;
-            if (days < 1) {
-              timeKey += (active ? "endsToday" : "endedToday");
-              timeMessage = gStrings.ext.GetStringFromName(timeKey);
-            } else {
-              timeKey += (active ? "daysRemaining" : "daysPassed");
-              days = Math.round(days);
-              let timeString = gStrings.ext.GetStringFromName(timeKey);
-              timeMessage = PluralForm.get(days, timeString)
-                                      .replace("#1", days);
+              if (days < 1) {
+                timeKey += (active ? "endsToday" : "endedToday");
+                timeMessage = gStrings.ext.GetStringFromName(timeKey);
+              } else {
+                timeKey += (active ? "daysRemaining" : "daysPassed");
+                days = Math.round(days);
+                let timeString = gStrings.ext.GetStringFromName(timeKey);
+                timeMessage = PluralForm.get(days, timeString)
+                                        .replace("#1", days);
+              }
+
+              this._experimentTime.value = timeMessage;
             }
-
-            this._experimentTime.value = timeMessage;
           }
         ]]></body>
       </method>
 
       <method name="_updateUpgradeInfo">
         <body><![CDATA[
           // Only update the version string if we're displaying the upgrade info
           if (this.hasAttribute("upgrade") && shouldShowVersionNumber(this.mAddon))