From 4c68329850f0a7c65e220622aea3059ac8605987 Mon Sep 17 00:00:00 2001 From: Dave Lane Date: Thu, 15 Aug 2024 09:49:01 +1200 Subject: [PATCH] WIP commit - just about to set up new 'tile' approach to formatting --- src/routes/+page.js | 2 +- src/routes/+page.svelte | 163 ++++++++++++++++++++++++++-------------- 2 files changed, 107 insertions(+), 58 deletions(-) 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}