Skip to content

Commit

Permalink
Merge pull request #3311 from dzhw/dev-2023-2-1
Browse files Browse the repository at this point in the history
Feature Release 2023.2.1 for test stage
  • Loading branch information
tilovillwock authored Mar 4, 2024
2 parents 3b3fb9c + 09ecbd1 commit d1a7366
Show file tree
Hide file tree
Showing 40 changed files with 930 additions and 40 deletions.
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Before you can build this project, you must install and configure the following

1. Java: You need to install java 15 sdk on your system. On Ubuntu you should use [SDKMAN!][] (`sdk install java 15.0.2.hs-adpt`)
2. Maven: You need to install maven 3.6.1 or above on your system. On Ubuntu you should use [SDKMAN!][] (`sdk install maven`)
3. [Node.js][]: Node.js 14 and npm (coming with node.js) are required as well. On Ubuntu you should install node using [NVM][] (`nvm install v14`)
3. [Node.js][]: Node.js 16 and npm (coming with node.js) are required as well. On Ubuntu you should install node using [NVM][] (`nvm install v16`)

On Windows, `patch.exe` has to exist in the PATH. It is distributed as part of git bash, or can be downloaded manually from [GnuWin32][].

Expand All @@ -33,6 +33,8 @@ Otherwise your Docker Host will attempt to change permissions on the directories

Use `docker-compose up` to create all containers initially. MongoDB and Elasticsearch will be listening on their default ports. MailDev will show all locally sent email on 8081 and the identity-provider can be setup on port 8082. Any time after that use either `docker-compose up` or `docker-compose start`.

In case elasticsearch does not start successfully, you might need to increase its memory limit
`mem_limit: 512m`, e.g. to `1024` (this change required removing and re-building the container).

You can get a MongoDB dump and restore it locally:
```
Expand Down Expand Up @@ -64,8 +66,10 @@ You will need to setup your `~/.m2/settings.xml` so that maven can download a de
```

Run `mvn` **first** to start the Spring backend and to **make sure** the frontend Angular constants module has been generated by the Maven Plugin. Run `npm --prefix mdm-frontend start` to start the Angular Frontend.

If you run the backend on your machine for the first time or you have restored a mongodb dump then you need to setup the elasticsearch indices. Therefore go to http://localhost:8080/de/health and sign in with `localuser` and password `herzlichwillkommen`. Then click the red button 'reindex'. Reindexing can take up to 1 hour.
```shell
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`:
```
Expand All @@ -75,6 +79,11 @@ dara:
password: {see s3://metadatamanagement-private/sensitive_variables.tf}
```

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,
go to `Administration` on the left, navigate to `External Services` and then
click the red button `Reindex` for the Elasticsearch service. Reindexing can take up to 1 hour.

If you want to build a docker image for the metadatamanagement server app you can run

mvn deploy
Expand Down
4 changes: 4 additions & 0 deletions mdm-frontend/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,10 @@
"src/app/legacy/searchmanagement/directives/instrument-search-filter.controller.js",
"src/app/legacy/searchmanagement/directives/survey-search-filter.directive.js",
"src/app/legacy/searchmanagement/directives/survey-search-filter.controller.js",
"src/app/legacy/searchmanagement/directives/approved-usage-search-filter.directive.js",
"src/app/legacy/searchmanagement/directives/approved-usage-search-filter.controller.js",
"src/app/legacy/searchmanagement/directives/approved-usage-list-search-filter.directive.js",
"src/app/legacy/searchmanagement/directives/approved-usage-list-search-filter.controller.js",
"src/app/legacy/searchmanagement/directives/variable-search-filter.directive.js",
"src/app/legacy/searchmanagement/directives/variable-search-filter.controller.js",
"src/app/legacy/searchmanagement/directives/data-set-search-filter.directive.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ angular.module('metadatamanagementApp').config([
'diskSpace': 'Festplattenplatz',
'mail': 'Email',
'mongo': 'MongoDB',
'elasticsearch': 'ElasticSearch',
'elasticsearch': 'Elasticsearch',
'dara': 'Dara',
'messageBroker': 'Message Broker (für Websockets)',
'rabbit': 'RabbitMQ',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ angular.module('metadatamanagementApp').config([
'diskSpace': 'Disk space',
'mail': 'Email',
'mongo': 'MongoDB',
'elasticsearch': 'ElasticSearch',
'elasticsearch': 'Elasticsearch',
'dara': 'Dara',
'messageBroker': 'Message Broker (for Websockets)',
'rabbit': 'RabbitMQ',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ angular.module('metadatamanagementApp').config([
'access-ways': 'Zugangswege',
'unavailable': 'Nicht vorhanden',
'language': 'Sprache',
'year': 'Erscheinungsjahr'
'year': 'Erscheinungsjahr',
'approved-usage': 'Spezielle Beschränkungen für die Datennutzung'
},
'toolbar': {
'buttons': {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ angular.module('metadatamanagementApp').config([
'access-ways': 'Access Ways',
'unavailable': 'Not available',
'language': 'Language',
'year': 'Publication Year'
'year': 'Publication Year',
'approved-usage': 'Special restrictions for the data use'
},
'toolbar': {
'buttons': {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ angular.module('metadatamanagementApp').config([
var translations = {
//jscs:disable
'data-package-management': {
'common': {
'approvedUsage': {
'scientificUse': 'Wissenschaftliche Nutzung',
'teachingPurposes':'Lehrzwecke',
'nonCommercialUse':'Nichtkommerzielle Nutzung',
'commercialUse':'Kommerzielle Nutzung'
}
},
'detail': {
'label': {
'studySeries': 'Studienreihe',
Expand All @@ -22,13 +30,17 @@ angular.module('metadatamanagementApp').config([
'version': 'Version',
'surveyDesign': 'Erhebungsdesign',
'annotations': 'Anmerkungen',
'transmission-via-VerbundFdb': 'Datenmeldung über den VerbundFDB',
'remarksUserService': 'Bemerkungen für den User Service',
'externalDataPackage': 'DZHW-externes Datenpaket',
'wave': 'Wellen',
'survey-data-type': 'Erhebungsdatentyp',
'survey-period': 'Erhebungszeitraum',
'title': 'Titel',
'dataLanguages': 'Daten verfügbar auf',
'tags': 'Schlagwörter',
'approvedUsageList': 'Erlaubte Nutzungszwecke',
'approvedUsage': 'Spezielle Beschränkungen für die Datennutzung',
'additional-links': 'Weiterführende Links',
'attachments': {
'type': 'Typ',
Expand Down Expand Up @@ -299,6 +311,8 @@ angular.module('metadatamanagementApp').config([
'de': 'Geben Sie zusätzliche Anmerkungen zum Datenpaket auf Deutsch ein.',
'en': 'Geben Sie zusätzliche Anmerkungen zum Datenpaket auf Englisch ein.'
},
'approved-usage-list': 'Geben Sie, falls vorhanden, die erlaubten Nutzungszwecke an.',
'approved-usage': 'Geben Sie, falls vorhanden, die spezielle Beschränkung für die Datennutzung an.',
'description': {
'de': 'Geben Sie eine Beschreibung des Datenpakets auf Deutsch ein.',
'en': 'Geben Sie eine Beschreibung des Datenpakets auf Englisch ein.'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ angular.module('metadatamanagementApp').config([
var translations = {
//jscs:disable
'data-package-management': {
'common': {
'approvedUsage': {
'scientificUse': 'scientific use',
'teachingPurposes':'teaching purposes',
'nonCommercialUse':'non-commercial use',
'commercialUse':'commercial use'
}
},
'detail': {
'label': {
'studySeries': 'Study Series',
Expand All @@ -22,13 +30,17 @@ angular.module('metadatamanagementApp').config([
'version': 'Version',
'surveyDesign': 'Survey Design',
'annotations': 'Annotations',
'transmission-via-VerbundFdb': 'Data transmission via the VerbundFDB',
'remarksUserService': 'Remarks for the User Service',
'externalDataPackage': 'DZHW external data package',
'wave': 'Waves',
'survey-data-type': 'Survey Data Type',
'survey-period': 'Survey Period',
'title': 'Title',
'dataLanguages': 'Data available in',
'tags': 'Tags',
'approvedUsageList': 'Allowed use cases',
'approvedUsage': 'Special restrictions for the data use',
'additional-links': 'Additional Links',
'attachments': {
'type': 'Type',
Expand Down Expand Up @@ -297,6 +309,8 @@ angular.module('metadatamanagementApp').config([
'de': 'Enter additional annotations for this data package in German.',
'en': 'Enter additional annotations for this data package in English.'
},
'approved-usage-list': 'If available enter the allowed use cases.',
'approved-usage': 'If available enter the special restrictions for the data use.',
'description': {
'de': 'Enter a description of this data package in German.',
'en': 'Enter a description of this data package in English.'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,75 @@ angular.module('metadatamanagementApp').factory('DataPackageSearchService', ['$q
});
};

var findApprovedUsage = function(searchText, filter,
ignoreAuthorization) {
ignoreAuthorization = ignoreAuthorization || false;
var query = createQueryObject();
var termFilters = createTermFilters(filter);
query.size = 0;
query.body = {
'aggs': {
'approvedUsage': {
"terms": {
"field": "approvedUsage"
},
'aggs': {
'filtered': {
'filter': {
'bool': {
'must': [{
'match': {}
}]
}
}
}
}
}
}
};

query.body.query = {
'bool': {
'filter': {
'term': {
'shadow': false
}
}
}
};

query.body.aggs.approvedUsage.aggs.filtered.filter.bool.must[0].match
['approvedUsage'] = {
'query': searchText || '',
'operator': 'AND',
'minimum_should_match': '100%',
'zero_terms_query': 'ALL'
};

if (termFilters) {
query.body.query.bool.filter = termFilters;
}

if (!ignoreAuthorization) {
SearchHelperService.addFilter(query);
}

return ElasticSearchClient.search(query).then(function(result) {
var approvedUsage = [];
var approvedUsageElement = {};
result.aggregations.approvedUsage.buckets.forEach(
function(bucket) {
approvedUsageElement = {
title: bucket.key,
count: bucket.doc_count
}
// approvedUsageElement = bucket.key;
approvedUsage.push(approvedUsageElement);
});
return approvedUsage;
});
};

var findInstitutions = function(searchText, filter, language,
ignoreAuthorization, excludedInstitutions) {
ignoreAuthorization = ignoreAuthorization || false;
Expand Down Expand Up @@ -644,6 +713,7 @@ angular.module('metadatamanagementApp').factory('DataPackageSearchService', ['$q
findDataPackageById: findDataPackageById,
findStudySeries: findStudySeries,
findSponsors: findSponsors,
findApprovedUsage: findApprovedUsage,
findInstitutions: findInstitutions,
findDataPackageTitles: findDataPackageTitles,
findInstitutionFilterOptions: findInstitutionFilterOptions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,16 @@
markdown-to-html="$ctrl.options.dataPackage.annotations | displayI18nString"
></p>
</md-list-item>
<md-list-item ng-if="$ctrl.options.dataPackage.transmissionViaVerbundFdb && $ctrl.options.isPublisher()">
<h5>{{'data-package-management.detail.label.transmission-via-VerbundFdb' | translate }}:</h5>
<input type="checkbox" ng-model="$ctrl.options.dataPackage.transmissionViaVerbundFdb"
ng-true-value="true" ng-false-value="false" ng-disabled=true>
</md-list-item>
<md-list-item ng-if="$ctrl.options.dataPackage.externalDataPackage && $ctrl.options.isPublisher()">
<h5>{{'data-package-management.detail.label.externalDataPackage' | translate }}:</h5>
<input type="checkbox" ng-model="$ctrl.options.dataPackage.externalDataPackage"
ng-true-value="true" ng-false-value="false" ng-disabled=true>
</md-list-item>
<md-list-item ng-if="$ctrl.options.dataPackage.additionalLinks && $ctrl.options.dataPackage.additionalLinks.length > 0">
<h5>{{'data-package-management.detail.label.additional-links' | translate }}:</h5>
<ul class="md-secondary" style="list-style-type: none; margin: 0px; margin-block: 0px; padding-inline: 0px; padding: 0px;">
Expand All @@ -126,6 +136,19 @@
</li>
</ul>
</md-list-item>
<md-list-item ng-if="$ctrl.options.dataPackage.approvedUsageList && $ctrl.options.dataPackage.approvedUsageList.length > 0">
<h5>{{'data-package-management.detail.label.approvedUsageList' | translate }}:</h5>
<ul style="list-style: none; padding-left: 0;">
<li ng-repeat="usage in $ctrl.options.dataPackage.approvedUsageList">{{ $ctrl.options.getTranslationPathFromApprovedUsageId(usage) | translate }}</li>
</ul>
</md-list-item>
<md-list-item ng-if="$ctrl.options.dataPackage.approvedUsage && $ctrl.options.dataPackage.approvedUsage.length > 0">
<h5>{{'data-package-management.detail.label.approvedUsage' | translate }}:</h5>
<p
class="md-secondary"
markdown-to-html="$ctrl.options.dataPackage.approvedUsage"
></p>
</md-list-item>
</md-list>
</md-card-content>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,5 +219,25 @@ angular.module('metadatamanagementApp')
});
});
};

ctrl.getTranslationPathFromApprovedUsageId = function(id) {
switch(id) {
case 'SCIENTIFIC_USE':
return "data-package-management.common.approvedUsage.scientificUse"
case 'TEACHING_PURPOSES':
return "data-package-management.common.approvedUsage.teachingPurposes"
case 'NON_COMMERCIAL_USE':
return "data-package-management.common.approvedUsage.nonCommercialUse"
case 'COMMERCIAL_USE':
return "data-package-management.common.approvedUsage.commercialUse"
default:
console.log("ApprovedUsageId (" + id + ") unknown!");
return "unknown"
}
}

ctrl.isPublisher = function() {
return Principal.isPublisher();
};
}]);

Loading

0 comments on commit d1a7366

Please sign in to comment.