diff --git a/src/main/jhipster/src/main/webapp/app/entities/sample/index.ts b/src/main/jhipster/src/main/webapp/app/entities/sample/index.ts index d1db00ce09..45824e0c6c 100644 --- a/src/main/jhipster/src/main/webapp/app/entities/sample/index.ts +++ b/src/main/jhipster/src/main/webapp/app/entities/sample/index.ts @@ -1,9 +1,5 @@ export * from './sample.model'; -export * from './sample-popup.service'; export * from './sample.service'; -export * from './sample-dialog.component'; -export * from './sample-delete-dialog.component'; -export * from './sample-detail.component'; export * from './sample-manager.component'; export * from './sample.component'; export * from './sample.route'; diff --git a/src/main/jhipster/src/main/webapp/app/entities/sample/sample-delete-dialog.component.html b/src/main/jhipster/src/main/webapp/app/entities/sample/sample-delete-dialog.component.html deleted file mode 100644 index f80272b72d..0000000000 --- a/src/main/jhipster/src/main/webapp/app/entities/sample/sample-delete-dialog.component.html +++ /dev/null @@ -1,19 +0,0 @@ -
- - - -
diff --git a/src/main/jhipster/src/main/webapp/app/entities/sample/sample-delete-dialog.component.ts b/src/main/jhipster/src/main/webapp/app/entities/sample/sample-delete-dialog.component.ts deleted file mode 100644 index ba12127c47..0000000000 --- a/src/main/jhipster/src/main/webapp/app/entities/sample/sample-delete-dialog.component.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { Component, OnInit, OnDestroy } from '@angular/core'; -import { ActivatedRoute } from '@angular/router'; - -import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; -import { JhiEventManager } from 'ng-jhipster'; - -import { Sample } from './sample.model'; -import { SamplePopupService } from './sample-popup.service'; -import { SampleService } from './sample.service'; - -@Component({ - selector: 'jhi-sample-delete-dialog', - templateUrl: './sample-delete-dialog.component.html' -}) -export class SampleDeleteDialogComponent { - - sample: Sample; - - constructor( - private sampleService: SampleService, - public activeModal: NgbActiveModal, - private eventManager: JhiEventManager - ) { - } - - clear() { - this.activeModal.dismiss('cancel'); - } - - confirmDelete(id: number) { - this.sampleService.delete(id).subscribe((response) => { - this.eventManager.broadcast({ - name: 'sampleListModification', - content: 'Deleted an sample' - }); - this.activeModal.dismiss(true); - }); - } -} - -@Component({ - selector: 'jhi-sample-delete-popup', - template: '' -}) -export class SampleDeletePopupComponent implements OnInit, OnDestroy { - - routeSub: any; - - constructor( - private route: ActivatedRoute, - private samplePopupService: SamplePopupService - ) {} - - ngOnInit() { - this.routeSub = this.route.params.subscribe((params) => { - this.samplePopupService - .open(SampleDeleteDialogComponent as Component, params['id']); - }); - } - - ngOnDestroy() { - this.routeSub.unsubscribe(); - } -} diff --git a/src/main/jhipster/src/main/webapp/app/entities/sample/sample-detail.component.html b/src/main/jhipster/src/main/webapp/app/entities/sample/sample-detail.component.html deleted file mode 100644 index 0161a85cfa..0000000000 --- a/src/main/jhipster/src/main/webapp/app/entities/sample/sample-detail.component.html +++ /dev/null @@ -1,54 +0,0 @@ - -
-

Sample {{sample.id}}

-
- -
-
Sample Name
-
- {{sample.sampleName}} -
-
Sample Business Key
-
- {{sample.sampleBusinessKey}} -
-
Taken By
-
- {{sample.takenBy}} -
-
Plant Number
-
- {{sample.plantNumber}} -
-
Plant Business Key
-
- {{sample.plantBusinessKey}} -
-
Plate Id
-
- {{sample.plateId}} -
-
Well
-
- {{sample.well}} -
-
Sampling Date
-
- {{sample.samplingDate | date:'medium'}} -
-
- - - - -
diff --git a/src/main/jhipster/src/main/webapp/app/entities/sample/sample-detail.component.ts b/src/main/jhipster/src/main/webapp/app/entities/sample/sample-detail.component.ts deleted file mode 100644 index e71e33eb08..0000000000 --- a/src/main/jhipster/src/main/webapp/app/entities/sample/sample-detail.component.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { Component, OnInit, OnDestroy } from '@angular/core'; -import { ActivatedRoute } from '@angular/router'; -import { HttpResponse } from '@angular/common/http'; -import { Subscription } from 'rxjs/Subscription'; -import { JhiEventManager } from 'ng-jhipster'; - -import { Sample } from './sample.model'; -import { SampleService } from './sample.service'; - -@Component({ - selector: 'jhi-sample-detail', - templateUrl: './sample-detail.component.html' -}) -export class SampleDetailComponent implements OnInit, OnDestroy { - - sample: Sample; - private subscription: Subscription; - private eventSubscriber: Subscription; - - constructor( - private eventManager: JhiEventManager, - private sampleService: SampleService, - private route: ActivatedRoute - ) { - } - - ngOnInit() { - this.subscription = this.route.params.subscribe((params) => { - this.load(params['id']); - }); - this.registerChangeInSamples(); - } - - load(id) { - this.sampleService.find(id) - .subscribe((sampleResponse: HttpResponse) => { - this.sample = sampleResponse.body; - }); - } - previousState() { - window.history.back(); - } - - ngOnDestroy() { - this.subscription.unsubscribe(); - this.eventManager.destroy(this.eventSubscriber); - } - - registerChangeInSamples() { - this.eventSubscriber = this.eventManager.subscribe( - 'sampleListModification', - (response) => this.load(this.sample.id) - ); - } -} diff --git a/src/main/jhipster/src/main/webapp/app/entities/sample/sample-dialog.component.html b/src/main/jhipster/src/main/webapp/app/entities/sample/sample-dialog.component.html deleted file mode 100644 index a04bbfadc1..0000000000 --- a/src/main/jhipster/src/main/webapp/app/entities/sample/sample-dialog.component.html +++ /dev/null @@ -1,73 +0,0 @@ -
- - - - -
diff --git a/src/main/jhipster/src/main/webapp/app/entities/sample/sample-dialog.component.ts b/src/main/jhipster/src/main/webapp/app/entities/sample/sample-dialog.component.ts deleted file mode 100644 index dbdb3f04da..0000000000 --- a/src/main/jhipster/src/main/webapp/app/entities/sample/sample-dialog.component.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { Component, OnInit, OnDestroy } from '@angular/core'; -import { ActivatedRoute } from '@angular/router'; -import { HttpResponse, HttpErrorResponse } from '@angular/common/http'; - -import { Observable } from 'rxjs/Observable'; -import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; -import { JhiEventManager } from 'ng-jhipster'; - -import { Sample } from './sample.model'; -import { SamplePopupService } from './sample-popup.service'; -import { SampleService } from './sample.service'; - -@Component({ - selector: 'jhi-sample-dialog', - templateUrl: './sample-dialog.component.html' -}) -export class SampleDialogComponent implements OnInit { - - sample: Sample; - isSaving: boolean; - - constructor( - public activeModal: NgbActiveModal, - private sampleService: SampleService, - private eventManager: JhiEventManager - ) { - } - - ngOnInit() { - this.isSaving = false; - } - - clear() { - this.activeModal.dismiss('cancel'); - } - - save() { - this.isSaving = true; - if (this.sample.id !== undefined) { - this.subscribeToSaveResponse( - this.sampleService.update(this.sample)); - } else { - this.subscribeToSaveResponse( - this.sampleService.create(this.sample)); - } - } - - private subscribeToSaveResponse(result: Observable>) { - result.subscribe((res: HttpResponse) => - this.onSaveSuccess(res.body), (res: HttpErrorResponse) => this.onSaveError()); - } - - private onSaveSuccess(result: Sample) { - this.eventManager.broadcast({ name: 'sampleListModification', content: 'OK'}); - this.isSaving = false; - this.activeModal.dismiss(result); - } - - private onSaveError() { - this.isSaving = false; - } -} - -@Component({ - selector: 'jhi-sample-popup', - template: '' -}) -export class SamplePopupComponent implements OnInit, OnDestroy { - - routeSub: any; - - constructor( - private route: ActivatedRoute, - private samplePopupService: SamplePopupService - ) {} - - ngOnInit() { - this.routeSub = this.route.params.subscribe((params) => { - if ( params['id'] ) { - this.samplePopupService - .open(SampleDialogComponent as Component, params['id']); - } else { - this.samplePopupService - .open(SampleDialogComponent as Component); - } - }); - } - - ngOnDestroy() { - this.routeSub.unsubscribe(); - } -} diff --git a/src/main/jhipster/src/main/webapp/app/entities/sample/sample-popup.service.ts b/src/main/jhipster/src/main/webapp/app/entities/sample/sample-popup.service.ts deleted file mode 100644 index 8d506a87f3..0000000000 --- a/src/main/jhipster/src/main/webapp/app/entities/sample/sample-popup.service.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { Injectable, Component } from '@angular/core'; -import { Router } from '@angular/router'; -import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; -import { HttpResponse } from '@angular/common/http'; -import { DatePipe } from '@angular/common'; -import { Sample } from './sample.model'; -import { SampleService } from './sample.service'; - -@Injectable() -export class SamplePopupService { - private ngbModalRef: NgbModalRef; - - constructor( - private datePipe: DatePipe, - private modalService: NgbModal, - private router: Router, - private sampleService: SampleService - - ) { - this.ngbModalRef = null; - } - - open(component: Component, id?: number | any): Promise { - return new Promise((resolve, reject) => { - const isOpen = this.ngbModalRef !== null; - if (isOpen) { - resolve(this.ngbModalRef); - } - - if (id) { - this.sampleService.find(id) - .subscribe((sampleResponse: HttpResponse) => { - const sample: Sample = sampleResponse.body; - sample.samplingDate = this.datePipe - .transform(sample.samplingDate, 'yyyy-MM-ddTHH:mm:ss'); - this.ngbModalRef = this.sampleModalRef(component, sample); - resolve(this.ngbModalRef); - }); - } else { - // setTimeout used as a workaround for getting ExpressionChangedAfterItHasBeenCheckedError - setTimeout(() => { - this.ngbModalRef = this.sampleModalRef(component, new Sample()); - resolve(this.ngbModalRef); - }, 0); - } - }); - } - - sampleModalRef(component: Component, sample: Sample): NgbModalRef { - const modalRef = this.modalService.open(component, { size: 'lg', backdrop: 'static'}); - modalRef.componentInstance.sample = sample; - modalRef.result.then((result) => { - this.router.navigate([{ outlets: { popup: null }}], { replaceUrl: true, queryParamsHandling: 'merge' }); - this.ngbModalRef = null; - }, (reason) => { - this.router.navigate([{ outlets: { popup: null }}], { replaceUrl: true, queryParamsHandling: 'merge' }); - this.ngbModalRef = null; - }); - return modalRef; - } -} diff --git a/src/main/jhipster/src/main/webapp/app/entities/sample/sample.module.ts b/src/main/jhipster/src/main/webapp/app/entities/sample/sample.module.ts index 50e26828d6..c0d209359b 100644 --- a/src/main/jhipster/src/main/webapp/app/entities/sample/sample.module.ts +++ b/src/main/jhipster/src/main/webapp/app/entities/sample/sample.module.ts @@ -4,15 +4,8 @@ import { RouterModule } from '@angular/router'; import { BmsjHipsterSharedModule } from '../../shared'; import { SampleService, - SamplePopupService, SampleComponent, - SampleDetailComponent, - SampleDialogComponent, - SamplePopupComponent, - SampleDeletePopupComponent, - SampleDeleteDialogComponent, sampleRoute, - samplePopupRoute, SampleResolvePagingParams, SampleManagerComponent } from './'; @@ -29,7 +22,6 @@ import {SampleContext} from './sample.context'; const ENTITY_STATES = [ ...sampleRoute, - ...samplePopupRoute, ]; @NgModule({ @@ -39,11 +31,6 @@ const ENTITY_STATES = [ ], declarations: [ SampleComponent, - SampleDetailComponent, - SampleDialogComponent, - SampleDeleteDialogComponent, - SamplePopupComponent, - SampleDeletePopupComponent, SampleManagerComponent, SampleSearchListComponent, SampleImportPlateComponent, @@ -52,10 +39,6 @@ const ENTITY_STATES = [ ], entryComponents: [ SampleComponent, - SampleDialogComponent, - SamplePopupComponent, - SampleDeleteDialogComponent, - SampleDeletePopupComponent, SampleManagerComponent, SampleImportPlateComponent, SampleImportPlateMappingComponent, @@ -64,7 +47,6 @@ const ENTITY_STATES = [ providers: [ SampleService, SampleListService, - SamplePopupService, SampleResolvePagingParams, FileDownloadHelper, ModalService, diff --git a/src/main/jhipster/src/main/webapp/app/entities/sample/sample.route.ts b/src/main/jhipster/src/main/webapp/app/entities/sample/sample.route.ts index f2fe99e288..f9a2a65c8e 100644 --- a/src/main/jhipster/src/main/webapp/app/entities/sample/sample.route.ts +++ b/src/main/jhipster/src/main/webapp/app/entities/sample/sample.route.ts @@ -3,9 +3,6 @@ import { Resolve, ActivatedRouteSnapshot, RouterStateSnapshot, Routes } from '@a import { JhiPaginationUtil } from 'ng-jhipster'; import { SampleComponent, SampleManagerComponent } from './'; -import { SampleDetailComponent } from './sample-detail.component'; -import { SamplePopupComponent } from './sample-dialog.component'; -import { SampleDeletePopupComponent } from './sample-delete-dialog.component'; @Injectable() export class SampleResolvePagingParams implements Resolve { @@ -31,7 +28,6 @@ export const sampleRoute: Routes = [ 'pagingParams': SampleResolvePagingParams }, data: { - authorities: ['ROLE_USER'], pageTitle: 'bmsjHipsterApp.sample.home.title' }, }, { @@ -41,19 +37,15 @@ export const sampleRoute: Routes = [ 'pagingParams': SampleResolvePagingParams }, data: { - authorities: ['ROLE_USER'], - pageTitle: 'bmsjHipsterApp.sample.home.title' - } - }, { - path: 'sample/:id', - component: SampleDetailComponent, - data: { - authorities: ['ROLE_USER'], pageTitle: 'bmsjHipsterApp.sample.home.title' } } ]; +// TODO Removing jhipster samplePopup component +// but leaving this as a reminder to try again ng-bootstrap (when animations are available) +// and popup outlet +/* export const samplePopupRoute: Routes = [ { path: 'sample-new', @@ -63,23 +55,6 @@ export const samplePopupRoute: Routes = [ pageTitle: 'bmsjHipsterApp.sample.home.title' }, outlet: 'popup' - }, - { - path: 'sample/:id/edit', - component: SamplePopupComponent, - data: { - authorities: ['ROLE_USER'], - pageTitle: 'bmsjHipsterApp.sample.home.title' - }, - outlet: 'popup' - }, - { - path: 'sample/:id/delete', - component: SampleDeletePopupComponent, - data: { - authorities: ['ROLE_USER'], - pageTitle: 'bmsjHipsterApp.sample.home.title' - }, - outlet: 'popup' } ]; +*/ diff --git a/src/main/jhipster/src/test/javascript/spec/app/entities/sample/sample-delete-dialog.component.spec.ts b/src/main/jhipster/src/test/javascript/spec/app/entities/sample/sample-delete-dialog.component.spec.ts deleted file mode 100644 index 1e01df8a40..0000000000 --- a/src/main/jhipster/src/test/javascript/spec/app/entities/sample/sample-delete-dialog.component.spec.ts +++ /dev/null @@ -1,61 +0,0 @@ -/* tslint:disable max-line-length */ -import { ComponentFixture, TestBed, async, inject, fakeAsync, tick } from '@angular/core/testing'; -import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; -import { Observable } from 'rxjs/Observable'; -import { JhiEventManager } from 'ng-jhipster'; - -import { BmsjHipsterTestModule } from '../../../test.module'; -import { SampleDeleteDialogComponent } from '../../../../../../main/webapp/app/entities/sample/sample-delete-dialog.component'; -import { SampleService } from '../../../../../../main/webapp/app/entities/sample/sample.service'; - -describe('Component Tests', () => { - - describe('Sample Management Delete Component', () => { - let comp: SampleDeleteDialogComponent; - let fixture: ComponentFixture; - let service: SampleService; - let mockEventManager: any; - let mockActiveModal: any; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - imports: [BmsjHipsterTestModule], - declarations: [SampleDeleteDialogComponent], - providers: [ - SampleService - ] - }) - .overrideTemplate(SampleDeleteDialogComponent, '') - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(SampleDeleteDialogComponent); - comp = fixture.componentInstance; - service = fixture.debugElement.injector.get(SampleService); - mockEventManager = fixture.debugElement.injector.get(JhiEventManager); - mockActiveModal = fixture.debugElement.injector.get(NgbActiveModal); - }); - - describe('confirmDelete', () => { - it('Should call delete service on confirmDelete', - inject([], - fakeAsync(() => { - // GIVEN - spyOn(service, 'delete').and.returnValue(Observable.of({})); - - // WHEN - comp.confirmDelete(123); - tick(); - - // THEN - expect(service.delete).toHaveBeenCalledWith(123); - expect(mockActiveModal.dismissSpy).toHaveBeenCalled(); - expect(mockEventManager.broadcastSpy).toHaveBeenCalled(); - }) - ) - ); - }); - }); - -}); diff --git a/src/main/jhipster/src/test/javascript/spec/app/entities/sample/sample-detail.component.spec.ts b/src/main/jhipster/src/test/javascript/spec/app/entities/sample/sample-detail.component.spec.ts deleted file mode 100644 index a0f7287df3..0000000000 --- a/src/main/jhipster/src/test/javascript/spec/app/entities/sample/sample-detail.component.spec.ts +++ /dev/null @@ -1,54 +0,0 @@ -/* tslint:disable max-line-length */ -import { ComponentFixture, TestBed, async } from '@angular/core/testing'; -import { HttpResponse } from '@angular/common/http'; -import { Observable } from 'rxjs/Observable'; - -import { BmsjHipsterTestModule } from '../../../test.module'; -import { SampleDetailComponent } from '../../../../../../main/webapp/app/entities/sample/sample-detail.component'; -import { SampleService } from '../../../../../../main/webapp/app/entities/sample/sample.service'; -import { Sample } from '../../../../../../main/webapp/app/entities/sample/sample.model'; - -describe('Component Tests', () => { - - describe('Sample Management Detail Component', () => { - let comp: SampleDetailComponent; - let fixture: ComponentFixture; - let service: SampleService; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - imports: [BmsjHipsterTestModule], - declarations: [SampleDetailComponent], - providers: [ - SampleService - ] - }) - .overrideTemplate(SampleDetailComponent, '') - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(SampleDetailComponent); - comp = fixture.componentInstance; - service = fixture.debugElement.injector.get(SampleService); - }); - - describe('OnInit', () => { - it('Should call load all on init', () => { - // GIVEN - - spyOn(service, 'find').and.returnValue(Observable.of(new HttpResponse({ - body: new Sample(123) - }))); - - // WHEN - comp.ngOnInit(); - - // THEN - expect(service.find).toHaveBeenCalledWith(123); - expect(comp.sample).toEqual(jasmine.objectContaining({id: 123})); - }); - }); - }); - -}); diff --git a/src/main/jhipster/src/test/javascript/spec/app/entities/sample/sample-dialog.component.spec.ts b/src/main/jhipster/src/test/javascript/spec/app/entities/sample/sample-dialog.component.spec.ts deleted file mode 100644 index f9b55da951..0000000000 --- a/src/main/jhipster/src/test/javascript/spec/app/entities/sample/sample-dialog.component.spec.ts +++ /dev/null @@ -1,85 +0,0 @@ -/* tslint:disable max-line-length */ -import { ComponentFixture, TestBed, async, inject, fakeAsync, tick } from '@angular/core/testing'; -import { HttpResponse } from '@angular/common/http'; -import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; -import { Observable } from 'rxjs/Observable'; -import { JhiEventManager } from 'ng-jhipster'; - -import { BmsjHipsterTestModule } from '../../../test.module'; -import { SampleDialogComponent } from '../../../../../../main/webapp/app/entities/sample/sample-dialog.component'; -import { SampleService } from '../../../../../../main/webapp/app/entities/sample/sample.service'; -import { Sample } from '../../../../../../main/webapp/app/entities/sample/sample.model'; - -describe('Component Tests', () => { - - describe('Sample Management Dialog Component', () => { - let comp: SampleDialogComponent; - let fixture: ComponentFixture; - let service: SampleService; - let mockEventManager: any; - let mockActiveModal: any; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - imports: [BmsjHipsterTestModule], - declarations: [SampleDialogComponent], - providers: [ - SampleService - ] - }) - .overrideTemplate(SampleDialogComponent, '') - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(SampleDialogComponent); - comp = fixture.componentInstance; - service = fixture.debugElement.injector.get(SampleService); - mockEventManager = fixture.debugElement.injector.get(JhiEventManager); - mockActiveModal = fixture.debugElement.injector.get(NgbActiveModal); - }); - - describe('save', () => { - it('Should call update service on save for existing entity', - inject([], - fakeAsync(() => { - // GIVEN - const entity = new Sample(123); - spyOn(service, 'update').and.returnValue(Observable.of(new HttpResponse({body: entity}))); - comp.sample = entity; - // WHEN - comp.save(); - tick(); // simulate async - - // THEN - expect(service.update).toHaveBeenCalledWith(entity); - expect(comp.isSaving).toEqual(false); - expect(mockEventManager.broadcastSpy).toHaveBeenCalledWith({ name: 'sampleListModification', content: 'OK'}); - expect(mockActiveModal.dismissSpy).toHaveBeenCalled(); - }) - ) - ); - - it('Should call create service on save for new entity', - inject([], - fakeAsync(() => { - // GIVEN - const entity = new Sample(); - spyOn(service, 'create').and.returnValue(Observable.of(new HttpResponse({body: entity}))); - comp.sample = entity; - // WHEN - comp.save(); - tick(); // simulate async - - // THEN - expect(service.create).toHaveBeenCalledWith(entity); - expect(comp.isSaving).toEqual(false); - expect(mockEventManager.broadcastSpy).toHaveBeenCalledWith({ name: 'sampleListModification', content: 'OK'}); - expect(mockActiveModal.dismissSpy).toHaveBeenCalled(); - }) - ) - ); - }); - }); - -});