diff --git a/cluster-role-trust-policy.json b/cluster-role-trust-policy.json new file mode 100644 index 0000000..85cfb59 --- /dev/null +++ b/cluster-role-trust-policy.json @@ -0,0 +1,12 @@ +{ + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Principal": { + "Service": "eks.amazonaws.com" + }, + "Action": "sts:AssumeRole" + } + ] +} diff --git a/eks-br2s-front-end-service.yaml b/eks-br2s-front-end-service.yaml new file mode 100644 index 0000000..8899eef --- /dev/null +++ b/eks-br2s-front-end-service.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + name: eks-br2s-linux-service + namespace: eks-br2s-app + labels: + app: eks-br2s-linux-app +spec: + selector: + app: eks-br2s-linux-app + ports: + - protocol: TCP + port: 80 + targetPort: 80 diff --git a/eks-br2s-load-balancer.yaml b/eks-br2s-load-balancer.yaml new file mode 100644 index 0000000..b4b08cb --- /dev/null +++ b/eks-br2s-load-balancer.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Service +metadata: + name: br2s-poc-loadbalancer + namespace: eks-br2s-app +spec: + type: LoadBalancer + selector: + app: eks-br2s-linux-app + ports: + - protocol: TCP + port: 80 + targetPort: 80 diff --git a/eks-deployment.yaml b/eks-deployment.yaml new file mode 100644 index 0000000..f4b8fb5 --- /dev/null +++ b/eks-deployment.yaml @@ -0,0 +1,36 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: eks-br2s-linux-deployment + namespace: eks-br2s-app + labels: + app: eks-br2s-linux-app +spec: + replicas: 3 + selector: + matchLabels: + app: eks-br2s-linux-app + template: + metadata: + labels: + app: eks-br2s-linux-app + spec: + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: kubernetes.io/arch + operator: In + values: + - amd64 + - arm64 + containers: + - name: br2s-front-end + image: 834628752744.dkr.ecr.ap-southeast-1.amazonaws.com/acra/br2s-front-end:latest + ports: + - name: http + containerPort: 80 + imagePullPolicy: Always + nodeSelector: + kubernetes.io/os: linux diff --git a/nginx.conf b/nginx.conf index db19e4d..0a26742 100644 --- a/nginx.conf +++ b/nginx.conf @@ -2,6 +2,7 @@ events{} http { include /etc/nginx/mime.types; + server { listen 80; # listen 443; @@ -12,6 +13,27 @@ http { server_name localhost; root /usr/share/nginx/html; index index.html; + + location /api/registration-name-check/ { + proxy_pass http://eks-br2s-registration-name-check-service/; + } + + location /api/registration-name-register/ { + proxy_pass http://eks-br2s-registration-name-register-service/; + } + + location /api/registration-payment/ { + proxy_pass http://eks-br2s-registration-payment-service/; + } + + location /api/compliance-data-aggregation/ { + proxy_pass http://eks-br2s-compliance-data-aggregation-service/; + } + + location /api/compliance-panel/ { + proxy_pass http://eks-br2s-compliance-panel-service/; + } + location / { try_files $uri $uri/ /index.html; } diff --git a/node-role-trust-policy.json b/node-role-trust-policy.json new file mode 100644 index 0000000..87c7d7c --- /dev/null +++ b/node-role-trust-policy.json @@ -0,0 +1,12 @@ +{ + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Principal": { + "Service": "ec2.amazonaws.com" + }, + "Action": "sts:AssumeRole" + } + ] +} diff --git a/package.json b/package.json index f0e9515..17a558c 100644 --- a/package.json +++ b/package.json @@ -8,15 +8,17 @@ "watch": "ng build --watch --configuration development", "test": "ng test", - "docker-build": "docker build -t b2rs-front-end-image .", - "docker-tag": "docker tag b2rs-front-end-image:latest 834628752744.dkr.ecr.ap-southeast-1.amazonaws.com/b2rs-front-end-image:latest", - "docker-push": "docker push 834628752744.dkr.ecr.ap-southeast-1.amazonaws.com/b2rs-front-end-image:latest", + "docker-build": "docker build -t acra/br2s-front-end .", + "docker-tag": "docker tag acra/br2s-front-end:latest 834628752744.dkr.ecr.ap-southeast-1.amazonaws.com/acra/br2s-front-end:latest", + "docker-login": "aws ecr get-login-password | docker login --username AWS --password-stdin 834628752744.dkr.ecr.ap-southeast-1.amazonaws.com", + "docker-push": "docker push 834628752744.dkr.ecr.ap-southeast-1.amazonaws.com/acra/br2s-front-end:latest", - "docker-create": "docker run --name b2rs-app-container -d -p 80:80 b2rs-front-end-image", - "docker-destroy": "docker container rm b2rs-app-container", + "docker-create": "docker run --name br2s-app-container -d -p 80:80 acra/br2s-front-end", + "docker-destroy": "docker container rm br2s-app-container", + "docker-purge": "docker image rm acra/br2s-front-end", - "docker-start": "docker start b2rs-app-container", - "docker-stop": "docker stop b2rs-app-container" + "docker-start": "docker start br2s-app-container", + "docker-stop": "docker stop br2s-app-container" }, "private": true, "dependencies": { diff --git a/src/app/pages/investigate-business-entities-and-individuals/assign-panel/assign-panel.component.html b/src/app/pages/investigate-business-entities-and-individuals/assign-panel/assign-panel.component.html index cf67907..8695bff 100644 --- a/src/app/pages/investigate-business-entities-and-individuals/assign-panel/assign-panel.component.html +++ b/src/app/pages/investigate-business-entities-and-individuals/assign-panel/assign-panel.component.html @@ -1,2 +1,2 @@ - + diff --git a/src/app/pages/investigate-business-entities-and-individuals/assign-panel/assign-panel.component.ts b/src/app/pages/investigate-business-entities-and-individuals/assign-panel/assign-panel.component.ts index 35fd46a..66188aa 100644 --- a/src/app/pages/investigate-business-entities-and-individuals/assign-panel/assign-panel.component.ts +++ b/src/app/pages/investigate-business-entities-and-individuals/assign-panel/assign-panel.component.ts @@ -1,4 +1,6 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, EventEmitter, Output, OnInit } from '@angular/core'; +import { InvestigateBuinessEntityAndIndividualService } from 'src/app/services/investigate-buiness-entity-and-individual.service'; +import { SelectableEntity } from 'src/app/widgets/select-entities/select-entities.component'; @Component({ selector: 'app-assign-panel', @@ -6,10 +8,26 @@ import { Component, OnInit } from '@angular/core'; styleUrls: ['./assign-panel.component.scss'] }) export class AssignPanelComponent implements OnInit { + panelCandidates: Array = []; - constructor() { } + @Output() onSelectedCandidatesUpdate: EventEmitter> = new EventEmitter(); - ngOnInit(): void { - } + constructor(investigateBuinessEntityAndIndividualService: InvestigateBuinessEntityAndIndividualService) { + investigateBuinessEntityAndIndividualService.getPanelCandidates().then(panelCandidates => this.panelCandidates = panelCandidates); + } + + ngOnInit(): void { + } + + toggleSelectedCandidate(candidate: SelectableEntity) { + const selectedCandidate = this.panelCandidates.find(panelCandidate => candidate.id === panelCandidate.id); + + if (selectedCandidate) { + selectedCandidate.isSelected = candidate.isSelected; + } + + const selectedIds = this.panelCandidates.filter(candidate => candidate.isSelected).map(candidate => String(candidate.id)); + this.onSelectedCandidatesUpdate.emit(selectedIds); + } } diff --git a/src/app/pages/investigate-business-entities-and-individuals/investigate-business-entities-and-individuals.component.html b/src/app/pages/investigate-business-entities-and-individuals/investigate-business-entities-and-individuals.component.html index da2cc5c..14ce612 100644 --- a/src/app/pages/investigate-business-entities-and-individuals/investigate-business-entities-and-individuals.component.html +++ b/src/app/pages/investigate-business-entities-and-individuals/investigate-business-entities-and-individuals.component.html @@ -33,6 +33,7 @@ = []; + selectedCandidateIds: Array = []; loginRole: Role; @@ -24,7 +26,7 @@ export class InvestigateBusinessEntitiesAndIndividualsComponent implements OnIni executingRole: Role; - constructor() { + constructor(private investigationServie: InvestigateBuinessEntityAndIndividualService) { const panelRemarks = localStorage.getItem('panelRemarks'); if (panelRemarks) { @@ -96,7 +98,11 @@ export class InvestigateBusinessEntitiesAndIndividualsComponent implements OnIni localStorage.setItem('panelRemarks', remarks); } - proceed() { + handleSelectedCandidates(selectedCandidateIds: Array) { + this.selectedCandidateIds = selectedCandidateIds; + } + + async proceed() { this.stateHistory.push(this.state); switch (this.state) { @@ -114,6 +120,7 @@ export class InvestigateBusinessEntitiesAndIndividualsComponent implements OnIni this.executingRole = 'Hod'; break; case 'ASSIGN COMMITTEE': + await this.investigationServie.selectPanelMembers(this.selectedCandidateIds); this.state = 'REVIEW NON COMPLIANCE'; this.executingRole = 'Investigator'; break; diff --git a/src/app/pages/investigate-business-entities-and-individuals/view-case-details/view-case-details.component.ts b/src/app/pages/investigate-business-entities-and-individuals/view-case-details/view-case-details.component.ts index 8943530..f2fd658 100644 --- a/src/app/pages/investigate-business-entities-and-individuals/view-case-details/view-case-details.component.ts +++ b/src/app/pages/investigate-business-entities-and-individuals/view-case-details/view-case-details.component.ts @@ -1,4 +1,5 @@ import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; +import { InvestigateBuinessEntityAndIndividualService } from 'src/app/services/investigate-buiness-entity-and-individual.service'; import { KeyValue } from 'src/app/widgets/key-value-holder/key-value-holder.component'; @Component({ @@ -40,7 +41,7 @@ export class ViewCaseDetailsComponent implements OnInit { ] ] - constructor() { } + constructor(private investigationServie: InvestigateBuinessEntityAndIndividualService) { } toggleHasData(toggle: boolean) { this.hasEnoughData = toggle; @@ -48,6 +49,13 @@ export class ViewCaseDetailsComponent implements OnInit { } ngOnInit(): void { + this.investigationServie.getCaseDetails().then(caseDetails => { + this.companyDetails = caseDetails; + }); + + this.investigationServie.getBoardDetails().then(boardDetails => { + this.boardDirectorData = boardDetails; + }) } } diff --git a/src/app/services/investigate-buiness-entity-and-individual.service.spec.ts b/src/app/services/investigate-buiness-entity-and-individual.service.spec.ts new file mode 100644 index 0000000..27fb1f3 --- /dev/null +++ b/src/app/services/investigate-buiness-entity-and-individual.service.spec.ts @@ -0,0 +1,16 @@ +import { TestBed } from '@angular/core/testing'; + +import { InvestigateBuinessEntityAndIndividualService } from './investigate-buiness-entity-and-individual.service'; + +describe('InvestigateBuinessEntityAndIndividualService', () => { + let service: InvestigateBuinessEntityAndIndividualService; + + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(InvestigateBuinessEntityAndIndividualService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/src/app/services/investigate-buiness-entity-and-individual.service.ts b/src/app/services/investigate-buiness-entity-and-individual.service.ts new file mode 100644 index 0000000..e44b842 --- /dev/null +++ b/src/app/services/investigate-buiness-entity-and-individual.service.ts @@ -0,0 +1,67 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { KeyValue } from '../widgets/key-value-holder/key-value-holder.component'; +import { HARDCODED_USERS, SelectableEntity } from '../widgets/select-entities/select-entities.component'; + +export interface StatusResponse { + status: string; +} + +@Injectable({ + providedIn: 'root' +}) +export class InvestigateBuinessEntityAndIndividualService { + + constructor(private http: HttpClient) { + + } + + getCaseDetails() { + + return this.http.get>('/api/compliance-data-aggregation/case-details/').toPromise(); + + return new Promise>((resolve, reject) => resolve([{ + key: 'Business Name', + value: 'Entity Corp.', + }, { + key: 'Company ID', + value: 'ARN2021110294038', + }, { + key: 'Source of complaint', + value: 'Automatic', + }, { + key: 'Reason for complaint', + value: 'Unusual financial activity', + }])); + } + + getBoardDetails() { + return this.http.get>>('/api/compliance-data-aggregation/board-details/').toPromise(); + + return new Promise>>((resolve, reject) => resolve([ + [ + 'Rose E. Arthur', + 'July 26, 2010', + ], [ + 'David A. Bryant', + 'July 26, 2008', + ] + ])); + } + + getPanelCandidates() { + return this.http.get>('/api/compliance-panel/get-panel-candidates/').toPromise(); + + return new Promise>((resolve, reject) => resolve(HARDCODED_USERS)); + } + + selectPanelMembers(selectedPanelMembers: Array) { + const selectPanelRequestBody = { + names: selectedPanelMembers, + } + + return this.http.post('/api/compliance-panel/select-panel/', selectPanelRequestBody).toPromise(); + + return new Promise((resolve, reject) => resolve({status: 'success'})); + } +} diff --git a/src/app/services/register-business-name.service.ts b/src/app/services/register-business-name.service.ts index 084f7b3..929c36f 100644 --- a/src/app/services/register-business-name.service.ts +++ b/src/app/services/register-business-name.service.ts @@ -1,7 +1,5 @@ import { Injectable } from '@angular/core'; -import { HttpClient, HttpHeaders } from '@angular/common/http'; -import { Observable, throwError } from 'rxjs'; -import { catchError, retry } from 'rxjs/operators'; +import { HttpClient } from '@angular/common/http'; import { AcknowledgementRow, ReceiptRow } from '../pages/register-business/register-business.component'; export interface NameCheckRequest { @@ -38,9 +36,9 @@ export class RegisterBusinessNameService { name, }; - return new Promise((resolve, reject) => resolve({status: 'success'})); + return this.http.post('/api/registration-name-check/name-check', nameCheckRequest).toPromise(); - return this.http.post('http://localhost:10000/name-check/', nameCheckRequest).toPromise(); + return new Promise((resolve, reject) => resolve({status: 'success'})); } registerName( @@ -58,20 +56,21 @@ export class RegisterBusinessNameService { dropSuffix, }; - return new Promise((resolve, reject) => resolve({status: 'success'})); + return this.http.post('/api/registration-name-register/name-register', nameRegisterRequest).toPromise(); - return this.http.post('http://localhost:8080/name-register/', nameRegisterRequest).toPromise(); + return new Promise((resolve, reject) => resolve({status: 'success'})); } getAcknowledgement() { + return this.http.get>('/api/registration-payment/acknowledgement/').toPromise(); + return new Promise>((resolve, reject) => resolve([])); - return this.http.get>('http://localhost:8080/acknowledgement/').toPromise(); } getReceipt() { + return this.http.get>('/api/registration-payment/receipt/').toPromise(); + return new Promise>((resolve, reject) => resolve([])); - - return this.http.get>('http://localhost:8080/receipt/').toPromise(); } } diff --git a/src/app/widgets/select-entities/select-entities.component.ts b/src/app/widgets/select-entities/select-entities.component.ts index 950d505..47c6fdd 100644 --- a/src/app/widgets/select-entities/select-entities.component.ts +++ b/src/app/widgets/select-entities/select-entities.component.ts @@ -1,4 +1,4 @@ -import { Component, Input, OnInit } from '@angular/core'; +import { Component, Input, OnChanges, OnInit, Output, EventEmitter, SimpleChanges } from '@angular/core'; export interface SelectableEntity { id: string|number; @@ -8,56 +8,56 @@ export interface SelectableEntity { isSelected: boolean, }; -const HARDCODED_USERS: Array = [{ +export const HARDCODED_USERS: Array = [{ id: 0, name: "Alfred E. Kaplan", avatar: '../../assets/avatars/1.jpg', subTitle: 'Analyst', isSelected: false }, { - id: 0, + id: 1, name: "Ernest L. Hall", avatar: '../../assets/avatars/2.jpg', subTitle: 'Investigator', isSelected: false }, { - id: 0, + id: 2, name: "Leslie L. Barber", avatar: '../../assets/avatars/3.jpg', subTitle: 'Analyst', isSelected: false }, { - id: 0, + id: 3, name: "Todd K. Carrico", avatar: '../../assets/avatars/4.jpg', subTitle: 'Analyst', isSelected: false }, { - id: 0, + id: 4, name: "Louise K. Parker", avatar: '../../assets/avatars/5.jpg', subTitle: 'Investigator', isSelected: false }, { - id: 0, + id: 5, name: "Jessica R. Folger", avatar: '../../assets/avatars/6.jpg', subTitle: 'Analyst', isSelected: false }, { - id: 0, + id: 6, name: "Charles M. Pollard", avatar: '../../assets/avatars/7.jpg', subTitle: 'Analyst', isSelected: false }, { - id: 0, + id: 7, name: "David B. Boaz", avatar: '../../assets/avatars/8.jpg', subTitle: 'Investigator', isSelected: false }, { - id: 0, + id: 8, name: "Julia R. Bedwell", avatar: '../../assets/avatars/9.jpg', subTitle: 'Analyst', @@ -69,16 +69,24 @@ const HARDCODED_USERS: Array = [{ templateUrl: './select-entities.component.html', styleUrls: ['./select-entities.component.scss'] }) -export class SelectEntitiesComponent implements OnInit { - @Input() entities: Array = HARDCODED_USERS; +export class SelectEntitiesComponent implements OnInit, OnChanges { + @Input() entities: Array = []; + @Output() onSelectChange: EventEmitter = new EventEmitter(); constructor() { } ngOnInit(): void { } + ngOnChanges(changes: SimpleChanges): void { + if (changes.entities.currentValue !== changes.entities.previousValue) { + this.entities = changes.entities.currentValue; + } + } + selectEntity(entity: SelectableEntity) { entity.isSelected = !entity.isSelected; + this.onSelectChange.emit(entity); } }