From e509726de7101dbdd5e94f58d7f9fd2dbb0c7d43 Mon Sep 17 00:00:00 2001 From: sggerard Date: Mon, 19 Aug 2024 15:45:53 -0700 Subject: [PATCH 1/3] Add button, env variable --- .../compliance-tab-content.component.html | 13 +++++++++++-- .../compliance-tab-content.component.ts | 8 +++++++- src/assets/styles/components/buttons.scss | 16 +++++++++++++++- src/env.js | 1 + 4 files changed, 34 insertions(+), 4 deletions(-) diff --git a/src/app/projects/project-detail/compliance/compliance-tab-content.component.html b/src/app/projects/project-detail/compliance/compliance-tab-content.component.html index 8bffa23e..af17d5f8 100644 --- a/src/app/projects/project-detail/compliance/compliance-tab-content.component.html +++ b/src/app/projects/project-detail/compliance/compliance-tab-content.component.html @@ -10,12 +10,21 @@
+

Inspections & Orders

+

+ +

+ NRCEDlink +
+ + More records for {{project?.name}} are available on the Natural Resource Compliance and Enforcement Database (NRCED). +

+
-

Inspections & Orders

- +
diff --git a/src/app/projects/project-detail/compliance/compliance-tab-content.component.ts b/src/app/projects/project-detail/compliance/compliance-tab-content.component.ts index e8600719..8c8e931f 100644 --- a/src/app/projects/project-detail/compliance/compliance-tab-content.component.ts +++ b/src/app/projects/project-detail/compliance/compliance-tab-content.component.ts @@ -5,6 +5,7 @@ import { Subscription } from 'rxjs'; import { Project } from 'app/models/project'; import { CollectionsArray } from 'app/models/collection'; import { LoggerService } from 'app/services/logger.service'; +import { ConfigService } from 'app/services/config.service'; @Component({ selector: 'app-compliance-tab-content', @@ -24,7 +25,7 @@ export class ComplianceTabContentComponent implements OnInit, OnDestroy { // private fields private sub: Subscription; - constructor(private route: ActivatedRoute, private logger: LoggerService) { } + constructor(private route: ActivatedRoute, private logger: LoggerService, private configService: ConfigService) { } ngOnInit(): void { this.loading = true; @@ -36,6 +37,7 @@ export class ComplianceTabContentComponent implements OnInit, OnDestroy { } parseData(data: {project: Project}): void { + console.log(data); if (data.project && data.project.collections) { this.project = data.project; this.collections = data.project.collections.compliance; @@ -48,6 +50,10 @@ export class ComplianceTabContentComponent implements OnInit, OnDestroy { } } + openNRCED(){ + window.open(this.configService.config['NRCED_LOCATION']+'/records;project='+encodeURIComponent(this.project.name),'_blank'); + } + ngOnDestroy(): void { if (this.sub) { this.sub.unsubscribe(); diff --git a/src/assets/styles/components/buttons.scss b/src/assets/styles/components/buttons.scss index 7c1b496f..d934ff93 100644 --- a/src/assets/styles/components/buttons.scss +++ b/src/assets/styles/components/buttons.scss @@ -41,6 +41,21 @@ &:disabled { pointer-events: none; } + + &.fixed-r-btn { + padding: 0.25rem 0.5rem; + margin-right: 0.25rem; + + i{ + margin-left: 0.25rem; + } + + div.center{ + display: flex; + justify-content: center; + align-items: center; + } + } } .btn-inverted { @@ -57,7 +72,6 @@ main { } } - // Slide Buttons .slide-r-btn, .slide-l-btn { diff --git a/src/env.js b/src/env.js index 24dfc1e9..61772aa7 100644 --- a/src/env.js +++ b/src/env.js @@ -9,6 +9,7 @@ window.__env.ENVIRONMENT = 'local'; // local | dev | test | prod window.__env.API_LOCATION = 'http://localhost:3000'; + window.__env.NRCED_LOCATION = 'http://localhost:8080'; window.__env.API_PATH = '/api'; window.__env.API_PUBLIC_PATH = '/api/public'; window.__env.GEOCODER_API = 'https://geocoder.api.gov.bc.ca'; From 4523173164431fe3143e810d323d87f6d49efe1d Mon Sep 17 00:00:00 2001 From: sggerard Date: Mon, 19 Aug 2024 16:07:33 -0700 Subject: [PATCH 2/3] fix linting --- .../compliance/compliance-tab-content.component.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/projects/project-detail/compliance/compliance-tab-content.component.ts b/src/app/projects/project-detail/compliance/compliance-tab-content.component.ts index 8c8e931f..137c41c4 100644 --- a/src/app/projects/project-detail/compliance/compliance-tab-content.component.ts +++ b/src/app/projects/project-detail/compliance/compliance-tab-content.component.ts @@ -50,8 +50,8 @@ export class ComplianceTabContentComponent implements OnInit, OnDestroy { } } - openNRCED(){ - window.open(this.configService.config['NRCED_LOCATION']+'/records;project='+encodeURIComponent(this.project.name),'_blank'); + openNRCED() { + window.open(this.configService.config['NRCED_LOCATION'] + '/records;project=' + encodeURIComponent(this.project.name), '_blank'); } ngOnDestroy(): void { From 8578d78cc3aab8308f2aa1c0e29349a99abb45e7 Mon Sep 17 00:00:00 2001 From: sggerard Date: Mon, 19 Aug 2024 16:19:03 -0700 Subject: [PATCH 3/3] fix tests --- .../compliance/compliance-tab-content.component.spec.ts | 8 ++++++-- .../compliance/compliance-tab-content.component.ts | 1 - 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/app/projects/project-detail/compliance/compliance-tab-content.component.spec.ts b/src/app/projects/project-detail/compliance/compliance-tab-content.component.spec.ts index 4c76179c..60e6aaa6 100644 --- a/src/app/projects/project-detail/compliance/compliance-tab-content.component.spec.ts +++ b/src/app/projects/project-detail/compliance/compliance-tab-content.component.spec.ts @@ -7,9 +7,11 @@ import { ProjectTypeFilterPipe } from 'app/pipes/project-type-filter.pipe'; import { Project } from 'app/models/project'; import { CollectionsArray, CollectionsList } from 'app/models/collection'; import { ActivatedRoute } from '@angular/router'; +import { ConfigService } from 'app/services/config.service'; import { ComplianceTabContentComponent } from 'app/projects/project-detail/compliance//compliance-tab-content.component'; import { OrderByPipe } from 'app/pipes/filters/order-by.pipe'; +import { HttpClientModule } from '@angular/common/http'; describe('ComplianceTabContentComponent', () => { let component: ComplianceTabContentComponent; @@ -30,7 +32,8 @@ describe('ComplianceTabContentComponent', () => { }; TestBed.configureTestingModule({ providers: [ - { provide: ActivatedRoute, useValue: ActivatedRouteStub } + { provide: ActivatedRoute, useValue: ActivatedRouteStub }, + ConfigService ], declarations: [ ComplianceTabContentComponent, @@ -41,7 +44,8 @@ describe('ComplianceTabContentComponent', () => { OrderByPipe ], imports: [ - RouterTestingModule + RouterTestingModule, + HttpClientModule ] }) .compileComponents(); diff --git a/src/app/projects/project-detail/compliance/compliance-tab-content.component.ts b/src/app/projects/project-detail/compliance/compliance-tab-content.component.ts index 137c41c4..164ec76b 100644 --- a/src/app/projects/project-detail/compliance/compliance-tab-content.component.ts +++ b/src/app/projects/project-detail/compliance/compliance-tab-content.component.ts @@ -37,7 +37,6 @@ export class ComplianceTabContentComponent implements OnInit, OnDestroy { } parseData(data: {project: Project}): void { - console.log(data); if (data.project && data.project.collections) { this.project = data.project; this.collections = data.project.collections.compliance;