diff --git a/backend/exence/src/main/java/com/exence/finance/modules/statistics/repository/WidgetRepository.java b/backend/exence/src/main/java/com/exence/finance/modules/statistics/repository/WidgetRepository.java index 16cf930a..5b29861c 100644 --- a/backend/exence/src/main/java/com/exence/finance/modules/statistics/repository/WidgetRepository.java +++ b/backend/exence/src/main/java/com/exence/finance/modules/statistics/repository/WidgetRepository.java @@ -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; diff --git a/backend/exence/src/main/java/com/exence/finance/modules/statistics/service/impl/WidgetServiceImpl.java b/backend/exence/src/main/java/com/exence/finance/modules/statistics/service/impl/WidgetServiceImpl.java index e0e413f2..8771d608 100644 --- a/backend/exence/src/main/java/com/exence/finance/modules/statistics/service/impl/WidgetServiceImpl.java +++ b/backend/exence/src/main/java/com/exence/finance/modules/statistics/service/impl/WidgetServiceImpl.java @@ -62,7 +62,9 @@ private void init() { @Override public WidgetLayoutResponse getLayout() { - List widgets = widgetRepository.findAllWidgets(); + List widgets = widgetRepository.findAllWidgets().stream() + .filter(widget -> !widget.getType().equals(WidgetType.DASHBOARD_BALANCE_TREND)) + .toList(); return new WidgetLayoutResponse( widgetMapper.mapToStatCardDTOList( diff --git a/frontend/Exence/src/app/private/statistics/chart-widget-list/chart-widget-list.component.ts b/frontend/Exence/src/app/private/statistics/chart-widget-list/chart-widget-list.component.ts index 528790bf..85cfecd9 100644 --- a/frontend/Exence/src/app/private/statistics/chart-widget-list/chart-widget-list.component.ts +++ b/frontend/Exence/src/app/private/statistics/chart-widget-list/chart-widget-list.component.ts @@ -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'; @@ -28,6 +36,7 @@ export class ChartWidgetListComponent { options = signal({ gridType: GridType.VerticalFixed, + compactType: CompactType.CompactUpAndLeft, displayGrid: DisplayGrid.None, fixedRowHeight: 575, mobileBreakpoint: 768, diff --git a/frontend/Exence/src/app/private/statistics/chart-widget/chart-widget.component.ts b/frontend/Exence/src/app/private/statistics/chart-widget/chart-widget.component.ts index d24bd20c..43aa19d0 100644 --- a/frontend/Exence/src/app/private/statistics/chart-widget/chart-widget.component.ts +++ b/frontend/Exence/src/app/private/statistics/chart-widget/chart-widget.component.ts @@ -62,11 +62,14 @@ export class ChartWidgetComponent extends BaseComponent { return; } - this.statisticService.getWidgetData(this.widget().id, timeframe).then(response => { - const providerFn = mapToProvider(this.type()); - this.data.set(providerFn(response.payload, this.widget().title) as Partial); - this.isLoading.set(false); - }); + this.statisticService + .getWidgetData(this.widget().id, timeframe) + .then(response => { + const providerFn = mapToProvider(this.type()); + this.data.set(providerFn(response.payload, this.widget().title) as Partial); + }) + .catch(() => {}) + .finally(() => this.isLoading.set(false)); }); } diff --git a/frontend/Exence/src/app/private/statistics/sankey-chart/sankey-chart.component.ts b/frontend/Exence/src/app/private/statistics/sankey-chart/sankey-chart.component.ts index d6bec018..c2b554aa 100644 --- a/frontend/Exence/src/app/private/statistics/sankey-chart/sankey-chart.component.ts +++ b/frontend/Exence/src/app/private/statistics/sankey-chart/sankey-chart.component.ts @@ -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]); @@ -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('sankey'); - this.data.set(providerFn(response.payload, this.widget().title) as Partial); - this.isLoading.set(false); - }); + this.statisticService + .getWidgetData(this.widget().id, timeframe) + .then(response => { + const providerFn = mapToProvider('sankey'); + this.data.set(providerFn(response.payload, this.widget().title) as Partial); + }) + .catch(() => {}) + .finally(() => this.isLoading.set(false)); }); } } diff --git a/frontend/Exence/src/app/private/statistics/statistics.component.html b/frontend/Exence/src/app/private/statistics/statistics.component.html index 9e7acbb2..950b5dd8 100644 --- a/frontend/Exence/src/app/private/statistics/statistics.component.html +++ b/frontend/Exence/src/app/private/statistics/statistics.component.html @@ -1,5 +1,7 @@
- + @if (store.statCards().length) { + + } diff --git a/frontend/Exence/src/app/private/statistics/statistics.component.ts b/frontend/Exence/src/app/private/statistics/statistics.component.ts index fa2000e5..94345d28 100644 --- a/frontend/Exence/src/app/private/statistics/statistics.component.ts +++ b/frontend/Exence/src/app/private/statistics/statistics.component.ts @@ -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(false); @@ -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);