Removes and refactors endpoints from DMPs

This commit is contained in:
Diamantis Tziotzios 2019-01-29 18:25:40 +02:00
parent 339f65f499
commit d5740a560c
3 changed files with 9 additions and 17 deletions

View File

@ -100,13 +100,6 @@ public class DMPs extends BaseController {
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DMP>().status(ApiMessageCode.NO_MESSAGE)); return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DMP>().status(ApiMessageCode.NO_MESSAGE));
} }
@RequestMapping(method = RequestMethod.POST, value = {"/get"}, consumes = "application/json", produces = "application/json")
public @ResponseBody
ResponseEntity<ResponseItem<List<DataManagementPlan>>> getWithCriteria(@RequestBody DataManagementPlanCriteriaRequest dataManagementPlanCriteria, Principal principal) throws InstantiationException, IllegalAccessException {
List<DataManagementPlan> dataTable = this.dataManagementPlanManager.getWithCriteria(this.getApiContext().getOperationsContext().getDatabaseRepository().getDmpDao(), dataManagementPlanCriteria, principal);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<DataManagementPlan>>().status(ApiMessageCode.NO_MESSAGE).payload(dataTable));
}
@Transactional @Transactional
@RequestMapping(method = RequestMethod.DELETE, value = {"{id}"}, consumes = "application/json", produces = "application/json") @RequestMapping(method = RequestMethod.DELETE, value = {"{id}"}, consumes = "application/json", produces = "application/json")
public @ResponseBody public @ResponseBody

View File

@ -62,10 +62,6 @@ export class DmpService {
return this.http.post<any>(this.actionUrl + 'dynamic', requestItem, { headers: this.headers }); return this.http.post<any>(this.actionUrl + 'dynamic', requestItem, { headers: this.headers });
} }
get(requestItem: RequestItem<DmpCriteria>): Observable<DmpListingModel[]> {
return this.http.post<DmpListingModel[]>(this.actionUrl + 'get', requestItem, { headers: this.headers });
}
public downloadXML(id: string): Observable<HttpResponse<Blob>> { public downloadXML(id: string): Observable<HttpResponse<Blob>> {
return this.httpClient.get(this.actionUrl + 'getXml/' + id, { responseType: 'blob', observe: 'response' }); return this.httpClient.get(this.actionUrl + 'getXml/' + id, { responseType: 'blob', observe: 'response' });
} }

View File

@ -26,6 +26,7 @@ import { DatasetDescriptionFormEditorModel } from '../../misc/dataset-descriptio
import { DatasetWizardEditorModel } from './dataset-wizard-editor.model'; import { DatasetWizardEditorModel } from './dataset-wizard-editor.model';
import { SnackBarNotificationLevel, UiNotificationService } from '../../../core/services/notification/ui-notification-service'; import { SnackBarNotificationLevel, UiNotificationService } from '../../../core/services/notification/ui-notification-service';
import { ConfirmationDialogComponent } from '../../../library/confirmation-dialog/confirmation-dialog.component'; import { ConfirmationDialogComponent } from '../../../library/confirmation-dialog/confirmation-dialog.component';
import { DataTableRequest } from '../../../core/model/data-table/data-table-request';
@Component({ @Component({
selector: 'app-dataset-wizard-component', selector: 'app-dataset-wizard-component',
@ -207,15 +208,17 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe((params: Params) => { .subscribe((params: Params) => {
const itemId = params['id']; const itemId = params['id'];
if (itemId != null) { setTimeout(()=> this.stepper.selectedIndex = 2); } if (itemId != null) { setTimeout(() => this.stepper.selectedIndex = 2); }
}); });
} }
searchDmp(query: string): Observable<DmpListingModel[]> { searchDmp(query: string): Observable<DmpListingModel[]> {
const dmpRequestItem: RequestItem<DmpCriteria> = new RequestItem(); const fields: Array<string> = new Array<string>();
dmpRequestItem.criteria = new DmpCriteria(); fields.push('asc');
dmpRequestItem.criteria.like = query; const dmpDataTableRequest: DataTableRequest<DmpCriteria> = new DataTableRequest(0, null, { fields: fields });
return this.dmpService.get(dmpRequestItem); dmpDataTableRequest.criteria = new DmpCriteria();
dmpDataTableRequest.criteria.like = query;
return this.dmpService.getPaged(dmpDataTableRequest).map(x => x.data);
} }
loadDatasetProfiles() { loadDatasetProfiles() {
@ -236,7 +239,7 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
} }
getDefinition() { getDefinition() {
if (this.formGroup.invalid) { setTimeout(()=> this.stepper.selectedIndex = 0); return; } if (this.formGroup.invalid) { setTimeout(() => this.stepper.selectedIndex = 0); return; }
if (this.isNew) { if (this.isNew) {
this.datasetWizardService.getDefinition(this.formGroup.get('profile').value) this.datasetWizardService.getDefinition(this.formGroup.get('profile').value)
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))