Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.exence.finance.modules.statistics.repository;

import com.exence.finance.modules.statistics.entity.Widget;
import com.exence.finance.modules.statistics.dto.WidgetType;
import com.exence.finance.modules.statistics.entity.Widget;
import java.util.List;
import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ private void init() {

@Override
public WidgetLayoutResponse getLayout() {
List<Widget> widgets = widgetRepository.findAllWidgets();
List<Widget> widgets = widgetRepository.findAllWidgets().stream()
.filter(widget -> !widget.getType().equals(WidgetType.DASHBOARD_BALANCE_TREND))
.toList();

return new WidgetLayoutResponse(
widgetMapper.mapToStatCardDTOList(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import { Component, effect, inject, input, signal, viewChild } from '@angular/core';
import { DisplayGrid, Gridster, GridsterConfig, GridsterItem, GridsterItemConfig, GridType } from 'angular-gridster2';
import {
CompactType,
DisplayGrid,
Gridster,
GridsterConfig,
GridsterItem,
GridsterItemConfig,
GridType,
} from 'angular-gridster2';
import { ChartWidget } from '../../../data-model/modules/statistics/Widget';
import { ButtonComponent } from '../../../shared/button/button.component';
import { DialogService } from '../../../shared/dialog/dialog.service';
Expand Down Expand Up @@ -28,6 +36,7 @@ export class ChartWidgetListComponent {

options = signal<GridsterConfig>({
gridType: GridType.VerticalFixed,
compactType: CompactType.CompactUpAndLeft,
displayGrid: DisplayGrid.None,
fixedRowHeight: 575,
mobileBreakpoint: 768,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,14 @@ export class ChartWidgetComponent extends BaseComponent {
return;
}

this.statisticService.getWidgetData(this.widget().id, timeframe).then(response => {
const providerFn = mapToProvider<typeof response.payload>(this.type());
this.data.set(providerFn(response.payload, this.widget().title) as Partial<ApexOptions>);
this.isLoading.set(false);
});
this.statisticService
.getWidgetData(this.widget().id, timeframe)
.then(response => {
const providerFn = mapToProvider<typeof response.payload>(this.type());
this.data.set(providerFn(response.payload, this.widget().title) as Partial<ApexOptions>);
})
.catch(() => {})
.finally(() => this.isLoading.set(false));
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import * as echarts from 'echarts/core';
import { CanvasRenderer } from 'echarts/renderers';
import { EChartsOption } from 'echarts/types/dist/shared';
import { NgxEchartsDirective, provideEchartsCore } from 'ngx-echarts';
import { ChartWidget } from '../../../data-model/modules/statistics/Widget';
import { AnimatedSkeletonLoaderComponent } from '../../../shared/animated-skeleton-loader/animated-skeleton-loader.component';
import { DisplayThemeService } from '../../../shared/display-theme.service';
import { Timeframe } from '../../../data-model/modules/statistics/Timeframe';
import { mapToProvider } from '../chart-providers';
import { StatisticService } from '../statistic.service';
import { ChartWidget } from '../../../data-model/modules/statistics/Widget';
import { AnimatedSkeletonLoaderComponent } from '../../../shared/animated-skeleton-loader/animated-skeleton-loader.component';

echarts.use([SankeyChart, TooltipComponent, TitleComponent, CanvasRenderer]);

Expand Down Expand Up @@ -50,11 +50,14 @@ export class SankeyChartComponent {
const timeframe = this.timeframe();

this.isLoading.set(true);
this.statisticService.getWidgetData(this.widget().id, timeframe).then(response => {
const providerFn = mapToProvider<typeof response.payload>('sankey');
this.data.set(providerFn(response.payload, this.widget().title) as Partial<EChartsOption>);
this.isLoading.set(false);
});
this.statisticService
.getWidgetData(this.widget().id, timeframe)
.then(response => {
const providerFn = mapToProvider<typeof response.payload>('sankey');
this.data.set(providerFn(response.payload, this.widget().title) as Partial<EChartsOption>);
})
.catch(() => {})
.finally(() => this.isLoading.set(false));
});
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<section class="d-flex flex-column p-2 pb-0 p-sm-3 p-md-4 poisiton-relative" [class.gap-4]="editing()">
<ex-stat-card-list [data]="store.statCards()" [editing]="editing()" />
@if (store.statCards().length) {
<ex-stat-card-list [data]="store.statCards()" [editing]="editing()" />
}

<ex-chart-widget-list [data]="store.charts()" [editing]="editing()" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class StatisticsComponent implements HasChangesComponent {
readonly store = inject(WidgetStore);

private readonly chartWidgetList = viewChild.required(ChartWidgetListComponent);
private readonly statCardList = viewChild.required(StatCardListComponent);
private readonly statCardList = viewChild(StatCardListComponent);

editing = signal<boolean>(false);

Expand Down Expand Up @@ -78,7 +78,7 @@ export class StatisticsComponent implements HasChangesComponent {

const isStatCard = mapToExChartType(result.catalogItem.type) === 'statCard';
const nextFreePosition = isStatCard
? this.statCardList().getFirstPossiblePosition()
? (this.statCardList()?.getFirstPossiblePosition() ?? { cols: 1, rows: 1, x: 0, y: 0 })
: this.chartWidgetList().getFirstPossiblePosition();

await this.store.addWidget(result, nextFreePosition);
Expand Down
Loading