diff --git a/src/lib/components/CollapsibleSection.svelte b/src/lib/components/CollapsibleSection.svelte
index b6bfa66..62acc24 100644
--- a/src/lib/components/CollapsibleSection.svelte
+++ b/src/lib/components/CollapsibleSection.svelte
@@ -4,44 +4,67 @@
// Inclusive Components by Heydon Pickering https://inclusive-components.design/collapsible-sections/
export let headerText;
- let expanded = false
+ let expanded = false;
+
+ {#if technology.repository}
R{/if}
+ {#if technology.wikipedia}
W{/if}
+
+
+
+ {technology.description}{#if technology.extended_description}i{/if}
+
+ {#if technology.categories}
+ {pluraliser('Category', 'Categories', technology.categories.length)}:
+ {toOxfordCommaString(technology.categories)}
+
{/if}
+ {#if technology.analogues}
+ Alternative to {toOxfordCommaString(technology.analogues)}
+
{/if}
+ {#if technology.license}
+ License: {technology.license}
+
{/if}
+ {#if hasInstances(technology)}
+
+
+ {#each technology.instances as instance}
+ {/each}
+
+
+ {:else}
+
Nothing here yet...
+ {/if}
+
+
+
diff --git a/src/lib/components/filter.js b/src/lib/components/filter.js
index e70cc4a..158410a 100644
--- a/src/lib/components/filter.js
+++ b/src/lib/components/filter.js
@@ -3,17 +3,17 @@ import { getContext, setContext } from 'svelte';
export function setFilter(context) {
let contextFilter = writable(0);
- console.log('setFilter: ', contextFilter);
+ //console.log('setFilter: ', contextFilter);
contextFilter.subscribe((value) => {
- console.log('initial value: ', value);
+ //console.log('initial value: ', value);
});
setContext(context, contextFilter);
- console.log('contextFilter (' + context + '): ', contextFilter);
+ //console.log('contextFilter (' + context + '): ', contextFilter);
}
export function getFilter(context) {
- console.log('looking for writable for context ', context);
+ //console.log('looking for writable for context ', context);
let f = getContext(context);
- console.log('returning filter writable: ', f);
+ //console.log('returning filter writable: ', f);
return f;
}
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index 57d11e7..f436bcf 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -18,9 +18,10 @@
//
// digest and return useful info from the Webservices JSON feed
function processData(webservices) {
- let instances = 0;
- let current = [];
- let future = [];
+ let stats = { 'instances': 0, 'technologies': 0, 'licenses': 0,'weak': 0, 'copyleft': 0 };
+ let all = []; // all services
+ let current = []; // those with active instances
+ let future = []; // those that are planned
// properties of technologies
let category_list = [];
let analogue_list = [];
@@ -33,6 +34,7 @@
// actual objects
let hosts = [];
let affiliates = [];
+
//
// just a trivial reassignment
//let hosts = webservices.hosts;
@@ -40,7 +42,10 @@
// pull out relevant info in useful chunks.
for (let key in webservices.technologies) {
let tech = webservices.technologies[key];
+ tech['name'] = key;
+ console.log('tech '+key+' ('+tech.categories.length+'):', tech.categories);
if (tech.hasOwnProperty('categories') && tech.categories.constructor === Array) {
+ //console.log('tech '+key+' ('+tech.categories.length+'):', tech.categories);
tech.categories.forEach(function (category, index) {
if (category_list.hasOwnProperty(category)) category_list[category]++;
else category_list[category] = 1;
@@ -57,13 +62,11 @@
if (license_list.hasOwnProperty(license)) license_list[license]++;
else license_list[license] = 1;
}
-
if (hasInstances(tech)) {
- tech['name'] = key;
current.push(tech);
//console.log(tech.name + ': ' + tech.instances.length + ' instances...');
tech.instances.forEach(function (instance, i) {
- instances++;
+ stats.instances++;
if (instance.hasOwnProperty('status')) {
let tag = instance.status;
if (status_list.hasOwnProperty(tag)) status_list[tag]++;
@@ -84,6 +87,7 @@
} else {
future[key] = tech;
}
+ all[key] = tech;
}
for (let key in webservices.hosts) {
//console.log('key: ', key);
@@ -102,8 +106,15 @@
affiliates[key] = affiliate;
}
+ // assign stats based on gathered data...
+ stats.current = current.length;
+ stats.future = future.length;
+ console.log('license_list: ', license_list);
+ stats.licenses = license_list.length;
+
return {
- total_instances: instances,
+ stats: stats,
+ all_services: all,
active_services: current,
candidate_services: future,
tech_lists: {
@@ -121,18 +132,7 @@
};
}
- // console.log(technologies);
- // return true if a tech object includes valid instances
- function hasInstances(tech) {
- if (
- tech.hasOwnProperty('instances') &&
- tech.instances.constructor === Array &&
- tech.instances.length
- ) return true;
- return false;
- }
-
- // return an object with ob's keys ordered alphabetically, with an idfrom an object
+ // return an object with ob's keys ordered alphabetically, with an id from an object
function getSortedFilter(ob) {
let keys = [];
let i = 0;
@@ -150,6 +150,17 @@
return key_array;
}
+ // return true if a tech object includes valid instances
+ function hasInstances(tech) {
+ if (
+ tech.hasOwnProperty('instances') &&
+ tech.instances.constructor === Array &&
+ tech.instances.length
+ ) return true;
+ return false;
+ }
+
+
// get intersection: ref https://bobbyhadz.com/blog/javascript-get-intersection-of-two-arrays
function getIntersection(a, b) {
const set1 = new Set(a);
@@ -160,22 +171,6 @@
return intersection;
}
- // combine an array of terms into a sentence with proper Oxford commas, dealing with the special cases
- // of one or two elements.
- function toOxfordCommaString(arr) {
- if (arr.length == 1) return arr;
- if (arr.length == 2) return arr.join(' and ');
- else {
- var last = arr.pop();
- return arr.join(', ') + ', and ' + last;
- }
- }
-
- // return a singular or plural term depending on the value of 'count'
- function pluraliser(singular, plural, count) {
- if (count > 1) return plural;
- return singular;
- }
// assign colours from a set of differentiated colours to a list of tags...
// this one is for 'hosts'
@@ -240,7 +235,7 @@
const set2 = new Set(b);
const intersection = [...set1].filter((element) => set2.has(element));
- console.log('intersection = ', intersection);
+ //console.log('intersection = ', intersection);
return intersection;
}
@@ -255,13 +250,14 @@
// filter technologies based on a list of Categories
function filterTechnologiesByCategoryList(technologies, list) {
- console.log('looking for tech in categories: ', list);
+ //console.log('looking for tech in categories: ', list);
const included = [];
technologies.forEach(function (tech) {
if (hasInstances(tech)) {
const intersection = inCommon(tech.categories, list);
- //console.log('categories: ', tech.categories);
- //console.log('list: ', list);
+ console.log('for tech: ', tech.name);
+ console.log('categories: ', tech.categories);
+ console.log('list: ', list);
console.log('intersection: ', intersection);
if (intersection && intersection.constructor === Array) {
//console.log('found intersection!', intersection.constructor);
@@ -323,8 +319,9 @@
// reactive stuff...
$: {
- console.log('about to filterTechnologiesByCategoryList');
+ //console.log('about to filterTechnologiesByCategoryList');
filteredTechnologies = filterTechnologiesByCategoryList(results.active_services, flattenFilter($categoryFilter));
+ //filteredTechnologies = filterTechnologiesByCategoryList(results.all_services, flattenFilter($categoryFilter));
const technologies = sortTechnologies(filteredTechnologies);
}
@@ -336,61 +333,75 @@