diff --git a/src/routes/+page.js b/src/routes/+page.js index 4e58e23..951d6a5 100644 --- a/src/routes/+page.js +++ b/src/routes/+page.js @@ -3,7 +3,7 @@ export const load = async ({ fetch }) => { const webservicesResult = await fetch('https://static.magnificent.nz/webservices/webservices.json'); const webservicesData = await webservicesResult.json(); - console.log(webservicesData); + //console.log(webservicesData); return { webservices: { technologies: webservicesData.technologies, diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index d2f885e..10fd490 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -7,8 +7,10 @@ function processData(webservices) { let instances = 0; let current = {}; + let current_status = []; let future = {}; - let affiliates = {}; + let affiliates = []; + let analogues = [] // // just a trivial reassignment let hosts = webservices.hosts; @@ -17,9 +19,24 @@ webservices.technologies.forEach(function(tech, i) { if (hasInstances(tech)) { console.log(tech.name + ': ' + tech.instances.length + ' instances...'); - instances += tech.instances.length; + tech.instances.forEach(function(instance, i) { + if (hasAffiliation(instance)) { + let tag = instance.affiliation; + affiliates[tag] += 1; + console.log('added tag: ' + tag); + } + }); } - }) + getAnalogues(analogues, tech) { + single = + if + analogues = analogues.concat(local); + } + }); + /*affiliates.forEach(function(num, tag) { + console.log(tag + ': ' + num); + });*/ + console.log('affiliates: ', affiliates); return { total_instances: instances, @@ -32,9 +49,15 @@ // console.log(technologies); function hasInstances(tech) { - if (tech.hasOwnProperty('instances') && tech.instances.constructor === Array) { - return true; - } + if (tech.hasOwnProperty('instances') && tech.instances.constructor === Array) return true; + return false; + } + function hasAffiliation(instance) { + if (instance.hasOwnProperty('affiliation')) return true; + return false; + } + function hasStatus(instance) { + if (instance.hasOwnProperty('status')) return true; return false; } @@ -47,64 +70,90 @@
-
-

Dave Web Services

+

Dave Web Services

-
-
    -
  • Total number of services: {stats.total_instances}
  • -
-
+
+
    +
  • Total number of services: {stats.total_instances}
  • +
{#each technologies as technology} -
- - {#if hasInstances(technology)} -
-
    - {#each technology.instances as instance} -
  • {instance.domain} {instance.affiliation}
  • - {/each} -
-
- {:else} -
-
    -
  • Nothing here yet...
  • -
-
- {/if} +
+

{technology.name}

+

{technology.description}

+ {#if hasInstances(technology)} +
+
    + {#each technology.instances as instance} +
  • {instance.domain} {instance.affiliation}
  • + {/each} +
+
+ {:else} +
+
    +
  • Nothing here yet...
  • +
+
+ {/if} {/each}