diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/DatasetProfiles.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/DatasetProfiles.java index a3b2d9f56..35375e148 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/DatasetProfiles.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/DatasetProfiles.java @@ -48,17 +48,5 @@ public class DatasetProfiles extends BaseController { List datasetProfileTableData = this.datasetProfileManager.getAll(); return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>().status(ApiMessageCode.NO_MESSAGE).payload(datasetProfileTableData)); } - - @Transactional - @RequestMapping(method = RequestMethod.DELETE, value = {"/datasetprofiles/delete/{id}"}, consumes = "application/json", produces = "application/json") - public @ResponseBody - ResponseEntity> delete(@PathVariable UUID id, Principal principal) { - try { - new DatasetProfileManager().delete(this.getApiContext(), id); - return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem().status(ApiMessageCode.SUCCESS_MESSAGE).message("Successfully Deleted Dataset Profile Plan")); - } catch (DMPWithDatasetsDeleteException exception) { - return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem().status(ApiMessageCode.ERROR_MESSAGE).message(exception.getMessage())); - } - } } diff --git a/dmp-frontend/src/app/dataset-profile-form/form/form.component.html b/dmp-frontend/src/app/dataset-profile-form/form/form.component.html deleted file mode 100644 index a82c190bd..000000000 --- a/dmp-frontend/src/app/dataset-profile-form/form/form.component.html +++ /dev/null @@ -1,73 +0,0 @@ -
- - - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - - - - - {{'DATASET-PROFILE.PAGES-DESCRIPTION' | translate}} -
-
- - - {{i + - 1}}.{{form.get('pages').at(i).get('title').value}} -
- -
-
-
-
- -
-
-
-
-
- -
-
-
- - {{'DATASET-PROFILE.FORM-DESCRIPTION' | translate}} -
-
- - - {{i + 1}}. - {{form.get('sections').get(''+i).get('title').value}} -
- -
-
-
-
- -
-
-
-
-
- -
-
-
- - {{'DATASET-PROFILE.PREVIEW' | translate}} -
- -
-
-
- - -
diff --git a/dmp-frontend/src/app/dataset-profile-form/form/form.component.ts b/dmp-frontend/src/app/dataset-profile-form/form/form.component.ts deleted file mode 100644 index ea92bd900..000000000 --- a/dmp-frontend/src/app/dataset-profile-form/form/form.component.ts +++ /dev/null @@ -1,185 +0,0 @@ -import { AfterViewInit, Component, OnInit, ViewChild, ViewContainerRef } from '@angular/core'; -import { FormArray, FormControl, FormGroup } from '@angular/forms'; -import { MatDialog, MatHorizontalStepper } from '@angular/material'; -import { ActivatedRoute, Router } from '@angular/router'; -import { takeUntil } from 'rxjs/operators'; -import { BaseComponent } from '../../core/common/base/base.component'; -import { DatasetProfileModelAdmin } from '../../models/datasetProfileAdmin/DatasetProfileModelAdmin'; -import { Page } from '../../models/datasetProfileAdmin/Page'; -import { Section } from '../../models/datasetProfileAdmin/Section'; -import { DatasetProfileDefinitionModel } from '../../models/DatasetProfileDefinitionModel'; -import { DatasetWizardModel } from '../../models/datasets/DatasetWizardModel'; -import { DatasetProfileService } from '../../services/dataset-profile.service'; -import { DatasetProfileAdmin } from '../../services/datasetProfileAdmin/datasetProfileAfmin.service'; -import { JsonSerializer } from '../../utilities/JsonSerializer'; -import { TdDialogService } from '@covalent/core'; - -@Component({ - selector: 'app-form-component', - templateUrl: './form.component.html', - providers: [DatasetProfileAdmin, DatasetProfileService], - styleUrls: ['./form.component.scss'] -}) - -export class FormComponent extends BaseComponent implements OnInit, AfterViewInit { - - - dataModel: DatasetProfileModelAdmin; - form: FormGroup; - previewerFormGroup: FormGroup; - private profileID: string; - private cloneId: string; - dataWizardModel: DatasetWizardModel; - isNew = true; - @ViewChild('stepper') stepper: MatHorizontalStepper; - constructor( - public datasetprofileAdmin: DatasetProfileAdmin, - private datasetProfileService: DatasetProfileService, - private datasetProfileAdminService: DatasetProfileAdmin, - private route: ActivatedRoute, - private router: Router, - private _dialogService: TdDialogService, - private _viewContainerRef: ViewContainerRef, - public dialog: MatDialog, - ) { - super(); - this.profileID = route.snapshot.params['id']; - this.cloneId = route.snapshot.params['cloneid']; - } - - ngAfterViewInit(): void { - console.log(this.stepper); - } - - ngOnInit() { - - this.dataModel = JsonSerializer.fromJSONObject(new DatasetProfileModelAdmin(), DatasetProfileModelAdmin); - if (this.profileID) { - this.datasetProfileService.getDatasetProfileById(this.profileID) - .pipe(takeUntil(this._destroyed)) - .subscribe((data) => { - this.isNew = false; - this.dataModel = JsonSerializer.fromJSONObject(data, DatasetProfileModelAdmin); - this.form = this.dataModel.buildForm(); - this.form.valueChanges - .pipe(takeUntil(this._destroyed)) - .subscribe(change => { - this.datasetProfileAdminService.preview(this.dataModel) - .pipe(takeUntil(this._destroyed)) - .subscribe(dataset => { - const datasetModel = new DatasetWizardModel(); - datasetModel.datasetProfileDefinition = JsonSerializer.fromJSONObject(dataset, DatasetProfileDefinitionModel); - this.dataWizardModel = datasetModel; - this.previewerFormGroup = this.dataWizardModel.buildForm().get('datasetProfileDefinition'); - }); - }); - this.form.updateValueAndValidity(); - }); - } else if (this.cloneId) { - this.datasetprofileAdmin.clone(this.cloneId) - .pipe(takeUntil(this._destroyed)) - .subscribe((data) => { - this.isNew = false; - this.dataModel = JsonSerializer.fromJSONObject(data, DatasetProfileModelAdmin); - this.form = this.dataModel.buildForm(); - this.form.valueChanges - .pipe(takeUntil(this._destroyed)) - .subscribe(change => { - this.datasetProfileAdminService.preview(this.dataModel) - .pipe(takeUntil(this._destroyed)) - .subscribe(dataset => { - const datasetModel = new DatasetWizardModel(); - datasetModel.datasetProfileDefinition = JsonSerializer.fromJSONObject(dataset, DatasetProfileDefinitionModel); - this.dataWizardModel = datasetModel; - this.previewerFormGroup = this.dataWizardModel.buildForm().get('datasetProfileDefinition'); - }); - }); - this.form.updateValueAndValidity(); - }); - } else { - this.addSection(); - this.addPage(); - } - } - - onIsMultiplicityEnabledChange(isMultiplicityEnabled: boolean) { - if (!isMultiplicityEnabled) { - (this.form.get('multiplicity').get('min')).setValue(0); - (this.form.get('multiplicity').get('max')).setValue(0); - } - } - - addSection() { - const section: Section = new Section(); - this.dataModel.sections.push(section); - (this.form.get('sections')).push(section.buildForm()); - } - - addPage() { - const page: Page = new Page(this.dataModel.pages.length); - this.dataModel.pages.push(page); - (this.form.get('pages')).push(page.buildForm()); - } - - DeleteSection(index) { - this.dataModel.sections.splice(index, 1); - (this.form.get('sections')).removeAt(index); - } - - DeletePage(index) { - this.dataModel.pages.splice(index, 1); - (this.form.get('pages')).removeAt(index); - } - - createForm(data) { - return this.datasetprofileAdmin.createForm(data); - } - updateForm(id, data) { - return this.datasetprofileAdmin.updateForm(id, data); - } - - onSubmit() { - const data = this.form.value; - - if (this.profileID) { - this.updateForm(this.profileID, data) - .pipe(takeUntil(this._destroyed)) - .subscribe(() => { - this.router.navigate(['/dataset-profile']); - }); - } else { - this.createForm(data) - .pipe(takeUntil(this._destroyed)) - .subscribe(() => { - this.router.navigate(['/dataset-profile']); - }); - } - } - - isStepActive(step: number) { - return this.stepper && this.stepper.selectedIndex === step; - } - - openConfirm(dmpLabel, id): void { - this._dialogService.openConfirm({ - message: 'Are you sure you want to delete the "' + dmpLabel + '"', - disableClose: true || false, - viewContainerRef: this._viewContainerRef, - title: 'Confirm', - cancelButton: 'No', - acceptButton: 'Yes' - }).afterClosed() - .pipe(takeUntil(this._destroyed)) - .subscribe((accept: boolean) => { - if (accept) { - this.datasetprofileAdmin.delete(id) - .pipe(takeUntil(this._destroyed)) - .subscribe(() => { - this.router.navigate(['/datasets']); - }); - } else { - // DO SOMETHING ELSE - } - }); - } -} diff --git a/dmp-frontend/src/app/services/datasetProfileAdmin/datasetProfileAfmin.service.ts b/dmp-frontend/src/app/services/datasetProfileAdmin/datasetProfileAfmin.service.ts deleted file mode 100644 index 0c05932d2..000000000 --- a/dmp-frontend/src/app/services/datasetProfileAdmin/datasetProfileAfmin.service.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { HttpHeaders } from '@angular/common/http'; -import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs'; -import { environment } from '../../../environments/environment'; -import { DatasetProfileCriteria } from '../../models/criteria/dataset-profile/DatasetProfileCriteria'; -import { DataTableData } from '../../models/data-table/DataTableData'; -import { DataTableRequest } from '../../models/data-table/DataTableRequest'; -import { DatasetProfileModelAdmin } from '../../models/datasetProfileAdmin/DatasetProfileModelAdmin'; -import { DatasetListingModel } from '../../models/datasets/DatasetListingModel'; -import { BaseHttpService } from '../../utilities/cite-http-service-module/base-http.service'; - - - -@Injectable() -export class DatasetProfileAdmin { - - private actionUrl: string; - private headers: HttpHeaders; - - constructor(private http: BaseHttpService) { - - this.actionUrl = environment.Server + 'admin/'; - - this.headers = new HttpHeaders(); - this.headers = this.headers.set('Content-Type', 'application/json'); - this.headers = this.headers.set('Accept', 'application/json'); - } - createForm(data) { - return this.http.post(this.actionUrl + 'addDmp', data, { headers: this.headers }); - } - - updateForm(id, data) { - return this.http.post(this.actionUrl + 'addDmp/' + id, data, { headers: this.headers }); - } - - getDatasetProfileById(datasetProfileID) { - return this.http.get(this.actionUrl + 'get/' + datasetProfileID, { headers: this.headers }); - } - - getPaged(dataTableRequest: DataTableRequest): Observable> { - return this.http.post>(this.actionUrl + 'datasetprofiles/getPaged', dataTableRequest, { headers: this.headers }); - } - - preview(data: DatasetProfileModelAdmin): Observable { - return this.http.post(this.actionUrl + 'preview', data, { headers: this.headers }); - } - - clone(id: string): Observable { - return this.http.post(environment.Server + 'datasetprofile/clone/' + id, {}, { headers: this.headers }); - } - - delete(id: string): Observable { - return this.http.delete(environment.Server + 'datasetprofile/delete/' + id, { headers: this.headers }); - } -} diff --git a/dmp-frontend/src/app/ui/dmp/listing/criteria/dmp-criteria.component.ts b/dmp-frontend/src/app/ui/dmp/listing/criteria/dmp-criteria.component.ts index 653667cb0..6a934ded3 100644 --- a/dmp-frontend/src/app/ui/dmp/listing/criteria/dmp-criteria.component.ts +++ b/dmp-frontend/src/app/ui/dmp/listing/criteria/dmp-criteria.component.ts @@ -1,28 +1,22 @@ import { Component, Input, OnInit } from '@angular/core'; -import { FormBuilder, FormControl, FormGroup } from '@angular/forms'; +import { FormBuilder, FormControl } from '@angular/forms'; +import { MatDialog } from '@angular/material'; import { TranslateService } from '@ngx-translate/core'; import { takeUntil } from 'rxjs/operators'; import { ValidationErrorModel } from '../../../../common/forms/validation/error-model/validation-error-model'; +import { DataTableRequest } from '../../../../core/model/data-table/data-table-request'; import { ProjectListingModel } from '../../../../core/model/project/project-listing'; import { DmpCriteria } from '../../../../core/query/dmp/dmp-criteria'; -import { ProjectCriteria } from '../../../../core/query/project/project-criteria'; -import { ProjectService } from '../../../../core/services/project/project.service'; -import { MultipleAutoCompleteConfiguration } from '../../../../library/auto-complete/multiple/multiple-auto-complete-configuration'; -import { RequestItem } from '../../../../core/query/request-item'; -import { BaseCriteriaComponent } from '../../../misc/criteria/base-criteria.component'; -import { DataTableRequest } from '../../../../core/model/data-table/data-table-request'; -import { DmpService } from '../../../../core/services/dmp/dmp.service'; -import { MatDialog } from '@angular/material'; -import { DmpUploadDialogue } from './upload-dialogue/dmp-upload-dialogue.component'; -import { Observable } from 'rxjs'; -import { ExternalSourceItemModel } from '../../../../core/model/external-sources/external-source-item'; -import { ExternalSourcesService } from '../../../../core/services/external-sources/external-sources.service'; -import { OrganisationService } from '../../../../core/services/organisation/organisation.service'; import { OrganisationCriteria } from '../../../../core/query/organisation/organisation-criteria'; -import { OrganizationModel } from '../../../../core/model/organisation/organization'; -import { DataTableData } from '../../../../core/model/data-table/data-table-data'; +import { ProjectCriteria } from '../../../../core/query/project/project-criteria'; import { UserCriteria } from '../../../../core/query/user/user-criteria'; +import { DmpService } from '../../../../core/services/dmp/dmp.service'; +import { OrganisationService } from '../../../../core/services/organisation/organisation.service'; +import { ProjectService } from '../../../../core/services/project/project.service'; import { UserService } from '../../../../core/services/user/user.service'; +import { MultipleAutoCompleteConfiguration } from '../../../../library/auto-complete/multiple/multiple-auto-complete-configuration'; +import { BaseCriteriaComponent } from '../../../misc/criteria/base-criteria.component'; +import { DmpUploadDialogue } from './upload-dialogue/dmp-upload-dialogue.component'; @Component({ selector: 'app-dmp-criteria-component',