REFACTOR: Support bundling our `admin` section as an ember addon

REFACTOR: Support bundling our admin section as an ember addon

diff --git a/.gitignore b/.gitignore
index 0a8b037..6322b83 100644
--- a/.gitignore
+++ b/.gitignore
@@ -141,3 +141,5 @@ dist
 
 # Copyright Deposits
 copyright
+
+yarn-error.log
diff --git a/app/assets/javascripts/admin/adapters/api-key.js b/app/assets/javascripts/admin/adapters/api-key.js
deleted file mode 100644
index 860e4c5..0000000
--- a/app/assets/javascripts/admin/adapters/api-key.js
+++ /dev/null
@@ -1,13 +0,0 @@
-import RESTAdapter from "discourse/adapters/rest";
-
-export default RESTAdapter.extend({
-  jsonMode: true,
-
-  basePath() {
-    return "/admin/api/";
-  },
-
-  apiNameFor() {
-    return "key";
-  },
-});
diff --git a/app/assets/javascripts/admin/adapters/build-plugin.js b/app/assets/javascripts/admin/adapters/build-plugin.js
deleted file mode 100644
index 3a81ab4..0000000
--- a/app/assets/javascripts/admin/adapters/build-plugin.js
+++ /dev/null
@@ -1,11 +0,0 @@
-import RestAdapter from "discourse/adapters/rest";
-
-export default function buildPluginAdapter(pluginName) {
-  return RestAdapter.extend({
-    pathFor(store, type, findArgs) {
-      return (
-        "/admin/plugins/" + pluginName + this._super(store, type, findArgs)
-      );
-    },
-  });
-}
diff --git a/app/assets/javascripts/admin/adapters/customization-base.js b/app/assets/javascripts/admin/adapters/customization-base.js
deleted file mode 100644
index 272103e..0000000
--- a/app/assets/javascripts/admin/adapters/customization-base.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import RestAdapter from "discourse/adapters/rest";
-
-export default RestAdapter.extend({
-  basePath() {
-    return "/admin/customize/";
-  },
-});
diff --git a/app/assets/javascripts/admin/adapters/email-style.js b/app/assets/javascripts/admin/adapters/email-style.js
deleted file mode 100644
index 12919f0..0000000
--- a/app/assets/javascripts/admin/adapters/email-style.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import RestAdapter from "discourse/adapters/rest";
-
-export default RestAdapter.extend({
-  pathFor() {
-    return "/admin/customize/email_style";
-  },
-});
diff --git a/app/assets/javascripts/admin/adapters/embedding.js b/app/assets/javascripts/admin/adapters/embedding.js
deleted file mode 100644
index ba3fb81..0000000
--- a/app/assets/javascripts/admin/adapters/embedding.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import RestAdapter from "discourse/adapters/rest";
-
-export default RestAdapter.extend({
-  pathFor() {
-    return "/admin/customize/embedding";
-  },
-});
diff --git a/app/assets/javascripts/admin/adapters/site-text.js b/app/assets/javascripts/admin/adapters/site-text.js
deleted file mode 100644
index f362b06..0000000
--- a/app/assets/javascripts/admin/adapters/site-text.js
+++ /dev/null
@@ -1,2 +0,0 @@
-import CustomizationBase from "admin/adapters/customization-base";
-export default CustomizationBase;
diff --git a/app/assets/javascripts/admin/adapters/staff-action-log.js b/app/assets/javascripts/admin/adapters/staff-action-log.js
deleted file mode 100644
index d281f97..0000000
--- a/app/assets/javascripts/admin/adapters/staff-action-log.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import RestAdapter from "discourse/adapters/rest";
-
-export default RestAdapter.extend({
-  basePath() {
-    return "/admin/logs/";
-  },
-});
diff --git a/app/assets/javascripts/admin/adapters/tag-group.js b/app/assets/javascripts/admin/adapters/tag-group.js
deleted file mode 100644
index 4c12654..0000000
--- a/app/assets/javascripts/admin/adapters/tag-group.js
+++ /dev/null
@@ -1,5 +0,0 @@
-import RestAdapter from "discourse/adapters/rest";
-
-export default RestAdapter.extend({
-  jsonMode: true,
-});
diff --git a/app/assets/javascripts/admin/adapters/theme.js b/app/assets/javascripts/admin/adapters/theme.js
deleted file mode 100644
index cf34ab4..0000000
--- a/app/assets/javascripts/admin/adapters/theme.js
+++ /dev/null
@@ -1,26 +0,0 @@
-import RestAdapter from "discourse/adapters/rest";
-
-export default RestAdapter.extend({
-  basePath() {
-    return "/admin/";
-  },
-
-  afterFindAll(results) {
-    let map = {};
-    results.forEach((theme) => {
-      map[theme.id] = theme;
-    });
-    results.forEach((theme) => {
-      let mapped = theme.get("child_themes") || [];
-      mapped = mapped.map((t) => map[t.id]);
-      theme.set("childThemes", mapped);
-
-      let mappedParents = theme.get("parent_themes") || [];
-      mappedParents = mappedParents.map((t) => map[t.id]);
-      theme.set("parentThemes", mappedParents);
-    });
-    return results;
-  },
-
-  jsonMode: true,
-});
diff --git a/app/assets/javascripts/admin/adapters/user-field.js b/app/assets/javascripts/admin/adapters/user-field.js
deleted file mode 100644
index f362b06..0000000
--- a/app/assets/javascripts/admin/adapters/user-field.js
+++ /dev/null
@@ -1,2 +0,0 @@
-import CustomizationBase from "admin/adapters/customization-base";
-export default CustomizationBase;
diff --git a/app/assets/javascripts/admin/adapters/web-hook-event.js b/app/assets/javascripts/admin/adapters/web-hook-event.js
deleted file mode 100644
index 1acd383..0000000
--- a/app/assets/javascripts/admin/adapters/web-hook-event.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import RESTAdapter from "discourse/adapters/rest";
-
-export default RESTAdapter.extend({
-  basePath() {
-    return "/admin/api/";
-  },
-});
diff --git a/app/assets/javascripts/admin/adapters/web-hook.js b/app/assets/javascripts/admin/adapters/web-hook.js
deleted file mode 100644
index 1acd383..0000000
--- a/app/assets/javascripts/admin/adapters/web-hook.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import RESTAdapter from "discourse/adapters/rest";
-
-export default RESTAdapter.extend({
-  basePath() {
-    return "/admin/api/";
-  },
-});
diff --git a/app/assets/javascripts/admin/addon/adapters/api-key.js b/app/assets/javascripts/admin/addon/adapters/api-key.js
new file mode 100644
index 0000000..860e4c5
--- /dev/null
+++ b/app/assets/javascripts/admin/addon/adapters/api-key.js
@@ -0,0 +1,13 @@
+import RESTAdapter from "discourse/adapters/rest";
+
+export default RESTAdapter.extend({
+  jsonMode: true,
+
+  basePath() {
+    return "/admin/api/";
+  },
+
+  apiNameFor() {
+    return "key";
+  },
+});
diff --git a/app/assets/javascripts/admin/addon/adapters/build-plugin.js b/app/assets/javascripts/admin/addon/adapters/build-plugin.js
new file mode 100644
index 0000000..3a81ab4
--- /dev/null
+++ b/app/assets/javascripts/admin/addon/adapters/build-plugin.js
@@ -0,0 +1,11 @@
+import RestAdapter from "discourse/adapters/rest";
+
+export default function buildPluginAdapter(pluginName) {
+  return RestAdapter.extend({
+    pathFor(store, type, findArgs) {
+      return (
+        "/admin/plugins/" + pluginName + this._super(store, type, findArgs)
+      );
+    },
+  });
+}
diff --git a/app/assets/javascripts/admin/addon/adapters/customization-base.js b/app/assets/javascripts/admin/addon/adapters/customization-base.js
new file mode 100644
index 0000000..272103e
--- /dev/null
+++ b/app/assets/javascripts/admin/addon/adapters/customization-base.js
@@ -0,0 +1,7 @@
+import RestAdapter from "discourse/adapters/rest";
+
+export default RestAdapter.extend({
+  basePath() {
+    return "/admin/customize/";
+  },
+});
diff --git a/app/assets/javascripts/admin/addon/adapters/email-style.js b/app/assets/javascripts/admin/addon/adapters/email-style.js
new file mode 100644
index 0000000..12919f0
--- /dev/null
+++ b/app/assets/javascripts/admin/addon/adapters/email-style.js
@@ -0,0 +1,7 @@
+import RestAdapter from "discourse/adapters/rest";
+
+export default RestAdapter.extend({
+  pathFor() {
+    return "/admin/customize/email_style";
+  },
+});
diff --git a/app/assets/javascripts/admin/addon/adapters/embedding.js b/app/assets/javascripts/admin/addon/adapters/embedding.js
new file mode 100644
index 0000000..ba3fb81
--- /dev/null
+++ b/app/assets/javascripts/admin/addon/adapters/embedding.js
@@ -0,0 +1,7 @@
+import RestAdapter from "discourse/adapters/rest";
+
+export default RestAdapter.extend({
+  pathFor() {

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

GitHub sha: ce3fe2f4

1 Like

This commit appears in #10725 which was merged by eviltrout.