ui.sql.queryResult.ftl Maven / Gradle / Ivy
<#-- @ftlvariable name="appUrl" type="com.infobip.kafkistry.webapp.url.AppUrl" -->
<#-- @ftlvariable name="result" type="com.infobip.kafkistry.sql.QueryResult" -->
<#function linkedTypeUrl type value>
<#if value?is_string>
<#assign valueStr = value>
<#elseif value?is_boolean || value?is_number>
<#assign valueStr = value?c>
<#else>
<#assign valueStr = "${value?no_esc?markup_string}">
#if>
<#switch type>
<#case "TOPIC">
<#return appUrl.topics().showTopic(valueStr)>
<#case "CLUSTER">
<#return appUrl.clusters().showCluster(valueStr)>
<#case "PRINCIPAL">
<#return appUrl.acls().showAllPrincipalAcls(valueStr)>
<#case "QUOTA_ENTITY">
<#return appUrl.quotas().showEntity(valueStr)>
#switch>
<#return "">
#function>
<#function compoundLink type resource>
<#-- @ftlvariable name="resource" type="com.infobip.kafkistry.sql.LinkedResource" -->
<#switch type.name()>
<#case "CLUSTER_TOPIC">
<#return appUrl.topics().showInspectTopicOnCluster(resource.topic, resource.cluster)>
<#case "CLUSTER_GROUP">
<#return appUrl.consumerGroups().showConsumerGroup(resource.cluster, resource.group)>
<#case "PRINCIPAL_ACL">
<#return appUrl.acls().showAllPrincipalAclsRule(resource.principal, resource.acl.toString())>
<#case "PRINCIPAL_CLUSTER">
<#return appUrl.acls().showAllPrincipalAclsCluster(resource.principal, resource.cluster)>
<#case "KSTREAM_APP">
<#return appUrl.kStream().showKStreamApp(resource.cluster, resource.kafkaStreamAppId)>
#switch>
<#return "">
#function>
<#function splitCamelCased string>
<#return string?replace("(?<=[a-z])(?=[A-Z])", " ", "r")?split(" ")>
#function>
<#macro breakLongString string>
<#assign parts = string?split("(?<=[,;-])", "r")>
<#list parts as part>${part}#list>
#macro>
Got result set of ${result.count}
rows<#if result.totalCount gt result.count>, total count without LIMIT would be ${result.totalCount}
#if>
#
<#list result.linkedCompoundTypes as type>
${type.name()?replace("_","-")?lower_case}
#list>
<#list result.columns as column>
<#assign parts = splitCamelCased(column.name)>
<#list parts as part>${part}#list>
#list>
<#if result.rows?size == 0>
(empty)
#if>
<#list result.rows as row>
${row?index + 1}
<#if result.linkedCompoundTypes??>
<#list result.linkedCompoundTypes as type>
<#if row.linkedResource?? && row.linkedResource.types?seq_contains(type)>
🔍
<#else>
---
#if>
#list>
#if>
<#list row.values as value>
<#assign valueRaw><#t>
<#if !(value??)><#t>
null<#t>
<#elseif value?is_string><#t>
${value}<#t>
<#else><#t>
${value?c}<#t>
#if><#t>
#assign>
<#assign columnMeta = result.columns[value?index]>
<#if value??>
<#assign valueDisplay>
<#if value?is_boolean>
${value?c}
<#elseif value?is_string>
<@breakLongString string=value/>
<#else>
${value}
#if>
#assign>
<#if result.columnLinkedType?keys?seq_contains(value?index)>
<#assign columnLinkedType = result.columnLinkedType?api.get(value?index)>
${valueDisplay}
<#else>
${valueDisplay}
#if>
<#else>
null
#if>
#list>
#list>