DEV: Move admin namespace (#87)

DEV: Move admin namespace (#87)

diff --git a/app/routes/discourse.rb b/app/routes/discourse.rb
index 0e3214f..f9fb23d 100644
--- a/app/routes/discourse.rb
+++ b/app/routes/discourse.rb
@@ -1,7 +1,7 @@
 # frozen_string_literal: true
 
 Discourse::Application.routes.append do
-  mount ::DiscourseChatIntegration::AdminEngine, at: '/admin/plugins/chat', constraints: AdminConstraint.new
+  mount ::DiscourseChatIntegration::AdminEngine, at: '/admin/plugins/chat-integration', constraints: AdminConstraint.new
   mount ::DiscourseChatIntegration::PublicEngine, at: '/chat-transcript/', as: 'chat-transcript'
   mount ::DiscourseChatIntegration::Provider::HookEngine, at: '/chat-integration/'
 
diff --git a/assets/javascripts/admin/adapters/channel.js.es6 b/assets/javascripts/admin/adapters/channel.js.es6
index e100dde..2fe5f04 100644
--- a/assets/javascripts/admin/adapters/channel.js.es6
+++ b/assets/javascripts/admin/adapters/channel.js.es6
@@ -1,3 +1,3 @@
 import buildPluginAdapter from "admin/adapters/build-plugin";
 
-export default buildPluginAdapter("chat");
+export default buildPluginAdapter("chat-integration");
diff --git a/assets/javascripts/admin/adapters/provider.js.es6 b/assets/javascripts/admin/adapters/provider.js.es6
index e100dde..2fe5f04 100644
--- a/assets/javascripts/admin/adapters/provider.js.es6
+++ b/assets/javascripts/admin/adapters/provider.js.es6
@@ -1,3 +1,3 @@
 import buildPluginAdapter from "admin/adapters/build-plugin";
 
-export default buildPluginAdapter("chat");
+export default buildPluginAdapter("chat-integration");
diff --git a/assets/javascripts/admin/adapters/rule.js.es6 b/assets/javascripts/admin/adapters/rule.js.es6
index e100dde..2fe5f04 100644
--- a/assets/javascripts/admin/adapters/rule.js.es6
+++ b/assets/javascripts/admin/adapters/rule.js.es6
@@ -1,3 +1,3 @@
 import buildPluginAdapter from "admin/adapters/build-plugin";
 
-export default buildPluginAdapter("chat");
+export default buildPluginAdapter("chat-integration");
diff --git a/assets/javascripts/admin/chat-integration-route-map.js.es6 b/assets/javascripts/admin/chat-integration-route-map.js.es6
new file mode 100644
index 0000000..786a660
--- /dev/null
+++ b/assets/javascripts/admin/chat-integration-route-map.js.es6
@@ -0,0 +1,9 @@
+export default {
+  resource: "admin.adminPlugins",
+  path: "/plugins",
+  map() {
+    this.route("chat-integration", function () {
+      this.route("provider", { path: "/:provider" });
+    });
+  },
+};
diff --git a/assets/javascripts/admin/chat-route-map.js.es6 b/assets/javascripts/admin/chat-route-map.js.es6
deleted file mode 100644
index 201c5b6..0000000
--- a/assets/javascripts/admin/chat-route-map.js.es6
+++ /dev/null
@@ -1,9 +0,0 @@
-export default {
-  resource: "admin.adminPlugins",
-  path: "/plugins",
-  map() {
-    this.route("chat", function () {
-      this.route("provider", { path: "/:provider" });
-    });
-  },
-};
diff --git a/assets/javascripts/admin/controllers/admin-plugins-chat-integration-provider.js.es6 b/assets/javascripts/admin/controllers/admin-plugins-chat-integration-provider.js.es6
new file mode 100644
index 0000000..0e5176b
--- /dev/null
+++ b/assets/javascripts/admin/controllers/admin-plugins-chat-integration-provider.js.es6
@@ -0,0 +1,104 @@
+import showModal from "discourse/lib/show-modal";
+import computed from "discourse-common/utils/decorators";
+
+export default Ember.Controller.extend({
+  modalShowing: false,
+
+  @computed("model.channels")
+  anyErrors(channels) {
+    let anyErrors = false;
+
+    channels.forEach((channel) => {
+      if (channel.error_key) {
+        anyErrors = true;
+      }
+    });
+
+    return anyErrors;
+  },
+
+  actions: {
+    createChannel() {
+      this.set("modalShowing", true);
+
+      const model = {
+        channel: this.store.createRecord("channel", {
+          provider: this.get("model.provider.id"),
+          data: {},
+        }),
+        provider: this.get("model.provider"),
+      };
+
+      showModal("admin-plugins-chat-integration-edit-channel", {
+        model,
+        admin: true,
+      });
+    },
+
+    editChannel(channel) {
+      this.set("modalShowing", true);
+
+      const model = {
+        channel,
+        provider: this.get("model.provider"),
+      };
+
+      showModal("admin-plugins-chat-integration-edit-channel", {
+        model,
+        admin: true,
+      });
+    },
+
+    testChannel(channel) {
+      this.set("modalShowing", true);
+      showModal("admin-plugins-chat-integration-test", {
+        model: { channel },
+        admin: true,
+      });
+    },
+
+    createRule(channel) {
+      this.set("modalShowing", true);
+
+      const model = {
+        rule: this.store.createRecord("rule", {
+          channel_id: channel.id,
+          channel,
+        }),
+        channel,
+        provider: this.get("model.provider"),
+        groups: this.get("model.groups"),
+      };
+
+      showModal("admin-plugins-chat-integration-edit-rule", {
+        model,
+        admin: true,
+      });
+    },
+
+    editRuleWithChannel(rule, channel) {
+      this.set("modalShowing", true);
+
+      const model = {
+        rule,
+        channel,
+        provider: this.get("model.provider"),
+        groups: this.get("model.groups"),
+      };
+
+      showModal("admin-plugins-chat-integration-edit-rule", {
+        model,
+        admin: true,
+      });
+    },
+
+    showError(channel) {
+      this.set("modalShowing", true);
+
+      showModal("admin-plugins-chat-integration-channel-error", {
+        model: channel,
+        admin: true,
+      });
+    },
+  },
+});
diff --git a/assets/javascripts/admin/controllers/admin-plugins-chat-integration.js.es6 b/assets/javascripts/admin/controllers/admin-plugins-chat-integration.js.es6
new file mode 100644
index 0000000..2d3f960
--- /dev/null
+++ b/assets/javascripts/admin/controllers/admin-plugins-chat-integration.js.es6
@@ -0,0 +1 @@
+export default Ember.Controller.extend({});
diff --git a/assets/javascripts/admin/controllers/admin-plugins-chat-provider.js.es6 b/assets/javascripts/admin/controllers/admin-plugins-chat-provider.js.es6
deleted file mode 100644
index a2176db..0000000
--- a/assets/javascripts/admin/controllers/admin-plugins-chat-provider.js.es6
+++ /dev/null
@@ -1,98 +0,0 @@
-import showModal from "discourse/lib/show-modal";
-import computed from "discourse-common/utils/decorators";
-
-export default Ember.Controller.extend({
-  modalShowing: false,
-
-  @computed("model.channels")
-  anyErrors(channels) {
-    let anyErrors = false;
-
-    channels.forEach((channel) => {
-      if (channel.error_key) {
-        anyErrors = true;
-      }
-    });
-
-    return anyErrors;
-  },
-
-  actions: {
-    createChannel() {
-      this.set("modalShowing", true);
-
-      const model = {
-        channel: this.store.createRecord("channel", {
-          provider: this.get("model.provider.id"),
-          data: {},
-        }),
-        provider: this.get("model.provider"),
-      };
-
-      showModal("admin-plugins-chat-edit-channel", {
-        model,
-        admin: true,
-      });
-    },
-
-    editChannel(channel) {
-      this.set("modalShowing", true);
-
-      const model = {
-        channel,
-        provider: this.get("model.provider"),
-      };
-
-      showModal("admin-plugins-chat-edit-channel", {
-        model,
-        admin: true,
-      });
-    },
-
-    testChannel(channel) {
-      this.set("modalShowing", true);
-      showModal("admin-plugins-chat-test", {
-        model: { channel },
-        admin: true,
-      });
-    },
-
-    createRule(channel) {
-      this.set("modalShowing", true);
-
-      const model = {
-        rule: this.store.createRecord("rule", {
-          channel_id: channel.id,
-          channel,
-        }),
-        channel,
-        provider: this.get("model.provider"),
-        groups: this.get("model.groups"),
-      };
-
-      showModal("admin-plugins-chat-edit-rule", { model, admin: true });
-    },
-

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

GitHub sha: a8b7e9631ba12f60467fceccb76e3d1f402bb35a

This commit appears in #87 which was approved by davidtaylorhq. It was merged by markvanlan.