Backend: Fixes modified time check on save dmp without previous reload. Frontend: Adds dialog to proceed to dataset editor on "save & add dataset"
This commit is contained in:
parent
0de0888407
commit
a1b067071a
|
@ -84,6 +84,7 @@ import java.io.*;
|
|||
import java.math.BigInteger;
|
||||
import java.nio.file.Files;
|
||||
import java.time.Instant;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -359,7 +360,7 @@ public class DataManagementPlanManager {
|
|||
if (!isUserOwnerOfDmp(dmp1, principal)) {
|
||||
throw new Exception("User not being the creator is not authorized to edit this DMP.");
|
||||
}
|
||||
if (dmp1.getModified().getTime() != dataManagementPlan.getModified().getTime()) {
|
||||
if (Instant.ofEpochMilli(dmp1.getModified().getTime()).truncatedTo(ChronoUnit.SECONDS).toEpochMilli() != Instant.ofEpochMilli(dataManagementPlan.getModified().getTime()).truncatedTo(ChronoUnit.SECONDS).toEpochMilli()) {
|
||||
throw new Exception("Another user have already edit that DMP.");
|
||||
}
|
||||
List<Dataset> datasetList = new ArrayList<>(dmp1.getDataset());
|
||||
|
@ -481,7 +482,7 @@ public class DataManagementPlanManager {
|
|||
if (!isUserOwnerOfDmp(dmp1, principal)) {
|
||||
throw new Exception("User not being the creator is not authorized to edit this DMP.");
|
||||
}
|
||||
if (dmp1.getModified().getTime() != dataManagementPlan.getModified().getTime()) {
|
||||
if (Instant.ofEpochMilli(dmp1.getModified().getTime()).truncatedTo(ChronoUnit.SECONDS).toEpochMilli() != Instant.ofEpochMilli(dataManagementPlan.getModified().getTime()).truncatedTo(ChronoUnit.SECONDS).toEpochMilli()) {
|
||||
throw new Exception("Another user have already edit that DMP.");
|
||||
}
|
||||
for (DatasetWizardModel dataset : dataManagementPlan.getDatasets()) {
|
||||
|
|
|
@ -33,7 +33,7 @@ import { ValidationErrorModel } from '@common/forms/validation/error-model/valid
|
|||
import { TranslateService } from '@ngx-translate/core';
|
||||
import * as FileSaver from 'file-saver';
|
||||
import { Observable, of as observableOf, interval } from 'rxjs';
|
||||
import { map, takeUntil } from 'rxjs/operators';
|
||||
import { delay, map, takeUntil } from 'rxjs/operators';
|
||||
import { Principal } from "@app/core/model/auth/principal";
|
||||
import { Role } from "@app/core/common/enum/role";
|
||||
import { LockService } from '@app/core/services/lock/lock.service';
|
||||
|
@ -439,6 +439,8 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
|
|||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(
|
||||
complete => {
|
||||
this.formGroup.get('id').setValue(complete.id);
|
||||
this.formGroup.get('modified').setValue(complete.modified);
|
||||
if (showAddDatasetDialog) {
|
||||
this.addDatasetOpenDialog(complete);
|
||||
}
|
||||
|
@ -510,8 +512,8 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
|
|||
|
||||
onCallbackSuccessAddNew(dmp?: DmpModel) {
|
||||
// this.uiNotificationService.snackBarNotification(this.isNew ? this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-CREATION') : this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
|
||||
this.router.navigate(['/datasets', 'new', dmp.id]);
|
||||
// this.editDataset(dmp.id, true);
|
||||
// this.router.navigate(['/datasets', 'new', dmp.id]);
|
||||
this.editDataset(dmp.id, true);
|
||||
}
|
||||
|
||||
public setErrorModel(validationErrorModel: ValidationErrorModel) {
|
||||
|
|
Loading…
Reference in New Issue