mirror of
https://github.com/SuiteCRM/SuiteCRM-Core.git
synced 2025-08-29 11:00:40 +08:00
Implement chart loading splash
This commit is contained in:
parent
c2b92c8967
commit
573fed6d2b
5 changed files with 40 additions and 15 deletions
|
@ -30,19 +30,17 @@ import {AppManagerModule} from '../app-manager/app-manager.module';
|
|||
|
||||
import {environment} from '../environments/environment';
|
||||
import {FetchPolicy} from 'apollo-client/core/watchQueryOptions';
|
||||
import {FullPageSpinnerComponent} from '@components/full-page-spinner/full-page-spinner.component';
|
||||
import {RouteReuseStrategy} from '@angular/router';
|
||||
import {AppRouteReuseStrategy} from './app-router-reuse-strategy';
|
||||
import {ImageModule} from '@components/image/image.module';
|
||||
import {AuthService} from '@services/auth/auth.service';
|
||||
import {GraphQLError} from 'graphql';
|
||||
|
||||
import {FullPageSpinnerModule} from '@components/full-page-spinner/full-page-spinner.module';
|
||||
import {BnNgIdleService} from 'bn-ng-idle';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AppComponent,
|
||||
FullPageSpinnerComponent
|
||||
AppComponent
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
|
@ -67,6 +65,7 @@ import {BnNgIdleService} from 'bn-ng-idle';
|
|||
ImageModule,
|
||||
BrowserAnimationsModule,
|
||||
NgbModule,
|
||||
FullPageSpinnerModule
|
||||
],
|
||||
providers: [
|
||||
{provide: HTTP_INTERCEPTORS, useClass: ErrorInterceptor, multi: true},
|
||||
|
|
|
@ -8,14 +8,17 @@
|
|||
</select>
|
||||
</form>
|
||||
<div class="col-xs">
|
||||
<scrm-dropdown-button *ngIf="false" [config]="getDropdownConfig()"></scrm-dropdown-button>
|
||||
<scrm-vertical-bar-chart *ngIf="type === 'bar' && dataSource"
|
||||
[dataSource]="dataSource"></scrm-vertical-bar-chart>
|
||||
<scrm-pie-grid-chart *ngIf="type === 'pie-grid' && dataSource"
|
||||
[dataSource]="dataSource"></scrm-pie-grid-chart>
|
||||
<scrm-line-chart *ngIf="type === 'line' && dataSource"
|
||||
<ng-container *ngIf="(appState$ | async) as appState">
|
||||
<app-full-page-spinner *ngIf="appState.loading"></app-full-page-spinner>
|
||||
<scrm-dropdown-button *ngIf="false" [config]="getDropdownConfig()"></scrm-dropdown-button>
|
||||
<scrm-vertical-bar-chart *ngIf="type === 'bar' && dataSource"
|
||||
[dataSource]="dataSource"></scrm-vertical-bar-chart>
|
||||
<scrm-pie-grid-chart *ngIf="type === 'pie-grid' && dataSource"
|
||||
[dataSource]="dataSource"></scrm-pie-grid-chart>
|
||||
<scrm-line-chart *ngIf="type === 'line' && dataSource"
|
||||
[dataSource]="dataSource"></scrm-line-chart>
|
||||
<p *ngIf="!dataSource" class="lead text-center pt-3">Chart not found</p>
|
||||
<p *ngIf="!dataSource" class="lead text-center pt-3">Chart not found</p>
|
||||
</ng-container>
|
||||
</div>
|
||||
<div class="donut-chart col-xs" *ngIf="false">
|
||||
<div class="accordion">
|
||||
|
@ -24,4 +27,4 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -7,6 +7,7 @@ import {DropdownButtonInterface} from '@components/dropdown-button/dropdown-butt
|
|||
import {PipelineBySalesStage} from '@components/chart/types/pipeline-by-sales-stage/pipeline-by-sales-stage.service';
|
||||
import {AccountTypesPerMonthLineChart} from '@components/chart/types/account-types-per-month/account-types-per-month.service';
|
||||
import {LeadsByStatus} from '@components/chart/types/leads-by-status/leads-by-status.service';
|
||||
import {AppState, AppStateStore} from '@store/app-state/app-state.store';
|
||||
|
||||
export interface ChartTypesDataSource {
|
||||
getChartTypes(): Observable<ChartTypesMap>;
|
||||
|
@ -24,19 +25,20 @@ export interface ChartsViewModel {
|
|||
providers: [PipelineBySalesStage, AccountTypesPerMonthLineChart, LeadsByStatus]
|
||||
})
|
||||
export class ChartUiComponent {
|
||||
appState$: Observable<AppState> = this.appStateStore.vm$;
|
||||
type = '';
|
||||
chartKey = '';
|
||||
chartLabel = '';
|
||||
dataSource;
|
||||
private dataSourceMap: { [key: string]: any } = {};
|
||||
|
||||
|
||||
constructor(
|
||||
protected languageStore: LanguageStore,
|
||||
protected listStore: ListViewStore,
|
||||
protected pipelineBySalesStage: PipelineBySalesStage,
|
||||
protected accountTypesPerMonth: AccountTypesPerMonthLineChart,
|
||||
protected leadsByStatus: LeadsByStatus
|
||||
protected leadsByStatus: LeadsByStatus,
|
||||
private appStateStore: AppStateStore
|
||||
) {
|
||||
this.dataSourceMap[this.pipelineBySalesStage.key] = this.pipelineBySalesStage;
|
||||
this.dataSourceMap[this.accountTypesPerMonth.key] = this.accountTypesPerMonth;
|
||||
|
|
|
@ -13,6 +13,7 @@ import {NgxChartsModule} from '@swimlane/ngx-charts';
|
|||
import {VerticalBarChartComponent} from './charts/vertical-bar-chart/vertical-bar-chart.component';
|
||||
import {LineChartComponent} from '@components/chart/charts/line-chart/line-chart.component';
|
||||
import {PieGridChartComponent} from './charts/pie-grid-chart/pie-grid-chart.component';
|
||||
import {FullPageSpinnerModule} from '@components/full-page-spinner/full-page-spinner.module';
|
||||
|
||||
@NgModule({
|
||||
declarations: [ChartUiComponent, VerticalBarChartComponent, LineChartComponent, PieGridChartComponent],
|
||||
|
@ -26,7 +27,8 @@ import {PieGridChartComponent} from './charts/pie-grid-chart/pie-grid-chart.comp
|
|||
BrowserModule,
|
||||
FormsModule,
|
||||
NgxChartsModule,
|
||||
BrowserAnimationsModule
|
||||
BrowserAnimationsModule,
|
||||
FullPageSpinnerModule
|
||||
]
|
||||
})
|
||||
export class ChartUiModule {
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
import {NgModule} from '@angular/core';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {AngularSvgIconModule} from 'angular-svg-icon';
|
||||
import {FullPageSpinnerComponent} from '@components/full-page-spinner/full-page-spinner.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
FullPageSpinnerComponent
|
||||
],
|
||||
exports: [
|
||||
FullPageSpinnerComponent
|
||||
],
|
||||
imports: [
|
||||
CommonModule,
|
||||
AngularSvgIconModule
|
||||
]
|
||||
})
|
||||
export class FullPageSpinnerModule {
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue