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")
|
@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) {
|
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);
|
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));
|
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);
|
eu.eudat.models.data.admin.composite.DatasetProfile datasetprofile = AdminManager.generateDatasetProfileModel(profile);
|
||||||
datasetprofile.setLabel(profile.getLabel() + " new ");
|
datasetprofile.setLabel(profile.getLabel() + " new ");
|
||||||
datasetprofile.setLanguage(profile.getLanguage());
|
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));
|
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<>();
|
this.cache = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
public eu.eudat.models.data.admin.composite.DatasetProfile getDatasetProfile(String id) {
|
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.data.entities.DatasetProfile profile = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id));
|
||||||
eu.eudat.models.data.admin.composite.DatasetProfile datasetprofile = AdminManager.generateDatasetProfileModel(profile);
|
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) {
|
public void retrieveUsers(DatasetProfile entity, eu.eudat.models.data.admin.composite.DatasetProfile model) {
|
||||||
if (entity.getUsers() != null && !entity.getUsers().isEmpty()) {
|
if (entity.getUsers() != null && !entity.getUsers().isEmpty()) {
|
||||||
model.setUsers(entity.getUsers().stream().filter(userDatasetProfile -> userDatasetProfile.getRole() < 2).map(userDatasetProfile -> {
|
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) {
|
} catch (error) {
|
||||||
this.logger.error('Could not parse MasterItem: ' + data);
|
this.logger.error('Could not parse MasterItem: ' + data);
|
||||||
console.log(error)
|
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)
|
error => this.onCallbackError(error)
|
||||||
|
@ -180,9 +180,10 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
|
||||||
this.dataModel.status = DatasetProfileEnum.SAVED;
|
this.dataModel.status = DatasetProfileEnum.SAVED;
|
||||||
this.form = this.dataModel.buildForm();
|
this.form = this.dataModel.buildForm();
|
||||||
this.prepareForm();
|
this.prepareForm();
|
||||||
} catch {
|
} catch (error){
|
||||||
this.logger.error('Could not parse MasterItem: ' + data);
|
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)
|
error => this.onCallbackError(error)
|
||||||
|
@ -202,9 +203,10 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
|
||||||
this.form.controls['description'].disable();
|
this.form.controls['description'].disable();
|
||||||
this.form.controls['language'].disable();
|
this.form.controls['language'].disable();
|
||||||
this.prepareForm();
|
this.prepareForm();
|
||||||
} catch {
|
} catch (error){
|
||||||
this.logger.error('Could not parse MasterItem: ' + data);
|
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)
|
error => this.onCallbackError(error)
|
||||||
|
@ -271,7 +273,7 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}, {root:null, rootMargin:'0px', threshold:0});
|
}, {root:null, rootMargin:'0px', threshold:0});
|
||||||
this.stepperNavigationObserver.observe(titleColumn);
|
this.stepperNavigationObserver.observe(titleColumn);
|
||||||
}else{
|
}else{
|
||||||
console.log('Could not load scroll On Top Observer')
|
console.log('Could not load scroll On Top Observer')
|
||||||
}
|
}
|
||||||
|
@ -304,7 +306,11 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
|
||||||
});
|
});
|
||||||
this._initializeToCEntries();
|
this._initializeToCEntries();
|
||||||
// console.log(this.form.get('users').value);
|
// 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');
|
// console.log('user add');
|
||||||
if(this.inputUserState === 'triggered'){
|
if(this.inputUserState === 'triggered'){
|
||||||
// this.checkAndAdd(email);
|
// this.checkAndAdd(email);
|
||||||
|
|
||||||
of(email.value)
|
of(email.value)
|
||||||
.pipe(tap(_=> {this.userFormDisabled = true; email.focus()}))
|
.pipe(tap(_=> {this.userFormDisabled = true; email.focus()}))
|
||||||
.pipe(mergeMap(email=>this.userService.getFromEmail(email)))
|
.pipe(mergeMap(email=>this.userService.getFromEmail(email)))
|
||||||
|
@ -1860,7 +1866,7 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
|
||||||
this.userFormDisabled = false;
|
this.userFormDisabled = false;
|
||||||
// email.focus();
|
// email.focus();
|
||||||
// this.inputUserState = 'triggered';
|
// this.inputUserState = 'triggered';
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
error=>{
|
error=>{
|
||||||
|
@ -1874,7 +1880,7 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
|
||||||
}else{
|
}else{
|
||||||
this.inputUserState = 'triggered';
|
this.inputUserState = 'triggered';
|
||||||
email.focus();
|
email.focus();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onUserButtonFocus(){
|
onUserButtonFocus(){
|
||||||
|
|
Loading…
Reference in New Issue