Sha256: 07645eb57eccd165003f5c92b4eff0b45d5ae3e4661ab42dc9a8d9c7a97a5539
Contents?: true
Size: 1.73 KB
Versions: 21
Compression:
Stored size: 1.73 KB
Contents
import Component from "@ember/component"; import { computed } from "@ember/object"; import { buildHashString, clone } from "client-app/lib/utilities"; import Preload from "client-app/lib/preload"; export default Component.extend({ currentEnv: computed("isEnvArray", "currentEnvPosition", function() { if (this.isEnvArray) { return this.message.env[this.currentEnvPosition]; } else { return this.message.env; } }), isEnvArray: computed("message.env", function() { return Array.isArray(this.get("message.env")); }), html: computed("isEnvArray", "currentEnv", "expanded.[]", function() { if (!this.isEnvArray) { return buildHashString(this.get("message.env")); } else { const currentEnv = clone(this.currentEnv); const expandableKeys = Preload.get("env_expandable_keys") || []; expandableKeys.forEach(key => { if (currentEnv.hasOwnProperty(key) && !Array.isArray(currentEnv[key])) { const list = [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]; } }); return buildHashString(currentEnv, false, this.expanded || []); } }), click(e) { const elem = e.target; const dataKey = elem.dataset.key; const expandableKeys = Preload.get("env_expandable_keys") || []; if ( expandableKeys.indexOf(dataKey) !== -1 && elem.classList.contains("expand-list") ) { e.preventDefault(); if (!this.expanded) { this.set("expanded", [dataKey]); } else { this.expanded.pushObject(dataKey); } } } });
Version data entries
21 entries across 21 versions & 1 rubygems