+
Edit
diff --git a/client/wfprev-war/src/main/angular/src/app/components/list-panel/projects-list/projects-list.component.spec.ts b/client/wfprev-war/src/main/angular/src/app/components/list-panel/projects-list/projects-list.component.spec.ts
index 1717e40dc..5beb8ecbb 100644
--- a/client/wfprev-war/src/main/angular/src/app/components/list-panel/projects-list/projects-list.component.spec.ts
+++ b/client/wfprev-war/src/main/angular/src/app/components/list-panel/projects-list/projects-list.component.spec.ts
@@ -5,6 +5,8 @@ import { DebugElement } from '@angular/core';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { MatExpansionModule } from '@angular/material/expansion';
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
+import { ActivatedRoute, Router } from '@angular/router';
+import { ResourcesRoutes } from 'src/app/utils';
describe('ProjectsListComponent', () => {
let component: ProjectsListComponent;
@@ -14,6 +16,9 @@ describe('ProjectsListComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [ProjectsListComponent, BrowserAnimationsModule, MatExpansionModule, MatSlideToggleModule], // Using standalone component
+ providers: [
+ { provide: ActivatedRoute, useValue: ActivatedRoute }, // Provide mock for ActivatedRoute
+ ],
}).compileComponents();
fixture = TestBed.createComponent(ProjectsListComponent);
@@ -167,4 +172,25 @@ describe('ProjectsListComponent', () => {
expect(sortOptions[1].nativeElement.textContent).toContain('Name (A-Z)');
expect(sortOptions[2].nativeElement.textContent).toContain('Name (Z-A)');
});
+ it('should navigate to the edit project route with the correct query parameters and stop event propagation', () => {
+ // Arrange
+ const mockRouter = TestBed.inject(Router);
+ spyOn(mockRouter, 'navigate'); // Spy on the navigate method
+ const mockEvent = jasmine.createSpyObj('Event', ['stopPropagation']); // Mock event with stopPropagation method
+
+ const project = {
+ projectNumber: 12345,
+ projectName: 'Sample Project'
+ };
+
+ // Act
+ component.editProject(project, mockEvent);
+
+ // Assert
+ expect(mockRouter.navigate).toHaveBeenCalledWith([ResourcesRoutes.EDIT_PROJECT], {
+ queryParams: { projectNumber: project.projectNumber, name: project.projectName }
+ });
+ expect(mockEvent.stopPropagation).toHaveBeenCalled();
+ });
+
});
diff --git a/client/wfprev-war/src/main/angular/src/app/components/list-panel/projects-list/projects-list.component.ts b/client/wfprev-war/src/main/angular/src/app/components/list-panel/projects-list/projects-list.component.ts
index 8aadc379a..7bd777a49 100644
--- a/client/wfprev-war/src/main/angular/src/app/components/list-panel/projects-list/projects-list.component.ts
+++ b/client/wfprev-war/src/main/angular/src/app/components/list-panel/projects-list/projects-list.component.ts
@@ -2,6 +2,8 @@ import { CommonModule } from '@angular/common';
import { Component } from '@angular/core';
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
import { MatExpansionModule } from '@angular/material/expansion';
+import { ActivatedRoute, Router } from '@angular/router';
+import { ResourcesRoutes } from 'src/app/utils';
@Component({
selector: 'app-projects-list',
@@ -11,6 +13,12 @@ import { MatExpansionModule } from '@angular/material/expansion';
styleUrls: ['./projects-list.component.scss'], // Corrected to 'styleUrls'
})
export class ProjectsListComponent {
+
+ constructor(
+ private router: Router,
+ ) {
+ }
+
sortOptions = [
{ label: 'Name (A-Z)', value: 'ascending' },
{ label: 'Name (Z-A)', value: 'descending' },
@@ -115,7 +123,7 @@ export class ProjectsListComponent {
},
];
- fiscalYearActivityTypes = ['Clearning','Burning','Pruning']
+ fiscalYearActivityTypes = ['Clearing','Burning','Pruning']
onSortChange(event:any): void {
@@ -127,5 +135,12 @@ export class ProjectsListComponent {
this.syncWithMap = event.checked;
console.log('Sync with map:', this.syncWithMap ? 'On' : 'Off');
}
+
+ editProject(project: any, event:Event) {
+ event.stopPropagation();
+ this.router.navigate([ResourcesRoutes.EDIT_PROJECT], {
+ queryParams: { projectNumber: project.projectNumber, name: project.projectName}
+ });
+ }
}
diff --git a/client/wfprev-war/src/main/angular/src/app/components/map/map.component.spec.ts b/client/wfprev-war/src/main/angular/src/app/components/map/map.component.spec.ts
index 48377d6ea..b8cdc28b7 100644
--- a/client/wfprev-war/src/main/angular/src/app/components/map/map.component.spec.ts
+++ b/client/wfprev-war/src/main/angular/src/app/components/map/map.component.spec.ts
@@ -3,12 +3,20 @@ import { MapComponent } from './map.component';
import { By } from '@angular/platform-browser';
import * as L from 'leaflet';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
+import { of } from 'rxjs';
+import { ActivatedRoute } from '@angular/router';
describe('MapComponent', () => {
let component: MapComponent;
let fixture: ComponentFixture
;
let mapMock: Partial;
+ const mockActivatedRoute = {
+ queryParamMap: of({
+ get: (key: string) => null, // Mock behavior for query parameters
+ }),
+ };
+
beforeEach(async () => {
mapMock = {
fitBounds: jasmine.createSpy('fitBounds'),
@@ -19,7 +27,8 @@ describe('MapComponent', () => {
spyOn(L, 'map').and.returnValue(mapMock as L.Map);
await TestBed.configureTestingModule({
- imports: [MapComponent, BrowserAnimationsModule]
+ imports: [MapComponent, BrowserAnimationsModule],
+ providers: [{ provide: ActivatedRoute, useValue: mockActivatedRoute }]
}).compileComponents();
fixture = TestBed.createComponent(MapComponent);
diff --git a/client/wfprev-war/src/main/angular/src/app/components/resizable-panel/resizable-panel.component.spec.ts b/client/wfprev-war/src/main/angular/src/app/components/resizable-panel/resizable-panel.component.spec.ts
index 44aebb789..89dcd77f0 100644
--- a/client/wfprev-war/src/main/angular/src/app/components/resizable-panel/resizable-panel.component.spec.ts
+++ b/client/wfprev-war/src/main/angular/src/app/components/resizable-panel/resizable-panel.component.spec.ts
@@ -1,6 +1,8 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ResizablePanelComponent } from './resizable-panel.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
+import { ActivatedRoute } from '@angular/router';
+import { of } from 'rxjs';
describe('ResizablePanelComponent', () => {
let component: ResizablePanelComponent;
@@ -9,6 +11,14 @@ describe('ResizablePanelComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [ResizablePanelComponent, BrowserAnimationsModule], // Standalone component
+ providers: [
+ {
+ provide: ActivatedRoute,
+ useValue: {
+ queryParamMap: of({ get: () => null }), // Mock ActivatedRoute
+ },
+ },
+ ],
}).compileComponents();
fixture = TestBed.createComponent(ResizablePanelComponent);
diff --git a/client/wfprev-war/src/main/angular/src/app/components/shared-layout/app-header/app-header.component.spec.ts b/client/wfprev-war/src/main/angular/src/app/components/shared-layout/app-header/app-header.component.spec.ts
index 4399be3f8..eddc5c4ba 100644
--- a/client/wfprev-war/src/main/angular/src/app/components/shared-layout/app-header/app-header.component.spec.ts
+++ b/client/wfprev-war/src/main/angular/src/app/components/shared-layout/app-header/app-header.component.spec.ts
@@ -58,7 +58,7 @@ describe('AppHeaderComponent', () => {
spyOn(window, 'open');
component.onSupportLinkClick();
expect(window.open).toHaveBeenCalledWith(
- 'https://intranet.gov.bc.ca/bcws/provincial-programs/strategic-initiatives-and-innovation/wildfire-one/wildfire-one-training',
+ 'https://intranet.gov.bc.ca/bcws/corporate-governance/strategic-initiatives-and-innovation/wildfire-one/wildfire-one-training',
'_blank',
'noopener'
);
diff --git a/client/wfprev-war/src/main/angular/src/app/components/shared-layout/app-header/app-header.component.ts b/client/wfprev-war/src/main/angular/src/app/components/shared-layout/app-header/app-header.component.ts
index 5abeded6d..992db0991 100644
--- a/client/wfprev-war/src/main/angular/src/app/components/shared-layout/app-header/app-header.component.ts
+++ b/client/wfprev-war/src/main/angular/src/app/components/shared-layout/app-header/app-header.component.ts
@@ -41,7 +41,7 @@ export class AppHeaderComponent {
onSupportLinkClick() {
//navigate to a support link page, upon decide which url would that be.
- const url = 'https://intranet.gov.bc.ca/bcws/provincial-programs/strategic-initiatives-and-innovation/wildfire-one/wildfire-one-training'
+ const url = 'https://intranet.gov.bc.ca/bcws/corporate-governance/strategic-initiatives-and-innovation/wildfire-one/wildfire-one-training'
window.open(url, '_blank', 'noopener');
}
}
diff --git a/client/wfprev-war/src/main/angular/src/app/utils/index.ts b/client/wfprev-war/src/main/angular/src/app/utils/index.ts
index d3cbad714..cf16a93ee 100644
--- a/client/wfprev-war/src/main/angular/src/app/utils/index.ts
+++ b/client/wfprev-war/src/main/angular/src/app/utils/index.ts
@@ -7,7 +7,8 @@ export enum ResourcesRoutes {
LANDING = '',
MAP = 'map',
LIST = 'list',
- ERROR_PAGE = 'error-page'
+ ERROR_PAGE = 'error-page',
+ EDIT_PROJECT = 'edit-project'
}
export function appInitializerFactory(injector: Injector) {
diff --git a/client/wfprev-war/src/main/angular/src/styles.scss b/client/wfprev-war/src/main/angular/src/styles.scss
index f992e2a7e..dcd184434 100644
--- a/client/wfprev-war/src/main/angular/src/styles.scss
+++ b/client/wfprev-war/src/main/angular/src/styles.scss
@@ -46,14 +46,25 @@ body {
width: fit-content;
text-align: center;
.mat-mdc-simple-snack-bar {
- font-family: var(--wf-font-family-main);
+ font-family: var(--wf-font-family-main) !important;
font-size: 13px;
}
.mat-button-wrapper {
color: white;
}
- }
+ .mat-mdc-snack-bar-action {
+ color: white !important;
+ border: 1px solid white;
+ border-radius: 5px;
+ }
+}
+
+html, body{
+ font-family: var(--wf-font-family-main);
+ height: 100%;
+ overflow: hidden; /* Prevent scrolling if not needed */
+}
.snackbar-error {
background-color: #FF0000;
color: var(--colour-white);
diff --git a/client/wfprev-war/src/styles.scss b/client/wfprev-war/src/styles.scss
deleted file mode 100644
index 90d4ee007..000000000
--- a/client/wfprev-war/src/styles.scss
+++ /dev/null
@@ -1 +0,0 @@
-/* You can add global styles to this file, and also import other style files */