dashborad total counts from server
This commit is contained in:
parent
66447e29e9
commit
d134efcb55
|
@ -104,12 +104,13 @@ import { SharedModule } from './shared/shared.module';
|
||||||
import { MaterialModule } from './shared/material/material.module';
|
import { MaterialModule } from './shared/material/material.module';
|
||||||
import { AuthService } from './services/auth/auth.service';
|
import { AuthService } from './services/auth/auth.service';
|
||||||
import { ProjectListingComponent } from './projects/project-listing.component';
|
import { ProjectListingComponent } from './projects/project-listing.component';
|
||||||
|
import { DashboardService } from './services/dashboard/dashboard.service';
|
||||||
import { BaseHttpService } from './utilities/cite-http-service-module/base-http.service';
|
import { BaseHttpService } from './utilities/cite-http-service-module/base-http.service';
|
||||||
import { DataManagementPlanListingComponent } from './dmps/dmp-listing.component';
|
import { DataManagementPlanListingComponent } from './dmps/dmp-listing.component';
|
||||||
import { ProjectEditorComponent } from './projects/editor/project-editor.component';
|
import { ProjectEditorComponent } from './projects/editor/project-editor.component';
|
||||||
import { DataManagementPlanEditorComponent } from './dmps/editor/dmp-editor.component';
|
import { DataManagementPlanEditorComponent } from './dmps/editor/dmp-editor.component';
|
||||||
|
|
||||||
import { FigurecardComponent } from './figurecard/figurecard.component';
|
import { FigurecardComponent } from './shared/components/figurecard/figurecard.component';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -195,7 +196,7 @@ import { FigurecardComponent } from './figurecard/figurecard.component';
|
||||||
},
|
},
|
||||||
ServerService, VisibilityRulesService, PaginationService, GlobalVariables, AuthGuard, TokenService,
|
ServerService, VisibilityRulesService, PaginationService, GlobalVariables, AuthGuard, TokenService,
|
||||||
LocalStorageService, RestBase, EestoreService, NativeLoginService, PDFService,
|
LocalStorageService, RestBase, EestoreService, NativeLoginService, PDFService,
|
||||||
AuthService,
|
AuthService,DashboardService,
|
||||||
BaseHttpService
|
BaseHttpService
|
||||||
],
|
],
|
||||||
bootstrap: [AppComponent]
|
bootstrap: [AppComponent]
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
<div class="icon">
|
<div class="icon">
|
||||||
<i class="material-icons">list</i>
|
<i class="material-icons">list</i>
|
||||||
</div>
|
</div>
|
||||||
<h3 class="card-title">52</h3>
|
<h3 class="card-title">{{dashboardStatisticsData.totalProjectCount}}</h3>
|
||||||
<p class="card-description text-center">
|
<p class="card-description text-center">
|
||||||
This is good if your company size is between 2 and 10 Persons.
|
This is good if your company size is between 2 and 10 Persons.
|
||||||
</p>
|
</p>
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
<div class="icon">
|
<div class="icon">
|
||||||
<i class="material-icons">mode_edit</i>
|
<i class="material-icons">mode_edit</i>
|
||||||
</div>
|
</div>
|
||||||
<h3 class="card-title">33</h3>
|
<h3 class="card-title">{{dashboardStatisticsData.totalDataManagementPlanCount}}</h3>
|
||||||
<p class="card-description text-center">
|
<p class="card-description text-center">
|
||||||
This is good if your company size is between 2 and 10 Persons.
|
This is good if your company size is between 2 and 10 Persons.
|
||||||
</p>
|
</p>
|
||||||
|
@ -47,7 +47,7 @@
|
||||||
<div class="icon">
|
<div class="icon">
|
||||||
<i class="material-icons">subject</i>
|
<i class="material-icons">subject</i>
|
||||||
</div>
|
</div>
|
||||||
<h3 class="card-title">3</h3>
|
<h3 class="card-title">{{dashboardStatisticsData.totalDataSetCount}}</h3>
|
||||||
<p class="card-description text-center">
|
<p class="card-description text-center">
|
||||||
This is good if your company size is between 2 and 10 Persons.
|
This is good if your company size is between 2 and 10 Persons.
|
||||||
</p>
|
</p>
|
||||||
|
@ -64,7 +64,7 @@
|
||||||
<div class="row" style="margin-top: 30px">
|
<div class="row" style="margin-top: 30px">
|
||||||
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12 col-md-offset-1">
|
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12 col-md-offset-1">
|
||||||
<app-figurecard
|
<app-figurecard
|
||||||
title="184"
|
title={{dashboardStatisticsData.totalProjectCount}}
|
||||||
headerIcon="list"
|
headerIcon="list"
|
||||||
category="Projects"
|
category="Projects"
|
||||||
footContent="open projects"
|
footContent="open projects"
|
||||||
|
@ -75,7 +75,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
|
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
|
||||||
<app-figurecard
|
<app-figurecard
|
||||||
title="75.521"
|
title={{dashboardStatisticsData.totalDataManagementPlanCount}}
|
||||||
headerIcon="mode_edit"
|
headerIcon="mode_edit"
|
||||||
category="DMPs"
|
category="DMPs"
|
||||||
footContent="open DMPs"
|
footContent="open DMPs"
|
||||||
|
@ -86,7 +86,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
|
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
|
||||||
<app-figurecard
|
<app-figurecard
|
||||||
title="+245"
|
title={{dashboardStatisticsData.totalDataSetCount}}
|
||||||
headerIcon="subject"
|
headerIcon="subject"
|
||||||
category="Datasets"
|
category="Datasets"
|
||||||
footContent="open datasets"
|
footContent="open datasets"
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { Router, ActivatedRoute } from '@angular/router';
|
import { Router, ActivatedRoute } from '@angular/router';
|
||||||
import { ServerService } from '../../app/services/server.service';
|
import { ServerService } from '../../app/services/server.service';
|
||||||
import { RestBase } from '../../app/services/rest-base';
|
import { DashboardService } from '../../app/services/dashboard/dashboard.service';
|
||||||
|
import { DashboardStatisticsModel } from '../models/dashboard/DashboardStatisticsModel';
|
||||||
|
import { JsonSerializer } from '../utilities/JsonSerializer';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'homepage',
|
selector: 'homepage',
|
||||||
|
@ -12,9 +14,12 @@ import { RestBase } from '../../app/services/rest-base';
|
||||||
export class HomepageComponent implements OnInit{
|
export class HomepageComponent implements OnInit{
|
||||||
|
|
||||||
private userInfo: any;
|
private userInfo: any;
|
||||||
|
private dashboardStatisticsData:DashboardStatisticsModel = new DashboardStatisticsModel();
|
||||||
constructor(private serverService: ServerService, private route: ActivatedRoute, private router: Router, private restbase: RestBase){
|
|
||||||
|
constructor(private serverService: ServerService, private route: ActivatedRoute, private router: Router, private dashBoardService: DashboardService){
|
||||||
|
this.dashboardStatisticsData.totalDataManagementPlanCount = 0;
|
||||||
|
this.dashboardStatisticsData.totalDataSetCount = 0;
|
||||||
|
this.dashboardStatisticsData.totalProjectCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,14 +29,14 @@ export class HomepageComponent implements OnInit{
|
||||||
this.userInfo = userInfo;
|
this.userInfo = userInfo;
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
this.dashBoardService.getStatistics().subscribe(data =>{
|
||||||
|
debugger;
|
||||||
|
this.dashboardStatisticsData = new JsonSerializer<DashboardStatisticsModel>().fromJSONObject(data,DashboardStatisticsModel);
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getStatistics(){
|
|
||||||
return this.restbase.get("datasetprofile/getAll");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
import { Serializable } from "../Serializable";
|
||||||
|
|
||||||
|
export class DashboardStatisticsModel implements Serializable<DashboardStatisticsModel>{
|
||||||
|
public totalDataManagementPlanCount: number;
|
||||||
|
public totalProjectCount: number;
|
||||||
|
public totalDataSetCount: number;
|
||||||
|
|
||||||
|
fromJSONObject(item: any): DashboardStatisticsModel {
|
||||||
|
this.totalDataManagementPlanCount = item.totalDataManagementPlanCount;
|
||||||
|
this.totalProjectCount = item.totalProjectCount;
|
||||||
|
this.totalDataSetCount = item.totalDataSetCount;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
import 'rxjs/add/operator/map';
|
||||||
|
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { HostConfiguration } from './../../app.constants';
|
||||||
|
import { BaseHttpService } from '../../utilities/cite-http-service-module/base-http.service';
|
||||||
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
import { DashboardStatisticsModel } from '../../models/dashboard/DashboardStatisticsModel';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class DashboardService {
|
||||||
|
|
||||||
|
private actionUrl: string;
|
||||||
|
private headers: HttpHeaders;
|
||||||
|
|
||||||
|
constructor(private http: BaseHttpService) {
|
||||||
|
|
||||||
|
this.actionUrl = HostConfiguration.Server + 'dashboard/';
|
||||||
|
|
||||||
|
this.headers = new HttpHeaders();
|
||||||
|
this.headers = this.headers.set('Content-Type', 'application/json');
|
||||||
|
this.headers = this.headers.set('Accept', 'application/json');
|
||||||
|
}
|
||||||
|
|
||||||
|
getStatistics(): Observable<DashboardStatisticsModel> {
|
||||||
|
return this.http.get<DashboardStatisticsModel>(this.actionUrl + 'getStatistics', { headers: this.headers });
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue