Adds Dataset Profile Versioning.

This commit is contained in:
Diamantis Tziotzios 2019-03-26 16:30:33 +02:00
parent a7f138c1ea
commit 2c51468dfe
15 changed files with 231 additions and 111 deletions

View File

@ -25,7 +25,6 @@ public class DatasetProfile implements DataEntity<DatasetProfile,UUID> {
private Status(short value) {
this.value = value;
}
public short getValue() {
return value;
}
@ -60,11 +59,9 @@ public class DatasetProfile implements DataEntity<DatasetProfile,UUID> {
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = false)
private String definition;
@Column(name = "\"Status\"", nullable = false)
private Short status;
@Column(name = "\"Created\"")
@Convert(converter = DateToUTCConverter.class)
private Date created;
@ -76,90 +73,80 @@ public class DatasetProfile implements DataEntity<DatasetProfile,UUID> {
@Column(name = "\"Description\"")
private String description;
@Column(name = "\"GroupId\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
private UUID groupId;
@Column(name = "\"Version\"", nullable = false)
private Short version;
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Short getStatus() {
return status;
}
public void setStatus(Short status) {
this.status = status;
}
public Date getCreated() {
return created;
}
public void setCreated(Date created) {
this.created = created;
}
public Date getModified() {
return modified;
}
public void setModified(Date modified) {
this.modified = modified;
}
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public void setId(UUID id) { this.id = id;}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getDefinition() {
return definition;
}
public void setDefinition(String definition) {
this.definition = definition;
}
public Set<Dataset> getDataset() {
return dataset;
}
public void setDataset(Set<Dataset> dataset) {
this.dataset = dataset;
}
public UUID getGroupId() { return groupId; }
public void setGroupId(UUID groupId) { this.groupId = groupId;}
public Short getVersion() { return version; }
public void setVersion(Short version) { this.version = version; }
@Override
public String toString() {
return "DatasetProfileListingModel [id=" + id + ", label=" + label + ", dataset=" + dataset + ", definition=" + definition + "]";
}
@Override
public void update(DatasetProfile entity) {
}
@Override

View File

@ -2,6 +2,7 @@ package eu.eudat.controllers;
import eu.eudat.core.logger.Logger;
import eu.eudat.data.query.items.table.datasetprofile.DatasetProfileTableRequestItem;
import eu.eudat.exceptions.datasetprofile.DatasetProfileNewVersionException;
import eu.eudat.exceptions.datasetprofile.DatasetProfileWithDatasetsExeption;
import eu.eudat.logic.managers.AdminManager;
import eu.eudat.logic.managers.DatasetProfileManager;
@ -67,12 +68,20 @@ public class Admin extends BaseController {
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<UUID>().status(ApiMessageCode.NO_MESSAGE));
}
@Transactional
@RequestMapping(method = RequestMethod.POST, value = {"/newVersion/{id}"}, produces = "application/json")
public ResponseEntity newVersionDatasetProfile(@PathVariable String id, @RequestBody DatasetProfile profile, @ClaimedAuthorities(claims = {ADMIN}) Principal principal) throws Exception {
try {
eu.eudat.data.entities.DatasetProfile modelDefinition = this.datasetProfileManager.createNewVersionDatasetProfile(id, profile);
return ResponseEntity.status(HttpStatus.OK).body(modelDefinition.getId());
} catch (DatasetProfileNewVersionException exception) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<eu.eudat.models.data.admin.composite.DatasetProfile>().status(ApiMessageCode.ERROR_MESSAGE).message(exception.getMessage()));
}
}
@RequestMapping(method = RequestMethod.GET, value = {"/get/{id}"}, produces = "application/json")
public ResponseEntity<ResponseItem<DatasetProfile>> get(@PathVariable String id, @ClaimedAuthorities(claims = {ADMIN}) Principal principal) {
eu.eudat.data.entities.DatasetProfile profile = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id));
eu.eudat.models.data.admin.composite.DatasetProfile datasetprofile = AdminManager.generateDatasetProfileModel(profile);
datasetprofile.setLabel(profile.getLabel());
datasetprofile.setStatus(profile.getStatus());
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));
}
@ -92,7 +101,7 @@ public class Admin extends BaseController {
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<PagedDatasetProfile>().status(ApiMessageCode.NO_MESSAGE).payload(pagedDatasetProfile));
}
@org.springframework.transaction.annotation.Transactional
@Transactional
@RequestMapping(method = RequestMethod.POST, value = {"/datasetprofile/clone/{id}"}, consumes = "application/json", produces = "application/json")
public ResponseEntity<ResponseItem<eu.eudat.models.data.admin.composite.DatasetProfile>> clone(@PathVariable String id, @ClaimedAuthorities(claims = {ADMIN}) Principal principal) {
eu.eudat.data.entities.DatasetProfile profile = this.datasetProfileManager.clone(id);
@ -126,7 +135,6 @@ public class Admin extends BaseController {
}
}
@RequestMapping(method = RequestMethod.POST, value = {"/upload"})
public ResponseEntity<Object> setDatasetProfileXml(@RequestParam("file") MultipartFile file,
@ClaimedAuthorities(claims = {ADMIN}) Principal principal) throws IllegalAccessException, IOException {

View File

@ -0,0 +1,9 @@
package eu.eudat.exceptions.datasetprofile;
public class DatasetProfileNewVersionException extends RuntimeException {
public DatasetProfileNewVersionException(String message) {
super(message);
}
}

View File

@ -7,6 +7,7 @@ import eu.eudat.data.dao.entities.DatasetProfileDao;
import eu.eudat.data.entities.DatasetProfile;
import eu.eudat.data.query.items.item.datasetprofile.DatasetProfileAutocompleteRequest;
import eu.eudat.data.query.items.table.datasetprofile.DatasetProfileTableRequestItem;
import eu.eudat.exceptions.datasetprofile.DatasetProfileNewVersionException;
import eu.eudat.logic.builders.model.models.DataTableDataBuilder;
import eu.eudat.logic.services.ApiContext;
import eu.eudat.logic.services.operations.DatabaseRepository;
@ -49,6 +50,15 @@ public class DatasetProfileManager {
this.databaseRepository = apiContext.getOperationsContext().getDatabaseRepository();
}
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);
datasetprofile.setLabel(profile.getLabel());
datasetprofile.setStatus(profile.getStatus());
return datasetprofile;
}
public List<DatasetProfileAutocompleteItem> getWithCriteria(DatasetProfileAutocompleteRequest datasetProfileAutocompleteRequest) throws IllegalAccessException, InstantiationException {
QueryableList<DatasetProfile> items = databaseRepository.getDatasetProfileDao().getWithCriteria(datasetProfileAutocompleteRequest.getCriteria());
List<DatasetProfileAutocompleteItem> datasetProfiles = items.select(item -> new DatasetProfileAutocompleteItem().fromDataModel(item));
@ -104,10 +114,7 @@ public class DatasetProfileManager {
return result;
}
public ResponseEntity<byte[]> getDocument(eu.eudat.models.data.user.composite.DatasetProfile datasetProfile, String label) throws IllegalAccessException, IOException, InstantiationException {
FileEnvelope envelope = getXmlDocument(datasetProfile, label);
InputStream resource = new FileInputStream(envelope.getFile());
System.out.println("Mime Type of " + envelope.getFilename() + " is " +
@ -137,7 +144,6 @@ public class DatasetProfileManager {
return fileEnvelope;
}
public eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel.DatasetProfile createDatasetProfileFromXml(MultipartFile multiPartFile) {
ImportXmlBuilderDatasetProfile xmlBuilder = new ImportXmlBuilderDatasetProfile();
try {
@ -156,4 +162,30 @@ public class DatasetProfileManager {
fos.close();
return convFile;
}
public eu.eudat.data.entities.DatasetProfile createNewVersionDatasetProfile(String id, eu.eudat.models.data.admin.composite.DatasetProfile profile) throws Exception {
// Getting the DatasetProfile which we will create its new version.
eu.eudat.data.entities.DatasetProfile oldDatasetProfile = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id));
// Getting the DatasetProfile with the latest Version.
DatasetProfileCriteria criteria = new DatasetProfileCriteria();
LinkedList<UUID> list = new LinkedList<>();
list.push(oldDatasetProfile.getGroupId());
criteria.setGroupIds(list);
criteria.setAllVersions(false);
QueryableList<DatasetProfile> datasetProfileQueryableList = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().getWithCriteria(criteria);
eu.eudat.data.entities.DatasetProfile latestVersionDatasetProfile = datasetProfileQueryableList.getSingle();
if (latestVersionDatasetProfile.getVersion().equals(oldDatasetProfile.getVersion())){
eu.eudat.models.data.admin.composite.DatasetProfile sortedProfile = profile.toShort();
eu.eudat.data.entities.DatasetProfile modelDefinition = AdminManager.generateViewStyleDefinition(sortedProfile, apiContext);
modelDefinition.setLabel(oldDatasetProfile.getLabel());
modelDefinition.setVersion((short) (oldDatasetProfile.getVersion() + 1));
modelDefinition.setGroupId(oldDatasetProfile.getGroupId());
apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().createOrUpdate(modelDefinition);
return modelDefinition;
} else {
throw new DatasetProfileNewVersionException("Version to update not the latest.");
}
}
}

View File

@ -13,19 +13,16 @@ public class DatasetProfile {
private List<Section> sections;
private List<Page> pages;
private Short status;
private Short version;
public List<Section> getSections() {
return sections;
}
public void setSections(List<Section> sections) {
this.sections = sections;
}
public void setSections(List<Section> sections) { this.sections = sections; }
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
@ -33,7 +30,6 @@ public class DatasetProfile {
public List<Page> getPages() {
return pages;
}
public void setPages(List<Page> pages) {
this.pages = pages;
}
@ -41,11 +37,13 @@ public class DatasetProfile {
public Short getStatus() {
return status;
}
public void setStatus(Short status) {
this.status = status;
}
public Short getVersion() { return version; }
public void setVersion(Short version) { this.version = version; }
public void buildProfile(eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.ViewStyleModel viewStyle) {
this.sections = new ModelBuilder().fromViewStyleDefinition(viewStyle.getSections(), Section.class);
this.pages = new ModelBuilder().fromViewStyleDefinition(viewStyle.getPages(), Page.class);
@ -62,6 +60,7 @@ public class DatasetProfile {
shortProfile.setSections(shortSection);
shortProfile.setPages(this.pages);
shortProfile.setStatus(this.status);
shortProfile.setVersion(this.version);
return shortProfile;
}
}

View File

@ -10,21 +10,17 @@ import java.util.UUID;
public class DatasetProfileListingModel implements DataModel<DatasetProfile, DatasetProfileListingModel> {
private UUID id;
private String label;
private Short status;
private Date created;
private Date modified = new Date();
private String description;
private Short version;
private UUID groupId;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
@ -32,7 +28,6 @@ public class DatasetProfileListingModel implements DataModel<DatasetProfile, Dat
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
@ -40,7 +35,6 @@ public class DatasetProfileListingModel implements DataModel<DatasetProfile, Dat
public Short getStatus() {
return status;
}
public void setStatus(Short status) {
this.status = status;
}
@ -48,7 +42,6 @@ public class DatasetProfileListingModel implements DataModel<DatasetProfile, Dat
public Date getCreated() {
return created;
}
public void setCreated(Date created) {
this.created = created;
}
@ -56,7 +49,6 @@ public class DatasetProfileListingModel implements DataModel<DatasetProfile, Dat
public Date getModified() {
return modified;
}
public void setModified(Date modified) {
this.modified = modified;
}
@ -64,11 +56,16 @@ public class DatasetProfileListingModel implements DataModel<DatasetProfile, Dat
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Short getVersion() { return version; }
public void setVersion(Short version) { this.version = version; }
public UUID getGroupId() { return groupId; }
public void setGroupId(UUID groupId) { this.groupId = groupId; }
@Override
public DatasetProfileListingModel fromDataModel(DatasetProfile entity) {
this.id = entity.getId();
@ -77,6 +74,8 @@ public class DatasetProfileListingModel implements DataModel<DatasetProfile, Dat
this.created = entity.getCreated();
this.modified = entity.getModified();
this.description = entity.getDescription();
this.version = entity.getVersion();
this.groupId = entity.getGroupId();
return this;
}

View File

@ -5,6 +5,7 @@ export interface DatasetProfile {
sections: Section[];
pages: Page[];
status: number;
version: number;
}
export interface Page {

View File

@ -2,4 +2,6 @@ import { BaseCriteria } from "../base-criteria";
export class DatasetProfileCriteria extends BaseCriteria {
public id: String;
public groupIds: string[];
public allVersions: boolean;
}

View File

@ -22,6 +22,7 @@ export class DatasetProfileService {
constructor(private http: BaseHttpService, private httpClient: HttpClient) {
this.actionUrl = environment.Server + 'admin/';
}
createForm(data) {
return this.http.post<DatasetProfileEditorModel>(this.actionUrl + 'addDmp', data);
}
@ -46,18 +47,20 @@ export class DatasetProfileService {
return this.http.post<DatasetProfile>(this.actionUrl + 'datasetprofile/clone/' + id, {});
}
newVersion(id, data) {
return this.http.post<DatasetProfileEditorModel>(this.actionUrl + 'newVersion/' + id, data);
}
delete(id: string, data): Observable<DatasetProfile> {
//return this.http.post<DatasetProfile>(this.actionUrl + 'addDmp/' + id, data);
return this.http.delete<DatasetProfile>(this.actionUrl + id, {});
}
public downloadXML(id: string): Observable<HttpResponse<Blob>> {
downloadXML(id: string): Observable<HttpResponse<Blob>> {
let headerXml: HttpHeaders = this.headers.set('Content-Type', 'application/xml')
return this.httpClient.get(this.actionUrl + 'getXml/' + id, { responseType: 'blob', observe: 'response', headers: headerXml });
}
uploadFile(file: FileList, labelSent: string): Observable<DataTableData<DatasetListingModel>> {
const params = new BaseHttpParams();
params.interceptorContext = {

View File

@ -16,6 +16,14 @@ const routes: Routes = [
path: 'clone/:cloneid',
component: DatasetProfileEditorComponent
},
{
path: 'newversion/:newversionid',
component: DatasetProfileEditorComponent
},
{
path: 'versions/:groupId',
component: DatasetProfileListingComponent,
},
{
path: '',
component: DatasetProfileListingComponent,

View File

@ -11,12 +11,14 @@ export class DatasetProfileEditorModel extends BaseFormModel {
public pages: Array<PageEditorModel> = new Array<PageEditorModel>();
public label: string;
public status: number;
public version: number;
fromModel(item: DatasetProfile): DatasetProfileEditorModel {
if (item.sections) { this.sections = item.sections.map(x => new SectionEditorModel().fromModel(x)); }
if (item.pages) { this.pages = item.pages.map(x => new PageEditorModel().fromModel(x)); }
this.label = item.label;
this.status = item.status;
this.version = item.version;
return this;
}
@ -38,6 +40,7 @@ export class DatasetProfileEditorModel extends BaseFormModel {
formGroup.addControl('pages', this.formBuilder.array(pagesFormArray));
formGroup.addControl('label', new FormControl(this.label, Validators.required));
formGroup.addControl('status', new FormControl(this.status));
formGroup.addControl('version', new FormControl(this.version));
return formGroup;
}
}

View File

@ -1,6 +1,6 @@
<div class="container" *ngIf="form" [formGroup]='form' class="dataset-profile-editor">
<mat-form-field class="full-width">
<input matInput formControlName="label"
<input matInput formControlName="label" [disabled]="newVersionId"
placeholder="{{'DATASET-PROFILE-EDITOR.FIELDS.DATASET-TITLE' | translate}}" required>
<mat-error *ngIf="form.get('label').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}
</mat-error>

View File

@ -31,6 +31,7 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
form: FormGroup;
previewerFormGroup: FormGroup;
private datasetProfileId: string;
newVersionId: string;
dataWizardModel: DatasetWizardModel;
@ViewChild('stepper') stepper: MatHorizontalStepper;
viewOnly = false;
@ -53,6 +54,7 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
this.route.paramMap.pipe(takeUntil(this._destroyed)).subscribe((paramMap: ParamMap) => {
this.datasetProfileId = paramMap.get('id');
const cloneId = paramMap.get('cloneid');
this.newVersionId = paramMap.get('newversionid');
if (this.datasetProfileId != null) {
this.isNew = false;
@ -94,6 +96,25 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
},
error => this.onCallbackError(error)
);
} else if (this.newVersionId != null) {
this.datasetProfileService.getDatasetProfileById(this.newVersionId)
.pipe(map(data => data as DatasetProfile), takeUntil(this._destroyed))
.subscribe(
data => {
try {
this.dataModel = new DatasetProfileEditorModel().fromModel(data);
// this.isDeleted = this.masterItem.isActive === IsActive.Inactive;
this.form = this.dataModel.buildForm();
this.form.get('version').setValue(this.form.get('version').value + 1);
this.form.controls['label'].disable();
this.prepareForm();
} catch {
this.logger.error('Could not parse MasterItem: ' + data);
this.uiNotificationService.snackBarNotification(this.language.instant('NOTIFICATIONS.DEFAULT.ERROR'), SnackBarNotificationLevel.Error);
}
},
error => this.onCallbackError(error)
);
} else {
this.dataModel = new DatasetProfileEditorModel();
this.form = this.dataModel.buildForm();
@ -155,6 +176,14 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
.subscribe(() => {
this.router.navigate(['/dataset-profiles']);
});
} else if (this.newVersionId) {
this.datasetProfileService.newVersion(this.newVersionId, data)
.pipe(takeUntil(this._destroyed))
.subscribe(() => {
this.router.navigate(['/dataset-profiles']);
},
error => this.onCallbackErrorNewVersion(error)
);
} else {
this.form.get('status').setValue(0);
data = this.form.value;
@ -182,6 +211,10 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
this.router.navigate(['/master-items']);
}
onCallbackErrorNewVersion(errorResponse: HttpErrorResponse) {
this.uiNotificationService.snackBarNotification(errorResponse.error.message, SnackBarNotificationLevel.Error);
}
onCallbackError(errorResponse: HttpErrorResponse) {
// const error: HttpError = this.httpErrorHandlingService.getError(errorResponse);
// if (error.statusCode === 400) {

View File

@ -29,9 +29,15 @@
<mat-header-cell *matHeaderCellDef>{{'DATASET-PROFILE-LISTING.COLUMNS.ACTIONS' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row" (click)="$event.stopPropagation()">
<mat-menu #actionsMenu="matMenu">
<button mat-menu-item (click)="newVersion(row.id, row.label)">
<mat-icon>queue</mat-icon>{{'DATASET-PROFILE-LISTING.ACTIONS.NEW-VERSION' | translate}}
</button>
<button mat-menu-item (click)="clone(row.id)">
<mat-icon>filter_none</mat-icon>{{'DATASET-PROFILE-LISTING.ACTIONS.CLONE' | translate}}
</button>
<button mat-menu-item (click)="viewVersions(row.groupId, row.label)">
<mat-icon>library_books</mat-icon>{{'DATASET-PROFILE-LISTING.ACTIONS.VIEW-VERSIONS' | translate}}
</button>
<!--<button *ngIf="row.status==1" mat-menu-item (click)="makeItPublic(row.id)"><mat-icon>people_outline</mat-icon>{{'DATASET-LISTING.ACTIONS.MAKE-IT-PUBLIC' | translate}}</button> -->
</mat-menu>
<button mat-icon-button [matMenuTriggerFor]="actionsMenu">

View File

@ -12,6 +12,9 @@ import { DatasetProfileCriteria } from '../../../../core/query/dataset-profile/d
import { DatasetProfileService } from '../../../../core/services/dataset-profile/dataset-profile.service';
import { DmpService } from '../../../../core/services/dmp/dmp.service';
import { DatasetProfileCriteriaComponent } from './criteria/dataset-profile.component';
import { error } from 'selenium-webdriver';
import { UiNotificationService, SnackBarNotificationLevel } from '../../../../core/services/notification/ui-notification-service';
import { TranslateService } from '@ngx-translate/core';
@Component({
selector: 'app-dataset-profile-listing-component',
@ -24,32 +27,45 @@ export class DatasetProfileListingComponent extends BaseComponent implements OnI
@ViewChild(MatSort) sort: MatSort;
@ViewChild(DatasetProfileCriteriaComponent) criteria: DatasetProfileCriteriaComponent;
dataSource: DatasetDataSource | null;
displayedColumns: String[] = ['label', 'description', 'created', 'actions'];
pageEvent: PageEvent;
titlePrefix: String;
dmpId: String;
itemId: string;
constructor(
private datasetService: DatasetProfileService,
private router: Router,
private route: ActivatedRoute,
private dmpService: DmpService
private dmpService: DmpService,
private language: TranslateService,
private uiNotificationService: UiNotificationService
) {
super();
}
ngOnInit() {
this.route.params
.pipe(takeUntil(this._destroyed))
.subscribe((params: Params) => {
if (params['dmpId']) {
this.dmpId = params['dmpId'];
if (this.dmpId != null) { this.setDmpTitle(this.dmpId); }
this.criteria.setCriteria(this.getDefaultCriteria(this.dmpId));
this.criteria.setCriteria(this.getDefaultCriteria());
this.refresh();
this.criteria.setRefreshCallback(() => this.refresh());
} else {
this.itemId = params['groupId'];
if (this.itemId) {
const datasetProfileLabel = this.route.snapshot.queryParams.groupLabel;
}
this.criteria.setCriteria(this.getDefaultCriteria());
this.refresh();
this.criteria.setRefreshCallback(() => this.refresh());
}
});
}
@ -58,18 +74,19 @@ export class DatasetProfileListingComponent extends BaseComponent implements OnI
.pipe(takeUntil(this._destroyed))
.subscribe(data => {
this.titlePrefix = data.label;
});
}
);
}
refresh() {
this.dataSource = new DatasetDataSource(this.datasetService, this._paginator, this.sort, this.criteria);
this.dataSource = new DatasetDataSource(this.datasetService, this._paginator, this.sort, this.criteria, this.itemId);
}
rowClick(rowId: String) {
this.router.navigate(['dataset-profiles/' + rowId]);
}
getDefaultCriteria(dmpId: String): DatasetProfileCriteria {
getDefaultCriteria(): DatasetProfileCriteria {
const defaultCriteria = new DatasetProfileCriteria();
return defaultCriteria;
}
@ -78,6 +95,14 @@ export class DatasetProfileListingComponent extends BaseComponent implements OnI
this.router.navigate(['dataset-profiles/clone/' + id]);
}
newVersion(id: string, label: string) {
this.router.navigate(['dataset-profiles/newversion/' + id]);
}
viewVersions(rowId, rowLabel) {
this.router.navigate(['/dataset-profiles/versions/' + rowId], { queryParams: { groupLabel: rowLabel } });
}
// makeItPublic(id: String) {
// debugger;
// this.datasetService.makeDatasetPublic(id).pipe(takeUntil(this._destroyed)).subscribe();
@ -92,7 +117,8 @@ export class DatasetDataSource extends DataSource<DatasetListingModel> {
private _service: DatasetProfileService,
private _paginator: MatPaginator,
private _sort: MatSort,
private _criteria: DatasetProfileCriteriaComponent
private _criteria: DatasetProfileCriteriaComponent,
private itemId
) {
super();
@ -112,6 +138,10 @@ export class DatasetDataSource extends DataSource<DatasetListingModel> {
if (this._sort.active) { fields = this._sort.direction === 'asc' ? ['+' + this._sort.active] : ['-' + this._sort.active]; }
const request = new DataTableRequest<DatasetProfileCriteria>(startIndex, this._paginator.pageSize, { fields: fields });
request.criteria = this._criteria.criteria;
if (this.itemId) {
request.criteria.groupIds = [this.itemId];
request.criteria.allVersions = true;
}
return this._service.getPaged(request);
})
/*.catch((error: any) => {