further improvements WIP
This commit is contained in:
parent
01d648eb46
commit
fcd1a8b12b
2 changed files with 38 additions and 21 deletions
|
@ -27,9 +27,10 @@
|
||||||
footer {
|
footer {
|
||||||
display: inline-grid;
|
display: inline-grid;
|
||||||
margin: 4em, auto, 0, auto;
|
margin: 4em, auto, 0, auto;
|
||||||
grid-template-columns: 1fr 1fr 1fr;
|
grid-template-columns: 2fr 3fr 1fr;
|
||||||
}
|
}
|
||||||
footer div {
|
footer div {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
|
margin-left: 1em;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -248,33 +248,46 @@
|
||||||
return flat;
|
return flat;
|
||||||
}
|
}
|
||||||
|
|
||||||
// filter technologies based on a list of Categories
|
// filter technologies based on an array of filterables on tech and a list of filters
|
||||||
function filterTechnologiesByCategoryList(technologies, list) {
|
function filterTechnologiesByArray(technologies, field, list) {
|
||||||
//console.log('looking for tech in categories: ', list);
|
|
||||||
const included = [];
|
const included = [];
|
||||||
technologies.forEach(function (tech) {
|
technologies.forEach(function (tech) {
|
||||||
if (hasInstances(tech)) {
|
if (hasInstances(tech)) {
|
||||||
const intersection = inCommon(tech.categories, list);
|
let arr = tech[field]
|
||||||
console.log('for tech: ', tech.name);
|
const intersection = inCommon(arr, list);
|
||||||
console.log('categories: ', tech.categories);
|
|
||||||
console.log('list: ', list);
|
|
||||||
console.log('intersection: ', intersection);
|
|
||||||
if (intersection && intersection.constructor === Array) {
|
if (intersection && intersection.constructor === Array) {
|
||||||
//console.log('found intersection!', intersection.constructor);
|
|
||||||
console.log('intersection length: ', intersection.length);
|
console.log('intersection length: ', intersection.length);
|
||||||
if (intersection.length > 0) {
|
if (intersection.length > 0) {
|
||||||
//console.log('including tech: ', tech);
|
|
||||||
included.push(tech);
|
included.push(tech);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
console.log('intersection not array');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
console.log('found ' + included.length + ' technologies.');
|
//console.log('found ' + included.length + ' technologies.');
|
||||||
return included;
|
return included;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// filter technologies based on a single filterable value on tech and a list of filters
|
||||||
|
function filterTechnologiesByValue(technologies, field, list) {
|
||||||
|
const included = [];
|
||||||
|
technologies.forEach(function (tech) {
|
||||||
|
if (hasInstances(tech)) {
|
||||||
|
let arr = [tech[field]];
|
||||||
|
const intersection = inCommon(arr, list);
|
||||||
|
if (intersection && intersection.constructor === Array) {
|
||||||
|
console.log('intersection length: ', intersection.length);
|
||||||
|
if (intersection.length > 0) {
|
||||||
|
included.push(tech);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//console.log('found ' + included.length + ' technologies.');
|
||||||
|
return included;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// process the data received by the web request!
|
||||||
const results = processData(webservices);
|
const results = processData(webservices);
|
||||||
|
|
||||||
//const technologies = webservices.technologies;
|
//const technologies = webservices.technologies;
|
||||||
|
@ -319,17 +332,20 @@
|
||||||
|
|
||||||
// reactive stuff...
|
// reactive stuff...
|
||||||
$: {
|
$: {
|
||||||
//console.log('about to filterTechnologiesByCategoryList');
|
console.log('about to filterTechnologiesByCategoryList');
|
||||||
filteredTechnologies = filterTechnologiesByCategoryList(results.active_services, flattenFilter($categoryFilter));
|
// filter by categories
|
||||||
|
filteredTechnologies = filterTechnologiesByArray(results.active_services, 'categories',
|
||||||
|
flattenFilter($categoryFilter));
|
||||||
|
// filter by analogues
|
||||||
|
filteredTechnologies = filterTechnologiesByArray(results.active_services, 'analogues',
|
||||||
|
flattenFilter($analogueFilter));
|
||||||
|
filteredTechnologies = filterTechnologiesByValue(results.active_services, 'license',
|
||||||
|
flattenFilter($licenseFilter));
|
||||||
|
|
||||||
//filteredTechnologies = filterTechnologiesByCategoryList(results.all_services, flattenFilter($categoryFilter));
|
//filteredTechnologies = filterTechnologiesByCategoryList(results.all_services, flattenFilter($categoryFilter));
|
||||||
const technologies = sortTechnologies(filteredTechnologies);
|
const technologies = sortTechnologies(filteredTechnologies);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*function flipOn(list, id) {
|
|
||||||
console.log('list: ' + list + ', id: ' + id);
|
|
||||||
return true;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="webservices">
|
<div class="webservices">
|
||||||
|
|
Loading…
Reference in a new issue