Adds Dataset Profile versioning functionality (Ticket #59)
This commit is contained in:
parent
05a75090e9
commit
aed9d831e9
|
@ -81,13 +81,11 @@ public class Dataset implements DataEntity<Dataset, UUID> {
|
|||
@Column(name = "\"Label\"")
|
||||
private String label;
|
||||
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
// @Cascade(value=org.hibernate.annotations.CascadeType.ALL)
|
||||
@JoinColumn(name = "\"DMP\"", nullable = false)
|
||||
private DMP dmp;
|
||||
|
||||
|
||||
@Column(name = "\"Uri\"")
|
||||
private String uri;
|
||||
|
||||
|
@ -95,7 +93,6 @@ public class Dataset implements DataEntity<Dataset, UUID> {
|
|||
@Column(name = "\"Properties\"", columnDefinition = "xml", nullable = true)
|
||||
private String properties;
|
||||
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
//@Cascade(value=org.hibernate.annotations.CascadeType.ALL)
|
||||
@JoinColumn(name = "\"Profile\"", nullable = true)
|
||||
|
@ -112,18 +109,15 @@ public class Dataset implements DataEntity<Dataset, UUID> {
|
|||
)
|
||||
private Set<Registry> registries;
|
||||
|
||||
|
||||
@OneToMany(mappedBy = "dataset", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
private Set<DatasetDataRepository> datasetDataRepositories;
|
||||
|
||||
|
||||
@OneToMany(mappedBy = "dataset", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
private Set<DatasetService> services;
|
||||
|
||||
@OneToMany(mappedBy = "dataset", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
private Set<DatasetExternalDataset> datasetExternalDatasets;
|
||||
|
||||
|
||||
@Column(name = "\"Status\"", nullable = false)
|
||||
private Short status;
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ import java.util.UUID;
|
|||
|
||||
@Entity
|
||||
@Table(name = "\"DatasetProfile\"")
|
||||
public class DatasetProfile implements DataEntity<DatasetProfile,UUID> {
|
||||
public class DatasetProfile implements DataEntity<DatasetProfile,UUID>{
|
||||
|
||||
public enum Status {
|
||||
SAVED((short) 0), FINALIZED((short) 1), DELETED((short) 99);
|
||||
|
@ -142,7 +142,7 @@ public class DatasetProfile implements DataEntity<DatasetProfile,UUID> {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DatasetProfileListingModel [id=" + id + ", label=" + label + ", dataset=" + dataset + ", definition=" + definition + "]";
|
||||
return "DatasetProfileListingModel [id=" + id + ", label=" + label + ", dataset=" + dataset + ", definition=" + definition + ", version=" + version + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -194,4 +194,11 @@ public class DatasetWizardController extends BaseController {
|
|||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem().status(ApiMessageCode.NO_MESSAGE).message("Import was unsuccessful."));
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"profile/{id}"}, produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity getSingleProfileUpdate(@PathVariable String id, @ClaimedAuthorities(claims = {ANONYMOUS}) Principal principal) throws IllegalAccessException, IOException, InstantiationException {
|
||||
DatasetWizardModel dataset = this.datasetManager.datasetUpdateProfile(id);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DatasetWizardModel>().status(ApiMessageCode.NO_MESSAGE).payload(dataset));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
package eu.eudat.logic.managers;
|
||||
|
||||
import eu.eudat.data.dao.criteria.DataRepositoryCriteria;
|
||||
import eu.eudat.data.dao.criteria.ExternalDatasetCriteria;
|
||||
import eu.eudat.data.dao.criteria.RegistryCriteria;
|
||||
import eu.eudat.data.dao.criteria.ServiceCriteria;
|
||||
import eu.eudat.data.dao.criteria.*;
|
||||
import eu.eudat.data.dao.entities.*;
|
||||
import eu.eudat.data.entities.*;
|
||||
import eu.eudat.data.query.items.table.dataset.DatasetPublicTableRequest;
|
||||
|
@ -22,6 +19,7 @@ import eu.eudat.logic.utilities.documents.xml.ExportXmlBuilder;
|
|||
import eu.eudat.models.HintedModelFactory;
|
||||
import eu.eudat.models.data.datasetImport.*;
|
||||
import eu.eudat.models.data.datasetwizard.DatasetWizardModel;
|
||||
import eu.eudat.models.data.dmp.AssociatedProfile;
|
||||
import eu.eudat.models.data.helpers.common.DataTableData;
|
||||
import eu.eudat.models.data.listingmodels.DatasetListingModel;
|
||||
import eu.eudat.models.data.security.Principal;
|
||||
|
@ -168,6 +166,44 @@ public class DatasetManager {
|
|||
}
|
||||
dataset.setDatasetProfileDefinition(getPagedProfile(dataset, datasetEntity));
|
||||
dataset.fromDataModel(datasetEntity);
|
||||
|
||||
// Creates the Criteria to get all version of DatasetProfile in question.
|
||||
DatasetProfileCriteria profileCriteria = new DatasetProfileCriteria();
|
||||
UUID profileId = datasetEntity.getProfile().getGroupId();
|
||||
List<UUID> uuidList = new LinkedList<>();
|
||||
uuidList.add(profileId);
|
||||
profileCriteria.setGroupIds(uuidList);
|
||||
profileCriteria.setAllVersions(true);
|
||||
List<eu.eudat.data.entities.DatasetProfile> items = databaseRepository.getDatasetProfileDao().getWithCriteria(profileCriteria)
|
||||
.orderBy(((builder, root) -> builder.asc(root.get("version"))))
|
||||
.toList();
|
||||
|
||||
// Search if the Dataset needs dataset Profile update depending on his DMP associated profiles.
|
||||
AssociatedProfile associatedProfile = new AssociatedProfile();
|
||||
boolean y = true;
|
||||
// Start the Dataset Profile List from the latest to the earliest.
|
||||
for (int x=(items.size()-1); x>=0; x--) {
|
||||
associatedProfile.setId(items.get(x).getId());
|
||||
// Check if Dmp contains this profile.
|
||||
for(AssociatedProfile p : dataset.getDmp().getProfiles() ) {
|
||||
if (p.getId().toString().equals(associatedProfile.getId().toString())) {
|
||||
Short latestVersion = items.get(x).getVersion();
|
||||
if (latestVersion.equals(datasetEntity.getProfile().getVersion())) {
|
||||
dataset.setIsProfileLatestVersion(true);
|
||||
y = false;
|
||||
break;
|
||||
} else {
|
||||
dataset.setIsProfileLatestVersion(false);
|
||||
y = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!y){
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
dataset.setTags(datasetElastic.getTags());
|
||||
return dataset;
|
||||
}
|
||||
|
@ -255,7 +291,7 @@ public class DatasetManager {
|
|||
HttpEntity<LinkedMultiValueMap<String, Object>> requestEntity = new HttpEntity<LinkedMultiValueMap<String, Object>>(
|
||||
map, headers);
|
||||
|
||||
byte[] queueResult = new RestTemplate().postForObject("http://localhost:3000/convert/office"
|
||||
byte[] queueResult = new RestTemplate().postForObject(environment.getProperty("pdf.converter.url") + "convert/office"
|
||||
, requestEntity, byte[].class);
|
||||
|
||||
File resultPdf = new File(environment.getProperty("configuration.exportUrl") + label + ".pdf");
|
||||
|
@ -496,4 +532,51 @@ public class DatasetManager {
|
|||
// TODO: When tags functionality return.
|
||||
}
|
||||
|
||||
public DatasetWizardModel datasetUpdateProfile(String id) {
|
||||
DatasetWizardModel dataset = new DatasetWizardModel();
|
||||
eu.eudat.data.entities.Dataset datasetEntity = databaseRepository.getDatasetDao().find(UUID.fromString(id), HintedModelFactory.getHint(DatasetWizardModel.class));
|
||||
eu.eudat.elastic.entities.Dataset datasetElastic;
|
||||
try{
|
||||
datasetElastic = datasetRepository.exists() ?
|
||||
datasetRepository.findDocument(id) : new eu.eudat.elastic.entities.Dataset();
|
||||
}
|
||||
catch (Exception ex){
|
||||
datasetElastic = new eu.eudat.elastic.entities.Dataset();
|
||||
}
|
||||
dataset.setDatasetProfileDefinition(getPagedProfile(dataset, datasetEntity));
|
||||
dataset.fromDataModel(datasetEntity);
|
||||
|
||||
// Creates the Criteria to get all version of DatasetProfile in question.
|
||||
DatasetProfileCriteria profileCriteria = new DatasetProfileCriteria();
|
||||
UUID profileId = datasetEntity.getProfile().getGroupId();
|
||||
List<UUID> uuidList = new LinkedList<>();
|
||||
uuidList.add(profileId);
|
||||
profileCriteria.setGroupIds(uuidList);
|
||||
|
||||
// Gets the latest version of the datasetProfile.
|
||||
eu.eudat.data.entities.DatasetProfile item = databaseRepository.getDatasetProfileDao().getWithCriteria(profileCriteria).getSingle();
|
||||
|
||||
// Sets the latest version of dataet Profile to the Dataset in question.
|
||||
dataset.setDatasetProfileDefinition(getLatestDatasetProfile(datasetEntity, item));
|
||||
dataset.setProfile(item.getId());
|
||||
|
||||
// Now at latest version.
|
||||
dataset.setIsProfileLatestVersion(true);
|
||||
|
||||
dataset.setTags(datasetElastic.getTags());
|
||||
return dataset;
|
||||
}
|
||||
|
||||
public PagedDatasetProfile getLatestDatasetProfile(Dataset datasetEntity, DatasetProfile profile) {
|
||||
eu.eudat.models.data.user.composite.DatasetProfile datasetprofile = userManager.generateDatasetProfileModel(profile);
|
||||
datasetprofile.setStatus(datasetEntity.getStatus());
|
||||
if (datasetEntity.getProperties() != null) {
|
||||
JSONObject jobject = new JSONObject(datasetEntity.getProperties());
|
||||
Map<String, Object> properties = jobject.toMap();
|
||||
datasetprofile.fromJsonObject(properties);
|
||||
}
|
||||
PagedDatasetProfile pagedDatasetProfile = new PagedDatasetProfile();
|
||||
pagedDatasetProfile.buildPagedDatasetProfile(datasetprofile);
|
||||
return pagedDatasetProfile;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,11 +33,11 @@ public class DatasetWizardModel implements DataModel<Dataset, DatasetWizardModel
|
|||
private List<Tag> tags;
|
||||
private List<ExternalDatasetListingModel> externalDatasets;
|
||||
private UUID profile;
|
||||
private Boolean isProfileLatestVersion;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
@ -45,7 +45,6 @@ public class DatasetWizardModel implements DataModel<Dataset, DatasetWizardModel
|
|||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
@ -53,7 +52,6 @@ public class DatasetWizardModel implements DataModel<Dataset, DatasetWizardModel
|
|||
public String getReference() {
|
||||
return reference;
|
||||
}
|
||||
|
||||
public void setReference(String reference) {
|
||||
this.reference = reference;
|
||||
}
|
||||
|
@ -61,7 +59,6 @@ public class DatasetWizardModel implements DataModel<Dataset, DatasetWizardModel
|
|||
public String getUri() {
|
||||
return uri;
|
||||
}
|
||||
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
|
@ -69,7 +66,6 @@ public class DatasetWizardModel implements DataModel<Dataset, DatasetWizardModel
|
|||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
@ -77,7 +73,6 @@ public class DatasetWizardModel implements DataModel<Dataset, DatasetWizardModel
|
|||
public short getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(short status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
@ -85,7 +80,6 @@ public class DatasetWizardModel implements DataModel<Dataset, DatasetWizardModel
|
|||
public Date getCreated() {
|
||||
return created;
|
||||
}
|
||||
|
||||
public void setCreated(Date created) {
|
||||
this.created = created;
|
||||
}
|
||||
|
@ -93,7 +87,6 @@ public class DatasetWizardModel implements DataModel<Dataset, DatasetWizardModel
|
|||
public DataManagementPlan getDmp() {
|
||||
return dmp;
|
||||
}
|
||||
|
||||
public void setDmp(DataManagementPlan dmp) {
|
||||
this.dmp = dmp;
|
||||
}
|
||||
|
@ -101,7 +94,6 @@ public class DatasetWizardModel implements DataModel<Dataset, DatasetWizardModel
|
|||
public PagedDatasetProfile getDatasetProfileDefinition() {
|
||||
return datasetProfileDefinition;
|
||||
}
|
||||
|
||||
public void setDatasetProfileDefinition(PagedDatasetProfile datasetProfileDefinition) {
|
||||
this.datasetProfileDefinition = datasetProfileDefinition;
|
||||
}
|
||||
|
@ -109,7 +101,6 @@ public class DatasetWizardModel implements DataModel<Dataset, DatasetWizardModel
|
|||
public List<Registry> getRegistries() {
|
||||
return registries;
|
||||
}
|
||||
|
||||
public void setRegistries(List<Registry> registries) {
|
||||
this.registries = registries;
|
||||
}
|
||||
|
@ -117,7 +108,6 @@ public class DatasetWizardModel implements DataModel<Dataset, DatasetWizardModel
|
|||
public List<Service> getServices() {
|
||||
return services;
|
||||
}
|
||||
|
||||
public void setServices(List<Service> services) {
|
||||
this.services = services;
|
||||
}
|
||||
|
@ -125,7 +115,6 @@ public class DatasetWizardModel implements DataModel<Dataset, DatasetWizardModel
|
|||
public List<DataRepository> getDataRepositories() {
|
||||
return dataRepositories;
|
||||
}
|
||||
|
||||
public void setDataRepositories(List<DataRepository> dataRepositories) {
|
||||
this.dataRepositories = dataRepositories;
|
||||
}
|
||||
|
@ -133,7 +122,6 @@ public class DatasetWizardModel implements DataModel<Dataset, DatasetWizardModel
|
|||
public UUID getProfile() {
|
||||
return profile;
|
||||
}
|
||||
|
||||
public void setProfile(UUID profile) {
|
||||
this.profile = profile;
|
||||
}
|
||||
|
@ -141,7 +129,6 @@ public class DatasetWizardModel implements DataModel<Dataset, DatasetWizardModel
|
|||
public List<ExternalDatasetListingModel> getExternalDatasets() {
|
||||
return externalDatasets;
|
||||
}
|
||||
|
||||
public void setExternalDatasets(List<ExternalDatasetListingModel> externalDatasets) {
|
||||
this.externalDatasets = externalDatasets;
|
||||
}
|
||||
|
@ -149,11 +136,17 @@ public class DatasetWizardModel implements DataModel<Dataset, DatasetWizardModel
|
|||
public List<Tag> getTags() {
|
||||
return tags;
|
||||
}
|
||||
|
||||
public void setTags(List<Tag> tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
public Boolean getIsProfileLatestVersion() {
|
||||
return isProfileLatestVersion;
|
||||
}
|
||||
public void setIsProfileLatestVersion(Boolean profileLatestVersion) {
|
||||
isProfileLatestVersion = profileLatestVersion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DatasetWizardModel fromDataModel(Dataset entity) {
|
||||
this.id = entity.getId();
|
||||
|
@ -178,7 +171,7 @@ public class DatasetWizardModel implements DataModel<Dataset, DatasetWizardModel
|
|||
this.dmp = new DataManagementPlan().fromDataModel(entity.getDmp());
|
||||
this.externalDatasets = entity.getDatasetExternalDatasets().stream().map(item -> {
|
||||
ExternalDatasetListingModel externalDatasetListingModel = new ExternalDatasetListingModel().fromDataModel(item.getExternalDataset());
|
||||
if(item.getData()!=null) {
|
||||
if(item.getData()!= null) {
|
||||
Map<String, Map<String, String>> data = (Map<String, Map<String, String>>) JSONValue.parse(item.getData());
|
||||
Map<String, String> values = data.get("data");
|
||||
externalDatasetListingModel.setInfo(values.get("info"));
|
||||
|
|
|
@ -21,4 +21,5 @@ export interface DatasetWizardModel {
|
|||
tags?: TagModel[];
|
||||
externalDatasets?: ExternalDatasetModel[];
|
||||
profile?: DatasetProfileModel;
|
||||
isProfileLatestVersion?: Boolean;
|
||||
}
|
||||
|
|
|
@ -88,4 +88,8 @@ export class DatasetWizardService {
|
|||
};
|
||||
return this.http.post(this.actionUrl + 'upload', formData, { params: params });
|
||||
}
|
||||
|
||||
public updateDatasetProfile(id: String): Observable<DatasetWizardModel> {
|
||||
return this.http.get<DatasetWizardModel>(this.actionUrl + "profile/"+ id, { headers: this.headers });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ export class DatasetWizardEditorModel {
|
|||
public dmp: DmpModel;
|
||||
public datasetProfileDefinition: DatasetDescriptionFormEditorModel;
|
||||
public validationErrorModel: ValidationErrorModel = new ValidationErrorModel();
|
||||
public isProfileLatestVersion: Boolean;
|
||||
|
||||
fromModel(item: DatasetWizardModel): DatasetWizardEditorModel {
|
||||
this.id = item.id;
|
||||
|
@ -41,9 +42,9 @@ export class DatasetWizardEditorModel {
|
|||
if (item.dataRepositories) { this.dataRepositories = item.dataRepositories.map(x => new ExternalDataRepositoryEditorModel().fromModel(x)); }
|
||||
if (item.externalDatasets) { this.externalDatasets = item.externalDatasets.map(x => new ExternalDatasetEditorModel().fromModel(x)); }
|
||||
this.dmp = item.dmp;
|
||||
this.profile = item.profile;
|
||||
if (item.datasetProfileDefinition) { this.datasetProfileDefinition = new DatasetDescriptionFormEditorModel().fromModel(item.datasetProfileDefinition); }
|
||||
this.tags = item.tags;
|
||||
this.isProfileLatestVersion = item.isProfileLatestVersion;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -321,4 +322,4 @@ export class ExternalDataRepositoryEditorModel {
|
|||
// name: [this.name]
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
|
|
@ -41,7 +41,10 @@
|
|||
(click)="downloadDOCX();" type="button">{{ 'DATASET-WIZARD.ACTIONS.DOWNLOAD-DOCX' | translate }}</button>
|
||||
<button mat-raised-button color="primary" *ngIf="datasetWizardModel&&datasetWizardModel?.status == 1" class="downloadXML"
|
||||
(click)="downloadXML();" type="button">{{ 'DATASET-WIZARD.ACTIONS.DOWNLOAD-XML' | translate }}</button>
|
||||
<button mat-raised-button color="primary" *ngIf="needsUpdate()" class="updateDatasetProfile" (click)="openUpdateDatasetProfileDialogue();"
|
||||
type="button">{{ 'DATASET-WIZARD.ACTIONS.UPDATE-DATASET-PROFILE' | translate }}</button>
|
||||
<div class="fill-space"></div>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<mat-horizontal-stepper [linear]="isLinear" class="col-12" #stepper>
|
||||
|
|
|
@ -39,4 +39,9 @@
|
|||
margin-bottom: 15px;
|
||||
margin-right: 15px;
|
||||
}
|
||||
.updateDatasetProfile {
|
||||
margin-top: 15px;
|
||||
margin-bottom: 15px;
|
||||
margin-right: 15px;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,6 +56,7 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
|
|||
availableProfiles: DatasetProfileModel[] = [];
|
||||
itemId: string;
|
||||
publicId: string;
|
||||
profileUpdateId: string;
|
||||
downloadDocumentId: string;
|
||||
isLinear = false;
|
||||
|
||||
|
@ -121,6 +122,7 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
|
|||
const dmpId = params['dmpId'];
|
||||
const newDmpId = queryParams['newDmpId'];
|
||||
this.publicId = params['publicId'];
|
||||
this.profileUpdateId = params['updateId'];
|
||||
|
||||
this.itemId ? this.downloadDocumentId = this.itemId : this.downloadDocumentId = this.publicId
|
||||
|
||||
|
@ -130,6 +132,7 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
|
|||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(data => {
|
||||
this.datasetWizardModel = new DatasetWizardEditorModel().fromModel(data);
|
||||
this.needsUpdate();
|
||||
this.breadCrumbs = Observable.of([
|
||||
{
|
||||
parentComponentName: null,
|
||||
|
@ -274,8 +277,40 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
|
|||
}
|
||||
});
|
||||
this.publicMode = true;
|
||||
}
|
||||
else {
|
||||
} else if (this.profileUpdateId != null) {
|
||||
this.datasetWizardService.updateDatasetProfile(this.profileUpdateId)
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(data => {
|
||||
this.datasetWizardModel = new DatasetWizardEditorModel().fromModel(data);
|
||||
this.needsUpdate();
|
||||
this.breadCrumbs = Observable.of([
|
||||
{
|
||||
parentComponentName: null,
|
||||
label: 'Datasets',
|
||||
url: '/datasets',
|
||||
notFoundResolver: [
|
||||
{
|
||||
parentComponentName: null,
|
||||
label: this.datasetWizardModel.dmp.project.label,
|
||||
url: '/projects/edit/' + this.datasetWizardModel.dmp.project.id
|
||||
},
|
||||
{
|
||||
parentComponentName: null,
|
||||
label: this.datasetWizardModel.dmp.label,
|
||||
url: '/plans/edit/' + this.datasetWizardModel.dmp.id,
|
||||
},
|
||||
]
|
||||
}]);
|
||||
this.formGroup = this.datasetWizardModel.buildForm();
|
||||
this.editMode = this.datasetWizardModel.status === DatasetStatus.Draft;
|
||||
if (this.datasetWizardModel.status === 1) {
|
||||
this.formGroup.disable();
|
||||
this.viewOnly = true;
|
||||
}
|
||||
// if (this.viewOnly) { this.formGroup.disable(); } // For future use, to make Dataset edit like DMP.
|
||||
this.loadDatasetProfiles();
|
||||
});
|
||||
} else {
|
||||
this.datasetWizardModel = new DatasetWizardEditorModel();
|
||||
this.formGroup = this.datasetWizardModel.buildForm();
|
||||
this.editMode = this.datasetWizardModel.status === DatasetStatus.Draft;
|
||||
|
@ -535,4 +570,30 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
needsUpdate() {
|
||||
if (this.datasetWizardModel.isProfileLatestVersion) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
openUpdateDatasetProfileDialogue() {
|
||||
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
||||
data: {
|
||||
message: this.language.instant('DATASET-EDITOR.VERSION-DIALOG.QUESTION'),
|
||||
confirmButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CONFIRM'),
|
||||
cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL')
|
||||
}
|
||||
});
|
||||
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
|
||||
if (result) {
|
||||
this.profileUpdateId = this.itemId;
|
||||
this.uiNotificationService.snackBarNotification("Profile changed, WOW!", SnackBarNotificationLevel.Success);
|
||||
this.router.navigate(['/datasets/profileupdate/' + this.profileUpdateId]);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,7 +54,6 @@ const routes: Routes = [
|
|||
breadcrumb: true
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
path: 'copy/:id',
|
||||
component: DatasetWizardComponent,
|
||||
|
@ -62,6 +61,14 @@ const routes: Routes = [
|
|||
data: {
|
||||
breadcrumb: true
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'profileupdate/:updateId',
|
||||
component: DatasetWizardComponent,
|
||||
canActivate: [AuthGuard],
|
||||
data: {
|
||||
breadcrumb: true
|
||||
},
|
||||
}
|
||||
];
|
||||
|
||||
|
|
|
@ -121,8 +121,8 @@ export class DatasetCriteriaComponent extends BaseCriteriaComponent implements O
|
|||
this.datasetWizardService.uploadXml(result.fileList, result.datasetTitle, result.dmpId, result.datasetProfileId)
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(
|
||||
complete => this.onCallbackSuccess(),
|
||||
error => this.onCallbackError(error)
|
||||
complete => this.onCallbackSuccess(),
|
||||
error => this.onCallbackError(error)
|
||||
);
|
||||
}
|
||||
})
|
||||
|
|
|
@ -258,7 +258,8 @@
|
|||
"DOWNLOAD-PDF": "Download PDF",
|
||||
"DOWNLOAD-XML": "Download XML",
|
||||
"DOWNLOAD-DOCX": "Download DOCX",
|
||||
"COPY-DATASET": "Copy Dataset"
|
||||
"COPY-DATASET": "Copy Dataset",
|
||||
"UPDATE-DATASET-PROFILE": "Update Profile"
|
||||
},
|
||||
"UPLOAD": {
|
||||
"UPLOAD-XML": "Import",
|
||||
|
@ -493,6 +494,9 @@
|
|||
"SAVE": "Save",
|
||||
"CANCEL": "Cancel",
|
||||
"DELETE": "Delete"
|
||||
},
|
||||
"VERSION-DIALOG": {
|
||||
"QUESTION": "It seems your Dataset Profile is outdated. Do you want to update it to the latest version?"
|
||||
}
|
||||
},
|
||||
"DATASET-CREATE-WIZARD": {
|
||||
|
|
Loading…
Reference in New Issue