Skip to content

Commit

Permalink
Added checksum truncation function WIP [ref #7081 #6685 #5210]
Browse files Browse the repository at this point in the history
  • Loading branch information
mheppler committed Oct 15, 2020
1 parent 9eb7f9a commit 81384ba
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/webapp/file-info-fragment.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@
</h:outputFormat>
<!-- CHECKSUM -->
<div class="checksum-block" style="word-break: break-all;" jsf:rendered="#{!fileMetadata.dataFile.tabularData}">
<h:outputText id="file-checksum" value="#{fileMetadata.dataFile.checksumType}: #{fileMetadata.dataFile.checksumValue}" rendered="#{!(empty fileMetadata.dataFile.checksumValue)}"/>
<span class="#{!editDatafilesPage ? 'checksum-truncate' : ''}"
jsf:rendered="#{!(empty fileMetadata.dataFile.checksumValue)}"
title="Click to copy: #{fileMetadata.dataFile.checksumValue}">#{fileMetadata.dataFile.checksumType}: #{fileMetadata.dataFile.checksumValue}</span>
<span class="glyphicon glyphicon-copy"></span>
</div>
<!-- UNF + Variables, Obsersvations -->
<div class="unf-block" style="word-break: break-all;" jsf:rendered="#{fileMetadata.dataFile.tabularData}">
Expand Down
39 changes: 39 additions & 0 deletions src/main/webapp/resources/js/dv_rebind_bootstrap_ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,45 @@ function bind_bsui_components(){
// Disabled pagination links
disabledLinks();

// Truncate checksums
// TO-DO DETERMINE IF THIS IS PLACE IS OVERKILL, ON EVERY PG, EVERY REBIND ACTION ...
// PROBABLY NEEDED LIKE ALL THE OTHER FUNCTIONS FOR DYNAMIC AJAX UPDATES ON PG
checksumTruncate();

/*
* Truncate file checksums
*/
function checksumTruncate(){

// TO-DO MOVE THIS CHUNK OUT OF BIND_BSUI, TO BOTTOM OF THIS FILE

$('span.checksum-truncate').each(function () {

var checksumText = $(this).text();

console.log("Total Checksums..." + checksumText);

$(this).css('color', 'red');

console.log("Characters..." + checksumText.length);

if (checksumText.length > 35) {
$(this).text( checksumText.substr(0, 8) + '...' + checksumText.substr(checksumText.length-3, checksumText.length) );
}

// TO-DO WIRE UP CLICK TO COPY W/ CLIPBOARD.JS ... SEE JIM'S PR 5211
// var clipboard = new Clipboard('button.checksum');
// clipboard.on('success', function(e) {
// console.log(e);
// });
// clipboard.on('error', function(e) {
// console.log(e);
// });

});

}

// Sharrre
sharrre();

Expand Down

0 comments on commit 81384ba

Please sign in to comment.