Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add button, env variable for NRCED #400

Merged
merged 3 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,21 @@
<div class="spinner-new rotating"></div>
</div>

<h3>Inspections &amp; Orders</h3>
<p>
<a class="btn hero-btn content-btn-alt fixed-r-btn" (click)="openNRCED()">
<div class="center">
<span>NRCED</span><i class="material-icons">link</i>
</div>
</a>
More records for {{project?.name}} are available on the Natural Resource Compliance and Enforcement Database (NRCED).
</p>

<div *ngIf="collections.length; then table else emptyMessage"></div>

<ng-template #table>
<section class="ce-section">
<h3>Inspections &amp; Orders</h3>


<div class="inspections-list" id="complianceList" role="tablist" aria-multiselectable="false">

<table class="table mb-0">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -30,7 +32,8 @@ describe('ComplianceTabContentComponent', () => {
};
TestBed.configureTestingModule({
providers: [
{ provide: ActivatedRoute, useValue: ActivatedRouteStub }
{ provide: ActivatedRoute, useValue: ActivatedRouteStub },
ConfigService
],
declarations: [
ComplianceTabContentComponent,
Expand All @@ -41,7 +44,8 @@ describe('ComplianceTabContentComponent', () => {
OrderByPipe
],
imports: [
RouterTestingModule
RouterTestingModule,
HttpClientModule
]
})
.compileComponents();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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;
Expand All @@ -48,6 +49,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();
Expand Down
16 changes: 15 additions & 1 deletion src/assets/styles/components/buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -57,7 +72,6 @@ main {
}
}


// Slide Buttons
.slide-r-btn,
.slide-l-btn {
Expand Down
1 change: 1 addition & 0 deletions src/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Loading