client-app/app/controllers/index.js in logster-2.1.2 vs client-app/app/controllers/index.js in logster-2.2.0
- old
+ new
@@ -1,12 +1,23 @@
import Controller from "@ember/controller";
import { ajax } from "client-app/lib/utilities";
import { observer, computed } from "@ember/object";
+import Preload from "client-app/lib/preload";
export default Controller.extend({
+ showDebug: true,
+ showInfo: true,
+ showWarn: true,
+ showErr: true,
+ showFatal: true,
+ search: "",
currentMessage: Em.computed.alias("model.currentMessage"),
+ showSettings: computed(function() {
+ return Preload.get("patterns_enabled");
+ }),
+
resizePanels(amount) {
Em.$("#bottom-panel").css("height", amount - 13);
Em.$("#top-panel").css("bottom", amount + 12);
},
@@ -67,11 +78,11 @@
this.set("currentMessage", null);
}
}
},
- filterChanged: observer(
+ filter: computed(
"showDebug",
"showInfo",
"showWarn",
"showErr",
"showFatal",
@@ -83,16 +94,21 @@
}
});
// always show unknown, rare
filter.push(5);
- const model = this.get("model");
- model.set("filter", filter);
- if (this.get("initialized")) {
- model.reload().then(() => this.updateSelectedMessage());
- }
+ return filter;
}
),
+
+ filterChanged: observer("filter.length", function() {
+ const filter = this.get("filter");
+ const model = this.get("model");
+ model.set("filter", filter);
+ if (filter && this.get("initialized")) {
+ model.reload().then(() => this.updateSelectedMessage());
+ }
+ }),
searchChanged: observer("search", function() {
const search = this.get("search");
const model = this.get("model");
model.set("search", search);