Skip to content

Commit

Permalink
Implemented PID registration for variables
Browse files Browse the repository at this point in the history
  • Loading branch information
tilovillwock committed Dec 9, 2024
1 parent c114182 commit 08719f5
Show file tree
Hide file tree
Showing 36 changed files with 1,200 additions and 41 deletions.
25 changes: 19 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,26 @@ mvn clean install -f maven-plugin/pom.xml
mvn spring-boot:run
```

In order for all external services to work on your local machine, you need to set the following variables in `application-local.yml`:
```
dara:
endpoint: "https://labs.da-ra.de/dara/"
username: {see s3://metadatamanagement-private/sensitive_variables.tf}
password: {see s3://metadatamanagement-private/sensitive_variables.tf}
In order for all external services to work on your local machine, you need to set the following environment variables
when starting the Spring Boot application:
* `DARA_ENDPOINT` (regular endpoint for registering projects)
* `DARA_USERNAME`
* `DARA_PASSWORD`
* `DARA_PID_ENDPOINT` (endpoint for registering variables)
* `DARA_PID_USERNAME`
* `DARA_PID_PASSWORD`

Starting the application from the command line would look like this:
```sh
DARA_ENDPOINT="https://dara.service/projects/" \
DARA_USERNAME="bob" \
DARA_PASSWORD="secret" \
DARA_PID_ENDPOINT="https://dara.service/variables/" \
DARA_PID_USERNAME="alice" \
DARA_PID_PASSWORD="pid-secret" \
mvn spring-boot:run
```
Use `sensitive-variables.tf` to fill in the **correct credentials**.

If you run the backend on your machine for the first time, or you have restored a
mongodb dump, then you need to setup/reindex the elasticsearch indices. Therefore, login as admin to the application,
Expand Down
5 changes: 4 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@ services:
environment:
- discovery.type=single-node
# ensure group has rwx on this directory
mem_limit: 512m
volumes:
- ./data/elasticsearch/data:/usr/share/elasticsearch/data
ports:
- "9200:9200"
deploy:
resources:
limits:
memory: 1024m
maildev:
image: djfarrelly/maildev
container_name: maildev
Expand Down
1 change: 1 addition & 0 deletions mdm-frontend/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,7 @@
"src/app/legacy/dataacquisitionprojectmanagement/services/projectStatusScoringService.js",
"src/app/legacy/dataacquisitionprojectmanagement/directives/projectStatusBadge.directive.js",
"src/app/legacy/dataacquisitionprojectmanagement/directives/releaseStatusBadge.directive.js",
"src/app/legacy/dataacquisitionprojectmanagement/directives/registrationStatusCard.directive.js",
"src/app/legacy/dataacquisitionprojectmanagement/directives/metadata-status.js",
"src/app/legacy/dataacquisitionprojectmanagement/services/outdatedVersionNotifierService.js",
"src/app/legacy/dataacquisitionprojectmanagement/directives/releaseButton.directive.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ angular.module('metadatamanagementApp').config([
'mongo': 'MongoDB',
'elasticsearch': 'Elasticsearch',
'dara': 'Dara',
'daraPid': 'Dara PID Registrierung',
'messageBroker': 'Message Broker (für Websockets)',
'rabbit': 'RabbitMQ',
'seo4Ajax': 'Seo4Ajax (Prerender as a Service)',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ angular.module('metadatamanagementApp').config([
'mongo': 'MongoDB',
'elasticsearch': 'Elasticsearch',
'dara': 'Dara',
'daraPid': 'Dara PID Registration',
'messageBroker': 'Message Broker (for Websockets)',
'rabbit': 'RabbitMQ',
'seo4Ajax': 'Seo4Ajax (Prerender as a Service)',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ angular.module('metadatamanagementApp').factory('MonitoringService', ['$http',
return $http.get('/management/health').then(function(response) {
return response.data;
});
},
checkDaraPidHealth: function() {
return $http.get('/management/health/daraPid')
.then(response => response.data.status === 'UP')
.catch(response => response.data.status === 'UP');
}
};
}]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ angular.module('metadatamanagementApp').config([
'landing-page-de-title': 'Deutsch',
'landing-page-en-title': 'Englisch',
'landing-page-hint': 'Bitte wählen Sie die Sprache der DOI-Landingpage',
'pid-registration': 'Registierung von persistenten Identifikatoren (PIDs) für die Variablen des Datenpakets',
'pid-registration-hint': 'Markieren Sie dieses Kästchen, wenn sie für jede Variable des Datenpakets eine PID registrieren wollen.',
'pid-api-not-reachable-dialog': {
'title': 'Dienst für PID-Registrierung nicht erreichbar',
'message': 'Der Dienst zur Registrierung von PIDs für Variablen ist aktuell nicht verfügbar. Sie können den Releaseprozess trotzdem vornehmen und die Variablen später registrieren.',
'question': 'Soll der Releaseprozess fortgesetzt werden?'
},
'pin-to-start-page': 'Datenpaket auf Startseite anzeigen',
'pin-to-start-page-hint': 'Markieren Sie dieses Kästchen, wenn das Datenpaket auf der Startseite des MDMs angezeigt werden soll.',
'confirmed': {
Expand Down Expand Up @@ -56,9 +63,11 @@ angular.module('metadatamanagementApp').config([
'deleted-successfully-project': 'Das Datenaufnahmeprojekt "{{ id }}" wurde erfolgreich gelöscht.',
'deleted-not-successfully-project': 'Das Datenaufnahmeprojekt "{{ id }}" konnte nicht gelöscht werden!',
'released-successfully': 'Die Metadaten des Projektes wurden bei da|ra gespeichert und die Daten des Projektes "{{ id }}" werden in ca. 10 Minuten für alle Benutzer:innen sichtbar sein.',
'released-successfully-with-pids': 'Der Releaseprozess wurde angestoßen. Das Datenpaket ist in wenigen Minuten verfügbar. Die Registrierung der PIDs für Variablen wird im Hintergrund ausgeführt und kann bis zu einer Stunde in Anspruch nehmen.',
'dara-update-successfully': 'Die Metadaten des Projektes wurden bei da|ra aktualisiert.',
'released-beta-successfully': 'Die Daten des Projektes "{{ id }}" werden in ca. 10 Minuten für alle Benutzer:innen sichtbar sein. Es wurden keine Metadaten zu da|ra gesendet.',
'dara-released-not-successfully': 'Die Daten des Projektes "{{ id }}" können nicht veröffentlicht werden. Der da|ra-Service zur Registrierung der DOI ist aktuell nicht verfügbar. Kontaktieren Sie den Administrator ([email protected]) und versuchen Sie es später erneut.',
'dara-pid-previous-registration': 'Es sind bereits PIDs für die Variablen in dieser Version registriert, es wird keine neue Registrierung vorgenommen. Der Release des Datenpakets wird wie gewohnt durchgeführt, es sind keine weiteren Aktionen erforderlich.',
'unreleased-successfully': 'Die Daten des Projektes "{{ id }}" können jetzt bearbeitet werden.',
'unrelease-title': 'Freigabe für Projekt "{{ id }}" zurücknehmen?',
'unrelease': 'Möchten Sie wirklich die Freigabe zurücknehmen und die Metadaten des Projektes "{{ id }}" bearbeiten?',
Expand Down Expand Up @@ -157,6 +166,10 @@ angular.module('metadatamanagementApp').config([
'unreleased': 'Nicht freigegeben',
'pre-released': 'Vorläufig freigegeben'
},
'registration-status-badge': {
'registered': 'PIDs registriert',
'not-registered': 'Keine PIDs registriert'
},
'project-cockpit': {
'title': 'Projekt-Cockpit ({{projectId}})',
'header': 'Projekt-Cockpit',
Expand Down Expand Up @@ -186,7 +199,8 @@ angular.module('metadatamanagementApp').config([
'save': 'Klicken, um die Anpassungen zu speichern.',
'save-assign': 'Klicken, um die Anpassungen zu speichern und das Projekt zuzuweisen.',
'save-takeback': 'Klicken, um die Anpassungen zu speichern und das Projekt der Gruppe Publisher zuzuweisen.',
'remove-user': 'Nutzer:in entfernen'
'remove-user': 'Nutzer:in entfernen',
'register-pids': 'PIDs bei da|ra registrieren'
},
'list': {
'empty-data-provider': 'Keine Datengeber:innen sind diesem Projekt zugeteilt.',
Expand Down Expand Up @@ -258,6 +272,13 @@ angular.module('metadatamanagementApp').config([
'unhide-shadow': 'Diese Version ist aktuell nicht für alle Benutzer:innen sichtbar. Klicken Sie hier, um die Version wieder sichtbar zu machen!',
'pre-released': 'Diese Version unterliegt bis zum {{date}} einem Embargo durch die Datengeber:innen. Die Veröffentlichung kann erst nach diesem Datum erfolgen.'
}
},
'pid-registration': {
'confirm-dialog': {
'title': 'PIDs bei da|ra registrieren',
'message': 'Die Registrierung der PIDs für Variablen wird im Hintergrund ausgeführt und kann bis zu einer Stunde in Anspruch nehmen.',
'question': 'Möchten Sie fortfahren?'
}
}
},
'project-overview': {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ angular.module('metadatamanagementApp').config([
'landing-page-de-title': 'German',
'landing-page-en-title': 'English',
'landing-page-hint': 'Please select the language of the DOI landing page',
'pid-registration': 'Registration of Persistent Identifiers (PIDs) for the variables of the data package',
'pid-registration-hint': 'Check this box if you want to register PIDs for each variable of the data package',
'pid-api-not-reachable-dialog': {
'title': 'PID registration service not available',
'message': 'The service for registering PIDs for variables is currently not available. You can still carry out the release and register the variables later.',
'question': 'Should the release process be continued?'
},
'pin-to-start-page': 'Show Data Package on Start Page',
'pin-to-start-page-hint': 'Check this box, if you want to show this data package on the start page.',
'confirmed': {
Expand Down Expand Up @@ -56,10 +63,12 @@ angular.module('metadatamanagementApp').config([
'deleted-successfully-project': 'Successfully deleted Data Acquisition Project "{{ id }}"!',
'deleted-not-successfully-project': 'Could not delete Data Acquisition Project "{{ id }}"!',
'released-successfully': 'The projects metadata has been sent to da|ra and the data of the project "{{ id }}" will be visible to all users in about 10 minutes.',
'released-successfully-with-pids': 'The release process has been initiated. The data package will be available in a few minutes. The registration of the PIDs for variables is carried out in the background and can take up to an hour.',
'dara-update-successfully': 'The projects metadata has been updated at da|ra.',
'released-beta-successfully': 'The data of the project "{{ id }}" will be visible to all users in about 10 minutes. No metadata has been sent to da|ra.',
'unreleased-successfully': 'The data of the project "{{ id }}" can now be edited by assigned Publishers and Data Providers.',
'dara-released-not-successfully': 'The data of the project "{{ id }}" could not be released. The da|ra service for registering the DOI is currently not available. Contact the administrator ([email protected]) and try again later.',
'dara-pid-previous-registration': 'PIDs are already registered for the variables in this version, no new registration will be made. The data package is released as usual, no further action is required.',
'unrelease-title': 'Unrelease Project "{{ id }}"?',
'unrelease': 'Do you really want to unrelease the project "{{ id }}" and edit its metadata?',
'release-not-possible-title': 'Project "{{ id }}" cannot be released!',
Expand Down Expand Up @@ -158,6 +167,10 @@ angular.module('metadatamanagementApp').config([
'unreleased': 'Unreleased',
'pre-released': 'Preliminarily released'
},
'registration-status-badge': {
'registered': 'PIDs registered',
'not-registered': 'No PIDs registered'
},
'project-cockpit': {
'title': 'Project-Cockpit ({{projectId}})',
'header': 'Project-Cockpit',
Expand Down Expand Up @@ -187,7 +200,8 @@ angular.module('metadatamanagementApp').config([
'save': 'Click to save the changes.',
'save-assign': 'Click to save the changes and to assign the project.',
'save-takeback': 'Click to save the changes and to assign the project to the publishers group.',
'remove-user': 'Remove user'
'remove-user': 'Remove user',
'register-pids': 'Register PIDs with da|ra'
},
'list': {
'empty-data-provider': 'No data providers are assigned to this project.',
Expand Down Expand Up @@ -259,6 +273,13 @@ angular.module('metadatamanagementApp').config([
'unhide-shadow': 'This version is currently not visible for all users. Click here to make it available for all users!',
'pre-released': 'This version is subject to an embargo until {{ date }}. The final release can only take place after this date.'
}
},
'pid-registration': {
'confirm-dialog': {
'title': 'Register PIDs with da|ra',
'message': 'The registration of the PIDs for variables is carried out in the background and can take up to an hour.',
'question': 'Do you want to proceed?'
}
}
},
'project-overview': {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ angular.module('metadatamanagementApp')
templateUrl: 'scripts/dataacquisitionprojectmanagement/directives/' +
'project-cockpit-status.html.tmpl',
scope: {
project: '='
project: '=',
variablesCheck: '<'
},
replace: true,
controllerAs: 'ctrl',
Expand All @@ -36,6 +37,7 @@ angular.module('metadatamanagementApp')
this.isAssignedPublisher =
ProjectUpdateAccessService.isAssignedToProject.bind(null,
this.project, 'publishers');
this.hasAdminRole = () => Principal.isAdmin();
}],
/* jshint -W098 */
link: function($scope, elem, attrs, ctrl) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
</md-button>
</div>
</md-card>
<registration-status-card
ng-if="!!ctrl.project.release && ctrl.hasAdminRole()"
project="ctrl.project"
status="variablesCheck"
></registration-status-card>
</div>
</div>
<div layout-gt-sm="row" layout="column" layout-wrap class="mb8">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<md-card layout-align="center center" style="min-width: 200px;">
<span ng-if="status.hasRegistrations" style="border-radius: 11px; font-weight: bold; padding: 0.1rem 0.8rem 0.1rem 0.8rem; margin: 0.8rem;"
class="fdz-released"
>{{ 'data-acquisition-project-management.registration-status-badge.registered' | translate }}</span>
<span ng-if="!status.hasRegistrations" style="border-radius: 11px; font-weight: bold; padding: 0.1rem 0.8rem 0.1rem 0.8rem; margin: 0.8rem;"
class="bg-primary"
>{{ 'data-acquisition-project-management.registration-status-badge.not-registered' | translate }}</span>
<md-button class="md-raised md-fab md-mini md-primary"
ng-click="ctrl.registerVariables()"
ng-disabled="!status.hasVariables || status.hasRegistrations"
>
<md-icon md-font-set="material-icons">app_registration</md-icon>
<md-tooltip md-direction="bottom" md-autohide="true">
{{ 'data-acquisition-project-management.project-cockpit.button.register-pids' | translate }}
</md-tooltip>
</md-button>
</md-card>
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
'use strict';
/**
* Directive rendering the PID registration status of variables linked to a project
*/
angular.module('metadatamanagementApp').directive('registrationStatusCard', [
'DaraReleaseResource',
'$translate',
'$mdDialog',
function (DaraReleaseResource, $translate, $mdDialog) {
return {
restrict: 'E',
templateUrl: 'scripts/dataacquisitionprojectmanagement/' +
'directives/registrationStatusCard.directive.html.tmpl',
scope: {
project: '<',
status: '<'
},
controllerAs: 'ctrl',
controller: ['$scope', function ($scope) {
/**
* Prompts for confirmation and proceeds
* to trigger the PID registration process.
*/
this.registerVariables = async () => {
const i18nPrefix = 'data-acquisition-project-management' +
'.project-cockpit.pid-registration.confirm-dialog.';
const confirmDialog = $mdDialog.confirm()
.title($translate.instant(i18nPrefix + 'title'))
.textContent(
$translate.instant(i18nPrefix + 'message') +
'\n\n' +
$translate.instant(i18nPrefix + 'question')
)
.ariaLabel(
$translate.instant(i18nPrefix + 'message') +
$translate.instant(i18nPrefix + 'question')
)
.ok($translate.instant('global.common-dialogs.yes'))
.cancel($translate.instant('global.common-dialogs.no'));
$mdDialog.show(confirmDialog)
.then(() => DaraReleaseResource.variablesRegister($scope.project));
}
}]
};
}
]);
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,18 @@ angular.module('metadatamanagementApp')
}, {
'release': {
method: 'POST',
url: '/api/data-acquisition-projects/:id/release'
},
'preRelease': {
method: 'POST',
url: '/api/data-acquisition-projects/:id/pre-release'
},
variablesCheck: {
method: 'GET',
url: '/api/data-acquisition-projects/:id/variables-check'
},
variablesRegister: {
method: 'POST',
url: '/api/data-acquisition-projects/:id/variables-register'
}
});
}]);
Expand Down
Loading

0 comments on commit 08719f5

Please sign in to comment.