Skip to content

Commit

Permalink
Remove console logs
Browse files Browse the repository at this point in the history
  • Loading branch information
dersmon committed Jan 13, 2025
1 parent c0ba2e3 commit c06c781
Show file tree
Hide file tree
Showing 9 changed files with 154 additions and 163 deletions.
28 changes: 13 additions & 15 deletions frontend/app/catalog/ar-catalog-occurrences.directive.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
export default function (arachneSettings, $http, $uibModal, Catalog, CatalogEntry) {
console.log('construct catalog-occurrences.directive.js');
return {
scope: {
entity: '='
},
template: require('./ar-catalog-occurrences.html'),
link: function (scope, element, attrs) {
console.log('link catalog-occurrences.directive.js');
scope.catalogEntries = [];
scope.catalogEntrySets = [];

Expand Down Expand Up @@ -37,7 +35,7 @@ export default function (arachneSettings, $http, $uibModal, Catalog, CatalogEntr
editEntryModal.close = function (newEntry) {
CatalogEntry.save([newEntry], function (data) {
if (data.error_message) {
console.log(data.error_message);
console.error(data.error_message);
} else {
scope.loadOccurences();
}
Expand All @@ -61,46 +59,46 @@ export default function (arachneSettings, $http, $uibModal, Catalog, CatalogEntr
scope.arrangeEntries();

}).catch(function (result) {
console.log("Error Arachne dataservice not reachable");
console.error("Error Arachne dataservice not reachable");
});
}
};

scope.arrangeEntries = function() {
scope.arrangeEntries = function () {
var i, j, n, len = scope.catalogEntries.length, curi, curj, curk, duplicateAlreadyAdded, newCatalog;

for(i = 0; i < len; i++) {
for (i = 0; i < len; i++) {
curi = scope.catalogEntries[i];
scope.loadParentLabel(curi.entry);
if(curi.duplicate)
if (curi.duplicate)
continue;
duplicateAlreadyAdded = false;
for(j = i; j < len; j++) {
for (j = i; j < len; j++) {
curj = scope.catalogEntries[j];
if(curi.entry.catalogId === curj.entry.catalogId) {
if(!duplicateAlreadyAdded) {
if (curi.entry.catalogId === curj.entry.catalogId) {
if (!duplicateAlreadyAdded) {
scope.catalogEntrySets.push(scope.getNewCatalogEntrySet(curi));
duplicateAlreadyAdded = true;
} else {
for(n = 0; n < scope.catalogEntrySets.length; n++) {
for (n = 0; n < scope.catalogEntrySets.length; n++) {
curk = scope.catalogEntrySets[n];
if(curk.catalogId === curj.entry.catalogId)
if (curk.catalogId === curj.entry.catalogId)
scope.catalogEntrySets[n].entries.push(curj.entry);
}
}
curi.duplicate = curj.duplicate = true;
}
}
if(!curi.duplicate) {
if (!curi.duplicate) {
scope.catalogEntrySets.push(scope.getNewCatalogEntrySet(curi));
}
}
};

// used to load the parent label in order to distinguish entries when multiple
// entries for the same entity are present in the same catalog
scope.loadParentLabel = function(entry) {
CatalogEntry.get({id:entry.parentId, limit:1, full:false}, function(result) {
scope.loadParentLabel = function (entry) {
CatalogEntry.get({ id: entry.parentId, limit: 1, full: false }, function (result) {
entry.parentLabel = result.label;
});
};
Expand Down
30 changes: 14 additions & 16 deletions frontend/app/catalog/catalog.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ export default function ($rootScope, $scope, $state, $stateParams, $uibModal, $w
}));

} else { //Array contains entries with labels and entities attached to them
console.log("HA", newEntry);
var toAddItem = {};
if (newEntry[i].entity) {
toAddItem.arachneEntityId = newEntry[i].entity.entityId;
Expand Down Expand Up @@ -196,7 +195,6 @@ export default function ($rootScope, $scope, $state, $stateParams, $uibModal, $w
entry.totalChildren += 1;
initialize(result[i]);
if (scope && scope.collapsed) {
console.log("!!!!!");
$scope.toggleNode(scope, entry);
}
}
Expand Down Expand Up @@ -481,20 +479,20 @@ export default function ($rootScope, $scope, $state, $stateParams, $uibModal, $w
};


function initialize (entry) {
function initialize(entry) {
$scope.entryMap[entry.id] = entry;

// needed to enable dragging to entries without children
// see https://github.com/angular-ui-tree/angular-ui-tree/issues/203
if (!entry.children) entry.children = [];
}

function getIndexParent (entry) {
function getIndexParent(entry) {
var parent = $scope.entryMap[entry.parentId];
return parent.children.indexOf(entry);
}

function retrieveCatalog (id, callback) {
function retrieveCatalog(id, callback) {
Catalog.get({ id: id, limit: $scope.childrenLimit }, function (result) {
initialize(result.root);
if (result.root.children.length === 0 && result.root.totalChildren > 0) {
Expand All @@ -515,7 +513,7 @@ export default function ($rootScope, $scope, $state, $stateParams, $uibModal, $w
});
}

function showEntry (entry, treeScope) {
function showEntry(entry, treeScope) {

// Toggle collapsed parent when selecting a thumbnail image in catalog preview
if (!treeScope && $scope.currentTreeScope) {
Expand Down Expand Up @@ -548,7 +546,7 @@ export default function ($rootScope, $scope, $state, $stateParams, $uibModal, $w
showThumbnails($scope.currentEntry, offset);
};

function showThumbnails (entry, offset) {
function showThumbnails(entry, offset) {

$scope.currentEntry = entry;
$scope.cellsNotDisplayed = 0;
Expand Down Expand Up @@ -598,7 +596,7 @@ export default function ($rootScope, $scope, $state, $stateParams, $uibModal, $w
$scope.showThumbnails = entry.totalChildren > 0;
}

function checkIfEditable () {
function checkIfEditable() {
if (!$scope.user) {
$scope.editable = false;
} else {
Expand All @@ -615,7 +613,7 @@ export default function ($rootScope, $scope, $state, $stateParams, $uibModal, $w
}
}

function loadEntry (entryId, callback) {
function loadEntry(entryId, callback) {
CatalogEntry.get({
id: entryId
}, function (result) {
Expand All @@ -626,14 +624,14 @@ export default function ($rootScope, $scope, $state, $stateParams, $uibModal, $w
});
}

function toggleParentHierarchy (entryId) {
function toggleParentHierarchy(entryId) {
getAncestorList(entryId, [], function (list) {
list.reverse();
toggleEntriesInList(list);
});
}

function getAncestorList (entryId, ancestorList, callback) {
function getAncestorList(entryId, ancestorList, callback) {
if ($scope.entryMap[entryId] === undefined) {
loadEntry(entryId, function (entry) {
ancestorList.push(entry);
Expand All @@ -649,7 +647,7 @@ export default function ($rootScope, $scope, $state, $stateParams, $uibModal, $w
} // ^- if cached but no parentId present, we reached the root node and return the list
}

function toggleEntriesInList (list) {
function toggleEntriesInList(list) {

var current = list[0];
if (current !== undefined) {
Expand All @@ -662,7 +660,7 @@ export default function ($rootScope, $scope, $state, $stateParams, $uibModal, $w
}
}

function waitForElem (id, callback) {
function waitForElem(id, callback) {
var elem = document.getElementById(id);
$timeout(function () {
if (elem) callback(elem);
Expand All @@ -672,11 +670,11 @@ export default function ($rootScope, $scope, $state, $stateParams, $uibModal, $w

function toggleMoreEntries(entry) {
var parentEntry = $scope.entryMap[entry.parentId];
var foundEntry = parentEntry.children.find(function(e) { return e.id == entry.id });
var foundEntry = parentEntry.children.find(function (e) { return e.id == entry.id });
if (!foundEntry) {
waitForElem("entry-more-" + entry.parentId, function(elem) {
waitForElem("entry-more-" + entry.parentId, function (elem) {
elem.parentNode.scrollIntoView();
$scope.loadChildren(parentEntry).then(function() {
$scope.loadChildren(parentEntry).then(function () {
toggleMoreEntries(entry);
});
});
Expand Down
24 changes: 11 additions & 13 deletions frontend/app/con10t-widgets/con10t-search.directive.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default function($location, $filter) {
export default function ($location, $filter) {
return {
restrict: 'E',
template: require('./con10t-search.html'),
Expand All @@ -9,21 +9,19 @@ export default function($location, $filter) {
scopeName: '@',
searchPage: '@'
},
link: function(scope, element, attrs) {
link: function (scope, element, attrs) {
scope.placeholder = attrs.searchPlaceholder;
scope.slashRegex = /\//g;
scope.slashRegex = /\//g;

if(!scope.placeholder)
if (!scope.placeholder)
scope.placeholder = $filter('transl8')('ui_projectsearchplaceholder');

scope.search = function() {
scope.search = function () {

// http://localhost:8082/project/syrher?lang=en%2Fsearch%3Fq%3D* /search?q=*

var url = '';
console.log($location.url().split("?")[0])
if (typeof scope.scopeName === "undefined") {
console.log($location.url().split("?")[0])
url += $location.url().split("?")[0] + '/';
} else {
url += 'project/' + scope.scopeName + '/';
Expand All @@ -33,24 +31,24 @@ export default function($location, $filter) {

url += "?q=";

if(scope.catalogId != undefined && scope.catalogId != "")
url += "catalogPaths:"+$filter('escapeSlashes')(scope.catalogId)+"+";
if (scope.catalogId != undefined && scope.catalogId != "")
url += "catalogPaths:" + $filter('escapeSlashes')(scope.catalogId) + "+";

if(scope.q != null && scope.q != "")
if (scope.q != null && scope.q != "")
url += scope.q;
else
url += "*";

if (scope.appendQuery)
url += " AND " + scope.appendQuery;

if(scope.fq != undefined && scope.fq != "") {
if (scope.fq != undefined && scope.fq != "") {
// split at every NOT escaped comma by replacing the comma with ETB, then split at every ETB
var fqs = scope.fq.replace(/([^\\]),/g, '$1\u0017').split('\u0017');
fqs.forEach(function(fq) {
fqs.forEach(function (fq) {
var split = fq.split(':');
// remove backslash in front of escaped commas (de-escape)
url += '&fq='+split[0]+':"'+split[1].replace(/\\,/g, ',')+'"';
url += '&fq=' + split[0] + ':"' + split[1].replace(/\\,/g, ',') + '"';
});
}
$location.url(url);
Expand Down
Loading

0 comments on commit c06c781

Please sign in to comment.