Merge branch 'dmp-refactoring' of https://code-repo.d4science.org/MaDgiK-CITE/argos into dmp-refactoring

This commit is contained in:
Sofia Papacharalampous 2024-05-14 15:38:51 +03:00
commit 0955c52da9
26 changed files with 242 additions and 124 deletions

2
.gitignore vendored
View File

@ -56,3 +56,5 @@ backend/target/classes/
backend/core/target/maven-archiver/
backend/node_modules/.yarn-integrity
dmp-frontend/.nx/
notification-service/notification-web/src/main/resources/config/app.env
backend/web/src/main/resources/config/app.env

View File

@ -46,10 +46,6 @@
<appender-ref ref="TROUBLESHOOTING"/>
<appender-ref ref="STDOUT"/>
</logger>
<logger name="org.springframework.data.elasticsearch.client.WIRE" level="TRACE" additivity="false">
<appender-ref ref="TROUBLESHOOTING"/>
<appender-ref ref="STDOUT"/>
</logger>
<logger name="audit" level="INFO" additivity="false">
<appender-ref ref="AUDITING"/>
<appender-ref ref="STDOUT"/>

View File

@ -0,0 +1,4 @@
dashboard:
reference-type-counters:
- "7eeffb98-58fb-4921-82ec-e27f32f8e738"
- "5b9c284f-f041-4995-96cc-fad7ad13289c"

View File

@ -1,4 +1,2 @@
dashboard:
reference-type-counters:
- "7eeffb98-58fb-4921-82ec-e27f32f8e738"
- "5b9c284f-f041-4995-96cc-fad7ad13289c"
reference-type-counters: []

View File

@ -1,9 +1,3 @@
#database:
# driver-class-name: org.postgresql.Driver
# lock-fail-interval: 120000
# url: ${DB_URL:}
# username: ${DB_USER:}
# password: ${DB_PASS:}
spring:
jpa:
properties:
@ -19,9 +13,9 @@ spring:
physical-strategy: org.opencdmp.data.namingstrategy.PrefixPhysicalNamingStrategy
implicit-strategy: org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy
datasource:
url: ${DB_URL:}
username: ${DB_USER:}
password: ${DB_PASS:}
url: ${DB_URL}
username: ${DB_USER}
password: ${DB_PASS}
driver-class-name: org.postgresql.Driver
hikari:
connection-timeout: 30000

View File

@ -1,10 +1,10 @@
elastic:
enabled: ${ELASTIC_ENABLED:}
enabled: ${ELASTIC_ENABLED}
hosts:
- ${ELASTIC_HOST:}
username: ${ELASTIC_USER:}
password: ${ELASTIC_PASS:}
useSSL: ${ELASTIC_USE_SSL:}
- ${ELASTIC_HOST}
username: ${ELASTIC_USER}
password: ${ELASTIC_PASS}
useSSL: ${ELASTIC_USE_SSL}
socketTimeoutMillis: 30000
connectTimeoutMillis: 30000
defaultResultSize: 100
@ -14,8 +14,8 @@ elastic:
defaultCompositeAggregationResultSize: 200000
disableHostnameVerifier: false
app-elastic:
enabled: ${ELASTIC_ENABLED:}
dmpIndexName: ${ELASTIC_DMP_INDEX:}
descriptionIndexName: ${ELASTIC_DESCRIPTION_INDEX:}
enabled: ${ELASTIC_ENABLED}
dmpIndexName: ${ELASTIC_DMP_INDEX}
descriptionIndexName: ${ELASTIC_DESCRIPTION_INDEX}
enableIcuAnalysisPlugin: false
resetBatchSize: 1000

View File

@ -1,7 +1,3 @@
pdf:
converter:
url: ${PDF_CONVERTER_URL:}
publicapi:
host: devel.opendmp.eu
basePath: /srv

View File

@ -1,36 +1,2 @@
logging:
config: classpath:logging/logback-${spring.profiles.active}.xml
context:
request:
requestIdKey: req.id
requestRemoteHostKey: req.remoteHost
requestUriKey: req.requestURI
requestQueryStringKey: req.queryString
requestUrlKey : req.requestURL
requestMethodKey: req.method
requestUserAgentKey: req.userAgent
requestForwardedForKey: req.xForwardedFor
requestSchemeKey: req.scheme
requestRemoteAddressKey: req.remoteAddr
requestRemotePortKey: req.remotePort
requestRemoteUserKey: req.remoteUser
principal:
subjectKey: usr.subject
nameKey: usr.name
clientKey: usr.client
audit:
enable: true
requestRemoteHostKey: req.remoteHost
requestUriKey: req.requestURI
requestQueryStringKey: req.queryString
requestUrlKey : req.requestURL
requestMethodKey: req.method
requestUserAgentKey: req.userAgent
requestForwardedForKey: req.xForwardedFor
requestSchemeKey: req.scheme
requestRemoteAddressKey: req.remoteAddr
requestRemotePortKey: req.remotePort
requestRemoteUserKey: req.remoteUser
principalSubjectKey: usr.subject
principalNameKey: usr.name
principalClientKey: usr.client
config: classpath:logging/logback-${spring.profiles.active}.xml

View File

@ -0,0 +1,14 @@
notification:
dmpInvitationExternalUserType: 065DEECD-21BB-44AF-9983-E660FDF24BC4
dmpInvitationExistingUserType: 4904dea2-5079-46d3-83be-3a19c9ab45dc
dmpModifiedType: 4542262A-22F8-4BAA-9DB6-1C8E70AC1DBB
dmpFinalisedType: 90DB0B46-42DE-BD89-AEBF-6F27EFEB256E
descriptionModifiedType: 4FDBFA80-7A71-4A69-B854-67CBB70648F1
descriptionFinalisedType: 33790bad-94d4-488a-8ee2-7f6295ca18ea
mergeAccountConfirmationType: BFE68845-CB05-4C5A-A03D-29161A7C9660
removeCredentialConfirmationType: C9BC3F16-057E-4BBA-8A5F-36BD835E5604
dmpDepositType: 55736F7A-83AB-4190-AF43-9D031A6F9612
descriptionTemplateInvitationType: 223BB607-EFA1-4CE7-99EC-4BEABFEF9A8B
contactSupportType: 5B1D6C52-88F9-418B-9B8A-6F1F963D9EAD
publicContactSupportType: B542B606-ACC6-4629-ADEF-4D8EE2F01222
contactSupportEmail: support@dmp.com

View File

@ -1,15 +1,2 @@
notification:
dmpInvitationExternalUserType: 065DEECD-21BB-44AF-9983-E660FDF24BC4
dmpInvitationExistingUserType: 4904dea2-5079-46d3-83be-3a19c9ab45dc
dmpModifiedType: 4542262A-22F8-4BAA-9DB6-1C8E70AC1DBB
dmpFinalisedType: 90DB0B46-42DE-BD89-AEBF-6F27EFEB256E
descriptionModifiedType: 4FDBFA80-7A71-4A69-B854-67CBB70648F1
descriptionFinalisedType: 33790bad-94d4-488a-8ee2-7f6295ca18ea
mergeAccountConfirmationType: BFE68845-CB05-4C5A-A03D-29161A7C9660
removeCredentialConfirmationType: C9BC3F16-057E-4BBA-8A5F-36BD835E5604
dmpDepositType: 55736F7A-83AB-4190-AF43-9D031A6F9612
descriptionTemplateInvitationType: 223BB607-EFA1-4CE7-99EC-4BEABFEF9A8B
contactSupportType: 5B1D6C52-88F9-418B-9B8A-6F1F963D9EAD
publicContactSupportType: B542B606-ACC6-4629-ADEF-4D8EE2F01222
contactSupportEmail: support@dmp.com
emailExpirationTimeSeconds: 14400

View File

@ -0,0 +1,10 @@
public-api:
reference-type-map:
funderTypeId: "538928bb-c7c6-452e-b66d-08e539f5f082"
grantTypeId: "5b9c284f-f041-4995-96cc-fad7ad13289c"
registryTypeId: "2beacaad-3223-43ad-ad99-1e5f21328e7b"
serviceTypeId: "9ec2000d-95c7-452e-b356-755fc8e2574c"
dataRepositoryTypeId: "d26b64ba-fda0-4b14-b3ef-9856a492d55a"
datasetTypeId: "a3ce0fb2-d72c-48bb-b322-7401940cb802"
researcherTypeId: "5a2112e7-ea99-4cfe-98a1-68665e26726e"
organizationTypeId: "7eeffb98-58fb-4921-82ec-e27f32f8e738"

View File

@ -1,10 +1,2 @@
public-api:
reference-type-map:
funderTypeId: "538928bb-c7c6-452e-b66d-08e539f5f082"
grantTypeId: "5b9c284f-f041-4995-96cc-fad7ad13289c"
registryTypeId: "2beacaad-3223-43ad-ad99-1e5f21328e7b"
serviceTypeId: "9ec2000d-95c7-452e-b356-755fc8e2574c"
dataRepositoryTypeId: "d26b64ba-fda0-4b14-b3ef-9856a492d55a"
datasetTypeId: "a3ce0fb2-d72c-48bb-b322-7401940cb802"
researcherTypeId: "5a2112e7-ea99-4cfe-98a1-68665e26726e"
organizationTypeId: "7eeffb98-58fb-4921-82ec-e27f32f8e738"
reference-type-map: []

View File

@ -10,6 +10,6 @@ web:
token-type: JWT #| opaque
jwt:
claims: [ role, x-role ]
issuer-uri: ${IDP_ISSUER_URI:}
issuer-uri: ${IDP_ISSUER_URI}
audiences: [ "dmp_web" ]
validIssuer: ${IDP_ISSUER_URI:}
validIssuer: ${IDP_ISSUER_URI}

View File

@ -30,8 +30,8 @@ RABBIT_PASS=guest
#KEYCLOAK
KEYCLOAK_API_SERVER_URL=http://host.docker.internal:8081/keycloak
KEYCLOAK_API_REALM=OpenCDMP
KEYCLOAK_API_USERNAME=keycloak-admin
KEYCLOAK_API_PASSWORD=admin
KEYCLOAK_API_USERNAME=dmp-keycloak-api
KEYCLOAK_API_PASSWORD=dmp-api
KEYCLOAK_API_CLIENT_ID=dmp_web
KEYCLOAK_API_CLIENT_SECRET=web_secret

View File

@ -0,0 +1,22 @@
<div class="dmp-delete-dialog">
<div class="row mt-3">
<div mat-dialog-title class="col-12 pr-1 d-flex justify-content-between">
<span class="mr-3 title">{{'DMP-DELETE-DIALOG.WARNING' | translate}}</span>
<mat-icon class="close-icon" (click)="close()">close</mat-icon>
</div>
</div>
<div class="row d-flex flex-row mb-2">
<div class="col message pb-4 pl-3">{{'DMP-DELETE-DIALOG.DELETE-ITEM' | translate}}</div>
</div>
<div class="row mt-3 mr-3 mb-3">
<ng-container *ngIf="descriptions">
<ul class="error-list">
<li *ngFor="let description of descriptions">{{description.label}}</li>
</ul>
</ng-container>
</div>
<div class="row" style="justify-content: space-between;">
<div class="col-auto"><button mat-raised-button type="button" class="cancel-btn" (click)="cancel()">{{'DMP-DELETE-DIALOG.ACTIONS.CANCEL' | translate}}</button></div>
<div class="col-auto"><button mat-raised-button type="button" (click)="confirm()" class="delete-btn">{{'DMP-DELETE-DIALOG.ACTIONS.DELETE' | translate}}</button></div>
</div>
</div>

View File

@ -0,0 +1,55 @@
// ::ng-deep .mat-dialog-container {
// overflow: hidden;
// padding: 20px;
// border-radius: 125px;
// }
.dmp-delete-dialog {
padding: 24px;
overflow: hidden;
.confirmation {
padding-bottom: 20px;
}
.close-btn {
margin-left: auto;
cursor: pointer;
}
.warn-text {
// color: #f44336;
}
.cancel {
background-color: #aaaaaa;
color: #ffffff;
}
.cancel-btn {
min-width: 101px;
height: 43px;
background: #ffffff;
border: 1px solid #b5b5b5;
border-radius: 30px;
opacity: 1;
}
.delete {
background-color: #ba2c2c;
color: #ffffff;
}
.delete-btn {
min-width: 101px;
height: 43px;
background: #ffffff;
color: #ba2c2c;
border: 1px solid #ba2c2c;
border-radius: 30px;
opacity: 1;
}
}

View File

@ -0,0 +1,31 @@
import { Component, Inject } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { Description } from '@app/core/model/description/description';
@Component({
selector: 'app-dmp-delete-dialog',
templateUrl: './dmp-delete-dialog.component.html',
styleUrls: ['./dmp-delete-dialog.component.scss']
})
export class DmpDeleteDialogComponent {
descriptions: Description[];
constructor(
public dialogRef: MatDialogRef<DmpDeleteDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: any
) {
this.descriptions = data.descriptions;
}
close() {
this.dialogRef.close(false);
}
cancel() {
this.dialogRef.close(false);
}
confirm() {
this.dialogRef.close(true);
}
}

View File

@ -0,0 +1,13 @@
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { CommonUiModule } from '@common/ui/common-ui.module';
import { DmpDeleteDialogComponent } from './dmp-delete-dialog.component';
@NgModule({
imports: [CommonUiModule, FormsModule],
declarations: [DmpDeleteDialogComponent],
exports: [DmpDeleteDialogComponent]
})
export class DmpDeleteDialogModule {
constructor() { }
}

View File

@ -11,6 +11,7 @@ import { DmpUserFieldModule } from '../dmp-user-field/dmp-user-field.module';
import { DmpEditorComponent } from './dmp-editor.component';
import { DmpEditorRoutingModule } from './dmp-editor.routing';
import { DmpFormProgressIndicationModule } from './form-progress-indication/dmp-form-progress-indication.module';
import { DmpDeleteDialogModule } from '../dmp-delete-dialog/dmp-delete-dialog.module';
@NgModule({
imports: [
@ -18,6 +19,7 @@ import { DmpFormProgressIndicationModule } from './form-progress-indication/dmp-
CommonFormsModule,
FormattingModule,
ConfirmationDialogModule,
DmpDeleteDialogModule,
DmpEditorRoutingModule,
RichTextEditorModule,
AutoCompleteModule,

View File

@ -29,6 +29,7 @@ import { NewVersionDmpDialogComponent } from '../../new-version-dialog/dmp-new-v
import { AppPermission } from '@app/core/common/enum/permission.enum';
import { FileTransformerEntityType } from '@app/core/common/enum/file-transformer-entity-type';
import { DmpVersionStatus } from '@app/core/common/enum/dmp-version-status';
import { DmpDeleteDialogComponent } from '../../dmp-delete-dialog/dmp-delete-dialog.component';
@Component({
selector: 'app-dmp-listing-item-component',
@ -168,16 +169,28 @@ export class DmpListingItemComponent extends BaseComponent implements OnInit {
}
openDeleteDialog(id: Guid) {
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
maxWidth: '300px',
restoreFocus: false,
data: {
message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.DELETE-ITEM'),
confirmButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.DELETE'),
cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL'),
isDeleteConfirmation: true
}
});
let dialogRef: any;
if (this.dmp.descriptions && this.dmp.descriptions.length > 0){
dialogRef = this.dialog.open(DmpDeleteDialogComponent, {
maxWidth: '300px',
data: {
descriptions: this.dmp.descriptions,
}
});
} else {
dialogRef = this.dialog.open(ConfirmationDialogComponent, {
maxWidth: '300px',
restoreFocus: false,
data: {
message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.DELETE-ITEM'),
confirmButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.DELETE'),
cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL'),
isDeleteConfirmation: true
}
});
}
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
if (result) {
this.dmpService.delete(id)

View File

@ -48,6 +48,7 @@ import { DmpFinalizeDialogComponent, DmpFinalizeDialogOutput } from '../dmp-fina
import { DmpEditorResolver } from '../dmp-editor-blueprint/dmp-editor.resolver';
import { FileTransformerEntityType } from '@app/core/common/enum/file-transformer-entity-type';
import { DmpVersionStatus } from '@app/core/common/enum/dmp-version-status';
import { DmpDeleteDialogComponent } from '../dmp-delete-dialog/dmp-delete-dialog.component';
@Component({
selector: 'app-dmp-overview',
@ -373,15 +374,26 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
// }
deleteClicked() {
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
maxWidth: '300px',
data: {
message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.DELETE-ITEM'),
confirmButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.DELETE'),
cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL'),
isDeleteConfirmation: true
}
});
let dialogRef: any;
if (this.dmp.descriptions && this.dmp.descriptions.length > 0){
dialogRef = this.dialog.open(DmpDeleteDialogComponent, {
maxWidth: '300px',
data: {
descriptions: this.dmp.descriptions,
}
});
} else {
dialogRef = this.dialog.open(ConfirmationDialogComponent, {
maxWidth: '300px',
data: {
message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.DELETE-ITEM'),
confirmButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.DELETE'),
cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL'),
isDeleteConfirmation: true
}
});
}
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
if (result) {
this.dmpService.delete(this.dmp.id)

View File

@ -10,12 +10,14 @@ import { NgDialogAnimationService } from 'ng-dialog-animation';
import { DmpFinalizeDialogModule } from '../dmp-finalize-dialog/dmp-finalize-dialog.module';
import { DmpOverviewRoutingModule } from './dmp-overview.routing';
import { MultipleChoiceDialogModule } from '@common/modules/multiple-choice-dialog/multiple-choice-dialog.module';
import { DmpDeleteDialogModule } from '../dmp-delete-dialog/dmp-delete-dialog.module';
@NgModule({
imports: [
CommonUiModule,
CommonFormsModule,
ConfirmationDialogModule,
DmpDeleteDialogModule,
MultipleChoiceDialogModule,
FormattingModule,
AutoCompleteModule,

View File

@ -643,6 +643,14 @@
},
"PLACEHOLDER": "Plan title"
},
"DMP-DELETE-DIALOG": {
"WARNING": "Warning!",
"DELETE-ITEM": "Are you sure to delete this plan? The following descriptions will also be removed:",
"ACTIONS": {
"DELETE": "Delete",
"CANCEL": "Cancel"
}
},
"DMP-OVERVIEW": {
"TITLE": "Plan",
"PUBLIC": "Public",

View File

@ -486,5 +486,5 @@ notification:
priority-key: null
cipher-fields: [ ]
template-cache:
prefix: ${CACHE_DISAMBIGUATION:}
prefix: ${CACHE_DISAMBIGUATION}
key-pattern: "{prefix}:Notification_Message_InApp_Template:{key}:v0"

View File

@ -46,10 +46,6 @@
<appender-ref ref="TROUBLESHOOTING"/>
<appender-ref ref="STDOUT"/>
</logger>
<logger name="org.springframework.data.elasticsearch.client.WIRE" level="TRACE" additivity="false">
<appender-ref ref="TROUBLESHOOTING"/>
<appender-ref ref="STDOUT"/>
</logger>
<logger name="audit" level="INFO" additivity="false">
<appender-ref ref="AUDITING"/>
<appender-ref ref="STDOUT"/>

View File

@ -108,20 +108,25 @@ public class MessageBuilderServiceImpl implements MessageInfoBuilderService {
if (messageInfo.getTimeZone() == null || messageInfo.getTimeZone().isBlank()) messageInfo.setTimeZone(this.localeService.timezoneName());
if (this.scope.isMultitenant()) {
TenantEntity tenantInfo = this.queryFactory.query(TenantQuery.class)
.isActive(IsActive.Active).firstAs(new BaseFieldSet(TenantEntity._id, TenantEntity._code));
if (!this.scope.isDefaultTenant()) {
TenantEntity tenantInfo = this.queryFactory.query(TenantQuery.class)
.isActive(IsActive.Active).firstAs(new BaseFieldSet(TenantEntity._id, TenantEntity._code));
if (tenantInfo == null) {
try {
logger.error("Could not retrieve tenant info for notification {} in tenant {}", notification.getId(), scope.getTenant());
} catch (InvalidApplicationException e) {
throw new RuntimeException(e);
if (tenantInfo == null) {
try {
logger.error("Could not retrieve tenant info for notification {} in tenant {}", notification.getId(), scope.getTenant());
} catch (InvalidApplicationException e) {
throw new RuntimeException(e);
}
throw new MyForbiddenException(this.errors.getMissingTenant().getCode(), this.errors.getMissingTenant().getMessage());
}
throw new MyForbiddenException(this.errors.getMissingTenant().getCode(), this.errors.getMissingTenant().getMessage());
}
messageInfo.setTenantId(tenantInfo.getId());
messageInfo.setTenantCode(tenantInfo.getCode());
messageInfo.setTenantId(tenantInfo.getId());
messageInfo.setTenantCode(tenantInfo.getCode());
} else {
messageInfo.setTenantId(null);
messageInfo.setTenantCode(this.scope.getDefaultTenantCode());
}
}
return messageInfo;