prasadnu commited on
Commit
7498d76
·
verified ·
1 Parent(s): 51e3ab0

Flow diagram: App -> OpenSearch Ingestion -> OpenSearch

Browse files
Files changed (5) hide show
  1. app.js +11 -10
  2. icons/api-gateway.svg +0 -10
  3. icons/lambda.svg +0 -10
  4. index.html +1 -3
  5. style.css +3 -1
app.js CHANGED
@@ -126,9 +126,9 @@
126
  if (li._ball) { status === "sent" ? li._ball.toEnd() : li._ball.fail(); if (status !== "retrying") li._ball = null; }
127
  }
128
 
129
- // ---------- live flow diagram: a ball per event, App -> API Gateway (queued), then on "sent" -> OpenSearch ----------
130
  const flow = (() => {
131
- const box = $("flow"), ORDER = ["app", "apigw", "lambda", "osi", "aos"], MAX_BALLS = 30;
132
  const reduce = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
133
  let active = 0;
134
  const node = (n) => box.querySelector(`[data-node="${n}"]`);
@@ -146,21 +146,22 @@
146
  const ball = document.createElement("span"); ball.className = `ball ev ${action}`; box.append(ball);
147
  let done = false, phase1;
148
  const finish = () => { if (!done) { done = true; active--; ball.remove(); } };
149
- const start = x("app"), gw = x("apigw");
150
  ball.style.transform = `translateX(${start}px)`;
151
- phase1 = ball.animate([{ transform: `translateX(${start}px)` }, { transform: `translateX(${gw}px)` }],
152
- { duration: 350, delay: Math.random() * 150, easing: "ease-out", fill: "forwards" });
153
- phase1.onfinish = () => pulse("apigw", action);
154
  return {
155
  toEnd() {
156
  const go = () => {
157
- const pts = ["apigw", "lambda", "osi", "aos"].map(x);
158
  const a = ball.animate(pts.map((p) => ({ transform: `translateX(${p}px)` })),
159
- { duration: 900, easing: "linear", fill: "forwards" });
160
- ["lambda", "osi", "aos"].forEach((n, i) => setTimeout(() => pulse(n, action), (i + 1) * 300));
 
161
  a.onfinish = () => { ball.animate([{ opacity: 1 }, { opacity: 0 }], { duration: 250 }).onfinish = finish; };
162
  };
163
- phase1.playState === "finished" ? go() : (phase1.onfinish = () => { pulse("apigw", action); go(); });
164
  },
165
  fail() { ball.classList.add("failed"); setTimeout(finish, 1200); },
166
  };
 
126
  if (li._ball) { status === "sent" ? li._ball.toEnd() : li._ball.fail(); if (status !== "retrying") li._ball = null; }
127
  }
128
 
129
+ // ---------- live flow diagram: a ball per event, waits on the way to Ingestion (queued), then on "sent" -> OpenSearch ----------
130
  const flow = (() => {
131
+ const box = $("flow"), ORDER = ["app", "osi", "aos"], MAX_BALLS = 30;
132
  const reduce = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
133
  let active = 0;
134
  const node = (n) => box.querySelector(`[data-node="${n}"]`);
 
146
  const ball = document.createElement("span"); ball.className = `ball ev ${action}`; box.append(ball);
147
  let done = false, phase1;
148
  const finish = () => { if (!done) { done = true; active--; ball.remove(); } };
149
+ const start = x("app"), wait = start + (x("osi") - start) * 0.45; // queued: hold part way to Ingestion
150
  ball.style.transform = `translateX(${start}px)`;
151
+ phase1 = ball.animate([{ transform: `translateX(${start}px)` }, { transform: `translateX(${wait}px)` }],
152
+ { duration: 300, delay: Math.random() * 150, easing: "ease-out", fill: "forwards" });
153
+ pulse("app", action);
154
  return {
155
  toEnd() {
156
  const go = () => {
157
+ const pts = [wait, x("osi"), x("aos")];
158
  const a = ball.animate(pts.map((p) => ({ transform: `translateX(${p}px)` })),
159
+ { duration: 800, easing: "linear", fill: "forwards" });
160
+ setTimeout(() => pulse("osi", action), 280);
161
+ setTimeout(() => pulse("aos", action), 800);
162
  a.onfinish = () => { ball.animate([{ opacity: 1 }, { opacity: 0 }], { duration: 250 }).onfinish = finish; };
163
  };
164
+ phase1.playState === "finished" ? go() : (phase1.onfinish = go);
165
  },
166
  fail() { ball.classList.add("failed"); setTimeout(finish, 1200); },
167
  };
icons/api-gateway.svg DELETED
icons/lambda.svg DELETED
index.html CHANGED
@@ -52,15 +52,13 @@
52
 
53
  <aside class="events" aria-labelledby="events-title">
54
  <div id="flow" class="flow" role="img"
55
- aria-label="Event flow: app, then Amazon API Gateway, AWS Lambda, Amazon OpenSearch Ingestion, Amazon OpenSearch Service">
56
  <div class="flow-line" aria-hidden="true"></div>
57
  <div class="node" data-node="app">
58
  <svg viewBox="0 0 48 48" aria-hidden="true"><rect x="5" y="9" width="38" height="30" rx="4" fill="#232f3e"/>
59
  <rect x="9" y="17" width="30" height="18" rx="2" fill="#fff"/><circle cx="11" cy="13" r="1.6" fill="#ff9900"/>
60
  <circle cx="16" cy="13" r="1.6" fill="#fff"/><circle cx="21" cy="13" r="1.6" fill="#fff"/></svg>
61
  <span>App</span></div>
62
- <div class="node" data-node="apigw"><img src="icons/api-gateway.svg" alt=""><span>API Gateway</span></div>
63
- <div class="node" data-node="lambda"><img src="icons/lambda.svg" alt=""><span>Lambda</span></div>
64
  <div class="node" data-node="osi"><img src="icons/opensearch-ingestion.svg" alt=""><span>OpenSearch Ingestion</span></div>
65
  <div class="node" data-node="aos"><img src="icons/opensearch-service.svg" alt=""><span>OpenSearch</span></div>
66
  </div>
 
52
 
53
  <aside class="events" aria-labelledby="events-title">
54
  <div id="flow" class="flow" role="img"
55
+ aria-label="Event flow: app, then Amazon OpenSearch Ingestion, then Amazon OpenSearch Service">
56
  <div class="flow-line" aria-hidden="true"></div>
57
  <div class="node" data-node="app">
58
  <svg viewBox="0 0 48 48" aria-hidden="true"><rect x="5" y="9" width="38" height="30" rx="4" fill="#232f3e"/>
59
  <rect x="9" y="17" width="30" height="18" rx="2" fill="#fff"/><circle cx="11" cy="13" r="1.6" fill="#ff9900"/>
60
  <circle cx="16" cy="13" r="1.6" fill="#fff"/><circle cx="21" cy="13" r="1.6" fill="#fff"/></svg>
61
  <span>App</span></div>
 
 
62
  <div class="node" data-node="osi"><img src="icons/opensearch-ingestion.svg" alt=""><span>OpenSearch Ingestion</span></div>
63
  <div class="node" data-node="aos"><img src="icons/opensearch-service.svg" alt=""><span>OpenSearch</span></div>
64
  </div>
style.css CHANGED
@@ -76,7 +76,9 @@ dialog img { width:100%; max-height:340px; object-fit:contain; }
76
  .flow { position:relative; display:flex; justify-content:space-between; align-items:flex-start;
77
  padding:6px 2px 10px; margin-bottom:10px; border-bottom:1px solid var(--line); }
78
  .flow-line { position:absolute; left:22px; right:22px; top:24px; height:2px; background:#d5dbe1; }
79
- .flow .node { position:relative; z-index:1; display:flex; flex-direction:column; align-items:center; gap:4px; width:52px; }
 
 
80
  .flow .node img, .flow .node svg { width:32px; height:32px; border-radius:6px; background:#fff; }
81
  .flow .node span { font-size:9.5px; line-height:1.15; text-align:center; color:var(--muted); }
82
  .flow .node.hit img, .flow .node.hit svg { box-shadow:0 0 0 3px var(--c, #005eb8); transition:box-shadow .15s; }
 
76
  .flow { position:relative; display:flex; justify-content:space-between; align-items:flex-start;
77
  padding:6px 2px 10px; margin-bottom:10px; border-bottom:1px solid var(--line); }
78
  .flow-line { position:absolute; left:22px; right:22px; top:24px; height:2px; background:#d5dbe1; }
79
+ .flow { padding-left:14px; padding-right:14px; }
80
+ .flow-line { left:40px; right:40px; }
81
+ .flow .node { position:relative; z-index:1; display:flex; flex-direction:column; align-items:center; gap:4px; width:64px; }
82
  .flow .node img, .flow .node svg { width:32px; height:32px; border-radius:6px; background:#fff; }
83
  .flow .node span { font-size:9.5px; line-height:1.15; text-align:center; color:var(--muted); }
84
  .flow .node.hit img, .flow .node.hit svg { box-shadow:0 0 0 3px var(--c, #005eb8); transition:box-shadow .15s; }