Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

1.5 KB
Raw Blame
<script>
  import { tick } from 'svelte';
  import { k6Output } from './k6-output.mjs';
  export let output = '';
  export let label = 'k6 output';
  let element;
  let following = true;

  function scrolled(){if(element.scrollHeight>element.clientHeight+24)following=element.scrollHeight-element.scrollTop-element.clientHeight<24;}
  async function update(_output){await tick();if(element && following)element.scrollTop=element.scrollHeight;}
  async function follow(){following=true;await update(output);}
  $: update(output);
  $: display = k6Output(output);
</script>

<div class="output-toolbar"><span>{label}</span><button class="quiet" aria-pressed={following} onclick={() => {if(following)following=false;else follow();}}>{following ? 'Following output' : 'Follow output ↓'}</button></div>
<pre bind:this={element} onscroll={scrolled} aria-label={label}>{#if display.progress}<span>{display.before}{display.before ? '\n\n' : ''}</span><span aria-label="Current k6 progress">{display.progress}</span><span>{display.after ? '\n\n' : ''}{display.after}</span>{:else}{display.history}{/if}</pre>

<style>
  .output-toolbar{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:8px;color:#667085;font-size:12px}
  .output-toolbar button{min-height:28px;font-size:12px}
  pre{width:100%;max-width:none!important;margin:0;background:#182235!important;color:#dce6f3!important;border-radius:8px;padding:16px!important;min-height:180px;max-height:none!important;overflow-x:auto;white-space:pre!important;line-height:1.55}
</style>