commit
893bdca736
13 changed files with 16 additions and 296 deletions
|
@ -1,16 +1,12 @@
|
|||
# Force sudo due to issue in travis
|
||||
sudo: required
|
||||
addons:
|
||||
chrome: stable
|
||||
language: node_js
|
||||
node_js:
|
||||
- 8
|
||||
- node
|
||||
before_install:
|
||||
- openssl aes-256-cbc -K $encrypted_9d2af3734b6c_key -iv $encrypted_9d2af3734b6c_iv -in src/environments/environments.tar.enc -out src/environments/environments.tar -d
|
||||
- openssl aes-256-cbc -K $encrypted_17157b34afc7_key -iv $encrypted_17157b34afc7_iv -in src/environments/environments.tar.enc -out src/environments/environments.tar -d
|
||||
- tar xf src/environments/environments.tar -C src/environments
|
||||
before_script:
|
||||
- export DISPLAY=:99.0
|
||||
- sh -e /etc/init.d/xvfb start
|
||||
- npm config set spin false
|
||||
install:
|
||||
- npm install
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ module.exports = function (config) {
|
|||
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
||||
plugins: [
|
||||
require('karma-jasmine'),
|
||||
require("readable-stream");
|
||||
require('karma-chrome-launcher'),
|
||||
require('karma-jasmine-html-reporter'),
|
||||
require('karma-coverage-istanbul-reporter'),
|
||||
|
|
|
@ -9,10 +9,12 @@
|
|||
"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",
|
||||
"test:ci": "ng test --watch=false --browsers=ChromeHeadless",
|
||||
"lint": "ng lint",
|
||||
"e2e": "ng e2e",
|
||||
"e2e:ci": "ng e2e --configuration=ci",
|
||||
|
@ -75,6 +77,7 @@
|
|||
"karma-cli": "2.0.0",
|
||||
"karma-coverage-istanbul-reporter": "^2.0.5",
|
||||
"karma-jasmine": "^2.0.1",
|
||||
"readable-stream": "latest",
|
||||
"karma-jasmine-html-reporter": "^1.4.2",
|
||||
"protractor": "^5.4.2",
|
||||
"ts-node": "^8.3.0",
|
||||
|
|
|
@ -9,7 +9,10 @@ exports.config = {
|
|||
'./e2e/**/*.e2e-spec.ts'
|
||||
],
|
||||
capabilities: {
|
||||
'browserName': 'chrome'
|
||||
'browserName': 'chrome',
|
||||
chromeOptions: {
|
||||
args: [ "--headless" ]
|
||||
}
|
||||
},
|
||||
directConnect: true,
|
||||
baseUrl: 'http://localhost:4200/',
|
||||
|
|
|
@ -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: [],
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
<div class="card">
|
||||
<div class="card-block">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h4 class="card-title mb-0">All Purchases</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="chart-wrapper">
|
||||
<canvas baseChart class="chart"
|
||||
[data]="doughnutChartDataLocal"
|
||||
[labels]="doughnutChartLabelsLocal"
|
||||
[legend]="chartLegend"
|
||||
[chartType]="chartType"
|
||||
(chartHover)="chartHovered($event)"
|
||||
(chartClick)="chartClicked($event)"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -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';
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
<div class="card">
|
||||
<div class="card-block">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h4 class="card-title mb-0">All Purchases</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="chart-wrapper">
|
||||
<canvas baseChart class="chart"
|
||||
[data]="doughnutChartDataLocal"
|
||||
[labels]="doughnutChartLabelsLocal"
|
||||
[legend]="chartLegend"
|
||||
[chartType]="chartType"
|
||||
(chartHover)="chartHovered($event)"
|
||||
(chartClick)="chartClicked($event)"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
<div class="card">
|
||||
<div class="card-block">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h4 class="card-title mb-0">All Purchases</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="chart-wrapper">
|
||||
<canvas baseChart class="chart"
|
||||
attr.[data]="doughnutChartDataLocal"
|
||||
attr.[labels]="doughnutChartLabelsLocal"
|
||||
attr.[legend]="chartLegend"
|
||||
attr.[chartType]="chartType"
|
||||
(chartHover)="chartHovered($event)"
|
||||
(chartClick)="chartClicked($event)"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -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);
|
Binary file not shown.
Reference in a new issue