client-app/app/controllers/index.js in logster-1.3.1 vs client-app/app/controllers/index.js in logster-1.3.2
- old
+ new
@@ -1,83 +1,92 @@
-import Controller from "@ember/controller";
-import { ajax } from "client-app/lib/utilities";
-import { observer } from "@ember/object";
-
-export default Controller.extend({
- currentMessage: Em.computed.alias("model.currentMessage"),
-
- actions: {
- expandMessage(message) {
- message.expand();
- },
-
- selectMessage(message) {
- const old = this.get("currentMessage");
- if (old) {
- old.set("selected", false);
- }
-
- message.set("selected", true);
- this.set("currentMessage", message);
- },
-
- showMoreBefore() {
- this.get("model").showMoreBefore();
- },
-
- loadMore() {
- return this.get("model").loadMore();
- },
-
- clear() {
- if (confirm("Clear the logs?\n\nCancel = No, OK = Clear")) {
- ajax("/clear", { type: "POST" }).then(() => {
- this.get("model").reload();
- });
- }
- },
-
- removeMessage(msg) {
- const messages = this.get("model");
- messages.destroy(msg);
- },
-
- solveMessage(msg) {
- const messages = this.get("model");
- messages.solve(msg);
- }
- },
-
- filterChanged: observer(
- "showDebug",
- "showInfo",
- "showWarn",
- "showErr",
- "showFatal",
- function() {
- const filter = [];
- ["Debug", "Info", "Warn", "Err", "Fatal"].forEach((severity, index) => {
- if (this.get(`show${severity}`)) {
- filter.push(index);
- }
- });
-
- // always show unknown, rare
- filter.push(5);
- const model = this.get("model");
- model.set("filter", filter);
- if (this.get("initialized")) {
- model.reload();
- }
- }
- ),
-
- searchChanged: observer("search", function() {
- const search = this.get("search");
- const model = this.get("model");
- model.set("search", search);
-
- if (this.get("initialized")) {
- model.reload();
- }
- })
-});
+import Controller from "@ember/controller";
+import { ajax } from "client-app/lib/utilities";
+import { observer, computed } from "@ember/object";
+
+export default Controller.extend({
+ currentMessage: Em.computed.alias("model.currentMessage"),
+
+ resizePanels(amount) {
+ Em.$("#bottom-panel").css("height", amount - 10);
+ Em.$("#top-panel").css("bottom", amount + 12);
+ },
+
+ actionsInMenu: computed(function() {
+ return this.site.isMobile;
+ }),
+
+ actions: {
+ expandMessage(message) {
+ message.expand();
+ },
+
+ selectMessage(message) {
+ const old = this.get("currentMessage");
+ if (old) {
+ old.set("selected", false);
+ }
+
+ message.set("selected", true);
+ this.set("currentMessage", message);
+ },
+
+ showMoreBefore() {
+ this.get("model").showMoreBefore();
+ },
+
+ loadMore() {
+ return this.get("model").loadMore();
+ },
+
+ clear() {
+ if (confirm("Clear the logs?\n\nCancel = No, OK = Clear")) {
+ ajax("/clear", { type: "POST" }).then(() => {
+ this.get("model").reload();
+ });
+ }
+ },
+
+ removeMessage(msg) {
+ const messages = this.get("model");
+ messages.destroy(msg);
+ },
+
+ solveMessage(msg) {
+ const messages = this.get("model");
+ messages.solve(msg);
+ }
+ },
+
+ filterChanged: observer(
+ "showDebug",
+ "showInfo",
+ "showWarn",
+ "showErr",
+ "showFatal",
+ function() {
+ const filter = [];
+ ["Debug", "Info", "Warn", "Err", "Fatal"].forEach((severity, index) => {
+ if (this.get(`show${severity}`)) {
+ filter.push(index);
+ }
+ });
+
+ // always show unknown, rare
+ filter.push(5);
+ const model = this.get("model");
+ model.set("filter", filter);
+ if (this.get("initialized")) {
+ model.reload();
+ }
+ }
+ ),
+
+ searchChanged: observer("search", function() {
+ const search = this.get("search");
+ const model = this.get("model");
+ model.set("search", search);
+
+ if (this.get("initialized")) {
+ model.reload();
+ }
+ })
+});