Skip to content

Commit

Permalink
when importing urls corresponding to preexisting WEs, add these urls …
Browse files Browse the repository at this point in the history
…to their list of startpages (#365)
  • Loading branch information
boogheta committed Nov 15, 2019
1 parent 7dd6ab9 commit e4a40ed
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
3 changes: 2 additions & 1 deletion hyphe_frontend/app/views/definewebentities.html
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,8 @@ <h1>{{createdList.length}} web entit{{createdList.length | y_ies}} created</h1>
<div style="height: 60px; text-align: center;">
{{existingList.length}} web entit{{existingList.length | y_ies}}
<br/>
already existed
which already existed<br/>
{{existingList.length | were_was}} completed with startpages
</div>
<div style="height: 60px" layout="column" layout-align="center center">
<md-checkbox class="md-primary" ng-model="$parent.$parent.crawlExisting" ng-if="createdList.length > 0">
Expand Down
30 changes: 27 additions & 3 deletions hyphe_frontend/app/views/definewebentities.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,9 @@ angular.module('hyphe.definewebentitiesController', [])

// Keep track of created web entity prefixes
var createdPrefixes = {}
var queriesBatcher = new QueriesBatcher()

// Mark all "existing"
// Mark all "existing" and add new startpages to them
$scope.list.forEach(function(obj){
var webentityFound
(obj.parentWebEntities || []).forEach(function(we){
Expand All @@ -206,13 +207,36 @@ angular.module('hyphe.definewebentitiesController', [])
}
})
if(webentityFound){
obj.status = 'existing'
obj.webentity = webentityFound
// Add the url to the existing WebEntity's startpages
queriesBatcher.addQuery(
api.addStartPage
, {
webentityId: webentityFound.id
,url: obj.url
}
, function() { // Success
console.log('STARTPAGE ADDED')
obj.status = 'existing'
}
,function (data, status, headers, config) { // Error
obj.status = 'error'
console.log('[row '+(obj.id+1)+'] Error while adding startpage '+obj.url+' to webentity', webentityFound, data, 'status', status, 'headers', headers, config)
if(data && data[0] && data[0].code == 'fail'){
obj.infoMessage = data[0].message
}
}
,{
label: obj.lru
,before: function(){
obj.status = 'pending'
}
}
)
}
})

// Query the rest
var queriesBatcher = new QueriesBatcher()
$scope.list
.filter(function(obj){
var webentityFound
Expand Down

0 comments on commit e4a40ed

Please sign in to comment.