diff --git a/src/app/components/leaderboards.component.html b/src/app/components/leaderboards.component.html new file mode 100644 index 0000000..df82859 --- /dev/null +++ b/src/app/components/leaderboards.component.html @@ -0,0 +1,373 @@ +
+
+
+
+
+ Simple Table +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
UsernameDate registeredRoleStatus
Samppa Nori2012/01/01Member + Active +
Estavan Lykos2012/02/01Staff + Banned +
Chetan Mohamed2012/02/01Admin + Inactive +
Derick Maximinus2012/03/01Member + Pending +
Friderik Dávid2012/01/21Staff + Active +
+ +
+
+
+ +
+
+
+ Striped Table +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
UsernameDate registeredRoleStatus
Yiorgos Avraamu2012/01/01Member + Active +
Avram Tarasios2012/02/01Staff + Banned +
Quintin Ed2012/02/01Admin + Inactive +
Enéas Kwadwo2012/03/01Member + Pending +
Agapetus Tadeáš2012/01/21Staff + Active +
+ +
+
+
+ +
+ +
+
+
+
+ Condensed Table +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
UsernameDate registeredRoleStatus
Carwyn Fachtna2012/01/01Member + Active +
Nehemiah Tatius2012/02/01Staff + Banned +
Ebbe Gemariah2012/02/01Admin + Inactive +
Eustorgios Amulius2012/03/01Member + Pending +
Leopold Gáspár2012/01/21Staff + Active +
+ +
+
+
+ +
+
+
+ Bordered Table +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
UsernameDate registeredRoleStatus
Pompeius René2012/01/01Member + Active +
Paĉjo Jadon2012/02/01Staff + Banned +
Micheal Mercurius2012/02/01Admin + Inactive +
Ganesha Dubhghall2012/03/01Member + Pending +
Hiroto Šimun2012/01/21Staff + Active +
+ +
+
+
+ +
+ +
+
+
+
+ Combined All Table +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
UsernameDate registeredRoleStatus
Vishnu Serghei2012/01/01Member + Active +
Zbyněk Phoibos2012/02/01Staff + Banned +
Einar Randall2012/02/01Admin + Inactive +
Félix Troels2012/03/01Member + Pending +
Aulus Agmundr2012/01/21Staff + Active +
+ +
+
+
+ +
+ +
diff --git a/src/app/components/leaderboards.component.ts b/src/app/components/leaderboards.component.ts new file mode 100644 index 0000000..a28f08b --- /dev/null +++ b/src/app/components/leaderboards.component.ts @@ -0,0 +1,46 @@ +import { Component } from '@angular/core'; +import { Http, Response } from '@angular/http'; +import { ApiService } from '../providers/api-service'; +import 'rxjs/add/operator/map'; + +@Component({ + templateUrl: 'leaderboards.component.html', + providers: [ApiService] +}) +export class LeaderboardsComponent { + + constructor( + private http: Http, + private formBuilder: FormBuilder, + private api: ApiService, + ) { + } + + ngOnInit() { + this.api + // get daily total + .leaderboard_fetch('daily_total') + .subscribe( + result => { + console.log('got daily weekly leaderboard!'); + console.log(result); + }, + error => { + console.log( error._body ); + } + ); + this.api + // get daily count + .leaderboard_fetch('daily_count') + .subscribe( + result => { + console.log('got daily count leaderboard!'); + console.log(result); + }, + error => { + console.log( error._body ); + } + ); + } + +} diff --git a/src/app/providers/api-service.ts b/src/app/providers/api-service.ts index 79b5fc3..94ae507 100644 --- a/src/app/providers/api-service.ts +++ b/src/app/providers/api-service.ts @@ -74,82 +74,12 @@ export class ApiService { // Leaderboard Api - private leaderboard_daily_total() { - return this.http.post( + public leaderboard_fetch(data) { + this.http.post( this.apiUrl + '/stats/leaderboard', { session_key : this.sessionKey, - type : 'daily_total' - } - ).map( response => response.json() ); - } - - private leaderboard_daily_count() { - return this.http.post( - this.apiUrl + '/stats/leaderboard', - { - session_key : this.sessionKey, - type : 'daily_count' - } - ).map( response => response.json() ); - } - - private leaderboard_weekly_total() { - return this.http.post( - this.apiUrl + '/stats/leaderboard', - { - session_key : this.sessionKey, - type : 'weekly_total' - } - ).map( response => response.json() ); - } - - private leaderboard_weekly_count() { - return this.http.post( - this.apiUrl + '/stats/leaderboard', - { - session_key : this.sessionKey, - type : 'weekly_count' - } - ).map( response => response.json() ); - } - - private leaderboard_monthly_total() { - return this.http.post( - this.apiUrl + '/stats/leaderboard', - { - session_key : this.sessionKey, - type : 'monthly_total' - } - ).map( response => response.json() ); - } - - private leaderboard_monthly_count() { - return this.http.post( - this.apiUrl + '/stats/leaderboard', - { - session_key : this.sessionKey, - type : 'monthly_count' - } - ).map( response => response.json() ); - } - - private leaderboard_all_time_total() { - return this.http.post( - this.apiUrl + '/stats/leaderboard', - { - session_key : this.sessionKey, - type : 'all_time_total' - } - ).map( response => response.json() ); - } - - private leaderboard_all_time_count() { - return this.http.post( - this.apiUrl + '/stats/leaderboard', - { - session_key : this.sessionKey, - type : 'all_time_count' + type : data } ).map( response => response.json() ); }