Browse Source

Add services and kubernetes configuration files

master
Adwaith Rao 3 years ago
parent
commit
7660741e08
16 changed files with 272 additions and 37 deletions
  1. +12
    -0
      cluster-role-trust-policy.json
  2. +14
    -0
      eks-br2s-front-end-service.yaml
  3. +13
    -0
      eks-br2s-load-balancer.yaml
  4. +36
    -0
      eks-deployment.yaml
  5. +22
    -0
      nginx.conf
  6. +12
    -0
      node-role-trust-policy.json
  7. +9
    -7
      package.json
  8. +1
    -1
      src/app/pages/investigate-business-entities-and-individuals/assign-panel/assign-panel.component.html
  9. +22
    -4
      src/app/pages/investigate-business-entities-and-individuals/assign-panel/assign-panel.component.ts
  10. +1
    -0
      src/app/pages/investigate-business-entities-and-individuals/investigate-business-entities-and-individuals.component.html
  11. +9
    -2
      src/app/pages/investigate-business-entities-and-individuals/investigate-business-entities-and-individuals.component.ts
  12. +9
    -1
      src/app/pages/investigate-business-entities-and-individuals/view-case-details/view-case-details.component.ts
  13. +16
    -0
      src/app/services/investigate-buiness-entity-and-individual.service.spec.ts
  14. +67
    -0
      src/app/services/investigate-buiness-entity-and-individual.service.ts
  15. +9
    -10
      src/app/services/register-business-name.service.ts
  16. +20
    -12
      src/app/widgets/select-entities/select-entities.component.ts

+ 12
- 0
cluster-role-trust-policy.json View File

@@ -0,0 +1,12 @@
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "eks.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}

+ 14
- 0
eks-br2s-front-end-service.yaml View File

@@ -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

+ 13
- 0
eks-br2s-load-balancer.yaml View File

@@ -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

+ 36
- 0
eks-deployment.yaml View File

@@ -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

+ 22
- 0
nginx.conf View File

@@ -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;
}


+ 12
- 0
node-role-trust-policy.json View File

@@ -0,0 +1,12 @@
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "ec2.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}

+ 9
- 7
package.json View File

@@ -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": {


+ 1
- 1
src/app/pages/investigate-business-entities-and-individuals/assign-panel/assign-panel.component.html View File

@@ -1,2 +1,2 @@
<app-view-case-details></app-view-case-details>
<app-select-entities></app-select-entities>
<app-select-entities *ngIf="panelCandidates.length > 0" [entities]="panelCandidates" (onSelectChange)="toggleSelectedCandidate($event)"></app-select-entities>

+ 22
- 4
src/app/pages/investigate-business-entities-and-individuals/assign-panel/assign-panel.component.ts View File

@@ -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<SelectableEntity> = [];

constructor() { }
@Output() onSelectedCandidatesUpdate: EventEmitter<Array<string>> = 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);
}

}

+ 1
- 0
src/app/pages/investigate-business-entities-and-individuals/investigate-business-entities-and-individuals.component.html View File

@@ -33,6 +33,7 @@
<app-assign-panel
*ngIf="state === 'ASSIGN COMMITTEE'"
(onSelectedCandidatesUpdate)="handleSelectedCandidates($event)"
></app-assign-panel>

<app-review-non-compliance


+ 9
- 2
src/app/pages/investigate-business-entities-and-individuals/investigate-business-entities-and-individuals.component.ts View File

@@ -1,4 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { InvestigateBuinessEntityAndIndividualService } from 'src/app/services/investigate-buiness-entity-and-individual.service';

type State = 'VIEW INITIAL DETAILS'|'ENTER MORE DETAILS'|'ASSIGN COMMITTEE'|'REVIEW NON COMPLIANCE'|'CONCUR COMPLIANCE REVIEW'|'CLOSING REMARKS'|'PREPARE PRELIMINARY LETTER'|'RESPOND TO PRELIMINARY LETTER';
type Role = 'Investigator'|'Hod'|'Panel'|'Customer'|'Officer';
@@ -17,6 +18,7 @@ export class InvestigateBusinessEntitiesAndIndividualsComponent implements OnIni

state: State;
stateHistory: Array<State> = [];
selectedCandidateIds: Array<string> = [];

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<string>) {
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;


+ 9
- 1
src/app/pages/investigate-business-entities-and-individuals/view-case-details/view-case-details.component.ts View File

@@ -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;
})
}

}

+ 16
- 0
src/app/services/investigate-buiness-entity-and-individual.service.spec.ts View File

@@ -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();
});
});

+ 67
- 0
src/app/services/investigate-buiness-entity-and-individual.service.ts View File

@@ -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<Array<KeyValue>>('/api/compliance-data-aggregation/case-details/').toPromise();

return new Promise<Array<KeyValue>>((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<Array<Array<string>>>('/api/compliance-data-aggregation/board-details/').toPromise();

return new Promise<Array<Array<string>>>((resolve, reject) => resolve([
[
'Rose E. Arthur',
'July 26, 2010',
], [
'David A. Bryant',
'July 26, 2008',
]
]));
}

getPanelCandidates() {
return this.http.get<Array<SelectableEntity>>('/api/compliance-panel/get-panel-candidates/').toPromise();

return new Promise<Array<SelectableEntity>>((resolve, reject) => resolve(HARDCODED_USERS));
}

selectPanelMembers(selectedPanelMembers: Array<string>) {
const selectPanelRequestBody = {
names: selectedPanelMembers,
}
return this.http.post<StatusResponse>('/api/compliance-panel/select-panel/', selectPanelRequestBody).toPromise();

return new Promise<StatusResponse>((resolve, reject) => resolve({status: 'success'}));
}
}

+ 9
- 10
src/app/services/register-business-name.service.ts View File

@@ -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<NameCheckResponse>((resolve, reject) => resolve({status: 'success'}));
return this.http.post<NameCheckResponse>('/api/registration-name-check/name-check', nameCheckRequest).toPromise();

return this.http.post<NameCheckResponse>('http://localhost:10000/name-check/', nameCheckRequest).toPromise();
return new Promise<NameCheckResponse>((resolve, reject) => resolve({status: 'success'}));
}

registerName(
@@ -58,20 +56,21 @@ export class RegisterBusinessNameService {
dropSuffix,
};

return new Promise<NameCheckResponse>((resolve, reject) => resolve({status: 'success'}));
return this.http.post<NameCheckResponse>('/api/registration-name-register/name-register', nameRegisterRequest).toPromise();

return this.http.post<NameRegisterResponse>('http://localhost:8080/name-register/', nameRegisterRequest).toPromise();
return new Promise<NameCheckResponse>((resolve, reject) => resolve({status: 'success'}));
}

getAcknowledgement() {
return this.http.get<Array<AcknowledgementRow>>('/api/registration-payment/acknowledgement/').toPromise();

return new Promise<Array<AcknowledgementRow>>((resolve, reject) => resolve([]));

return this.http.get<Array<AcknowledgementRow>>('http://localhost:8080/acknowledgement/').toPromise();
}

getReceipt() {
return this.http.get<Array<ReceiptRow>>('/api/registration-payment/receipt/').toPromise();

return new Promise<Array<ReceiptRow>>((resolve, reject) => resolve([]));
return this.http.get<Array<ReceiptRow>>('http://localhost:8080/receipt/').toPromise();
}
}

+ 20
- 12
src/app/widgets/select-entities/select-entities.component.ts View File

@@ -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<SelectableEntity> = [{
export const HARDCODED_USERS: Array<SelectableEntity> = [{
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<SelectableEntity> = [{
templateUrl: './select-entities.component.html',
styleUrls: ['./select-entities.component.scss']
})
export class SelectEntitiesComponent implements OnInit {
@Input() entities: Array<SelectableEntity> = HARDCODED_USERS;
export class SelectEntitiesComponent implements OnInit, OnChanges {
@Input() entities: Array<SelectableEntity> = [];
@Output() onSelectChange: EventEmitter<SelectableEntity> = 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);
}

}

Loading…
Cancel
Save