diff --git a/bitrepository-webclient/src/main/webapp/dashboard_components/collectionStatus.js b/bitrepository-webclient/src/main/webapp/dashboard_components/collectionStatus.js
index ed2de73ae..4a7a06940 100644
--- a/bitrepository-webclient/src/main/webapp/dashboard_components/collectionStatus.js
+++ b/bitrepository-webclient/src/main/webapp/dashboard_components/collectionStatus.js
@@ -19,7 +19,7 @@
for(var i = 0; i < collectionIDs.length; i++) {
collections[collectionIDs[i].collectionID] = {collectionID: collectionIDs[i].collectionID,
collectionName: collectionIDs[i].collectionName,
- numFiles: '-',
+ numFiles: '-',
latestIngest: "Fetching",
collectionSize: '-',
pillars: '-',
@@ -72,7 +72,7 @@
}
}
- function updateCollectionStatistic(collection) {
+ function updateCollectionStatistic(collection) {
if(scheduleUpdate(collection, "stats")) {
url = integrityServiceUrl + "/integrity/IntegrityService/getIntegrityStatus/?collectionID=" + collection;
var c = collection;
@@ -88,7 +88,7 @@
collections[c].pillars = pillarCount;
collections[c].numChecksumErrors = checksumErrors;
collections[c].numMissingFiles = missingFiles;
- }).done(function(){updateCollectionRow(collections[c])}).always(function() {finishUpdate(c, "stats");});
+ }).done(function(){updateCollectionRow(collections[c])}).always(function() {finishUpdate(c, "stats");});
}
}
@@ -100,7 +100,7 @@
}
}
- function makeCollectionRow(collection) {
+ function makeCollectionRow(collection) {
var id = collection.collectionID;
var html = "";
html += "
";
@@ -118,7 +118,7 @@
function updateCollectionRow(collection) {
var id = collection.collectionID;
- $("#" + id + "-name").html(collection.collectionName);
+ $("#" + id + "-name").html(`${collection.collectionName}`);
$("#" + id + "-numFiles").html(numeral(collection.numFiles).format('0,0'));
$("#" + id + "-latestIngest").html(collection.latestIngest);
$("#" + id + "-collectionSize").html(collection.collectionSize);
@@ -153,7 +153,7 @@
return false;
}
}
-
+
function finishUpdate(collection, type) {
return updateLock[collection][type] = true;
}
diff --git a/bitrepository-webclient/src/main/webapp/integrity-service.html b/bitrepository-webclient/src/main/webapp/integrity-service.html
index 6d97edd61..35f3dc21e 100644
--- a/bitrepository-webclient/src/main/webapp/integrity-service.html
+++ b/bitrepository-webclient/src/main/webapp/integrity-service.html
@@ -128,7 +128,7 @@
function loadWorkflows() {
var url = integrityServiceUrl + '/integrity/IntegrityService/getWorkflowList/?collectionID=' + getCollectionID();
- $.getJSON(url, {}, function(j) {
+ $.getJSON(url, {}, function (j) {
for (var i = 0; i < j.length; i++) {
$("#workflowSelector").append('');
}
@@ -157,7 +157,7 @@
function getStoredWorkflowInfo(id, type) {
var myID = id;
var myType = type;
- return function() {
+ return function () {
return nl2br(workflows[myID][myType]);
}
}
@@ -165,32 +165,37 @@
function attachWorkflowInfoButton(id, type) {
var element;
var title;
- if(type == "workflowDescription") {
+ if (type == "workflowDescription") {
element = "#" + id + "-details";
title = "Workflow description";
- } else if(type == "lastRunDetails") {
+ } else if (type == "lastRunDetails") {
element = "#" + id + "-lastRun";
title = "Last run details";
}
- if(element != null) {
- $(element).popover({placement : "right",
- title : title,
- html : true,
- content : getStoredWorkflowInfo(id, type)});
+
+ if (element != null) {
+ $(element).popover({
+ placement: "right",
+ title: title,
+ html: true,
+ content: getStoredWorkflowInfo(id, type)
+ });
}
}
function getWorkflowStatuses() {
var url = integrityServiceUrl + '/integrity/IntegrityService/getWorkflowSetup/?collectionID=' + getCollectionID();
- $.getJSON(url, {}, function(j) {
+ $.getJSON(url, {}, function (j) {
var htmlTableBody;
for (var i = 0; i < j.length; i++) {
- if(workflows[j[i].workflowID] == null) {
+ if (workflows[j[i].workflowID] == null) {
$("#workflow-status-table-body").append(
makeWorkflowRow(j[i].workflowID, j[i].nextRun, j[i].lastRun, j[i].executionInterval,
j[i].currentState, j[i].lastRunFinishState));
- workflows[j[i].workflowID] = {workflowDescription : j[i].workflowDescription,
- lastRunDetails : j[i].lastRunDetails};
+ workflows[j[i].workflowID] = {
+ workflowDescription: j[i].workflowDescription,
+ lastRunDetails: j[i].lastRunDetails
+ };
attachWorkflowInfoButton(j[i].workflowID, "workflowDescription");
attachWorkflowInfoButton(j[i].workflowID, "lastRunDetails");
} else {
@@ -206,7 +211,7 @@
function getPagingLimit(id, member) {
var myID = id;
var myMember = member;
- return function() {
+ return function () {
return pillars[myID][myMember];
}
}
@@ -216,7 +221,7 @@
var myUrl = url;
var myID = id;
var myMember = member;
- return function() {
+ return function () {
pager = new Pager(getPagingLimit(myID, myMember), 20, myUrl, "#modalPager", "#modalPagerBody");
$("#modalPagerLabel").html(myTitle);
$("#modalPagerBody").html("Loading
");
@@ -228,35 +233,35 @@
function getCellContext(id, type) {
var context = {};
context.url = integrityServiceUrl + "/integrity/IntegrityService/";
- if(type == "Pillar Hostname") {
+ if (type == "Pillar Hostname") {
context.element = id + "-pillarHostname";
context.title = type + " on " + id;
context.member = "pillarHostname";
- } else if(type == "Pillar Type") {
+ } else if (type == "Pillar Type") {
context.element = id + "-pillarType";
context.title = type + " on " + id;
context.member = "pillarType";
- } else if(type == "Total files") {
+ } else if (type == "Total files") {
context.element = id + "-totalFileCount";
context.title = type + " on " + id;
context.member = "totalFileCount";
context.url += "getAllFileIDs/";
- } else if(type == "Missing files") {
+ } else if (type == "Missing files") {
context.element = id + "-missingFiles";
context.title = type + " on " + id;
context.member = "missingFilesCount";
context.url += "getMissingFileIDs/";
- } else if(type == "Missing checksums") {
+ } else if (type == "Missing checksums") {
context.element = id + "-missingChecksums";
context.title = type + " on " + id;
context.member = "missingChecksumsCount";
context.url += "getMissingChecksumsFileIDs/";
- } else if(type == "Obsolete checksums") {
+ } else if (type == "Obsolete checksums") {
context.element = id + "-obsoleteChecksums";
context.title = type + " on " + id;
context.member = "obsoleteChecksumsCount";
context.url += "getObsoleteChecksumsFileIDs/";
- } else if(type == "Inconsistent checksums") {
+ } else if (type == "Inconsistent checksums") {
context.element = id + "-checksumErrors";
context.title = type + " on " + id;
context.member = "checksumErrorCount";
@@ -298,7 +303,7 @@
function updateIntCell(id, type, cellValue) {
var context = getCellContext(id, type);
- if(cellValue == 0) {
+ if (cellValue == 0) {
var html = "";
$("#" + context.element).html(html);
} else {
@@ -312,20 +317,21 @@
function getIntegrityStatus() {
var url = integrityServiceUrl + "/integrity/IntegrityService/getIntegrityStatus/?collectionID="
+ getCollectionID();
- $.getJSON(url, {}, function(j){
+ $.getJSON(url, {}, function (j) {
var htmlTable;
for (var i = 0; i < j.length; i++) {
- if(pillars[j[i].pillarID] == null) {
+ if (pillars[j[i].pillarID] == null) {
$("#integrity-status-table-body").append(makePillarRow(j[i].pillarID));
}
pillars[j[i].pillarID] = {
- pillarHostname : j[i].pillarHostname,
- pillarType : j[i].pillarType,
- totalFileCount : j[i].totalFileCount,
- missingFilesCount : j[i].missingFilesCount,
- missingChecksumsCount : j[i].missingChecksumsCount,
- obsoleteChecksumsCount : j[i].obsoleteChecksumsCount,
- checksumErrorCount : j[i].checksumErrorCount};
+ pillarHostname: j[i].pillarHostname,
+ pillarType: j[i].pillarType,
+ totalFileCount: j[i].totalFileCount,
+ missingFilesCount: j[i].missingFilesCount,
+ missingChecksumsCount: j[i].missingChecksumsCount,
+ obsoleteChecksumsCount: j[i].obsoleteChecksumsCount,
+ checksumErrorCount: j[i].checksumErrorCount
+ };
updateCells(j[i].pillarID);
}
});
@@ -334,14 +340,16 @@
function startWorkflow() {
var ID = $("#workflowSelector option:selected").val();
var url = integrityServiceUrl + '/integrity/IntegrityService/startWorkflow/';
- $('#formStatus').load(url, {workflowID: ID,
- collectionID: getCollectionID() }).show().fadeOut({duration: 5000});
+ $('#formStatus').load(url, {
+ workflowID: ID,
+ collectionID: getCollectionID()
+ }).show().fadeOut({duration: 5000});
}
- function getCollectionInformation() {
- var url = integrityServiceUrl + "/integrity/IntegrityService/getCollectionInformation/?collectionID=" + getCollectionID();
- $.getJSON(url, {}, function(j) {
+ function getCollectionInformation(collectionID) {
+ var url = integrityServiceUrl + "/integrity/IntegrityService/getCollectionInformation/?collectionID=" + collectionID;
+ $.getJSON(url, {}, function (j) {
var infoHtml = " Latest ingest: " + j.lastIngest + " ";
infoHtml += " Size: " + j.collectionSize + " ";
infoHtml += " Number of files: " + formatInt(j.numberOfFiles) + "";
@@ -366,47 +374,64 @@
}
function initializePage() {
- $.get('repo/urlservice/integrityService/', {}, function(url) {
+ $.get('repo/urlservice/integrityService/', {}, function (url) {
integrityServiceUrl = url;
- }, 'html').done(function() {
- $.getJSON('repo/reposervice/getCollections/', {}, function(collections) {
+ }, 'html').done(function () {
+ $.getJSON('repo/reposervice/getCollections/', {}, function (collections) {
nameMapper = new CollectionNameMapper(collections);
- var colls = nameMapper.getCollectionIDs();
- for(i in colls) {
- $("#collectionChooser").append('');
+ let cols = nameMapper.getCollectionIDs();
+ for (let i in cols) {
+ $("#collectionChooser").append('');
+ }
+ let collectionID = new URLSearchParams(window.location.search).get("collectionID");
+ if (collectionID !== null && cols.includes(collectionID)) {
+ setCollection(collectionID);
+ } else {
+ collectionChanged(getCollectionID());
}
- collectionChanged();
});
});
}
- function collectionChanged() {
+ function collectionChanged(collectionID) {
clearContent();
- $("#integrityLegend").html("Integrity information for collection " + nameMapper.getName(getCollectionID()));
- reportUrl = integrityServiceUrl + "/integrity/IntegrityService/getLatestIntegrityReport/";
- reportUrl += "?collectionID=" + getCollectionID();
+ $("#integrityLegend").html("Integrity information for collection " + nameMapper.getName(collectionID));
+ reportUrl = integrityServiceUrl + "/integrity/IntegrityService/getLatestIntegrityReport/";
+ reportUrl += "?collectionID=" + collectionID;
reportUrl += "&workflowID=" + "CompleteIntegrityCheck";
$("#integrityReportGetter").html("Get latest integrity report");
clearInterval(update_page);
loadWorkflows();
- getCollectionInformation();
+ getCollectionInformation(collectionID);
getWorkflowStatuses();
getIntegrityStatus();
- update_page = setInterval(function() {
+ update_page = setInterval(function () {
getWorkflowStatuses();
getIntegrityStatus();
- getCollectionInformation();
+ getCollectionInformation(collectionID);
}, 2500);
}
- $(document).ready(function(){
+ function setCollection(collectionID) {
+ $("#collectionChooser").val(collectionID).change();
+ }
+
+ $(document).ready(function () {
// Load page content
makeMenu("integrity-service.html", "#pageMenu");
initializePage();
// Setup event / click handling
- $("#workflowStarter").click(function(event) { event.preventDefault(); startWorkflow(); });
- $("#collectionChooser").change(function(event) {event.preventDefault(); collectionChanged();});
+ $("#workflowStarter").click(function (event) {
+ event.preventDefault();
+ startWorkflow();
+ });
+ $("#collectionChooser").change(function (event) {
+ event.preventDefault();
+ collectionChanged(getCollectionID());
+ });
+
+ closePopoverOnClick();
});
diff --git a/bitrepository-webclient/src/main/webapp/status-service.html b/bitrepository-webclient/src/main/webapp/status-service.html
index b9e0e15da..c26b7d3b5 100644
--- a/bitrepository-webclient/src/main/webapp/status-service.html
+++ b/bitrepository-webclient/src/main/webapp/status-service.html
@@ -172,6 +172,7 @@
$(document).ready(function(){
makeMenu("status-service.html", "#pageMenu");
initPage();
+ closePopoverOnClick();
});
diff --git a/bitrepository-webclient/src/main/webapp/utils.js b/bitrepository-webclient/src/main/webapp/utils.js
index 7849205fc..2c63a6e4e 100644
--- a/bitrepository-webclient/src/main/webapp/utils.js
+++ b/bitrepository-webclient/src/main/webapp/utils.js
@@ -22,5 +22,15 @@
function nl2br(line) {
- return line.replace(/\n/g, '
');
+ return line.replace(/\n/g, '
');
}
+
+function closePopoverOnClick() {
+ $("html").on("mouseup", function (e) {
+ if (!$(e.target).closest(".popover").length) {
+ $(".popover").each(function () {
+ $(this.previousSibling).popover("hide");
+ });
+ }
+ });
+}
\ No newline at end of file