-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NRPT-619: implement admin component for LNG map updates (#797)
* NRPT-619: implement admin component for LNG map info * fix cancel loading old values and alert return * fix unit test and cleanup code * allow empty segement description updates, remove unused code
- Loading branch information
Showing
14 changed files
with
487 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
angular/projects/admin-nrpti/src/app/communications/lng-map-info/lng-map-info-resolver.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { Resolve } from '@angular/router'; | ||
import { Observable } from 'rxjs/Observable'; | ||
import { FactoryService } from '../../services/factory.service'; | ||
|
||
@Injectable() | ||
export class LngMapInfoResolver implements Resolve<Observable<object>> { | ||
constructor(private factoryService: FactoryService) {} | ||
|
||
resolve(): Observable<object> { | ||
return this.factoryService.getRecords( | ||
'', | ||
['MapLayerInfo'], | ||
[], | ||
1, | ||
10, | ||
'-dateAdded', | ||
{}, | ||
false, | ||
{}, | ||
[], | ||
{} | ||
); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
angular/projects/admin-nrpti/src/app/communications/lng-map-info/lng-map-info.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
|
||
<form [formGroup]="mapForm" novalidate> | ||
<div class="flex-container"> | ||
<div class="label-pair"> | ||
<label for="sectionNumber">Section Number</label> | ||
<select name="sectionNumber" id="sectionNumber" formControlName="sectionNumber" class="form-control" (change)="onSelectSegment($event)"> | ||
<option *ngFor="let section of sections" [ngValue]="section"> | ||
{{ section }} | ||
</option> | ||
</select> | ||
</div> | ||
</div> | ||
<div class="flex-container"> | ||
<div class="label-pair"> | ||
<label for="location">Location</label> | ||
<input name="location" id="location" type="text" formControlName="location" class="form-control" /> | ||
</div> | ||
<div class="label-pair"> | ||
<label for="length">Length</label> | ||
<input name="length" id="length" type="text" formControlName="length" class="form-control" /> | ||
</div> | ||
</div> | ||
<div class="flex-container"> | ||
<div class="label-pair lrg"> | ||
<label for="description">Recent Updates</label> | ||
<editor | ||
[init]="tinyMceSettings" | ||
name="recentUpdates" | ||
id="recentUpdates" | ||
formControlName="recentUpdates" | ||
></editor> | ||
</div> | ||
</div> | ||
</form> | ||
|
||
<div class="d-flex justify-content-end mb-1"> | ||
<button class="btn btn-primary mr-1" (click)="cancel()" title="Cancel Popup"> | ||
Cancel Map Updates | ||
</button> | ||
<button class="btn btn-primary" type="submit" (click)="submit()" title="Save Popup"> | ||
Save/Publish Map Updates | ||
</button> | ||
</div> |
2 changes: 2 additions & 0 deletions
2
angular/projects/admin-nrpti/src/app/communications/lng-map-info/lng-map-info.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
@import "assets/styles/base/base.scss"; | ||
@import "assets/styles/components/add-edit.scss"; |
59 changes: 59 additions & 0 deletions
59
...r/projects/admin-nrpti/src/app/communications/lng-map-info/lng-map-info.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { LoadingScreenService } from 'nrpti-angular-components'; | ||
import { EditorModule } from '@tinymce/tinymce-angular'; | ||
import { FactoryService } from './../../../../../public-nrpti/src/app/services/factory.service'; | ||
import { FormsModule, ReactiveFormsModule } from '@angular/forms'; | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { KeycloakService } from '../../services/keycloak.service'; | ||
|
||
import { LngMapInfoComponent } from './lng-map-info.component'; | ||
import { ActivatedRoute } from '@angular/router'; | ||
import { ActivatedRouteStub } from '../../../../../common/src/app/spec/spec-utils'; | ||
|
||
describe('LngMapInfoComponent', () => { | ||
let component: LngMapInfoComponent; | ||
let fixture: ComponentFixture<LngMapInfoComponent>; | ||
|
||
const mockActivatedRoute = new ActivatedRouteStub(); | ||
const mockFactoryService = jasmine.createSpyObj('FactoryService', [ | ||
'updateMapLayerInfo', | ||
'userInRole', | ||
'userInLngRole' | ||
]); | ||
mockFactoryService.userInLngRole.and.returnValue(true); | ||
|
||
const mockKeycloakService = jasmine.createSpyObj('KeycloackService', ['isMenuEnabled', 'getToken']); | ||
const mockLoadingScreenService = { | ||
isLoading: false, | ||
setLoadingState: () => { | ||
return false; | ||
} | ||
}; | ||
|
||
beforeEach((() => { | ||
TestBed.configureTestingModule({ | ||
imports: [ | ||
FormsModule, | ||
ReactiveFormsModule, | ||
EditorModule | ||
], | ||
declarations: [ LngMapInfoComponent ], | ||
providers: [ | ||
{ provide: ActivatedRoute, useValue: mockActivatedRoute}, | ||
{ provide: KeycloakService, useValue: mockKeycloakService}, | ||
{ provide: FactoryService, useValue: mockFactoryService }, | ||
{ provide: LoadingScreenService, useValue: mockLoadingScreenService } | ||
] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(LngMapInfoComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
Oops, something went wrong.