Skip to content
Snippets Groups Projects
Commit a39d5ff5 authored by Callari, Roberto's avatar Callari, Roberto
Browse files

removed unnecessary

parent bb04ee0e
No related branches found
No related tags found
No related merge requests found
Showing
with 0 additions and 356 deletions
...@@ -9,50 +9,16 @@ import { throwIfAlreadyLoaded } from './module-import-guard'; ...@@ -9,50 +9,16 @@ import { throwIfAlreadyLoaded } from './module-import-guard';
import { import {
AnalyticsService, AnalyticsService,
LayoutService, LayoutService,
PlayerService,
SeoService, SeoService,
StateService, StateService,
} from './utils'; } from './utils';
import { UserData } from './data/users'; import { UserData } from './data/users';
import { ElectricityData } from './data/electricity';
import { SmartTableData } from './data/smart-table';
import { UserActivityData } from './data/user-activity'; import { UserActivityData } from './data/user-activity';
import { OrdersChartData } from './data/orders-chart';
import { ProfitChartData } from './data/profit-chart';
import { TrafficListData } from './data/traffic-list';
import { EarningData } from './data/earning';
import { OrdersProfitChartData } from './data/orders-profit-chart';
import { TrafficBarData } from './data/traffic-bar';
import { ProfitBarAnimationChartData } from './data/profit-bar-animation-chart';
import { TemperatureHumidityData } from './data/temperature-humidity';
import { SolarData } from './data/solar';
import { TrafficChartData } from './data/traffic-chart';
import { StatsBarData } from './data/stats-bar';
import { CountryOrderData } from './data/country-order';
import { StatsProgressBarData } from './data/stats-progress-bar';
import { VisitorsAnalyticsData } from './data/visitors-analytics'; import { VisitorsAnalyticsData } from './data/visitors-analytics';
import { SecurityCamerasData } from './data/security-cameras';
import { UserService } from './mock/users.service'; import { UserService } from './mock/users.service';
import { ElectricityService } from './mock/electricity.service';
import { SmartTableService } from './mock/smart-table.service';
import { UserActivityService } from './mock/user-activity.service'; import { UserActivityService } from './mock/user-activity.service';
import { OrdersChartService } from './mock/orders-chart.service';
import { ProfitChartService } from './mock/profit-chart.service';
import { TrafficListService } from './mock/traffic-list.service';
import { EarningService } from './mock/earning.service';
import { OrdersProfitChartService } from './mock/orders-profit-chart.service';
import { TrafficBarService } from './mock/traffic-bar.service';
import { ProfitBarAnimationChartService } from './mock/profit-bar-animation-chart.service';
import { TemperatureHumidityService } from './mock/temperature-humidity.service';
import { SolarService } from './mock/solar.service';
import { TrafficChartService } from './mock/traffic-chart.service';
import { StatsBarService } from './mock/stats-bar.service';
import { CountryOrderService } from './mock/country-order.service';
import { StatsProgressBarService } from './mock/stats-progress-bar.service';
import { VisitorsAnalyticsService } from './mock/visitors-analytics.service'; import { VisitorsAnalyticsService } from './mock/visitors-analytics.service';
import { SecurityCamerasService } from './mock/security-cameras.service';
import { RippleService } from './utils/ripple.service';
import { MockDataModule } from './mock/mock-data.module'; import { MockDataModule } from './mock/mock-data.module';
const socialLinks = [ const socialLinks = [
...@@ -75,25 +41,8 @@ const socialLinks = [ ...@@ -75,25 +41,8 @@ const socialLinks = [
const DATA_SERVICES = [ const DATA_SERVICES = [
{ provide: UserData, useClass: UserService }, { provide: UserData, useClass: UserService },
{ provide: ElectricityData, useClass: ElectricityService },
{ provide: SmartTableData, useClass: SmartTableService },
{ provide: UserActivityData, useClass: UserActivityService }, { provide: UserActivityData, useClass: UserActivityService },
{ provide: OrdersChartData, useClass: OrdersChartService },
{ provide: ProfitChartData, useClass: ProfitChartService },
{ provide: TrafficListData, useClass: TrafficListService },
{ provide: EarningData, useClass: EarningService },
{ provide: OrdersProfitChartData, useClass: OrdersProfitChartService },
{ provide: TrafficBarData, useClass: TrafficBarService },
{ provide: ProfitBarAnimationChartData, useClass: ProfitBarAnimationChartService },
{ provide: TemperatureHumidityData, useClass: TemperatureHumidityService },
{ provide: SolarData, useClass: SolarService },
{ provide: TrafficChartData, useClass: TrafficChartService },
{ provide: StatsBarData, useClass: StatsBarService },
{ provide: CountryOrderData, useClass: CountryOrderService },
{ provide: StatsProgressBarData, useClass: StatsProgressBarService },
{ provide: VisitorsAnalyticsData, useClass: VisitorsAnalyticsService }, { provide: VisitorsAnalyticsData, useClass: VisitorsAnalyticsService },
{ provide: SecurityCamerasData, useClass: SecurityCamerasService },
{provide: MAT_RIPPLE_GLOBAL_OPTIONS, useExisting: RippleService},
]; ];
export class NbSimpleRoleProvider extends NbRoleProvider { export class NbSimpleRoleProvider extends NbRoleProvider {
...@@ -143,7 +92,6 @@ export const NB_CORE_PROVIDERS = [ ...@@ -143,7 +92,6 @@ export const NB_CORE_PROVIDERS = [
}, },
AnalyticsService, AnalyticsService,
LayoutService, LayoutService,
PlayerService,
SeoService, SeoService,
StateService, StateService,
]; ];
......
import { Observable } from 'rxjs';
export abstract class CountryOrderData {
abstract getCountriesCategories(): Observable<string[]>;
abstract getCountriesCategoriesData(country: string): Observable<number[]>;
}
import { Observable } from 'rxjs';
export interface LiveUpdateChart {
liveChart: { value: [string, number] }[];
delta: {
up: boolean;
value: number;
};
dailyIncome: number;
}
export interface PieChart {
value: number;
name: string;
}
export abstract class EarningData {
abstract getEarningLiveUpdateCardData(currency: string): Observable<any[]>;
abstract getEarningCardData(currency: string): Observable<LiveUpdateChart>;
abstract getEarningPieChartData(): Observable<PieChart[]>;
}
import { Observable } from 'rxjs';
export interface Month {
month: string;
delta: string;
down: boolean;
kWatts: string;
cost: string;
}
export interface Electricity {
title: string;
active?: boolean;
months: Month[];
}
export interface ElectricityChart {
label: string;
value: number;
}
export abstract class ElectricityData {
abstract getListData(): Observable<Electricity[]>;
abstract getChartData(): Observable<ElectricityChart[]>;
}
export interface OrdersChart {
chartLabel: string[];
linesData: number[][];
}
export abstract class OrdersChartData {
abstract getOrdersChartData(period: string): OrdersChart;
}
import { Observable } from 'rxjs';
import { OrdersChart } from './orders-chart';
import { ProfitChart } from './profit-chart';
export interface OrderProfitChartSummary {
title: string;
value: number;
}
export abstract class OrdersProfitChartData {
abstract getOrderProfitChartSummary(): Observable<OrderProfitChartSummary[]>;
abstract getOrdersChartData(period: string): Observable<OrdersChart>;
abstract getProfitChartData(period: string): Observable<ProfitChart>;
}
import { Observable } from 'rxjs';
export abstract class ProfitBarAnimationChartData {
abstract getChartData(): Observable<{ firstLine: number[]; secondLine: number[]; }>;
}
export interface ProfitChart {
chartLabel: string[];
data: number[][];
}
export abstract class ProfitChartData {
abstract getProfitChartData(period: string): ProfitChart;
}
import { Observable } from 'rxjs';
export interface Camera {
title: string;
source: string;
}
export abstract class SecurityCamerasData {
abstract getCamerasData(): Observable<Camera[]>;
}
export abstract class SmartTableData {
abstract getData(): any[];
}
import { Observable } from 'rxjs';
export abstract class SolarData {
abstract getSolarData(): Observable<number>;
}
import { Observable } from 'rxjs';
export abstract class StatsBarData {
abstract getStatsBarData(): Observable<number[]>;
}
import { Observable } from 'rxjs';
export interface ProgressInfo {
title: string;
value: number;
activeProgress: number;
description: string;
}
export abstract class StatsProgressBarData {
abstract getProgressInfoData(): Observable<ProgressInfo[]>;
}
import { Observable } from 'rxjs';
export interface Temperature {
value: number;
min: number;
max: number;
}
export abstract class TemperatureHumidityData {
abstract getTemperatureData(): Observable<Temperature>;
abstract getHumidityData(): Observable<Temperature>;
}
import { Observable } from 'rxjs';
export interface TrafficBar {
data: number[];
labels: string[];
formatter: string;
}
export abstract class TrafficBarData {
abstract getTrafficBarData(period: string): Observable<TrafficBar>;
}
import { Observable } from 'rxjs';
export abstract class TrafficChartData {
abstract getTrafficChartData(): Observable<number[]>;
}
import { Observable } from 'rxjs';
export interface TrafficList {
date: string;
value: number;
delta: {
up: boolean;
value: number;
};
comparison: {
prevDate: string;
prevValue: number;
nextDate: string;
nextValue: number;
};
}
export abstract class TrafficListData {
abstract getTrafficListData(period: string): Observable<TrafficList>;
}
Application-wise data providers.
import { Injectable } from '@angular/core';
import { of as observableOf, Observable } from 'rxjs';
import { CountryOrderData } from '../data/country-order';
@Injectable()
export class CountryOrderService extends CountryOrderData {
private countriesCategories = [
'Sofas',
'Furniture',
'Lighting',
'Tables',
'Textiles',
];
private countriesCategoriesLength = this.countriesCategories.length;
private generateRandomData(nPoints: number): number[] {
return Array.from(Array(nPoints)).map(() => {
return Math.round(Math.random() * 20);
});
}
getCountriesCategories(): Observable<string[]> {
return observableOf(this.countriesCategories);
}
getCountriesCategoriesData(country: string): Observable<number[]> {
return observableOf(this.generateRandomData(this.countriesCategoriesLength));
}
}
import { Injectable } from '@angular/core';
import { of as observableOf, Observable } from 'rxjs';
import { LiveUpdateChart, PieChart, EarningData } from '../data/earning';
@Injectable()
export class EarningService extends EarningData {
private currentDate: Date = new Date();
private currentValue = Math.random() * 1000;
private ONE_DAY = 24 * 3600 * 1000;
private pieChartData = [
{
value: 50,
name: 'Bitcoin',
},
{
value: 25,
name: 'Tether',
},
{
value: 25,
name: 'Ethereum',
},
];
private liveUpdateChartData = {
bitcoin: {
liveChart: [],
delta: {
up: true,
value: 4,
},
dailyIncome: 45895,
},
tether: {
liveChart: [],
delta: {
up: false,
value: 9,
},
dailyIncome: 5862,
},
ethereum: {
liveChart: [],
delta: {
up: false,
value: 21,
},
dailyIncome: 584,
},
};
getDefaultLiveChartData(elementsNumber: number) {
this.currentDate = new Date();
this.currentValue = Math.random() * 1000;
return Array.from(Array(elementsNumber))
.map(item => this.generateRandomLiveChartData());
}
generateRandomLiveChartData() {
this.currentDate = new Date(+this.currentDate + this.ONE_DAY);
this.currentValue = this.currentValue + Math.random() * 20 - 11;
if (this.currentValue < 0) {
this.currentValue = Math.random() * 100;
}
return {
value: [
[
this.currentDate.getFullYear(),
this.currentDate.getMonth(),
this.currentDate.getDate(),
].join('/'),
Math.round(this.currentValue),
],
};
}
getEarningLiveUpdateCardData(currency): Observable<any[]> {
const data = this.liveUpdateChartData[currency.toLowerCase()];
const newValue = this.generateRandomLiveChartData();
data.liveChart.shift();
data.liveChart.push(newValue);
return observableOf(data.liveChart);
}
getEarningCardData(currency: string): Observable<LiveUpdateChart> {
const data = this.liveUpdateChartData[currency.toLowerCase()];
data.liveChart = this.getDefaultLiveChartData(150);
return observableOf(data);
}
getEarningPieChartData(): Observable<PieChart[]> {
return observableOf(this.pieChartData);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment