Files
bpsets/views/partial/bpset_progress.ejs
Minhyeok Park f6e86cb4bc
All checks were successful
/ deploy_site (push) Successful in 2m18s
feat: add search and sort feature
2025-01-15 20:53:34 +09:00

48 lines
1.6 KiB
Plaintext

<%
const passResources = metadata.compliantResources.length
const failResources = metadata.nonCompliantResources.length
const totalResources = passResources + failResources
const passPercent =
totalResources > 0
? passResources / totalResources * 100
: 100
const isPass = failResources < 1
%>
<% if (metadata.status === 'FINISHED') { %>
<td class="py-3 px-4">
<span
class="inline-block px-2 py-1 text-xs font-medium rounded-full bg-<%= isPass ? 'green' : 'red' %>-200 text-<%= isPass ? 'green' : 'red' %>-800">
<%= isPass ? 'Pass' : 'Fail' %>
</span>
</td>
<td class="py-3 px-4">
<div class="relative w-full bg-gray-200 h-4 rounded-md">
<div class="absolute top-0 left-0 h-4 bg-green-500 rounded-md" style="width: <%= passPercent %>%"></div>
</div>
<span class="block mt-1 text-sm text-gray-600">
(<%= passResources %>/<%= totalResources %>)
</span>
</td>
<% } else if (metadata.status === 'CHECKING') { %>
<td colspan="2" class="py-3 px-4">
<div class="relative w-full bg-gray-200 h-4 rounded-md">
<div class="absolute top-0 left-0 h-4 bg-gray-500 animate-pulse"></div>
</div>
<p class="mt-1 text-sm text-gray-600">Progressing</p>
</td>
<% } else if (metadata.status === 'ERROR') { %>
<td colspan="2" class="py-3 px-4">
<div class="relative w-full bg-red-200 h-4 rounded-md"></div>
<p class="mt-1 text-sm text-red-500">Error</p>
</td>
<% } else if (metadata.status === 'LOADED') { %>
<td colspan="2" class="py-3 px-4">
<div class="relative w-full bg-gray-200 h-4 rounded-md"></div>
<p class="mt-1 text-sm text-gray-600">Ready</p>
</td>
<% } %>