client-app/app/models/message-collection.js in logster-2.5.1 vs client-app/app/models/message-collection.js in logster-2.6.0
- old
+ new
@@ -84,17 +84,18 @@
envChanged(newPosition) {
this.set("currentEnvPosition", newPosition);
this.fetchEnv();
},
- fetchEnv() {
+ fetchEnv(opts = {}) {
const message = this.currentMessage;
- if (message && !message.env && this.currentTab === "env") {
+ if (
+ opts["force"] ||
+ (message && !message.env && this.currentTab === "env")
+ ) {
this.set("loadingEnv", true);
- return ajax(`/fetch-env/${message.key}.json`)
- .then(env => message.set("env", env))
- .always(() => this.set("loadingEnv", false));
+ return message.fetchEnv().finally(() => this.set("loadingEnv", false));
}
},
findEquivalentMessageIndex(row) {
let messageIndex = 0;
@@ -133,11 +134,11 @@
const data = {
filter: this.filter.join("_")
};
- if (!_.isEmpty(this.search)) {
+ if (this.search && this.search.length > 0) {
data.search = this.search;
const regexSearch = this.regexSearch;
if (regexSearch) {
data.regex_search = "true";
}
@@ -193,11 +194,11 @@
}
}
this.set("total", data.total);
return data;
})
- .always(() => this.set("loading", false));
+ .finally(() => this.set("loading", false));
},
reload() {
this.set("total", 0);
this.rows.clear();
@@ -267,9 +268,10 @@
} catch (err) {
// don't care
}
}
}
+ return null;
}),
toObjects(rows) {
return rows.map(m => {
if (m.group) {