ui.consume.records.ftl Maven / Gradle / Ivy
<#-- @ftlvariable name="recordsResult" type="com.infobip.kafkistry.service.consume.KafkaRecordsResult" -->
<#-- @ftlvariable name="overallSkipCount" type="java.lang.Long" -->
<#-- @ftlvariable name="overallReadCount" type="java.lang.Long" -->
<#-- @ftlvariable name="overallPartitions" type="java.util.Map" -->
<#-- @ftlvariable name="json" type="com.fasterxml.jackson.databind.ObjectMapper" -->
<#import "../common/util.ftl" as util>
<#import "progressBar.ftl" as pb>
<#assign records = recordsResult.records>
<#if overallPartitions??>
<#assign totalReadCount = overallReadCount>
<#assign totalSkipCount = overallSkipCount>
<#assign partitionsStats = overallPartitions>
<#else>
<#assign partitionsStats = recordsResult.partitions>
<#assign totalSkipCount = recordsResult.skipCount>
<#assign totalReadCount = recordsResult.readCount>
#if>
<#assign statusMessages = []>
<#if records?size == 0>
<#assign msgAlertClass = "alert-warning">
<#assign statusMessages += ["No records received"]>
<#else>
<#assign msgAlertClass = "alert-primary">
<#assign statusMessages += ["Got ${records?size} record(s)"]>
#if>
<#assign statusMessages += ["Read iteration processed ${recordsResult.readCount} record(s)"]>
<#if recordsResult.totalRecordsCount == 0>
<#assign statusMessages += ["Processed no record(s), topic is empty"]>
<#else>
<#assign statusMessages += ["Processed ${totalReadCount} record(s), ${util.prettyNumber(100.0*totalReadCount/recordsResult.totalRecordsCount)}% of ${recordsResult.totalRecordsCount} total records in topic partition(s)"]>
<#if totalSkipCount gt 0>
<#assign statusMessages += ["Skipped first ${totalSkipCount} record(s) (${util.prettyNumber(100.0*totalSkipCount/recordsResult.totalRecordsCount)}% of total in partitions) due to 'Read starting from' options"]>
#if>
<#if recordsResult.remainingCount gt 0>
<#assign statusMessages += ["Remaining ${recordsResult.remainingCount} record(s) (${util.prettyNumber(100.0*recordsResult.remainingCount/recordsResult.totalRecordsCount)}% of total in partitions) to reach end "]>
#if>
#if>
<#assign preRetention = 0>
<#list partitionsStats as partition, partitionStatus>
<#assign skip = partitionStatus.startedAtOffset-partitionStatus.beginOffset>
<#if skip lt 0>
<#assign preRetention += -skip>
#if>
#list>
<#if preRetention gt 0>
<#assign statusMessages += ["${preRetention} record(s) have been processed, but now were deleted by retention on topic"]>
#if>
<#if recordsResult.timedOut>
<#assign statusMessages += ["Wait has timed out"]>
#if>
<#if recordsResult.reachedEnd>
<#assign statusMessages += ["Reading reached latest"]>
#if>
Read status:
<#list statusMessages as msg>
- ${msg}
#list>
<#assign totalSum = preRetention + totalSkipCount + totalReadCount + recordsResult.remainingCount>
<@pb.progressBar total=totalSum preRetention=preRetention skip=totalSkipCount read=totalReadCount remain=recordsResult.remainingCount
emHeight=2 legend=true/>
▼
△
Partition read stats
<#include "partitionReadStats.ftl">
<#list records as record>
Record ${record?index+1} of ${records?size}
Key:
<#assign kafkaValue = record.key>
<#include "kafkaValue.ftl">
Headers:
<#if record.headers?size == 0>
(none)
<#else>
<#t>
⊕<#t>
{<#t>
<#t>
${record.headers?size} item<#if record.headers?size gt 1>s#if><#t>
<#t>
}<#t>
#if>
Value:
<#assign kafkaValue = record.value>
<#include "kafkaValue.ftl">
#list>