filter(s){ let type_filter = this.props.filter || {} if (type_filter.traits){ const check = {has: s.traits, all: type_filter.traits} if (!utils.match_traits(check)) return false } let desc = `${s.name || ""} ${s.description}`.toLocaleLowerCase() for (let f of this.state.filter){ if (desc.indexOf(f)<0) return false } return true }
categorize(items){ let cloud=[] let server=[] let other=[] for (const i of items){ if (utils.match_traits({has: i.traits, all: ["cloud"]})) cloud.push(i) else if (utils.match_traits({has: i.traits, all: ["server"]})) server.push(i) else other.push(i) } let by_category = {} if (cloud.length>0) by_category[i18n("Cloud")] = cloud if (server.length>0) by_category[i18n("Server")] = server if (other.length>0) by_category[i18n("Other")] = other return by_category }
candidates={props.services.filter((c) => match_traits({any: c.traits, has: s.traits}))}