Skip to content

Commit

Permalink
Merge pull request #3321 from dzhw/dev-2024-1-1
Browse files Browse the repository at this point in the history
Release 2024.1.1
  • Loading branch information
tilovillwock authored Mar 22, 2024
2 parents d1a7366 + d0cef11 commit ec77401
Show file tree
Hide file tree
Showing 19 changed files with 133 additions and 16 deletions.
6 changes: 3 additions & 3 deletions mdm-frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mdm-frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mdm-frontend",
"version": "2023.2.1",
"version": "2024.1.1",
"scripts": {
"ng": "ng",
"start": "ng serve --proxy-config proxy.conf.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ angular.module('metadatamanagementApp').config([
'elasticsearch': {
'reindex': 'Reindizieren',
'reindex-success': 'Elasticsearch Indices werden jetzt neu erstellt...'
},
'dara': {
'update': 'Aktualisieren',
'update-success': 'DARA erfolgreich aktualisiert',
'update-failure': 'Es sind Fehler beim Aktualisieren von DARA aufgetreten! (Siehe Details)'
}
},
'logs': {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ angular.module('metadatamanagementApp').config([
'elasticsearch': {
'reindex': 'Reindex',
'reindex-success': 'Elasticsearch indices are currently recreated...'
},
'dara': {
'update': 'Update',
'update-success': 'DARA update successful',
'update-failure': 'Errors occurred during DARA update! (see details)'
}
},
'logs': {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ angular.module('metadatamanagementApp').controller('HealthController', [
'$state',
'BreadcrumbService',
'SimpleMessageToastService',
'DaraReleaseResource',
function($scope, MonitoringService, $uibModal, ElasticSearchAdminService,
PageMetadataService, $state, BreadcrumbService, SimpleMessageToastService) {
PageMetadataService, $state, BreadcrumbService, SimpleMessageToastService, DaraReleaseResource) {
PageMetadataService.setPageTitle('administration.health.title');
$scope.isRecreatingIndices = false;
$scope.updatingHealth = true;
$scope.isUpdatingDara = false;
$scope.separator = '.';

$scope.refresh = function() {
Expand All @@ -39,6 +41,35 @@ angular.module('metadatamanagementApp').controller('HealthController', [
});
};

/**
* Method that calls the updateDaraProjects-method from DaraReleaseResource.
* In this way, all projects are updated in dara.
* In particular projects with surveys that consist of qualitative data are marked.
* Potential errors are listed in details-modal.
*/
$scope.updateDaraProjects = function(health) {
$scope.isUpdatingDara = true;
DaraReleaseResource.updateDaraProjects().then(function(errorsList) {
if (errorsList.length > 0) {
// errors occurred during update
SimpleMessageToastService.openAlertMessageToasts(
[{messageId: 'administration.health.dara.update-failure'}]);
let errorsString = errorsList.length + " errors occured during DARA update:\n" +
"======================================================================\n\n";
for (const errMsg of errorsList) {
errorsString += errMsg + "\n\n======================================================================\n\n";
}
// set health.error, so that errors are shown in Details-Modal
health.error = errorsString;
} else {
// no errors occurred during update
SimpleMessageToastService.openSimpleMessageToast(
'administration.health.dara.update-success');
}
$scope.isUpdatingDara = false;
});
}

$scope.refresh();

$scope.getLabelClass = function(statusState) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@
{{subSystemName(health.name)}}
</td>
<td class="text-center">
<button class="btn btn-danger btn-xs" data-translate="administration.health.elasticsearch.reindex" ng-click="recreateAllElasticsearchIndices()"
ng-disabled="isRecreatingIndices" ng-show="health.name === 'elasticsearch'"
type="button">Reindex
<button ng-if="health.name === 'dara'" class="btn btn-danger btn-xs" data-translate="administration.health.dara.update"
ng-click="updateDaraProjects(health)" ng-disabled="isUpdatingDara" type="button">flag quali-data
</button>
<button ng-if="health.name === 'elasticsearch'" class="btn btn-danger btn-xs"
data-translate="administration.health.elasticsearch.reindex" ng-click="recreateAllElasticsearchIndices()"
ng-disabled="isRecreatingIndices" type="button">Reindex
</button>
</td>
<td class="text-center">
Expand Down
4 changes: 2 additions & 2 deletions mdm-frontend/src/app/legacy/common/footer/footer.html.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<div class="layout-align-end-center layout-column">
<div>
<a class="fdz-footer__link" href="{{$ctrl.lang === 'de' ? 'https://www.dzhw.eu/index_html' : 'https://www.dzhw.eu/en/index_html'}}" target="_blank">
<span class="hide-xs show-gt-xs">2023 {{'disclosure.company' | translate}}</span>
<span class="hide-gt-xs">2023 DZHW GmbH</span>
<span class="hide-xs show-gt-xs">2024 {{'disclosure.company' | translate}}</span>
<span class="hide-gt-xs">2024 DZHW GmbH</span>
</a>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,17 @@ angular.module('metadatamanagementApp')
});
}]);

/**
* Method to request the endpoint that updates all projects in dara-template.
* The response is a list (List<String>) of possible error messages, that occurre during update.
*/
angular.module('metadatamanagementApp').factory('DaraReleaseResource', ['$http',
function($http) {
return {
updateDaraProjects: function() {
return $http.put('/api/data-acquisition-projects/update-dara').then(function(response) {
return response.data;
});
}
};
}]);
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@
version: $ctrl.selectedVersion,
analysisPackage: {
id: $ctrl.analysisPackage.id,
title: $ctrl.analysisPackage.title
title: $ctrl.analysisPackage.title,
doi: $ctrl.analysisPackage.doi
}
});
if ($ctrl.dataPackages.length) {
Expand All @@ -162,7 +163,8 @@
dataPackage: {
id: item.id,
surveyDataTypes: item.surveyDataTypes,
title: item.title
title: item.title,
doi: item.doi
}
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@
surveyDataTypes: $ctrl.dataPackage.surveyDataTypes,
title: $ctrl.dataPackage.title,
remarksUserService: $ctrl.dataPackage.remarksUserService,
approvedUsage: $ctrl.dataPackage.approvedUsage
approvedUsage: $ctrl.dataPackage.approvedUsage,
doi: $ctrl.dataPackage.doi
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,6 @@ angular.module('metadatamanagementApp').controller('ShoppingCartController', [
completeProduct.analysisPackage.id = ProjectReleaseService
.stripVersionSuffix(completeProduct.analysisPackage.id);
order.products.push(completeProduct);
console.log(order);
};
ctrl.order = function() {
// check honeypot fields
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<groupId>eu.dzhw.fdz</groupId>
<artifactId>metadatamanagement</artifactId>
<version>2023.2.1</version>
<version>2024.1.1</version>
<packaging>war</packaging>
<name>metadatamanagement</name>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,9 @@ public class OrderedAnalysisPackage implements Serializable {
* The annotations of the {@link AnalysisPackage}.
*/
private I18nString annotations;

/**
* The DOI of the {@link AnalysisPackage}.
*/
private String doi;
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,9 @@ public class OrderedDataPackage implements Serializable {
* The approved usage of a dataPackage. May be null.
*/
private String approvedUsage;

/**
* The DOI of a dataPackage.
*/
private String doi;
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ Page<DataAcquisitionProject> findByIdLikeAndShadowIsFalseAndSuccessorIdIsNullOrd
List<DataAcquisitionProject> findAllByConfigurationPublishersContainsAndShadowIsFalse(
@Param("login") String publishers);

@RestResource(exported = true)
List<DataAcquisitionProject> findAllByShadowIsFalse();

@RestResource(exported = true)
List<DataAcquisitionProject> findAllByConfigurationDataProvidersContainsAndShadowIsFalse(
@Param("login") String dataProviders);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package eu.dzhw.fdz.metadatamanagement.projectmanagement.rest;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import javax.validation.Valid;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.annotation.Secured;
Expand All @@ -20,6 +23,7 @@
import eu.dzhw.fdz.metadatamanagement.common.rest.errors.ErrorListDto;
import eu.dzhw.fdz.metadatamanagement.projectmanagement.domain.DataAcquisitionProject;
import eu.dzhw.fdz.metadatamanagement.projectmanagement.domain.ShadowCopyReleaseToDaraNotAllowed;
import eu.dzhw.fdz.metadatamanagement.projectmanagement.repository.DataAcquisitionProjectRepository;
import eu.dzhw.fdz.metadatamanagement.projectmanagement.service.DaraService;
import eu.dzhw.fdz.metadatamanagement.usermanagement.security.AuthoritiesConstants;
import freemarker.template.TemplateException;
Expand All @@ -39,6 +43,8 @@
public class DaraReleaseResource {

private final DaraService daraService;
@Autowired
private DataAcquisitionProjectRepository projectRepository;

/**
* Release a project to dara (or update it).
Expand All @@ -57,6 +63,28 @@ public ResponseEntity<?> release(@PathVariable String id,
return ResponseEntity.status(status).build();
}

/**
* Update all (non-shadow and non beta-release) projects in dara.
* @return List of errors that occurred during update. Empty List if no errors occurred.
*/
@RequestMapping(value = "/data-acquisition-projects/update-dara",
method = RequestMethod.PUT)
@Secured(value = {AuthoritiesConstants.ADMIN})
public List<String> flagQualityData() {
List<String> templateExceptionMessages = new ArrayList<>();
for (DataAcquisitionProject project : this.projectRepository.findAllByShadowIsFalse()) {
if (project.getRelease() != null
&& !project.getRelease().getVersion().startsWith("0")) { // ignore beta releases (0.X.X)
try {
this.daraService.registerOrUpdateProjectToDara(project);
} catch (Exception e) {
templateExceptionMessages.add("Error in project: " + project.getId() + "\n" + e.getMessage());
}
}
}
return templateExceptionMessages;
}

@ExceptionHandler(ShadowCopyReleaseToDaraNotAllowed.class)
@ResponseBody
@ResponseStatus(HttpStatus.BAD_REQUEST)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,16 @@ private Map<String, Object> getDataForDataPackageTemplate(DataAcquisitionProject
// Add data for collection mode
dataForTemplate.put("surveyToCollectionModesMap", computeSurveyToCollectionModesMap(surveys));

// Add flag for qualitative data in surveys
boolean hasQualitativeSurvey = false;
for (Survey survey : this.surveyRepository.findByDataAcquisitionProjectId(project.getId())) {
if (survey.getDataType().equals(DataTypes.QUALITATIVE_DATA)) {
hasQualitativeSurvey = true;
break;
}
}
dataForTemplate.put("hasQualitativeSurvey", hasQualitativeSurvey);

return dataForTemplate;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class AnalysisPackageSearchDocument extends AnalysisPackage

/**
* Construct the search document with all related subdocuments.
*
*
*/
@SuppressWarnings("CPD-START")
public AnalysisPackageSearchDocument(AnalysisPackage analysisPackage, Release release,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@
<identifier>1</identifier>
<type>VerbundFDB</type>
</alternativeID>
<#if hasQualitativeSurvey>
<alternativeID>
<identifier>2</identifier>
<type>QDN</type>
</alternativeID>
</#if>
</alternativeIDs>
<freeKeywords>
<freeKeyword>
Expand Down

0 comments on commit ec77401

Please sign in to comment.