├── src ├── assets │ ├── .gitkeep │ ├── AUD.png │ ├── EUR.png │ ├── USD.png │ ├── bowling.png │ ├── giphy.gif │ ├── bowling2.jpg │ ├── bowling3.jpg │ ├── bowling4.jpg │ ├── fonts │ │ ├── Proxima Nova Black.otf │ │ ├── Proxima Nova Bold.otf │ │ ├── Proxima Nova Thin.otf │ │ ├── Proxima Nova Alt Bold.otf │ │ ├── Proxima Nova Alt Thin.otf │ │ ├── ProximaNova-Regular.otf │ │ ├── Proxima Nova Alt Light.otf │ │ └── Proxima Nova Extrabold.otf │ └── mock-data.json ├── app │ ├── app.component.scss │ ├── cash-info │ │ ├── cash-info.component.scss │ │ ├── cash-info.component.ts │ │ ├── cash-info.component.html │ │ └── cash-info.component.spec.ts │ ├── charts │ │ ├── inventory │ │ │ ├── inventory.component.scss │ │ │ ├── inventory.component.html │ │ │ ├── inventory.component.spec.ts │ │ │ └── inventory.component.ts │ │ └── monthly-cash │ │ │ ├── monthly-cash.component.scss │ │ │ ├── monthly-cash.component.html │ │ │ ├── monthly-cash.component.spec.ts │ │ │ └── monthly-cash.component.ts │ ├── models │ │ └── Transaction.model.ts │ ├── live-table │ │ ├── live-table.component.scss │ │ ├── live-table.component.spec.ts │ │ ├── live-table.component.ts │ │ └── live-table.component.html │ ├── store │ │ ├── state │ │ │ ├── cash.state.ts │ │ │ └── app.state.ts │ │ ├── reducers │ │ │ ├── app.reducers.ts │ │ │ └── cash.reducer.ts │ │ ├── selectors │ │ │ └── transaction.selector.ts │ │ ├── actions │ │ │ └── cash.action.ts │ │ └── effects │ │ │ └── transaction.effect.ts │ ├── app-routing.module.ts │ ├── services │ │ ├── data.service.spec.ts │ │ └── data.service.ts │ ├── app.component.html │ ├── resources │ │ └── mock-data.json │ ├── app.component.spec.ts │ ├── app.module.ts │ └── app.component.ts ├── environments │ ├── environment.prod.ts │ └── environment.ts ├── favicon.ico ├── main.ts ├── index.html ├── test.ts ├── polyfills.ts └── styles.scss ├── e2e ├── tsconfig.json ├── src │ ├── app.po.ts │ └── app.e2e-spec.ts └── protractor.conf.js ├── .editorconfig ├── tsconfig.app.json ├── tsconfig.spec.json ├── browserslist ├── tsconfig.json ├── .gitignore ├── karma.conf.js ├── README.md ├── package.json ├── tslint.json └── angular.json /src/assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/app.component.scss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/cash-info/cash-info.component.scss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/charts/inventory/inventory.component.scss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/charts/monthly-cash/monthly-cash.component.scss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamisChebbi/ng-realtime-dashboard-ngrx/HEAD/src/favicon.ico -------------------------------------------------------------------------------- /src/assets/AUD.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamisChebbi/ng-realtime-dashboard-ngrx/HEAD/src/assets/AUD.png -------------------------------------------------------------------------------- /src/assets/EUR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamisChebbi/ng-realtime-dashboard-ngrx/HEAD/src/assets/EUR.png -------------------------------------------------------------------------------- /src/assets/USD.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamisChebbi/ng-realtime-dashboard-ngrx/HEAD/src/assets/USD.png -------------------------------------------------------------------------------- /src/assets/bowling.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamisChebbi/ng-realtime-dashboard-ngrx/HEAD/src/assets/bowling.png -------------------------------------------------------------------------------- /src/assets/giphy.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamisChebbi/ng-realtime-dashboard-ngrx/HEAD/src/assets/giphy.gif -------------------------------------------------------------------------------- /src/assets/bowling2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamisChebbi/ng-realtime-dashboard-ngrx/HEAD/src/assets/bowling2.jpg -------------------------------------------------------------------------------- /src/assets/bowling3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamisChebbi/ng-realtime-dashboard-ngrx/HEAD/src/assets/bowling3.jpg -------------------------------------------------------------------------------- /src/assets/bowling4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamisChebbi/ng-realtime-dashboard-ngrx/HEAD/src/assets/bowling4.jpg -------------------------------------------------------------------------------- /src/assets/fonts/Proxima Nova Black.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamisChebbi/ng-realtime-dashboard-ngrx/HEAD/src/assets/fonts/Proxima Nova Black.otf -------------------------------------------------------------------------------- /src/assets/fonts/Proxima Nova Bold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamisChebbi/ng-realtime-dashboard-ngrx/HEAD/src/assets/fonts/Proxima Nova Bold.otf -------------------------------------------------------------------------------- /src/assets/fonts/Proxima Nova Thin.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamisChebbi/ng-realtime-dashboard-ngrx/HEAD/src/assets/fonts/Proxima Nova Thin.otf -------------------------------------------------------------------------------- /src/assets/fonts/Proxima Nova Alt Bold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamisChebbi/ng-realtime-dashboard-ngrx/HEAD/src/assets/fonts/Proxima Nova Alt Bold.otf -------------------------------------------------------------------------------- /src/assets/fonts/Proxima Nova Alt Thin.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamisChebbi/ng-realtime-dashboard-ngrx/HEAD/src/assets/fonts/Proxima Nova Alt Thin.otf -------------------------------------------------------------------------------- /src/assets/fonts/ProximaNova-Regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamisChebbi/ng-realtime-dashboard-ngrx/HEAD/src/assets/fonts/ProximaNova-Regular.otf -------------------------------------------------------------------------------- /src/assets/fonts/Proxima Nova Alt Light.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamisChebbi/ng-realtime-dashboard-ngrx/HEAD/src/assets/fonts/Proxima Nova Alt Light.otf -------------------------------------------------------------------------------- /src/assets/fonts/Proxima Nova Extrabold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamisChebbi/ng-realtime-dashboard-ngrx/HEAD/src/assets/fonts/Proxima Nova Extrabold.otf -------------------------------------------------------------------------------- /src/app/charts/inventory/inventory.component.html: -------------------------------------------------------------------------------- 1 | 2 | DAYS INVENTORY OUTSTANDING 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/app/models/Transaction.model.ts: -------------------------------------------------------------------------------- 1 | export interface ITransaction { 2 | Type; 3 | AccountID; 4 | Progress; 5 | Status; 6 | CutOff; 7 | ValueDate; 8 | Currency; 9 | Amount; 10 | TransactionID; 11 | Beneficiary; 12 | Notional; 13 | Coupon; 14 | } 15 | -------------------------------------------------------------------------------- /src/app/charts/monthly-cash/monthly-cash.component.html: -------------------------------------------------------------------------------- 1 | 2 |
CASH
3 |
at end of month
4 | 5 |
6 | -------------------------------------------------------------------------------- /e2e/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/e2e", 5 | "module": "commonjs", 6 | "target": "es5", 7 | "types": [ 8 | "jasmine", 9 | "jasminewd2", 10 | "node" 11 | ] 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/app/live-table/live-table.component.scss: -------------------------------------------------------------------------------- 1 | .orange-color{ 2 | color:#ff6600 !important; 3 | } 4 | 5 | .red-color{ 6 | color:red !important; 7 | } 8 | 9 | 10 | .green-color { 11 | color:green !important; 12 | } 13 | 14 | .blue-color { 15 | color: #4F33FF !important; 16 | } 17 | -------------------------------------------------------------------------------- /src/app/store/state/cash.state.ts: -------------------------------------------------------------------------------- 1 | import { ITransaction } from 'src/app/models/Transaction.model'; 2 | 3 | export interface ITransactionState { 4 | transactions: ITransaction[]; 5 | } 6 | 7 | export const initialTransactionState: ITransactionState = { 8 | transactions: null 9 | } 10 | ; 11 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /e2e/src/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get(browser.baseUrl) as Promise; 6 | } 7 | 8 | getTitleText() { 9 | return element(by.css('app-root h1')).getText() as Promise; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/app/store/reducers/app.reducers.ts: -------------------------------------------------------------------------------- 1 | import { ActionReducerMap } from '@ngrx/store'; 2 | import { IAppState } from '../state/app.state'; 3 | import { transactionsReducers } from './cash.reducer'; 4 | 5 | export const appReducers: ActionReducerMap = { 6 | transactions: transactionsReducers 7 | }; 8 | 9 | -------------------------------------------------------------------------------- /src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { Routes, RouterModule } from '@angular/router'; 3 | 4 | 5 | const routes: Routes = []; 6 | 7 | @NgModule({ 8 | imports: [RouterModule.forRoot(routes)], 9 | exports: [RouterModule] 10 | }) 11 | export class AppRoutingModule { } 12 | -------------------------------------------------------------------------------- /tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./out-tsc/app", 5 | "types": [] 6 | }, 7 | "files": [ 8 | "src/main.ts", 9 | "src/polyfills.ts" 10 | ], 11 | "include": [ 12 | "src/**/*.ts" 13 | ], 14 | "exclude": [ 15 | "src/test.ts", 16 | "src/**/*.spec.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./out-tsc/spec", 5 | "types": [ 6 | "jasmine", 7 | "node" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts", 12 | "src/polyfills.ts" 13 | ], 14 | "include": [ 15 | "src/**/*.spec.ts", 16 | "src/**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /src/app/cash-info/cash-info.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-cash-info', 5 | templateUrl: './cash-info.component.html', 6 | styleUrls: ['./cash-info.component.scss'] 7 | }) 8 | export class CashInfoComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit() { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/app/store/state/app.state.ts: -------------------------------------------------------------------------------- 1 | import { ITransactionState, initialTransactionState } from './cash.state'; 2 | 3 | export interface IAppState { 4 | transactions: ITransactionState; 5 | } 6 | 7 | export const initialAppState: IAppState = { 8 | transactions: initialTransactionState 9 | }; 10 | 11 | export function getInitialState(): IAppState { 12 | return initialAppState; 13 | } 14 | -------------------------------------------------------------------------------- /src/app/services/data.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { DataService } from './data.service'; 4 | 5 | describe('DataService', () => { 6 | beforeEach(() => TestBed.configureTestingModule({})); 7 | 8 | it('should be created', () => { 9 | const service: DataService = TestBed.get(DataService); 10 | expect(service).toBeTruthy(); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /src/app/app.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 |
5 |
6 | 7 |
8 |
9 | 10 |
11 |
12 | 13 | 14 | -------------------------------------------------------------------------------- /src/app/store/selectors/transaction.selector.ts: -------------------------------------------------------------------------------- 1 | import { IAppState } from '../state/app.state'; 2 | import { createSelector } from '@ngrx/store'; 3 | import { ITransactionState } from '../state/cash.state'; 4 | 5 | const selectTransactions = (state: IAppState) => state.transactions; 6 | export const selectTransactionsStream = createSelector( 7 | selectTransactions, 8 | (state: ITransactionState) => state.transactions 9 | ); 10 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.error(err)); 13 | -------------------------------------------------------------------------------- /src/assets/mock-data.json: -------------------------------------------------------------------------------- 1 | { 2 | "data": [ 3 | { 4 | "TradeId": "1", 5 | "TradeDate": "11/02/2016", 6 | "BuySell": "Sell", 7 | "Notional": "50000000", 8 | "Coupon": "500", 9 | "Currency": "EUR", 10 | "Ticker": "LINDE", 11 | "ShortName": "Linde AG", 12 | "MaturityDate": "20/03/2023", 13 | "Sector": "Basic Materials", 14 | "Trader": "Yael Rich", 15 | "Status": "Pending" 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ClientAngular 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /browserslist: -------------------------------------------------------------------------------- 1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below. 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | 5 | # You can see what browsers were selected by your queries by running: 6 | # npx browserslist 7 | 8 | > 0.5% 9 | last 2 versions 10 | Firefox ESR 11 | not dead 12 | not IE 9-11 # For IE 9-11 support, remove 'not'. -------------------------------------------------------------------------------- /src/app/cash-info/cash-info.component.html: -------------------------------------------------------------------------------- 1 | 2 |
CASH BALANCE
3 |
€ 183,308.85
4 |
5 |
IN
6 |
€ 311,625.05
7 |
8 |
9 |
OUT
10 |
€ 311,625.05
11 |
12 |
13 | -------------------------------------------------------------------------------- /src/app/store/reducers/cash.reducer.ts: -------------------------------------------------------------------------------- 1 | import { initialTransactionState, ITransactionState } from '../state/cash.state'; 2 | import * as cashActions from '../actions/cash.action'; 3 | 4 | export const transactionsReducers = (state= initialTransactionState, action: cashActions.TransactionActions): 5 | ITransactionState => { 6 | switch (action.type) { 7 | case (cashActions.GET_TRANSATIONS_SUCCESS): { 8 | return {...state, transactions: action.payload.data}; 9 | } 10 | default: return state; 11 | } 12 | }; 13 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "baseUrl": "./", 5 | "outDir": "./dist/out-tsc", 6 | "sourceMap": true, 7 | "declaration": false, 8 | "downlevelIteration": true, 9 | "experimentalDecorators": true, 10 | "module": "esnext", 11 | "moduleResolution": "node", 12 | "importHelpers": true, 13 | "target": "es2015", 14 | "typeRoots": [ 15 | "node_modules/@types" 16 | ], 17 | "lib": [ 18 | "es2018", 19 | "dom" 20 | ] 21 | }, 22 | "angularCompilerOptions": { 23 | "fullTemplateTypeCheck": true, 24 | "strictInjectionParameters": true 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/app/store/actions/cash.action.ts: -------------------------------------------------------------------------------- 1 | import {Action} from '@ngrx/store'; 2 | import { ITransaction } from 'src/app/models/Transaction.model'; 3 | 4 | export const GET_TRANSATIONS = '[Transaction] Get Transations'; 5 | export const GET_TRANSATIONS_SUCCESS = '[Transaction] Get Transations Success'; 6 | 7 | 8 | export class GetTransactions implements Action { 9 | public readonly type = GET_TRANSATIONS; 10 | constructor(public payload: any) { } 11 | 12 | } 13 | 14 | export class GetTransactionsSuccess implements Action { 15 | public readonly type = GET_TRANSATIONS_SUCCESS; 16 | constructor(public payload: any) { } 17 | } 18 | 19 | export type TransactionActions = GetTransactions | GetTransactionsSuccess; 20 | -------------------------------------------------------------------------------- /src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/zone-testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | declare const require: any; 11 | 12 | // First, initialize the Angular testing environment. 13 | getTestBed().initTestEnvironment( 14 | BrowserDynamicTestingModule, 15 | platformBrowserDynamicTesting() 16 | ); 17 | // Then we find all the tests. 18 | const context = require.context('./', true, /\.spec\.ts$/); 19 | // And load the modules. 20 | context.keys().map(context); 21 | -------------------------------------------------------------------------------- /e2e/src/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | import { browser, logging } from 'protractor'; 3 | 4 | describe('workspace-project App', () => { 5 | let page: AppPage; 6 | 7 | beforeEach(() => { 8 | page = new AppPage(); 9 | }); 10 | 11 | it('should display welcome message', () => { 12 | page.navigateTo(); 13 | expect(page.getTitleText()).toEqual('Welcome to client-angular!'); 14 | }); 15 | 16 | afterEach(async () => { 17 | // Assert that there are no errors emitted from the browser 18 | const logs = await browser.manage().logs().get(logging.Type.BROWSER); 19 | expect(logs).not.toContain(jasmine.objectContaining({ 20 | level: logging.Level.SEVERE, 21 | } as logging.Entry)); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /src/app/resources/mock-data.json: -------------------------------------------------------------------------------- 1 | { 2 | "data": [ 3 | { 4 | "TradeId": "1", 5 | "TradeDate": "11/02/2016", 6 | "BuySell": "Sell", 7 | "Notional": "50000000", 8 | "Coupon": "500", 9 | "Currency": "EUR", 10 | "ReferenceEntity": "Linde Aktiengesellschaft", 11 | "Ticker": "LINDE", 12 | "ShortName": "Linde AG", 13 | "Counterparty": "MUFJ", 14 | "MaturityDate": "20/03/2023", 15 | "EffectiveDate": "12/02/2016", 16 | "Tenor": "7", 17 | "RedEntityCode": "DI537C", 18 | "EntityCusip": "D50348", 19 | "EntityType": "Corp", 20 | "Jurisdiction": "Germany", 21 | "Sector": "Basic Materials", 22 | "Trader": "Yael Rich", 23 | "Status": "Pending" 24 | } 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /src/app/cash-info/cash-info.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { CashInfoComponent } from './cash-info.component'; 4 | 5 | describe('CashInfoComponent', () => { 6 | let component: CashInfoComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ CashInfoComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(CashInfoComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // This file can be replaced during build by using the `fileReplacements` array. 2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. 3 | // The list of file replacements can be found in `angular.json`. 4 | 5 | export const environment = { 6 | production: false, 7 | wsEndpoint: 'ws://localhost:8081' 8 | }; 9 | 10 | /* 11 | * For easier debugging in development mode, you can import the following file 12 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. 13 | * 14 | * This import should be commented out in production mode because it will have a negative impact 15 | * on performance if an error is thrown. 16 | */ 17 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI. 18 | -------------------------------------------------------------------------------- /src/app/live-table/live-table.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { LiveTableComponent } from './live-table.component'; 4 | 5 | describe('LiveTableComponent', () => { 6 | let component: LiveTableComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ LiveTableComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(LiveTableComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/charts/inventory/inventory.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { InventoryComponent } from './inventory.component'; 4 | 5 | describe('InventoryComponent', () => { 6 | let component: InventoryComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ InventoryComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(InventoryComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/charts/monthly-cash/monthly-cash.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { MonthlyCashComponent } from './monthly-cash.component'; 4 | 5 | describe('MonthlyCashComponent', () => { 6 | let component: MonthlyCashComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ MonthlyCashComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(MonthlyCashComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | # Only exists if Bazel was run 8 | /bazel-out 9 | 10 | # dependencies 11 | /node_modules 12 | 13 | # profiling files 14 | chrome-profiler-events*.json 15 | speed-measure-plugin*.json 16 | 17 | # IDEs and editors 18 | /.idea 19 | .project 20 | .classpath 21 | .c9/ 22 | *.launch 23 | .settings/ 24 | *.sublime-workspace 25 | 26 | # IDE - VSCode 27 | .vscode/* 28 | !.vscode/settings.json 29 | !.vscode/tasks.json 30 | !.vscode/launch.json 31 | !.vscode/extensions.json 32 | .history/* 33 | 34 | # misc 35 | /.sass-cache 36 | /connect.lock 37 | /coverage 38 | /libpeerconnection.log 39 | npm-debug.log 40 | yarn-error.log 41 | testem.log 42 | /typings 43 | 44 | # System Files 45 | .DS_Store 46 | Thumbs.db 47 | -------------------------------------------------------------------------------- /src/app/charts/inventory/inventory.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-inventory', 5 | templateUrl: './inventory.component.html', 6 | styleUrls: ['./inventory.component.scss'] 7 | }) 8 | export class InventoryComponent implements OnInit { 9 | 10 | data = { 11 | labels: ['January', 'February', 'March'], 12 | datasets: [ 13 | { 14 | data: [50, 100, 50], 15 | backgroundColor: ['#4F33FF', '#6E33FF', '#A833FF'] 16 | } 17 | ] 18 | }; 19 | 20 | options = { 21 | responsive: false, 22 | maintainAspectRatio: false, 23 | legend: { 24 | position: 'bottom' 25 | }, 26 | rotation: 1 * Math.PI, 27 | circumference: 1 * Math.PI 28 | }; 29 | 30 | constructor() { } 31 | 32 | ngOnInit() { 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/app/services/data.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable, Inject } from '@angular/core'; 2 | import { of, Observable } from 'rxjs'; 3 | import { webSocket, WebSocketSubject } from 'rxjs/webSocket'; 4 | import {environment} from '../../environments/environment'; 5 | export const WS_ENDPOINT = environment.wsEndpoint; 6 | 7 | @Injectable({ 8 | providedIn: 'root' 9 | }) 10 | export class DataService { 11 | private socket$: WebSocketSubject; 12 | 13 | constructor() {} 14 | 15 | public connect(): WebSocketSubject { 16 | if (!this.socket$ || this.socket$.closed) { 17 | this.socket$ = webSocket(WS_ENDPOINT); 18 | } 19 | return this.socket$; 20 | } 21 | 22 | public dataUpdates$() { 23 | return this.connect().asObservable(); 24 | } 25 | 26 | closeConnection() { 27 | this.connect().complete(); 28 | } 29 | 30 | sendMessage(msg: any) { 31 | this.socket$.next(msg); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /e2e/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | // Protractor configuration file, see link for more information 3 | // https://github.com/angular/protractor/blob/master/lib/config.ts 4 | 5 | const { SpecReporter } = require('jasmine-spec-reporter'); 6 | 7 | /** 8 | * @type { import("protractor").Config } 9 | */ 10 | exports.config = { 11 | allScriptsTimeout: 11000, 12 | specs: [ 13 | './src/**/*.e2e-spec.ts' 14 | ], 15 | capabilities: { 16 | 'browserName': 'chrome' 17 | }, 18 | directConnect: true, 19 | baseUrl: 'http://localhost:4200/', 20 | framework: 'jasmine', 21 | jasmineNodeOpts: { 22 | showColors: true, 23 | defaultTimeoutInterval: 30000, 24 | print: function() {} 25 | }, 26 | onPrepare() { 27 | require('ts-node').register({ 28 | project: require('path').join(__dirname, './tsconfig.json') 29 | }); 30 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 31 | } 32 | }; -------------------------------------------------------------------------------- /src/app/store/effects/transaction.effect.ts: -------------------------------------------------------------------------------- 1 | import {Effect, Actions, ofType} from '@ngrx/effects'; 2 | import { Injectable } from '@angular/core'; 3 | import { map, switchMap} from 'rxjs/operators'; 4 | 5 | import { GET_TRANSATIONS, GetTransactions, GetTransactionsSuccess, GET_TRANSATIONS_SUCCESS } from '../actions/cash.action'; 6 | import { of } from 'rxjs'; 7 | import { ITransaction } from 'src/app/models/Transaction.model'; 8 | import { DataService } from 'src/app/services/data.service'; 9 | 10 | @Injectable() 11 | export class TransactionEffects { 12 | 13 | constructor(private actions$: Actions, public service: DataService) {} 14 | @Effect() 15 | getTransactions$ = this.actions$.pipe(ofType(GET_TRANSATIONS), 16 | map((action: GetTransactions) => action.payload), 17 | switchMap(payload => 18 | this.service.connect().pipe( 19 | map( 20 | result => 21 | new GetTransactionsSuccess(result) 22 | ) 23 | ))); 24 | } 25 | -------------------------------------------------------------------------------- /karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | dir: require('path').join(__dirname, './coverage/client-angular'), 20 | reports: ['html', 'lcovonly', 'text-summary'], 21 | fixWebpackSourcePaths: true 22 | }, 23 | reporters: ['progress', 'kjhtml'], 24 | port: 9876, 25 | colors: true, 26 | logLevel: config.LOG_INFO, 27 | autoWatch: true, 28 | browsers: ['Chrome'], 29 | singleRun: false, 30 | restartOnFileChange: true 31 | }); 32 | }; 33 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ng-realtime-dashboard-ngrx 2 | 3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.2.1. 4 | 5 | ## Development server 6 | 7 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. 8 | 9 | ## Code scaffolding 10 | 11 | Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. 12 | 13 | ## Build 14 | 15 | Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build. 16 | 17 | ## Running unit tests 18 | 19 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). 20 | 21 | ## Running end-to-end tests 22 | 23 | Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). 24 | 25 | ## Further help 26 | 27 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md). 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, async } from '@angular/core/testing'; 2 | import { RouterTestingModule } from '@angular/router/testing'; 3 | import { AppComponent } from './app.component'; 4 | 5 | describe('AppComponent', () => { 6 | beforeEach(async(() => { 7 | TestBed.configureTestingModule({ 8 | imports: [ 9 | RouterTestingModule 10 | ], 11 | declarations: [ 12 | AppComponent 13 | ], 14 | }).compileComponents(); 15 | })); 16 | 17 | it('should create the app', () => { 18 | const fixture = TestBed.createComponent(AppComponent); 19 | const app = fixture.debugElement.componentInstance; 20 | expect(app).toBeTruthy(); 21 | }); 22 | 23 | it(`should have as title 'client-angular'`, () => { 24 | const fixture = TestBed.createComponent(AppComponent); 25 | const app = fixture.debugElement.componentInstance; 26 | expect(app.title).toEqual('client-angular'); 27 | }); 28 | 29 | it('should render title in a h1 tag', () => { 30 | const fixture = TestBed.createComponent(AppComponent); 31 | fixture.detectChanges(); 32 | const compiled = fixture.debugElement.nativeElement; 33 | expect(compiled.querySelector('h1').textContent).toContain('Welcome to client-angular!'); 34 | }); 35 | }); 36 | -------------------------------------------------------------------------------- /src/app/live-table/live-table.component.ts: -------------------------------------------------------------------------------- 1 | import { 2 | Component, 3 | OnInit, 4 | OnDestroy, 5 | ViewEncapsulation, 6 | ChangeDetectionStrategy 7 | } from '@angular/core'; 8 | import { DataService } from '../services/data.service'; 9 | import { Observable, Subject } from 'rxjs'; 10 | import { Store, select } from '@ngrx/store'; 11 | import { selectTransactionsStream } from '../store/selectors/transaction.selector'; 12 | import { IAppState } from '../store/state/app.state'; 13 | import { GetTransactions } from '../store/actions/cash.action'; 14 | import { ITransaction } from '../models/Transaction.model'; 15 | import { tap, map } from 'rxjs/operators'; 16 | 17 | @Component({ 18 | selector: 'app-live-table', 19 | templateUrl: './live-table.component.html', 20 | styleUrls: ['./live-table.component.scss'], 21 | encapsulation: ViewEncapsulation.None, 22 | changeDetection: ChangeDetectionStrategy.OnPush 23 | }) 24 | export class LiveTableComponent implements OnInit, OnDestroy { 25 | 26 | 27 | trade$ = this.store.pipe(select(selectTransactionsStream)); 28 | constructor(private service: DataService, private store: Store) { 29 | this.store.dispatch(new GetTransactions({})); 30 | } 31 | 32 | updateStatus(trade) { 33 | this.service.sendMessage(trade); 34 | console.log(trade); 35 | } 36 | 37 | ngOnInit() { 38 | } 39 | 40 | ngOnDestroy() { 41 | this.service.closeConnection(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { BrowserModule } from '@angular/platform-browser'; 2 | import { NgModule } from '@angular/core'; 3 | import {FormsModule} from '@angular/forms'; 4 | import { AppRoutingModule } from './app-routing.module'; 5 | import { AppComponent } from './app.component'; 6 | import {ButtonModule} from 'primeng/button'; 7 | import { LiveTableComponent } from './live-table/live-table.component'; 8 | import {TableModule} from 'primeng/table'; 9 | import { HttpClientModule } from '@angular/common/http'; 10 | import {CardModule} from 'primeng/card'; 11 | import {ChartModule} from 'primeng/chart'; 12 | import {ProgressBarModule} from 'primeng/progressbar'; 13 | import { InventoryComponent } from './charts/inventory/inventory.component'; 14 | import { MonthlyCashComponent } from './charts/monthly-cash/monthly-cash.component'; 15 | import { CashInfoComponent } from './cash-info/cash-info.component'; 16 | import { StoreModule } from '@ngrx/store'; 17 | import { EffectsModule } from '@ngrx/effects'; 18 | import { appReducers } from './store/reducers/app.reducers'; 19 | import { TransactionEffects } from './store/effects/transaction.effect'; 20 | 21 | @NgModule({ 22 | declarations: [ 23 | AppComponent, 24 | LiveTableComponent, 25 | InventoryComponent, 26 | MonthlyCashComponent, 27 | CashInfoComponent 28 | ], 29 | imports: [ 30 | BrowserModule, 31 | AppRoutingModule, 32 | FormsModule, 33 | ButtonModule, 34 | TableModule, 35 | CardModule, 36 | ChartModule, 37 | ProgressBarModule, 38 | HttpClientModule, 39 | StoreModule.forRoot(appReducers), 40 | EffectsModule.forRoot([TransactionEffects]), 41 | 42 | ], 43 | providers: [], 44 | bootstrap: [AppComponent] 45 | }) 46 | export class AppModule { } 47 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "client-angular", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng serve", 7 | "build": "ng build", 8 | "test": "ng test", 9 | "lint": "ng lint", 10 | "e2e": "ng e2e" 11 | }, 12 | "private": true, 13 | "dependencies": { 14 | "@angular/animations": "~8.2.0", 15 | "@angular/cdk": "^8.1.4", 16 | "@angular/common": "~8.2.0", 17 | "@angular/compiler": "~8.2.0", 18 | "@angular/core": "~8.2.0", 19 | "@angular/forms": "~8.2.0", 20 | "@angular/platform-browser": "~8.2.0", 21 | "@angular/platform-browser-dynamic": "~8.2.0", 22 | "@angular/router": "~8.2.0", 23 | "@ngrx/core": "^1.2.0", 24 | "@ngrx/effects": "^8.3.0", 25 | "@ngrx/router-store": "^8.3.0", 26 | "@ngrx/store": "^8.3.0", 27 | "@ngrx/store-devtools": "^8.3.0", 28 | "chart.js": "^2.8.0", 29 | "primeicons": "^2.0.0", 30 | "primeng": "^8.0.2", 31 | "rxjs": "~6.4.0", 32 | "tslib": "^1.10.0", 33 | "zone.js": "~0.9.1" 34 | }, 35 | "devDependencies": { 36 | "@angular-devkit/build-angular": "~0.802.1", 37 | "@angular/cli": "~8.2.1", 38 | "@angular/compiler-cli": "~8.2.0", 39 | "@angular/language-service": "~8.2.0", 40 | "@types/node": "~8.9.4", 41 | "@types/jasmine": "~3.3.8", 42 | "@types/jasminewd2": "~2.0.3", 43 | "codelyzer": "^5.0.0", 44 | "jasmine-core": "~3.4.0", 45 | "jasmine-spec-reporter": "~4.2.1", 46 | "karma": "~4.1.0", 47 | "karma-chrome-launcher": "~2.2.0", 48 | "karma-coverage-istanbul-reporter": "~2.0.1", 49 | "karma-jasmine": "~2.0.1", 50 | "karma-jasmine-html-reporter": "^1.4.0", 51 | "protractor": "~5.4.0", 52 | "ts-node": "~7.0.0", 53 | "tslint": "~5.15.0", 54 | "typescript": "~3.5.3" 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/app/live-table/live-table.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Type 5 | AccountID 6 | Progress 7 | Status 8 | CutOff 9 | ValueDate 10 | Currency 11 | Amount 12 | TransactionID 13 | Beneficiary 14 | Notional 15 | Coupon 16 | 17 | 18 | 19 | 20 | 21 | 22 | {{ trade.Type }} 23 | 24 | {{ trade.AccountID }} 25 | 26 | 27 | 28 | 33 | 34 | {{ trade.Status }} 35 | 36 | {{ trade['CutOff'] }} 37 | 38 | {{ trade.ValueDate }} 39 | 40 | 41 | 42 | {{ trade.Currency }} 43 | 44 | {{ trade.Amount }} 45 | {{ trade.TransactionID }} 46 | {{ trade.Beneficiary }} 47 | 48 | 52 | {{ trade.Notional }} 53 | 54 | {{ trade.Coupon }} 55 | 56 | 57 | -------------------------------------------------------------------------------- /src/app/charts/monthly-cash/monthly-cash.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, ViewChild } from '@angular/core'; 2 | import { DataService } from 'src/app/services/data.service'; 3 | import { UIChart } from 'primeng/chart'; 4 | 5 | @Component({ 6 | selector: 'app-monthly-cash', 7 | templateUrl: './monthly-cash.component.html', 8 | styleUrls: ['./monthly-cash.component.scss'] 9 | }) 10 | export class MonthlyCashComponent implements OnInit { 11 | @ViewChild('chart', { static: false }) chart: UIChart; 12 | 13 | barData = { 14 | labels: [ 15 | 'Jan 2019', 16 | 'Feb 2019', 17 | 'Mar 2019', 18 | 'Apr 2019', 19 | 'May 2019', 20 | 'Jun 2019', 21 | 'Aug 2019', 22 | 'Sep 2019', 23 | 'Oct 2019', 24 | 'Nov 2019', 25 | 'Dec 2019' 26 | ], 27 | datasets: [ 28 | { 29 | label: 'First Dataset', 30 | data: [18, 17, 19, 19, 17, 18, 16, 17, 17, 18, 16, 17, 15], 31 | backgroundColor: [ 32 | '#4F33FF', 33 | '#6E33FF', 34 | '#A833FF', 35 | '#4F33FF', 36 | '#6E33FF', 37 | '#A833FF', 38 | '#4F33FF', 39 | '#6E33FF', 40 | '#A833FF', 41 | '#4F33FF', 42 | '#6E33FF', 43 | '#A833FF' 44 | ] 45 | } 46 | ] 47 | }; 48 | barOptions = { 49 | responsive: false, 50 | maintainAspectRatio: false, 51 | legend: { 52 | display: false 53 | } 54 | }; 55 | copy: { 56 | labels: string[]; 57 | datasets: { label: string; data: number[]; backgroundColor: string[] }[]; 58 | }; 59 | constructor(private service: DataService) {} 60 | 61 | ngOnInit() { 62 | // const observableB = this.service.wsSubject().multiplex( 63 | // // And the same goes for 'B'. 64 | // () => ({ charts: 'charts' }), 65 | // () => ({ charts: 'charts' }), 66 | // message => message.type === 'charts' 67 | // ); 68 | // observableB.subscribe(msg => { 69 | // console.log('charts'); 70 | // this.copy = this.barData; 71 | // this.copy.datasets[0].data = msg.data; 72 | // this.barData = { ...this.copy }; 73 | // }); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "tslint:recommended", 3 | "rules": { 4 | "array-type": false, 5 | "arrow-parens": false, 6 | "deprecation": { 7 | "severity": "warning" 8 | }, 9 | "component-class-suffix": true, 10 | "contextual-lifecycle": true, 11 | "directive-class-suffix": true, 12 | "directive-selector": [ 13 | true, 14 | "attribute", 15 | "app", 16 | "camelCase" 17 | ], 18 | "component-selector": [ 19 | true, 20 | "element", 21 | "app", 22 | "kebab-case" 23 | ], 24 | "import-blacklist": [ 25 | true, 26 | "rxjs/Rx" 27 | ], 28 | "interface-name": false, 29 | "max-classes-per-file": false, 30 | "max-line-length": [ 31 | true, 32 | 140 33 | ], 34 | "member-access": false, 35 | "member-ordering": [ 36 | true, 37 | { 38 | "order": [ 39 | "static-field", 40 | "instance-field", 41 | "static-method", 42 | "instance-method" 43 | ] 44 | } 45 | ], 46 | "no-consecutive-blank-lines": false, 47 | "no-console": [ 48 | true, 49 | "debug", 50 | "info", 51 | "time", 52 | "timeEnd", 53 | "trace" 54 | ], 55 | "no-empty": false, 56 | "no-inferrable-types": [ 57 | true, 58 | "ignore-params" 59 | ], 60 | "no-non-null-assertion": true, 61 | "no-redundant-jsdoc": true, 62 | "no-switch-case-fall-through": true, 63 | "no-use-before-declare": true, 64 | "no-var-requires": false, 65 | "object-literal-key-quotes": [ 66 | true, 67 | "as-needed" 68 | ], 69 | "object-literal-sort-keys": false, 70 | "ordered-imports": false, 71 | "quotemark": [ 72 | true, 73 | "single" 74 | ], 75 | "trailing-comma": false, 76 | "no-conflicting-lifecycle": true, 77 | "no-host-metadata-property": true, 78 | "no-input-rename": true, 79 | "no-inputs-metadata-property": true, 80 | "no-output-native": true, 81 | "no-output-on-prefix": true, 82 | "no-output-rename": true, 83 | "no-outputs-metadata-property": true, 84 | "template-banana-in-box": true, 85 | "template-no-negated-async": true, 86 | "use-lifecycle-interface": true, 87 | "use-pipe-transform-interface": true 88 | }, 89 | "rulesDirectory": [ 90 | "codelyzer" 91 | ] 92 | } -------------------------------------------------------------------------------- /src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, ViewChild } from '@angular/core'; 2 | import { webSocket } from 'rxjs/webSocket'; 3 | import { DataService } from './services/data.service'; 4 | import { Observable } from 'rxjs'; 5 | import { of } from 'rxjs'; 6 | import { UIChart } from 'primeng/chart'; 7 | 8 | @Component({ 9 | selector: 'app-root', 10 | templateUrl: './app.component.html', 11 | styleUrls: ['./app.component.scss'] 12 | }) 13 | export class AppComponent { 14 | title = 'client-angular'; 15 | message = 'Hello'; 16 | barData$: Observable; 17 | @ViewChild('chart', {static: false}) chart: UIChart; 18 | 19 | constructor(private service: DataService) { 20 | // let tempData: any; 21 | // this.barData$ = of(this.barData); 22 | // this.service.wsSubject().subscribe(msg => { 23 | // console.log('I received this message: ' + msg); 24 | // tempData = this.barData$; 25 | // tempData['value'].datasets[0].data = tempData['value'].datasets[0].data.filter(x=>x>15).map( 26 | // x => x * 2 27 | // ); 28 | // this.barData$ = tempData; 29 | // this.chart.reinit(); 30 | // }); 31 | } 32 | 33 | sendToServer($event) { 34 | // this.subject.next(this.message); 35 | this.service.connect().error({code: 4000, reason: 'I think our app just broke!'}); 36 | // this.service.wsSubject().complete(); 37 | // this.service.wsSubject().next('Hi'); 38 | // 1st way 39 | // const subject$ = webSocket( 'ws://localhost:8081'); 40 | // 2nd way 41 | // const subject$ = webSocket({ 42 | // url: 'ws://localhost:8081', 43 | // // Apply any transformation of your choice. 44 | // deserializer: (e) => JSON.parse(e.data), 45 | // // Apply any transformation of your choice. 46 | // serializer: (value) => JSON.stringify(value), 47 | // openObserver: { 48 | // next: () => { 49 | // console.log('Connetion established'); 50 | // } 51 | // }, 52 | // closeObserver: { 53 | // next() { 54 | // const customError = { code: 4040, reason: 'Custom reason' }; 55 | // console.log(`code: ${customError.code}, reason: ${customError.reason}`); 56 | // }, 57 | // }, 58 | // }); 59 | 60 | // } 61 | } 62 | unsubscribe($event) { 63 | this.service.connect().unsubscribe(); 64 | } 65 | 66 | subscribe($event) { 67 | this.service.connect().subscribe(); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/polyfills.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file includes polyfills needed by Angular and is loaded before the app. 3 | * You can add your own extra polyfills to this file. 4 | * 5 | * This file is divided into 2 sections: 6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. 7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main 8 | * file. 9 | * 10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that 11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), 12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. 13 | * 14 | * Learn more in https://angular.io/guide/browser-support 15 | */ 16 | 17 | /*************************************************************************************************** 18 | * BROWSER POLYFILLS 19 | */ 20 | 21 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */ 22 | // import 'classlist.js'; // Run `npm install --save classlist.js`. 23 | 24 | /** 25 | * Web Animations `@angular/platform-browser/animations` 26 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. 27 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). 28 | */ 29 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 30 | 31 | /** 32 | * By default, zone.js will patch all possible macroTask and DomEvents 33 | * user can disable parts of macroTask/DomEvents patch by setting following flags 34 | * because those flags need to be set before `zone.js` being loaded, and webpack 35 | * will put import in the top of bundle, so user need to create a separate file 36 | * in this directory (for example: zone-flags.ts), and put the following flags 37 | * into that file, and then add the following code before importing zone.js. 38 | * import './zone-flags.ts'; 39 | * 40 | * The flags allowed in zone-flags.ts are listed here. 41 | * 42 | * The following flags will work for all browsers. 43 | * 44 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 45 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 46 | * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 47 | * 48 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 49 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 50 | * 51 | * (window as any).__Zone_enable_cross_context_check = true; 52 | * 53 | */ 54 | 55 | /*************************************************************************************************** 56 | * Zone JS is required by default for Angular itself. 57 | */ 58 | import 'zone.js/dist/zone'; // Included with Angular CLI. 59 | 60 | 61 | /*************************************************************************************************** 62 | * APPLICATION IMPORTS 63 | */ 64 | -------------------------------------------------------------------------------- /src/styles.scss: -------------------------------------------------------------------------------- 1 | .ng-inventor-chart .ui-card { 2 | background-color: rgb(248, 248, 248); 3 | } 4 | .ng-cash-chart .ui-card, .ng-cash-month-column .ui-card { 5 | background-color: rgb(248, 248, 248); 6 | } 7 | .ng-cash-balance { 8 | font-size: 17.5px; 9 | height: 19.5px; 10 | text-align: center; 11 | color: rgb(31, 33, 33); 12 | font-weight: bold; 13 | font-style: normal; 14 | text-decoration: none; 15 | } 16 | .ng-inventor-column, .ng-cash-column, .ng-cash-month-column{ 17 | float: left; 18 | } 19 | 20 | .ng-inventor-column { 21 | width: 29%; 22 | padding: 8px; 23 | 24 | } 25 | 26 | .ng-cash-column { 27 | width: 29%; 28 | padding: 8px; 29 | } 30 | 31 | .ng-cash-month-column { 32 | width: 42%; 33 | padding: 8px; 34 | 35 | } 36 | .row { 37 | margin: 0; 38 | } 39 | 40 | .ng-inventor-label { 41 | font-family: 'Montserrat', sans-serif; 42 | font-size: 17.5px; 43 | height: 19.5px; 44 | text-align: center; 45 | color: rgb(31, 33, 33); 46 | font-weight: bold; 47 | font-style: normal; 48 | text-decoration: none; 49 | } 50 | 51 | .ui-card { 52 | height: 210px; 53 | } 54 | 55 | 56 | .ng-cash-amount { 57 | color: #1f2121; 58 | font-family: "Montserrat", sans-serif; 59 | font-weight: bold; 60 | font-style: normal; 61 | text-decoration: none; 62 | font-size: -webkit-xxx-large !important; 63 | text-align: center !important; 64 | padding-top: 25px !important; 65 | } 66 | 67 | .ui-card-header { 68 | text-align: center; 69 | padding-top: 10px; 70 | } 71 | 72 | .ng-cash-label, .ng-cash-balance-label { 73 | font-family: 'Montserrat', sans-serif; 74 | font-size: 17.5px; 75 | height: 19.5px; 76 | text-align: center; 77 | color: rgb(31, 33, 33); 78 | font-weight: bold; 79 | font-style: normal; 80 | text-decoration: none; 81 | } 82 | 83 | .ng-end-of-month-label { 84 | font-family: 'Montserrat', sans-serif; 85 | font-size: 13px; 86 | height: 16px; 87 | text-align: center; 88 | color: rgb(31, 33, 33); 89 | } 90 | 91 | body .ui-table .ui-table-tbody > tr > td { 92 | border: none !important; 93 | text-align: center; 94 | font-family: 'Montserrat', sans-serif; 95 | font-style: normal; 96 | font-weight: bold; 97 | } 98 | body .ui-table .ui-table-thead > tr > th { 99 | border: none !important; 100 | font-family: 'Montserrat', sans-serif; 101 | font-weight: bold; 102 | font-style: normal; 103 | } 104 | 105 | body .ui-progressbar .ui-progressbar-value { 106 | background: #A833FF !important; 107 | } 108 | 109 | body .ui-widget { 110 | font-family: 'Montserrat', sans-serif; 111 | } 112 | 113 | body .ui-progressbar{ 114 | height: 14px !important; 115 | } 116 | 117 | body .ui-progressbar .ui-progressbar-label{ 118 | line-height: 14px !important; 119 | } 120 | 121 | body .pi { 122 | font-size: 1em !important; 123 | } 124 | 125 | .pi.pi-arrow-up.green-arrow{ 126 | color: forestgreen !important; 127 | } 128 | .pi.pi-arrow-down.red-arrow{ 129 | color: red !important; 130 | } 131 | body .ui-table .ui-table-tbody > tr > td { 132 | padding: 0.271em 0.457em !important; 133 | } 134 | .flex-container { 135 | display: flex; 136 | padding-left: 100px; 137 | } 138 | .ui-table.ui-widget { 139 | margin: 8px; 140 | } 141 | .ng-cash-in, .ng-cash-out { 142 | text-align: center; 143 | font-size: 15.504px; 144 | padding-top: 11.5px; 145 | padding-right: 40px; 146 | } 147 | 148 | .ng-cash-in-amount { 149 | text-align: center; 150 | font-size: 15.504px; 151 | padding-top: 11.5px; 152 | } 153 | 154 | .ng-cash-out { 155 | padding-right: 25px; 156 | } 157 | 158 | .ng-currency { 159 | vertical-align: middle; 160 | } 161 | 162 | body .ui-button { 163 | font-size: 12px !important; 164 | } 165 | 166 | body .ui-button.ui-button-icon-only .ui-button-text, .ui-button-icon-only .ui-button-text { 167 | padding: 0 !important; 168 | } -------------------------------------------------------------------------------- /angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "client-angular": { 7 | "projectType": "application", 8 | "schematics": { 9 | "@schematics/angular:component": { 10 | "style": "scss" 11 | } 12 | }, 13 | "root": "", 14 | "sourceRoot": "src", 15 | "prefix": "app", 16 | "architect": { 17 | "build": { 18 | "builder": "@angular-devkit/build-angular:browser", 19 | "options": { 20 | "outputPath": "dist/client-angular", 21 | "index": "src/index.html", 22 | "main": "src/main.ts", 23 | "polyfills": "src/polyfills.ts", 24 | "tsConfig": "tsconfig.app.json", 25 | "aot": false, 26 | "assets": [ 27 | "src/favicon.ico", 28 | "src/assets" 29 | ], 30 | "styles": [ 31 | "src/styles.scss", 32 | "node_modules/primeicons/primeicons.css", 33 | "node_modules/primeng/resources/themes/nova-light/theme.css", 34 | "node_modules/primeng/resources/primeng.min.css" 35 | ], 36 | "scripts": [ 37 | "node_modules/chart.js/dist/Chart.js" 38 | ] 39 | }, 40 | "configurations": { 41 | "production": { 42 | "fileReplacements": [ 43 | { 44 | "replace": "src/environments/environment.ts", 45 | "with": "src/environments/environment.prod.ts" 46 | } 47 | ], 48 | "optimization": true, 49 | "outputHashing": "all", 50 | "sourceMap": false, 51 | "extractCss": true, 52 | "namedChunks": false, 53 | "aot": true, 54 | "extractLicenses": true, 55 | "vendorChunk": false, 56 | "buildOptimizer": true, 57 | "budgets": [ 58 | { 59 | "type": "initial", 60 | "maximumWarning": "2mb", 61 | "maximumError": "5mb" 62 | }, 63 | { 64 | "type": "anyComponentStyle", 65 | "maximumWarning": "6kb", 66 | "maximumError": "10kb" 67 | } 68 | ] 69 | } 70 | } 71 | }, 72 | "serve": { 73 | "builder": "@angular-devkit/build-angular:dev-server", 74 | "options": { 75 | "browserTarget": "client-angular:build" 76 | }, 77 | "configurations": { 78 | "production": { 79 | "browserTarget": "client-angular:build:production" 80 | } 81 | } 82 | }, 83 | "extract-i18n": { 84 | "builder": "@angular-devkit/build-angular:extract-i18n", 85 | "options": { 86 | "browserTarget": "client-angular:build" 87 | } 88 | }, 89 | "test": { 90 | "builder": "@angular-devkit/build-angular:karma", 91 | "options": { 92 | "main": "src/test.ts", 93 | "polyfills": "src/polyfills.ts", 94 | "tsConfig": "tsconfig.spec.json", 95 | "karmaConfig": "karma.conf.js", 96 | "assets": [ 97 | "src/favicon.ico", 98 | "src/assets" 99 | ], 100 | "styles": [ 101 | "src/styles.scss", 102 | ], 103 | "scripts": [] 104 | } 105 | }, 106 | "lint": { 107 | "builder": "@angular-devkit/build-angular:tslint", 108 | "options": { 109 | "tsConfig": [ 110 | "tsconfig.app.json", 111 | "tsconfig.spec.json", 112 | "e2e/tsconfig.json" 113 | ], 114 | "exclude": [ 115 | "**/node_modules/**" 116 | ] 117 | } 118 | }, 119 | "e2e": { 120 | "builder": "@angular-devkit/build-angular:protractor", 121 | "options": { 122 | "protractorConfig": "e2e/protractor.conf.js", 123 | "devServerTarget": "client-angular:serve" 124 | }, 125 | "configurations": { 126 | "production": { 127 | "devServerTarget": "client-angular:serve:production" 128 | } 129 | } 130 | } 131 | } 132 | }}, 133 | "defaultProject": "client-angular" 134 | } 135 | --------------------------------------------------------------------------------