diff --git a/bin/build-releases b/bin/build-releases index f7f5334..bb16744 100755 --- a/bin/build-releases +++ b/bin/build-releases @@ -12,13 +12,13 @@ echo "Building releases for $VERSION" echo "Building Prod Release..." -ng build --prod +ng build --configuration=prod tar -czf ../WebApp-Releases/LocalLoop-Web-prod-$VERSION.tar.gz dist echo "Building Dev Release..." -ng build --dev +ng build --configuration=dev tar -czf ../WebApp-Releases/LocalLoop-Web-dev-$VERSION.tar.gz dist diff --git a/package.json b/package.json index d5348ee..b4b0703 100644 --- a/package.json +++ b/package.json @@ -9,8 +9,10 @@ "ng": "ng", "start": "ng serve", "start:dev": "ng serve --optimization=false --configuration=dev", + "start:prod": "ng serve --optimization=false --configuration=prod", "start:local": "ng serve --optimization=false --configuration=local", - "build": "ng build", + "build:dev": "ng build --configuration=dev", + "build:prod": "ng build --configuration=prod", "test": "ng test", "test:ci": "ng test --watch=false", "lint": "ng lint", diff --git a/src/app/dashboard/more-graphs-and-tables.component.ts b/src/app/dashboard/more-graphs-and-tables.component.ts index 1e41ad8..2de09b7 100644 --- a/src/app/dashboard/more-graphs-and-tables.component.ts +++ b/src/app/dashboard/more-graphs-and-tables.component.ts @@ -38,7 +38,7 @@ export class MoreStuffComponent implements OnInit { this.loadData(); } - private loadData() { + public loadData() { this.tableSummary(); this.loadYearSpend(); this.loadSupplierBubble(); @@ -284,8 +284,8 @@ export class MoreStuffComponent implements OnInit { private _supplierHistoryData: any[]; private _supplierHistoryPerPage: number = 15; - private _supplierHistoryPage: number = 1; - private _supplierHistoryPages: number = 1; + public _supplierHistoryPage: number = 1; + public _supplierHistoryPages: number = 1; public supplierMonthChartData: any[] = [ { data: [], diff --git a/src/app/panels/candlestick.component.html b/src/app/panels/candlestick.component.html deleted file mode 100644 index 9aa9cb5..0000000 --- a/src/app/panels/candlestick.component.html +++ /dev/null @@ -1,19 +0,0 @@ -
-
-
-
-

All Purchases

-
-
-
- -
-
-
- \ No newline at end of file diff --git a/src/app/panels/candlestick.component.ts b/src/app/panels/candlestick.component.ts deleted file mode 100644 index 4f8d3c0..0000000 --- a/src/app/panels/candlestick.component.ts +++ /dev/null @@ -1,84 +0,0 @@ -import { Component, OnInit, ViewChild } from '@angular/core'; -import 'dist/chartjs-chart-financial/chartjs-chart-financial'; -import * as luxon from 'luxon'; -import 'chartjs-adapter-luxon'; -import { ChartOptions } from 'chart.js'; -import { Color, BaseChartDirective } from 'ng2-charts'; - -@Component({ - selector: 'app-financial-chart', - templateUrl: './financial-chart.component.html', - styleUrls: ['./financial-chart.component.css'] -}) -export class FinancialChartComponent implements OnInit { - barCount = 60; - initialDateStr = '01 Apr 2017 00:00 Z'; - - public financialChartData = [ - { - label: 'CHRT - Chart.js Corporation', - data: this.getRandomData(this.initialDateStr, this.barCount) - }, - ]; - public financialChartOptions: ChartOptions = { - responsive: true, - maintainAspectRatio: false, - }; - public financialChartColors: Color[] = [ - { - borderColor: 'black', - backgroundColor: 'rgba(255,0,0,0.3)', - }, - ]; - public financialChartLegend : Boolean; - public chartLegend : Boolean; - public financialChartType = 'candlestick'; - public chartType : string; - public financialChartPlugins = []; - - @ViewChild(BaseChartDirective, { static: true }) chart: BaseChartDirective; - - constructor() { } - - ngOnInit() { - this.financialChartType = 'candlestick'; - this.chartType=this.financialChartType; - - this.financialChartLegend = this.chartLegend; - } - - randomNumber(min: number, max: number) { - return Math.random() * (max - min) + min; - } - - randomBar(date: luxon.DateTime, lastClose: number) { - const open = this.randomNumber(lastClose * 0.95, lastClose * 1.05); - const close = this.randomNumber(open * 0.95, open * 1.05); - const high = this.randomNumber(Math.max(open, close), Math.max(open, close) * 1.1); - const low = this.randomNumber(Math.min(open, close) * 0.9, Math.min(open, close)); - return { - t: date.valueOf(), - o: open, - h: high, - l: low, - c: close - }; - } - - getRandomData(dateStr: string, count: number) { - let date = luxon.DateTime.fromRFC2822(dateStr); - const data = [this.randomBar(date, 30)]; - while (data.length < count) { - date = date.plus({ days: 1 }); - if (date.weekday <= 5) { - data.push(this.randomBar(date, data[data.length - 1].c)); - } - } - return data; - } - - update() { - // candlestick vs ohlc - this.financialChartType = this.financialChartType === 'candlestick' ? 'ohlc' : 'candlestick'; - } -} \ No newline at end of file diff --git a/src/app/panels/polar-panel.component.html b/src/app/panels/polar-panel.component.html deleted file mode 100644 index 9aa9cb5..0000000 --- a/src/app/panels/polar-panel.component.html +++ /dev/null @@ -1,19 +0,0 @@ -
-
-
-
-

All Purchases

-
-
-
- -
-
-
- \ No newline at end of file diff --git a/src/app/panels/polar-panel.component.ts b/src/app/panels/polar-panel.component.ts deleted file mode 100644 index e698fb4..0000000 --- a/src/app/panels/polar-panel.component.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; -import { SingleDataSet, Label } from 'ng2-charts'; -import { ChartType } from 'chart.js'; -import { ApiService } from '../providers/api-service'; -import { CustPiesService } from '../providers/cust-pies.service'; -import { DataType } from '../shared/data-types.enum'; -import { ChartData } from '../_interfaces/chart-data'; - -@Component({ - selector: 'polar-area', - templateUrl: 'polar-panel.component.html', -}) - -export class PolarAreaChartComponent implements OnInit { - // PolarArea - - public chartType : 'polar-area'; - public polarAreaChartLabels: Label[]; - public polarAreaChartData: SingleDataSet; - public chartLegend : Boolean; - public polarAreaLegend : Boolean; - - public polarChartLabelsLocal: string[] = []; - public polarChartDataLocal: number[] = []; - - public polarAreaChartType: ChartType = 'polarArea'; - - constructor( - private api: ApiService, - private pieService: CustPiesService, - ) { - this.pieService.getPie().subscribe( - result => { - this.setChartData(result.local_all); - }, - error => { - console.log('Retrieval Error'); - console.log( error._body ); - } - ); - } - - ngOnInit() { - this.polarAreaLegend = this.chartLegend; - this.polarAreaLegend = true; - } - - private setChartData(dataLocal: any) { - this.polarChartDataLocal = Object.keys(dataLocal).map(key => dataLocal[key]); - // setTimeout is currently a workaround for ng2-charts labels - setTimeout(() => this.polarChartLabelsLocal = Object.keys(dataLocal), 0); - } - - public convertHex(hex: string, opacity: number) { - hex = hex.replace('#', ''); - const r = parseInt(hex.substring(0, 2), 16); - const g = parseInt(hex.substring(2, 4), 16); - const b = parseInt(hex.substring(4, 6), 16); - - const rgba = 'rgba(' + r + ', ' + g + ', ' + b + ', ' + opacity / 100 + ')'; - return rgba; - } - - // events - public chartClicked({ event, active }: { event: MouseEvent, active: {}[] }): void { - console.log(event, active); - } - - public chartHovered({ event, active }: { event: MouseEvent, active: {}[] }): void { - console.log(event, active); - } -} \ No newline at end of file diff --git a/src/app/panels/stacked-bar.component.html.broken b/src/app/panels/stacked-bar.component.html.broken deleted file mode 100644 index 8a95a2e..0000000 --- a/src/app/panels/stacked-bar.component.html.broken +++ /dev/null @@ -1,19 +0,0 @@ -
-
-
-
-

All Purchases

-
-
-
- -
-
-
- \ No newline at end of file diff --git a/src/app/panels/stacked-bar.component.ts.broken b/src/app/panels/stacked-bar.component.ts.broken deleted file mode 100644 index 3987dc5..0000000 --- a/src/app/panels/stacked-bar.component.ts.broken +++ /dev/null @@ -1,68 +0,0 @@ -import { NgModule, enableProdMode } from '@angular/core'; -import { BrowserModule } from '@angular/platform-browser'; -import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; -import { ApiService } from '../providers/api-service'; -import { CustPiesService } from '../providers/cust-pies.service'; -import { DataType } from '../shared/data-types.enum'; -import { ChartData } from '../_interfaces/chart-data'; -import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; - -import { DxChartModule } from 'devextreme-angular'; - -if(!/localhost/.test(document.location.host)) { - enableProdMode(); -} - -@Component({ - selector: 'stacked-bar', - templateUrl: 'stacked-bar.component.html', -}) -@NgModule({ - imports: [ - BrowserModule, - DxChartModule - ], - declarations: [StackedBarChartComponent], - bootstrap: [StackedBarChartComponent] -}) -export class StackedBarChartComponent { - - public chartType: 'stacked-bar'; - public chartLegend = true; - public stackedBarChartDataLocal : number[] = []; - public stackedBarChartLabelsLocal : string[] = []; - - constructor( - private api: ApiService, - private pieService: CustPiesService, - ) { - this.pieService.getPie().subscribe( - result => { - this.setChartData(result.local_all); - }, - error => { - console.log('Retrieval Error'); - console.log( error._body ); - } - ); - } - - public ngOnInit(): void { - console.log("stacked bar graph tried to initialise"); - } - - private setChartData(dataLocal: any) { - this.stackedBarChartDataLocal = Object.keys(dataLocal).map(key => dataLocal[key]); - // setTimeout is currently a workaround for ng2-charts labels - setTimeout(() => this.stackedBarChartLabelsLocal = Object.keys(dataLocal), 0); - } - - customizeTooltip(arg: any) { - return { - text: arg.percentText + ' - ' + arg.valueText - }; - } -} - - -platformBrowserDynamic().bootstrapModule(StackedBarChartComponent); \ No newline at end of file