-
Notifications
You must be signed in to change notification settings - Fork 8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(data): update data module, add new mock data (#1960)
- Loading branch information
Showing
53 changed files
with
635 additions
and
256 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { of as observableOf, Observable } from 'rxjs'; | ||
|
||
@Injectable() | ||
export class CountryOrderService { | ||
|
||
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(): Observable<number[]> { | ||
return observableOf(this.generateRandomData(this.countriesCategoriesLength)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { of as observableOf, Observable } from 'rxjs'; | ||
|
||
export class Camera { | ||
title: string; | ||
source: string; | ||
} | ||
|
||
@Injectable() | ||
export class SecurityCamerasService { | ||
|
||
private cameras: Camera[] = [ | ||
{ | ||
title: 'Camera #1', | ||
source: 'assets/images/camera1.jpg', | ||
}, | ||
{ | ||
title: 'Camera #2', | ||
source: 'assets/images/camera2.jpg', | ||
}, | ||
{ | ||
title: 'Camera #3', | ||
source: 'assets/images/camera3.jpg', | ||
}, | ||
{ | ||
title: 'Camera #4', | ||
source: 'assets/images/camera4.jpg', | ||
}, | ||
]; | ||
|
||
getCamerasData(): Observable<Camera[]> { | ||
return observableOf(this.cameras); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { of as observableOf, Observable } from 'rxjs'; | ||
|
||
@Injectable() | ||
export class SolarService { | ||
private value = 42; | ||
|
||
getSolarData(): Observable<number> { | ||
return observableOf(this.value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { of as observableOf, Observable } from 'rxjs'; | ||
|
||
@Injectable() | ||
export class StatsBarService { | ||
|
||
private statsBarData: number[] = [ | ||
300, 520, 435, 530, | ||
730, 620, 660, 860, | ||
]; | ||
|
||
getStatsBarData(): Observable<number[]> { | ||
return observableOf(this.statsBarData); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { of as observableOf, Observable } from 'rxjs'; | ||
|
||
export class ProgressInfo { | ||
title: string; | ||
value: number; | ||
activeProgress: number; | ||
description: string; | ||
} | ||
|
||
@Injectable() | ||
export class StatsProgressBarService { | ||
private progressInfoData: ProgressInfo[] = [ | ||
{ | ||
title: 'Today’s Profit', | ||
value: 572900, | ||
activeProgress: 70, | ||
description: 'Better than last week (70%)', | ||
}, | ||
{ | ||
title: 'New Orders', | ||
value: 6378, | ||
activeProgress: 30, | ||
description: 'Better than last week (30%)', | ||
}, | ||
{ | ||
title: 'New Comments', | ||
value: 200, | ||
activeProgress: 55, | ||
description: 'Better than last week (55%)', | ||
}, | ||
]; | ||
|
||
getProgressInfoData(): Observable<ProgressInfo[]> { | ||
return observableOf(this.progressInfoData); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { of as observableOf, Observable } from 'rxjs'; | ||
|
||
export class Temperature { | ||
value: number; | ||
min: number; | ||
max: number; | ||
} | ||
|
||
@Injectable() | ||
export class TemperatureHumidityService { | ||
|
||
private temperatureDate: Temperature = { | ||
value: 24, | ||
min: 12, | ||
max: 30, | ||
}; | ||
|
||
private humidityDate: Temperature = { | ||
value: 87, | ||
min: 0, | ||
max: 100, | ||
}; | ||
|
||
getTemperatureData(): Observable<Temperature> { | ||
return observableOf(this.temperatureDate); | ||
} | ||
|
||
getHumidityData(): Observable<Temperature> { | ||
return observableOf(this.humidityDate); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { of as observableOf, Observable } from 'rxjs'; | ||
|
||
|
||
@Injectable() | ||
export class TrafficChartService { | ||
|
||
private data: number[] = [ | ||
300, 520, 435, 530, | ||
730, 620, 660, 860, | ||
]; | ||
|
||
getTrafficChartData(): Observable<number[]> { | ||
return observableOf(this.data); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.