DEV: Move computed to discourseComputed (#8312)

DEV: Move computed to discourseComputed (#8312)

diff --git a/app/assets/javascripts/admin/components/ace-editor.js.es6 b/app/assets/javascripts/admin/components/ace-editor.js.es6
index 60498a0bdb..4fc881dae4 100644
--- a/app/assets/javascripts/admin/components/ace-editor.js.es6
+++ b/app/assets/javascripts/admin/components/ace-editor.js.es6
@@ -1,6 +1,6 @@
 import Component from "@ember/component";
 import loadScript from "discourse/lib/load-script";
-import { observes } from "ember-addons/ember-computed-decorators";
+import { observes } from "discourse-common/utils/decorators";
 import { on } from "@ember/object/evented";
 
 export default Component.extend({
diff --git a/app/assets/javascripts/admin/components/admin-backups-logs.js.es6 b/app/assets/javascripts/admin/components/admin-backups-logs.js.es6
index ccacb2e705..72706af79f 100644
--- a/app/assets/javascripts/admin/components/admin-backups-logs.js.es6
+++ b/app/assets/javascripts/admin/components/admin-backups-logs.js.es6
@@ -4,7 +4,7 @@ import debounce from "discourse/lib/debounce";
 import { renderSpinner } from "discourse/helpers/loading-spinner";
 import { escapeExpression } from "discourse/lib/utilities";
 import { bufferedRender } from "discourse-common/lib/buffered-render";
-import { observes, on } from "ember-addons/ember-computed-decorators";
+import { observes, on } from "discourse-common/utils/decorators";
 
 export default Component.extend(
   bufferedRender({
diff --git a/app/assets/javascripts/admin/components/admin-report-storage-stats.js.es6 b/app/assets/javascripts/admin/components/admin-report-storage-stats.js.es6
index 948ecf1e87..61629c626e 100644
--- a/app/assets/javascripts/admin/components/admin-report-storage-stats.js.es6
+++ b/app/assets/javascripts/admin/components/admin-report-storage-stats.js.es6
@@ -1,7 +1,7 @@
+import discourseComputed from "discourse-common/utils/decorators";
 import { alias } from "@ember/object/computed";
 import Component from "@ember/component";
 import { setting } from "discourse/lib/computed";
-import computed from "ember-addons/ember-computed-decorators";
 
 export default Component.extend({
   classNames: ["admin-report-storage-stats"],
@@ -10,32 +10,32 @@ export default Component.extend({
   backupStats: alias("model.data.backups"),
   uploadStats: alias("model.data.uploads"),
 
-  @computed("backupStats")
+  @discourseComputed("backupStats")
   showBackupStats(stats) {
     return stats && this.currentUser.admin;
   },
 
-  @computed("backupLocation")
+  @discourseComputed("backupLocation")
   backupLocationName(backupLocation) {
     return I18n.t(`admin.backups.location.${backupLocation}`);
   },
 
-  @computed("backupStats.used_bytes")
+  @discourseComputed("backupStats.used_bytes")
   usedBackupSpace(bytes) {
     return I18n.toHumanSize(bytes);
   },
 
-  @computed("backupStats.free_bytes")
+  @discourseComputed("backupStats.free_bytes")
   freeBackupSpace(bytes) {
     return I18n.toHumanSize(bytes);
   },
 
-  @computed("uploadStats.used_bytes")
+  @discourseComputed("uploadStats.used_bytes")
   usedUploadSpace(bytes) {
     return I18n.toHumanSize(bytes);
   },
 
-  @computed("uploadStats.free_bytes")
+  @discourseComputed("uploadStats.free_bytes")
   freeUploadSpace(bytes) {
     return I18n.toHumanSize(bytes);
   }
diff --git a/app/assets/javascripts/admin/components/admin-report-table-cell.js.es6 b/app/assets/javascripts/admin/components/admin-report-table-cell.js.es6
index f83a33dbfb..e7bf688f2f 100644
--- a/app/assets/javascripts/admin/components/admin-report-table-cell.js.es6
+++ b/app/assets/javascripts/admin/components/admin-report-table-cell.js.es6
@@ -1,6 +1,6 @@
+import discourseComputed from "discourse-common/utils/decorators";
 import { alias } from "@ember/object/computed";
 import Component from "@ember/component";
-import computed from "ember-addons/ember-computed-decorators";
 
 export default Component.extend({
   tagName: "td",
@@ -8,7 +8,7 @@ export default Component.extend({
   classNameBindings: ["type", "property"],
   options: null,
 
-  @computed("label", "data", "options")
+  @discourseComputed("label", "data", "options")
   computedLabel(label, data, options) {
     return label.compute(data, options || {});
   },
diff --git a/app/assets/javascripts/admin/components/admin-report-table-header.js.es6 b/app/assets/javascripts/admin/components/admin-report-table-header.js.es6
index 9317ef1f66..bc5633b21d 100644
--- a/app/assets/javascripts/admin/components/admin-report-table-header.js.es6
+++ b/app/assets/javascripts/admin/components/admin-report-table-header.js.es6
@@ -1,5 +1,5 @@
+import discourseComputed from "discourse-common/utils/decorators";
 import Component from "@ember/component";
-import computed from "ember-addons/ember-computed-decorators";
 
 export default Component.extend({
   tagName: "th",
@@ -7,12 +7,12 @@ export default Component.extend({
   classNameBindings: ["label.mainProperty", "label.type", "isCurrentSort"],
   attributeBindings: ["label.title:title"],
 
-  @computed("currentSortLabel.sortProperty", "label.sortProperty")
+  @discourseComputed("currentSortLabel.sortProperty", "label.sortProperty")
   isCurrentSort(currentSortField, labelSortField) {
     return currentSortField === labelSortField;
   },
 
-  @computed("currentSortDirection")
+  @discourseComputed("currentSortDirection")
   sortIcon(currentSortDirection) {
     return currentSortDirection === 1 ? "caret-up" : "caret-down";
   }
diff --git a/app/assets/javascripts/admin/components/admin-report-table.js.es6 b/app/assets/javascripts/admin/components/admin-report-table.js.es6
index 38e00c8ab8..aa636224d4 100644
--- a/app/assets/javascripts/admin/components/admin-report-table.js.es6
+++ b/app/assets/javascripts/admin/components/admin-report-table.js.es6
@@ -1,7 +1,7 @@
+import discourseComputed from "discourse-common/utils/decorators";
 import { makeArray } from "discourse-common/lib/helpers";
 import { alias } from "@ember/object/computed";
 import Component from "@ember/component";
-import computed from "ember-addons/ember-computed-decorators";
 
 const PAGES_LIMIT = 8;
 
@@ -13,12 +13,16 @@ export default Component.extend({
   perPage: alias("options.perPage"),
   page: 0,
 
-  @computed("model.computedLabels.length")
+  @discourseComputed("model.computedLabels.length")
   twoColumns(labelsLength) {
     return labelsLength === 2;
   },
 
-  @computed("totalsForSample", "options.total", "model.dates_filtering")
+  @discourseComputed(
+    "totalsForSample",
+    "options.total",
+    "model.dates_filtering"
+  )
   showTotalForSample(totalsForSample, total, datesFiltering) {
     // check if we have at least one cell which contains a value
     const sum = totalsForSample
@@ -29,12 +33,16 @@ export default Component.extend({
     return sum >= 1 && total && datesFiltering;
   },
 
-  @computed("model.total", "options.total", "twoColumns")
+  @discourseComputed("model.total", "options.total", "twoColumns")
   showTotal(reportTotal, total, twoColumns) {
     return reportTotal && total && twoColumns;
   },
 
-  @computed("model.{average,data}", "totalsForSample.1.value", "twoColumns")
+  @discourseComputed(
+    "model.{average,data}",
+    "totalsForSample.1.value",
+    "twoColumns"
+  )
   showAverage(model, sampleTotalValue, hasTwoColumns) {
     return (
       model.average &&
@@ -44,17 +52,17 @@ export default Component.extend({
     );
   },
 
-  @computed("totalsForSample.1.value", "model.data.length")
+  @discourseComputed("totalsForSample.1.value", "model.data.length")
   averageForSample(totals, count) {
     return (totals / count).toFixed(0);
   },
 
-  @computed("model.data.length")
+  @discourseComputed("model.data.length")
   showSortingUI(dataLength) {
     return dataLength >= 5;
   },
 
-  @computed("totalsForSampleRow", "model.computedLabels")
+  @discourseComputed("totalsForSampleRow", "model.computedLabels")
   totalsForSample(row, labels) {
     return labels.map(label => {
       const computedLabel = label.compute(row);
@@ -64,7 +72,7 @@ export default Component.extend({
     });

[... diff too long, it was truncated ...]

GitHub sha: 6275c05c