in public/javascripts/app/controllers/RestoreFormCtrl.js [42:83]
function loadSourceAndDestinations(){
RestoreService
.getDestinations($routeParams.contentId)
.then((destinations)=> {
SnapshotIdModels.getCollection($routeParams.contentId)
.then((collection) => {
//get model
var model = collection.find((data) => data.activeState);
// set source info
$scope.snapshotRevisionId = model.getRevisionId();
$scope.snapshotSystem = model.getSystem();
$scope.snapshotCreatedDate = model.getCreatedDateHtml();
var systemId = model.getSystemId();
var destination = destinations.find((d) => d.systemId == systemId);
$scope.selectedDestination = destination || destinations[0];
$scope.destinations = destinations.filter((dest) => {
// only display the destinations that the user can restore to
return $scope.canRestoreToAnyStack || dest.systemId === systemId;
}).map((dest) => {
if (dest.changeDetails) {
var lastModified = moment(dest.changeDetails.lastModified);
var formattedDate = DateFormatService.formatHtml(lastModified);
dest.changeString = `currently has revision ${dest.changeDetails.revisionId}, last modified at ${formattedDate}`;
} else if (dest.available) {
dest.changeString = "content not on this instance";
} else {
dest.changeString = "";
}
return dest;
});
})
.catch(() => {
$scope.selectedDestination = null;
});
})
.catch(()=> {
$scope.destinations = [];
});
}