diff --git a/dmp-frontend/src/app/app.module.ts b/dmp-frontend/src/app/app.module.ts index d708daa68..1b9602363 100644 --- a/dmp-frontend/src/app/app.module.ts +++ b/dmp-frontend/src/app/app.module.ts @@ -23,6 +23,7 @@ import { AuthGuard } from './guards/auth.guard'; import { PageNotFoundComponent } from './not-found.component'; import { EmptyComponent } from './empty.component'; import { TocComponent } from './form/tableOfContents/toc.component'; +import { ConfirmationComponent } from './widgets/confirmation/confirmation.component'; import { PaginationService } from './services/pagination.service'; import { EestoreService } from './services/eestore.service'; @@ -86,6 +87,7 @@ import { UserWorkspaceComponent } from './user-workspace/user-workspace.componen DmpComponent, DatasetsComponent, UserWorkspaceComponent, + ConfirmationComponent, ProjectTableFilterPipe, DmpVersionFilterPipe, diff --git a/dmp-frontend/src/app/datasets/dataset.component.ts b/dmp-frontend/src/app/datasets/dataset.component.ts index d3da0f538..cdacd04a2 100644 --- a/dmp-frontend/src/app/datasets/dataset.component.ts +++ b/dmp-frontend/src/app/datasets/dataset.component.ts @@ -9,6 +9,7 @@ import {DataTable} from 'angular2-datatable'; import { DropdownField } from '../../app/form/fields/dropdown/field-dropdown'; import { Param } from '../entities/model/param'; import { StatusToString } from '../pipes/various/status-to-string'; +import { ConfirmationComponent } from '../widgets/confirmation/confirmation.component'; declare var $: any; @@ -217,7 +218,17 @@ export class DatasetsComponent implements OnInit { this.ngZone.run(() => this.router.navigate(['dynamic-form', {id: item.profile.id, datasetId:item.id}])); } - deleteRow(dataset, $event){ + markDatasetForDelete(dataset){ + this.dataset = dataset; + } + + deleteDataset(confirmation){ + if(confirmation==true) + this.deleteRow(this.dataset); + } + + + deleteRow(dataset){ this.serverService.deleteDataset(dataset).subscribe( response => { simple_notifier("success",null,"Deleted dataset"); diff --git a/dmp-frontend/src/app/datasets/dataset.html b/dmp-frontend/src/app/datasets/dataset.html index a4621f0b9..81d97fcfb 100644 --- a/dmp-frontend/src/app/datasets/dataset.html +++ b/dmp-frontend/src/app/datasets/dataset.html @@ -62,7 +62,7 @@ {{dataset?.created | date:'yyyy-MM-dd HH:mm:ss Z'}} {{dataset?.status | statusToString }} - + @@ -136,4 +136,7 @@ - \ No newline at end of file + + + + diff --git a/dmp-frontend/src/app/dmps/dmp.component.ts b/dmp-frontend/src/app/dmps/dmp.component.ts index 8940766c1..e40178d49 100644 --- a/dmp-frontend/src/app/dmps/dmp.component.ts +++ b/dmp-frontend/src/app/dmps/dmp.component.ts @@ -5,6 +5,7 @@ import { ServerService } from '../../app/services/server.service'; import { Dmp } from '../entities/model/dmp'; import { Dataset } from '../entities/model/dataset'; import { Project } from '../entities/model/project'; +import { ConfirmationComponent } from '../widgets/confirmation/confirmation.component'; import {DataTable} from 'angular2-datatable'; import { DropdownField } from '../../app/form/fields/dropdown/field-dropdown'; @@ -53,7 +54,6 @@ export class DmpComponent implements OnInit{ showIDs : boolean = false; // END ALTERNATIVE - dmp:any; @Input() dmpTableVisible: boolean; @Input() dmpCount = 0; @@ -241,7 +241,16 @@ newDmp(item){ $("#newDmpModal").modal("show"); } -deleteRow(dmp, $event){ +markDMPForDelete(dmp){ + this.dmp = dmp; +} + +deleteDMP(confirmation){ + if(confirmation==true) + this.deleteRow(this.dmp); +} + +deleteRow(dmp){ this.serverService.deleteDmp(dmp).subscribe( response => { diff --git a/dmp-frontend/src/app/dmps/dmps.html b/dmp-frontend/src/app/dmps/dmps.html index cc0735041..a6e7e56c9 100644 --- a/dmp-frontend/src/app/dmps/dmps.html +++ b/dmp-frontend/src/app/dmps/dmps.html @@ -1,7 +1,5 @@ - - @@ -73,7 +71,7 @@ @@ -197,3 +195,7 @@ + + + + \ No newline at end of file diff --git a/dmp-frontend/src/app/projects/projects.component.ts b/dmp-frontend/src/app/projects/projects.component.ts index 3b1c00eb2..76fd4bdfd 100644 --- a/dmp-frontend/src/app/projects/projects.component.ts +++ b/dmp-frontend/src/app/projects/projects.component.ts @@ -16,6 +16,7 @@ import { FormGroup, FormControl } from '@angular/forms'; //na dw import { NgForm } from '@angular/forms'; import { DatepickerOptions } from 'ng2-datepicker'; import { StatusToString} from '../pipes/various/status-to-string'; +import { ConfirmationComponent } from '../widgets/confirmation/confirmation.component'; import { ProjectTableFilterPipe } from '../pipes/project-table-filter.pipe'; diff --git a/dmp-frontend/src/app/widgets/confirmation/confirmation.component.css b/dmp-frontend/src/app/widgets/confirmation/confirmation.component.css new file mode 100644 index 000000000..4838ba5c1 --- /dev/null +++ b/dmp-frontend/src/app/widgets/confirmation/confirmation.component.css @@ -0,0 +1,11 @@ +.modal-header { + padding:9px 15px; + border-bottom:1px solid #eee; + background-color: #0480be; + -webkit-border-top-left-radius: 5px; + -webkit-border-top-right-radius: 5px; + -moz-border-radius-topleft: 5px; + -moz-border-radius-topright: 5px; + border-top-left-radius: 5px; + border-top-right-radius: 5px; + } \ No newline at end of file diff --git a/dmp-frontend/src/app/widgets/confirmation/confirmation.component.html b/dmp-frontend/src/app/widgets/confirmation/confirmation.component.html new file mode 100644 index 000000000..fdb60c8fd --- /dev/null +++ b/dmp-frontend/src/app/widgets/confirmation/confirmation.component.html @@ -0,0 +1,21 @@ + + \ No newline at end of file diff --git a/dmp-frontend/src/app/widgets/confirmation/confirmation.component.spec.ts b/dmp-frontend/src/app/widgets/confirmation/confirmation.component.spec.ts new file mode 100644 index 000000000..fd4da952c --- /dev/null +++ b/dmp-frontend/src/app/widgets/confirmation/confirmation.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ConfirmationComponent } from './confirmation.component'; + +describe('ConfirmationComponent', () => { + let component: ConfirmationComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ConfirmationComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ConfirmationComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should be created', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/dmp-frontend/src/app/widgets/confirmation/confirmation.component.ts b/dmp-frontend/src/app/widgets/confirmation/confirmation.component.ts new file mode 100644 index 000000000..2f35931d8 --- /dev/null +++ b/dmp-frontend/src/app/widgets/confirmation/confirmation.component.ts @@ -0,0 +1,35 @@ +import { Component, OnInit, Input,Output,EventEmitter } from '@angular/core'; + +@Component({ + selector: 'confirmation', + templateUrl: './confirmation.component.html', + styleUrls: ['./confirmation.component.css'] +}) +export class ConfirmationComponent implements OnInit { + + @Input() confirmationID : string; + @Input() confirmationTitle : string; + @Input() confirmationDescr : string; + @Input() subjectObj : any; + + @Output() responseSender: EventEmitter = new EventEmitter(); + + constructor() { + + } + + + ngOnInit() { + + } + + saidNo(){ + this.responseSender.emit(false); + } + + saidYes(){ + this.responseSender.emit(true); + } + + +}
{{dmp?.status | statusToString }} - +