aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat_web/templates/entity_macros.html
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2020-07-07 17:10:38 -0700
committerBryan Newbold <bnewbold@robocracy.org>2020-07-30 18:23:12 -0700
commit6d79479347752e450e9a8eeb4fbac84691044c67 (patch)
treeeaaa24065c6831d25c5ea65830c51b64960eaaed /python/fatcat_web/templates/entity_macros.html
parentbd3c6566fb9fdd5507782f19672fc62d0c551d05 (diff)
downloadfatcat-6d79479347752e450e9a8eeb4fbac84691044c67.tar.gz
fatcat-6d79479347752e450e9a8eeb4fbac84691044c67.zip
update container view stats
- show release type counts - new-style preservation status (single bar) - show release_type preservation break down on coverage page
Diffstat (limited to 'python/fatcat_web/templates/entity_macros.html')
-rw-r--r--python/fatcat_web/templates/entity_macros.html89
1 files changed, 89 insertions, 0 deletions
diff --git a/python/fatcat_web/templates/entity_macros.html b/python/fatcat_web/templates/entity_macros.html
index 8e4c4f6a..c3ae099a 100644
--- a/python/fatcat_web/templates/entity_macros.html
+++ b/python/fatcat_web/templates/entity_macros.html
@@ -260,3 +260,92 @@ yellow
{% endif %}
{%- endmacro %}
+
+{% macro preservation_bar(stats, extra_class="") -%}
+
+ {% set frac_bright = stats.bright/stats.total %}
+ {% set frac_dark = stats.dark/stats.total %}
+ {% set frac_shadows_only = stats.shadows_only/stats.total %}
+ {% set frac_none = stats.none/stats.total %}
+
+ <div class="ui {{ extra_class }} multiple progress" data-percent="0,0,0,0" style="margin-bottom: 0.1em;">
+ <div class="green bar" style="border-radius: 0; min-width: 0; width: {{ (frac_bright*100)|round(method='ceil') }}%;" title="bright">
+ <div class="progress">{# {{ (frac_bright*100)|int }}% #}</div>
+ </div>
+ <div class="green bar" style="border-radius: 0; min-width: 0; width: {{ (frac_dark*100)|round(method='ceil') }}%; background-color: darkgreen;" title="dark">
+ <div class="progress">{# {{ (frac_dark*100)|int }}% #}</div>
+ </div>
+ <div class="red bar" style="border-radius: 0; min-width: 0; width: {{ (frac_shadows_only*100)|round(method='ceil') }}%; background-color: darkred;" title="shadows only">
+ <div class="progress">{# {{ (frac_shadows_only*100)|int }}% #}</div>
+ </div>
+ <div class="red bar" style="border-radius: 0; min-width: 0; width: {{ (frac_none*100)|round(method='ceil') }}%;" title="no preservation">
+ <div class="progress">{# {{ (frac_none*100)|int }}% #}</div>
+ </div>
+ </div>
+
+
+{%- endmacro %}
+
+{% macro preservation_table(stats) -%}
+
+ {% set frac_bright = stats.bright/stats.total %}
+ {% set frac_dark = stats.dark/stats.total %}
+ {% set frac_shadows_only = stats.shadows_only/stats.total %}
+ {% set frac_none = stats.none/stats.total %}
+
+ <table class="ui very basic very compact collapsing table" style="font-weight: bold; margin-left: 1em;">
+ <tbody>
+ <tr>
+ <td style="background-color: #21ba45;">
+ <td class="right aligned" >{{ "{:,}".format(stats.bright) }}
+ <td class="right aligned" >{{ (frac_bright*100)|round(2,method='ceil') }}%
+ <td>preserved and publicly available (bright)
+ <tr>
+ <td style="background-color: darkgreen;">
+ <td class="right aligned" >{{ "{:,}".format(stats.dark) }}
+ <td class="right aligned" >{{ (frac_dark*100)|round(2,method='ceil') }}%
+ <td>preserved but not publicly accessible (dark)
+ <tr>
+ <td style="background-color: darkred;">
+ <td class="right aligned" >{{ "{:,}".format(stats.shadows_only) }}
+ <td class="right aligned" >{{ (frac_shadows_only*100)|round(2,method='ceil') }}%
+ <td>only independently preserved in "shadow" libraries
+ <tr>
+ <td style="background-color: #db2828;">
+ <td class="right aligned" >{{ "{:,}".format(stats.none) }}
+ <td class="right aligned" >{{ (frac_none*100)|round(2,method='ceil') }}%
+ <td>no known independent preservation
+ </tbody>
+ </table>
+
+{%- endmacro %}
+
+{% macro preservation_small_table(stats) -%}
+
+ {% set frac_bright = stats.bright/stats.total %}
+ {% set frac_dark = stats.dark/stats.total %}
+ {% set frac_shadows_only = stats.shadows_only/stats.total %}
+ {% set frac_none = stats.none/stats.total %}
+
+ <table class="ui very basic very compact collapsing table">
+ <tbody>
+ <tr>
+ <td style="background-color: #21ba45;">
+ <td class="right aligned" >{{ "{:,}".format(stats.bright) }}
+ <td>preserved and accessble (bright)
+ <tr>
+ <td style="background-color: darkgreen;">
+ <td class="right aligned" >{{ "{:,}".format(stats.dark) }}
+ <td>preserved, inaccessible (dark)
+ <tr>
+ <td style="background-color: darkred;">
+ <td class="right aligned" >{{ "{:,}".format(stats.shadows_only) }}
+ <td>shadow library only
+ <tr>
+ <td style="background-color: #db2828;">
+ <td class="right aligned" >{{ "{:,}".format(stats.none) }}
+ <td>no known preservation
+ </tbody>
+ </table>
+
+{%- endmacro %}