client-app/app/components/env-tab.js in logster-2.5.1 vs client-app/app/components/env-tab.js in logster-2.6.0
- old
+ new
@@ -2,14 +2,10 @@
import { computed } from "@ember/object";
import { buildHashString } from "client-app/lib/utilities";
import Preload from "client-app/lib/preload";
export default Component.extend({
- didUpdateAttrs() {
- this.set("expanded", null);
- },
-
currentEnv: computed("isEnvArray", "currentEnvPosition", function() {
if (this.isEnvArray) {
return this.message.env[this.currentEnvPosition];
} else {
return this.message.env;
@@ -22,33 +18,41 @@
html: computed("isEnvArray", "currentEnv", "expanded.[]", function() {
if (!this.isEnvArray) {
return buildHashString(this.get("message.env"));
} else {
- const currentEnv = Em.$.extend({}, this.currentEnv);
const expandableKeys = Preload.get("env_expandable_keys") || [];
+ const expandedLists = {};
expandableKeys.forEach(key => {
- if (currentEnv.hasOwnProperty(key) && !Array.isArray(currentEnv[key])) {
- const list = [currentEnv[key]];
+ if (
+ Object.prototype.hasOwnProperty.call(this.currentEnv, key) &&
+ !Array.isArray(this.currentEnv[key])
+ ) {
+ const list = [this.currentEnv[key]];
this.message.env.forEach(env => {
if (env[key] && list.indexOf(env[key]) === -1) {
list.push(env[key]);
}
});
- currentEnv[key] = list.length > 1 ? list : list[0];
+ expandedLists[key] = list;
}
});
- return buildHashString(currentEnv, false, this.expanded || []);
+ return buildHashString(
+ this.currentEnv,
+ false,
+ this.expanded,
+ expandedLists
+ );
}
}),
click(e) {
- const $elem = Em.$(e.target);
- const dataKey = $elem.attr("data-key");
+ const elem = e.target;
+ const dataKey = elem.dataset.key;
const expandableKeys = Preload.get("env_expandable_keys") || [];
if (
expandableKeys.indexOf(dataKey) !== -1 &&
- $elem.hasClass("expand-list")
+ elem.classList.contains("expand-list")
) {
e.preventDefault();
if (!this.expanded) {
this.set("expanded", [dataKey]);
} else {