Fix issues when cloning dataset templates
This commit is contained in:
parent
e5264780c3
commit
77bcb95ad7
|
@ -106,6 +106,7 @@ public class Admin extends BaseController {
|
|||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/get/{id}"}, produces = "application/json")
|
||||
@Transactional
|
||||
public ResponseEntity<ResponseItem<DatasetProfile>> get(@PathVariable String id, @ClaimedAuthorities(claims = {ADMIN, DATASET_PROFILE_MANAGER}) Principal principal) {
|
||||
eu.eudat.models.data.admin.composite.DatasetProfile datasetprofile = this.datasetProfileManager.getDatasetProfile(id);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DatasetProfile>().status(ApiMessageCode.NO_MESSAGE).payload(datasetprofile));
|
||||
|
@ -134,7 +135,8 @@ public class Admin extends BaseController {
|
|||
eu.eudat.models.data.admin.composite.DatasetProfile datasetprofile = AdminManager.generateDatasetProfileModel(profile);
|
||||
datasetprofile.setLabel(profile.getLabel() + " new ");
|
||||
datasetprofile.setLanguage(profile.getLanguage());
|
||||
datasetProfileManager.retrieveUsers(profile, datasetprofile);
|
||||
datasetprofile.setDescription(profile.getDescription());
|
||||
//datasetProfileManager.retrieveUsers(profile, datasetprofile);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<eu.eudat.models.data.admin.composite.DatasetProfile>().payload(datasetprofile));
|
||||
}
|
||||
|
||||
|
|
|
@ -68,6 +68,7 @@ public class DatasetProfileManager {
|
|||
this.cache = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public eu.eudat.models.data.admin.composite.DatasetProfile getDatasetProfile(String id) {
|
||||
eu.eudat.data.entities.DatasetProfile profile = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id));
|
||||
eu.eudat.models.data.admin.composite.DatasetProfile datasetprofile = AdminManager.generateDatasetProfileModel(profile);
|
||||
|
@ -297,6 +298,7 @@ public class DatasetProfileManager {
|
|||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void retrieveUsers(DatasetProfile entity, eu.eudat.models.data.admin.composite.DatasetProfile model) {
|
||||
if (entity.getUsers() != null && !entity.getUsers().isEmpty()) {
|
||||
model.setUsers(entity.getUsers().stream().filter(userDatasetProfile -> userDatasetProfile.getRole() < 2).map(userDatasetProfile -> {
|
||||
|
|
|
@ -158,7 +158,7 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
|
|||
} catch (error) {
|
||||
this.logger.error('Could not parse MasterItem: ' + data);
|
||||
console.log(error)
|
||||
this.uiNotificationService.snackBarNotification(this.language.instant('NOTIFICATIONS.DEFAULT.ERROR'), SnackBarNotificationLevel.Error);
|
||||
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.FORM-VALIDATION-DISPLAY-DIALOG.HAS-ERROR'), SnackBarNotificationLevel.Error);
|
||||
}
|
||||
},
|
||||
error => this.onCallbackError(error)
|
||||
|
@ -180,9 +180,10 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
|
|||
this.dataModel.status = DatasetProfileEnum.SAVED;
|
||||
this.form = this.dataModel.buildForm();
|
||||
this.prepareForm();
|
||||
} catch {
|
||||
} catch (error){
|
||||
this.logger.error('Could not parse MasterItem: ' + data);
|
||||
this.uiNotificationService.snackBarNotification(this.language.instant('NOTIFICATIONS.DEFAULT.ERROR'), SnackBarNotificationLevel.Error);
|
||||
this.logger.error(error);
|
||||
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.FORM-VALIDATION-DISPLAY-DIALOG.HAS-ERROR'), SnackBarNotificationLevel.Error);
|
||||
}
|
||||
},
|
||||
error => this.onCallbackError(error)
|
||||
|
@ -202,9 +203,10 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
|
|||
this.form.controls['description'].disable();
|
||||
this.form.controls['language'].disable();
|
||||
this.prepareForm();
|
||||
} catch {
|
||||
} catch (error){
|
||||
this.logger.error('Could not parse MasterItem: ' + data);
|
||||
this.uiNotificationService.snackBarNotification(this.language.instant('NOTIFICATIONS.DEFAULT.ERROR'), SnackBarNotificationLevel.Error);
|
||||
this.logger.error(error);
|
||||
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.FORM-VALIDATION-DISPLAY-DIALOG.HAS-ERROR'), SnackBarNotificationLevel.Error);
|
||||
}
|
||||
},
|
||||
error => this.onCallbackError(error)
|
||||
|
@ -271,7 +273,7 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
|
|||
}
|
||||
})
|
||||
}, {root:null, rootMargin:'0px', threshold:0});
|
||||
this.stepperNavigationObserver.observe(titleColumn);
|
||||
this.stepperNavigationObserver.observe(titleColumn);
|
||||
}else{
|
||||
console.log('Could not load scroll On Top Observer')
|
||||
}
|
||||
|
@ -304,7 +306,11 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
|
|||
});
|
||||
this._initializeToCEntries();
|
||||
// console.log(this.form.get('users').value);
|
||||
this.userChipList = [...this.form.get('users').value];
|
||||
if (this.form.get('users').value !== null && this.form.get('users').value !== undefined) {
|
||||
this.userChipList = [...this.form.get('users').value];
|
||||
} else {
|
||||
this.userChipList = [];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -1847,7 +1853,7 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
|
|||
// console.log('user add');
|
||||
if(this.inputUserState === 'triggered'){
|
||||
// this.checkAndAdd(email);
|
||||
|
||||
|
||||
of(email.value)
|
||||
.pipe(tap(_=> {this.userFormDisabled = true; email.focus()}))
|
||||
.pipe(mergeMap(email=>this.userService.getFromEmail(email)))
|
||||
|
@ -1860,7 +1866,7 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
|
|||
this.userFormDisabled = false;
|
||||
// email.focus();
|
||||
// this.inputUserState = 'triggered';
|
||||
|
||||
|
||||
|
||||
},
|
||||
error=>{
|
||||
|
@ -1874,7 +1880,7 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
|
|||
}else{
|
||||
this.inputUserState = 'triggered';
|
||||
email.focus();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
onUserButtonFocus(){
|
||||
|
|
Loading…
Reference in New Issue