Revision 62129
Added by Michele Artini about 2 years ago
repoControllers.js | ||
---|---|---|
241 | 241 |
|
242 | 242 |
$scope.prepareUpdateRepoApi = function() { |
243 | 243 |
$scope.tempAccessParams = angular.copy($scope.currentRepoApi.accessParams); |
244 |
|
|
245 |
$scope.tempMdIdPath = ''; |
|
246 |
angular.forEach($scope.currentRepoApi.otherParams, function(param, pos){ |
|
247 |
if (param.name == 'metadata_identifier_path') { |
|
248 |
$scope.tempMdIdPath = param.value; |
|
249 |
} |
|
250 |
}); |
|
244 |
$scope.tempMdIdPath = $scope.currentRepoApi.metadataIdentifierPath; |
|
251 | 245 |
} |
252 | 246 |
|
253 | 247 |
|
... | ... | |
331 | 325 |
|
332 | 326 |
|
333 | 327 |
$scope.verifyMetaWf = function(ds, wf) { |
334 |
var compliance = ''; |
|
335 |
var type = ''; |
|
336 |
angular.forEach(ds.commonParams, function(p,pos) { |
|
337 |
if (p.id == 'compliance') { |
|
338 |
compliance = p.value; |
|
339 |
} |
|
340 |
if (p.id == 'typology') { |
|
341 |
type = p.value; |
|
342 |
} |
|
343 |
}); |
|
344 |
|
|
345 |
return (compliance && type && $scope.isValidTerm(compliance, wf.compliances) && $scope.isValidTerm(type, wf.ifaceTypes)); |
|
328 |
var compliance = ds.compliance; |
|
329 |
var type = ds.repoType; |
|
330 |
|
|
331 |
return ( |
|
332 |
compliance && |
|
333 |
type && |
|
334 |
$scope.isValidTerm(compliance, wf.compliances) && |
|
335 |
$scope.isValidTerm(type, wf.ifaceTypes) && |
|
336 |
$scope.isValidBoolean(ds.consentTermsOfUseLabel, wf.consentTermsOfUseLabel) && |
|
337 |
$scope.isValidBoolean(ds.fullTextDownloadLabel, wf.fullTextDownloadLabel) |
|
338 |
); |
|
346 | 339 |
} |
347 | 340 |
|
348 | 341 |
$scope.isValidTerm = function(term, list) { |
... | ... | |
352 | 345 |
} |
353 | 346 |
var res = false; |
354 | 347 |
angular.forEach(list, function(curr,pos) { |
355 |
if (term.lastIndexOf(curr, 0) === 0) { // implementation of term.startsWith(curr)
|
|
348 |
if (term == curr) {
|
|
356 | 349 |
res = true; |
357 | 350 |
} |
358 | 351 |
}); |
359 | 352 |
return res; |
360 | 353 |
} |
361 | 354 |
|
355 |
$scope.isValidBoolean = function(term, expected) { |
|
356 |
if (expected == null || expected == 'UNKNOWN') { |
|
357 |
return true; |
|
358 |
} else { |
|
359 |
return term == expected; |
|
360 |
} |
|
361 |
} |
|
362 |
|
|
363 |
|
|
362 | 364 |
$scope.overrideApiCompliance = function(level) { |
363 | 365 |
$scope.showSpinner(); |
364 | 366 |
$http.get('repoApiCompliance.update?id=' + $scope.currentRepoApi.repoId + '&iface=' + $scope.currentRepoApi.id + '&compliance=' + level) |
... | ... | |
395 | 397 |
|
396 | 398 |
$scope.showCreateRemoteSyncApi = function(mongoUrl, mongoDB, mdId, apiSuffix) { |
397 | 399 |
|
398 |
var path = "//*[local-name()='header']/*[local-name()='identifier']"; |
|
399 |
angular.forEach($scope.currentRepoApi.otherParams, function(p) { |
|
400 |
if (p.id=='metadata_identifier_path') { |
|
401 |
path = p.value; |
|
402 |
} |
|
403 |
}); |
|
404 |
|
|
405 |
var compliance = "UNKNOWN"; |
|
406 |
angular.forEach($scope.currentRepoApi.commonParams, function(p) { |
|
407 |
if (p.id=='compliance') { |
|
408 |
compliance = p.value; |
|
409 |
} |
|
410 |
}); |
|
400 |
var path = $scope.currentRepoApi.metadataIdentifierPath; |
|
411 | 401 |
|
412 |
var typology = "UNKNOWN"; |
|
413 |
angular.forEach($scope.currentRepoApi.commonParams, function(p) { |
|
414 |
if (p.id=='typology') { |
|
415 |
typology = p.value; |
|
416 |
} |
|
417 |
}); |
|
402 |
if (!path) { |
|
403 |
path = "//*[local-name()='header']/*[local-name()='identifier']"; |
|
404 |
} |
|
418 | 405 |
|
406 |
var compliance = $scope.currentRepoApi.compliance; |
|
407 |
var typology = $scope.currentRepoApi.repoType; |
|
408 |
|
|
419 | 409 |
$scope.showSpinner(); |
420 | 410 |
$http.get('remoteDatasource/apis?repo=' + $routeParams.repoId) |
421 | 411 |
.success( |
Also available in: Unified diff
merge from eosc_services